Author: mir3x
Date: Sun Oct 23 19:52:57 2016
New Revision: 34220

URL: http://svn.gna.org/viewcvs/freeciv?rev=34220&view=rev
Log:
Qt client - sidebar icons not updated on theme change

See bug #25206

Modified:
    branches/S2_6/client/gui-qt/fc_client.h
    branches/S2_6/client/gui-qt/pages.cpp
    branches/S2_6/client/gui-qt/sidebar.cpp
    branches/S2_6/client/gui-qt/sidebar.h
    branches/S2_6/client/gui-qt/themes.cpp

Modified: branches/S2_6/client/gui-qt/fc_client.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/fc_client.h?rev=34220&r1=34219&r2=34220&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/fc_client.h     (original)
+++ branches/S2_6/client/gui-qt/fc_client.h     Sun Oct 23 19:52:57 2016
@@ -269,6 +269,7 @@
   void write_settings();
   bool is_closing();
   void update_sidebar_tooltips();
+  void reload_sidebar_icons();
 
 private slots:
   void send_fake_chat_message(const QString &message);

Modified: branches/S2_6/client/gui-qt/pages.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/pages.cpp?rev=34220&r1=34219&r2=34220&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/pages.cpp       (original)
+++ branches/S2_6/client/gui-qt/pages.cpp       Sun Oct 23 19:52:57 2016
@@ -2005,7 +2005,21 @@
   popup_races_dialog(client_player());
 }
 
-
+/***************************************************************************
+  Reloads sidebar icons (useful on theme change)
+***************************************************************************/
+void fc_client::reload_sidebar_icons()
+{
+  sw_map->set_pixmap(fc_icons::instance()->get_pixmap("view"));
+  sw_cunit->set_pixmap(fc_icons::instance()->get_pixmap("units"));
+  sw_cities->set_pixmap(fc_icons::instance()->get_pixmap("cities"));
+  sw_diplo->set_pixmap(fc_icons::instance()->get_pixmap("nations"));
+  sw_science->set_pixmap(fc_icons::instance()->get_pixmap("research"));
+  sw_economy->set_pixmap(fc_icons::instance()->get_pixmap("economy"));
+  sw_endturn->set_pixmap(fc_icons::instance()->get_pixmap("endturn"));
+  sidebar_wdg->resize_me(game_tab_widget->width(),
+                         game_tab_widget->height(), true);
+}
 /***************************************************************************
   Updates sidebar tooltips
 ***************************************************************************/

Modified: branches/S2_6/client/gui-qt/sidebar.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/sidebar.cpp?rev=34220&r1=34219&r2=34220&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/sidebar.cpp     (original)
+++ branches/S2_6/client/gui-qt/sidebar.cpp     Sun Oct 23 19:52:57 2016
@@ -482,14 +482,14 @@
   Resize sidebar to take 100 pixels or 10% of given width, and all
   widgets inside sidebar
 **************************************************************************/
-void fc_sidebar::resize_me(int wdth, int hght)
+void fc_sidebar::resize_me(int wdth, int hght, bool force)
 {
   int w, h, non_std, non_std_count;
   w = wdth / 10;
   h = hght;
   w = qMin(100, w);
 
-  if (w == width() && h == height()) {
+  if (force == false && w == width() && h == height()) {
     return;
   }
 

Modified: branches/S2_6/client/gui-qt/sidebar.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/sidebar.h?rev=34220&r1=34219&r2=34220&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/sidebar.h       (original)
+++ branches/S2_6/client/gui-qt/sidebar.h       Sun Oct 23 19:52:57 2016
@@ -107,7 +107,7 @@
   ~fc_sidebar();
   void add_widget(fc_sidewidget *fsw);
   void paint(QPainter *painter, QPaintEvent *event);
-  void resize_me(int width, int height);
+  void resize_me(int width, int height, bool force = false);
   QList<fc_sidewidget*> objects;
 protected:
   void paintEvent(QPaintEvent *event);

Modified: branches/S2_6/client/gui-qt/themes.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/themes.cpp?rev=34220&r1=34219&r2=34220&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/themes.cpp      (original)
+++ branches/S2_6/client/gui-qt/themes.cpp      Sun Oct 23 19:52:57 2016
@@ -84,8 +84,11 @@
     QApplication::setStyle(QStyleFactory::create("Fusion"));
   }
 
+  current_theme = theme_name;
   current_app()->setStyleSheet(stylestring);
-  current_theme = theme_name;
+  if (gui()) {
+    gui()->reload_sidebar_icons();
+  }
   pal.setBrush(QPalette::Link, QColor(92,170,229));
   pal.setBrush(QPalette::LinkVisited, QColor(54,150,229));
   QApplication::setPalette(pal);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to