Skip to content

Commit

Permalink
docs: Add TokTok/qTox adoption to the about form.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Dec 3, 2024
1 parent e8bb2b6 commit 5b65b7b
Show file tree
Hide file tree
Showing 54 changed files with 242 additions and 33 deletions.
32 changes: 17 additions & 15 deletions src/net/updatecheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
namespace {
const QString versionUrl{
QStringLiteral("https://api.github.com/repos/TokTok/qTox/releases/latest")};
const QString versionRegexString{QStringLiteral("v([0-9]+)\\.([0-9]+)\\.([0-9]+)")};
// Release candidates are ignored, as they are prereleases and don't appear in
// the response to the releases/latest API call.
const QString versionRegexString{QStringLiteral(R"(v([0-9]+)\.([0-9]+)\.([0-9]+))")};

struct Version
{
Expand All @@ -32,25 +34,25 @@ struct Version
int patch;
};

Version tagToVersion(QString tagName)
Version tagToVersion(const QString& tagName)
{
// capture tag name to avoid showing update available on dev builds which include hash as part of describe
QRegularExpression versionFormat(versionRegexString);
auto matches = versionFormat.match(tagName);
assert(matches.lastCapturedIndex() == 3);

bool ok;
auto major = matches.captured(1).toInt(&ok);
const auto major = matches.captured(1).toInt(&ok);
assert(ok);
auto minor = matches.captured(2).toInt(&ok);
const auto minor = matches.captured(2).toInt(&ok);
assert(ok);
auto patch = matches.captured(3).toInt(&ok);
const auto patch = matches.captured(3).toInt(&ok);
assert(ok);

return {major, minor, patch};
}

bool isUpdateAvailable(Version current, Version available)
bool isUpdateAvailable(const Version& current, const Version& available)
{
// A user may have a version greater than our latest release in the time between a tag being
// pushed and the release being published. Don't notify about an update in that case.
Expand Down Expand Up @@ -81,7 +83,7 @@ bool isUpdateAvailable(Version current, Version available)

bool isCurrentVersionStable()
{
QRegularExpression versionRegex(versionRegexString);
const QRegularExpression versionRegex(versionRegexString);
auto currentVer = versionRegex.match(GIT_DESCRIBE_EXACT);
if (currentVer.hasMatch()) {
return true;
Expand Down Expand Up @@ -141,24 +143,24 @@ void UpdateCheck::handleResponse(QNetworkReply* reply)
reply->deleteLater();
return;
}
QByteArray result = reply->readAll();
QJsonDocument doc = QJsonDocument::fromJson(result);
QJsonObject jObject = doc.object();
QVariantMap mainMap = jObject.toVariantMap();
QString latestVersion = mainMap["tag_name"].toString();
const QByteArray result = reply->readAll();
const QJsonDocument doc = QJsonDocument::fromJson(result);
const QJsonObject jObject = doc.object();
const QVariantMap mainMap = jObject.toVariantMap();
const QString latestVersion = mainMap["tag_name"].toString();
if (latestVersion.isEmpty()) {
qWarning() << "No tag name found in response:";
emit updateCheckFailed();
reply->deleteLater();
return;
}

auto currentVer = tagToVersion(GIT_DESCRIBE);
auto availableVer = tagToVersion(latestVersion);
const auto currentVer = tagToVersion(GIT_DESCRIBE);
const auto availableVer = tagToVersion(latestVersion);

if (isUpdateAvailable(currentVer, availableVer)) {
qInfo() << "Update available to version" << latestVersion;
QUrl link{mainMap["html_url"].toString()};
const QUrl link{mainMap["html_url"].toString()};
emit updateAvailable(latestVersion, link);
} else {
qInfo() << "qTox is up to date";
Expand Down
5 changes: 2 additions & 3 deletions src/net/updatecheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@
#include <QTimer>
#include <QUrl>

#include <memory>

class Settings;
class QString;
class QUrl;
class QNetworkReply;

class UpdateCheck : public QObject
{
Q_OBJECT

public:
UpdateCheck(const Settings& settings_);
explicit UpdateCheck(const Settings& settings_);

#ifdef UPDATE_CHECK_ENABLED
void checkForUpdate();
Expand Down
15 changes: 8 additions & 7 deletions src/widget/form/settings/aboutform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,14 @@ void AboutForm::replaceVersions()
QStringLiteral("<b>%1</b>").arg(tr("Click here to report a bug."))));

QString authorInfo =
QString("<p>%1</p><p>%2</p>")
.arg(tr("Original author: %1").arg(createLink("https://github.com/tux3", "tux3")))
.arg(
tr("See a full list of %1 at Github",
"`%1` is replaced with translation of word `contributors`")
.arg(createLink("https://qtox.github.io/gitstats/authors.html",
tr("contributors", "Replaces `%1` in `See a full list of…`"))));
QStringLiteral("<p>%1</p><p>%2</p><p>%3</p>")
.arg(tr("Original author: %1").arg(createLink("https://github.com/tux3", "tux3")),
tr("See a full list of %1 at Github",
"`%1` is replaced with translation of word `contributors`")
.arg(createLink("https://qtox.github.io/gitstats/authors.html",
tr("contributors", "Replaces `%1` in `See a full list of…`"))),
tr("This version of qTox is being maintained by the TokTok team "
"following the archiving of the original qTox project."));

bodyUI->authorInfo->setText(authorInfo);
}
Expand Down
23 changes: 15 additions & 8 deletions src/widget/form/settings/aboutsettings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<x>0</x>
<y>0</y>
<width>496</width>
<height>599</height>
<height>610</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,1,0,0">
Expand Down Expand Up @@ -294,14 +294,18 @@
</property>
<property name="html">
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;meta charset=&quot;utf-8&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;Copyright © 2014-2020 by The qTox Project Contributors&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu';&quot;&gt;qTox is a Qt-based graphical interface for Tox.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;qTox is libre software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif';&quot;&gt;qTox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu';&quot;&gt;You should have received a copy of the GNU General Public License along with this program. If not, see &lt;/span&gt;&lt;a href=&quot;https://www.gnu.org/copyleft/gpl.html&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; text-decoration: underline; color:#007af4;&quot;&gt;https://www.gnu.org/copyleft/gpl.html&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu';&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
hr { height: 1px; border-width: 0; }
li.unchecked::marker { content: &quot;\2610&quot;; }
li.checked::marker { content: &quot;\2612&quot;; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Noto Sans'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:10pt;&quot;&gt;Copyright © 2024 The TokTok team&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:10pt;&quot;&gt;Copyright © 2014-2023 by The qTox Project Contributors&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:10pt;&quot;&gt;qTox is a Qt-based graphical interface for Tox.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:10pt;&quot;&gt;qTox is libre software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Sans Serif'; font-size:10pt;&quot;&gt;qTox is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. &lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:10pt;&quot;&gt;You should have received a copy of the GNU General Public License along with this program. If not, see &lt;/span&gt;&lt;a href=&quot;https://www.gnu.org/copyleft/gpl.html&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:10pt; text-decoration: underline; color:#007af4;&quot;&gt;https://www.gnu.org/copyleft/gpl.html&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:10pt;&quot;&gt;.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="searchPaths">
<stringlist/>
Expand Down Expand Up @@ -351,6 +355,9 @@ p, li { white-space: pre-wrap; }
<property name="text">
<string notr="true">{AUTHOR INFO}</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
Expand Down
4 changes: 4 additions & 0 deletions translations/ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished">المساهمين</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/be.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished">удзельнікаў</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/bg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation>сътрудници</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/bn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/cs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ může dojít během video hovoru k výpadkům či jiným problémům.</translat
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation>přispěvatelů</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/da.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ dadurch kann es zu Problemen bei Videoanrufen kommen.</translation>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation>Mitwirkende</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/el.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished">συντελεστές</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/eo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished">kontribuintoj</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ lo que puede provocar problemas en las videollamadas.</translation>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation>contribuidores</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/et.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ mis võib põhjustada probleeme videokõnedega.</translation>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation>kaastöötajad</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/fa.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished">مشارکت کنندگان</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/fi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ mikä voi johtaa ongelmiin videopuheluissa.</translation>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation>osallistujat</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ ce qui peut entraîner des problèmes lors des appels vidéo.</translation>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation>contributeurs</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/gl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished">autores</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/he.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished"></translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
4 changes: 4 additions & 0 deletions translations/hr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ which may lead to problems with video calls.</source>
<comment>Replaces `%1` in `See a full list of…`</comment>
<translation type="unfinished">suradnici</translation>
</message>
<message>
<source>This version of qTox is being maintained by the TokTok team following the archiving of the original qTox project.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>AboutFriendForm</name>
Expand Down
Loading

0 comments on commit 5b65b7b

Please sign in to comment.