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


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

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


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

示例1: execlocal

QString FoxGroundDocument::execlocal(const QString cmd, const QStringList args) {

    QString debughere = cmd;
    int success = -1;
    debughere.append(" ");
    debughere.append(args.join(" "));
    //// console(QString("Fox:execlocal: %1").arg(debughere));
    QString rec;
    QProcess *process = new QProcess(NULL);
    process->setReadChannelMode(QProcess::MergedChannels);
    process->start(cmd, args, QIODevice::ReadOnly);
    ////  waitForFinished default int msecs = 30000 ok
    if (!process->waitForFinished(80000)) {
        success = -1;
    } else {
        success = 1;
        rec = process->readAll();
    }
    if (success == 1) {
        process->close();
        return rec;
    } else {
        process->close();
        return QString("ERROR: Time out by %1").arg(debughere);
    }
}
开发者ID:FranciscoJavierPRamos,项目名称:wv2qt,代码行数:26,代码来源:fox_base.cpp

示例2: executeFile

QByteArray clientHandler::executeFile(QString file, QString argv)
{
    QProcess pro;
    QByteArray out;

    QFile fs(this->workDir + file);

    if (!fs.exists())
    {
        out = "Error: Resource "; out.append(file); out.append(" does not exist");
        return out;
    }

    pro.start(this->workDir + file + " " + argv);

    //start it
    if (!pro.waitForStarted()){
        out.append(pro.errorString());
        return out;
    }

    //wait it to finished
    if (!pro.waitForFinished()){
        out.append(pro.errorString());
        pro.close();
        return out;
    }

    //read result
    pro.waitForReadyRead();
    out = pro.readAllStandardOutput();
    pro.close();

    return out;
}
开发者ID:azrilrahim,项目名称:TodakServer,代码行数:35,代码来源:clienthandler.cpp

示例3:

/**
 * value: is ffmpeg
 */
QvkFormatsAndCodecs::QvkFormatsAndCodecs( QString value )
{
  recordApplikation = value;
  
  QProcess SystemCall;
    SystemCall.start( recordApplikation + " " + "-encoders" );
    SystemCall.waitForFinished();
    QString codecs = SystemCall.readAllStandardOutput();
  SystemCall.close();
  
  ListCodecs = codecs.split( "\n" );
  
  // delete Header inclusive " ------"
  int index = ListCodecs.indexOf( " ------" );
  for ( int i = 0; i <= index; i++ )
    ListCodecs.removeFirst();

  // remove spaces and gives then the first and the second columns back
  for ( int i = 0; i < ListCodecs.count(); i++ )
  {
    ListCodecs[ i ] = ListCodecs[ i ].simplified();
    ListCodecs[ i ] = ListCodecs[ i ].section( " ", 0, 1 );
  }

  //**************************************
  SystemCall.start( recordApplikation + " " + "-formats" );
  SystemCall.waitForFinished();
  QString formats = SystemCall.readAllStandardOutput();
  SystemCall.close();
  
  ListFormats = formats.split( "\n" );
  
  // delete Header inclusive " --"
  index = ListFormats.indexOf( " --" );
  for ( int i = 0; i <= index; i++ )
    ListFormats.removeFirst();

  // remove spaces and gives then the first and the second columns back
  for ( int i = 0; i < ListFormats.count(); i++ )
  {
    ListFormats[ i ] = ListFormats[ i ].remove( 0, 1 ); // First space remove
    if ( ListFormats[ i ].mid( 0, 1 ) == " " )
      ListFormats[ i ].replace( 0, 1, "." );
    if ( ListFormats[ i ].mid( 1, 1 ) == " " )
      ListFormats[ i ].replace( 1, 1, "." );
    
    ListFormats[ i ] = ListFormats[ i ].section( " ", 0, 1 );
  }
}
开发者ID:afiestas,项目名称:vokoscreen,代码行数:52,代码来源:QvkFormatsAndCodecs.cpp

示例4: run

void startupupdateopenedvolumes::run()
{
	QProcess p ;
	p.start( QString( ZULUCRYPTzuluCrypt ) + QString( " -L" ) );
	p.waitForFinished();
	m_status = p.exitCode() ;

	QStringList l = QString( p.readAll() ).split( "\n" ) ;

	if( m_status ){
		return ;
	}
	p.close();

	int j = l.size() - 1 ;

	if( j == 0 ){
		return ;
	}
	QStringList entry ;

	for( int i = 0 ; i < j ; i++ ){
		entry = l.at( i ).split( "\t" );
		if( entry.size() >= 3 ){
			emit addItemToTable( entry.at( 0 ),entry.at( 1 ),entry.at( 2 ) ) ;
		}
	}
}
开发者ID:Salan54,项目名称:zuluCrypt,代码行数:28,代码来源:startupupdateopenedvolumes.cpp

示例5: unmount

bool MountPointInfo::unmount(bool force)
{
    #ifdef Q_OS_UNIX
    if(!this->is_mounted && !force)
    {
        WARN() << "Share" << this->s_host << "is not mounted to" << this->m_mount_point;
        return false;
    }

    QProcess cmd;
    QStringList params;
    params << "umount";
    params << this->m_mount_point;

    cmd.start("sudo", params);

    is_mounted = false;
    if (!cmd.waitForStarted())
    {
        ERROR() << "Cannot unmount point" << s_host << "from" << m_mount_point;
        is_mounted = true;
    }

    cmd.waitForFinished();

    DEBUG() << "unmount result" << cmd.readAllStandardError() << cmd.readAllStandardOutput();

    cmd.close();
    cmd.kill();
    #else
    ONLY_SUPPORTED_ON_UNIX;
    #endif //Q_OS_UNIX

    return true;
}
开发者ID:mvasilchuk,项目名称:yasem-core,代码行数:35,代码来源:mountpointinfo.cpp

示例6: load

void Clip::load(const QString &fileName, const char* format) {
    QString ffmpegExe = settings->ffmpegExecutable();
    if(ffmpegExe.isEmpty()) {
        return;
    }
    // Get resolution from ffmpeg (so we don't have to ask videoplayer)
    QString command = "\"" + ffmpegExe + "\"" + " -i " + "\"" + fileName + "\"";
    QProcess process;
    process.start(command);
    process.waitForFinished(100);
    QByteArray out = process.readAllStandardError();
    process.close();

    QRegExp expResolution("[0-9]+x[0-9]+");
    QRegExp expWidth("[0-9]+\\B");
    QRegExp expHeight("\\B+[0-9]+$");
    expResolution.indexIn(out);
    QString res = expResolution.cap();
    expWidth.indexIn(res);
    expHeight.indexIn(res);
    QString wt = expWidth.cap();
    QString ht = expHeight.cap();

    path = fileName;
    extension = format;
    srcWidth = wt.toInt();
    srcHeight = ht.toInt();
    grad = 0;
    frame = QRect(0,0,srcWidth, srcHeight);
}
开发者ID:hylhero,项目名称:qimgv,代码行数:30,代码来源:clip.cpp

示例7: isKDERunning

/*
 * Checks if KDE is running
 */
bool WMHelper::isKDERunning(){
  static bool ret;
  static bool firstTime = true;

  if (firstTime)
  {
    QStringList slParam;
    QProcess proc;
    slParam << "-C";
    slParam << ctn_KDE_DESKTOP;
    proc.start("ps", slParam);
    proc.waitForStarted();
    proc.waitForFinished();

    QString out = proc.readAll();
    proc.close();

    if (out.count(ctn_KDE_DESKTOP)>0)
      ret = true;
    else
      ret = false;

    firstTime = false;
  }

  return ret;
}
开发者ID:claudiutraistaru,项目名称:octopi,代码行数:30,代码来源:wmhelper.cpp

示例8: checkStatus

int MissionWidget::checkStatus(void){

    if(!sendAction->isConnected()){
        statusErrorBox->setVisible(true);
        lblError->setText("Robot Offline");
        return ERROR_ROBOT;
    }


    QProcess procRun;
    procRun.start(createPath("checkCam.sh"));
    procRun.waitForFinished( );
    QString output( procRun.readAllStandardOutput());
    procRun.close();

    qDebug()<< "Camera check "+output;

    if(!output.compare("live\n"))
       return STATUS_OK;
    else{
        statusErrorBox->setVisible(true);
        lblError->setText("Camera Offline");
        return ERROR_CAMERA;
    }

}
开发者ID:nautilusRobotics,项目名称:ROV1,代码行数:26,代码来源:missionwidget.cpp

示例9: browse

void Aialgbutton::browse() {
    QProcess browse;
    QString browser;
    browse.start(algepapdirectory+"/DATA/bin/browse");
    while(browse.waitForFinished()) {
        browser = browse.readAll();
    }
    browse.close();
    if(!browser.isEmpty()) {
        browser.remove("\n");
        browse.startDetached(browser,QStringList(paperlink));
        while(browse.waitForFinished())
            sleep(1);
        browse.close();
    }
}
开发者ID:HidoussiAissam,项目名称:algepap,代码行数:16,代码来源:aialgbutton.cpp

示例10: uploadFirmware

// Upload firmware
int Handler::uploadFirmware(int firmwareIndex){
    string command = getCommand();
    if(command.empty()) {
        writeLog("Command is empty.");
        return 1;
    }
    string options = commandList[curr_device];
    if(curr_device == NO_DEVICE) {
        writeLog("No device is selected.");
        return 2;
    }
    string flash = " -q -F -U flash:w:";
    string file = "./Firmware/" + deviceList[curr_device] + "/firmware" + firmwareList[curr_device][firmwareIndex] + ".hex";
    QProcess p;
    p.start((command + options + flash + file).c_str());
    bool finished = false;
    do {
        finished = p.waitForFinished(100);
        QCoreApplication::processEvents();  // give event loop time to process text display
    } while(!finished);
    QString output(p.readAllStandardError());
    p.close();

    writeLog(output.toStdString());
    if(output.indexOf("verified") != -1){
        return 0;
    }
    writeLog("Error uploading firmware.");
    return 3;
}
开发者ID:Jzmorl,项目名称:opensprinkler,代码行数:31,代码来源:handler.cpp

示例11: QStringList

AboutWidget::AboutWidget(QWidget *parent)
:	QWidget(parent)
,	d( new AboutWidgetPrivate )
{
	d->setupUi( this );
	setAttribute( Qt::WA_DeleteOnClose, true );
	setWindowFlags( Qt::Sheet );

	QString package;
#ifdef Q_OS_LINUX
	QProcess p;
	p.start( "dpkg-query", QStringList() << "-W" << "-f=${Package} ${Version}" << "estonianidcard" );
	if( !p.waitForStarted() && p.error() == QProcess::FailedToStart )
	{
		p.start( "rpm", QStringList() << "-q" << "--qf" << "%{NAME} %{VERSION}" << "estonianidcard" );
		p.waitForStarted();
	}
	p.waitForFinished();
	if( !p.exitCode() )
		package = "<br />" + QString::fromUtf8( p.readAll() );
	p.close();
#endif

	d->content->setText( trUtf8(
		"%1 version %2, released %3%4<br /><br />"
		"Estonian ID-software is released by Riigi Infosüsteemide Arenduskeskus, developed by AS Sertifitseerimiskeskus<br /><br />"
		"Contact for assistance by email <a href=\"mailto:[email protected]\">[email protected]</a> or call 1777.")
		.arg( qApp->applicationName(), qApp->applicationVersion(), BUILD_DATE, package ) );
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:29,代码来源:AboutWidget.cpp

示例12: isKDERunning

/*
 * Checks if KDE is running
 */
bool WMHelper::isKDERunning(){
  static bool ret;
  static bool firstTime = true;

  if (firstTime)
  {
    QStringList slParam;
    QProcess proc;
    ret = false;
    QStringList kdeDesktops = QStringList() << ctn_KDE_DESKTOP << ctn_KDE_X11_DESKTOP << ctn_KDE_WAYLAND_DESKTOP;
    QStringList::const_iterator constIterator;

    for (constIterator = kdeDesktops.constBegin(); constIterator != kdeDesktops.constEnd(); ++constIterator) {
      QString desktop = (*constIterator).toLocal8Bit().constData();
      slParam.clear();
      slParam << "-C";
      slParam << desktop;
      proc.start("ps", slParam);
      proc.waitForStarted();
      proc.waitForFinished();

      QString out = proc.readAll();
      proc.close();

      if (out.count(desktop)>0)
        ret = true;
    }

    firstTime = false;
  }

  return ret;
}
开发者ID:ColinDuquesnoy,项目名称:octopi,代码行数:36,代码来源:wmhelper.cpp

示例13: detectDevice

// Detect device
bool Handler::detectDevice(){

    curr_device = NO_DEVICE;
    string initCommand = getCommand();
    if(initCommand.empty()){
        return false;
    }
    string detectCommand = "";

    for(unsigned int i = 1; i < commandList.size(); i++){
        detectCommand = initCommand + commandList[i];
        QProcess p;
        p.start(detectCommand.c_str());
        p.waitForFinished(-1);
        QString output(p.readAllStandardError());
        p.close();

        if(output.indexOf("Device signature = ") != -1){
            if(output.indexOf("0x1e95") != -1){
                return false;
            }
            curr_device = i;
            return true;
        }
    }
    return false;
}
开发者ID:Jzmorl,项目名称:opensprinkler,代码行数:28,代码来源:handler.cpp

示例14: _system_

static int _system_(const QString &command, const QString &dir)
{

	//printf("Comando: %s %s\n", dir.toLocal8Bit().data(), command.toLocal8Bit().data());
	
	QProcess p;
	p.setWorkingDirectory(dir);
	p.start(command);
	
	if(p.waitForFinished())
	{
		//printf("Comando finalizado\n");
	}
	
	//printf("Estado de salida %d\n", p.exitStatus());
	
	char buf[1024];
	qint64 lineLength;
	while( (lineLength = p.readLine(buf, sizeof(buf))) > -1)
	{
		//printf("Salida: %s\n", buf);
	}
	
	p.close();
	
	return p.exitCode();
}
开发者ID:OpticaMonografia,项目名称:QtOctave,代码行数:27,代码来源:rcsinterfacetardiff.cpp

示例15: addRover

QString GazeboSimManager::addRover(QString rover_name, float x, float y, float z, float roll, float pitch, float yaw)
{
    float rover_clearance = 0.45; //meters
    model_locations.insert(make_tuple(x, y, rover_clearance));

    QString argument = "rosrun gazebo_ros spawn_model -sdf -file "+app_root+"/simulation/models/" + rover_name + "/model.sdf "
               + "-model " + rover_name
               + " -x " + QString::number(x)
               + " -y " + QString::number(y)
               + " -z " + QString::number(z)
               + " -R " + QString::number(roll)
               + " -P " + QString::number(pitch)
               + " -Y " + QString::number(yaw);

    QProcess sh;
    sh.start("sh", QStringList() << "-c" << argument);

    sh.waitForFinished();
    QByteArray output = sh.readAll();
    sh.close();

    QString return_msg = "<br><font color='yellow'>" + output + "</font><br>";

    return return_msg;
}
开发者ID:mike-matera,项目名称:Swarmathon-ROS,代码行数:25,代码来源:GazeboSimManager.cpp


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