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

Merge pull request #6272

powerjungle (3):
      feat(ui): add warning in GUI when running unstable version
      refactor(log): change unstable version warning message
      refactor(ui): change unstable version warning message
This commit is contained in:
sudden6 2020-12-21 23:20:37 +01:00
commit 31be947ac5
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
11 changed files with 64 additions and 15 deletions

View File

@ -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() << "Currently running an untested/unstable version of qTox";
emit versionIsUnstable();
} }
assert(reply != nullptr); assert(reply != nullptr);

View File

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

View File

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

View File

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

View File

@ -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>Currently running an untested/unstable version of qTox</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>

View File

@ -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()},

View File

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

View File

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

View File

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

View File

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

View File

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