1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:27:45 +00:00

DisplaySettings: Set window modified state

This commit is contained in:
Sam Atkins 2022-05-11 17:08:32 +01:00 committed by Andreas Kling
parent af01c6be0c
commit d7190be3a3
5 changed files with 23 additions and 7 deletions

View file

@ -61,6 +61,7 @@ void BackgroundSettingsWidget::create_frame()
} }
m_monitor_widget->set_wallpaper(path); m_monitor_widget->set_wallpaper(path);
set_modified(true);
}; };
m_context_menu = GUI::Menu::construct(); m_context_menu = GUI::Menu::construct();
@ -93,6 +94,7 @@ void BackgroundSettingsWidget::create_frame()
m_wallpaper_view->selection().clear(); m_wallpaper_view->selection().clear();
m_monitor_widget->set_wallpaper(path.value()); m_monitor_widget->set_wallpaper(path.value());
m_background_settings_changed = true; m_background_settings_changed = true;
set_modified(true);
}; };
m_mode_combo = *find_descendant_of_type_named<GUI::ComboBox>("mode_combo"); m_mode_combo = *find_descendant_of_type_named<GUI::ComboBox>("mode_combo");
@ -103,6 +105,7 @@ void BackgroundSettingsWidget::create_frame()
m_monitor_widget->set_wallpaper_mode(m_modes.at(index.row())); m_monitor_widget->set_wallpaper_mode(m_modes.at(index.row()));
m_background_settings_changed = !first_mode_change; m_background_settings_changed = !first_mode_change;
first_mode_change = false; first_mode_change = false;
set_modified(true);
}; };
m_color_input = *find_descendant_of_type_named<GUI::ColorInput>("color_input"); m_color_input = *find_descendant_of_type_named<GUI::ColorInput>("color_input");
@ -113,6 +116,7 @@ void BackgroundSettingsWidget::create_frame()
m_monitor_widget->set_background_color(m_color_input->color()); m_monitor_widget->set_background_color(m_color_input->color());
m_background_settings_changed = !first_color_change; m_background_settings_changed = !first_color_change;
first_color_change = false; first_color_change = false;
set_modified(true);
}; };
} }
@ -133,7 +137,7 @@ void BackgroundSettingsWidget::load_current_settings()
mode = "center"; mode = "center";
} }
m_monitor_widget->set_wallpaper_mode(mode); m_monitor_widget->set_wallpaper_mode(mode);
m_mode_combo->set_selected_index(m_modes.find_first_index(mode).value_or(0)); m_mode_combo->set_selected_index(m_modes.find_first_index(mode).value_or(0), GUI::AllowCallback::No);
auto palette_desktop_color = palette().desktop_background(); auto palette_desktop_color = palette().desktop_background();
auto background_color = ws_config->read_entry("Background", "Color", ""); auto background_color = ws_config->read_entry("Background", "Color", "");
@ -144,7 +148,7 @@ void BackgroundSettingsWidget::load_current_settings()
palette_desktop_color = opt_color.value(); palette_desktop_color = opt_color.value();
} }
m_color_input->set_color(palette_desktop_color); m_color_input->set_color(palette_desktop_color, GUI::AllowCallback::No);
m_monitor_widget->set_background_color(palette_desktop_color); m_monitor_widget->set_background_color(palette_desktop_color);
m_background_settings_changed = false; m_background_settings_changed = false;
} }

View file

@ -26,14 +26,20 @@ void DesktopSettingsWidget::create_frame()
load_from_gml(desktop_settings_gml); load_from_gml(desktop_settings_gml);
m_workspace_rows_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("workspace_rows_spinbox"); m_workspace_rows_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("workspace_rows_spinbox");
m_workspace_rows_spinbox->on_change = [&](auto) {
set_modified(true);
};
m_workspace_columns_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("workspace_columns_spinbox"); m_workspace_columns_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("workspace_columns_spinbox");
m_workspace_columns_spinbox->on_change = [&](auto) {
set_modified(true);
};
} }
void DesktopSettingsWidget::load_current_settings() void DesktopSettingsWidget::load_current_settings()
{ {
auto& desktop = GUI::Desktop::the(); auto& desktop = GUI::Desktop::the();
m_workspace_rows_spinbox->set_value(desktop.workspace_rows()); m_workspace_rows_spinbox->set_value(desktop.workspace_rows(), GUI::AllowCallback::No);
m_workspace_columns_spinbox->set_value(desktop.workspace_columns()); m_workspace_columns_spinbox->set_value(desktop.workspace_columns(), GUI::AllowCallback::No);
} }
void DesktopSettingsWidget::apply_settings() void DesktopSettingsWidget::apply_settings()

View file

@ -30,6 +30,7 @@ FontSettingsWidget::FontSettingsWidget()
auto font_picker = GUI::FontPicker::construct(window(), &m_default_font_label->font(), false); auto font_picker = GUI::FontPicker::construct(window(), &m_default_font_label->font(), false);
if (font_picker->exec() == GUI::Dialog::ExecOK) { if (font_picker->exec() == GUI::Dialog::ExecOK) {
update_label_with_font(*m_default_font_label, *font_picker->font()); update_label_with_font(*m_default_font_label, *font_picker->font());
set_modified(true);
} }
}; };
@ -42,6 +43,7 @@ FontSettingsWidget::FontSettingsWidget()
auto font_picker = GUI::FontPicker::construct(window(), &m_fixed_width_font_label->font(), true); auto font_picker = GUI::FontPicker::construct(window(), &m_fixed_width_font_label->font(), true);
if (font_picker->exec() == GUI::Dialog::ExecOK) { if (font_picker->exec() == GUI::Dialog::ExecOK) {
update_label_with_font(*m_fixed_width_font_label, *font_picker->font()); update_label_with_font(*m_fixed_width_font_label, *font_picker->font());
set_modified(true);
} }
}; };
} }

View file

@ -92,6 +92,7 @@ void MonitorSettingsWidget::create_frame()
// Try to auto re-arrange things if there are overlaps or disconnected screens // Try to auto re-arrange things if there are overlaps or disconnected screens
m_screen_layout.normalize(); m_screen_layout.normalize();
selected_screen_index_or_resolution_changed(); selected_screen_index_or_resolution_changed();
set_modified(true);
}; };
m_display_scale_radio_1x = *find_descendant_of_type_named<GUI::RadioButton>("scale_1x"); m_display_scale_radio_1x = *find_descendant_of_type_named<GUI::RadioButton>("scale_1x");
@ -103,6 +104,7 @@ void MonitorSettingsWidget::create_frame()
m_screen_layout.normalize(); m_screen_layout.normalize();
m_monitor_widget->set_desktop_scale_factor(1); m_monitor_widget->set_desktop_scale_factor(1);
m_monitor_widget->update(); m_monitor_widget->update();
set_modified(true);
} }
}; };
m_display_scale_radio_2x = *find_descendant_of_type_named<GUI::RadioButton>("scale_2x"); m_display_scale_radio_2x = *find_descendant_of_type_named<GUI::RadioButton>("scale_2x");
@ -114,6 +116,7 @@ void MonitorSettingsWidget::create_frame()
m_screen_layout.normalize(); m_screen_layout.normalize();
m_monitor_widget->set_desktop_scale_factor(2); m_monitor_widget->set_desktop_scale_factor(2);
m_monitor_widget->update(); m_monitor_widget->update();
set_modified(true);
} }
}; };
@ -209,12 +212,12 @@ void MonitorSettingsWidget::selected_screen_index_or_resolution_changed()
dbgln("unexpected ScaleFactor {}, setting to 1", screen.scale_factor); dbgln("unexpected ScaleFactor {}, setting to 1", screen.scale_factor);
screen.scale_factor = 1; screen.scale_factor = 1;
} }
(screen.scale_factor == 1 ? m_display_scale_radio_1x : m_display_scale_radio_2x)->set_checked(true); (screen.scale_factor == 1 ? m_display_scale_radio_1x : m_display_scale_radio_2x)->set_checked(true, GUI::AllowCallback::No);
m_monitor_widget->set_desktop_scale_factor(screen.scale_factor); m_monitor_widget->set_desktop_scale_factor(screen.scale_factor);
// Select the current selected resolution as it may differ // Select the current selected resolution as it may differ
m_monitor_widget->set_desktop_resolution(current_resolution); m_monitor_widget->set_desktop_resolution(current_resolution);
m_resolution_combo->set_selected_index(index); m_resolution_combo->set_selected_index(index, GUI::AllowCallback::No);
m_monitor_widget->update(); m_monitor_widget->update();
} }

View file

@ -44,8 +44,9 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
m_themes_combo->on_change = [this](auto&, const GUI::ModelIndex& index) { m_themes_combo->on_change = [this](auto&, const GUI::ModelIndex& index) {
m_selected_theme = &m_themes.at(index.row()); m_selected_theme = &m_themes.at(index.row());
m_theme_preview->set_theme(m_selected_theme->path); m_theme_preview->set_theme(m_selected_theme->path);
set_modified(true);
}; };
m_themes_combo->set_selected_index(current_theme_index); m_themes_combo->set_selected_index(current_theme_index, GUI::AllowCallback::No);
} }
void ThemesSettingsWidget::apply_settings() void ThemesSettingsWidget::apply_settings()