From dc231f2e2954876d47f5ab8066f26590a22841bf Mon Sep 17 00:00:00 2001 From: "fox.cpp" Date: Wed, 17 Jan 2018 22:09:12 +0300 Subject: [PATCH] Allow to change app. name using CMake cache --- Telegram/CMakeLists.txt | 10 ++++++++++ Telegram/SourceFiles/boxes/about_box.cpp | 3 ++- Telegram/SourceFiles/boxes/notifications_box.cpp | 3 ++- Telegram/SourceFiles/boxes/sessions_box.cpp | 2 +- Telegram/SourceFiles/{config.h => config.h.in} | 3 +-- Telegram/SourceFiles/intro/introstart.cpp | 3 ++- Telegram/SourceFiles/logs.cpp | 5 ----- Telegram/SourceFiles/main.cpp | 4 +++- Telegram/SourceFiles/mainwidget.cpp | 2 +- Telegram/SourceFiles/mainwindow.cpp | 16 ++++++++-------- .../platform/linux/main_window_linux.cpp | 6 +++--- .../linux/notifications_manager_linux.cpp | 3 ++- .../platform/linux/specific_linux.cpp | 5 +++-- .../SourceFiles/platform/mac/main_window_mac.mm | 4 ++-- .../SourceFiles/platform/mac/window_title_mac.mm | 2 +- .../SourceFiles/platform/win/specific_win.cpp | 16 +++------------- Telegram/SourceFiles/platform/win/specific_win.h | 1 - Telegram/SourceFiles/window/main_window.cpp | 4 ++-- .../SourceFiles/window/notifications_manager.cpp | 2 +- .../window/notifications_manager_default.cpp | 3 ++- Telegram/SourceFiles/window/window_main_menu.cpp | 2 +- 21 files changed, 50 insertions(+), 49 deletions(-) rename Telegram/SourceFiles/{config.h => config.h.in} (99%) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 63dccf83f..c7fb0abaa 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -170,6 +170,16 @@ foreach (src ${style_files}) endforeach() +##================================================ +## Branding +##================================================ + +set(KEPKA_APPNAME "Kepka" + CACHE STRING "Application name") + +configure_file(SourceFiles/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + ##================================================ ## Telegram app ##================================================ diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index f545e9ec9..2f0e89dee 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #include "boxes/about_box.h" +#include "config.h" #include "lang/lang_keys.h" #include "mainwidget.h" #include "mainwindow.h" @@ -39,7 +40,7 @@ AboutBox::AboutBox(QWidget *parent) void AboutBox::prepare() { constexpr auto test = std::is_convertible::value; - setTitle([] { return qsl("Telegram Desktop"); }); + setTitle([] { return str_const_toString(AppName); }); addButton(langFactory(lng_close), [this] { closeBox(); }); diff --git a/Telegram/SourceFiles/boxes/notifications_box.cpp b/Telegram/SourceFiles/boxes/notifications_box.cpp index ed83a00bf..342746065 100644 --- a/Telegram/SourceFiles/boxes/notifications_box.cpp +++ b/Telegram/SourceFiles/boxes/notifications_box.cpp @@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #include "boxes/notifications_box.h" +#include "config.h" #include "lang/lang_keys.h" #include "ui/widgets/buttons.h" #include "ui/widgets/discrete_sliders.h" @@ -292,7 +293,7 @@ void NotificationsBox::prepareNotificationSampleLarge() { p.setPen(st::dialogsNameFg); p.setFont(st::msgNameFont); - auto notifyTitle = st::msgNameFont->elided(qsl("Telegram Desktop"), rectForName.width()); + auto notifyTitle = st::msgNameFont->elided(str_const_toString(AppName), rectForName.width()); p.drawText(rectForName.left(), rectForName.top() + st::msgNameFont->ascent, notifyTitle); st::notifyClose.icon.paint(p, w - st::notifyClosePos.x() - st::notifyClose.width + st::notifyClose.iconPosition.x(), st::notifyClosePos.y() + st::notifyClose.iconPosition.y(), w); diff --git a/Telegram/SourceFiles/boxes/sessions_box.cpp b/Telegram/SourceFiles/boxes/sessions_box.cpp index 72e2468df..55caef6f8 100644 --- a/Telegram/SourceFiles/boxes/sessions_box.cpp +++ b/Telegram/SourceFiles/boxes/sessions_box.cpp @@ -106,7 +106,7 @@ void SessionsBox::gotAuthorizations(const MTPaccount_Authorizations &result) { QString appName, appVer = qs(d.vapp_version), systemVer = qs(d.vsystem_version), deviceModel = qs(d.vdevice_model); if (d.vapi_id.v == 2040 || d.vapi_id.v == 17349) { - appName = (d.vapi_id.v == 2040) ? qstr("Telegram Desktop") : qstr("Telegram Desktop (GitHub)"); + appName = str_const_toString(AppName); // if (systemVer == qstr("windows")) { // deviceModel = qsl("Windows"); // } else if (systemVer == qstr("os x")) { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h.in similarity index 99% rename from Telegram/SourceFiles/config.h rename to Telegram/SourceFiles/config.h.in index 297dcbd88..5ab8a6072 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h.in @@ -23,8 +23,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "core/version.h" #include "settings.h" -constexpr str_const AppNameOld = "Telegram Win (Unofficial)"; -constexpr str_const AppName = "Telegram Desktop"; +constexpr str_const AppName = "${KEPKA_APPNAME}"; constexpr str_const AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"; // used in updater.cpp and Setup.iss for Windows constexpr str_const AppFile = "Telegram"; diff --git a/Telegram/SourceFiles/intro/introstart.cpp b/Telegram/SourceFiles/intro/introstart.cpp index 0b8b576cc..be37b56d4 100644 --- a/Telegram/SourceFiles/intro/introstart.cpp +++ b/Telegram/SourceFiles/intro/introstart.cpp @@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #include "intro/introstart.h" +#include "config.h" #include "lang/lang_keys.h" #include "application.h" #include "intro/introphone.h" @@ -30,7 +31,7 @@ namespace Intro { StartWidget::StartWidget(QWidget *parent, Widget::Data *data) : Step(parent, data, true) { setMouseTracking(true); - setTitleText([] { return qsl("Telegram Desktop"); }); + setTitleText([] { return str_const_toString(AppName); }); setDescriptionText(langFactory(lng_intro_about)); show(); } diff --git a/Telegram/SourceFiles/logs.cpp b/Telegram/SourceFiles/logs.cpp index 9760c24d8..bec59927a 100644 --- a/Telegram/SourceFiles/logs.cpp +++ b/Telegram/SourceFiles/logs.cpp @@ -376,11 +376,6 @@ namespace Logs { return; } -#ifdef Q_OS_WIN - if (cWorkingDir() == psAppDataPath()) { // fix old "Telegram Win (Unofficial)" version - moveOldDataFrom = psAppDataPathOld(); - } -#endif if (!moveOldDataFrom.isEmpty()) { _moveOldDataFiles(moveOldDataFrom); } diff --git a/Telegram/SourceFiles/main.cpp b/Telegram/SourceFiles/main.cpp index c9d1ae3be..78ce491e1 100644 --- a/Telegram/SourceFiles/main.cpp +++ b/Telegram/SourceFiles/main.cpp @@ -18,6 +18,8 @@ to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ + +#include "stdafx.h" #include "application.h" #include "platform/platform_specific.h" #include "storage/localstorage.h" @@ -27,7 +29,7 @@ int main(int argc, char *argv[]) { // Retina display support is working fine, others are not. QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true); #endif // not defined Q_OS_MAC and QT_VERSION >= 5.6.0 - QCoreApplication::setApplicationName(qsl("Kepka")); + QCoreApplication::setApplicationName(str_const_toString(AppName)); InitFromCommandLine(argc, argv); if (cLaunchMode() == LaunchModeFixPrevious) { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 28679fb11..4128a2e8e 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -3709,7 +3709,7 @@ void MainWidget::gotDifference(const MTPupdates_Difference &difference) { } break; case mtpc_updates_differenceTooLong: { auto &d = difference.c_updates_differenceTooLong(); - LOG(("API Error: updates.differenceTooLong is not supported by Telegram Desktop!")); + LOG(("API Error: updates.differenceTooLong is not supported by %1!").arg(str_const_toString(AppName))); } break; }; } diff --git a/Telegram/SourceFiles/mainwindow.cpp b/Telegram/SourceFiles/mainwindow.cpp index cd28e6aa0..9c21103e6 100644 --- a/Telegram/SourceFiles/mainwindow.cpp +++ b/Telegram/SourceFiles/mainwindow.cpp @@ -985,7 +985,7 @@ PreLaunchWindow::PreLaunchWindow(QString title) { setWindowIcon(icon); setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); - setWindowTitle(title.isEmpty() ? qsl("Telegram") : title); + setWindowTitle(title.isEmpty() ? str_const_toString(AppName) : title); QPalette p(palette()); p.setColor(QPalette::Background, QColor(255, 255, 255)); @@ -1118,7 +1118,7 @@ NotStartedWindow::NotStartedWindow() : _label(this) , _log(this) , _close(this) { - _label.setText(qsl("Could not start Telegram Desktop!\nYou can see complete log below:")); + _label.setText(qsl("Could not start %1!\nYou can see complete log below:").arg(str_const_toString(AppName))); _log.setPlainText(Logs::full()); @@ -1246,9 +1246,9 @@ LastCrashedWindow::LastCrashedWindow() connect(&_networkSettings, SIGNAL(clicked()), this, SLOT(onNetworkSettings())); if (_sendingState == SendingNoReport) { - _label.setText(qsl("Last time Telegram Desktop was not closed properly.")); + _label.setText(qsl("Last time %1 was not closed properly.").arg(str_const_toString(AppName))); } else { - _label.setText(qsl("Last time Telegram Desktop crashed :(")); + _label.setText(qsl("Last time %1 crashed :(").arg(str_const_toString(AppName))); } _updating.setText(qsl("Please check if there is a new version available.")); @@ -1292,7 +1292,7 @@ void LastCrashedWindow::onViewReport() { } void LastCrashedWindow::onSaveReport() { - QString to = QFileDialog::getSaveFileName(0, qsl("Telegram Crash Report"), QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + qsl("/report.telegramcrash"), qsl("Telegram crash report (*.telegramcrash)")); + QString to = QFileDialog::getSaveFileName(0, qsl("%1 Crash Report").arg(str_const_toString(AppName)), QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation) + qsl("/report.telegramcrash"), qsl("%1 crash report (*.telegramcrash)").arg(str_const_toString(AppName))); if (!to.isEmpty()) { QFile file(to); if (file.open(QIODevice::WriteOnly)) { @@ -1400,12 +1400,12 @@ void LastCrashedWindow::onCheckingFinished() { LOG(("Crash report check for sending done, result: %1").arg(QString::fromUtf8(result))); if (result == "Old") { - _pleaseSendReport.setText(qsl("This report is about some old version of Telegram Desktop.")); + _pleaseSendReport.setText(qsl("This report is about some old version of %1.").arg(str_const_toString(AppName))); _sendingState = SendingTooOld; updateControls(); return; } else if (result == "Unofficial") { - _pleaseSendReport.setText(qsl("You use some custom version of Telegram Desktop.")); + _pleaseSendReport.setText(qsl("You use some custom version of %1.").arg(str_const_toString(AppName))); _sendingState = SendingUnofficial; updateControls(); return; @@ -1546,7 +1546,7 @@ void LastCrashedWindow::updateControls() { h += _networkSettings.height() + padding; QRect scr(QApplication::primaryScreen()->availableGeometry()); - QSize s(2 * padding + QFontMetrics(_label.font()).width(qsl("Last time Telegram Desktop was not closed properly.")) + padding + _networkSettings.width(), h); + QSize s(2 * padding + QFontMetrics(_label.font()).width(qsl("Last time %1 was not closed properly.").arg(str_const_toString(AppName))) + padding + _networkSettings.width(), h); if (s == size()) { resizeEvent(0); } else { diff --git a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp index 6c898ef85..d12350fc2 100644 --- a/Telegram/SourceFiles/platform/linux/main_window_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/main_window_linux.cpp @@ -476,7 +476,7 @@ void MainWindow::psCreateTrayIcon() { QFileInfo iconFile(_trayIconImageFile()); if (iconFile.exists()) { QByteArray path = QFile::encodeName(iconFile.absoluteFilePath()); - _trayIndicator = Libs::app_indicator_new("Telegram Desktop", path.constData(), APP_INDICATOR_CATEGORY_APPLICATION_STATUS); + _trayIndicator = Libs::app_indicator_new(AppName.c_str(), path.constData(), APP_INDICATOR_CATEGORY_APPLICATION_STATUS); if (_trayIndicator) { LOG(("Tray Icon: Using appindicator tray icon.")); } else { @@ -517,8 +517,8 @@ void MainWindow::psCreateTrayIcon() { Libs::g_signal_connect_helper(_trayIcon, "activate", GCallback(_trayIconActivate), _trayMenu); Libs::g_signal_connect_helper(_trayIcon, "size-changed", GCallback(_trayIconResized), _trayMenu); - Libs::gtk_status_icon_set_title(_trayIcon, "Telegram Desktop"); - Libs::gtk_status_icon_set_tooltip_text(_trayIcon, "Telegram Desktop"); + Libs::gtk_status_icon_set_title(_trayIcon, AppName.c_str()); + Libs::gtk_status_icon_set_tooltip_text(_trayIcon, AppName.c_str()); Libs::gtk_status_icon_set_visible(_trayIcon, true); } else { useStatusIcon = false; diff --git a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp index 1bc0a146c..435ee000c 100644 --- a/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/notifications_manager_linux.cpp @@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #include "platform/linux/notifications_manager_linux.h" +#include "config.h" #include "window/notifications_utilities.h" #include "platform/linux/linux_libnotify.h" #include "platform/linux/linux_libs.h" @@ -242,7 +243,7 @@ QString GetServerName() { if (!LibNotifyLoaded()) { return QString(); } - if (!Libs::notify_is_initted() && !Libs::notify_init("Telegram Desktop")) { + if (!Libs::notify_is_initted() && !Libs::notify_init(AppName.c_str())) { LOG(("LibNotify Error: failed to init!")); return QString(); } diff --git a/Telegram/SourceFiles/platform/linux/specific_linux.cpp b/Telegram/SourceFiles/platform/linux/specific_linux.cpp index 8f802365d..4fd01bb6d 100644 --- a/Telegram/SourceFiles/platform/linux/specific_linux.cpp +++ b/Telegram/SourceFiles/platform/linux/specific_linux.cpp @@ -456,13 +456,14 @@ void psRegisterCustomScheme() { s.setCodec("UTF-8"); s << "[Desktop Entry]\n"; s << "Version=1.0\n"; - s << "Name=Telegram Desktop\n"; - s << "Comment=Official desktop version of Telegram messaging app\n"; + s << "Name=" << str_const_toString(AppName) << '\n'; + s << "Comment=Unofficial desktop version of Telegram messaging app\n"; s << "TryExec=" << EscapeShell(QFile::encodeName(cExeDir() + cExeName())) << "\n"; s << "Exec=" << EscapeShell(QFile::encodeName(cExeDir() + cExeName())) << " -- %u\n"; s << "Icon=telegram\n"; s << "Terminal=false\n"; s << "StartupWMClass=Kepka\n"; + s << "StartupWMClass=" << str_const_toString(AppName) << '\n'; s << "Type=Application\n"; s << "Categories=Network;InstantMessaging;Qt;\n"; s << "MimeType=x-scheme-handler/tg;\n"; diff --git a/Telegram/SourceFiles/platform/mac/main_window_mac.mm b/Telegram/SourceFiles/platform/mac/main_window_mac.mm index 8a3902527..574790894 100644 --- a/Telegram/SourceFiles/platform/mac/main_window_mac.mm +++ b/Telegram/SourceFiles/platform/mac/main_window_mac.mm @@ -406,8 +406,8 @@ void MainWindow::psFirstShow() { } void MainWindow::createGlobalMenu() { - auto main = psMainMenu.addMenu(qsl("Telegram")); - auto about = main->addAction(lng_mac_menu_about_telegram(lt_telegram, qsl("Telegram"))); + auto main = psMainMenu.addMenu(str_const_toString(AppName)); + auto about = main->addAction(lng_mac_menu_about_telegram(lt_telegram, str_const_toString(AppName))); connect(about, &QAction::triggered, about, [] { if (App::wnd() && App::wnd()->isHidden()) App::wnd()->showFromTray(); Ui::show(Box()); diff --git a/Telegram/SourceFiles/platform/mac/window_title_mac.mm b/Telegram/SourceFiles/platform/mac/window_title_mac.mm index 3e7ddaf52..58d5e7bc3 100644 --- a/Telegram/SourceFiles/platform/mac/window_title_mac.mm +++ b/Telegram/SourceFiles/platform/mac/window_title_mac.mm @@ -146,7 +146,7 @@ void PreviewWindowTitle(Painter &p, const style::palette &palette, QRect body, i p.setPen(st::titleFgActive[palette]); p.setFont(font); - p.drawText(titleRect, qsl("Telegram"), style::al_center); + p.drawText(titleRect, str_const_toString(AppName), style::al_center); auto isGraphite = ([NSColor currentControlTint] == NSGraphiteControlTint); auto buttonSkip = 8; diff --git a/Telegram/SourceFiles/platform/win/specific_win.cpp b/Telegram/SourceFiles/platform/win/specific_win.cpp index b0d477b1c..89f65e11c 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.cpp +++ b/Telegram/SourceFiles/platform/win/specific_win.cpp @@ -169,7 +169,7 @@ QString psAppDataPath() { if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) { QDir appData(QString::fromStdWString(std::wstring(wstrPath))); #ifdef OS_WIN_STORE - return appData.absolutePath() + qsl("/Telegram Desktop UWP/"); + return appData.absolutePath() + '/' + str_const_toString(AppName) + qsl(" UWP/")); #else // OS_WIN_STORE return appData.absolutePath() + '/' + str_const_toString(AppName) + '/'; #endif // OS_WIN_STORE @@ -177,16 +177,6 @@ QString psAppDataPath() { return QString(); } -QString psAppDataPathOld() { - static const int maxFileLen = MAX_PATH * 10; - WCHAR wstrPath[maxFileLen]; - if (GetEnvironmentVariable(L"APPDATA", wstrPath, maxFileLen)) { - QDir appData(QString::fromStdWString(std::wstring(wstrPath))); - return appData.absolutePath() + '/' + str_const_toString(AppNameOld) + '/'; - } - return QString(); -} - QString psDownloadPath() { return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation) + '/' + str_const_toString(AppName) + '/'; } @@ -596,8 +586,8 @@ void RegisterCustomScheme() { if (!_psOpenRegKey(L"Software\\TelegramDesktop", &rkey)) return; if (!_psOpenRegKey(L"Software\\TelegramDesktop\\Capabilities", &rkey)) return; - if (!_psSetKeyValue(rkey, L"ApplicationName", qsl("Telegram Desktop"))) return; - if (!_psSetKeyValue(rkey, L"ApplicationDescription", qsl("Telegram Desktop"))) return; + if (!_psSetKeyValue(rkey, L"ApplicationName", str_const_toString(AppName))) return; + if (!_psSetKeyValue(rkey, L"ApplicationDescription", str_const_toString(AppName))) return; if (!_psOpenRegKey(L"Software\\TelegramDesktop\\Capabilities\\UrlAssociations", &rkey)) return; if (!_psSetKeyValue(rkey, L"tg", qsl("tdesktop.tg"))) return; diff --git a/Telegram/SourceFiles/platform/win/specific_win.h b/Telegram/SourceFiles/platform/win/specific_win.h index 775a31c0b..fadb0b1ad 100644 --- a/Telegram/SourceFiles/platform/win/specific_win.h +++ b/Telegram/SourceFiles/platform/win/specific_win.h @@ -78,7 +78,6 @@ void psClearInitLogs(); void psActivateProcess(quint64 pid = 0); QString psLocalServerPrefix(); QString psAppDataPath(); -QString psAppDataPathOld(); QString psDownloadPath(); void psAutoStart(bool start, bool silent = false); void psSendToMenu(bool send, bool silent = false); diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index f1215021a..f7af0a799 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -61,7 +61,7 @@ MainWindow::MainWindow() : QWidget() , _positionUpdatedTimer(this) , _body(this) , _icon(CreateIcon()) -, _titleText(qsl("Telegram")) { +, _titleText(str_const_toString(AppName)) { subscribe(Theme::Background(), [this](const Theme::BackgroundUpdate &data) { if (data.paletteChanged()) { if (_title) { @@ -275,7 +275,7 @@ void MainWindow::updateUnreadCounter() { if (!Global::started() || App::quitting()) return; auto counter = App::histories().unreadBadge(); - _titleText = (counter > 0) ? qsl("Telegram (%1)").arg(counter) : qsl("Telegram"); + _titleText = (counter > 0) ? (str_const_toString(AppName) + "(%1)").arg(counter) : str_const_toString(AppName); unreadCounterChangedHook(); } diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 85b884a0b..f0dbbe1a4 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -422,7 +422,7 @@ void Manager::notificationReplied(PeerId peerId, MsgId msgId, const QString &rep void NativeManager::doShowNotification(HistoryItem *item, int forwardedCount) { auto options = getNotificationOptions(item); - QString title = options.hideNameAndPhoto ? qsl("Telegram Desktop") : item->history()->peer->name; + QString title = options.hideNameAndPhoto ? str_const_toString(AppName) : item->history()->peer->name; QString subtitle = options.hideNameAndPhoto ? QString() : item->notificationHeader(); QString text = options.hideMessageText ? lang(lng_notification_preview) : (forwardedCount < 2 ? item->notificationText() : lng_forward_messages(lt_count, forwardedCount)); diff --git a/Telegram/SourceFiles/window/notifications_manager_default.cpp b/Telegram/SourceFiles/window/notifications_manager_default.cpp index 9e62f1d2a..300814c02 100644 --- a/Telegram/SourceFiles/window/notifications_manager_default.cpp +++ b/Telegram/SourceFiles/window/notifications_manager_default.cpp @@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org */ #include "window/notifications_manager_default.h" +#include "config.h" #include "platform/platform_notifications_manager.h" #include "application.h" #include "messenger.h" @@ -695,7 +696,7 @@ void Notification::updateNotifyDisplay() { _history->peer->dialogName().drawElided(p, rectForName.left(), rectForName.top(), rectForName.width()); } else { p.setFont(st::msgNameFont); - static QString notifyTitle = st::msgNameFont->elided(qsl("Telegram Desktop"), rectForName.width()); + static QString notifyTitle = st::msgNameFont->elided(str_const_toString(AppName), rectForName.width()); p.drawText(rectForName.left(), rectForName.top() + st::msgNameFont->ascent, notifyTitle); } } diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index efbdfae71..d5f1721ad 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -65,7 +65,7 @@ MainMenu::MainMenu(QWidget *parent) : TWidget(parent) }); refreshMenu(); - _telegram->setRichText(textcmdLink(1, qsl("Telegram Desktop"))); + _telegram->setRichText(textcmdLink(1, str_const_toString(AppName))); _telegram->setLink(1, MakeShared(qsl("https://desktop.telegram.org"))); _version->setRichText(textcmdLink(1, lng_settings_current_version(lt_version, currentVersionText())) + QChar(' ') + QChar(8211) + QChar(' ') + textcmdLink(2, lang(lng_menu_about))); _version->setLink(1, MakeShared(qsl("https://desktop.telegram.org/changelog")));