summaryrefslogtreecommitdiff
path: root/Userland/Applications/DisplaySettings
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-07-31 18:41:07 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-01 10:29:53 +0200
commit548081ea23f131ae129ff5e1f2ca70ea4eda2da9 (patch)
tree5fca2c60c4da5d4beee5a02ddbdc26276b904c54 /Userland/Applications/DisplaySettings
parent419e986dccb95d185b2468f016e69c8f39c03b9d (diff)
downloadserenity-548081ea23f131ae129ff5e1f2ca70ea4eda2da9.zip
Userland+Base: Make the window titlebar font configurable separately
Instead of defaulting to "bold variant of the system default font", let's allow the user to set any font they want as the titlebar font.
Diffstat (limited to 'Userland/Applications/DisplaySettings')
-rw-r--r--Userland/Applications/DisplaySettings/FontSettings.gml28
-rw-r--r--Userland/Applications/DisplaySettings/FontSettingsWidget.cpp18
-rw-r--r--Userland/Applications/DisplaySettings/FontSettingsWidget.h1
3 files changed, 46 insertions, 1 deletions
diff --git a/Userland/Applications/DisplaySettings/FontSettings.gml b/Userland/Applications/DisplaySettings/FontSettings.gml
index 9470bb6a9e..dfcf434397 100644
--- a/Userland/Applications/DisplaySettings/FontSettings.gml
+++ b/Userland/Applications/DisplaySettings/FontSettings.gml
@@ -41,6 +41,34 @@
@GUI::Label {
fixed_width: 100
+ text: "Window title font:"
+ text_alignment: "CenterLeft"
+ }
+
+ @GUI::Label {
+ background_role: "Base"
+ shadow: "Sunken"
+ shape: "Container"
+ thickness: 2
+ fill_with_background_color: true
+ name: "window_title_font_label"
+ }
+
+ @GUI::Button {
+ text: "..."
+ name: "window_title_font_button"
+ fixed_width: 30
+ }
+ }
+
+ @GUI::Widget {
+ preferred_height: "fit"
+ layout: @GUI::HorizontalBoxLayout {
+ spacing: 6
+ }
+
+ @GUI::Label {
+ fixed_width: 100
text: "Fixed-width font:"
text_alignment: "CenterLeft"
}
diff --git a/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp b/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp
index 7a683a4dce..5a55f48c65 100644
--- a/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp
+++ b/Userland/Applications/DisplaySettings/FontSettingsWidget.cpp
@@ -34,6 +34,19 @@ FontSettingsWidget::FontSettingsWidget()
}
};
+ auto& window_title_font = Gfx::FontDatabase::window_title_font();
+ m_window_title_font_label = *find_descendant_of_type_named<GUI::Label>("window_title_font_label");
+ update_label_with_font(*m_window_title_font_label, window_title_font);
+
+ auto& window_title_font_button = *find_descendant_of_type_named<GUI::Button>("window_title_font_button");
+ window_title_font_button.on_click = [this](auto) {
+ auto font_picker = GUI::FontPicker::construct(window(), &m_window_title_font_label->font(), false);
+ if (font_picker->exec() == GUI::Dialog::ExecResult::OK) {
+ update_label_with_font(*m_window_title_font_label, *font_picker->font());
+ set_modified(true);
+ }
+ };
+
auto& default_fixed_width_font = Gfx::FontDatabase::default_fixed_width_font();
m_fixed_width_font_label = *find_descendant_of_type_named<GUI::Label>("fixed_width_font_label");
update_label_with_font(*m_fixed_width_font_label, default_fixed_width_font);
@@ -56,7 +69,10 @@ static void update_label_with_font(GUI::Label& label, Gfx::Font const& font)
void FontSettingsWidget::apply_settings()
{
- GUI::ConnectionToWindowServer::the().set_system_fonts(m_default_font_label->font().qualified_name(), m_fixed_width_font_label->font().qualified_name());
+ GUI::ConnectionToWindowServer::the().set_system_fonts(
+ m_default_font_label->font().qualified_name(),
+ m_fixed_width_font_label->font().qualified_name(),
+ m_window_title_font_label->font().qualified_name());
}
}
diff --git a/Userland/Applications/DisplaySettings/FontSettingsWidget.h b/Userland/Applications/DisplaySettings/FontSettingsWidget.h
index 490b6e00b9..7c3fe08ed9 100644
--- a/Userland/Applications/DisplaySettings/FontSettingsWidget.h
+++ b/Userland/Applications/DisplaySettings/FontSettingsWidget.h
@@ -24,6 +24,7 @@ private:
FontSettingsWidget();
RefPtr<GUI::Label> m_default_font_label;
+ RefPtr<GUI::Label> m_window_title_font_label;
RefPtr<GUI::Label> m_fixed_width_font_label;
};