From 27a4d0f0295158c774159f518890638b5417d5ba Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 7 Feb 2017 20:39:47 +0300 Subject: [PATCH] Alpha 1.0.7: Theme editor added to Settings. --- Telegram/Resources/langs/lang.strings | 10 +++--- Telegram/Resources/uwp/AppX/AppxManifest.xml | 2 +- Telegram/Resources/winrc/Telegram.rc | 8 ++--- Telegram/Resources/winrc/Updater.rc | 8 ++--- Telegram/SourceFiles/application.cpp | 4 +-- Telegram/SourceFiles/core/version.h | 8 ++--- .../settings/settings_background_widget.cpp | 11 +++++++ .../settings/settings_background_widget.h | 3 ++ .../SourceFiles/settings/settings_widget.cpp | 9 +---- .../window/themes/window_theme_editor.cpp | 33 ++++++++++--------- .../window/themes/window_theme_editor.h | 3 +- Telegram/build/build.bat | 4 +-- Telegram/build/version | 10 +++--- 13 files changed, 61 insertions(+), 52 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index e4b6beffb..b864bc2b9 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -224,7 +224,6 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_settings_crop_profile" = "Select a square area for your profile photo"; "lng_settings_uploading_photo" = "Uploading photo..."; "lng_settings_edit" = "Edit"; - "lng_settings_drop_area_subtitle" = "to set it as your photo"; "lng_username_title" = "Username"; @@ -296,6 +295,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_settings_bg_use_default" = "Use default color theme"; "lng_settings_bg_from_gallery" = "Choose from gallery"; "lng_settings_bg_from_file" = "Choose from file"; +"lng_settings_bg_edit_theme" = "Edit theme"; "lng_settings_bg_tile" = "Tile background"; "lng_settings_adaptive_wide" = "Adaptive layout for wide screens"; @@ -1024,7 +1024,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_confirm_phone_enter_code" = "Please enter the code."; "lng_theme_editor_no_keys" = "No keys in the palette yet"; -"lng_theme_editor_cant_change_theme" = "You can not apply themes while you edit a color palette. Please close the palette editor first."; +"lng_theme_editor_cant_change_theme" = "You can not apply new themes while you're editing the color palette. Please close the theme editor first."; "lng_theme_editor_new_keys" = "Not in the palette yet"; "lng_theme_editor_background_image" = "Background image"; "lng_theme_editor_saved_to_jpg" = "Saved to JPEG, {size}"; @@ -1033,9 +1033,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_theme_editor_export" = "Export"; "lng_theme_editor_choose_image" = "Choose background image"; "lng_theme_editor_save_palette" = "Save palette file"; -"lng_theme_editor_choose_name" = "Choose theme filename"; -"lng_theme_editor_error" = "Editor encountered an error :( See 'log.txt' for details."; -"lng_theme_editor_done" = "Theme export was successfull!"; +"lng_theme_editor_choose_name" = "Save theme file"; +"lng_theme_editor_error" = "The editor encountered an error :( See 'log.txt' for details."; +"lng_theme_editor_done" = "Theme exported successfully!"; "lng_theme_editor_title" = "Edit color palette"; "lng_theme_editor_export_button" = "Export theme"; diff --git a/Telegram/Resources/uwp/AppX/AppxManifest.xml b/Telegram/Resources/uwp/AppX/AppxManifest.xml index 6d3aafc24..ce876cca2 100644 --- a/Telegram/Resources/uwp/AppX/AppxManifest.xml +++ b/Telegram/Resources/uwp/AppX/AppxManifest.xml @@ -6,7 +6,7 @@ + Version="1.0.7.0" /> Telegram Desktop Telegram Messenger LLP diff --git a/Telegram/Resources/winrc/Telegram.rc b/Telegram/Resources/winrc/Telegram.rc index 92b3a800f..5fd25d120 100644 --- a/Telegram/Resources/winrc/Telegram.rc +++ b/Telegram/Resources/winrc/Telegram.rc @@ -34,8 +34,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,6,1 - PRODUCTVERSION 1,0,6,1 + FILEVERSION 1,0,7,0 + PRODUCTVERSION 1,0,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -51,10 +51,10 @@ BEGIN BLOCK "040904b0" BEGIN VALUE "CompanyName", "Telegram Messenger LLP" - VALUE "FileVersion", "1.0.6.1" + VALUE "FileVersion", "1.0.7.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.6.1" + VALUE "ProductVersion", "1.0.7.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/Resources/winrc/Updater.rc b/Telegram/Resources/winrc/Updater.rc index 9ac2f0990..8021a4ed8 100644 --- a/Telegram/Resources/winrc/Updater.rc +++ b/Telegram/Resources/winrc/Updater.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,6,1 - PRODUCTVERSION 1,0,6,1 + FILEVERSION 1,0,7,0 + PRODUCTVERSION 1,0,7,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -43,10 +43,10 @@ BEGIN BEGIN VALUE "CompanyName", "Telegram Messenger LLP" VALUE "FileDescription", "Telegram Updater" - VALUE "FileVersion", "1.0.6.1" + VALUE "FileVersion", "1.0.7.0" VALUE "LegalCopyright", "Copyright (C) 2014-2017" VALUE "ProductName", "Telegram Desktop" - VALUE "ProductVersion", "1.0.6.1" + VALUE "ProductVersion", "1.0.7.0" END END BLOCK "VarFileInfo" diff --git a/Telegram/SourceFiles/application.cpp b/Telegram/SourceFiles/application.cpp index fca7dd303..a6f2b6786 100644 --- a/Telegram/SourceFiles/application.cpp +++ b/Telegram/SourceFiles/application.cpp @@ -1069,8 +1069,8 @@ void AppClass::checkMapVersion() { if (Local::oldMapVersion() < AppVersion) { if (Local::oldMapVersion()) { QString versionFeatures; - if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000004) { - versionFeatures = QString::fromUtf8("\xe2\x80\x94 Click and drag to reorder pinned chats."); + if ((cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000007) { + versionFeatures = QString::fromUtf8("\xe2\x80\x94 Added Theme editor to Settings."); } else if (!(cAlphaVersion() || cBetaVersion()) && Local::oldMapVersion() < 1000005) { versionFeatures = langNewVersionText(); } else { diff --git a/Telegram/SourceFiles/core/version.h b/Telegram/SourceFiles/core/version.h index 24f553790..a8f3088d3 100644 --- a/Telegram/SourceFiles/core/version.h +++ b/Telegram/SourceFiles/core/version.h @@ -22,9 +22,9 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "core/utils.h" -#define BETA_VERSION_MACRO (1000006001ULL) +#define BETA_VERSION_MACRO (0ULL) -constexpr int AppVersion = 1000006; -constexpr str_const AppVersionStr = "1.0.6"; -constexpr bool AppAlphaVersion = false; +constexpr int AppVersion = 1000007; +constexpr str_const AppVersionStr = "1.0.7"; +constexpr bool AppAlphaVersion = true; constexpr uint64 AppBetaVersion = BETA_VERSION_MACRO; diff --git a/Telegram/SourceFiles/settings/settings_background_widget.cpp b/Telegram/SourceFiles/settings/settings_background_widget.cpp index 8cfdfaa55..347d24f74 100644 --- a/Telegram/SourceFiles/settings/settings_background_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_background_widget.cpp @@ -31,17 +31,20 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org #include "localstorage.h" #include "mainwindow.h" #include "window/themes/window_theme.h" +#include "window/themes/window_theme_editor.h" namespace Settings { BackgroundRow::BackgroundRow(QWidget *parent) : TWidget(parent) , _chooseFromGallery(this, lang(lng_settings_bg_from_gallery), st::boxLinkButton) , _chooseFromFile(this, lang(lng_settings_bg_from_file), st::boxLinkButton) +, _editTheme(this, lang(lng_settings_bg_edit_theme), st::boxLinkButton) , _radial(animation(this, &BackgroundRow::step_radial)) { updateImage(); connect(_chooseFromGallery, SIGNAL(clicked()), this, SIGNAL(chooseFromGallery())); connect(_chooseFromFile, SIGNAL(clicked()), this, SIGNAL(chooseFromFile())); + connect(_editTheme, SIGNAL(clicked()), this, SIGNAL(editTheme())); checkNonDefaultTheme(); subscribe(Window::Theme::Background(), [this](const Window::Theme::BackgroundUpdate &update) { if (update.type == Window::Theme::BackgroundUpdate::Type::ApplyingTheme) { @@ -108,6 +111,7 @@ int BackgroundRow::resizeGetHeight(int newWidth) { auto linkWidth = newWidth - linkLeft; _chooseFromGallery->resizeToWidth(qMin(linkWidth, _chooseFromGallery->naturalWidth())); _chooseFromFile->resizeToWidth(qMin(linkWidth, _chooseFromFile->naturalWidth())); + _editTheme->resizeToWidth(qMin(linkWidth, _editTheme->naturalWidth())); if (_useDefaultTheme) { _useDefaultTheme->resizeToWidth(qMin(linkWidth, _useDefaultTheme->naturalWidth())); _useDefaultTheme->moveToLeft(linkLeft, linkTop, newWidth); @@ -116,6 +120,8 @@ int BackgroundRow::resizeGetHeight(int newWidth) { _chooseFromGallery->moveToLeft(linkLeft, linkTop, newWidth); linkTop += _chooseFromGallery->height() + st::settingsSmallSkip; _chooseFromFile->moveToLeft(linkLeft, linkTop, newWidth); + linkTop += _chooseFromFile->height() + st::settingsSmallSkip; + _editTheme->moveToLeft(linkLeft, linkTop, newWidth); return st::settingsBackgroundSize; } @@ -220,6 +226,7 @@ void BackgroundWidget::createControls() { addChildRow(_background, margin); connect(_background, SIGNAL(chooseFromGallery()), this, SLOT(onChooseFromGallery())); connect(_background, SIGNAL(chooseFromFile()), this, SLOT(onChooseFromFile())); + connect(_background, SIGNAL(editTheme()), this, SLOT(onEditTheme())); connect(_background, SIGNAL(useDefault()), this, SLOT(onUseDefaultTheme())); addChildRow(_tile, margin, lang(lng_settings_bg_tile), SLOT(onTile()), Window::Theme::Background()->tile()); @@ -246,6 +253,10 @@ void BackgroundWidget::onChooseFromFile() { _chooseFromFileQueryId = FileDialog::queryReadFile(lang(lng_choose_image), filters.join(qsl(";;"))); } +void BackgroundWidget::onEditTheme() { + Window::Theme::Editor::Start(); +} + void BackgroundWidget::onUseDefaultTheme() { Window::Theme::ApplyDefault(); } diff --git a/Telegram/SourceFiles/settings/settings_background_widget.h b/Telegram/SourceFiles/settings/settings_background_widget.h index 797f2022b..4f3954eb2 100644 --- a/Telegram/SourceFiles/settings/settings_background_widget.h +++ b/Telegram/SourceFiles/settings/settings_background_widget.h @@ -42,6 +42,7 @@ protected: signals: void chooseFromGallery(); void chooseFromFile(); + void editTheme(); void useDefault(); private: @@ -58,6 +59,7 @@ private: object_ptr _useDefaultTheme = { nullptr }; object_ptr _chooseFromGallery; object_ptr _chooseFromFile; + object_ptr _editTheme; Ui::RadialAnimation _radial; @@ -72,6 +74,7 @@ public: private slots: void onChooseFromGallery(); void onChooseFromFile(); + void onEditTheme(); void onUseDefaultTheme(); void onTile(); void onAdaptive(); diff --git a/Telegram/SourceFiles/settings/settings_widget.cpp b/Telegram/SourceFiles/settings/settings_widget.cpp index b6f2aa5e7..0d98903d6 100644 --- a/Telegram/SourceFiles/settings/settings_widget.cpp +++ b/Telegram/SourceFiles/settings/settings_widget.cpp @@ -100,14 +100,7 @@ void fillCodes() { }); }); Codes.insert(qsl("edittheme"), []() { - auto palettePath = Local::themePaletteAbsolutePath(); - if (palettePath.isEmpty()) { - FileDialog::askWritePath(lang(lng_theme_editor_save_palette), "Palette (*.tdesktop-palette)", "colors.tdesktop-palette", [](const QString &path) { - Window::Theme::Editor::StartFromCurrentTheme(path); - }); - } else { - Window::Theme::Editor::Start(palettePath); - } + Window::Theme::Editor::Start(); }); } diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp index 51e2e490b..bc95e3b05 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp @@ -731,18 +731,6 @@ Editor::Editor(QWidget*, const QString &path) resizeToWidth(st::windowMinWidth); } -void Editor::StartFromCurrentTheme(const QString &path) { - if (!Local::copyThemeColorsToPalette(path)) { - writeDefaultPalette(path); - } - if (!Apply(path)) { - Ui::show(Box(lang(lng_theme_editor_error))); - return; - } - KeepApplied(); - Start(path); -} - void Editor::resizeEvent(QResizeEvent *e) { _export->resizeToWidth(width()); _close->moveToRight(0, 0); @@ -801,9 +789,24 @@ void Editor::paintEvent(QPaintEvent *e) { p.drawTextLeft(st::themeEditorMargin.left(), st::themeEditorMargin.top(), width(), lang(lng_theme_editor_title)); } -void Editor::Start(const QString &path) { - if (auto window = App::wnd()) { - window->showRightColumn(Box(path)); +void Editor::Start() { + auto palettePath = Local::themePaletteAbsolutePath(); + if (palettePath.isEmpty()) { + FileDialog::askWritePath(lang(lng_theme_editor_save_palette), "Palette (*.tdesktop-palette)", "colors.tdesktop-palette", [](const QString &path) { + if (!Local::copyThemeColorsToPalette(path)) { + writeDefaultPalette(path); + } + if (!Apply(path)) { + Ui::show(Box(lang(lng_theme_editor_error))); + return; + } + KeepApplied(); + if (auto window = App::wnd()) { + window->showRightColumn(Box(path)); + } + }); + } else if (auto window = App::wnd()) { + window->showRightColumn(Box(palettePath)); } } diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor.h b/Telegram/SourceFiles/window/themes/window_theme_editor.h index 8a27ab660..d5fd8dc58 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor.h +++ b/Telegram/SourceFiles/window/themes/window_theme_editor.h @@ -38,8 +38,7 @@ class Editor : public TWidget { public: Editor(QWidget*, const QString &path); - static void StartFromCurrentTheme(const QString &path); - static void Start(const QString &path); + static void Start(); protected: void paintEvent(QPaintEvent *e) override; diff --git a/Telegram/build/build.bat b/Telegram/build/build.bat index 1ff61a7d0..53477da92 100644 --- a/Telegram/build/build.bat +++ b/Telegram/build/build.bat @@ -175,8 +175,8 @@ if %BuildUWP% equ 0 ( if %errorlevel% neq 0 goto error if %BetaVersion% neq 0 ( - set "UpdateFile=%UpdateFile%_%BetaSignature%" - set "PortableFile=tbeta%BetaVersion%_%BetaSignature%.zip" + set "UpdateFile=!UpdateFile!_!BetaSignature!" + set "PortableFile=tbeta!BetaVersion!_!BetaSignature!.zip" ) ) diff --git a/Telegram/build/version b/Telegram/build/version index b930f657b..569c0411e 100644 --- a/Telegram/build/version +++ b/Telegram/build/version @@ -1,6 +1,6 @@ -AppVersion 1000006 +AppVersion 1000007 AppVersionStrMajor 1.0 -AppVersionStrSmall 1.0.6 -AppVersionStr 1.0.6 -AlphaChannel 0 -BetaVersion 1000006001 +AppVersionStrSmall 1.0.7 +AppVersionStr 1.0.7 +AlphaChannel 1 +BetaVersion 0