From 9803cda4a5c5ea6e10a6ac65c2a62d3a114e1379 Mon Sep 17 00:00:00 2001 From: Marko Lindqvist Date: Tue, 21 Jun 2022 16:29:13 +0300 Subject: [PATCH 55/55] Qt: Configure the fonts when needed - Do not discard and overwrite good font settings - Make sure that fonts are always configured when needed See osdn #44864 Signed-off-by: Marko Lindqvist --- client/gui-qt/fc_client.cpp | 4 ---- client/gui-qt/gui_main.cpp | 5 +++++ client/gui-qt/qtg_cxxside.h | 1 - client/options.c | 13 +++++++++++++ client/options.h | 1 + 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/client/gui-qt/fc_client.cpp b/client/gui-qt/fc_client.cpp index 90f796fcde..247cb1cff3 100644 --- a/client/gui-qt/fc_client.cpp +++ b/client/gui-qt/fc_client.cpp @@ -618,9 +618,6 @@ void fc_client::read_settings() QSettings s(QSettings::IniFormat, QSettings::UserScope, sname); - if (!s.contains("Fonts-set")) { - configure_fonts(); - } if (s.contains("Chat-fx-size")) { qt_settings.chat_fwidth = s.value("Chat-fx-size").toFloat(); } else { @@ -758,7 +755,6 @@ void fc_client::write_settings() QSettings s(QSettings::IniFormat, QSettings::UserScope, sname); - s.setValue("Fonts-set", true); s.setValue("Chat-fx-size", qt_settings.chat_fwidth); s.setValue("Chat-fy-size", qt_settings.chat_fheight); s.setValue("Chat-fx-pos", qt_settings.chat_fx_pos); diff --git a/client/gui-qt/gui_main.cpp b/client/gui-qt/gui_main.cpp index df7288781a..f640699ab4 100644 --- a/client/gui-qt/gui_main.cpp +++ b/client/gui-qt/gui_main.cpp @@ -187,6 +187,11 @@ void qtg_ui_main(int argc, char *argv[]) } freeciv_qt = new fc_client(); + if (!gui_options.gui_qt_default_fonts_set) { + configure_fonts(); + gui_options.gui_qt_default_fonts_set = TRUE; + } + // Initial fonts setup by forcing running change-callback for each options_iterate(client_optset, poption) { if (OT_FONT == option_type(poption)) { diff --git a/client/gui-qt/qtg_cxxside.h b/client/gui-qt/qtg_cxxside.h index 5a0cc2b953..8a29823397 100644 --- a/client/gui-qt/qtg_cxxside.h +++ b/client/gui-qt/qtg_cxxside.h @@ -33,7 +33,6 @@ void qtg_ui_exit(); enum gui_type qtg_get_gui_type(); void qtg_insert_client_build_info(char *outbuf, size_t outlen); -void qtg_adjust_default_options(); void qtg_version_message(const char *vertext); void qtg_real_output_window_append(const char *astring, diff --git a/client/options.c b/client/options.c index accf08027c..8c73d40d86 100644 --- a/client/options.c +++ b/client/options.c @@ -103,6 +103,10 @@ struct client_options gui_options = { .migrate_fullscreen = FALSE, +/** Flags **/ + + .gui_qt_default_fonts_set = FALSE, + /** Local Options: **/ .solid_color_behind_units = FALSE, @@ -5841,6 +5845,11 @@ void options_load(void) secfile_lookup_bool_default(sf, gui_options.gui_qt_migrated_from_2_5, "%s.migration_qt_from_2_5", prefix); + /* Flag values */ + gui_options.gui_qt_default_fonts_set = + secfile_lookup_bool_default(sf, gui_options.gui_qt_default_fonts_set, + "%s.flag_qt_default_fonts_set", prefix); + /* These are not gui-enabled yet */ gui_options.zoom_set = secfile_lookup_bool_default(sf, FALSE, "%s.zoom_set", prefix); @@ -5960,6 +5969,10 @@ void options_save(option_save_log_callback log_cb) secfile_insert_bool(sf, gui_options.gui_qt_migrated_from_2_5, "client.migration_qt_from_2_5"); + /* Flag */ + secfile_insert_bool(sf, gui_options.gui_qt_default_fonts_set, + "client.flag_qt_default_fonts_set"); + /* gui-enabled options */ client_options_iterate_all(poption) { if ((client_poption->specific != GUI_SDL || !gui_options.gui_sdl2_migrated_from_sdl) diff --git a/client/options.h b/client/options.h index 001833d07d..405eca4483 100644 --- a/client/options.h +++ b/client/options.h @@ -131,6 +131,7 @@ struct client_options bool gui_gtk2_migrated_from_2_5; bool gui_gtk3_migrated_from_2_5; bool gui_qt_migrated_from_2_5; + bool gui_qt_default_fonts_set; bool migrate_fullscreen; -- 2.35.1