mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-01 07:35:02 +03:00
LibGUI+WindowServer+DisplaySettings: Add Tooltips to SystemEffects
Tooltips can now be toggled on and off system-wide.
This commit is contained in:
parent
d286bf85e6
commit
a74f512f6b
Notes:
sideshowbarker
2024-07-18 08:59:31 +09:00
Author: https://github.com/thankyouverycool Commit: https://github.com/SerenityOS/serenity/commit/a74f512f6b Pull-request: https://github.com/SerenityOS/serenity/pull/14886
@ -96,6 +96,11 @@
|
||||
text: "Show knurls on splitters"
|
||||
}
|
||||
|
||||
@GUI::CheckBox {
|
||||
name: "tooltips_checkbox"
|
||||
text: "Show tooltips"
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
fixed_height: 4
|
||||
}
|
||||
|
@ -68,6 +68,12 @@ EffectsSettingsWidget::EffectsSettingsWidget()
|
||||
m_system_effects.effects().at(Effects::SplitterKnurls) = checked;
|
||||
set_modified(true);
|
||||
};
|
||||
auto& tooltips = *find_descendant_of_type_named<GUI::CheckBox>("tooltips_checkbox");
|
||||
tooltips.set_checked(m_system_effects.tooltips());
|
||||
tooltips.on_checked = [this](bool checked) {
|
||||
m_system_effects.effects().at(Effects::Tooltips) = checked;
|
||||
set_modified(true);
|
||||
};
|
||||
auto& menu_shadow = *find_descendant_of_type_named<GUI::CheckBox>("menu_shadow_checkbox");
|
||||
menu_shadow.set_checked(m_system_effects.menu_shadow());
|
||||
menu_shadow.on_checked = [this](bool checked) {
|
||||
@ -98,6 +104,7 @@ ErrorOr<void> EffectsSettingsWidget::load_settings()
|
||||
ws_config->read_bool_entry("Effects", "SmoothScrolling", true),
|
||||
ws_config->read_bool_entry("Effects", "TabAccents", true),
|
||||
ws_config->read_bool_entry("Effects", "SplitterKnurls", true),
|
||||
ws_config->read_bool_entry("Effects", "Tooltips", true),
|
||||
ws_config->read_bool_entry("Effects", "MenuShadow", true),
|
||||
ws_config->read_bool_entry("Effects", "WindowShadow", true),
|
||||
ws_config->read_bool_entry("Effects", "TooltipShadow", true),
|
||||
|
@ -147,6 +147,8 @@ Action* Application::action_for_shortcut(Shortcut const& shortcut) const
|
||||
|
||||
void Application::show_tooltip(String tooltip, Widget const* tooltip_source_widget)
|
||||
{
|
||||
if (!Desktop::the().system_effects().tooltips())
|
||||
return;
|
||||
m_tooltip_source_widget = tooltip_source_widget;
|
||||
if (!m_tooltip_window) {
|
||||
m_tooltip_window = TooltipWindow::construct();
|
||||
@ -166,6 +168,8 @@ void Application::show_tooltip(String tooltip, Widget const* tooltip_source_widg
|
||||
|
||||
void Application::show_tooltip_immediately(String tooltip, Widget const* tooltip_source_widget)
|
||||
{
|
||||
if (!Desktop::the().system_effects().tooltips())
|
||||
return;
|
||||
m_tooltip_source_widget = tooltip_source_widget;
|
||||
if (!m_tooltip_window) {
|
||||
m_tooltip_window = TooltipWindow::construct();
|
||||
|
@ -24,6 +24,7 @@ enum Effects : size_t {
|
||||
SmoothScrolling,
|
||||
TabAccents,
|
||||
SplitterKnurls,
|
||||
Tooltips,
|
||||
MenuShadow,
|
||||
WindowShadow,
|
||||
TooltipShadow,
|
||||
@ -85,6 +86,7 @@ public:
|
||||
|
||||
bool tab_accents() const { return m_effects[TabAccents]; }
|
||||
bool splitter_knurls() const { return m_effects[SplitterKnurls]; }
|
||||
bool tooltips() const { return m_effects[Tooltips]; }
|
||||
|
||||
bool menu_shadow() const { return m_effects[MenuShadow]; }
|
||||
bool window_shadow() const { return m_effects[WindowShadow]; }
|
||||
|
@ -2354,6 +2354,7 @@ void WindowManager::apply_system_effects(Vector<bool> effects, ShowGeometry geom
|
||||
m_config->write_bool_entry("Effects", "SmoothScrolling", m_system_effects.smooth_scrolling());
|
||||
m_config->write_bool_entry("Effects", "TabAccents", m_system_effects.tab_accents());
|
||||
m_config->write_bool_entry("Effects", "SplitterKnurls", m_system_effects.splitter_knurls());
|
||||
m_config->write_bool_entry("Effects", "Tooltips", m_system_effects.tooltips());
|
||||
m_config->write_bool_entry("Effects", "MenuShadow", m_system_effects.menu_shadow());
|
||||
m_config->write_bool_entry("Effects", "WindowShadow", m_system_effects.window_shadow());
|
||||
m_config->write_bool_entry("Effects", "TooltipShadow", m_system_effects.tooltip_shadow());
|
||||
@ -2370,6 +2371,7 @@ void WindowManager::load_system_effects()
|
||||
m_config->read_bool_entry("Effects", "SmoothScrolling", true),
|
||||
m_config->read_bool_entry("Effects", "TabAccents", true),
|
||||
m_config->read_bool_entry("Effects", "SplitterKnurls", true),
|
||||
m_config->read_bool_entry("Effects", "Tooltips", true),
|
||||
m_config->read_bool_entry("Effects", "MenuShadow", true),
|
||||
m_config->read_bool_entry("Effects", "WindowShadow", true),
|
||||
m_config->read_bool_entry("Effects", "TooltipShadow", true)
|
||||
|
Loading…
Reference in New Issue
Block a user