refs #883, improved layout of launcher`s "new version" section

* group boxes
* header bar if new version is avilable
This commit is contained in:
Klaus Basan
2017-02-16 01:23:50 +01:00
committed by Mathew Sutcliffe
parent c5b4b01a90
commit 4a31fa1cba
2 changed files with 183 additions and 118 deletions

View File

@@ -52,7 +52,7 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
connect(sGui, &CApplication::updateInfoAvailable, this, &CSwiftLauncher::ps_loadedUpdateInfo);
QTimer::singleShot(10 * 1000, this, [ = ]
{
if (this->m_updateInfoLoaded) { return; }
if (m_updateInfoLoaded) { return; }
this->ps_loadedUpdateInfo(true); // failover
});
@@ -60,13 +60,13 @@ CSwiftLauncher::CSwiftLauncher(QWidget *parent) :
ui->le_DBusServerPort->setValidator(new QIntValidator(0, 65535, this));
// default from settings
const QString dbus(this->m_dbusServerAddress.getThreadLocal());
const QString dbus(m_dbusServerAddress.getThreadLocal());
this->setDefault(dbus);
// periodically check
connect(&this->m_checkTimer, &QTimer::timeout, this, &CSwiftLauncher::ps_checkRunningApplications);
this->m_checkTimer.setInterval(5000);
this->m_checkTimer.start();
connect(&m_checkTimer, &QTimer::timeout, this, &CSwiftLauncher::ps_checkRunningApplications);
m_checkTimer.setInterval(5000);
m_checkTimer.start();
}
@@ -75,7 +75,7 @@ CSwiftLauncher::~CSwiftLauncher()
QString CSwiftLauncher::getCmdLine() const
{
return toCmdLine(this->m_executable, this->m_executableArgs);
return toCmdLine(m_executable, m_executableArgs);
}
CEnableForFramelessWindow::WindowMode CSwiftLauncher::getWindowMode() const
@@ -135,9 +135,9 @@ void CSwiftLauncher::init()
{
sGui->initMainApplicationWindow(this);
this->m_mwaOverlayFrame = ui->fr_SwiftLauncherMain;
this->m_mwaStatusBar = nullptr;
this->m_mwaLogComponent = ui->fr_SwiftLauncherLog;
m_mwaOverlayFrame = ui->fr_SwiftLauncherMain;
m_mwaStatusBar = nullptr;
m_mwaLogComponent = ui->fr_SwiftLauncherLog;
ui->lbl_NewVersionUrl->setTextFormat(Qt::RichText);
ui->lbl_NewVersionUrl->setTextInteractionFlags(Qt::TextBrowserInteraction);
@@ -151,6 +151,7 @@ void CSwiftLauncher::init()
this->initDBusGui();
this->initVersion();
ui->lbl_HeaderInfo->setVisible(false);
ui->sw_SwiftLauncher->setCurrentWidget(ui->pg_SwiftLauncherMain);
ui->tb_Launcher->setCurrentWidget(ui->pg_CoreMode);
}
@@ -218,7 +219,7 @@ void CSwiftLauncher::initLogDisplay()
void CSwiftLauncher::startSwiftCore()
{
const QString dBus(this->getDBusAddress());
this->m_dbusServerAddress.setAndSave(dBus);
m_dbusServerAddress.setAndSave(dBus);
QStringList args(
{
"--start",
@@ -238,7 +239,7 @@ void CSwiftLauncher::startSwiftCore()
CLogMessage(this).info(this->getCmdLine());
// start
QProcess::startDetached(this->m_executable, this->m_executableArgs);
QProcess::startDetached(m_executable, m_executableArgs);
}
void CSwiftLauncher::setSwiftDataExecutable()
@@ -265,7 +266,7 @@ bool CSwiftLauncher::setSwiftGuiExecutable()
if (!this->isStandaloneGuiSelected())
{
const QString dBus(this->getDBusAddress());
this->m_dbusServerAddress.setAndSave(dBus);
m_dbusServerAddress.setAndSave(dBus);
args.append("--dbus");
args.append(dBus); // already converted
@@ -342,22 +343,26 @@ void CSwiftLauncher::ps_loadedUpdateInfo(bool success)
return;
}
this->m_updateInfoLoaded = true;
const CUpdateInfo updateInfo(this->m_updateInfo.get());
m_updateInfoLoaded = true;
const CUpdateInfo updateInfo(m_updateInfo.get());
const QString latestVersion(updateInfo.getLatestVersion()) ; // need to get this from somewhere
CFailoverUrlList downloadUrls(updateInfo.getDownloadUrls());
bool newVersionAvailable = CVersion::isNewerVersion(latestVersion) && !downloadUrls.isEmpty();
const bool newVersionAvailable = CVersion::isNewerVersion(latestVersion) && !downloadUrls.isEmpty();
ui->wi_NewVersionAvailable->setVisible(newVersionAvailable);
ui->wi_NoNewVersion->setVisible(!newVersionAvailable);
ui->le_LatestVersion->setText(latestVersion);
ui->le_Channel->setText(updateInfo.getChannel());
ui->lbl_HeaderInfo->setVisible(newVersionAvailable);
ui->lbl_HeaderInfo->setText("New version " + latestVersion + " available");
ui->lbl_HeaderInfo->setStyleSheet("background: red; color: yellow;");
if (!downloadUrls.isEmpty())
{
const CUrl downloadUrl(downloadUrls.obtainNextUrl());
const QString urlStr(downloadUrl.toQString());
QString hl("<a href=\"%1\">%2 %3</a>");
ui->lbl_NewVersionUrl->setText(hl.arg(urlStr).arg(urlStr).arg(latestVersion));
const QString hl("<a href=\"%1\"><img src=\":/own/icons/own/drophere16.png\"></a>");
ui->lbl_NewVersionUrl->setText(hl.arg(urlStr));
ui->lbl_NewVersionUrl->setToolTip("Download " + latestVersion);
}
this->loadLatestNews();
@@ -382,7 +387,7 @@ void CSwiftLauncher::ps_startButtonPressed()
else if (sender == ui->tb_SwiftMappingTool)
{
ui->tb_SwiftMappingTool->setEnabled(false);
this->m_startMappingToolWaitCycles = 2;
m_startMappingToolWaitCycles = 2;
this->setSwiftDataExecutable();
this->accept();
}
@@ -390,7 +395,7 @@ void CSwiftLauncher::ps_startButtonPressed()
{
if (this->isStandaloneGuiSelected()) { ui->rb_SwiftCoreGuiAudio->setChecked(true); }
ui->tb_SwiftCore->setEnabled(false);
this->m_startCoreWaitCycles = 2;
m_startCoreWaitCycles = 2;
this->startSwiftCore();
}
else if (sender == ui->tb_Database)
@@ -461,9 +466,9 @@ void CSwiftLauncher::ps_showLogPage()
void CSwiftLauncher::ps_checkRunningApplications()
{
const CApplicationInfoList runningApps = sGui->getRunningApplications();
if (this->m_startCoreWaitCycles > 0) { this->m_startCoreWaitCycles--; }
if (m_startCoreWaitCycles > 0) { m_startCoreWaitCycles--; }
else { ui->tb_SwiftCore->setEnabled(true); }
if (this->m_startMappingToolWaitCycles > 0) { this->m_startMappingToolWaitCycles--; }
if (m_startMappingToolWaitCycles > 0) { m_startMappingToolWaitCycles--; }
else { ui->tb_SwiftMappingTool->setEnabled(true); }
for (const CApplicationInfo &info : runningApps)

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>650</height>
<height>700</height>
</rect>
</property>
<property name="windowTitle">
@@ -37,6 +37,9 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pg_SwiftLauncherMain">
<layout class="QVBoxLayout" name="wl_SwiftLauncherMainPage">
<property name="spacing">
@@ -56,15 +59,9 @@
</property>
<item>
<widget class="BlackGui::COverlayMessagesFrame" name="fr_SwiftLauncherMain">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="vl_SwiftLauncherMain">
<property name="spacing">
<number>25</number>
<number>20</number>
</property>
<property name="leftMargin">
<number>0</number>
@@ -75,10 +72,17 @@
<property name="rightMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="lbl_HeaderInfo">
<property name="text">
<string>header info goes here</string>
</property>
</widget>
</item>
<item>
<widget class="QToolBox" name="tb_Launcher">
<property name="currentIndex">
<number>4</number>
<number>3</number>
</property>
<property name="tabSpacing">
<number>6</number>
@@ -88,8 +92,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>326</height>
<width>392</width>
<height>349</height>
</rect>
</property>
<attribute name="label">
@@ -119,8 +123,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>326</height>
<width>392</width>
<height>349</height>
</rect>
</property>
<attribute name="label">
@@ -184,8 +188,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>376</width>
<height>331</height>
<width>392</width>
<height>349</height>
</rect>
</property>
<attribute name="label">
@@ -428,37 +432,18 @@
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>326</height>
<width>392</width>
<height>349</height>
</rect>
</property>
<attribute name="label">
<string>Check for &amp;updates</string>
</attribute>
<layout class="QVBoxLayout" name="vl_Updates">
<property name="leftMargin">
<number>9</number>
</property>
<property name="topMargin">
<number>9</number>
</property>
<item>
<widget class="BlackGui::Components::CInfoBarWebReadersStatusSmallComponent" name="comp_InfoBar">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<widget class="QFrame" name="fr_SoftwareUpdates">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<widget class="QGroupBox" name="gb_SoftwareUpdates">
<property name="title">
<string>Software</string>
</property>
<layout class="QGridLayout" name="gl_Version">
<property name="leftMargin">
@@ -473,48 +458,6 @@
<property name="bottomMargin">
<number>2</number>
</property>
<item row="1" column="0">
<widget class="QLabel" name="lbl_Channel">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_Channel">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_CurrentVersion">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lbl_LatestVersion">
<property name="text">
<string>Latest version:</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_CurrentVersion">
<property name="text">
<string>This version:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="le_LatestVersion">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1" colspan="3">
<widget class="QWidget" name="wi_NoNewVersion" native="true">
<layout class="QVBoxLayout" name="vl_NoNewVersion">
@@ -562,16 +505,51 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_NewVersionUrl">
<property name="text">
<string>URL goes here</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_Channel">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="lbl_CurrentVersion">
<property name="text">
<string>This version:</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="lbl_LatestVersion">
<property name="text">
<string>Latest version:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lbl_Channel">
<property name="text">
<string>Channel:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_CurrentVersion">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLineEdit" name="le_LatestVersion">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="pb_CheckForUpdates">
<property name="text">
@@ -579,17 +557,99 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="lbl_NewVersionUrl">
<property name="text">
<string>URL goes here</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="BlackGui::Components::CDbLoadOverviewComponent" name="comp_DataUpdates">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<widget class="QGroupBox" name="gb_DataUpdates">
<property name="title">
<string>Data</string>
</property>
<layout class="QVBoxLayout" name="vl_DataUpdates">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="sa_DataUpdates">
<property name="styleSheet">
<string notr="true">border: 0px;</string>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="qw_DataUpdates">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>368</width>
<height>185</height>
</rect>
</property>
<layout class="QVBoxLayout" name="vl_DataUpdatesScrollArea">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item>
<widget class="BlackGui::Components::CInfoBarWebReadersStatusSmallComponent" name="comp_InfoBar">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</widget>
</item>
<item>
<widget class="BlackGui::Components::CDbLoadOverviewComponent" name="comp_DataUpdates">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<zorder>comp_InfoBar</zorder>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
@@ -599,8 +659,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<height>326</height>
<width>392</width>
<height>349</height>
</rect>
</property>
<attribute name="label">
@@ -653,7 +713,7 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>390</width>
<width>392</width>
<height>112</height>
</rect>
</property>