Alpha 1.0.7: Theme editor added to Settings.

This commit is contained in:
John Preston 2017-02-07 20:39:47 +03:00
parent b842761ea3
commit 27a4d0f029
13 changed files with 61 additions and 52 deletions

View file

@ -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";

View file

@ -6,7 +6,7 @@
<Identity Name="TelegramDesktop"
ProcessorArchitecture="x64"
Publisher="CN=Telegram Messenger LLP, O=Telegram Messenger LLP, L=London, C=GB"
Version="1.0.6.1" />
Version="1.0.7.0" />
<Properties>
<DisplayName>Telegram Desktop</DisplayName>
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>

View file

@ -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"

View file

@ -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"

View file

@ -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 {

View file

@ -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;

View file

@ -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();
}

View file

@ -42,6 +42,7 @@ protected:
signals:
void chooseFromGallery();
void chooseFromFile();
void editTheme();
void useDefault();
private:
@ -58,6 +59,7 @@ private:
object_ptr<Ui::LinkButton> _useDefaultTheme = { nullptr };
object_ptr<Ui::LinkButton> _chooseFromGallery;
object_ptr<Ui::LinkButton> _chooseFromFile;
object_ptr<Ui::LinkButton> _editTheme;
Ui::RadialAnimation _radial;
@ -72,6 +74,7 @@ public:
private slots:
void onChooseFromGallery();
void onChooseFromFile();
void onEditTheme();
void onUseDefaultTheme();
void onTile();
void onAdaptive();

View file

@ -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();
});
}

View file

@ -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<InformBox>(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<Editor>(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<InformBox>(lang(lng_theme_editor_error)));
return;
}
KeepApplied();
if (auto window = App::wnd()) {
window->showRightColumn(Box<Editor>(path));
}
});
} else if (auto window = App::wnd()) {
window->showRightColumn(Box<Editor>(palettePath));
}
}

View file

@ -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;

View file

@ -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"
)
)

View file

@ -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