From 7320149f224b1d58ac92264613eed4dae653e590 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 9 Feb 2018 04:23:11 +0300 Subject: [PATCH 1/2] Move out the hardcoded URLs (changelog, about) --- Telegram/CMakeLists.txt | 1 + Telegram/Resources/langs/lang.strings | 6 ++++++ Telegram/SourceFiles/apiwrap.cpp | 2 +- Telegram/SourceFiles/boxes/about_box.cpp | 2 +- Telegram/SourceFiles/window/window_main_menu.cpp | 4 ++-- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index c7fb0abaa..6f52329f3 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -75,6 +75,7 @@ add_custom_command( MAIN_DEPENDENCY ${CMAKE_CURRENT_SOURCE_DIR}/Resources/langs/lang.strings ) + add_custom_target(lang_output DEPENDS lang_auto.h lang_auto.cpp) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index c5e569340..841ba1198 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -18,6 +18,12 @@ 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 */ +"appname" = "Kepka"; +"lng_url_about" = "https://github.com/procxx/kepka"; +"lng_url_changelog" = "https://github.com/procxx/kepka/releases"; + +// basic lang info + "lng_language_name" = "English"; "lng_switch_to_this" = "Switch to English"; diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 260724fde..521771dd0 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -116,7 +116,7 @@ void ApiWrap::addLocalChangelogs(int oldAppVersion) { #endif // Q_OS_WIN } if (!addedSome) { - auto text = lng_new_version_wrap(lt_version, str_const_toString(AppVersionStr), lt_changes, lang(lng_new_version_minor), lt_link, qsl("https://desktop.telegram.org/changelog")).trimmed(); + auto text = lng_new_version_wrap(lt_version, str_const_toString(AppVersionStr), lt_changes, lang(lng_new_version_minor), lt_link, lang(lng_url_changelog)).trimmed(); addLocalChangelog(text); } } diff --git a/Telegram/SourceFiles/boxes/about_box.cpp b/Telegram/SourceFiles/boxes/about_box.cpp index 2f0e89dee..649d321ec 100644 --- a/Telegram/SourceFiles/boxes/about_box.cpp +++ b/Telegram/SourceFiles/boxes/about_box.cpp @@ -61,7 +61,7 @@ void AboutBox::resizeEvent(QResizeEvent *e) { } void AboutBox::showVersionHistory() { - QDesktopServices::openUrl(qsl("https://desktop.telegram.org/changelog")); + QDesktopServices::openUrl(lang(lng_url_changelog)); } void AboutBox::keyPressEvent(QKeyEvent *e) { diff --git a/Telegram/SourceFiles/window/window_main_menu.cpp b/Telegram/SourceFiles/window/window_main_menu.cpp index d5f1721ad..ad7e40d2b 100644 --- a/Telegram/SourceFiles/window/window_main_menu.cpp +++ b/Telegram/SourceFiles/window/window_main_menu.cpp @@ -66,9 +66,9 @@ MainMenu::MainMenu(QWidget *parent) : TWidget(parent) refreshMenu(); _telegram->setRichText(textcmdLink(1, str_const_toString(AppName))); - _telegram->setLink(1, MakeShared(qsl("https://desktop.telegram.org"))); + _telegram->setLink(1, MakeShared(lang(lng_url_about))); _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"))); + _version->setLink(1, MakeShared(lang(lng_url_changelog))); _version->setLink(2, MakeShared([] { Ui::show(Box()); })); subscribe(Auth().downloaderTaskFinished(), [this] { update(); }); From b1c7c6fc61653a9898e26134c6fb3739bda0ab9d Mon Sep 17 00:00:00 2001 From: Anatoly Shirokov Date: Tue, 13 Feb 2018 16:13:14 +0300 Subject: [PATCH 2/2] Made to compile by MSVC 2015/2017 32 bit compilers (#101) Patches by @anatoly-spb : 1. Get rid of -DWIN64, -DZLIB_WINAPI in 32-bit build for fixing zlib linkage; 2. Work around MSVC2015 limitation based on lacking the C++14 features (like void as literal type) and document it. --- Telegram/CMakeLists.txt | 4 ++-- Telegram/SourceFiles/base/assertion.h | 9 ++++++++- Telegram/SourceFiles/core/basic_types.h | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt index 6f52329f3..8ec40f3b6 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt @@ -582,9 +582,9 @@ endif() if (WIN32) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS -D_USING_V110_SDK71_ - -DWIN32 -D_WINDOWS -D_UNICODE -DUNICODE -DWIN64 + -DWIN32 -D_WINDOWS -D_UNICODE -DUNICODE -DWINAPI_FAMILY=WINAPI_FAMILY_DESKTOP_APP - -DHAVE_STDINT_H -DZLIB_WINAPI) + -DHAVE_STDINT_H) endif() add_definitions(-DAL_LIBTYPE_STATIC) diff --git a/Telegram/SourceFiles/base/assertion.h b/Telegram/SourceFiles/base/assertion.h index 33de049a9..1711e1504 100644 --- a/Telegram/SourceFiles/base/assertion.h +++ b/Telegram/SourceFiles/base/assertion.h @@ -43,10 +43,17 @@ inline constexpr void noop() { std::abort(); } -inline constexpr void validate(bool condition, const char *message, const char *file, int line) { +// Since MSVC 2015 cannot understand "constexpr void" (void is literal since C++14) +// we have to use conditional compilation +inline +#if !defined(_MSC_VER) || (_MSC_VER > 1900) +constexpr +#endif + void validate(bool condition, const char *message, const char *file, int line) { (GSL_UNLIKELY(!(condition))) ? fail(message, file, line) : noop(); } + } // namespace assertion } // namespace base diff --git a/Telegram/SourceFiles/core/basic_types.h b/Telegram/SourceFiles/core/basic_types.h index 2259cbba0..d8279bb6c 100644 --- a/Telegram/SourceFiles/core/basic_types.h +++ b/Telegram/SourceFiles/core/basic_types.h @@ -54,4 +54,4 @@ void as_const(const T&&) = delete; #include #define qsl(s) QStringLiteral(s) -#define qstr(s) QLatin1String(s, sizeof(s) - 1) +#define qstr(s) QLatin1String(s, static_cast(sizeof(s)-1))