mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 02:03:06 -05:00
MouseSettings: Set window modified state
This commit is contained in:
parent
7d6f5f19fd
commit
17b41f0d61
Notes:
sideshowbarker
2024-07-17 12:00:39 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/17b41f0d61 Pull-request: https://github.com/SerenityOS/serenity/pull/14006 Reviewed-by: https://github.com/MacDue
3 changed files with 36 additions and 9 deletions
|
@ -25,28 +25,41 @@ MouseWidget::MouseWidget()
|
|||
m_speed_label = *find_descendant_of_type_named<GUI::Label>("speed_label");
|
||||
m_speed_slider = *find_descendant_of_type_named<GUI::HorizontalSlider>("speed_slider");
|
||||
m_speed_slider->set_range(WindowServer::mouse_accel_min * speed_slider_scale, WindowServer::mouse_accel_max * speed_slider_scale);
|
||||
m_speed_slider->on_change = [&](int value) {
|
||||
m_speed_label->set_text(String::formatted("{} %", value));
|
||||
};
|
||||
int const slider_value = float { speed_slider_scale } * GUI::ConnectionToWindowServer::the().get_mouse_acceleration();
|
||||
m_speed_slider->set_value(slider_value);
|
||||
m_speed_slider->set_value(slider_value, GUI::AllowCallback::No);
|
||||
m_speed_slider->on_change = [&](int) {
|
||||
update_speed_label();
|
||||
set_modified(true);
|
||||
};
|
||||
|
||||
m_scroll_length_spinbox = *find_descendant_of_type_named<GUI::SpinBox>("scroll_length_spinbox");
|
||||
m_scroll_length_spinbox->set_min(WindowServer::scroll_step_size_min);
|
||||
m_scroll_length_spinbox->set_value(GUI::ConnectionToWindowServer::the().get_scroll_step_size());
|
||||
m_scroll_length_spinbox->set_value(GUI::ConnectionToWindowServer::the().get_scroll_step_size(), GUI::AllowCallback::No);
|
||||
m_scroll_length_spinbox->on_change = [&](auto) {
|
||||
set_modified(true);
|
||||
};
|
||||
|
||||
m_double_click_arrow_widget = *find_descendant_of_type_named<MouseSettings::DoubleClickArrowWidget>("double_click_arrow_widget");
|
||||
m_double_click_speed_label = *find_descendant_of_type_named<GUI::Label>("double_click_speed_label");
|
||||
m_double_click_speed_slider = *find_descendant_of_type_named<GUI::HorizontalSlider>("double_click_speed_slider");
|
||||
m_double_click_speed_slider->set_min(WindowServer::double_click_speed_min);
|
||||
m_double_click_speed_slider->set_max(WindowServer::double_click_speed_max);
|
||||
m_double_click_speed_slider->set_value(GUI::ConnectionToWindowServer::the().get_double_click_speed(), GUI::AllowCallback::No);
|
||||
m_double_click_speed_slider->on_change = [&](int speed) {
|
||||
m_double_click_arrow_widget->set_double_click_speed(speed);
|
||||
m_double_click_speed_label->set_text(String::formatted("{} ms", speed));
|
||||
update_double_click_speed_label();
|
||||
set_modified(true);
|
||||
};
|
||||
m_double_click_speed_slider->set_value(GUI::ConnectionToWindowServer::the().get_double_click_speed());
|
||||
|
||||
m_switch_buttons_checkbox = *find_descendant_of_type_named<GUI::CheckBox>("switch_buttons_input");
|
||||
m_switch_buttons_checkbox->set_checked(GUI::ConnectionToWindowServer::the().get_buttons_switched());
|
||||
m_switch_buttons_checkbox->set_checked(GUI::ConnectionToWindowServer::the().get_buttons_switched(), GUI::AllowCallback::No);
|
||||
m_switch_buttons_checkbox->on_checked = [&](auto) {
|
||||
set_modified(true);
|
||||
};
|
||||
|
||||
update_speed_label();
|
||||
update_double_click_speed_label();
|
||||
m_double_click_arrow_widget->set_double_click_speed(m_double_click_speed_slider->value());
|
||||
}
|
||||
|
||||
void MouseWidget::apply_settings()
|
||||
|
@ -65,3 +78,13 @@ void MouseWidget::reset_default_values()
|
|||
m_double_click_speed_slider->set_value(double_click_speed_default);
|
||||
m_switch_buttons_checkbox->set_checked(false);
|
||||
}
|
||||
|
||||
void MouseWidget::update_speed_label()
|
||||
{
|
||||
m_speed_label->set_text(String::formatted("{} %", m_speed_slider->value()));
|
||||
}
|
||||
|
||||
void MouseWidget::update_double_click_speed_label()
|
||||
{
|
||||
m_double_click_speed_label->set_text(String::formatted("{} ms", m_double_click_speed_slider->value()));
|
||||
}
|
||||
|
|
|
@ -22,6 +22,9 @@ public:
|
|||
private:
|
||||
MouseWidget();
|
||||
|
||||
void update_speed_label();
|
||||
void update_double_click_speed_label();
|
||||
|
||||
RefPtr<GUI::HorizontalSlider> m_speed_slider;
|
||||
RefPtr<GUI::Label> m_speed_label;
|
||||
RefPtr<GUI::SpinBox> m_scroll_length_spinbox;
|
||||
|
|
|
@ -121,10 +121,11 @@ ThemeWidget::ThemeWidget()
|
|||
m_theme_name_box = find_descendant_of_type_named<GUI::ComboBox>("theme_name_box");
|
||||
m_theme_name_box->on_change = [this](String const& value, GUI::ModelIndex const&) mutable {
|
||||
m_mouse_cursor_model->change_theme(value);
|
||||
set_modified(true);
|
||||
};
|
||||
m_theme_name_box->set_model(ThemeModel::create());
|
||||
m_theme_name_box->model()->invalidate();
|
||||
m_theme_name_box->set_text(theme_name);
|
||||
m_theme_name_box->set_text(theme_name, GUI::AllowCallback::No);
|
||||
}
|
||||
|
||||
void ThemeWidget::apply_settings()
|
||||
|
|
Loading…
Add table
Reference in a new issue