Ref T203, moved distribution info component to update info component

* adjusted components like launcher etc.
* deleted CDistributionInfoComponent
* CUpdateInfoComponent uses TUpdateInfo/CUpdateInfo
* UI adjustments
This commit is contained in:
Klaus Basan
2017-12-09 19:56:32 +01:00
parent 0daf4ba087
commit 67f927c3f6
10 changed files with 317 additions and 294 deletions

View File

@@ -40,6 +40,7 @@ using namespace BlackCore::Context;
using namespace BlackCore::Data;
using namespace BlackCore::Vatsim;
using namespace BlackMisc;
using namespace BlackMisc::Db;
using namespace BlackMisc::Network;
CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
@@ -62,7 +63,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
connect(ui->rb_SwiftCoreAudioOnGui, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased);
connect(ui->rb_SwiftStandalone, &QRadioButton::released, this, &CSwiftLauncher::onCoreModeReleased);
connect(ui->comp_DistributionInfo, &CDistributionInfoComponent::distributionInfoAvailable, this, &CSwiftLauncher::distributionInfoAvailable);
connect(ui->comp_UpdateInfo, &CUpdateInfoComponent::updateInfoAvailable, this, &CSwiftLauncher::updateInfoAvailable);
connect(ui->comp_DBusSelector, &CDBusServerAddressSelector::editingFinished, this, &CSwiftLauncher::onDBusEditingFinished);
connect(sGui, &CGuiApplication::styleSheetsChanged, this, &CSwiftLauncher::onStyleSheetsChanged);
@@ -142,9 +143,9 @@ void CSwiftLauncher::displayLatestNews(QNetworkReply *reply)
}
}
void CSwiftLauncher::distributionInfoAvailable()
void CSwiftLauncher::updateInfoAvailable()
{
this->setHeaderInfo(ui->comp_DistributionInfo->getNewAvailableVersionForSelection());
this->setHeaderInfo(ui->comp_UpdateInfo->getLatestAvailablePilotClientArtifactForSelection());
this->loadLatestNews();
this->loadAbout();
}
@@ -221,12 +222,16 @@ void CSwiftLauncher::initLogDisplay()
ui->comp_SwiftLauncherLog->filterUseRadioButtonDescriptiveIcons(false);
}
void CSwiftLauncher::setHeaderInfo(const QString &newVersionAvailable)
void CSwiftLauncher::setHeaderInfo(const CArtifact &latestArtifact)
{
ui->lbl_HeaderInfo->setVisible(!newVersionAvailable.isEmpty());
if (!newVersionAvailable.isEmpty())
const bool isNewer = latestArtifact.isNewerThanCurrentBuild();
ui->lbl_HeaderInfo->setVisible(isNewer);
if (isNewer)
{
ui->lbl_HeaderInfo->setText("New version '" + newVersionAvailable + "' available");
static const QString t("New version '%1' ['%2'/'%3']");
ui->lbl_HeaderInfo->setText(
t.arg(latestArtifact.getVersionString(), latestArtifact.getPlatform().getPlatformName(),
latestArtifact.getMostStableDistribution().getChannel()));
ui->lbl_HeaderInfo->setStyleSheet("background: red; color: yellow;");
}
}

View File

@@ -18,6 +18,7 @@
#include "blackcore/data/globalsetup.h"
#include "blackcore/data/launchersetup.h"
#include "blackcore/coremodeenums.h"
#include "blackmisc/db/artifact.h"
#include "blackmisc/identifiable.h"
#include <QDialog>
#include <QTimer>
@@ -110,7 +111,7 @@ private:
void initLogDisplay();
//! Set header info
void setHeaderInfo(const QString &newVersionAvailable);
void setHeaderInfo(const BlackMisc::Db::CArtifact &latestArtifact);
//! Latest news
//! \sa CSwiftLauncher::displayLatestNews
@@ -147,7 +148,7 @@ private:
void displayLatestNews(QNetworkReply *reply);
//! Distribution info is available
void distributionInfoAvailable();
void updateInfoAvailable();
//! Start button pressed
void startButtonPressed();

View File

@@ -393,7 +393,7 @@
<number>4</number>
</property>
<item>
<widget class="BlackGui::Components::CDistributionInfoComponent" name="comp_DistributionInfo">
<widget class="BlackGui::Components::CUpdateInfoComponent" name="comp_UpdateInfo">
<property name="minimumSize">
<size>
<width>0</width>
@@ -760,9 +760,9 @@ p, li { white-space: pre-wrap; }
<container>1</container>
</customwidget>
<customwidget>
<class>BlackGui::Components::CDistributionInfoComponent</class>
<class>BlackGui::Components::CUpdateInfoComponent</class>
<extends>QFrame</extends>
<header>blackgui/components/distributioninfocomponent.h</header>
<header>blackgui/components/updateinfocomponent.h</header>
<container>1</container>
</customwidget>
<customwidget>