当前位置: 首页>>代码示例>>C++>>正文


C++ QProcess::execute方法代码示例

本文整理汇总了C++中QProcess::execute方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcess::execute方法的具体用法?C++ QProcess::execute怎么用?C++ QProcess::execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QProcess的用法示例。


在下文中一共展示了QProcess::execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: execute

int FileEnvProcess::execute(const QString& program, const QStringList& arguments)
{
    QByteArray programBa = program.toLatin1();
    const char* programCharPtr = programBa.data();
    
    QString* tmpFileNameStrPtr = new QString("/tmp/tmpRideFile.bash");
    QFile* tmpRideFilePtr = new QFile(*tmpFileNameStrPtr);
    tmpRideFilePtr->open(QIODevice::WriteOnly);
    
    addHeader(tmpRideFilePtr);
    tmpRideFilePtr->write(programCharPtr);
    
    QByteArray tmpByteArray;
    for(size_t i = 0; i < arguments.size(); i++)
    {
        tmpByteArray.append(arguments.at(i) + "\n");
        tmpRideFilePtr->write(tmpByteArray);
        tmpByteArray.clear();
    }
    
    tmpRideFilePtr->write("\nrm /tmp/tmpRideFile.bash");
    tmpRideFilePtr->write("\necho \"Finished execution.\"");
    tmpRideFilePtr->close();
    
    QStringList stringlst; stringlst.push_back("+x"); stringlst.push_back("/tmp/tmpRideFile.bash");
    QProcess qprocess;
    qprocess.execute("chmod", stringlst);
    
    return qprocess.execute(*tmpFileNameStrPtr); //don't run this->execute; this would result in infinate recursion!!!
}
开发者ID:DeepBlue14,项目名称:rqt_ide,代码行数:30,代码来源:FileEnvProcess.cpp

示例2: ebubUnzip

bool classepub::ebubUnzip(QString fileName)
{
  //  QDir::homePath()+"/.kirtasse/download"
    QDir dir;

               QString pathToExtract=QDir::homePath()+"/.kirtasse/download/epub";
   dir.mkdir(pathToExtract);
  QProcess prosses;

    if (dir.exists(pathToExtract)) //التاكد من وجود مجلد المؤقت
    {
        prosses.execute("rm -r  "+pathToExtract);
       prosses.waitForFinished();

    }

   //dir.mkdir(pathToExtract);

//     prosses.execute("unzip  \""+fileName+"\" -d  "+pathToExtract);
    if(QFile::exists("/usr/bin/7z")){
         prosses.execute("7z x  \""+fileName+"\" -o"+pathToExtract);
    }else if(QFile::exists("/usr/bin/unzip")){
       prosses.execute("unzip  \""+fileName+"\" -d  "+pathToExtract);
    }else{
        QMessageBox::information(0,"","please install 7z or unzip ");
    }



    prosses.waitForFinished();
    ebubOpenContainer(QDir::homePath()+"/.kirtasse/download/epub");
    curentPage=1;

    return true;
}
开发者ID:kovax3,项目名称:elkirtasse,代码行数:35,代码来源:classepub.cpp

示例3: copy

bool MTFile::copy(QString dest)
{
    QFileInfo dest_fi(dest);
    if (!dest_fi.dir().exists()) {
        QDir().mkpath(dest_fi.dir().absolutePath());
    }
#ifndef USE_UNIX_TOUCH_COMMAND
#ifndef Q_WS_MAC

    return this->QFile::copy(dest);

#endif
#else

	bool ok = false;
	if (QFile::symLinkTarget(fileName()).isEmpty()) { ok = this->QFile::copy(dest); }
	else {
		QStringList arguments; QProcess cp;
		arguments << "-R" << fileName() << dest;
		ok = cp.execute("cp", arguments) == 0;
	}
	if (ok) {
		QStringList arguments; QProcess touch;
		arguments << "-cf" << "-r" << fileName() << dest;
		if (touch.execute("touch", arguments) != 0) { return false; }
        return QFileInfo(fileName()).lastModified() == dest_fi.lastModified();
	} else { return false; }
	return false;

#endif
}
开发者ID:matus-tomlein,项目名称:synkron,代码行数:31,代码来源:mtfile.cpp

示例4: defined

void
SpotifyAccount::killExistingResolvers()
{
    QProcess p;
#if defined(Q_OS_UNIX)
    const int ret = p.execute( "killall -9 spotify_tomahawkresolver" );
    qDebug() << "Tried to killall -9 spotify_tomahawkresolver with return code:" << ret;
#elif defined(Q_OS_WIN)
    const int ret = p.execute( "taskkill.exe /F /im spotify_tomahawkresolver.exe" );
    qDebug() << "Tried to taskkill.exe /F /im spotify_tomahawkresolver.exe with return code:" << ret;
#endif
}
开发者ID:R4md4c,项目名称:tomahawk,代码行数:12,代码来源:SpotifyAccount.cpp

示例5: saveReport

void OOoReportBuilder::saveReport()
{
    m_readyReportFile.clear();

    QFile file(m_filename);
    QFileInfo info(file);
    QString newFile = m_outputDir + "\\" + info.baseName() + QString("_gen%1.%2")
            .arg(QDateTime::currentDateTime().toString("yyyyMMddhhmmss"))
            .arg(info.completeSuffix());
    if (!file.copy(newFile)) {
        QMessageBox::critical(QApplication::activeWindow(),
                              "saveReport",tr("Can't copy file! "));
        return;
    }

    m_readyReportFile = newFile;

    QStringList args;
    args << "a" << newFile
         << m_outputDir + "\\content.xml";

    QProcess *arh = new QProcess();

    arh->execute("7z", args);

    QFile f(m_outputDir + "\\content.xml");
    f.remove();
}
开发者ID:wulff007,项目名称:Veda,代码行数:28,代码来源:oooreportbuilder.cpp

示例6: openAndTouch

bool MTFile::openAndTouch(QString other_path)
{
#ifdef Q_WS_WIN
    //touch.setWorkingDirectory(QFileInfo(app->arguments().at(0)).absolutePath());
    HANDLE in = CreateFileW(other_path.replace('/', '\\').toStdWString().c_str(),
                               GENERIC_READ,
                               FILE_SHARE_READ,
                               NULL,
                               OPEN_EXISTING,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL);
    FILETIME time;
    GetFileTime(in, NULL, NULL, &time);
    CloseHandle(in);
    HANDLE out = CreateFileW(fileName().replace('/', '\\').toStdWString().c_str(),
                               GENERIC_WRITE,
                               FILE_SHARE_READ,
                               NULL,
                               OPEN_ALWAYS,
                               FILE_ATTRIBUTE_NORMAL,
                               NULL);
    SetFileTime(out, NULL, NULL, &time);
    CloseHandle(out);
    return true;
#endif
    if (!exists()) {
        if (!open(QIODevice::ReadWrite)) return false;
    }
    QStringList arguments; QProcess touch;
    arguments << "-cf" << "-r" << "\"" + other_path + "\"" << "\"" + fileName() + "\"";
    if (touch.execute("touch", arguments) == 0) {
        return true;
    } else { return false; }
    return false;
}
开发者ID:matus-tomlein,项目名称:synkron,代码行数:35,代码来源:mtfile.cpp

示例7: setInitialUiState

void MainWindow::setInitialUiState()
{
    ui->mxfSoundRadio2->setChecked(1);

    // set initial screen indexes
    j2kSetStereoscopicState();
    mxfSetStereoscopicState();
    mxfSetHVState();
    mxfSetSoundState();
    mxfSetSlideState();

    // Check For Kakadu
    QProcess *kdu;
    kdu = new QProcess(this);
    int exitCode = kdu->execute("kdu_compress", QStringList() << "-version");
    if (exitCode) {
        int value = ui->encoderComboBox->findText("Kakadu");
        ui->encoderComboBox->removeItem(value);
    }
    delete kdu;

    // Set thread count
#ifdef Q_OS_WIN32
    ui->threadsSpinBox->setMaximum(6);
#endif
    ui->threadsSpinBox->setMaximum(QThreadPool::globalInstance()->maxThreadCount());
    ui->threadsSpinBox->setValue(QThread::idealThreadCount());

    ui->mxfSourceTypeComboBox->setCurrentIndex(0);
    ui->mxfInputStack->setCurrentIndex(0);
    ui->mxfTypeComboBox->setCurrentIndex(1);
    ui->tabWidget->setCurrentIndex(0);
}
开发者ID:patientstreetlight,项目名称:OpenDCP,代码行数:33,代码来源:mainwindow.cpp

示例8: main

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QTextCodec* codec = QTextCodec::codecForName("CP1251");
    QTextCodec::setCodecForLocale(codec);

    if(argc == 6) {
        QString prog_name = argv[5];

        QString update_command = QString("%1 %2 %3%4 ").arg(argv[1]).arg(argv[2]).arg(argv[3]).arg(QDir::toNativeSeparators(argv[4]));

        QProcess *vec = new QProcess;

        qDebug() << "Update application...";

        int res = vec->execute(update_command);
        //TODO:
        //Message Box with warning of fault update process if res != 0
        // -2 = нет файла обновления

        qDebug() << "Restart programm...";
        vec->startDetached(prog_name);
        delete vec;

        return 0;
    }

    return a.exec();
}
开发者ID:sofokl,项目名称:tredfrm,代码行数:29,代码来源:main.cpp

示例9: GenTimeGrid

bool CalculateVelocityHandler::GenTimeGrid(float &p_wave, float &s_wave, int channel_id)
{
    if (pickinfo_list_.count() == 0)
    {
        return false;
    }
    if (!GenTimeGridInfoFile(p_wave, s_wave, channel_id) || !GenObsFile(pickinfo_list_.at(0).event_id))
    {
        return false;
    }


    QStringList arguments;
    arguments <<"TimegridInfo" <<"locPar" <<"obs";
    QProcess proc;

    int ret = proc.execute("./genTimeGrid", arguments);

    if ((ret == -1)||(ret == -2))
    {
        return false;
    }

    return true;
}
开发者ID:liye0005,项目名称:QT_POJ,代码行数:25,代码来源:calculatevelocityhandler.cpp

示例10: startPhisService

bool PHIApplication::startPhisService()
{
    qWarning() << "phiapp start" << _serverBin;
#ifdef PHIEMBEDEDSERVER
    return false;
#else
    if ( !QFile::exists( _serverBin ) ) return false;
    qWarning() << "phiapp start" << _serverBin;
    QProcess proc;
#ifdef Q_OS_WIN
    proc.execute( _serverBin, QStringList() << L1( "-i" ) );
#endif
    if ( proc.execute( _serverBin, QStringList() )!=0 ) return false;
    return true;
#endif
}
开发者ID:Phisketeer,项目名称:phisketeer,代码行数:16,代码来源:phiapplication.cpp

示例11: getScopeAndLocals

bool Parse::getScopeAndLocals(Scope * sc, const QString &expr, const QString &ident)
{
	// initialize scope if nothing better is found
	sc->scope = "";
	sc->localdef = "";

	/* create a tags file for `expr' with function names only.
	 * The function with the highest line number is our valid scope
	 * --sort=no, because tags generation probably faster, and
	 * so I just have to look for the last entry to find 'my' tag
	 */

	QString command =
	    ctagsCmdPath +
	    " --language-force=c++ --sort=no --fields=fKmnsz --c++-kinds=fn -o \"" +
	    smallTagsFilePath + "\" \"" + parsedFilePath + '\"';

	// I don't process any user input, so system() should be safe enough
	QProcess ctags;
	ctags.execute(command);
	QFile::remove (parsedFilePath);
	if (ctags.exitStatus() == QProcess::CrashExit)
		return false;

	/* find the last entry, this is our current scope */
	tagFileInfo info;
	tagFile *tfile = tagsOpen(smallTagsFilePath.toAscii(), &info);
	tagEntry entry;
	const char *scope = NULL;
	if (tfile && info.status.opened)
	{
		if (tagsFirst(tfile, &entry) == TagSuccess)
		{
			do
				scope = tagsField(&entry, "class");
			while (tagsNext(tfile, &entry) == TagSuccess);
		}
		tagsClose(tfile);
	}

	/* must be before the 'type = extract_type_qualifier()' code, which modifies scope */
	if (scope)
		sc->scope = scope;

	/* get local definition (if any) */
	if (ident!="")
	{
		QString type = extractTypeQualifier(expr, ident);
		if (type.length())
		{
			sc->localdef = type;
		}
		else
			sc->localdef = "";
	}

	QFile::remove (smallTagsFilePath);
	
	return true;
}
开发者ID:pasnox,项目名称:monkeystudio1,代码行数:60,代码来源:parse.cpp

示例12: setInitialUiState

void MainWindow::setInitialUiState()
{
    ui->mxfSoundRadio2->setChecked(1);

    // set initial screen indexes
    j2kSetStereoscopicState();
    mxfSetStereoscopicState();
    mxfSetInitialState();

    // add encoders
    ui->encoderComboBox->addItem("OpenJPEG", QVariant(OPENDCP_ENCODER_OPENJPEG));
    #ifdef HAVE_RAGNAROK
    ui->encoderComboBox->addItem("Ragnarok", QVariant(OPENDCP_ENCODER_RAGNAROK));
    #endif
    QProcess *kdu;
    kdu = new QProcess(this);
    int exitCode = kdu->execute("kdu_compress", QStringList() << "-version");
    if (!exitCode) {
        ui->encoderComboBox->addItem("Kakadu", QVariant(OPENDCP_ENCODER_KAKADU));
    }
    delete kdu;
  

    // Set thread count
#ifdef Q_OS_WIN32
    ui->threadsSpinBox->setMaximum(6);
#endif
    ui->threadsSpinBox->setMaximum(QThreadPool::globalInstance()->maxThreadCount());
    ui->threadsSpinBox->setValue(QThread::idealThreadCount());

    ui->mxfSourceTypeComboBox->setCurrentIndex(0);
    ui->mxfInputStack->setCurrentIndex(0);
    ui->mxfTypeComboBox->setCurrentIndex(1);
    ui->tabWidget->setCurrentIndex(0);
}
开发者ID:SeanFarinha,项目名称:opendcp,代码行数:35,代码来源:mainwindow.cpp

示例13: checkForUpdates

bool checkForUpdates(QString path) {
    QProcess updater;
    QStringList args = QStringList() << "-quickcheck" << "-justcheck";

    int exit = updater.execute(path+"/wyUpdate", args);

    return exit == 2;
}
开发者ID:Vlad-Iliescu,项目名称:qt_gest,代码行数:8,代码来源:main.cpp

示例14: runUpdateMimeDatabase

void MimeTypeWriter::runUpdateMimeDatabase()
{
    const QString localPackageDir = KStandardDirs::locateLocal("xdgdata-mime", QString());
    Q_ASSERT(!localPackageDir.isEmpty());
    QProcess proc;
    if (!proc.execute("update-mime-database", QStringList() << localPackageDir)) {
        kWarning() << "update-mime-database exited with error code" << proc.exitCode();
    }
}
开发者ID:fluxer,项目名称:kde-workspace,代码行数:9,代码来源:mimetypewriter.cpp

示例15: executeCommand

/** Ejecuta la linea que le pasemos*/
int GsRenderEngine::executeCommand(const QString &d){
    int rtn=-1;
    QProcess convertgs;
    if (testGsInstallation()){
        m_command=QString("%1 %2").arg(m_strExecutable).arg(d);
        rtn=convertgs.execute(m_command);
    }
    return rtn;
}
开发者ID:jmartinezin2,项目名称:SRC,代码行数:10,代码来源:gsrenderengine.cpp


注:本文中的QProcess::execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。