Fix theme editor closing in a small window.

Fixes #6510.
This commit is contained in:
John Preston 2019-09-09 18:37:04 +03:00
parent c9c0d74b68
commit 423254f7eb
2 changed files with 9 additions and 28 deletions

View File

@ -602,12 +602,20 @@ void MainWindow::showRightColumn(object_ptr<TWidget> 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 {

View File

@ -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<InformBox>(tr::lng_theme_editor_error(tr::now)));
// return;
// }
// KeepApplied();
// if (auto window = App::wnd()) {
// window->showRightColumn(Box<Editor>(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<Editor>(path));
// }
//}
void Editor::closeWithConfirmation() {
if (!PaletteChanged(_inner->paletteContent(), _cloud)) {
Background()->clearEditingTheme(ClearEditing::KeepChanges);