From b51e46683e660ad035f04d0797458ad7ccd08f7d Mon Sep 17 00:00:00 2001 From: powerjungle Date: Sun, 6 Dec 2020 12:56:38 +0200 Subject: [PATCH 1/3] feat(ui): add warning in GUI when running unstable version Add warning in about window in settings when running a version that isn't tagged. Also print current running version in log. --- src/net/updatecheck.cpp | 5 +++- src/net/updatecheck.h | 1 + src/widget/form/settings/aboutform.cpp | 8 ++++++ src/widget/form/settings/aboutform.h | 1 + src/widget/form/settings/aboutsettings.ui | 35 +++++++++++++++++------ src/widget/style.cpp | 2 ++ src/widget/style.h | 1 + themes/dark/palette.ini | 3 +- themes/dark/window/general.css | 10 +++++-- themes/default/palette.ini | 3 +- themes/default/window/general.css | 10 +++++-- 11 files changed, 64 insertions(+), 15 deletions(-) diff --git a/src/net/updatecheck.cpp b/src/net/updatecheck.cpp index 49a34b671..a027971cf 100644 --- a/src/net/updatecheck.cpp +++ b/src/net/updatecheck.cpp @@ -120,8 +120,11 @@ void UpdateCheck::checkForUpdate() void UpdateCheck::handleResponse(QNetworkReply* reply) { + qInfo() << "qTox is running version:" << GIT_DESCRIBE; + if (isCurrentVersionStable() == false) { - qWarning() << "qTox is running an unstable version"; + qWarning() << "qTox is running an unstable version"; + emit versionIsUnstable(); } assert(reply != nullptr); diff --git a/src/net/updatecheck.h b/src/net/updatecheck.h index 8ca037a80..69d48fdec 100644 --- a/src/net/updatecheck.h +++ b/src/net/updatecheck.h @@ -41,6 +41,7 @@ signals: void updateAvailable(QString latestVersion, QUrl link); void upToDate(); void updateCheckFailed(); + void versionIsUnstable(); private slots: void handleResponse(QNetworkReply* reply); diff --git a/src/widget/form/settings/aboutform.cpp b/src/widget/form/settings/aboutform.cpp index 51540c8d6..2167ad5b0 100644 --- a/src/widget/form/settings/aboutform.cpp +++ b/src/widget/form/settings/aboutform.cpp @@ -62,6 +62,9 @@ AboutForm::AboutForm(UpdateCheck* updateCheck) { bodyUI->setupUi(this); + bodyUI->unstableVersion->setVisible(false); + connect(updateCheck, &UpdateCheck::versionIsUnstable, this, &AboutForm::onUnstableVersion); + // block all child signals during initialization const RecursiveSignalBlocker signalBlocker(this); @@ -187,6 +190,11 @@ void AboutForm::reloadTheme() replaceVersions(); } +void AboutForm::onUnstableVersion() +{ + bodyUI->unstableVersion->setVisible(true); +} + /** * @brief Creates hyperlink with specific style. * @param path The URL of the page the link goes to. diff --git a/src/widget/form/settings/aboutform.h b/src/widget/form/settings/aboutform.h index 9a884cb34..a5976fd6c 100644 --- a/src/widget/form/settings/aboutform.h +++ b/src/widget/form/settings/aboutform.h @@ -48,6 +48,7 @@ public slots: void onUpToDate(); void onUpdateCheckFailed(); void reloadTheme() override; + void onUnstableVersion(); private: void retranslateUi(); diff --git a/src/widget/form/settings/aboutsettings.ui b/src/widget/form/settings/aboutsettings.ui index 99b40c5ed..d6564d8ce 100644 --- a/src/widget/form/settings/aboutsettings.ui +++ b/src/widget/form/settings/aboutsettings.ui @@ -30,8 +30,8 @@ 0 0 - 506 - 550 + 496 + 599 @@ -53,7 +53,7 @@ Version - + @@ -83,7 +83,7 @@ - + @@ -98,7 +98,7 @@ - + @@ -122,7 +122,7 @@ - + @@ -149,7 +149,7 @@ - + @@ -197,7 +197,10 @@ - true + false + + + QFrame::StyledPanel qTox is up to date ✓ @@ -230,6 +233,22 @@ + + + + + + + QFrame::NoFrame + + + Warning! Currently running qTox is unstable. + + + Qt::AlignCenter + + + diff --git a/src/widget/style.cpp b/src/widget/style.cpp index f902002f0..e0ad15d8c 100644 --- a/src/widget/style.cpp +++ b/src/widget/style.cpp @@ -147,6 +147,7 @@ static const QMap aliasColors = { {Style::GroundExtra, "groundExtra"}, {Style::GroundBase, "groundBase"}, {Style::Orange, "orange"}, + {Style::Yellow, "yellow"}, {Style::ThemeDark, "themeDark"}, {Style::ThemeMediumDark, "themeMediumDark"}, {Style::ThemeMedium, "themeMedium"}, @@ -417,6 +418,7 @@ void Style::initDictColor() {"@groundExtra", Style::getColor(Style::GroundExtra).name()}, {"@groundBase", Style::getColor(Style::GroundBase).name()}, {"@orange", Style::getColor(Style::Orange).name()}, + {"@yellow", Style::getColor(Style::Yellow).name()}, {"@action", Style::getColor(Style::Action).name()}, {"@link", Style::getColor(Style::Link).name()}, {"@searchHighlighted", Style::getColor(Style::SearchHighlighted).name()}, diff --git a/src/widget/style.h b/src/widget/style.h index 5a2974f01..7653980af 100644 --- a/src/widget/style.h +++ b/src/widget/style.h @@ -40,6 +40,7 @@ public: GroundExtra, GroundBase, Orange, + Yellow, ThemeDark, ThemeMediumDark, ThemeMedium, diff --git a/themes/dark/palette.ini b/themes/dark/palette.ini index 719d17783..5c077caf4 100644 --- a/themes/dark/palette.ini +++ b/themes/dark/palette.ini @@ -9,6 +9,7 @@ statusActive="#d1d1d1" groundExtra="#d1d1d1" groundBase="#201f1f" orange="#713400" +yellow="#adab00" themeDark="#1c1c1c" themeMediumDark="#2a2a2a" themeMedium="#100f0f" @@ -16,4 +17,4 @@ themeLight="#201f1f" action="#546eff" link="#d292ff" searchHighlighted="#7e2a00" -selectText = "#515151" \ No newline at end of file +selectText = "#515151" diff --git a/themes/dark/window/general.css b/themes/dark/window/general.css index 32ce3045c..107f51505 100644 --- a/themes/dark/window/general.css +++ b/themes/dark/window/general.css @@ -21,13 +21,13 @@ QTabWidget background-color: #100f0f; } -QTabBar::tab:selected +QTabBar::tab:selected { background: #100f0f; color: @mainText; } -QTabBar::tab:!selected +QTabBar::tab:!selected { background: #444242; color: #8e8e8e; @@ -302,3 +302,9 @@ QSplitter:handle color: @groundBase; background-color: @groundBase; } + +QLabel#unstableVersion +{ + color: black; + background-color: @yellow; +} diff --git a/themes/default/palette.ini b/themes/default/palette.ini index 8d7171caf..aeeaaf778 100644 --- a/themes/default/palette.ini +++ b/themes/default/palette.ini @@ -9,6 +9,7 @@ statusActive="#414141" groundExtra="#d1d1d1" groundBase="#ffffff" orange="#ff7700" +yellow="#9c9100" themeDark="#1c1c1c" themeMediumDark="#2a2a2a" themeMedium="#414141" @@ -16,4 +17,4 @@ themeLight="#4e4e4e" action="#1818FF" link="#0000ff" searchHighlighted="#ff7626" -selectText = "#9edeff" \ No newline at end of file +selectText = "#9edeff" diff --git a/themes/default/window/general.css b/themes/default/window/general.css index 11c375d40..70efde9e6 100644 --- a/themes/default/window/general.css +++ b/themes/default/window/general.css @@ -21,13 +21,13 @@ QTabWidget background-color: white; } -QTabBar::tab:selected +QTabBar::tab:selected { background: #2d3136; color: #f1f1f1; } -QTabBar::tab:!selected +QTabBar::tab:!selected { background: #d0d1d1; color: #5e5e5e; @@ -277,3 +277,9 @@ QSplitter:handle color: white; background-color: white; } + +QLabel#unstableVersion +{ + color: @mainText; + background-color: @yellow; +} From f9f85febea71c299572dc4bcf19a4b4ec32bc6de Mon Sep 17 00:00:00 2001 From: powerjungle Date: Tue, 15 Dec 2020 16:28:41 +0200 Subject: [PATCH 2/3] refactor(log): change unstable version warning message --- src/net/updatecheck.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net/updatecheck.cpp b/src/net/updatecheck.cpp index a027971cf..47553cd0d 100644 --- a/src/net/updatecheck.cpp +++ b/src/net/updatecheck.cpp @@ -123,7 +123,7 @@ void UpdateCheck::handleResponse(QNetworkReply* reply) qInfo() << "qTox is running version:" << GIT_DESCRIBE; if (isCurrentVersionStable() == false) { - qWarning() << "qTox is running an unstable version"; + qWarning() << "Currently running an untested/unstable version of qTox"; emit versionIsUnstable(); } From 640493477ddb37b5b6c4b4cb213209e5a1937ae9 Mon Sep 17 00:00:00 2001 From: powerjungle Date: Tue, 15 Dec 2020 16:30:06 +0200 Subject: [PATCH 3/3] refactor(ui): change unstable version warning message --- src/widget/form/settings/aboutsettings.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget/form/settings/aboutsettings.ui b/src/widget/form/settings/aboutsettings.ui index d6564d8ce..6d42aa61a 100644 --- a/src/widget/form/settings/aboutsettings.ui +++ b/src/widget/form/settings/aboutsettings.ui @@ -242,7 +242,7 @@ QFrame::NoFrame - Warning! Currently running qTox is unstable. + Currently running an untested/unstable version of qTox Qt::AlignCenter