Fixed update info

* save before displaying "update info" as it relies on saved channel
* signal to indicate new version, using that for launcher header
This commit is contained in:
Klaus Basan
2019-03-06 17:47:55 +01:00
committed by Mat Sutcliffe
parent e6096abf57
commit 1dd6a0852d
4 changed files with 29 additions and 15 deletions

View File

@@ -137,7 +137,7 @@ namespace BlackGui
const QString platform = ui->cb_Platforms->currentText();
if (!CPlatform::isCurrentPlatform(platform))
{
const QMessageBox::StandardButton ret = QMessageBox::warning(this, tr("Download installer"),
const QMessageBox::StandardButton ret = QMessageBox::warning(this, "Download installer",
QStringLiteral(
"The platform '%1' does not match your current platform '%2'.\n"
"Do you want to continue?").arg(platform, CPlatform::currentPlatform().getPlatformName()),
@@ -197,7 +197,8 @@ namespace BlackGui
// for XSwiftBus we only show public (unrestricted) ones, as the follow up dialog will only show unrestricted
const CUpdateInfo updateInfo(m_updateInfo.get());
const CArtifactList artifactsPilotClient = updateInfo.getArtifactsPilotClient().findByDistributionAndPlatform(selectedDistribution, selectedPlatform, true);
const CArtifactList artifactsXsb = updateInfo.getArtifactsXSwiftBus().findWithUnrestrictedDistributions().findByDistributionAndPlatform(selectedDistribution, selectedPlatform, true);
const CArtifactList artifactsXsb = updateInfo.getArtifactsXSwiftBus().findWithUnrestrictedDistributions().findByDistributionAndPlatform(selectedDistribution, selectedPlatform, true);
const CArtifact latestPilotClient = artifactsPilotClient.getLatestArtifactOrDefault();
const QStringList sortedPilotClientVersions = artifactsPilotClient.getSortedVersions();
ui->cb_ArtifactsPilotClient->clear();
@@ -209,6 +210,9 @@ namespace BlackGui
ui->cb_ArtifactsXsb->insertItems(0, sortedXsbVersions);
ui->pb_DownloadXSwiftBus->setEnabled(!artifactsXsb.isEmpty());
// save the settings as this is needed afterwards
this->saveSettings();
//! \fixme hardcoded stylesheet color
const bool newer = this->isNewPilotClientVersionAvailable();
ui->lbl_StatusInfo->setText(newer ? "New version available" : "Nothing new");
@@ -216,8 +220,12 @@ namespace BlackGui
"background-color: green; color: white;" :
"background-color: red; color: white;");
this->saveSettings();
emit this->selectionChanged();
if (newer && latestPilotClient.isLoadedFromDb())
{
emit this->newerPilotClientAvailable(latestPilotClient);
}
}
const CPlatform &CUpdateInfoComponent::getSelectedOrDefaultPlatform() const

View File

@@ -14,6 +14,7 @@
#include "blackcore/application/updatesettings.h"
#include "blackgui/blackguiexport.h"
#include "blackmisc/db/updateinfo.h"
#include "blackmisc/db/artifact.h"
#include "blackmisc/settingscache.h"
#include "blackmisc/digestsignal.h"
#include <QFrame>
@@ -53,6 +54,9 @@ namespace BlackGui
//! Update info loaded
void updateInfoAvailable();
//! A newer pilot client is available
void newerPilotClientAvailable(const BlackMisc::Db::CArtifact &latestPilotClient);
//! New platfrom or channel
void selectionChanged();

View File

@@ -56,21 +56,23 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
this->init();
connect(ui->tb_SwiftCore, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
connect(ui->tb_SwiftMappingTool, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
connect(ui->tb_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
connect(ui->tb_SwiftGui, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
connect(ui->tb_Database, &QPushButton::pressed, this, &CSwiftLauncher::startButtonPressed);
connect(ui->tb_BackToMain, &QToolButton::pressed, this, &CSwiftLauncher::showMainPage);
connect(ui->tb_ConfigurationWizard, &QToolButton::pressed, this, &CSwiftLauncher::startWizard);
connect(ui->tb_Launcher, &QToolBox::currentChanged, this, &CSwiftLauncher::tabChanged);
connect(ui->rb_SwiftCoreAudioOnCore, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased);
connect(ui->rb_SwiftCoreAudioOnGui, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased);
connect(ui->rb_SwiftStandalone, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased);
connect(ui->rb_SwiftCoreAudioOnGui, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased);
connect(ui->rb_SwiftStandalone, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased);
connect(ui->comp_UpdateInfo, &CUpdateInfoComponent::updateInfoAvailable, this, &CSwiftLauncher::updateInfoAvailable);
connect(ui->comp_DBusSelector, &CDBusServerAddressSelector::editingFinished, this, &CSwiftLauncher::onDBusEditingFinished);
connect(ui->comp_UpdateInfo, &CUpdateInfoComponent::updateInfoAvailable, this, &CSwiftLauncher::updateInfoAvailable, Qt::QueuedConnection);
connect(ui->comp_UpdateInfo, &CUpdateInfoComponent::newerPilotClientAvailable, this, &CSwiftLauncher::setHeaderInfo, Qt::QueuedConnection);
connect(ui->comp_DBusSelector, &CDBusServerAddressSelector::editingFinished, this, &CSwiftLauncher::onDBusEditingFinished, Qt::QueuedConnection);
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CSwiftLauncher::onStyleSheetsChanged, Qt::QueuedConnection);
new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(showLogPage()));
const QShortcut *logPageShortCut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_L), this, SLOT(showLogPage()));
Q_UNUSED(logPageShortCut);
// default from settings
this->setDefaults();
@@ -86,7 +88,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
const QPointer<CSwiftLauncher> myself(this);
QTimer::singleShot(2500, this, [ = ]
{
if (!myself) { return; }
if (!sGui || sGui->isShuttingDown() || !myself) { return; }
myself->startWizard();
});
}
@@ -198,7 +200,7 @@ void CSwiftLauncher::loadLatestNews()
CFailoverUrlList newsUrls(sGui->getGlobalSetup().getSwiftLatestNewsUrls());
const CUrl newsUrl(newsUrls.obtainNextWorkingUrl(true, 10 * 1000));
// const CUrl newsUrl("https://dev.swift-project.org/phame/blog/view/1/");
// const CUrl newsUrl("https://dev.swift-project.org/phame/blog/view/1/?__print__=1");
if (newsUrl.isEmpty())
{

View File

@@ -88,7 +88,7 @@
<item>
<widget class="QToolBox" name="tb_Launcher">
<property name="currentIndex">
<number>0</number>
<number>3</number>
</property>
<property name="tabSpacing">
<number>6</number>
@@ -403,7 +403,7 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>100</height>
<height>110</height>
</size>
</property>
</widget>
@@ -443,7 +443,7 @@
<x>0</x>
<y>0</y>
<width>376</width>
<height>136</height>
<height>126</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vl_DataUpdatesScrollArea">