mirror of
https://github.com/Qz3rK/tdesktop.git
synced 2026-07-03 14:15:08 +02:00
Forbid auto-night mode with theme editor.
This commit is contained in:
@@ -309,6 +309,9 @@ void Application::checkSystemDarkMode() {
|
||||
}
|
||||
|
||||
void Application::startSystemDarkModeViewer() {
|
||||
if (Window::Theme::Background()->editingTheme()) {
|
||||
_settings.setSystemDarkModeEnabled(false);
|
||||
}
|
||||
rpl::merge(
|
||||
_settings.systemDarkModeChanges() | rpl::to_empty,
|
||||
_settings.systemDarkModeEnabledChanges() | rpl::to_empty
|
||||
|
||||
@@ -1294,8 +1294,14 @@ void SetupAutoNightMode(not_null<Ui::VerticalLayout*> container) {
|
||||
) | rpl::filter([=](bool checked) {
|
||||
return (checked != Core::App().settings().systemDarkModeEnabled());
|
||||
}) | rpl::start_with_next([=](bool checked) {
|
||||
Core::App().settings().setSystemDarkModeEnabled(checked);
|
||||
Core::App().saveSettingsDelayed();
|
||||
if (checked && Window::Theme::Background()->editingTheme()) {
|
||||
autoNight->setChecked(false);
|
||||
Ui::show(Box<InformBox>(
|
||||
tr::lng_theme_editor_cant_change_theme(tr::now)));
|
||||
} else {
|
||||
Core::App().settings().setSystemDarkModeEnabled(checked);
|
||||
Core::App().saveSettingsDelayed();
|
||||
}
|
||||
}, autoNight->lifetime());
|
||||
|
||||
Core::App().settings().systemDarkModeEnabledChanges(
|
||||
|
||||
@@ -676,6 +676,10 @@ void StartEditor(
|
||||
window->show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||
return;
|
||||
}
|
||||
if (Core::App().settings().systemDarkModeEnabled()) {
|
||||
Core::App().settings().setSystemDarkModeEnabled(false);
|
||||
Core::App().saveSettingsDelayed();
|
||||
}
|
||||
Background()->setEditingTheme(cloud);
|
||||
window->showRightColumn(Box<Editor>(window, cloud));
|
||||
}
|
||||
|
||||
@@ -880,6 +880,11 @@ void MainMenu::refreshMenu() {
|
||||
|
||||
_nightThemeAction = std::make_shared<QPointer<QAction>>();
|
||||
auto action = _menu->addAction(tr::lng_menu_night_mode(tr::now), [=] {
|
||||
if (Window::Theme::Background()->editingTheme()) {
|
||||
Ui::show(Box<InformBox>(
|
||||
tr::lng_theme_editor_cant_change_theme(tr::now)));
|
||||
return;
|
||||
}
|
||||
const auto weak = MakeWeak(this);
|
||||
const auto toggle = [=] {
|
||||
if (!weak) {
|
||||
|
||||
Reference in New Issue
Block a user