diff --git a/src/blackgui/components/downloadcomponent.cpp b/src/blackgui/components/downloadcomponent.cpp index bd9cbe4b9..5a8f84a1a 100644 --- a/src/blackgui/components/downloadcomponent.cpp +++ b/src/blackgui/components/downloadcomponent.cpp @@ -54,7 +54,7 @@ namespace BlackGui connect(ui->tb_CancelDownload, &QToolButton::pressed, this, &CDownloadComponent::cancelOngoingDownloads); connect(ui->pb_Download, &QPushButton::pressed, [ = ] { this->triggerDownloadingOfFiles(); }); connect(ui->pb_OpenDownloadDir, &QPushButton::pressed, this, &CDownloadComponent::openDownloadDir); - connect(ui->pb_DoIt, &QPushButton::pressed, this, &CDownloadComponent::startDownloadedExecutable); + connect(ui->pb_Launch, &QPushButton::pressed, this, &CDownloadComponent::startDownloadedExecutable); } CDownloadComponent::~CDownloadComponent() @@ -99,6 +99,8 @@ namespace BlackGui bool CDownloadComponent::triggerDownloadingOfFiles(int delayMs) { + ui->pb_Download->setEnabled(false); + ui->pb_Launch->setEnabled(false); if (m_remoteFiles.isEmpty()) { return false; } if (!m_waitingForDownload.isEmpty()) { return false; } if (delayMs > 0) @@ -162,6 +164,7 @@ namespace BlackGui ui->le_StartedNumber->clear(); ui->le_StartedUrl->clear(); this->showFileInfo(); + ui->pb_Download->setEnabled(true); } bool CDownloadComponent::triggerDownloadingOfNextFile() @@ -255,6 +258,8 @@ namespace BlackGui QTimer::singleShot(0, this, [ = ] { if (!myself || !sGui || sGui->isShuttingDown()) { return; } + myself->ui->pb_Download->setEnabled(true); + myself->ui->pb_Launch->setEnabled(true); this->allDownloadsCompleted(); }); this->startDownloadedExecutable(); diff --git a/src/blackgui/components/downloadcomponent.ui b/src/blackgui/components/downloadcomponent.ui index b60f1a6fb..a13af0e36 100644 --- a/src/blackgui/components/downloadcomponent.ui +++ b/src/blackgui/components/downloadcomponent.ui @@ -6,117 +6,47 @@ 0 0 - 450 - 310 + 438 + 298 - - - 450 - 250 - - Download files - - - - - cancel downloading + + + + + + 0 + 0 + - ... - - - - :/diagona/icons/diagona/icons/cross-circle.png:/diagona/icons/diagona/icons/cross-circle.png + Actions: - - + + + + + 0 + 0 + + + + Info: + + + + + true - - - - Started: - - - - - - - Completed: - - - - - - - Directory: - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - 1 - - - - - - - open - - - - - - - true - - - - - - - Current: - - - - - - - Reset download directory - - - ... - - - - :/diagona/icons/diagona/icons/arrow-circle-225-left.png:/diagona/icons/diagona/icons/arrow-circle-225-left.png - - - @@ -134,8 +64,53 @@ - - + + + + + 0 + 0 + + + + + 93 + 0 + + + + download and install + + + download + + + + + + + false + + + + 0 + 0 + + + + Launch + + + + + + + true + + + + + true @@ -151,27 +126,6 @@ - - - - true - - - - - - - Total: - - - - - - - Info: - - - @@ -182,20 +136,71 @@ - - + + + + cancel downloading + + + ... + + + + :/diagona/icons/diagona/icons/cross-circle.png:/diagona/icons/diagona/icons/cross-circle.png + + + + + + + + 0 + 0 + + + + open + + + + + true - - - - download and install + + + + + 0 + 0 + - download + Total: + + + + + + + 1 + + + + + + + Reset download directory + + + ... + + + + :/diagona/icons/diagona/icons/arrow-circle-225-left.png:/diagona/icons/diagona/icons/arrow-circle-225-left.png @@ -206,31 +211,28 @@ - - - - 4 - + + true - - + + + + + 0 + 0 + + - Actions: + Current: - - - 0 - 20 - - 0 @@ -246,13 +248,25 @@ + + + 0 + 0 + + - start after download + launch after download + + + 0 + 0 + + shutdown @@ -261,10 +275,52 @@ - - + + + + + 0 + 0 + + - do it + Directory: + + + + + + + + 0 + 0 + + + + Completed: + + + + + + + + 0 + 0 + + + + Started: + + + + + + + 4 + + + true diff --git a/src/blackgui/components/downloaddialog.cpp b/src/blackgui/components/downloaddialog.cpp index 3c22e43f5..d025ffd53 100644 --- a/src/blackgui/components/downloaddialog.cpp +++ b/src/blackgui/components/downloaddialog.cpp @@ -29,6 +29,7 @@ namespace BlackGui void CDownloadDialog::setDownloadFile(const CRemoteFile &remoteFile) { + setWindowTitle("Downloading " + remoteFile.getName()); ui->comp_Download->setDownloadFile(remoteFile); } @@ -60,13 +61,21 @@ namespace BlackGui void CDownloadDialog::accept() { - ui->comp_Download->triggerDownloadingOfFiles(); + if (! ui->comp_Download->haveAllDownloadsCompleted()) + { + const QString msg = QStringLiteral("Download ongoing. Do you want to abort it?"); + QMessageBox::StandardButton reply = QMessageBox::question(this, "Abort?", msg, QMessageBox::Yes | QMessageBox::No); + if (reply == QMessageBox::Yes) + { + ui->comp_Download->cancelOngoingDownloads(); + this->done(CDownloadDialog::Rejected); + } + } + else + { + this->done(CDownloadDialog::Accepted); + } } - void CDownloadDialog::reject() - { - ui->comp_Download->cancelOngoingDownloads(); - this->done(CDownloadDialog::Rejected); - } } // ns } // ns diff --git a/src/blackgui/components/downloaddialog.h b/src/blackgui/components/downloaddialog.h index 8a2c5433b..d6833ea15 100644 --- a/src/blackgui/components/downloaddialog.h +++ b/src/blackgui/components/downloaddialog.h @@ -56,9 +56,6 @@ namespace BlackGui //! \copydoc QDialog::accept virtual void accept() override; - //! \copydoc QDialog::reject - virtual void reject() override; - private: QScopedPointer ui; }; diff --git a/src/blackgui/components/downloaddialog.ui b/src/blackgui/components/downloaddialog.ui index 9afa6c575..189ad2f18 100644 --- a/src/blackgui/components/downloaddialog.ui +++ b/src/blackgui/components/downloaddialog.ui @@ -2,20 +2,6 @@ CDownloadDialog - - - 0 - 0 - 425 - 265 - - - - - 425 - 0 - - Download files @@ -33,14 +19,7 @@ 6 - - - - 0 - 225 - - - + @@ -48,7 +27,10 @@ Qt::Horizontal - QDialogButtonBox::Abort|QDialogButtonBox::Ok + QDialogButtonBox::Close + + + false @@ -66,33 +48,17 @@ bb_DownloadDialog - accepted() + clicked(QAbstractButton*) CDownloadDialog accept() - 248 - 254 + 102 + 36 - 157 - 274 - - - - - bb_DownloadDialog - rejected() - CDownloadDialog - reject() - - - 316 - 260 - - - 286 - 274 + 102 + 28 diff --git a/src/blackgui/components/updateinfocomponent.cpp b/src/blackgui/components/updateinfocomponent.cpp index 2b2643a36..44efedb63 100644 --- a/src/blackgui/components/updateinfocomponent.cpp +++ b/src/blackgui/components/updateinfocomponent.cpp @@ -174,7 +174,7 @@ namespace BlackGui { m_downloadDialog->setMode(CDownloadComponent::SwiftInstaller); m_downloadDialog->setDownloadFile(artifact.asRemoteFile()); - m_downloadDialog->showAndStartDownloading(); + m_downloadDialog->show(); } }