mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 14:14:45 +03:00
DisplaySettings: Move screen number show/hide logic into widget
This is functionally the same as before, as selecting a tab fires Show and HideEvents. But this way, we don't need to directly access the TabWidget, which will make using SettingsWindow simpler.
This commit is contained in:
parent
9fc53017c6
commit
a4af8b2a64
Notes:
sideshowbarker
2024-07-18 00:58:17 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/a4af8b2a648 Pull-request: https://github.com/SerenityOS/serenity/pull/10979 Reviewed-by: https://github.com/linusg ✅
@ -179,4 +179,14 @@ void MonitorSettingsWidget::show_screen_numbers(bool show)
|
||||
GUI::WindowServerConnection::the().async_show_screen_numbers(show);
|
||||
}
|
||||
|
||||
void MonitorSettingsWidget::show_event(GUI::ShowEvent&)
|
||||
{
|
||||
show_screen_numbers(true);
|
||||
}
|
||||
|
||||
void MonitorSettingsWidget::hide_event(GUI::HideEvent&)
|
||||
{
|
||||
show_screen_numbers(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -28,6 +28,10 @@ public:
|
||||
void apply_settings();
|
||||
void show_screen_numbers(bool);
|
||||
|
||||
protected:
|
||||
void show_event(GUI::ShowEvent& event) override;
|
||||
void hide_event(GUI::HideEvent& event) override;
|
||||
|
||||
private:
|
||||
MonitorSettingsWidget();
|
||||
|
||||
|
@ -50,9 +50,6 @@ int main(int argc, char** argv)
|
||||
auto& font_settings_widget = tab_widget.add_tab<DisplaySettings::FontSettingsWidget>("Fonts");
|
||||
auto& monitor_settings_widget = tab_widget.add_tab<DisplaySettings::MonitorSettingsWidget>("Monitor");
|
||||
auto& desktop_settings_widget = tab_widget.add_tab<DisplaySettings::DesktopSettingsWidget>("Workspaces");
|
||||
tab_widget.on_change = [&](auto& widget) {
|
||||
monitor_settings_widget.show_screen_numbers(&widget == &monitor_settings_widget);
|
||||
};
|
||||
|
||||
auto& button_container = main_widget.add<GUI::Widget>();
|
||||
button_container.set_shrink_to_fit(true);
|
||||
|
Loading…
Reference in New Issue
Block a user