Author: mir3x Date: Thu Sep 1 18:44:07 2016 New Revision: 33741 URL: http://svn.gna.org/viewcvs/freeciv?rev=33741&view=rev Log: Qt client - Remove old font system Patch by Louis Moureaux <louis94>
See patch #7663 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/gui_main.cpp trunk/client/gui-qt/optiondlg.cpp Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=33741&r1=33740&r2=33741&view=diff ============================================================================== --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Thu Sep 1 18:44:07 2016 @@ -119,7 +119,6 @@ central_layout = new QStackedLayout; // General part not related to any single page - fc_fonts.init_fonts(); menu_bar = new mr_menu(); corner_wid = new fc_corner(this); if (gui_options.gui_qt_show_titlebar == false) { @@ -200,7 +199,6 @@ fc_client::~fc_client() { status_bar_queue.clear(); - fc_fonts.release_fonts(); } /**************************************************************************** @@ -722,70 +720,6 @@ } /**************************************************************************** - Returns desired font -****************************************************************************/ -QFont *fc_font::get_font(QString name) -{ - /** - * example: get_font("gui_qt_font_city_label") - */ - - if (font_map.contains(name)) { - return font_map.value(name); - } else { - return NULL; - } -} - -/**************************************************************************** - Initiazlizes fonts from client options -****************************************************************************/ -void fc_font::init_fonts() -{ - QFont *f; - QString s; - - /** - * default font names are: - * gui_qt_font_city_label - * gui_qt_font_notify_label and so on. - * (full list is in options.c in client dir) - */ - - options_iterate(client_optset, poption) { - if (option_type(poption) == OT_FONT) { - f = new QFont; - s = option_font_get(poption); - f->fromString(s); - s = option_name(poption); - set_font(s, f); - } - } options_iterate_end; -} - -/**************************************************************************** - Deletes all fonts -****************************************************************************/ -void fc_font::release_fonts() -{ - foreach (QFont *f, font_map) { - delete f; - } -} - -/**************************************************************************** - Adds new font or overwrite old one -****************************************************************************/ -void fc_font::set_font(QString name, QFont *qf) -{ - font_map.insert(name, qf); - /* Automatically set default font */ - if (name == "gui_qt_font_default") { - QApplication::setFont(*qf); - } -} - -/**************************************************************************** Game tab widget constructor ****************************************************************************/ fc_game_tab_widget::fc_game_tab_widget(): QStackedWidget() Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=33741&r1=33740&r2=33741&view=diff ============================================================================== --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Thu Sep 1 18:44:07 2016 @@ -117,19 +117,6 @@ }; /**************************************************************************** - Class helping to get font set in options -****************************************************************************/ -class fc_font -{ - QMap <QString, QFont *> font_map; -public: - void set_font(QString name, QFont *qf); - QFont* get_font(QString name); - void init_fonts(); - void release_fonts(); -}; - -/**************************************************************************** Some qt-specific options like size to save between restarts ****************************************************************************/ struct fc_settings @@ -247,7 +234,6 @@ void update_sidebar_position(); mr_idle mr_idler; - fc_font fc_fonts; QWidget *central_wdg; mr_menu *menu_bar; fc_corner *corner_wid; Modified: trunk/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/gui_main.cpp?rev=33741&r1=33740&r2=33741&view=diff ============================================================================== --- trunk/client/gui-qt/gui_main.cpp (original) +++ trunk/client/gui-qt/gui_main.cpp Thu Sep 1 18:44:07 2016 @@ -343,23 +343,12 @@ static void apply_font(struct option *poption) { QFont font; - QFont *f; - QFont *remove_old; QString s; s = option_font_get(poption); font.fromString(s); s = option_name(poption); font_options_listener::set_font(s, font); - if (gui()) { - f = new QFont; - s = option_font_get(poption); - f->fromString(s); - s = option_name(poption); - remove_old = gui()->fc_fonts.get_font(s); - delete remove_old; - gui()->fc_fonts.set_font(s, f); - } } /**************************************************************************** Modified: trunk/client/gui-qt/optiondlg.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/optiondlg.cpp?rev=33741&r1=33740&r2=33741&view=diff ============================================================================== --- trunk/client/gui-qt/optiondlg.cpp (original) +++ trunk/client/gui-qt/optiondlg.cpp Thu Sep 1 18:44:07 2016 @@ -334,8 +334,6 @@ ql = s.split(","); qp->setText(ql[0] + " " + ql[1]); qp->setFont(*fp); - - ::gui()->fc_fonts.set_font(QString(option_name(poption)), fp); } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits