diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index b90d3c473..1484a5634 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -20,7 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "core/update_checker.h" AboutBox::AboutBox(QWidget *parent) -: _version(this, lng_about_version(lt_version, QString::fromLatin1(AppVersionStr.c_str()) + (cAlphaVersion() ? qsl(" alpha %1").arg(cAlphaVersion()) : (AppBetaVersion ? " beta" : ""))), st::aboutVersionLink) +: _version(this, lng_about_version(lt_version, QString::fromLatin1(AppVersionStr) + (cAlphaVersion() ? qsl(" alpha %1").arg(cAlphaVersion()) : (AppBetaVersion ? " beta" : ""))), st::aboutVersionLink) , _text1(this, lang(lng_about_text_1), Ui::FlatLabel::InitType::Rich, st::aboutLabel) , _text2(this, lang(lng_about_text_2), Ui::FlatLabel::InitType::Rich, st::aboutLabel) , _text3(this, st::aboutLabel) { @@ -98,7 +98,7 @@ QString telegramFaqLink() { } QString currentVersionText() { - auto result = QString::fromLatin1(AppVersionStr.c_str()); + auto result = QString::fromLatin1(AppVersionStr); if (cAlphaVersion()) { result += qsl(" alpha %1").arg(cAlphaVersion() % 1000); } else if (AppBetaVersion) { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 182a6398b..2fa792747 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -231,12 +231,11 @@ constexpr auto ApiHash = "344583e45741c457fe1862106095a5eb"; #error "Only little endian is supported!" #endif // Q_BYTE_ORDER == Q_BIG_ENDIAN -#ifndef ALPHA_VERSION_MACRO -#error "Alpha version macro is not defined." -#endif +#if (TDESKTOP_ALPHA_VERSION != 0) + +// Private key for downloading closed alphas. +#include "../../../TelegramPrivate/alpha_private.h" -#if (defined TDESKTOP_OFFICIAL_TARGET) && (ALPHA_VERSION_MACRO > 0ULL) -#include "../../../TelegramPrivate/alpha_private.h" // private key for downloading closed alphas #else static const char *AlphaPrivateKey = ""; #endif diff --git a/Telegram/SourceFiles/core/changelogs.cpp b/Telegram/SourceFiles/core/changelogs.cpp index c52cba285..7433bff04 100644 --- a/Telegram/SourceFiles/core/changelogs.cpp +++ b/Telegram/SourceFiles/core/changelogs.cpp @@ -141,7 +141,7 @@ void Changelogs::addLocalLogs() { if (!_addedSomeLocal) { const auto text = lng_new_version_wrap( lt_version, - str_const_toString(AppVersionStr), + QString::fromLatin1(AppVersionStr), lt_changes, lang(lng_new_version_minor), lt_link, diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 3317038bb..7473e1934 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -7,11 +7,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "core/utils.h" - #define ALPHA_VERSION_MACRO (1004004002ULL) -constexpr int AppVersion = 1004004; -constexpr str_const AppVersionStr = "1.4.4"; -constexpr bool AppBetaVersion = false; -constexpr uint64 AppAlphaVersion = ALPHA_VERSION_MACRO; +#ifdef TDESKTOP_OFFICIAL_TARGET +#define TDESKTOP_ALPHA_VERSION ALPHA_VERSION_MACRO +#else // TDESKTOP_OFFICIAL_TARGET +#define TDESKTOP_ALPHA_VERSION (0ULL) +#endif // TDESKTOP_OFFICIAL_TARGET + +constexpr auto AppVersion = 1004004; +constexpr auto AppVersionStr = "1.4.4"; +constexpr auto AppBetaVersion = false; +constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION; diff --git a/Telegram/SourceFiles/facades.cpp b/Telegram/SourceFiles/facades.cpp index 2784f9def..0b83ee97a 100644 --- a/Telegram/SourceFiles/facades.cpp +++ b/Telegram/SourceFiles/facades.cpp @@ -411,11 +411,11 @@ bool CheckPortableVersionDir() { const auto portable = cExeDir() + qsl("TelegramForcePortable"); QFile key(portable + qsl("/tdata/alpha")); if (cAlphaVersion()) { + Assert(*AlphaPrivateKey != 0); + cForceWorkingDir(portable + '/'); QDir().mkpath(cWorkingDir() + qstr("tdata")); - if (*AlphaPrivateKey) { - cSetAlphaPrivateKey(QByteArray(AlphaPrivateKey)); - } + cSetAlphaPrivateKey(QByteArray(AlphaPrivateKey)); if (!key.open(QIODevice::WriteOnly)) { LOG(("FATAL: Could not open '%1' for writing private key!" ).arg(key.fileName())); diff --git a/Telegram/SourceFiles/intro/introphone.cpp b/Telegram/SourceFiles/intro/introphone.cpp index 030fd8770..67b2714b9 100644 --- a/Telegram/SourceFiles/intro/introphone.cpp +++ b/Telegram/SourceFiles/intro/introphone.cpp @@ -24,7 +24,7 @@ namespace Intro { namespace { void SendToBannedHelp(const QString &phone) { - const auto version = QString::fromLatin1(AppVersionStr.c_str()) + const auto version = QString::fromLatin1(AppVersionStr) + (cAlphaVersion() ? qsl(" alpha %1").arg(cAlphaVersion()) : (AppBetaVersion ? " beta" : "")); diff --git a/Telegram/SourceFiles/mtproto/connection.cpp b/Telegram/SourceFiles/mtproto/connection.cpp index 96284301a..55d76433d 100644 --- a/Telegram/SourceFiles/mtproto/connection.cpp +++ b/Telegram/SourceFiles/mtproto/connection.cpp @@ -825,10 +825,10 @@ void ConnectionPrivate::tryToSend() { ? "n/a" : Messenger::Instance().launcher()->systemVersion(); #if defined OS_MAC_STORE || defined OS_WIN_STORE - const auto appVersion = str_const_toString(AppVersionStr) + const auto appVersion = QString::fromLatin1(AppVersionStr) + " store"; #else // OS_MAC_STORE || OS_WIN_STORE - const auto appVersion = str_const_toString(AppVersionStr); + const auto appVersion = QString::fromLatin1(AppVersionStr); #endif // OS_MAC_STORE || OS_WIN_STORE const auto proxyType = _connectionOptions->proxy.type; const auto mtprotoProxy = (proxyType == ProxyData::Type::Mtproto);