bool FrenchZipCodesStep::startDownload() { // TODO: manage progress download */ Utils::HttpDownloader *dld = new Utils::HttpDownloader(this); dld->setOutputPath(workingPath()); dld->setUrl(QUrl(FRENCH_URL)); connect(dld, SIGNAL(downloadFinished()), this, SIGNAL(downloadFinished())); connect(dld, SIGNAL(downloadFinished()), dld, SLOT(deleteLater())); dld->startDownload(); return true; }
bool PtDrugDatatabaseStep::downloadFiles(QProgressBar *bar) { Q_UNUSED(bar); // TODO: add progress download */ Utils::HttpDownloader *dld = new Utils::HttpDownloader(this); // dld->setMainWindow(mainwindow()); dld->setOutputPath(workingPath()); dld->setUrl(QUrl(PT_URL)); dld->startDownload(); connect(dld, SIGNAL(downloadFinished()), this, SIGNAL(downloadFinished())); connect(dld, SIGNAL(downloadFinished()), dld, SLOT(deleteLater())); connect(dld, SIGNAL(downloadProgressRange(qint64,qint64)), this, SIGNAL(progressRangeChanged(int,int))); connect(dld, SIGNAL(downloadProgressValue(qint64)), this, SIGNAL(progress(int))); return true; }
/** * \brief Download the URL to the tempPath(). * * You can optionally connect a QProgressBar to the progress() and progressRangeChanged() signals, it will * be updated according to the download progress. * Asynchronously emits the downloadFinished() signal when done. */ bool Icd10Step::startDownload() { // File already exists ? --> don't download QString filename = QString(d->_url).split("/").last(); if (QFile(d->_tmpPath + QDir::separator() + filename).exists()) { QTimer::singleShot(10, this, SIGNAL(downloadFinished())); return true; } Utils::HttpDownloader *dld = new Utils::HttpDownloader(this); connect(dld, SIGNAL(downloadFinished()), this, SIGNAL(downloadFinished()), Qt::UniqueConnection); connect(dld, SIGNAL(downloadFinished()), dld, SLOT(deleteLater())); connect(dld, SIGNAL(downloadProgressPermille(int)), this, SIGNAL(progress(int))); Q_EMIT progressRangeChanged(0, 1000); Q_EMIT progress(0); dld->setOutputPath(d->_tmpPath); dld->setUrl(QUrl(d->_url)); dld->startDownload(); return true; }