diff --git a/src/blackgui/components/updateinfocomponent.cpp b/src/blackgui/components/updateinfocomponent.cpp index 2b2643a36..8299b7b88 100644 --- a/src/blackgui/components/updateinfocomponent.cpp +++ b/src/blackgui/components/updateinfocomponent.cpp @@ -73,6 +73,16 @@ namespace BlackGui return (vCurrentChannelPlatform > vCurrent); } + void CUpdateInfoComponent::triggerDownload() + { + QPointer myself(this); + QTimer::singleShot(10, this, [ = ] + { + if (!myself) { return; } + ui->pb_DownloadInstaller->click(); + }); + } + void CUpdateInfoComponent::requestLoadOfSetup() { if (!sGui || sGui->isShuttingDown()) { return; } diff --git a/src/blackgui/components/updateinfocomponent.h b/src/blackgui/components/updateinfocomponent.h index 7ee1ca108..a392e94b6 100644 --- a/src/blackgui/components/updateinfocomponent.h +++ b/src/blackgui/components/updateinfocomponent.h @@ -39,7 +39,7 @@ namespace BlackGui explicit CUpdateInfoComponent(QWidget *parent = nullptr); //! Dtor - virtual ~CUpdateInfoComponent(); + virtual ~CUpdateInfoComponent() override; //! Is there a new version available return version, else empty string BlackMisc::Db::CArtifact getLatestAvailablePilotClientArtifactForSelection() const; @@ -47,6 +47,9 @@ namespace BlackGui //! Is there a new version available? bool isNewPilotClientVersionAvailable() const; + //! Trigger download + void triggerDownload(); + //! Current distribution BlackMisc::Db::CDistribution getCurrentDistribution() const { return this->getSelectedOrDefaultDistribution(); } diff --git a/src/blackgui/components/updateinfodialog.cpp b/src/blackgui/components/updateinfodialog.cpp index 6bd135dab..1d06ee67d 100644 --- a/src/blackgui/components/updateinfodialog.cpp +++ b/src/blackgui/components/updateinfodialog.cpp @@ -47,10 +47,8 @@ namespace BlackGui const CDistribution distribution = ui->comp_UpdateInfo->getCurrentDistribution(); if (!distribution.hasDownloadUrls()) { return QDialog::Rejected; } - // in future, start download and close application - // for now, just open URL - QDesktopServices::openUrl(distribution.getDownloadUrls().getRandomUrl()); - return QDialog::Rejected; + ui->comp_UpdateInfo->triggerDownload(); + return r; } bool CUpdateInfoDialog::event(QEvent *event)