void ConnectionTesterModel::setConnectionTester(ConnectionTester *connectionTester) { if (m_connectionTester == connectionTester) { return; } if (m_connectionTester) { disconnect(m_connectionTester, SIGNAL(started()), this, SLOT(onStarted())); disconnect(m_connectionTester, SIGNAL(finished()), this, SLOT(onFinished())); disconnect(m_connectionTester, SIGNAL(checkStarted(ConnectionTester::TestType)), this, SLOT(onCheckStarted(ConnectionTester::TestType))); disconnect(m_connectionTester, SIGNAL(checkFinished(ConnectionTester::TestType, bool, QVariant)), this, SLOT(onCheckFinished(ConnectionTester::TestType, bool, QVariant))); } m_connectionTester = connectionTester; if (m_connectionTester) { connect(m_connectionTester, SIGNAL(started()), this, SLOT(onStarted())); connect(m_connectionTester, SIGNAL(finished()), this, SLOT(onFinished())); connect(m_connectionTester, SIGNAL(checkStarted(ConnectionTester::TestType)), this, SLOT(onCheckStarted(ConnectionTester::TestType))); connect(m_connectionTester, SIGNAL(checkFinished(ConnectionTester::TestType, bool, QVariant)), this, SLOT(onCheckFinished(ConnectionTester::TestType, bool, QVariant))); } }
void DefaultSimSubpanel::onRunPressed() { //disable buttons and menu left->ui->runButton->setEnabled(false); right->ui->widSimStyle->setVisible(false); //delete custom plot delete left->customPlot; left->customPlot = new QCustomPlot(); showCustomPlot(false); portsToPlot.erase(portsToPlot.begin(), portsToPlot.end()); //delte simulation thread delete sim_process; sim_process = new DefaultSimSubpanelThread(); sim_process->init(mvpm, mpkg); //delete set delete thread; thread = new QThread(); //move to thread sim_process->moveToThread(thread); connect(thread, SIGNAL(started()), sim_process, SLOT(onStarted())); connect(sim_process, SIGNAL(simulationFinished()), this, SLOT(onSimulationFinished())); thread->start(); }
int ItemSequencerI::onNotify(int msg, int param1, int param2) { switch (msg) { case SEQNOTIFY_ONREGISTER: return onRegister(); case SEQNOTIFY_ONDEREGISTER: return onDeregister(); case SEQNOTIFY_ONNEXTFILE: return onNextFile(); case SEQNOTIFY_ONTITLECHANGE: return onTitleChange(); case SEQNOTIFY_ONSTARTED: return onStarted(); case SEQNOTIFY_ONSTOPPED: return onStopped(); case SEQNOTIFY_ONPAUSED: return onPaused(); case SEQNOTIFY_ONUNPAUSED: return onUnpaused(); } return 0; }
TorInstanceImpl(const TorSettings* settings): settings_(settings), locationFinder_(settings_), control_(settings_) { connect(&launcher_, SIGNAL(started()), SLOT(onStarted())); connect(&control_, SIGNAL(connected()), SLOT(onConnected())); connect(&control_, SIGNAL(newIdentity()), SLOT(onNewIdentity())); connect(&locationFinder_, SIGNAL(locationFound(QString,QString,QString,QPixmap)), SLOT(onLocationFound(QString,QString,QString,QPixmap))); control_.connectToTor(); }
void tcClientCtrl::initialize(QString config_file) { gst_init(NULL, NULL); msConfigFile = config_file; mpTray = new tcSystemTray(this); mpTray->initialize(); connect(this, SIGNAL(started()), mpTray, SLOT(onStarted())); connect(this, SIGNAL(stopped()), mpTray, SLOT(onStopped())); mpTray->writeToolTip("Addintool: Stopped"); start(); qDebug() << "tcClientCtrl Initialized"; }
FileUploader::FileUploader(MtpObjectsModel * model, QObject *parent) : QObject(parent), _model(model), _aborted(false) { _worker = new CommandQueue(_model); _worker->moveToThread(&_workerThread); connect(&_workerThread, SIGNAL(finished()), SLOT(deleteLater())); connect(this, SIGNAL(executeCommand(Command*)), _worker, SLOT(execute(Command*))); connect(_worker, SIGNAL(progress(qint64)), SLOT(onProgress(qint64))); connect(_worker, SIGNAL(started(QString)), SLOT(onStarted(QString))); connect(_worker, SIGNAL(finished()), SLOT(onFinished())); _workerThread.start(); }
void SpringLayoutUi::onStartStop() { m_ui.btnStartStop->setEnabled(false); if (m_thread == NULL) { emit runningChanged(true); m_thread = new WorkerThread(m_layout, 100 - m_ui.sldSpeed->value(), this); m_thread->connect(m_thread, SIGNAL(started()), this, SLOT(onStarted())); m_thread->connect(m_thread, SIGNAL(finished()), this, SLOT(onStopped())); m_thread->start(); } else { static_cast<WorkerThread*>(m_thread)->stop(); m_thread->wait(); m_thread = NULL; } }
execWindow::execWindow(QWidget *parent, const QString& info) : QDialog(parent), m_ui(new Ui::execWindow) { m_ui->setupUi(this); m_proc = new QProcess(this); m_proc->setProcessChannelMode(QProcess::MergedChannels); connect(m_proc,SIGNAL(started()),this,SLOT(onStarted())); connect(m_proc,SIGNAL(error(QProcess::ProcessError)),this,SLOT(onError(QProcess::ProcessError))); connect(m_proc,SIGNAL(finished(int,QProcess::ExitStatus)),this,SLOT(onFinished(int))); connect(m_proc,SIGNAL(readyReadStandardOutput()),this,SLOT(onDataReady()) ); if(info.isEmpty()) m_ui->plainTextEdit->appendHtml(tr("<font color=gray>Sony PlayStation3 HD Movie Muxer<br>Copyright (C) 2011 Anton Burdinuk<br>[email protected]<br>http://code.google.com/p/tsdemuxer<br>---------------------------------------------------<br><br></font>")); else m_ui->plainTextEdit->appendHtml(info); }
NetworkControl::NetworkControl() { client = new Client(); QObject::connect(client, SIGNAL(connected()), this, SLOT(onConnected())); QObject::connect(client, SIGNAL(hostFound()), this, SLOT(onHostFound())); QObject::connect(client, SIGNAL(loggingIn()), this, SLOT(onLoggingIn())); QObject::connect(client, SIGNAL(successfullJoin()), this, SLOT(onConnectionAccepted())); QObject::connect(client, SIGNAL(disconnected()), this, SLOT(onDisconnected())); QObject::connect(client, SIGNAL(presentationReceived(QString, QList<QImage>)), this, SLOT(onPresentationReceived(QString, QList<QImage>))); server = new Server(); QObject::connect(server, SIGNAL(listening()), this, SLOT(onStarted())); QObject::connect(server, SIGNAL(connectionAccepted()), this, SLOT(onClientConnected())); QObject::connect(server, SIGNAL(clientVerified()), this, SLOT(onClientVerified())); QObject::connect(server, SIGNAL(clientLeft()), this, SLOT(onClientLeft())); QObject::connect(server, SIGNAL(closing()), this, SLOT(onClosed())); }
/** Load execution implementation of throughput class */ bool MwtsIPerfThroughput::Exec() { MWTS_ENTER; m_pReturnValue = false; // Connect to important signals connect( m_pProcess, SIGNAL(error(QProcess::ProcessError)), SLOT(onError(QProcess::ProcessError)) ); connect( m_pProcess, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(onFinished(int,QProcess::ExitStatus)) ); connect( m_pProcess, SIGNAL(started()), SLOT(onStarted()) ); connect( m_pProcess, SIGNAL(stateChanged(QProcess::ProcessState)), SLOT(onStateChanged(QProcess::ProcessState)) ); qDebug() << "Starting iPerf with params" << m_params; if ( m_pIperfRole == IPERF_CLIENT ) { qDebug() << "Starting iperf in client role."; m_pProcess->start("iperf", m_params); qDebug() << "Wating for iperf to finish..."; // We might use waitForFinished, but then we'd loose the ability to // use fail timeout //m_pProcess->waitForFinished(TEST_TIME_INT*1100); // Wait until iperf client has finished. g_pTest->Start(); m_pProcess->disconnect(); } else { qDebug() << "Starting iperf in server role."; m_pProcess->start("iperf", m_params); qDebug() << "Wating for iperf to start..."; // We might use waitForStarted, but then we'd loose the ability to // use fail timeout //m_pProcess->waitForStarted(TEST_TIME_INT*1100); // Wait until iperf server has started. g_pTest->Start(); // Mark the return vaue to true, for successfull start m_pReturnValue = true; } MWTS_LEAVE; return m_pReturnValue; }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); ui->stopServerAct->setEnabled(false); setWindowTitle(qApp->applicationName() + ' ' + qApp->applicationVersion()); setContextMenuPolicy(Qt::NoContextMenu); createLPanel(); cLog = new Log; connect(cLog, SIGNAL(appendLog(QString)), logWidget->edit, SLOT(append(QString))); connect(logWidget->button, SIGNAL(clicked()), logWidget->edit, SLOT(clear())); cFtp = new Ftp; connect(cFtp, SIGNAL(onError(QString)), this, SLOT(eventHandler(QString))); connect(cFtp, SIGNAL(onStarted(QString)), this, SLOT(eventHandler(QString))); connect(cFtp, SIGNAL(onClose(QString)), this, SLOT(eventHandler(QString))); connect(cFtp, SIGNAL(onEvent(QString)), this, SLOT(eventHandler(QString))); }
void PlanSimSubpanel::onRunPressed() { // disable buttons and menu left->ui->runButton->setEnabled(false); right->ui->widSimStyle->setVisible(false); // delete custom plot //delete left->customPlot; delete left->planView; //left->customPlot = new QCustomPlot(); left->planView = new SvgView(left->ui->stackPlot); left->planView->loadTemplate(); showCustomPlot(false); portsToPlot.erase(portsToPlot.begin(), portsToPlot.end()); // prepare new thread for simulation log_messages.clear(); index_message = 0; delete sim_process; sim_process = new PlanSimSubpanelThread(log_messages, debug, nbthreads, blockSize); sim_process->init(mvpz, mpkg); // delete set delete thread; thread = new QThread(); // move to thread timer.start(1000); sim_process->moveToThread(thread); connect(thread, SIGNAL(started()), sim_process, SLOT(onStarted())); connect(sim_process, SIGNAL(simulationFinished()), this, SLOT(onSimulationFinished())); thread->start(); }
NetworkControl::NetworkControl(PresentationControl* p) { pc = p; QObject::connect(pc, SIGNAL(presentationChanged()), this, SLOT(onPresentationChanged())); QThread* networkThread = new QThread(); client = new Client(); QObject::connect(client, SIGNAL(currentPageReceived(qint64)), pc, SLOT(onCurrenPageChanged(qint64))); QObject::connect(client, SIGNAL(connected()), this, SLOT(onConnected())); QObject::connect(client, SIGNAL(hostFound()), this, SLOT(onHostFound())); QObject::connect(client, SIGNAL(loggingIn()), this, SLOT(onLoggingIn())); QObject::connect(client, SIGNAL(successfullJoin()), this, SLOT(onConnectionAccepted())); QObject::connect(client, SIGNAL(disconnected()), this, SLOT(onDisconnected())); QObject::connect(client, SIGNAL(presentationReceived(QString, QList<QImage>)), this, SLOT(onPresentationReceived(QString, QList<QImage>))); server = new Server(); server->setPresentation(p->getPresentation()); QObject::connect(server, SIGNAL(listening()), this, SLOT(onStarted())); QObject::connect(server, SIGNAL(connectionAccepted()), this, SLOT(onClientConnected())); QObject::connect(server, SIGNAL(clientVerified()), this, SLOT(onClientVerified())); QObject::connect(server, SIGNAL(clientLeft()), this, SLOT(onClientLeft())); QObject::connect(server, SIGNAL(closing()), this, SLOT(onClosed())); }
void Mounter::onPakcageReceived(const NetworkPackage& np) { if (np.get<bool>("stop", false)) { qCDebug(KDECONNECT_PLUGIN_SFTP) << "SFTP server stopped"; unmount(); return; } //This is the previous code, to access sftp server using KIO. Now we are //using the external binary sshfs, and accessing it as a local filesystem. /* * QUrl url; * url.setScheme("sftp"); * url.setHost(np.get<QString>("ip")); * url.setPort(np.get<QString>("port").toInt()); * url.setUserName(np.get<QString>("user")); * url.setPassword(np.get<QString>("password")); * url.setPath(np.get<QString>("path")); * new KRun(url, 0); * Q_EMIT mounted(); */ unmount(); m_proc = new KProcess(this); m_proc->setOutputChannelMode(KProcess::MergedChannels); connect(m_proc, SIGNAL(started()), SLOT(onStarted())); connect(m_proc, SIGNAL(error(QProcess::ProcessError)), SLOT(onError(QProcess::ProcessError))); connect(m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), SLOT(onFinished(int,QProcess::ExitStatus))); QDir().mkpath(m_mountPoint); const QString program = "sshfs"; QString path; if (np.has("multiPaths")) path = '/'; else path = np.get<QString>("path"); const QStringList arguments = QStringList() << QString("%1@%2:%3") .arg(np.get<QString>("user")) .arg(np.get<QString>("ip")) .arg(path) << m_mountPoint << "-p" << np.get<QString>("port") << "-f" << "-o" << "IdentityFile=" + KdeConnectConfig::instance()->privateKeyPath() << "-o" << "StrictHostKeyChecking=no" //Do not ask for confirmation because it is not a known host << "-o" << "UserKnownHostsFile=/dev/null" //Prevent storing as a known host << "-o" << "HostKeyAlgorithms=ssh-dss" //https://bugs.kde.org/show_bug.cgi?id=351725 << "-o" << "password_stdin" ; m_proc->setProgram(program, arguments); qCDebug(KDECONNECT_PLUGIN_SFTP) << "Starting process: " << m_proc->program().join(" "); m_proc->start(); //qCDebug(KDECONNECT_PLUGIN_SFTP) << "Passing password: "******"password").toLatin1(); m_proc->write(np.get<QString>("password").toLatin1()); m_proc->write("\n"); }