Browse Source

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.
reviewable/pr6272/r1
powerjungle 6 years ago
parent
commit
b51e46683e
No known key found for this signature in database
GPG Key ID: 190C37B0F8665DA8
  1. 5
      src/net/updatecheck.cpp
  2. 1
      src/net/updatecheck.h
  3. 8
      src/widget/form/settings/aboutform.cpp
  4. 1
      src/widget/form/settings/aboutform.h
  5. 35
      src/widget/form/settings/aboutsettings.ui
  6. 2
      src/widget/style.cpp
  7. 1
      src/widget/style.h
  8. 3
      themes/dark/palette.ini
  9. 10
      themes/dark/window/general.css
  10. 3
      themes/default/palette.ini
  11. 10
      themes/default/window/general.css

5
src/net/updatecheck.cpp

@ -120,8 +120,11 @@ void UpdateCheck::checkForUpdate()
void UpdateCheck::handleResponse(QNetworkReply* reply) void UpdateCheck::handleResponse(QNetworkReply* reply)
{ {
qInfo() << "qTox is running version:" << GIT_DESCRIBE;
if (isCurrentVersionStable() == false) { if (isCurrentVersionStable() == false) {
qWarning() << "qTox is running an unstable version"; qWarning() << "qTox is running an unstable version";
emit versionIsUnstable();
} }
assert(reply != nullptr); assert(reply != nullptr);

1
src/net/updatecheck.h

@ -41,6 +41,7 @@ signals:
void updateAvailable(QString latestVersion, QUrl link); void updateAvailable(QString latestVersion, QUrl link);
void upToDate(); void upToDate();
void updateCheckFailed(); void updateCheckFailed();
void versionIsUnstable();
private slots: private slots:
void handleResponse(QNetworkReply* reply); void handleResponse(QNetworkReply* reply);

8
src/widget/form/settings/aboutform.cpp

@ -62,6 +62,9 @@ AboutForm::AboutForm(UpdateCheck* updateCheck)
{ {
bodyUI->setupUi(this); bodyUI->setupUi(this);
bodyUI->unstableVersion->setVisible(false);
connect(updateCheck, &UpdateCheck::versionIsUnstable, this, &AboutForm::onUnstableVersion);
// block all child signals during initialization // block all child signals during initialization
const RecursiveSignalBlocker signalBlocker(this); const RecursiveSignalBlocker signalBlocker(this);
@ -187,6 +190,11 @@ void AboutForm::reloadTheme()
replaceVersions(); replaceVersions();
} }
void AboutForm::onUnstableVersion()
{
bodyUI->unstableVersion->setVisible(true);
}
/** /**
* @brief Creates hyperlink with specific style. * @brief Creates hyperlink with specific style.
* @param path The URL of the page the link goes to. * @param path The URL of the page the link goes to.

1
src/widget/form/settings/aboutform.h

@ -48,6 +48,7 @@ public slots:
void onUpToDate(); void onUpToDate();
void onUpdateCheckFailed(); void onUpdateCheckFailed();
void reloadTheme() override; void reloadTheme() override;
void onUnstableVersion();
private: private:
void retranslateUi(); void retranslateUi();

35
src/widget/form/settings/aboutsettings.ui

@ -30,8 +30,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>506</width> <width>496</width>
<height>550</height> <height>599</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0,0"> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0,0">
@ -53,7 +53,7 @@
<string>Version</string> <string>Version</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="1" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QLabel" name="youAreUsing"> <widget class="QLabel" name="youAreUsing">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -83,7 +83,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="4" column="1">
<widget class="QLabel" name="qtVersion"> <widget class="QLabel" name="qtVersion">
<property name="font"> <property name="font">
<font> <font>
@ -98,7 +98,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="toxCoreVersion"> <widget class="QLabel" name="toxCoreVersion">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -122,7 +122,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="3" column="0" colspan="2">
<widget class="QLabel" name="gitVersion"> <widget class="QLabel" name="gitVersion">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
@ -149,7 +149,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="2"> <item row="1" column="0" colspan="2">
<widget class="QStackedWidget" name="updateStack"> <widget class="QStackedWidget" name="updateStack">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
@ -197,7 +197,10 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="autoFillBackground"> <property name="autoFillBackground">
<bool>true</bool> <bool>false</bool>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property> </property>
<property name="text"> <property name="text">
<string>qTox is up to date ✓</string> <string>qTox is up to date ✓</string>
@ -230,6 +233,22 @@
</widget> </widget>
</widget> </widget>
</item> </item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="unstableVersion">
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="text">
<string>Warning! Currently running qTox is unstable.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

2
src/widget/style.cpp

@ -147,6 +147,7 @@ static const QMap<Style::ColorPalette, QString> aliasColors = {
{Style::GroundExtra, "groundExtra"}, {Style::GroundExtra, "groundExtra"},
{Style::GroundBase, "groundBase"}, {Style::GroundBase, "groundBase"},
{Style::Orange, "orange"}, {Style::Orange, "orange"},
{Style::Yellow, "yellow"},
{Style::ThemeDark, "themeDark"}, {Style::ThemeDark, "themeDark"},
{Style::ThemeMediumDark, "themeMediumDark"}, {Style::ThemeMediumDark, "themeMediumDark"},
{Style::ThemeMedium, "themeMedium"}, {Style::ThemeMedium, "themeMedium"},
@ -417,6 +418,7 @@ void Style::initDictColor()
{"@groundExtra", Style::getColor(Style::GroundExtra).name()}, {"@groundExtra", Style::getColor(Style::GroundExtra).name()},
{"@groundBase", Style::getColor(Style::GroundBase).name()}, {"@groundBase", Style::getColor(Style::GroundBase).name()},
{"@orange", Style::getColor(Style::Orange).name()}, {"@orange", Style::getColor(Style::Orange).name()},
{"@yellow", Style::getColor(Style::Yellow).name()},
{"@action", Style::getColor(Style::Action).name()}, {"@action", Style::getColor(Style::Action).name()},
{"@link", Style::getColor(Style::Link).name()}, {"@link", Style::getColor(Style::Link).name()},
{"@searchHighlighted", Style::getColor(Style::SearchHighlighted).name()}, {"@searchHighlighted", Style::getColor(Style::SearchHighlighted).name()},

1
src/widget/style.h

@ -40,6 +40,7 @@ public:
GroundExtra, GroundExtra,
GroundBase, GroundBase,
Orange, Orange,
Yellow,
ThemeDark, ThemeDark,
ThemeMediumDark, ThemeMediumDark,
ThemeMedium, ThemeMedium,

3
themes/dark/palette.ini

@ -9,6 +9,7 @@ statusActive="#d1d1d1"
groundExtra="#d1d1d1" groundExtra="#d1d1d1"
groundBase="#201f1f" groundBase="#201f1f"
orange="#713400" orange="#713400"
yellow="#adab00"
themeDark="#1c1c1c" themeDark="#1c1c1c"
themeMediumDark="#2a2a2a" themeMediumDark="#2a2a2a"
themeMedium="#100f0f" themeMedium="#100f0f"
@ -16,4 +17,4 @@ themeLight="#201f1f"
action="#546eff" action="#546eff"
link="#d292ff" link="#d292ff"
searchHighlighted="#7e2a00" searchHighlighted="#7e2a00"
selectText = "#515151" selectText = "#515151"

10
themes/dark/window/general.css

@ -21,13 +21,13 @@ QTabWidget
background-color: #100f0f; background-color: #100f0f;
} }
QTabBar::tab:selected QTabBar::tab:selected
{ {
background: #100f0f; background: #100f0f;
color: @mainText; color: @mainText;
} }
QTabBar::tab:!selected QTabBar::tab:!selected
{ {
background: #444242; background: #444242;
color: #8e8e8e; color: #8e8e8e;
@ -302,3 +302,9 @@ QSplitter:handle
color: @groundBase; color: @groundBase;
background-color: @groundBase; background-color: @groundBase;
} }
QLabel#unstableVersion
{
color: black;
background-color: @yellow;
}

3
themes/default/palette.ini

@ -9,6 +9,7 @@ statusActive="#414141"
groundExtra="#d1d1d1" groundExtra="#d1d1d1"
groundBase="#ffffff" groundBase="#ffffff"
orange="#ff7700" orange="#ff7700"
yellow="#9c9100"
themeDark="#1c1c1c" themeDark="#1c1c1c"
themeMediumDark="#2a2a2a" themeMediumDark="#2a2a2a"
themeMedium="#414141" themeMedium="#414141"
@ -16,4 +17,4 @@ themeLight="#4e4e4e"
action="#1818FF" action="#1818FF"
link="#0000ff" link="#0000ff"
searchHighlighted="#ff7626" searchHighlighted="#ff7626"
selectText = "#9edeff" selectText = "#9edeff"

10
themes/default/window/general.css

@ -21,13 +21,13 @@ QTabWidget
background-color: white; background-color: white;
} }
QTabBar::tab:selected QTabBar::tab:selected
{ {
background: #2d3136; background: #2d3136;
color: #f1f1f1; color: #f1f1f1;
} }
QTabBar::tab:!selected QTabBar::tab:!selected
{ {
background: #d0d1d1; background: #d0d1d1;
color: #5e5e5e; color: #5e5e5e;
@ -277,3 +277,9 @@ QSplitter:handle
color: white; color: white;
background-color: white; background-color: white;
} }
QLabel#unstableVersion
{
color: @mainText;
background-color: @yellow;
}

Loading…
Cancel
Save