//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RiuWellImportWizard::RiuWellImportWizard(const QString& webServiceAddress, const QString& downloadFolder, RimWellPathImport* wellPathImportObject, QWidget *parent /*= 0*/) : QWizard(parent) { m_wellPathImportObject = wellPathImportObject; m_destinationFolder = downloadFolder; m_webServiceAddress = webServiceAddress; m_progressDialog = new QProgressDialog(this); m_firstTimeRequestingAuthentication = true; addPage(new AuthenticationPage(webServiceAddress, this)); m_fieldSelectionPageId = addPage(new FieldSelectionPage(m_wellPathImportObject, this)); m_wellSelectionPageId = addPage(new WellSelectionPage(m_wellPathImportObject, this)); m_wellSummaryPageId = addPage(new WellSummaryPage(m_wellPathImportObject, this)); connect(this, SIGNAL(currentIdChanged(int)), SLOT(slotCurrentIdChanged(int))); connect(&m_networkAccessManager, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*))); #ifndef QT_NO_OPENSSL connect(&m_networkAccessManager, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>))); #endif connect(m_progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload())); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { iTrytoClose = false; iDownloader = new FileDownloader(this); iAudioExtractor = new AudioExtractor(this); ui->setupUi(this); ui->progressBar->setMinimum(0); ui->progressBar->setMaximum(100); ui->progressBar->setValue(0); connect(ui->startButton, SIGNAL(clicked()), this, SLOT(startDownload())); connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancelDownload())); connect(iDownloader, SIGNAL(downloadProgress(int)), this, SLOT(updateProgress(int))); connect(iDownloader, SIGNAL(stateChanged(DownloadState)), this, SLOT(stateChanged(DownloadState))); connect(ui->extractButton, SIGNAL(clicked()), this, SLOT(extractAudio())); connect(ui->codecButton, SIGNAL(clicked()), this, SLOT(codecInfo())); connect(ui->encodeButton, SIGNAL(clicked()), this, SLOT(encodeX264())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(closeApp())); connect(iDownloader, SIGNAL(infoChanged(const QString&)), this, SLOT(infoChanged(const QString&))); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearInfoText())); connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(openSettings())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(openAbout())); connect(iAudioExtractor, SIGNAL(infoChanged(const QString&)), this, SLOT(infoChanged(const QString&))); connect(iAudioExtractor, SIGNAL(extractStateChanged(int)), this, SLOT(extractStateChanged(int))); connect(iAudioExtractor, SIGNAL(encodeStateChanged(int)), this, SLOT(extractStateChanged(int))); ui->videoIdEdit->setText("nVjsGKrE6E8"); }
void ToolManager::removeTransaction(ToolTransactionId ttid, bool forced) { Misc::ToolTransInfo* info = NULL; m_MapLock.lock(); std::map<ToolTransactionId, Misc::ToolTransInfo*>::iterator it = m_mTransactions.find(ttid); if (it != m_mTransactions.end()) { info = it->second; m_mTransactions.erase(it); } m_MapLock.unlock(); if (info) { if (info->isDownload()) cancelDownload(info, forced); else cancelInstall(ttid); } safe_delete(info); }
int SyncTabWidget::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTabWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: on_pushButton_4_clicked(); break; case 1: on_pushButton_3_clicked(); break; case 2: on_pushButton_2_clicked(); break; case 3: on_pushButton_clicked(); break; case 4: downloadFile(); break; case 5: cancelDownload(); break; case 6: httpFinished(); break; case 7: httpReadyRead(); break; case 8: updateDataReadProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break; case 9: enableDownloadButton(); break; case 10: slotAuthenticationRequired((*reinterpret_cast< QNetworkReply*(*)>(_a[1])),(*reinterpret_cast< QAuthenticator*(*)>(_a[2]))); break; case 11: error((*reinterpret_cast< QNetworkReply::NetworkError(*)>(_a[1]))); break; default: ; } _id -= 12; } return _id; }
void OpenstreetmapMapProvider::getTiles(const QGeoCoordinate& topleft, int zoomLevel, int width, int height) { cancelDownload(); double tilex_exact = long2tilex(topleft.longitude(), zoomLevel); double tiley_exact = lat2tiley(topleft.latitude(), zoomLevel); int x_start = (int)floor(tilex_exact); int y_start = (int)floor(tiley_exact); int x_end = (int)floor(tilex_exact) + width / TILE_DIMENSION + 1; int y_end = (int)floor(tiley_exact) + height / TILE_DIMENSION + 1; QQueue<Tile> list; for (int y = y_start; y <= y_end; y++) { for (int x = x_start; x <= x_end; x++) { Tile info; info.x = x * TILE_DIMENSION; info.y = y * TILE_DIMENSION; info.w = TILE_DIMENSION; info.h = TILE_DIMENSION; info.zoom = zoomLevel; list.enqueue(info); } } startDownload(list); }
void Updater::downloadUpdate() { if(m_netManager->networkAccessible() != QNetworkAccessManager::NotAccessible) { m_progressDialog = new QProgressDialog(nullptr); m_progressDialog->setWindowModality(Qt::ApplicationModal); m_progressDialog->setWindowTitle(tr("Veuillez patienter")); m_progressDialog->setLabelText(tr("Téléchargement de la mise à jour de %1 en cours").arg(m_appName)); m_progressDialog->setValue(0); connect(m_progressDialog, SIGNAL(canceled()),this, SLOT(cancelDownload())); m_progressDialog->show(); m_netRequest.setUrl(m_urlExe); m_netReply = m_netManager->get(m_netRequest); connect(m_netReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(errorHandling(QNetworkReply::NetworkError))); connect(m_netReply, SIGNAL(finished()),this, SLOT(writeUpdate())); connect(m_netReply, SIGNAL(downloadProgress(qint64, qint64)),this, SLOT(updateProgress(qint64, qint64))); } else noNetworkError(); }
Downloader::Downloader (QWidget* parent) : QWidget (parent) { m_ui = new Ui::Downloader; m_ui->setupUi (this); /* Initialize private members */ m_manager = new QNetworkAccessManager(); /* Initialize internal values */ m_filePath = ""; m_startTime = 0; m_useCustomProcedures = false; /* Make the window look like a modal dialog */ setWindowIcon (QIcon ()); setWindowFlags (Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint); /* Configure the appearance and behavior of the buttons */ m_ui->openButton->setEnabled (false); m_ui->openButton->setVisible (false); connect (m_ui->stopButton, SIGNAL (clicked()), this, SLOT (cancelDownload())); connect (m_ui->openButton, SIGNAL (clicked()), this, SLOT (installUpdate())); /* Resize to fit */ setFixedSize (minimumSizeHint()); }
void ftpClient::downloadFile() { QString f_name = workDir + f_list.first(); if (QFile::exists(f_name)) { qDebug()<<tr("A file with the name %1 already exists in " "the current directory.").arg(f_list.first()); if(!QFile::remove(f_name)) { qDebug()<<tr("Can not delete file with name %1 !").arg(f_list.first()); cancelDownload(); return; } else qDebug()<<tr("File with name %1 deleted").arg(f_list.first()); } //![4] file = new QFile(f_name); if (!file->open(QIODevice::WriteOnly)) { qDebug()<<tr("Unable to save the file %1: %2.").arg(f_list.first()).arg(file->errorString()); delete file; return; } ftp->get(f_list.first(), file); qDebug()<<tr("Downloading %1...").arg(f_list.first()); f_list.removeFirst(); }
void Updater::downloadInstaller(QUrl url) { QString fName = url.path().split("/").last(); QString path = QDesktopServices::storageLocation(QDesktopServices::TempLocation); installer = new QFile(path + "/" + fName); if (!installer->open(QIODevice::WriteOnly)){ QMessageBox::information(this, tr("HTTP"), tr("Unable to save the file %1: %2.") .arg(installer->fileName()).arg(installer->errorString())); delete installer; installer = 0; return; } mProgDialog->setLabelText(tr("Downloading %1").arg(fName)); connect(mProgDialog, SIGNAL(canceled()), this, SLOT(cancelDownload())); mProgDialog->show(); instReply = qnam.get(QNetworkRequest(url)); connect(instReply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateDataTransferProgress(qint64,qint64))); connect(instReply, SIGNAL(finished()), this, SLOT(httpFinishedInstaller())); connect(instReply, SIGNAL(readyRead()), this, SLOT(httpReadyReadInstaller())); }
InstallDialog::InstallDialog(QHelpEngineCore *helpEngine, QWidget *parent, const QString &host, int port) : QDialog(parent), m_helpEngine(helpEngine), m_networkAccessManager(new QNetworkAccessManager(this)), m_networkReply(0), m_host(host), m_port(port) { TRACE_OBJ m_ui.setupUi(this); m_ui.installButton->setEnabled(false); m_ui.cancelButton->setEnabled(false); m_ui.pathLineEdit->setText(QFileInfo(m_helpEngine->collectionFile()).absolutePath()); m_ui.progressBar->hide(); m_windowTitle = tr("Install Documentation"); connect(m_networkAccessManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(httpRequestFinished(QNetworkReply*))); connect(m_ui.installButton, SIGNAL(clicked()), this, SLOT(install())); connect(m_ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancelDownload())); connect(m_ui.browseButton, SIGNAL(clicked()), this, SLOT(browseDirectories())); connect(m_ui.listWidget, SIGNAL(itemChanged(QListWidgetItem*)), this, SLOT(updateInstallButton())); QTimer::singleShot(0, this, SLOT(init())); }
Upgrader::~Upgrader() { cancelDownload(true); setTarget(getTarget()); unlockTarget(); downloadThread.interrupt(); downloadThread.join(); }
FtpWindow::FtpWindow(QWidget *parent) : QDialog(parent), ftp(0), networkSession(0) { ftpServerLabel = new QLabel(tr("Ftp &server:")); ftpServerLineEdit = new QLineEdit("ftp.qt.nokia.com"); ftpServerLabel->setBuddy(ftpServerLineEdit); statusLabel = new QLabel(tr("Please enter the name of an FTP server.")); fileList = new QTreeWidget; fileList->setEnabled(false); fileList->setRootIsDecorated(false); fileList->setHeaderLabels(QStringList() << tr("Name") << tr("Size") << tr("Owner") << tr("Group") << tr("Time")); fileList->header()->setStretchLastSection(false); connectButton = new QPushButton(tr("Connect")); connectButton->setDefault(true); cdToParentButton = new QPushButton; cdToParentButton->setIcon(QPixmap(":/images/cdtoparent.png")); cdToParentButton->setEnabled(false); downloadButton = new QPushButton(tr("Download")); downloadButton->setEnabled(false); quitButton = new QPushButton(tr("Quit")); buttonBox = new QDialogButtonBox; buttonBox->addButton(downloadButton, QDialogButtonBox::ActionRole); buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole); progressDialog = new QProgressDialog(this); connect(fileList, SIGNAL(itemActivated(QTreeWidgetItem*,int)), this, SLOT(processItem(QTreeWidgetItem*,int))); connect(fileList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(enableDownloadButton())); connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload())); connect(connectButton, SIGNAL(clicked()), this, SLOT(connectOrDisconnect())); connect(cdToParentButton, SIGNAL(clicked()), this, SLOT(cdToParent())); connect(downloadButton, SIGNAL(clicked()), this, SLOT(downloadFile())); connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); QHBoxLayout *topLayout = new QHBoxLayout; topLayout->addWidget(ftpServerLabel); topLayout->addWidget(ftpServerLineEdit); topLayout->addWidget(cdToParentButton); topLayout->addWidget(connectButton); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(topLayout); mainLayout->addWidget(fileList); mainLayout->addWidget(statusLabel); mainLayout->addWidget(buttonBox); setLayout(mainLayout); setWindowTitle(tr("FTP")); }
DlgUpdate::DlgUpdate(QWidget *parent) : QDialog(parent) { //Handle layout statusLabel = new QLabel(this); statusLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed); statusLabel->setWordWrap(true); descriptionLabel = new QLabel(tr("Current release channel") + QString(": %1").arg(tr(settingsCache->getUpdateReleaseChannel()->getName().toUtf8())), this); progress = new QProgressBar(this); buttonBox = new QDialogButtonBox(this); buttonBox->setFixedWidth(350); ok = new QPushButton("Close", this); manualDownload = new QPushButton(tr("Reinstall"), this); stopDownload = new QPushButton(tr("Cancel Download"), this); gotoDownload = new QPushButton(tr("Open Download Page"), this); addStopDownloadAndRemoveOthers(false); // Add all buttons to box enableUpdateButton(false); //Unless we know there's an update available, you can't install buttonBox->addButton(ok, QDialogButtonBox::AcceptRole); connect(gotoDownload, SIGNAL(clicked()), this, SLOT(gotoDownloadPage())); connect(manualDownload, SIGNAL(clicked()), this, SLOT(downloadUpdate())); connect(stopDownload, SIGNAL(clicked()), this, SLOT(cancelDownload())); connect(ok, SIGNAL(clicked()), this, SLOT(closeDialog())); QVBoxLayout *parentLayout = new QVBoxLayout(this); parentLayout->addWidget(descriptionLabel); parentLayout->addWidget(statusLabel); parentLayout->addWidget(progress); parentLayout->addWidget(buttonBox); setLayout(parentLayout); //Check for SSL (this probably isn't necessary) if (!QSslSocket::supportsSsl()) { enableUpdateButton(false); QMessageBox::critical(this, tr("Error"), tr("Cockatrice was not built with SSL support, therefore you cannot download updates automatically! \nPlease visit the download page to update manually.")); } //Initialize the checker and downloader class uDownloader = new UpdateDownloader(this); connect(uDownloader, SIGNAL(downloadSuccessful(QUrl)), this, SLOT(downloadSuccessful(QUrl))); connect(uDownloader, SIGNAL(progressMade(qint64, qint64)), this, SLOT(downloadProgressMade(qint64, qint64))); connect(uDownloader, SIGNAL(error(QString)), this, SLOT(downloadError(QString))); ReleaseChannel * channel = settingsCache->getUpdateReleaseChannel(); connect(channel, SIGNAL(finishedCheck(bool, bool, Release *)), this, SLOT(finishedUpdateCheck(bool, bool, Release *))); connect(channel, SIGNAL(error(QString)), this, SLOT(updateCheckError(QString))); //Check for updates beginUpdateCheck(); }
SettingsJavaPluginForm::SettingsJavaPluginForm(QWidget* me, QObject* parent) : QObject(parent), m_reply(0), m_dlgProgress(me) { setupUi(me); m_network = new QNetworkAccessManager(this); connect(pushUninstall, SIGNAL(clicked()), this, SLOT(uninstall())); connect(pushInstall, SIGNAL(clicked()), this, SLOT(install())); connect(&m_dlgProgress, SIGNAL(rejected()), this, SLOT(cancelDownload())); setupExtensionPages(); }
HttpWindow::HttpWindow(QWidget *parent) : QDialog(parent) { #ifndef QT_NO_SSL urlLineEdit = new QLineEdit("https://qt-project.org/"); #else urlLineEdit = new QLineEdit("http://qt-project.org/"); #endif urlLabel = new QLabel(tr("&URL:")); urlLabel->setBuddy(urlLineEdit); statusLabel = new QLabel(tr("Please enter the URL of a file you want to " "download.")); statusLabel->setWordWrap(true); downloadButton = new QPushButton(tr("Download")); downloadButton->setDefault(true); quitButton = new QPushButton(tr("Quit")); quitButton->setAutoDefault(false); buttonBox = new QDialogButtonBox; buttonBox->addButton(downloadButton, QDialogButtonBox::ActionRole); buttonBox->addButton(quitButton, QDialogButtonBox::RejectRole); progressDialog = new QProgressDialog(this); connect(urlLineEdit, SIGNAL(textChanged(QString)), this, SLOT(enableDownloadButton())); connect(&qnam, SIGNAL(authenticationRequired(QNetworkReply*, QAuthenticator*)), this, SLOT(slotAuthenticationRequired(QNetworkReply*, QAuthenticator*))); #ifndef QT_NO_SSL connect(&qnam, SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)), this, SLOT(sslErrors(QNetworkReply*, QList<QSslError>))); #endif connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload())); connect(downloadButton, SIGNAL(clicked()), this, SLOT(downloadFile())); connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); QHBoxLayout *topLayout = new QHBoxLayout; topLayout->addWidget(urlLabel); topLayout->addWidget(urlLineEdit); QVBoxLayout *mainLayout = new QVBoxLayout; mainLayout->addLayout(topLayout); mainLayout->addWidget(statusLabel); mainLayout->addWidget(buttonBox); setLayout(mainLayout); setWindowTitle(tr("HTTP")); urlLineEdit->setFocus(); }
void DcmtkServerDialog::open() { #ifdef VRN_DICOMLOADER if (listWidget_->getSelectedSeriesInstanceUID().empty()) return; int numImages = listWidget_->getSelectedNumImages(); std::cout << "Downloading " << numImages << " images\n"; pd_ = new QProgressDialog("Downloading...", "Cancel", 0, numImages); connect(pd_, SIGNAL(canceled()), this, SLOT(cancelDownload())); pd_->setValue(0); t_ = new QTimer(this); connect(t_, SIGNAL(timeout()), this, SLOT(updateProgressbar())); t_->start(100); QString targetPath = outputDirectory_->text(); if (targetPath.isEmpty()) return; repaint(); QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); std::string configFile = (QApplication::applicationDirPath() + "/dicomloader-storescp.cfg").toStdString(); if (!voreen::DcmtkMoveSCU::init(servers_[currentConf_].destAE_.toStdString(), servers_[currentConf_].inPort_, servers_[currentConf_].hostname_.toStdString(), servers_[currentConf_].serverPort_, security_, configFile)) { QApplication::restoreOverrideCursor(); QMessageBox::critical(this, "Init Connection", QString("Invalid connection parameters for DicomMoveSCU"), QMessageBox::Ok, QMessageBox::NoButton); t_->stop(); pd_->setValue(numImages); return; } delete dt_; dt_ = new DcmtkDownloadThread(targetPath.toStdString(), servers_[currentConf_].callAE_.toStdString(), listWidget_->getSelectedSeriesInstanceUID()); connect(dt_, SIGNAL(finished()), this, SLOT(downloadFinished())); dt_->start(); #else hide(); emit dicomServerFinished(); #endif }
void RepoTreeView::createActions() { show_detail_action_ = new QAction(tr("&Show details"), this); show_detail_action_->setIcon(QIcon(":/images/info.png")); show_detail_action_->setStatusTip(tr("Download this library")); show_detail_action_->setIconVisibleInMenu(true); connect(show_detail_action_, SIGNAL(triggered()), this, SLOT(showRepoDetail())); download_action_ = new QAction(tr("&Download this library"), this); download_action_->setIcon(QIcon(":/images/download.png")); download_action_->setStatusTip(tr("Download this library")); download_action_->setIconVisibleInMenu(true); connect(download_action_, SIGNAL(triggered()), this, SLOT(downloadRepo())); sync_now_action_ = new QAction(tr("&Sync now"), this); sync_now_action_->setIcon(QIcon(":/images/sync_now.png")); sync_now_action_->setStatusTip(tr("Sync this library immediately")); sync_now_action_->setIconVisibleInMenu(true); connect(sync_now_action_, SIGNAL(triggered()), this, SLOT(syncRepoImmediately())); cancel_download_action_ = new QAction(tr("&Cancel download"), this); cancel_download_action_->setIcon(QIcon(":/images/remove.png")); cancel_download_action_->setStatusTip(tr("Cancel download of this library")); cancel_download_action_->setIconVisibleInMenu(true); connect(cancel_download_action_, SIGNAL(triggered()), this, SLOT(cancelDownload())); open_local_folder_action_ = new QAction(tr("&Open folder"), this); open_local_folder_action_->setIcon(QIcon(":/images/folder-open.png")); open_local_folder_action_->setStatusTip(tr("open local folder")); open_local_folder_action_->setIconVisibleInMenu(true); connect(open_local_folder_action_, SIGNAL(triggered()), this, SLOT(openLocalFolder())); unsync_action_ = new QAction(tr("&Unsync"), this); unsync_action_->setStatusTip(tr("unsync this library")); unsync_action_->setIcon(QIcon(":/images/minus.png")); unsync_action_->setIconVisibleInMenu(true); connect(unsync_action_, SIGNAL(triggered()), this, SLOT(unsyncRepo())); toggle_auto_sync_action_ = new QAction(tr("Enable auto sync"), this); toggle_auto_sync_action_->setStatusTip(tr("Enable auto sync")); toggle_auto_sync_action_->setIconVisibleInMenu(true); connect(toggle_auto_sync_action_, SIGNAL(triggered()), this, SLOT(toggleRepoAutoSync())); view_on_web_action_ = new QAction(tr("&View on cloud"), this); view_on_web_action_->setIcon(QIcon(":/images/cloud.png")); view_on_web_action_->setStatusTip(tr("view this library on seahub")); view_on_web_action_->setIconVisibleInMenu(true); connect(view_on_web_action_, SIGNAL(triggered()), this, SLOT(viewRepoOnWeb())); }
HttpEng::HttpEng(QObject *parent): QObject(parent) { proxy_.setType(QNetworkProxy::HttpProxy); connect(&qnam_, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*))); connect(&timer_, SIGNAL(timeout()), this, SLOT(cancelDownload())); #ifndef QT_NO_SSL connect(&qnam_, SIGNAL(sslErrors(QNetworkReply*,QList<QSslError>)), this, SLOT(sslErrors(QNetworkReply*,QList<QSslError>))); #endif }
void Updater::startInstall() { QByteArray arr = _dwn->downloadedData(); QFile setup(_fileName); if (!setup.open(QIODevice::WriteOnly)) { emit cancelDownload(); emit unableToOpenFile(); return; } setup.write(arr); setup.close(); QProcess prc; prc.startDetached(_fileName, QStringList()); emit setupStarted(); }
TileDownloader::TileDownloader(QWidget *parent) : QMainWindow(parent), ui(new Ui::TileDownloader) { ui->setupUi(this); ////////////////////////////////////////////////// //DOWNLOADING STUFF //keep 32 images in ram and store once full or done buffer_size = 1024; connect(ui->pushButtonCancel,SIGNAL(clicked()),this,SLOT(cancelDownload())); connect(ui->pushButtonBrowse,SIGNAL(clicked()),this,SLOT(setOutputPath())); connect(ui->pushButtonDownload,SIGNAL(clicked()),this,SLOT(downloadTiles())); connect(ui->pushButtonStich,SIGNAL(clicked()),this,SLOT(stichDownloadedTiles())); fdl_1 = new FileDownloader(this); connect(fdl_1, SIGNAL (downloaded()), this, SLOT (loadAndSaveImage_1())); fdl_2 = new FileDownloader(this); connect(fdl_2, SIGNAL (downloaded()), this, SLOT (loadAndSaveImage_2())); fdl_3 = new FileDownloader(this); connect(fdl_3, SIGNAL (downloaded()), this, SLOT (loadAndSaveImage_3())); fdl_4 = new FileDownloader(this); connect(fdl_4, SIGNAL (downloaded()), this, SLOT (loadAndSaveImage_4())); ////////////////////////////////////////////////// //STICHING STUFF m_stichthread = new Stichthread(); // Worker thread connect( m_stichthread, SIGNAL( progress(const QString&) ), this, SLOT( threadStatus(const QString&) ) ); /* connect( m_stichthread, SIGNAL( ready(bool) ), goButton, SLOT( setEnabled(bool) ) ); */ connect( m_stichthread, SIGNAL( results( const QString& ) ), this, SLOT( threadDone( const QString& ) ) ); // Launch worker thread m_stichthread->start(); }
FileDownloader::FileDownloader(QWidget *parent) : QProgressDialog(parent) { setMinimumDuration(0); http = new QHttp(this); connect(http, SIGNAL(requestFinished(int, bool)), this, SLOT(httpRequestFinished(int, bool))); connect(http, SIGNAL(dataReadProgress(int, int)), this, SLOT(updateDataReadProgress(int, int))); connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader &)), this, SLOT(readResponseHeader(const QHttpResponseHeader &))); connect(this, SIGNAL(canceled()), this, SLOT(cancelDownload())); setWindowTitle(tr("Downloading...")); }
CodeDownloader::CodeDownloader(QWidget *parent) : QProgressDialog(parent) { reply = 0; manager = new QNetworkAccessManager(this); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(gotResponse(QNetworkReply*))); setMinimumDuration(0); setRange(0,0); connect(this, SIGNAL(canceled()), this, SLOT(cancelDownload())); connect(this, SIGNAL(fileSaved(const QString &, const QString &)), this, SLOT(reportFileSaved(const QString &,const QString &))); connect(this, SIGNAL(saveFailed(const QString &)), this, SLOT(reportSaveFailed(const QString &))); connect(this, SIGNAL(errorOcurred(int,QString)), this, SLOT(reportError(int,QString))); setWindowTitle(tr("Downloading...")); }
// This is called during the download to check for a hung state void Downloader::timerCheckDownloadProgress() { if (progressDialog->value() > downloadProgress) { downloadProgress = progressDialog->value(); return; } else { if (!downloadFinished) { // We appear to be hung. cancelDownload(); } // Finished with timer if (downloadTimer->isActive()) downloadTimer->stop(); } }
void OpenstreetmapMapProvider::getTile(const QGeoCoordinate& coord, int zoomLevel) { cancelDownload(); double tilex_exact = long2tilex(coord.longitude(), zoomLevel); double tiley_exact = lat2tiley(coord.latitude(), zoomLevel); Tile info; info.x = tilex_exact; info.y = tiley_exact; info.w = TILE_DIMENSION; info.h = TILE_DIMENSION; info.zoom = zoomLevel; QQueue<Tile> queue; queue.enqueue(info); startDownload(queue); }
HttpWindow::HttpWindow(QWidget *parent, QUrl _url, QString _savePath) : QDialog(parent) { this->setFont(THE_REPO->fontVariableWidthSmall); this->fullUrlString = _url.scheme() + "://" + _url.authority() + _url.path(); this->downloadSuccess = false; this->uploadFlag = false; this->savePath = _savePath; progressDialog = new QProgressDialog(this); connect(&qnam, SIGNAL(authenticationRequired(QNetworkReply*,QAuthenticator*)), this, SLOT(slotAuthenticationRequired(QNetworkReply*,QAuthenticator*))); connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload())); this->downloadFile(); }
void UploadsList::contextMenuEvent( QContextMenuEvent* e) { listItem = itemAt(e->pos()); if( listItem != 0 ) { QMenu popMenu(this); QAction *actionDownload = popMenu.addAction(tr("Cancel")); actionDownload->setIcon(QIcon(":/delete.png")); connect(actionDownload, SIGNAL(triggered()), this, SLOT(cancelDownload())); popMenu.addSeparator (); QAction *actionGrab = popMenu.addAction(tr("Grab Friend")); actionGrab->setIcon(QIcon(":/grabfriend.png")); connect(actionGrab, SIGNAL(triggered()), this, SLOT(grabFriend())); setCurrentItem(listItem); popMenu.setMouseTracking(true); popMenu.exec(QCursor::pos()); } }
void KNMusicOnlineLyricsDownloader::downloadLyrics( const KNMusicDetailInfo &detailInfo) { //Check the running flag. if(m_running) { //Cancel the current running mission first. cancelDownload(); } //Reset the cancel flag. m_cancelFlag=false; //Set up the running flag. m_running=true; //Save the new detail info. m_workingDetailInfo=detailInfo; //Clear the lyrics list. m_lyricsList=QList<KNMusicLyricsDownloader::KNMusicLyricsDetails>(); m_completeDownloader=0; //Emit the empty list data right now. emit listContentChanged(m_lyricsList); //Emit the server changed signal. emit serverChanged(0, m_downloaders.size()); //Download the lyrics data via all the plugins. for(auto i : m_downloaders) { //Before doing downloading, checking the cancel flag first. if(m_cancelFlag) { //Reset the running flag. m_running=false; //Emit signal. emit downloadCancel(); //Won't download before calling the download. return; } //Try to download the lyrics from all the remote server. i->downloadLyrics(m_identifier, detailInfo); } }
void checkForUpdates::downloadButtonPressed() { this->close(); QUrl url(newurl); filename = "xTuple-" + serverVersion + "-" + OS + "-installer."+ suffix; if(QFile::exists(filename)) { if(QMessageBox::question(this, tr("Update"), tr("There already exists a file called %1 in " "the current directory. Overwrite?").arg(filename), QMessageBox::Yes|QMessageBox::No, QMessageBox::No) == QMessageBox::No) return; QFile::remove(filename); } file = new QFile(filename); if(!file->open(QIODevice::WriteOnly)) { QMessageBox::information(this, "Update", tr("Unable to save the file %1: %2.") .arg(filename).arg(file->errorString())); delete file; file = NULL; return; } downloadRequestAborted = false; reply = manager.get(QNetworkRequest(url)); connect(reply, SIGNAL(finished()), this, SLOT(downloadFinished())); connect(reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead())); connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64))); connect(progressDialog, SIGNAL(canceled()), this, SLOT(cancelDownload())); progressDialog->setLabelText(tr("Downloading %1...").arg(filename)); _button->setEnabled(false); progressDialog->exec(); }
int FtpWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QDialog::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: connectOrDisconnect(); break; case 1: downloadFile(); break; case 2: cancelDownload(); break; case 3: ftpCommandFinished((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break; case 4: addToList((*reinterpret_cast< const QUrlInfo(*)>(_a[1]))); break; case 5: processItem((*reinterpret_cast< QTreeWidgetItem*(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 6: cdToParent(); break; case 7: updateDataTransferProgress((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break; case 8: enableDownloadButton(); break; default: ; } _id -= 9; } return _id; }
int Download::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: progress((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: satatechan((*reinterpret_cast< State(*)>(_a[1]))); break; case 2: cda(); break; case 3: downComp(); break; case 4: com(); break; case 5: ready(); break; case 6: data((*reinterpret_cast< qint64(*)>(_a[1])),(*reinterpret_cast< qint64(*)>(_a[2]))); break; case 7: { int _r = cancelDownload(); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; default: ; } _id -= 8; } return _id; }