Author: mir3x
Date: Sat Dec 31 10:14:38 2016
New Revision: 34752

URL: http://svn.gna.org/viewcvs/freeciv?rev=34752&view=rev
Log:
Qt client - fixed current theme not set as current in options

See bug #25404


Modified:
    trunk/client/gui-qt/themes.cpp

Modified: trunk/client/gui-qt/themes.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/themes.cpp?rev=34752&r1=34751&r2=34752&view=diff
==============================================================================
--- trunk/client/gui-qt/themes.cpp      (original)
+++ trunk/client/gui-qt/themes.cpp      Sat Dec 31 10:14:38 2016
@@ -68,7 +68,7 @@
   f.setFileName(name);
 
   if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
-    if (QString(theme_name) != QString("NightStalker")) {
+    if (QString(theme_name) != QString(FC_QT_DEFAULT_THEME_NAME)) {
       qtg_gui_clear_theme();
     }
     return;
@@ -105,7 +105,7 @@
 
   str = QString("themes") + DIR_SEPARATOR + "gui-qt" + DIR_SEPARATOR;
   name = fileinfoname(get_data_dirs(), str.toLocal8Bit().data());
-  qtg_gui_load_theme(name.toLocal8Bit().data(), "NightStalker");
+  qtg_gui_load_theme(name.toLocal8Bit().data(), FC_QT_DEFAULT_THEME_NAME);
 }
 
 /*****************************************************************************
@@ -139,6 +139,7 @@
   QByteArray qba;;
   QString str;
   QString name;
+  QString qtheme_name;
   QDir dir;
   QFile f;
 
@@ -156,7 +157,13 @@
     }
     theme_list << str;
   }
-  
+
+  qtheme_name = gui_options.gui_qt_default_theme_name;
+  /* move current theme on first position */
+  if (theme_list.contains(qtheme_name)) {
+    theme_list.removeAll(qtheme_name);
+    theme_list.prepend(qtheme_name);
+  }
   array = new char *[theme_list.count()];
   *count = theme_list.count();
 
@@ -166,6 +173,6 @@
     strcpy(data, theme_list[i].toLocal8Bit().data());
     array[i] = data;
   }
-  
+
   return array;
 }


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

Reply via email to