copy::copy(QStringList source, QString dest, bool deleteOriginal, MainWindow *parent) : QObject(parent) { this->source = source; this->dest = dest; progressBar = new QProgressBar(); QThread *thread = new QThread; copyWorker *worker = new copyWorker(source, dest, deleteOriginal); worker->moveToThread(thread); //connect(worker, SIGNAL (error(QString)), this, SLOT (errorString(QString))); connect(thread, SIGNAL (started()), worker, SLOT (process())); connect(worker, SIGNAL (finished()), thread, SLOT (quit())); connect(worker, SIGNAL (finished()), worker, SLOT (deleteLater())); connect(thread, SIGNAL (finished()), thread, SLOT (deleteLater())); connect(worker, SIGNAL(finished()), this, SLOT(copyFinished())); connect(worker, SIGNAL(progress(quint64,quint64,QString,QString)), this, SLOT(progress(quint64,quint64,QString,QString))); window = new transferWindow(); connect(window, SIGNAL(cancelTransfer()), worker, SLOT(cancelTransfer())); connect(this, SIGNAL(prog(qint64,qint64,QString,QString)), window, SLOT(prog(qint64,qint64,QString,QString))); connect(worker, SIGNAL(fileConflict(QString)), window, SLOT(fileConflict(QString))); connect(window, SIGNAL(continueTransfer(copyWorker::continueTransferOptions,bool)), worker, SLOT(continueTransfer(copyWorker::continueTransferOptions,bool))); window->show(); thread->start(); //transferWin->show(); //int rowIndex = transferWin->table->rowCount(); //transferWin->table->setRowCount(transferWin->table->rowCount() + 1); //transferWin->table->setCellWidget(rowIndex, 2, progressBar); }
void ServerCatchcopy::copyFinished(const uint32_t &globalOrderId,const bool &withError) { int index=0; while(index<LinkGlobalToLocalClientList.size()) { if(LinkGlobalToLocalClientList.at(index).globalOrderId==globalOrderId) { copyFinished(LinkGlobalToLocalClientList.at(index).idClient,LinkGlobalToLocalClientList.at(index).orderId,withError); LinkGlobalToLocalClientList.removeAt(index); orderList.removeOne(globalOrderId); return; } index++; } }
void PluginWizardPage::copyPlugins() { QStringList pluginList = m_pFileSysClient->getPluginList(); m_PluginManager.initFromFileSys(pluginList); m_pThread = new QThread; connect(&m_PluginManager, SIGNAL(error(QString)), this, SLOT(showError(QString))); connect(&m_PluginManager, SIGNAL(info(QString)), this, SLOT(updateStatus(QString))); connect(&m_PluginManager, SIGNAL(copyFinished()), this, SLOT(generateCertificate())); connect(&m_PluginManager, SIGNAL(error(QString)), m_pThread, SLOT(quit())); connect(m_pThread, SIGNAL(finished()), m_pThread, SLOT(deleteLater())); updateStatus( tr("Copying plugins...")); m_PluginManager.moveToThread(m_pThread); m_pThread->start(); QMetaObject::invokeMethod( &m_PluginManager, "copyPlugins", Qt::QueuedConnection); }