[Updater] Trigger download from dialog "download and install"

This commit is contained in:
Klaus Basan
2019-11-08 01:46:03 +01:00
committed by Mat Sutcliffe
parent 881ec39043
commit c187c701d5
3 changed files with 16 additions and 5 deletions

View File

@@ -73,6 +73,16 @@ namespace BlackGui
return (vCurrentChannelPlatform > vCurrent);
}
void CUpdateInfoComponent::triggerDownload()
{
QPointer<CUpdateInfoComponent> myself(this);
QTimer::singleShot(10, this, [ = ]
{
if (!myself) { return; }
ui->pb_DownloadInstaller->click();
});
}
void CUpdateInfoComponent::requestLoadOfSetup()
{
if (!sGui || sGui->isShuttingDown()) { return; }

View File

@@ -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(); }

View File

@@ -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)