Ref T203, download component (generic file download)

This commit is contained in:
Klaus Basan
2017-12-12 20:40:20 +01:00
parent 45d02bd22a
commit 9cc38c7f39
8 changed files with 1051 additions and 0 deletions

View File

@@ -10,6 +10,7 @@
#include "updateinfocomponent.h"
#include "ui_updateinfocomponent.h"
#include "installxswiftbusdialog.h"
#include "downloaddialog.h"
#include "blackgui/guiapplication.h"
#include "blackmisc/network/networkutils.h"
#include "blackmisc/db/distributionlist.h"
@@ -130,6 +131,31 @@ namespace BlackGui
m_installXSwiftBusDialog->show();
}
void CUpdateInfoComponent::downloadInstallerDialog()
{
const CUpdateInfo update(m_updateInfo.get());
const QString currentVersion = ui->cb_ArtifactsPilotClient->currentText();
const CArtifact artifact = update.getArtifactsPilotClient().findFirstByVersionOrDefault(currentVersion);
if (!m_downloadDialog)
{
m_downloadDialog.reset(new CDownloadDialog(this));
m_downloadDialog->setModal(true);
}
const CRemoteFile rf = artifact.asRemoteFile();
if (rf.getUrl().isHavingHtmlSuffix())
{
QDesktopServices::openUrl(rf.getUrl());
}
else
{
m_downloadDialog->setMode(CDownloadComponent::SwiftInstaller);
m_downloadDialog->setDownloadFile(artifact.asRemoteFile());
m_downloadDialog->showAndStartDownloading();
}
}
void CUpdateInfoComponent::saveSettings()
{
const QString channel = this->getSelectedOrDefaultDistribution().getChannel();