Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions editor/project_manager/quick_settings_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ void QuickSettingsDialog::_fetch_setting_values() {
#ifndef ANDROID_ENABLED
editor_languages.clear();
#endif
editor_styles.clear();
editor_themes.clear();
editor_scales.clear();
editor_network_modes.clear();
Expand All @@ -59,6 +60,8 @@ void QuickSettingsDialog::_fetch_setting_values() {
#ifndef ANDROID_ENABLED
editor_languages = pi.hint_string.split(";", false);
#endif
} else if (pi.name == "interface/theme/style") {
editor_styles = pi.hint_string.split(",");
} else if (pi.name == "interface/theme/color_preset") {
editor_themes = pi.hint_string.split(",");
} else if (pi.name == "interface/editor/display_scale") {
Expand Down Expand Up @@ -90,6 +93,19 @@ void QuickSettingsDialog::_update_current_values() {
}
}
#endif
// Style options.
{
const String current_style = EDITOR_GET("interface/theme/style");

for (int i = 0; i < editor_styles.size(); i++) {
const String &style_value = editor_styles[i];
if (current_style == style_value) {
style_option_button->set_text(current_style);
style_option_button->select(i);
style_option_button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
}
}
}

// Theme options.
{
Expand Down Expand Up @@ -183,6 +199,11 @@ void QuickSettingsDialog::_language_selected(int p_id) {
}
#endif

void QuickSettingsDialog::_style_selected(int p_id) {
const String selected_style = style_option_button->get_item_text(p_id);
_set_setting_value("interface/theme/style", selected_style);
}

void QuickSettingsDialog::_theme_selected(int p_id) {
const String selected_theme = theme_option_button->get_item_text(p_id);
_set_setting_value("interface/theme/color_preset", selected_theme);
Expand Down Expand Up @@ -295,6 +316,19 @@ QuickSettingsDialog::QuickSettingsDialog() {
_add_setting_control(TTRC("Language"), language_option_button);
}
#endif
// Style options.
{
style_option_button = memnew(OptionButton);
style_option_button->set_fit_to_longest_item(false);
style_option_button->connect(SceneStringName(item_selected), callable_mp(this, &QuickSettingsDialog::_style_selected));

for (int i = 0; i < editor_styles.size(); i++) {
const String &style_value = editor_styles[i];
style_option_button->add_item(style_value, i);
}

_add_setting_control(TTRC("Style"), style_option_button);
}

// Theme options.
{
Expand Down
3 changes: 3 additions & 0 deletions editor/project_manager/quick_settings_dialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class QuickSettingsDialog : public AcceptDialog {
#ifndef ANDROID_ENABLED
Vector<String> editor_languages;
#endif
Vector<String> editor_styles;
Vector<String> editor_themes;
Vector<String> editor_scales;
Vector<String> editor_network_modes;
Expand All @@ -64,6 +65,7 @@ class QuickSettingsDialog : public AcceptDialog {
// Also, the dropdown it spawns is very tall and can't be scrolled without a hardware mouse.
OptionButton *language_option_button = nullptr;
#endif
OptionButton *style_option_button = nullptr;
OptionButton *theme_option_button = nullptr;
OptionButton *scale_option_button = nullptr;
OptionButton *network_mode_option_button = nullptr;
Expand All @@ -75,6 +77,7 @@ class QuickSettingsDialog : public AcceptDialog {
#ifndef ANDROID_ENABLED
void _language_selected(int p_id);
#endif
void _style_selected(int p_id);
void _theme_selected(int p_id);
void _scale_selected(int p_id);
void _network_mode_selected(int p_id);
Expand Down