void ListEngine::connectDownloader() { connect(this, SIGNAL(download(QUrl,QUrl)), m_parent->downloader(), SLOT(download(QUrl,QUrl))); connect(m_parent->downloader(), SIGNAL(downloadComplete(QUrl,QUrl)), this, SLOT(downloadComplete(QUrl,QUrl))); connect(this, SIGNAL(listDir(QUrl)), m_parent->downloader(), SLOT(listDir(QUrl))); connect(m_parent->downloader(), SIGNAL(listingComplete(QUrl)), this, SLOT(listingComplete(QUrl))); }
void NYBOT::fileDone (bool d) { if (d) { QString ss(tr("Network error")); printStatusLogMessage(ss); downloadComplete(); return; } QFile f(file); if (! f.open(IO_WriteOnly)) { QString ss(tr("Cant write to file")); printStatusLogMessage(ss); downloadComplete(); return; } QTextStream stream(&f); stream << data; f.close(); parse(); }
void HttpRequest::httpFinished() { QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if (reply->error()) { qFatal("Network error"); exit(-1); } else if (!redirectionTarget.isNull()) { url = url.resolved(redirectionTarget.toUrl()); reply->deleteLater(); startRequest(); return; } reply->deleteLater(); qnam->deleteLater(); if (saveToFile) { emit downloadComplete(file->fileName()); file->deleteLater(); } else { emit downloadComplete(QString(*data)); delete data; } httpRequestComplete = true; emit downloadComplete(); }
void MagnatuneAlbumDownloader::albumDownloadComplete( KJob * downloadJob ) { DEBUG_BLOCK debug() << "album download complete"; if ( !downloadJob->error() == 0 ) { //TODO: error handling here return ; } if ( downloadJob != m_albumDownloadJob ) return ; //not the right job, so let's ignore it //ok, now we have the .zip file downloaded. All we need is to unpack it to the desired location and add it to the collection. QString unzipString = "unzip " + KShell::quoteArg( m_tempDir->name() + m_currentAlbumFileName ) + " -d " + KShell::quoteArg( m_currentAlbumUnpackLocation ) + " &"; debug() << "unpacking: " << unzipString; if ( system( unzipString.toAscii() ) == -1 ) return; if ( m_currentAlbum ) { //now I really want to add the album cover to the same folder where I just unzipped the album... The //only way of getting the actual location where the album was unpacked is using the artist and album names QString finalAlbumPath = m_currentAlbumUnpackLocation + '/' + m_currentAlbum->albumArtist()->name() + '/' + m_currentAlbum->name(); QString coverUrlString = m_currentAlbum->coverUrl(); KUrl downloadUrl( coverUrlString ); debug() << "Adding cover " << downloadUrl.url() << " to collection at " << finalAlbumPath; m_albumDownloadJob = KIO::file_copy( downloadUrl, KUrl( finalAlbumPath + "/cover.jpg" ), -1, KIO::Overwrite | KIO::HideProgressInfo ); connect( m_albumDownloadJob, SIGNAL( result( KJob* ) ), SLOT( coverAddComplete( KJob* ) ) ); The::statusBar()->newProgressOperation( m_albumDownloadJob, i18n( "Adding album cover to collection" ) ) ->setAbortSlot( this, SLOT( coverAddAborted() ) ); emit( downloadComplete( true ) ); } else { //we do not know exactly what album this is (we are most likely using the redownload manager) emit( downloadComplete( true ) ); } }
void Yahoo::timeoutError () { QString ts = "symbol"; QString ts2; errorLoop++; if (errorLoop == retrySpin->value()) { currentUrl->getData(ts, ts2); QString ss = tr("Timeout: retry limit skipping") + " " + ts2 + " " + tr("skipped"); printStatusLogMessage(ss); errorList.append(ts2); errorLoop = 0; currentUrl = url.next(); if (! currentUrl) { downloadComplete(); printStatusLogMessage(stringDone); printErrorList(); return; } startDownload(); } else { currentUrl->getData(ts, ts2); QString ss = tr("Timeout: retry") + " " + QString::number(errorLoop + 1) + " " + ts2; printStatusLogMessage(ss); startDownload(); } }
//---------------------------------------------------------------------- void aucDialog::connect_slots(void) { connect(mp_ui->browseButton, SIGNAL(clicked()), this, SLOT(select_file())); connect(mp_ui->installerMenu, SIGNAL(currentIndexChanged(int)), this, SLOT(set_installer_pict())); connect(mp_ui->installerMenu, SIGNAL(currentIndexChanged(int)), this, SLOT(set_installer_options())); connect(mp_ui->installMenu_2, SIGNAL(currentIndexChanged(int)), this, SLOT(update_options2())); connect(mp_ui->installMenu_3, SIGNAL(currentIndexChanged(int)), this, SLOT(update_options3())); connect(mp_ui->installCheckbox, SIGNAL(stateChanged(int)), this, SLOT(update_options3_fromcheckbox())); connect(mp_ui->deviceRefreshButton, SIGNAL(clicked()), this, SLOT(populate_devices())); connect(mp_ui->startButton, SIGNAL(clicked()), this, SLOT(build_installer())); connect(&m_thread, SIGNAL(status(QString)), this, SLOT(status(QString))); connect(&m_thread, SIGNAL(finished()), this, SLOT(enable_widgets())); connect(&m_thread, SIGNAL(terminated()), this, SLOT(enable_widgets())); connect(&m_thread, SIGNAL(progress(int)), this, SLOT(progress(int))); connect(&m_thread, SIGNAL(maxprogress(int)), this, SLOT(maxprogress(int))); connect(mp_creator, SIGNAL(status(QString)), this, SLOT(status(QString))); connect(mp_creator, SIGNAL(progress(int)), this, SLOT(progress(int))); connect(mp_creator, SIGNAL(maxprogress(int)), this, SLOT(maxprogress(int))); connect(&m_progress_thread, SIGNAL(progress(int)), this, SLOT(progress(int))); connect(&m_progress_thread, SIGNAL(maxprogress(int)), this, SLOT(maxprogress(int))); connect(&m_release_downloader, SIGNAL(progress(int)), this, SLOT(progress(int))); connect(&m_release_downloader, SIGNAL(maxprogress(int)), this, SLOT(maxprogress(int))); connect(&m_release_downloader, SIGNAL(downloadComplete(QString)), this, SLOT(download_complete(QString))); connect(&m_release_downloader, SIGNAL(status(QString)), this, SLOT(status(QString))); }
int DownloadManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: downloadComplete(); break; case 1: progress((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: downloadStatus((*reinterpret_cast< float(*)>(_a[1]))); break; case 3: downloadStarted(); break; case 4: cancel(); break; case 5: download((*reinterpret_cast< QUrl(*)>(_a[1]))); break; case 6: pause(); break; case 7: resume(); break; case 8: download((*reinterpret_cast< QNetworkRequest(*)>(_a[1]))); break; case 9: finished(); break; case 10: downloadProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break; case 11: error((*reinterpret_cast< QNetworkReply::NetworkError(*)>(_a[1]))); break; default: ; } _id -= 12; } return _id; }
void FileDownloader::download(QUrl url) { QNetworkRequest request(url); reply = netAccManager.get(request); QObject::connect(reply, SIGNAL(finished()), this, SLOT(downloadComplete())); QObject::connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64))); }
bool UpdaterComponent::fileComplete(Update* update) { Q_UNUSED(update); if (m_file->isReady() && (m_manifest->isReady() || !m_hasManifest)) { QLOG_DEBUG() << "Both files downloaded"; // create a file that shows that we are ready // to apply this update // QFile readyFile(UpdateManager::GetPath("_readyToApply", m_version, false)); if (readyFile.open(QFile::WriteOnly)) { readyFile.write("FOO"); readyFile.close(); } emit downloadComplete(m_version); delete m_file; delete m_manifest; m_file = NULL; m_manifest = NULL; return true; } if (update) { QLOG_DEBUG() << "File " << update->m_localPath << " download completed"; } return false; }
void KNMusicOnlineLyricsDownloader::onActionDownloadFinished( uint identifier, const KNMusicDetailInfo &detailInfo, QList<KNMusicLyricsDownloader::KNMusicLyricsDetails> lyricsList) { //Check the identifier first. if(identifier!=m_identifier || detailInfo.textLists[Name]!=m_workingDetailInfo.textLists[Name] || detailInfo.textLists[Artist]!=m_workingDetailInfo.textLists[Artist]) { //This signal is not for me. return; } //Increase the counter of the completed downloader. ++m_completeDownloader; //Emit the server changed signal. emit serverChanged(m_completeDownloader, m_downloaders.size()); //Check out the cancel flag. if(m_cancelFlag) { //Reset the running flag. m_running=false; //Emit signal. emit downloadCancel(); //Won't download more. return; } //Check the lyrics list size and emit signal. if(!lyricsList.isEmpty()) { //Increase the new lyrics list to the cached list. m_lyricsList.append(lyricsList); //Sort the lyrics list right now. std::sort(m_lyricsList.begin(), m_lyricsList.end(), KNMusicLyricsDownloader::lyricsDetailLessThan); //Emit the have content signal. emit listContentChanged(m_lyricsList); } //Check out the cancel flag. if(m_cancelFlag) { //Reset the running flag. m_running=false; //Emit signal. emit downloadCancel(); //Won't download more. return; } //Check whether the completed downloader count is the same as the size of //the downloaders. if(m_completeDownloader==m_downloaders.size()) { //After download all the data, emit the signal. emit downloadComplete(); //Reset the running flag. m_running=false; } }
void NotifyQt::notifyDownloadComplete(const std::string& fileHash) { #ifdef NOTIFY_DEBUG std::cerr << "Notifyqt::notifyDownloadComplete notified that a download is completed" << std::endl; #endif emit downloadComplete(QString::fromStdString(fileHash)); }
void DownloadM::finished() { dFile->close(); QFileInfo fileInfo(url0.path()); QString filename; filename = fileInfo.fileName(); QString tmp_md5 = UrTUpdater::getMd5( filename ); //if ( curentMd5 != tmp_md5 ) { // errorMd5(); //} // move the .pk3, .cfg in the assets subdir if( (filename.contains(".pk3", Qt::CaseInsensitive) && !filename.contains(".part", Qt::CaseInsensitive)) || filename.contains(".cfg", Qt::CaseInsensitive) || (filename.contains(".txt", Qt::CaseInsensitive)) || (filename.contains(".doc", Qt::CaseInsensitive))) { dFile->rename(filename, assetsDir+"/"+filename); } if(filename.contains(".part", Qt::CaseInsensitive)) { QString finalFileName; finalFileName = filename.split(".part").at(0)+".tmp"; Append_file_to_file(filename.toUtf8().data(), finalFileName.toUtf8().data()); QFile::remove(filename); } //@Barbatos - apply chmod +x for executable files on linux if((filename.contains(".i386", Qt::CaseInsensitive) || (filename.contains(".x86_64", Qt::CaseInsensitive))) && (Platform == "Linux")) { QString cmd("chmod +x "+filename); QProcess* process = new QProcess(this); process->start(QFile::encodeName(cmd).data()); process->waitForFinished(3000); } if((Platform == "Linux") || (Platform == "Mac")) { if(filename.contains(".zip", Qt::CaseInsensitive)) { QString cmd("unzip -q -o "+filename); QProcess* process = new QProcess(this); process->start(QFile::encodeName(cmd).data()); process->waitForFinished(30000); QFile::remove(filename); } } dFile = 0; dCurrentReply = 0; emit downloadComplete(curentMd5, tmp_md5); }
void Yahoo::update () { plug.close(); errorLoop = 0; url.clear(); errorList.clear(); if (allSymbols->isChecked()) allSymbolsChecked(TRUE); else allSymbolsChecked(FALSE); QDir dir; int loop; for (loop = 0; loop < (int) symbolList.count(); loop++) { fileCount++; QString path = dataPath + "/"; QFileInfo fi(symbolList[loop]); if (fi.extension(FALSE).length()) path.append(fi.extension(FALSE).upper()); else path.append("US"); path.append("/"); path.append(symbolList[loop]); if (! dir.exists(path)) continue; if (! method->currentText().compare("History")) createHistoryUrls(symbolList[loop]); else { if (! method->currentText().compare("Auto History")) createAutoHistoryUrls(path, symbolList[loop]); else { if (! method->currentText().compare("Quote")) createQuoteUrls(symbolList[loop]); else createFundamentalUrls(symbolList[loop]); } } } if (! url.count()) { downloadComplete(); QString ss(tr("No symbols selected. Done")); printStatusLogMessage(ss); return; } currentUrl = url.first(); startDownload(); }
void Download::finished() { QString newFilename = m_file->fileName(); newFilename.replace( ".part", "" ); m_file->close(); m_downloadRate = 0; m_file->rename( m_file->fileName(), newFilename ); emit downloadComplete(); }
void DownloadManager::finished() { qDebug() << "finished"; // mFile->rename("download.part","download.complete"); mFile->close(); mFile = 0; mCurrentReply = 0; emit downloadComplete(); }
void CHttpImageDownloader::httpRequestFinished(int requestId, bool error) { if (requestId != httpGetId) return; emit downloadComplete(buffer.data(),m_ImageMainUrl); buffer.close(); }
/*! \internal Internally used slot which is invoked when a download is finished. This handles redirection of URLs internally, as well as error checking. A successful download will emit the downloadComplete() signal which the user is responsible for handling in their own application. \sa downloadComplete() */ void QDownloadManager::netReplyDone() { //Ensure sanity of the sender QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender()); //Q_ASSERT(reply); if (!reply) { qWarning("DownloadManager's signal sender was not a QNetworkReply."); return; } if (reply->error() != QNetworkReply::NoError) { qWarning() << "Error in network reply: " << reply->url() << "(" << reply->errorString() << ")"; reply->deleteLater(); emit downloadComplete(NULL); return; } //In the case of a reply which is a redirect QVariant redirection = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if (redirection.isValid()) { QUrl url = redirection.toUrl(); //Check if we have a relative URL if (url.isRelative()) { url.setScheme(reply->url().scheme()); url.setHost(reply->url().host()); } //Reissue redirected request. QNetworkRequest request(url); QNetworkReply * netReply = m_netAccessMgr->get(request); connect(netReply, SIGNAL(finished()), SLOT(netReplyDone())); reply->deleteLater(); return; } //In the case of just data being returned //qDebug() << "ContentType:" << reply->header(QNetworkRequest::ContentTypeHeader).toString(); QByteArray *assetData = new QByteArray(); *assetData = reply->readAll(); reply->deleteLater(); emit downloadComplete(assetData); }
void MagnatuneAlbumDownloader::albumDownloadComplete( KIO::Job * downloadJob ) { debug() << "album download complete" << endl; if ( !downloadJob->error() == 0 ) { //TODO: error handling here return ; } if ( downloadJob != m_albumDownloadJob ) return ; //not the right job, so let's ignore it //ok, now we have the .zip file downloaded. All we need is to unpack it to the desired location and add it to the collection. QString unzipString = "unzip "+ KProcess::quote( m_tempDir.name() + m_currentAlbumFileName) + " -d " +KProcess::quote( m_currentAlbumUnpackLocation ) + " &"; debug() << "unpacking: " << unzipString << endl; system( unzipString.ascii() ); if (m_currentAlbumId != -1 ) { //now I really want to add the album cover to the same folder where I just unzipped the album... The //only way of getting the actual location where the album was unpacked is using the artist and album names MagnatuneAlbum album = MagnatuneDatabaseHandler::instance()->getAlbumById( m_currentAlbumId ); MagnatuneArtist artist = MagnatuneDatabaseHandler::instance()->getArtistById( album.getArtistId() ); QString finalAlbumPath = m_currentAlbumUnpackLocation + "/" + artist.getName() + "/" + album.getName(); QString coverUrlString = album.getCoverURL(); KURL downloadUrl( coverUrlString ); debug() << "Adding cover " << downloadUrl.url() << " to collection at " << finalAlbumPath << endl; m_albumDownloadJob = KIO::file_copy( downloadUrl, KURL( finalAlbumPath + "/cover.jpg" ), -1, true, false, false ); connect( m_albumDownloadJob, SIGNAL( result( KIO::Job* ) ), SLOT( coverAddComplete( KIO::Job* ) ) ); Amarok::StatusBar::instance() ->newProgressOperation( m_albumDownloadJob ) .setDescription( i18n( "Adding album cover to collection" ) ) .setAbortSlot( this, SLOT( coverAddAborted() ) ); } else { //we do not know exactly what album this is (we are most likely using the redownload manager) emit( downloadComplete( true ) ); } }
void MagnatuneAlbumDownloader::coverAddAborted() { Amarok::StatusBar::instance()->endProgressOperation( m_albumDownloadJob ); m_albumDownloadJob->kill( true ); delete m_albumDownloadJob; m_albumDownloadJob = 0; debug() << "Aborted cover add" << endl; emit( downloadComplete( true ) ); //the album download still went well, just the cover is missing }
void MagnatuneAlbumDownloader::albumDownloadAborted( ) { Amarok::StatusBar::instance()->endProgressOperation( m_albumDownloadJob ); m_albumDownloadJob->kill( true ); delete m_albumDownloadJob; m_albumDownloadJob = 0; debug() << "Aborted album download" << endl; emit( downloadComplete( false ) ); }
void Yahoo::cancelUpdate () { if (op) { timer->stop(); op->stop(); } downloadComplete(); printStatusLogMessage(stringCanceled); progressBar->reset(); }
void MagnatuneAlbumDownloader::albumDownloadAborted( ) { DEBUG_BLOCK The::statusBar()->endProgressOperation( m_albumDownloadJob ); m_albumDownloadJob->kill(); delete m_albumDownloadJob; m_albumDownloadJob = 0; debug() << "Aborted album download"; emit( downloadComplete( false ) ); }
void Downloader::copyingDone(KIO::Job *job, const QUrl &from, const QUrl &to, time_t mtime, bool directory, bool renamed) { Q_UNUSED(job); Q_UNUSED(mtime); Q_UNUSED(directory); Q_UNUSED(renamed); disconnect (job, SIGNAL(copyingDone(KIO::Job*,QUrl,QUrl,time_t,bool,bool)), this, SLOT(copyingDone(KIO::Job*,QUrl,QUrl,time_t,bool,bool))); emit downloadComplete(from, to); }
void savethread::run() { debug(LOG_DEBUG, DEBUG_LOG, 0, "download thread starts running"); std::list<std::pair<std::string, int> >::const_iterator i; for (i = _images.begin(); i != _images.end(); i++) { std::string reponame = i->first; int imageid = i->second; if (_stopProcess) { debug(LOG_DEBUG, DEBUG_LOG, 0, "process abort request"); emit downloadAborted(); return; } QString r(i->first.c_str()); downloadstatus s(r, i->second); emit sendStatus(s); // now download image debug(LOG_DEBUG, DEBUG_LOG, 0, "image %d from repo %s", imageid, reponame.c_str()); // get image snowstar::RepositoryPrx repository = _repositories->get(reponame); snowstar::ImageInfo info = repository->getInfo(imageid); std::string filename = astro::stringprintf("%s/%s", _directory.c_str(), info.filename.c_str()); snowstar::ImageFile image = repository->getImage(imageid); astro::image::ImagePtr imageptr = snowstar::convertfile(image); // get the file name from the image debug(LOG_DEBUG, DEBUG_LOG, 0, "filename: %s", filename.c_str()); // write image astro::io::FITSout out(filename); if (out.exists()) { out.unlink(); } try { out.write(imageptr); } catch (astro::io::FITSexception& x) { _errormsg = astro::stringprintf("cannot write image " "%d to %s: %s", imageid, filename.c_str(), x.what()); emit downloadAborted(); return; } } debug(LOG_DEBUG, DEBUG_LOG, 0, "download complete"); emit downloadComplete(); }
void NotifyQt::notifyDownloadComplete(const std::string& fileHash) { { QMutexLocker m(&_mutex) ; if(!_enabled) return ; } #ifdef NOTIFY_DEBUG std::cerr << "Notifyqt::notifyDownloadComplete notified that a download is completed" << std::endl; #endif emit downloadComplete(QString::fromStdString(fileHash)); }
int QAiSceneHandler::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QGLSceneFormatHandler::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: downloadComplete((*reinterpret_cast< QByteArray(*)>(_a[1]))); break; default: ; } _id -= 1; } return _id; }
void URLDownloader::complete() { if (pRequestTimeoutTimer_->isActive()) pRequestTimeoutTimer_->stop(); QNetworkReply* pReply = qobject_cast<QNetworkReply*>(sender()); if (pReply->error() == QNetworkReply::NoError) { QByteArray data = pReply->readAll(); downloadComplete(data); } deleteLater(); }
void MagnatuneAlbumDownloader::coverAddComplete(KIO::Job * downloadJob) { debug() << "cover add complete" << endl; if ( !downloadJob || !downloadJob->error() == 0 ) { //TODO: error handling here return ; } if ( downloadJob != m_albumDownloadJob ) return ; //not the right job, so let's ignore it emit( downloadComplete( true ) ); //all done, everyone is happy! :-) }
WebBridgeRS::WebBridgeRS(QObject *parent) : QObject(parent) { this->setObjectName("bridge"); //rsFiles->getSharedDirectories(); //embpyqt = new EmbeddedPyQt(); //todo, perhaps - deeper intergration with retroshare-gui //MainWindow *pMainWindow = MainWindow::getInstance(); //pMainWindow->forumsDialog-> //pMainWindow->chatLobbyDialog-> //pMainWindow->//blast - adding actions/plugins is private... connect(NotifyQt::getInstance(), SIGNAL(downloadComplete(QString)), this, SLOT(onDownloadComplete(QString))); connect(NotifyQt::getInstance(), SIGNAL(gotTurtleSearchResult(qulonglong,FileDetail)), this, SLOT(gotTurtleSearchResult(qulonglong,FileDetail))); }
// DownloadUpdateDialog void QUPDUpdater::showDownloadUpdateDialogWithCurrentProposal() { hideDownloadUpdateDialog(); QWidget *parent = 0; if (_updaterDialog) parent = _updaterDialog; else parent = parentWidget(); _downloadUpdateDialog = new QUPDDownloadUpdateDialog(parent); startDownloadNewVersion(); connect(this, SIGNAL(downloadNewVersionSuccess()), _downloadUpdateDialog, SLOT(downloadComplete())); connect(_downloadUpdateDialog, SIGNAL(installAndRelaunch()), this, SLOT(installAndRelaunch())); _downloadUpdateDialog->show(); }