From 423254f7eb497b6833bc73df8fde5c5938868111 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 9 Sep 2019 18:37:04 +0300 Subject: [PATCH] Fix theme editor closing in a small window. Fixes #6510. --- Telegram/SourceFiles/window/main_window.cpp | 10 ++++++- .../window/themes/window_theme_editor.cpp | 27 ------------------- 2 files changed, 9 insertions(+), 28 deletions(-) diff --git a/Telegram/SourceFiles/window/main_window.cpp b/Telegram/SourceFiles/window/main_window.cpp index 7e2e3f687..b397642c3 100644 --- a/Telegram/SourceFiles/window/main_window.cpp +++ b/Telegram/SourceFiles/window/main_window.cpp @@ -602,12 +602,20 @@ void MainWindow::showRightColumn(object_ptr widget) { } const auto nowRightWidth = _rightColumn ? _rightColumn->width() : 0; const auto wasMaximized = isMaximized(); + const auto wasMinimumWidth = minimumWidth(); + const auto nowMinimumWidth = st::windowMinWidth + nowRightWidth; + const auto firstResize = (nowMinimumWidth < wasMinimumWidth); + if (firstResize) { + setMinimumWidth(nowMinimumWidth); + } if (!isMaximized()) { tryToExtendWidthBy(wasWidth + nowRightWidth - wasRightWidth - width()); } else { updateControlsGeometry(); } - setMinimumWidth(st::windowMinWidth + nowRightWidth); + if (!firstResize) { + setMinimumWidth(nowMinimumWidth); + } } int MainWindow::maximalExtendBy() const { diff --git a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp index d56a86973..af32d5724 100644 --- a/Telegram/SourceFiles/window/themes/window_theme_editor.cpp +++ b/Telegram/SourceFiles/window/themes/window_theme_editor.cpp @@ -809,33 +809,6 @@ void Editor::paintEvent(QPaintEvent *e) { p.drawTextLeft(st::themeEditorMargin.left(), st::themeEditorMargin.top(), width(), tr::lng_theme_editor_title(tr::now)); } -//void Editor::Start() { -// const auto path = Background()->themeAbsolutePath(); -// if (!Window::Theme::IsPaletteTestingPath(path)) { -// const auto start = [](const QString &path) { -// if (!Local::copyThemeColorsToPalette(path)) { -// writeDefaultPalette(path); -// } -// if (!Apply(path)) { -// Ui::show(Box(tr::lng_theme_editor_error(tr::now))); -// return; -// } -// KeepApplied(); -// if (auto window = App::wnd()) { -// window->showRightColumn(Box(path)); -// } -// }; -// FileDialog::GetWritePath( -// App::wnd(), -// tr::lng_theme_editor_save_palette(tr::now), -// "Palette (*.tdesktop-palette)", -// "colors.tdesktop-palette", -// start); -// } else if (auto window = App::wnd()) { -// window->showRightColumn(Box(path)); -// } -//} - void Editor::closeWithConfirmation() { if (!PaletteChanged(_inner->paletteContent(), _cloud)) { Background()->clearEditingTheme(ClearEditing::KeepChanges);