mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
DisplaySettings: Link to cursor themes from "Themes" tab
This removes a few clicks to access the mouse settings and puts all theming actions in one place.
This commit is contained in:
parent
7c8541b914
commit
0c74f30819
4 changed files with 57 additions and 23 deletions
|
@ -4,29 +4,55 @@
|
|||
margins: [8]
|
||||
}
|
||||
|
||||
@GUI::Frame {
|
||||
layout: @GUI::HorizontalBoxLayout {}
|
||||
name: "preview_frame"
|
||||
fixed_width: 306
|
||||
fixed_height: 201
|
||||
}
|
||||
@GUI::GroupBox {
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [14, 14, 4]
|
||||
}
|
||||
title: "Window Theme"
|
||||
fixed_height: 294
|
||||
|
||||
@GUI::Widget {
|
||||
fixed_height: 20
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
shrink_to_fit: true
|
||||
layout: @GUI::HorizontalBoxLayout {}
|
||||
|
||||
@GUI::Label {
|
||||
text: "Theme:"
|
||||
text_alignment: "CenterLeft"
|
||||
fixed_width: 95
|
||||
@GUI::Frame {
|
||||
layout: @GUI::HorizontalBoxLayout {}
|
||||
name: "preview_frame"
|
||||
fixed_width: 306
|
||||
fixed_height: 201
|
||||
}
|
||||
|
||||
@GUI::ComboBox {
|
||||
name: "themes_combo"
|
||||
@GUI::Widget {
|
||||
fixed_height: 20
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
shrink_to_fit: true
|
||||
layout: @GUI::HorizontalBoxLayout {}
|
||||
|
||||
@GUI::Label {
|
||||
text: "Theme:"
|
||||
text_alignment: "CenterLeft"
|
||||
fixed_width: 95
|
||||
}
|
||||
|
||||
@GUI::ComboBox {
|
||||
name: "themes_combo"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@GUI::GroupBox {
|
||||
layout: @GUI::VerticalBoxLayout {
|
||||
margins: [14, 14, 4]
|
||||
}
|
||||
title: "Cursor Theme"
|
||||
shrink_to_fit: true
|
||||
|
||||
@GUI::Button {
|
||||
name: "cursor_themes_button"
|
||||
text: "Change in Mouse Settings..."
|
||||
fixed_width: 200
|
||||
}
|
||||
|
||||
@GUI::Widget {
|
||||
fixed_height: 10
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <LibCore/DirIterator.h>
|
||||
#include <LibGUI/ConnectionToWindowServer.h>
|
||||
#include <LibGUI/ItemListModel.h>
|
||||
#include <LibGUI/Process.h>
|
||||
|
||||
namespace DisplaySettings {
|
||||
|
||||
|
@ -36,7 +37,6 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
|
|||
}
|
||||
}
|
||||
VERIFY(m_selected_theme);
|
||||
|
||||
m_theme_preview = find_descendant_of_type_named<GUI::Frame>("preview_frame")->add<ThemePreviewWidget>(palette());
|
||||
m_themes_combo = *find_descendant_of_type_named<GUI::ComboBox>("themes_combo");
|
||||
m_themes_combo->set_only_allow_values_from_model(true);
|
||||
|
@ -47,6 +47,13 @@ ThemesSettingsWidget::ThemesSettingsWidget(bool& background_settings_changed)
|
|||
set_modified(true);
|
||||
};
|
||||
m_themes_combo->set_selected_index(current_theme_index, GUI::AllowCallback::No);
|
||||
|
||||
auto mouse_settings_icon = Gfx::Bitmap::try_load_from_file("res/icons/16x16/app-mouse.png").release_value_but_fixme_should_propagate_errors();
|
||||
m_cursor_themes_button = *find_descendant_of_type_named<GUI::Button>("cursor_themes_button");
|
||||
m_cursor_themes_button->set_icon(mouse_settings_icon);
|
||||
m_cursor_themes_button->on_click = [&](auto) {
|
||||
GUI::Process::spawn_or_show_error(window(), "/bin/MouseSettings", Array { "-t", "cursor-theme" });
|
||||
};
|
||||
}
|
||||
|
||||
void ThemesSettingsWidget::apply_settings()
|
||||
|
|
|
@ -28,9 +28,10 @@ private:
|
|||
|
||||
RefPtr<GUI::ComboBox> m_themes_combo;
|
||||
RefPtr<ThemePreviewWidget> m_theme_preview;
|
||||
|
||||
Gfx::SystemThemeMetaData const* m_selected_theme { nullptr };
|
||||
|
||||
RefPtr<GUI::Button> m_cursor_themes_button;
|
||||
|
||||
bool& m_background_settings_changed;
|
||||
|
||||
ThemesSettingsWidget(bool& background_settings_changed);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
|
||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
{
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath unix"));
|
||||
TRY(Core::System::pledge("stdio thread recvfd sendfd rpath cpath wpath unix proc exec"));
|
||||
|
||||
auto app = TRY(GUI::Application::try_create(arguments));
|
||||
Config::pledge_domain("WindowManager");
|
||||
|
|
Loading…
Add table
Reference in a new issue