Author: mir3x Date: Fri Sep 16 14:09:13 2016 New Revision: 33820 URL: http://svn.gna.org/viewcvs/freeciv?rev=33820&view=rev Log: Qt client - Update the font database for all fonts
Patch by Louis Moureaux <louis94> See patch #7670 Modified: branches/S2_6/client/gui-qt/fonts.cpp branches/S2_6/client/gui-qt/fonts.h branches/S2_6/client/gui-qt/gui_main.cpp branches/S2_6/client/gui-qt/qtg_cxxside.cpp branches/S2_6/client/options.c Modified: branches/S2_6/client/gui-qt/fonts.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/fonts.cpp?rev=33820&r1=33819&r2=33820&view=diff ============================================================================== --- branches/S2_6/client/gui-qt/fonts.cpp (original) +++ branches/S2_6/client/gui-qt/fonts.cpp Fri Sep 16 14:09:13 2016 @@ -46,7 +46,7 @@ if (option_type(poption) == OT_FONT) { s = option_font_get(poption); font.fromString(s); - s = option_name(poption); + s = option_font_target(poption); font_map[s] = font; } } options_iterate_end; @@ -90,9 +90,11 @@ /*************************************************************************** Sets the font with the given name. The configuration is *not* updated. ***************************************************************************/ -void font_options_listener::set_font(const QString &name, - const QFont &font) +void font_options_listener::set_font(const char *name, + const char *font_info) { + QFont font; + font.fromString(font_info); font_map[name] = font; invoke(&font_options_listener::update_font, name, font); } Modified: branches/S2_6/client/gui-qt/fonts.h URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/fonts.h?rev=33820&r1=33819&r2=33820&view=diff ============================================================================== --- branches/S2_6/client/gui-qt/fonts.h (original) +++ branches/S2_6/client/gui-qt/fonts.h Fri Sep 16 14:09:13 2016 @@ -33,21 +33,21 @@ ***************************************************************************/ namespace fonts { - const char * const city_label = "gui_qt_font_city_label"; - const char * const default_font = "gui_qt_font_default"; - const char * const notify_label = "gui_qt_font_notify_label"; - const char * const spaceship_label = "gui_qt_font_spaceship_label"; - const char * const help_label = "gui_qt_font_help_label"; - const char * const help_link = "gui_qt_font_help_link"; - const char * const help_text = "gui_qt_font_help_text"; - const char * const help_title = "gui_qt_font_help_title"; - const char * const chatline = "gui_qt_font_chatline"; - const char * const beta_label = "gui_qt_font_beta_label"; - const char * const small = "gui_qt_font_small"; - const char * const comment_label = "gui_qt_font_comment_label"; - const char * const city_names = "gui_qt_font_city_names"; - const char * const city_productions = "gui_qt_font_city_productions"; - const char * const reqtree_text = "gui_qt_font_reqtree_text"; + const char * const city_label = "city_label"; + const char * const default_font = "default"; + const char * const notify_label = "notify_label"; + const char * const spaceship_label = "spaceship_label"; + const char * const help_label = "help_label"; + const char * const help_link = "help_link"; + const char * const help_text = "help_text"; + const char * const help_title = "help_title"; + const char * const chatline = "chatline"; + const char * const beta_label = "beta_label"; + const char * const small = "small"; + const char * const comment_label = "comment_label"; + const char * const city_names = "city_names"; + const char * const city_productions = "city_productions"; + const char * const reqtree_text = "reqtree_text"; } /*************************************************************************** @@ -60,7 +60,7 @@ static void init_font_map(); public: - static void set_font(const QString &name, const QFont &value); + static void set_font(const char *name, const char *font_info); static QFont get_font(client_font font); explicit font_options_listener(); Modified: branches/S2_6/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/gui_main.cpp?rev=33820&r1=33819&r2=33820&view=diff ============================================================================== --- branches/S2_6/client/gui-qt/gui_main.cpp (original) +++ branches/S2_6/client/gui-qt/gui_main.cpp Fri Sep 16 14:09:13 2016 @@ -71,7 +71,6 @@ void reset_unit_table(void); static void populate_unit_pixmap_table(void); -static void apply_font(struct option *poption); static void apply_titlebar(struct option *poption); static void apply_sidebar(struct option *poption); @@ -207,26 +206,6 @@ } else { \ log_error("Didn't find option %s!", #var); \ } - option_var_set_callback(gui_qt_font_city_names, - apply_font); - option_var_set_callback(gui_qt_font_default, - apply_font); - option_var_set_callback(gui_qt_font_notify_label, - apply_font); - option_var_set_callback(gui_qt_font_city_productions, - apply_font); - option_var_set_callback(gui_qt_font_reqtree_text, - apply_font); - option_var_set_callback(gui_qt_font_city_label, - apply_font); - option_var_set_callback(gui_qt_font_help_label, - apply_font); - option_var_set_callback(gui_qt_font_help_text, - apply_font); - option_var_set_callback(gui_qt_font_help_title, - apply_font); - option_var_set_callback(gui_qt_font_chatline, - apply_font); option_var_set_callback(gui_qt_show_titlebar, apply_titlebar); option_var_set_callback(gui_qt_sidebar_left, @@ -335,20 +314,6 @@ cb->callback = callback; cb->data = data; gui()->mr_idler.add_callback(cb); -} - -/**************************************************************************** - Change the given font. -****************************************************************************/ -static void apply_font(struct option *poption) -{ - QFont font; - QString s; - - s = option_font_get(poption); - font.fromString(s); - s = option_name(poption); - font_options_listener::set_font(s, font); } /**************************************************************************** Modified: branches/S2_6/client/gui-qt/qtg_cxxside.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/qtg_cxxside.cpp?rev=33820&r1=33819&r2=33820&view=diff ============================================================================== --- branches/S2_6/client/gui-qt/qtg_cxxside.cpp (original) +++ branches/S2_6/client/gui-qt/qtg_cxxside.cpp Fri Sep 16 14:09:13 2016 @@ -17,6 +17,9 @@ // client #include "gui_interface.h" + +// gui-qt +#include "fonts.h" #include "qtg_cxxside.h" @@ -80,7 +83,7 @@ funcs->set_unit_icon = qtg_set_unit_icon; funcs->set_unit_icons_more_arrow = qtg_set_unit_icons_more_arrow; funcs->real_focus_units_changed = qtg_real_focus_units_changed; - funcs->gui_update_font = qtg_gui_update_font; + funcs->gui_update_font = font_options_listener::set_font; funcs->set_city_names_font_sizes = qtg_set_city_names_font_sizes; funcs->editgui_refresh = qtg_editgui_refresh; Modified: branches/S2_6/client/options.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/options.c?rev=33820&r1=33819&r2=33820&view=diff ============================================================================== --- branches/S2_6/client/options.c (original) +++ branches/S2_6/client/options.c Fri Sep 16 14:09:13 2016 @@ -2872,7 +2872,7 @@ "in the city dialog, the Economy report or the Units " "report."), COC_FONT, GUI_QT, - "Sans Serif,9,-1,5,50,0,0,0,0,0", NULL), + "Sans Serif,9,-1,5,50,0,0,0,0,0", font_changed_callback), GEN_FONT_OPTION(gui_qt_font_comment_label, "comment_label", N_("Comment Label"), N_("This font is used to display comment labels, such as " @@ -2884,19 +2884,19 @@ N_("This font is used to the display the city names " "on the map."), COC_FONT, GUI_QT, - "Sans Serif,10,-1,5,75,0,0,0,0,0", NULL), + "Sans Serif,10,-1,5,75,0,0,0,0,0", font_changed_callback), GEN_FONT_OPTION(gui_qt_font_city_productions, "city_productions", N_("City Productions"), N_("This font is used to the display the city production " "names on the map."), COC_FONT, GUI_QT, - "Sans Serif,10,-1,5,50,1,0,0,0,0", NULL), + "Sans Serif,10,-1,5,50,1,0,0,0,0", font_changed_callback), GEN_FONT_OPTION(gui_qt_font_reqtree_text, "reqtree_text", N_("Requirement Tree"), N_("This font is used to the display the requirement tree " "in the Research report."), COC_FONT, GUI_QT, - "Sans Serif,10,-1,5,50,1,0,0,0,0", NULL), + "Sans Serif,10,-1,5,50,1,0,0,0,0", font_changed_callback), GEN_BOOL_OPTION(gui_qt_show_preview, N_("Show savegame information"), N_("If this option is set the client will show " "information and map preview about current savegame "), _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits