ProcessListener::ProcessListener(KProcess* proc) : QObject(), m_proc(proc) { connect(m_proc,SIGNAL(readyReadStandardOutput()), this, SLOT(slot_readyReadStandardOutput())); connect(m_proc,SIGNAL(readyReadStandardError()), this, SLOT(slot_readyReadStandardError())); }
void Main::init() { context.info("Initializing " + name); // Read and parse the "command" option. if (config.configOptionExists(name + ".command") > 0) { command = config.getConfigOptionList(name + ".command"); context.info(" - " + name + ".command = " + command.join(" ")); } // Read and parse the "interval" option. if (config.configOptionExists(name + ".interval") > 0) { try { interval = Tools::readInt(config.getConfigOption(name + ".interval")); context.info(" - " + name + ".interval = " + QString::number(interval)); } catch (const Exception &e) { context.report(Error::BAD_CONFIG, "option_format", name + ".init() failed: Could not parse the 'interval' option."); return; } } // Read and parse the "systemwide" option. if (config.configOptionExists(name + ".systemwide") > 0) { systemwide = config.getConfigOptionBool(name + ".systemwide"); context.info(" - " + name + ".systemwide = " + (systemwide ? "true" : "false")); } // Connect stdout and stderr of the the external data logger to our callbacks... connect(&process, SIGNAL(readyReadStandardOutput()), this, SLOT(slot_readyReadStandardOutput())); connect(&process, SIGNAL(readyReadStandardError()), this, SLOT(slot_readyReadStandardError())); // ... and start it. process.start(command.first(), command.mid(1)); // Wait for the data logger to be started before continuing. If startup fails, error out. if (!process.waitForStarted(-1)) { context.report(Error::BAD_CONFIG, "option_format", name + ".init() failed: Could not start the specified command."); return; } // Start the timer which counts the time since the program was started. running.start(); // Setup the timer which will periodically query the performance monitors and forward the data... connect(&timer, SIGNAL(timeout()), this, SLOT(slot_logDataPoint())); timer.setInterval(interval); // ... and start it. timer.start(); }
packageResultDialog::packageResultDialog( QWidget * parent, QStringList * files ) : QDialog(parent) { setupUi(this); packageFiles = files; packageInfoProcess = new QProcess(this); connect(packageInfoProcess,SIGNAL(readyReadStandardOutput()),this,SLOT(slot_readyReadStandardOutput())); connect(packageInfoProcess,SIGNAL(readyReadStandardError()),this,SLOT(slot_readyReadStandardError())); connect(packageInfoProcess,SIGNAL(finished(int, QProcess::ExitStatus)),this,SLOT(slot_processFinished())); fillTable(); if (tableWidget->rowCount() > 0){ tableWidget->setCurrentCell(0,0); slot_tableClicked(); } }
ThanksPage::ThanksPage( QWidget* parent ) : QWizardPage( parent ) { setTitle( tr(gtr( "Thanks" )) ); // setPixmap( QWizard::WatermarkPixmap, QPixmap( "magic.png" ) );//TODO QVBoxLayout* layout = new QVBoxLayout; setLayout( layout ); label = new QLabel(tr(gtr("The Network configuration complete.\nPlease continue to experience MagicLinux!\nThank you!\n\nNotice:\nPlease wait for your network restart when press the finish button, making your configuration to take effect."))); label->setWordWrap( true ); layout->addWidget( label ); progressBar = new QProgressBar(); progressBar->setValue(0); layout->addWidget(progressBar); systemOutput = new QTextEdit; layout->addWidget(systemOutput); process = new QProcess(this); connect(process,SIGNAL(readyReadStandardOutput()),this,SLOT(slot_readyReadStandardOutput())); connect(process,SIGNAL(readyReadStandardError()),this,SLOT(slot_readyReadStandardError())); connect(process,SIGNAL(finished(int)),this, SLOT(slot_finished(int))); }