Skip to content

Commit e9365a7

Browse files
committed
Add a style option button to quick setttings
1 parent 0fdbf05 commit e9365a7

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

editor/project_manager/quick_settings_dialog.cpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ void QuickSettingsDialog::_fetch_setting_values() {
5959
#ifndef ANDROID_ENABLED
6060
editor_languages = pi.hint_string.split(";", false);
6161
#endif
62+
} else if (pi.name == "interface/theme/style") {
63+
editor_styles = pi.hint_string.split(",");
6264
} else if (pi.name == "interface/theme/color_preset") {
6365
editor_themes = pi.hint_string.split(",");
6466
} else if (pi.name == "interface/editor/display_scale") {
@@ -90,6 +92,19 @@ void QuickSettingsDialog::_update_current_values() {
9092
}
9193
}
9294
#endif
95+
// Style options.
96+
{
97+
const String current_style = EDITOR_GET("interface/theme/style");
98+
99+
for (int i = 0; i < editor_styles.size(); i++) {
100+
const String &style_value = editor_styles[i];
101+
if (current_style == style_value) {
102+
style_option_button->set_text(current_style);
103+
style_option_button->select(i);
104+
style_option_button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
105+
}
106+
}
107+
}
93108

94109
// Theme options.
95110
{
@@ -183,6 +198,11 @@ void QuickSettingsDialog::_language_selected(int p_id) {
183198
}
184199
#endif
185200

201+
void QuickSettingsDialog::_style_selected(int p_id) {
202+
const String selected_style = style_option_button->get_item_text(p_id);
203+
_set_setting_value("interface/theme/style", selected_style);
204+
}
205+
186206
void QuickSettingsDialog::_theme_selected(int p_id) {
187207
const String selected_theme = theme_option_button->get_item_text(p_id);
188208
_set_setting_value("interface/theme/color_preset", selected_theme);
@@ -295,6 +315,19 @@ QuickSettingsDialog::QuickSettingsDialog() {
295315
_add_setting_control(TTRC("Language"), language_option_button);
296316
}
297317
#endif
318+
// Style options.
319+
{
320+
style_option_button = memnew(OptionButton);
321+
style_option_button->set_fit_to_longest_item(false);
322+
style_option_button->connect(SceneStringName(item_selected), callable_mp(this, &QuickSettingsDialog::_style_selected));
323+
324+
for (int i = 0; i < editor_styles.size(); i++) {
325+
const String &style_value = editor_styles[i];
326+
style_option_button->add_item(style_value, i);
327+
}
328+
329+
_add_setting_control(TTRC("Style"), style_option_button);
330+
}
298331

299332
// Theme options.
300333
{

editor/project_manager/quick_settings_dialog.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class QuickSettingsDialog : public AcceptDialog {
4545
#ifndef ANDROID_ENABLED
4646
Vector<String> editor_languages;
4747
#endif
48+
Vector<String> editor_styles;
4849
Vector<String> editor_themes;
4950
Vector<String> editor_scales;
5051
Vector<String> editor_network_modes;
@@ -64,6 +65,7 @@ class QuickSettingsDialog : public AcceptDialog {
6465
// Also, the dropdown it spawns is very tall and can't be scrolled without a hardware mouse.
6566
OptionButton *language_option_button = nullptr;
6667
#endif
68+
OptionButton *style_option_button = nullptr;
6769
OptionButton *theme_option_button = nullptr;
6870
OptionButton *scale_option_button = nullptr;
6971
OptionButton *network_mode_option_button = nullptr;
@@ -75,6 +77,7 @@ class QuickSettingsDialog : public AcceptDialog {
7577
#ifndef ANDROID_ENABLED
7678
void _language_selected(int p_id);
7779
#endif
80+
void _style_selected(int p_id);
7881
void _theme_selected(int p_id);
7982
void _scale_selected(int p_id);
8083
void _network_mode_selected(int p_id);

0 commit comments

Comments
 (0)