mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 23:24:01 +02:00
Forbid auto-night mode with theme editor.
This commit is contained in:
parent
9a186cd8ce
commit
511067981d
4 changed files with 20 additions and 2 deletions
|
@ -309,6 +309,9 @@ void Application::checkSystemDarkMode() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::startSystemDarkModeViewer() {
|
void Application::startSystemDarkModeViewer() {
|
||||||
|
if (Window::Theme::Background()->editingTheme()) {
|
||||||
|
_settings.setSystemDarkModeEnabled(false);
|
||||||
|
}
|
||||||
rpl::merge(
|
rpl::merge(
|
||||||
_settings.systemDarkModeChanges() | rpl::to_empty,
|
_settings.systemDarkModeChanges() | rpl::to_empty,
|
||||||
_settings.systemDarkModeEnabledChanges() | rpl::to_empty
|
_settings.systemDarkModeEnabledChanges() | rpl::to_empty
|
||||||
|
|
|
@ -1294,8 +1294,14 @@ void SetupAutoNightMode(not_null<Ui::VerticalLayout*> container) {
|
||||||
) | rpl::filter([=](bool checked) {
|
) | rpl::filter([=](bool checked) {
|
||||||
return (checked != Core::App().settings().systemDarkModeEnabled());
|
return (checked != Core::App().settings().systemDarkModeEnabled());
|
||||||
}) | rpl::start_with_next([=](bool checked) {
|
}) | rpl::start_with_next([=](bool checked) {
|
||||||
Core::App().settings().setSystemDarkModeEnabled(checked);
|
if (checked && Window::Theme::Background()->editingTheme()) {
|
||||||
Core::App().saveSettingsDelayed();
|
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());
|
}, autoNight->lifetime());
|
||||||
|
|
||||||
Core::App().settings().systemDarkModeEnabledChanges(
|
Core::App().settings().systemDarkModeEnabledChanges(
|
||||||
|
|
|
@ -676,6 +676,10 @@ void StartEditor(
|
||||||
window->show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
window->show(Box<InformBox>(tr::lng_theme_editor_error(tr::now)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (Core::App().settings().systemDarkModeEnabled()) {
|
||||||
|
Core::App().settings().setSystemDarkModeEnabled(false);
|
||||||
|
Core::App().saveSettingsDelayed();
|
||||||
|
}
|
||||||
Background()->setEditingTheme(cloud);
|
Background()->setEditingTheme(cloud);
|
||||||
window->showRightColumn(Box<Editor>(window, cloud));
|
window->showRightColumn(Box<Editor>(window, cloud));
|
||||||
}
|
}
|
||||||
|
|
|
@ -880,6 +880,11 @@ void MainMenu::refreshMenu() {
|
||||||
|
|
||||||
_nightThemeAction = std::make_shared<QPointer<QAction>>();
|
_nightThemeAction = std::make_shared<QPointer<QAction>>();
|
||||||
auto action = _menu->addAction(tr::lng_menu_night_mode(tr::now), [=] {
|
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 weak = MakeWeak(this);
|
||||||
const auto toggle = [=] {
|
const auto toggle = [=] {
|
||||||
if (!weak) {
|
if (!weak) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue