1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

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.
This commit is contained in:
powerjungle 2020-12-06 12:56:38 +02:00
parent 12fc33ee23
commit b51e46683e
No known key found for this signature in database
GPG Key ID: 190C37B0F8665DA8
11 changed files with 64 additions and 15 deletions

View File

@ -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);

View File

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

View File

@ -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.

View File

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

View File

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

View File

@ -147,6 +147,7 @@ static const QMap<Style::ColorPalette, QString> 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()},

View File

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

View File

@ -9,6 +9,7 @@ statusActive="#d1d1d1"
groundExtra="#d1d1d1"
groundBase="#201f1f"
orange="#713400"
yellow="#adab00"
themeDark="#1c1c1c"
themeMediumDark="#2a2a2a"
themeMedium="#100f0f"

View File

@ -302,3 +302,9 @@ QSplitter:handle
color: @groundBase;
background-color: @groundBase;
}
QLabel#unstableVersion
{
color: black;
background-color: @yellow;
}

View File

@ -9,6 +9,7 @@ statusActive="#414141"
groundExtra="#d1d1d1"
groundBase="#ffffff"
orange="#ff7700"
yellow="#9c9100"
themeDark="#1c1c1c"
themeMediumDark="#2a2a2a"
themeMedium="#414141"

View File

@ -277,3 +277,9 @@ QSplitter:handle
color: white;
background-color: white;
}
QLabel#unstableVersion
{
color: @mainText;
background-color: @yellow;
}