From 4a31fa1cbacc20fb9812735178fd90d241b14fdb Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Thu, 16 Feb 2017 01:23:50 +0100 Subject: [PATCH] refs #883, improved layout of launcher`s "new version" section * group boxes * header bar if new version is avilable --- src/swiftlauncher/swiftlauncher.cpp | 47 ++--- src/swiftlauncher/swiftlauncher.ui | 254 +++++++++++++++++----------- 2 files changed, 183 insertions(+), 118 deletions(-) diff --git a/src/swiftlauncher/swiftlauncher.cpp b/src/swiftlauncher/swiftlauncher.cpp index eca5a2c53..2f2e50bb4 100644 --- a/src/swiftlauncher/swiftlauncher.cpp +++ b/src/swiftlauncher/swiftlauncher.cpp @@ -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("%2 %3"); - ui->lbl_NewVersionUrl->setText(hl.arg(urlStr).arg(urlStr).arg(latestVersion)); + const QString hl(""); + 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) diff --git a/src/swiftlauncher/swiftlauncher.ui b/src/swiftlauncher/swiftlauncher.ui index c7a52ea91..d27df74f3 100644 --- a/src/swiftlauncher/swiftlauncher.ui +++ b/src/swiftlauncher/swiftlauncher.ui @@ -7,7 +7,7 @@ 0 0 400 - 650 + 700 @@ -37,6 +37,9 @@ QFrame::Raised + + 0 + @@ -56,15 +59,9 @@ - - QFrame::StyledPanel - - - QFrame::Raised - - 25 + 20 0 @@ -75,10 +72,17 @@ 0 + + + + header info goes here + + + - 4 + 3 6 @@ -88,8 +92,8 @@ 0 0 - 390 - 326 + 392 + 349 @@ -119,8 +123,8 @@ 0 0 - 390 - 326 + 392 + 349 @@ -184,8 +188,8 @@ 0 0 - 376 - 331 + 392 + 349 @@ -428,37 +432,18 @@ 0 0 - 390 - 326 + 392 + 349 Check for &updates - - 9 - - - 9 - - - - QFrame::StyledPanel - - - QFrame::Raised - - - - - - - QFrame::StyledPanel - - - QFrame::Raised + + + Software @@ -473,48 +458,6 @@ 2 - - - - Channel: - - - - - - - true - - - - - - - true - - - - - - - Latest version: - - - - - - - This version: - - - - - - - true - - - @@ -562,16 +505,51 @@ - - - - URL goes here - - - + + + + true + + + + + + + This version: + + + + + + + Latest version: + + + + + + + Channel: + + + + + + + true + + + + + + + true + + + @@ -579,17 +557,99 @@ + + + + URL goes here + + + - - - QFrame::StyledPanel - - - QFrame::Raised + + + Data + + + 0 + + + 0 + + + 0 + + + 0 + + + + + border: 0px; + + + QFrame::NoFrame + + + QFrame::Plain + + + 0 + + + true + + + + + 0 + 0 + 368 + 185 + + + + + 3 + + + 3 + + + 3 + + + 3 + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + comp_InfoBar + + + + + + + @@ -599,8 +659,8 @@ 0 0 - 390 - 326 + 392 + 349 @@ -653,7 +713,7 @@ p, li { white-space: pre-wrap; } 0 0 - 390 + 392 112