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 PublicHubsFrame::on(Corrupted, const string& l) noexcept { if (l.empty()) { callAsync([=] { onFinished(TSTRING(HUBLIST_CACHE_CORRUPTED)); }); } else { callAsync([=] { onFinished(TSTRING(HUBLIST_DOWNLOAD_CORRUPTED) + _T(" (") + Text::toT(l) + _T(")")); }); } }
void GagImageDownloader::start() { // if there is still downloads ongoing when start() is called // there will be big problem since m_gagList will be replaced Q_ASSERT(m_replyHash.isEmpty()); foreach (const GagObject &gag, m_gagList) { if (gag.imageUrl().isEmpty() && gag.gifImageUrl().isEmpty()) continue; if (m_downloadGIF && !gag.isGIF()) { qWarning("GagImageDownloader::start(): Not GIF, skip"); continue; } const QUrl downloadImageUrl = m_downloadGIF ? gag.gifImageUrl() : gag.imageUrl(); QNetworkReply *reply = m_networkManager->createGetRequest(downloadImageUrl, NetworkManager::Image); // make sure the QNetworkReply will be destroy when this object is destroyed reply->setParent(this); m_replyHash.insert(reply, gag); connect(reply, SIGNAL(finished()), SLOT(onFinished())); } m_imagesTotal = m_replyHash.count(); if (m_imagesTotal > 1) { emit downloadProgress(0, m_imagesTotal); } else if (m_imagesTotal == 1) { connect(m_replyHash.keys().first(), SIGNAL(downloadProgress(qint64, qint64)), this, SIGNAL(downloadProgress(qint64,qint64))); } else { emit finished(); } }
void Sprite::update(float elapsedTime) { delay += elapsedTime * speed * 1000; if (delay >= animation[frame + 1]) { frame += 2; delay = 0; if (animation[frame] == -1) { if (!finished) { finished = true; if (onFinished) { onFinished(); } } if (looping == AnimationLooping::RepeatForever) { frame = 0; } else if (looping == AnimationLooping::OnceAndStop) { frame -= 2; } } } if (grow > 0) { Vector growStep = Vector(grow, grow) * elapsedTime; position -= growStep; size += 2 * growStep; } }
void CFileDownload::download(const QString& strUrl, const QString& strFolder, bool bOverWrite, bool bAutoRemoveFile) { m_strFolder = strFolder; m_strUrl = strUrl; m_bOverWrite = bOverWrite; m_bAutoRemoveFile = bAutoRemoveFile; QUrl url; url.setEncodedUrl(m_strUrl.toAscii()); if (!url.isValid()) { emit finishedDownloadAttachmentItem(m_pAttachmentItem, tr("Error: Bad file URL")); return; } if(m_pAttachmentItem) m_pAttachmentItem->setProcessState(STATE_PS_UPLOADING); QNetworkRequest request(url); request.setRawHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; ru; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)"); // request.setRawHeader("User-Agent", "Wget"); // request.setRawHeader("Accept", "*/*"); // request.setRawHeader("Connection", "Keep-Alive"); // request.setRawHeader("Keep-Alive", "300"); m_pNetworkReply = m_pNetworkMgr->get(request); connect(m_pNetworkReply, SIGNAL(metaDataChanged()), this, SLOT(onMetaDataChanged())); connect(m_pNetworkReply, SIGNAL(readyRead()), this, SLOT(onReadyRead())); connect(m_pNetworkReply, SIGNAL(uploadProgress(qint64, qint64)), this, SIGNAL(uploadProgress(qint64, qint64))); connect(m_pNetworkReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(onDownloadProgress(qint64,qint64))); connect(m_pNetworkReply, SIGNAL(finished()), this, SLOT(onFinished())); }
FileConveyor::FileConveyor(QWidget *parent) : QWidget(parent), ui(new Ui::FileConveyor) { ui->setupUi(this); sender = new Sender; ui->stackedWidget->addWidget(sender); receiver = new Receiver; ui->stackedWidget->addWidget(receiver); connect(ui->sendPushButton, SIGNAL(clicked()), this, SLOT(onSending())); connect(sender, SIGNAL(finished()), this, SLOT(onFinished())); connect(sender, SIGNAL(error()), this, SLOT(onError())); connect(ui->recvPushButton, SIGNAL(clicked()), this, SLOT(onReceive())); connect(receiver, SIGNAL(finished()), this, SLOT(onFinished())); connect(receiver, SIGNAL(error()), this, SLOT(onError())); }
AlignInBlocksDialog::AlignInBlocksDialog(QWidget *parent) : QDialog(parent), blockLen(5) { QLabel *header = new QLabel(tr("Select the size of the blocks to rearrange the ciphertext into.")); QLabel *lblLen = new QLabel(tr("Block length:")); spinLen = new QSpinBox; spinLen->setValue(blockLen); QDialogButtonBox *box = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); connect(box, SIGNAL(accepted()), this, SLOT(onFinished())); connect(box, SIGNAL(rejected()), this, SLOT(reject())); QHBoxLayout *layoutLen = new QHBoxLayout; layoutLen->addWidget(lblLen); layoutLen->addWidget(spinLen); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(header); layout->addLayout(layoutLen); layout->addWidget(box); setLayout(layout); setWindowTitle(tr("Align in Blocks")); centerWidget(this); }
Self::UnityAds(const Logger& logger) : bridge_(MessageBridge::getInstance()) , logger_(logger) { logger_.debug("%s", __PRETTY_FUNCTION__); errored_ = false; displayed_ = false; bridge_.registerHandler( [this](const std::string& message) { onError(message); return ""; }, k__onError); bridge_.registerHandler( [this](const std::string& message) { onSkipped(message); return ""; }, k__onSkipped); bridge_.registerHandler( [this](const std::string& message) { onFinished(message); return ""; }, k__onFinished); }
void PackageManager::uninstallMarkedPackages(bool simulate, bool autoremove) { #ifdef PACKAGEMANAGER_LOG qDebug() << Q_FUNC_INFO << simulate << autoremove; #endif QList<Package*> packageList = m_installedPackagesModel->packageMarkings()->packagesMarked(); QStringList packageIDs; if (packageList.count() == 0) return; foreach (Package *package, packageList) { packageIDs << package->id(); } PackageKit::Transaction *t = new PackageKit::Transaction(this); m_packManContext.setUninstallPackagesTransaction(new TransactionWrapper(t, true, this)); connect(t, SIGNAL(package(QSharedPointer<PackageKit::Package>)), this, SLOT(onPackage(QSharedPointer<PackageKit::Package>))); connect(t, SIGNAL(finished(PackageKit::Transaction::Exit,uint)), this, SLOT(onFinished(PackageKit::Transaction::Exit,uint))); if (simulate) { m_packagesToBeInstalled.clear(); m_packagesToBeUpdated.clear(); m_packagesToBeRemoved.clear(); // t->simulateRemovePackages(packagePtrList, autoremove); } else { t->removePackages(packageIDs, false, autoremove); } }
void QgsGrassImport::importInThread() { QgsDebugMsg( "entered" ); mFutureWatcher = new QFutureWatcher<bool>( this ); connect( mFutureWatcher, SIGNAL( finished() ), SLOT( onFinished() ) ); mFutureWatcher->setFuture( QtConcurrent::run( run, this ) ); }
void FileUpload::start() { //qDebug() << "FileUpload::start"; //qDebug() << " path: " << d_ptr->path; //qDebug() << " thread: " << QThread::currentThread(); FileUploadPrivate *d = static_cast<FileUploadPrivate *>(d_ptr); d->exchange = new NetworkExchange(d->request, this); if (d->netAccessManager) { d->exchange->setNetworkAccessManager(d->netAccessManager); } d->file = new QFile(d->path, this); if (!d->file->open(QFile::ReadOnly)) { setError(QNetworkReply::UnknownContentError, d->file->errorString()); emit error(this->error()); emit finished(); return; } connect(d->exchange, SIGNAL(replyReceived()), SLOT(onReplyReceived())); connect(d->exchange, SIGNAL(uploadProgress(qint64, qint64)), SLOT(onUploadProgress(qint64, qint64))); connect(d->exchange, SIGNAL(readyRead()), SLOT(onReadyRead())); connect(d->exchange, SIGNAL(redirected(const QUrl &)), SLOT(onRedirected(const QUrl &))); connect(d->exchange, SIGNAL(finished()), SLOT(onFinished())); connect(d->exchange, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(onError(QNetworkReply::NetworkError))); connect(&d->txTimer, SIGNAL(timeout()), this, SLOT(onDataTxTimeout())); emit started(); d->exchange->post(d->file); d->txTimer.start(d->txTimeout); }
bool EngineProcess::waitForFinished(int msecs) { if (!m_started) return true; DWORD dwWait; if (msecs == -1) dwWait = INFINITE; else dwWait = msecs; DWORD ret = WaitForSingleObject(m_processInfo.hProcess, dwWait); if (ret == WAIT_OBJECT_0) { // The blocking ReadFile call in the pipe reader should // return now that the pipes are closed. But if it doesn't // happen, the pipe reader will be terminated violently // after the timeout. m_reader->wait(10000); onFinished(); return true; } return false; }
void GrooveRequest::post() { QString cacheKey = generateCacheKey(); if (cacheKey.length()) { qDebug() << Q_FUNC_INFO << "Possibly cached request"; QString cachePath = QDesktopServices::storageLocation(QDesktopServices::CacheLocation) + "/libgroove/cache/api/" + cacheKey; QFile cacheFile(cachePath); if (cacheFile.open(QIODevice::ReadOnly)) { qDebug() << Q_FUNC_INFO << "Definitely cached request"; QByteArray response = cacheFile.readAll(); processData(response); return; } } m_request.setHeader(m_request.ContentTypeHeader, "application/json"); QJson::Serializer serializer; qDebug() << Q_FUNC_INFO << "Posting to: " << m_request.url(); qDebug() << Q_FUNC_INFO << serializer.serialize(buildRequest()); QNetworkReply *reply = m_client->networkManager()->post(m_request, serializer.serialize(buildRequest())); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SIGNAL(error(QNetworkReply::NetworkError))); connect(reply, SIGNAL(finished()), SLOT(onFinished())); }
void GetUrl::onFinished() { //check redirection int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); if (status == 301 || status == 302) { reply->deleteLater(); QByteArray final_url = reply->rawHeader("Location"); PyObject *str = PyString_FromString(final_url.constData()); PyObject_SetAttrString(apiModule, "final_url", str); Py_DecRef(str); //start request QNetworkRequest request = QNetworkRequest(QString::fromUtf8(final_url)); request.setRawHeader("User-Agent", "moonplayer"); reply = manager->get(request); connect(reply, SIGNAL(finished()), this, SLOT(onFinished())); return; } QByteArray barray = reply->readAll(); PyObject *callback = callbackFunc; PyObject *_data = data; callbackFunc = NULL; data = NULL; reply->deleteLater(); reply = 0; PyObject *retVal = PyObject_CallFunction(callback, "sO", barray.constData(), _data); Py_DecRef(_data); Py_DecRef(callback); RETURN_IF_ERROR(retVal) Py_DecRef(retVal); }
void GetUrl::start(const char *url, PyObject *callback, PyObject *_data, const QByteArray &referer, const QByteArray &postData) { //save callback function callbackFunc = callback; data = _data; Py_IncRef(callbackFunc); Py_IncRef(data); //start request QNetworkRequest request = QNetworkRequest(QString::fromUtf8(url)); if (!referer.isEmpty()) request.setRawHeader("Referer", referer); if (postData.isEmpty()) reply = access_manager->get(request); else { request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); reply = access_manager->post(request, postData); } connect(reply, SIGNAL(finished()), this, SLOT(onFinished())); timer->start(10000); // Set moonplayer.final_url in Python PyObject *str = PyString_FromString(url); PyObject_SetAttrString(apiModule, "final_url", str); Py_DecRef(str); }
void Notification::onFinished() { QTimer::singleShot(7000, this, SLOT(startClosing())); disconnect(this, SLOT(onFinished())); }
QgsOSMDownloadDialog::QgsOSMDownloadDialog( QWidget* parent ) : QDialog( parent ) , mDownload( new QgsOSMDownload ) { setupUi( this ); editXMin->setValidator( new QDoubleValidator( -180.0, 180.0, 6, this ) ); editXMax->setValidator( new QDoubleValidator( -180.0, 180.0, 6, this ) ); editYMin->setValidator( new QDoubleValidator( -90.0, 90.0, 6, this ) ); editYMax->setValidator( new QDoubleValidator( -90.0, 90.0, 6, this ) ); populateLayers(); onExtentCanvas(); connect( radExtentCanvas, SIGNAL( clicked() ), this, SLOT( onExtentCanvas() ) ); connect( radExtentLayer, SIGNAL( clicked() ), this, SLOT( onExtentLayer() ) ); connect( radExtentManual, SIGNAL( clicked() ), this, SLOT( onExtentManual() ) ); connect( cboLayers, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onCurrentLayerChanged( int ) ) ); connect( btnBrowse, SIGNAL( clicked() ), this, SLOT( onBrowseClicked() ) ); connect( buttonBox, SIGNAL( accepted() ), this, SLOT( onOK() ) ); connect( buttonBox, SIGNAL( rejected() ), this, SLOT( onClose() ) ); connect( mDownload, SIGNAL( finished() ), this, SLOT( onFinished() ) ); connect( mDownload, SIGNAL( downloadProgress( qint64, qint64 ) ), this, SLOT( onDownloadProgress( qint64, qint64 ) ) ); }
void BatchExtractJob::slotLoadingFinished(KJob *job) { if (job->error()) { // Forward errors as well. onError(job->errorString(), QString()); onFinished(false); return; } // Now we can start extraction. setupDestination(); Kerfuffle::ExtractionOptions options; options.setPreservePaths(m_preservePaths); m_extractJob = archive()->extractFiles({}, m_destination, options); if (m_extractJob) { connect(m_extractJob, &KJob::result, this, &BatchExtractJob::emitResult); connect(m_extractJob, &Kerfuffle::Job::userQuery, this, &BatchExtractJob::userQuery); if (archiveInterface()->hasBatchExtractionProgress()) { // The LoadJob is done, change slot and start setting the percentage from m_lastPercentage on. disconnect(archiveInterface(), &ReadOnlyArchiveInterface::progress, this, &BatchExtractJob::slotLoadingProgress); connect(archiveInterface(), &ReadOnlyArchiveInterface::progress, this, &BatchExtractJob::slotExtractProgress); } m_step = Extracting; m_extractJob->start(); } else { emitResult(); } }
void ImageView::generateCache() { delete m_cacheTimer; m_cacheTimer = 0; if (!m_item) return; m_cachedRect = sceneToViewport(m_item->rect()).intersected(viewport()->rect()); m_cachedSceneRect = viewportToScene(m_cachedRect); const QRect subRect = m_image.rect().intersected(m_cachedSceneRect); # if QT_VERSION >= 0x040700 const uchar* bits = m_image.constBits(); # else const uchar* bits = m_image.bits(); # endif const unsigned int offset = subRect.x() * m_image.depth() / 8 + subRect.y() * m_image.bytesPerLine(); const QImage subImage = QImage(bits + offset, subRect.width(), subRect.height(), m_image.bytesPerLine(), m_image.format()); ScaleRunnable *runnable = new ScaleRunnable(subImage.copy(), m_cachedRect.size()); connect(runnable, SIGNAL(finished(QImage)), SLOT(onFinished(QImage))); QThreadPool::globalInstance()->start(runnable); }
CustomDownload::CustomDownload(QNetworkReply *reply, QNetworkRequest request, qint64 dnsLookupTime, qint64 requestStartTime) { this->isWaiting = true; this->requestStartTime = requestStartTime; this->waitingTime = QDateTime::currentDateTime().toMSecsSinceEpoch(); this->dnsLookupTime = dnsLookupTime; this->request = request; this->reply = reply; connect(reply, SIGNAL(finished()), this, SLOT(onFinished())); connect(reply, SIGNAL(downloadProgress(qint64, qint64)), this, SLOT(onDownloadProgress(qint64, qint64))); connect(reply, SIGNAL(metaDataChanged()), this, SLOT(onMetaDataChanged())); /* connect(reply, SIGNAL(uploadProgress(qint64, qint64)), this, SLOT(onUploadProgress(qint64, qint64))); */ }
void SendLogsRequest::send() { QUrl url; url.setScheme( "http" ); url.setHost( "oops.last.fm" ); url.setPath( "logsubmission/add" ); url.addEncodedQueryItem( "username", QUrl::toPercentEncoding(Ws::Username) ); #ifdef Q_WS_MAC url.addQueryItem( "platform", "macosx" ); #elif defined WIN32 url.addQueryItem( "platform", "win32" ); #else url.addQueryItem( "platform", "linux" ); #endif url.addQueryItem( "clientname", QCoreApplication::applicationName() ); url.addQueryItem( "clientversion", QCoreApplication::applicationVersion() ); QNetworkRequest request = QNetworkRequest( url ); request.setRawHeader( "Content-Type", "multipart/form-data;boundary=8e61d618ca16" ); request.setRawHeader( "Accept", "*/*" ); m_data.append( postData( "usernotes", escapeString( m_usernotes ).toLatin1() ) ); m_data.append( postData( "logs", m_logs.join(",").toLatin1() ) ); m_data.append( "--8e61d618ca16--" ); // close the post request m_error = false; QNetworkReply *reply = (new WsAccessManager( this ))->post( request, m_data ); connect( reply, SIGNAL( finished() ), this, SLOT( onFinished() ) ); connect( reply, SIGNAL( error( QNetworkReply::NetworkError ) ), this, SLOT( onError( QNetworkReply::NetworkError ) ) ); }
void CmdCallbackI::finished(const omero::cmd::ResponsePtr& rsp, const omero::cmd::StatusPtr& status, const Ice::Current& current) { std::pair<omero::cmd::ResponsePtr, omero::cmd::StatusPtr> s(rsp, status); this->state = s; event.set(); onFinished(rsp, status, current); };
void TcpClient::onError(err_t err) { state = eTCS_Failed; onFinished(state); TcpConnection::onError(err); }
void GrooveRequest::get() { m_request.setHeader(m_request.ContentTypeHeader, "application/x-www-form-urlencoded"); QNetworkReply *reply = m_client->networkManager()->get(m_request); connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), SIGNAL(error(QNetworkReply::NetworkError))); connect(reply, SIGNAL(finished()), SLOT(onFinished())); }
Notification::Notification(QWidget *parent) : QWidget(parent), ui(new Ui::Notification) { ui->setupUi(this); animation = new QPropertyAnimation( this, "geometry" ); connect( animation, SIGNAL(finished()), SLOT(onFinished()) ); }
AnimatedStatusBar::AnimatedStatusBar( QWidget* parent ) :QStatusBar( parent ) { m_timeline = new QTimeLine( 50, this ); m_timeline->setUpdateInterval( 20 ); m_timeline->setCurveShape( QTimeLine::EaseInCurve ); connect( m_timeline, SIGNAL( frameChanged(int)), SLOT(onFrameChanged(int))); connect( m_timeline, SIGNAL( finished()), SLOT(onFinished())); }
void FileNetworkTask::onGetLinkFailed(const ApiError& error) { error_ = ApiRequestError; error_string_ = error.toString(); if (error.type() == ApiError::HTTP_ERROR) { http_error_code_ = error.httpErrorCode(); } onFinished(false); }
WsReply::WsReply( QNetworkReply* r ) { r->setParent( this ); m_error = Ws::NoError; m_reply = r; connect( m_reply, SIGNAL(finished()), SLOT(onFinished()) ); }
void MyObject::start() { QTimer *timer = new QTimer(this); timer->setInterval(1000); connect(timer, SIGNAL(timeout()), SLOT(DoSomething())); MyThread *t = new MyThread(this); connect(t, SIGNAL(finished()), SLOT(onFinished())); connect(t, SIGNAL(finished()), timer, SLOT(start())); t->start(); }
void SOCKS5BytestreamClientSession::finish(bool error) { SWIFT_LOG(debug) << std::endl; if (state < Ready) { weFailedTimeout->stop(); } closeConnection(); readBytestream.reset(); if (state == Initial || state == Hello || state == Authenticating) { onSessionReady(true); } else { state = Finished; if (error) { onFinished(boost::optional<FileTransferError>(FileTransferError::ReadError)); } else { onFinished(boost::optional<FileTransferError>()); } } }