mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
DisplaySettings: Set window modified state
This commit is contained in:
parent
af01c6be0c
commit
d7190be3a3
Notes:
sideshowbarker
2024-07-17 12:00:31 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/d7190be3a3 Pull-request: https://github.com/SerenityOS/serenity/pull/14006 Reviewed-by: https://github.com/MacDue
5 changed files with 23 additions and 7 deletions
|
@ -61,6 +61,7 @@ void BackgroundSettingsWidget::create_frame()
|
|||
}
|
||||
|
||||
m_monitor_widget->set_wallpaper(path);
|
||||
set_modified(true);
|
||||
};
|
||||
|
||||
m_context_menu = GUI::Menu::construct();
|
||||
|
@ -93,6 +94,7 @@ void BackgroundSettingsWidget::create_frame()
|
|||
m_wallpaper_view->selection().clear();
|
||||
m_monitor_widget->set_wallpaper(path.value());
|
||||
m_background_settings_changed = true;
|
||||
set_modified(true);
|
||||
};
|
||||
|
||||
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_background_settings_changed = !first_mode_change;
|
||||
first_mode_change = false;
|
||||
set_modified(true);
|
||||
};
|
||||
|
||||
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_background_settings_changed = !first_color_change;
|
||||
first_color_change = false;
|
||||
set_modified(true);
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -133,7 +137,7 @@ void BackgroundSettingsWidget::load_current_settings()
|
|||
mode = "center";
|
||||
}
|
||||
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 background_color = ws_config->read_entry("Background", "Color", "");
|
||||
|
@ -144,7 +148,7 @@ void BackgroundSettingsWidget::load_current_settings()
|
|||
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_background_settings_changed = false;
|
||||
}
|
||||
|
|
|
@ -26,14 +26,20 @@ void DesktopSettingsWidget::create_frame()
|
|||
load_from_gml(desktop_settings_gml);
|
||||
|
||||
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->on_change = [&](auto) {
|
||||
set_modified(true);
|
||||
};
|
||||
}
|
||||
|
||||
void DesktopSettingsWidget::load_current_settings()
|
||||
{
|
||||
auto& desktop = GUI::Desktop::the();
|
||||
m_workspace_rows_spinbox->set_value(desktop.workspace_rows());
|
||||
m_workspace_columns_spinbox->set_value(desktop.workspace_columns());
|
||||
m_workspace_rows_spinbox->set_value(desktop.workspace_rows(), GUI::AllowCallback::No);
|
||||
m_workspace_columns_spinbox->set_value(desktop.workspace_columns(), GUI::AllowCallback::No);
|
||||
}
|
||||
|
||||
void DesktopSettingsWidget::apply_settings()
|
||||
|
|
|
@ -30,6 +30,7 @@ FontSettingsWidget::FontSettingsWidget()
|
|||
auto font_picker = GUI::FontPicker::construct(window(), &m_default_font_label->font(), false);
|
||||
if (font_picker->exec() == GUI::Dialog::ExecOK) {
|
||||
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);
|
||||
if (font_picker->exec() == GUI::Dialog::ExecOK) {
|
||||
update_label_with_font(*m_fixed_width_font_label, *font_picker->font());
|
||||
set_modified(true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@ void MonitorSettingsWidget::create_frame()
|
|||
// Try to auto re-arrange things if there are overlaps or disconnected screens
|
||||
m_screen_layout.normalize();
|
||||
selected_screen_index_or_resolution_changed();
|
||||
set_modified(true);
|
||||
};
|
||||
|
||||
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_monitor_widget->set_desktop_scale_factor(1);
|
||||
m_monitor_widget->update();
|
||||
set_modified(true);
|
||||
}
|
||||
};
|
||||
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_monitor_widget->set_desktop_scale_factor(2);
|
||||
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);
|
||||
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);
|
||||
|
||||
// Select the current selected resolution as it may differ
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -44,8 +44,9 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
|
|||
m_themes_combo->on_change = [this](auto&, const GUI::ModelIndex& index) {
|
||||
m_selected_theme = &m_themes.at(index.row());
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue