8 #include "ui_downloaddialog.h"
10 using namespace swift::misc::network;
14 CDownloadDialog::CDownloadDialog(QWidget *parent) : QDialog(parent), ui(new Ui::
CDownloadDialog)
17 this->setWindowFlags(this->windowFlags() & ~Qt::WindowContextHelpButtonHint);
24 setWindowTitle(
"Downloading " + remoteFile.
getName());
25 ui->comp_Download->setDownloadFile(remoteFile);
30 ui->comp_Download->setDownloadFiles(remoteFiles);
35 ui->comp_Download->triggerDownloadingOfFiles(delayMs);
42 const QPointer<CDownloadDialog> guard(
this);
44 if (guard.isNull()) { return; }
45 ui->comp_Download->triggerDownloadingOfFiles(2500);
52 if (!ui->comp_Download->haveAllDownloadsCompleted())
54 const QString msg = QStringLiteral(
"Download ongoing. Do you want to abort it?");
55 QMessageBox::StandardButton reply =
56 QMessageBox::question(
this,
"Abort?", msg, QMessageBox::Yes | QMessageBox::No);
57 if (reply == QMessageBox::Yes)
59 ui->comp_Download->cancelOngoingDownloads();
60 this->done(CDownloadDialog::Rejected);
63 else { this->done(CDownloadDialog::Accepted); }
CDownloadComponent as dialog.
void setDownloadFile(const swift::misc::network::CRemoteFile &remoteFile)
Set file to be downloaded.
void showAndStartDownloading()
Show and start the downloading.
void setMode(CDownloadComponent::Mode mode)
Set the mode.
void triggerDownloadingOfFiles(int delayMs)
Trigger downloading of the file.
void setDownloadFiles(const swift::misc::network::CRemoteFileList &remoteFiles)
Set files to be downloaded.
virtual ~CDownloadDialog()
Destructor.
const QString & getName() const
Name.
Value object encapsulating a list of remote files.
High level reusable GUI components.
auto singleShot(int msec, QObject *target, F &&task)
Starts a single-shot timer which will call a task in the thread of the given object when it times out...