mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/telegramdesktop/tdesktop
synced 2026-09-20 08:03:45 +08:00
Improve version display for canary.
This commit is contained in:
@@ -150,7 +150,9 @@ QString telegramFaqLink() {
|
||||
return result;
|
||||
}
|
||||
|
||||
QString currentVersionText() {
|
||||
namespace {
|
||||
|
||||
[[nodiscard]] QString CurrentVersionText(bool withCommit) {
|
||||
auto result = QString::fromLatin1(AppVersionStr);
|
||||
if (Core::BuildIsCanary) {
|
||||
result += Core::CanaryVersionSuffix();
|
||||
@@ -167,9 +169,24 @@ QString currentVersionText() {
|
||||
#ifdef _DEBUG
|
||||
result += " DEBUG";
|
||||
#endif
|
||||
if (withCommit
|
||||
&& Core::BuildIsCanary
|
||||
&& Core::CanaryCommitHash[0] != '\0') {
|
||||
result += u" \u00B7 "_q + QLatin1String(Core::CanaryCommitHash);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
QString currentVersionText() {
|
||||
return CurrentVersionText(true);
|
||||
}
|
||||
|
||||
QString currentVersionShortText() {
|
||||
return CurrentVersionText(false);
|
||||
}
|
||||
|
||||
void ArchiveHintBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
bool unarchiveOnNewMessage,
|
||||
|
||||
@@ -16,4 +16,7 @@ void ArchiveHintBox(
|
||||
Fn<void()> onUnarchive);
|
||||
|
||||
QString telegramFaqLink();
|
||||
// The full form ends with the canary commit hash, the short one is for
|
||||
// the main menu where the line has to stay narrow.
|
||||
QString currentVersionText();
|
||||
QString currentVersionShortText();
|
||||
|
||||
@@ -72,15 +72,9 @@ inline constexpr auto CanaryMetadataMessageId
|
||||
}
|
||||
|
||||
[[nodiscard]] inline QString CanaryVersionSuffix() {
|
||||
if (!BuildIsCanary) {
|
||||
return QString();
|
||||
}
|
||||
auto result = QStringLiteral(" canary #%1").arg(CanaryBuildCounter);
|
||||
if (CanaryCommitHash[0] != '\0') {
|
||||
result += QStringLiteral(" · ")
|
||||
+ QLatin1String(CanaryCommitHash);
|
||||
}
|
||||
return result;
|
||||
return BuildIsCanary
|
||||
? QStringLiteral(" canary #%1").arg(CanaryBuildCounter)
|
||||
: QString();
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
||||
@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "base/event_filter.h"
|
||||
#include "base/qt_signal_producer.h"
|
||||
#include "boxes/about_box.h"
|
||||
#include "core/update_channel.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "boxes/premium_preview_box.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
@@ -386,12 +387,15 @@ MainMenu::MainMenu(
|
||||
u"Telegram Desktop"_q,
|
||||
u"https://desktop.telegram.org"_q));
|
||||
_telegram->setLinksTrusted();
|
||||
// The canary version is too long for the "Version {version}" form.
|
||||
_version->setMarkedText(
|
||||
tr::link(
|
||||
tr::lng_settings_current_version(
|
||||
tr::now,
|
||||
lt_version,
|
||||
currentVersionText()),
|
||||
Core::BuildIsCanary
|
||||
? currentVersionShortText()
|
||||
: tr::lng_settings_current_version(
|
||||
tr::now,
|
||||
lt_version,
|
||||
currentVersionShortText()),
|
||||
1) // Link 1.
|
||||
.append(QChar(' '))
|
||||
.append(QChar(8211))
|
||||
|
||||
Reference in New Issue
Block a user