Author: mir3x
Date: Mon Dec 28 10:00:19 2015
New Revision: 31230

URL: http://svn.gna.org/viewcvs/freeciv?rev=31230&view=rev
Log:
After closing player or city report, current sorted column 
will be remembered and after reopening report - previous sorting will be 
applied.

See patch #6726


Modified:
    branches/S2_5/client/gui-qt/cityrep.cpp
    branches/S2_5/client/gui-qt/fc_client.cpp
    branches/S2_5/client/gui-qt/fc_client.h
    branches/S2_5/client/gui-qt/plrdlg.cpp

Modified: branches/S2_5/client/gui-qt/cityrep.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.cpp?rev=31230&r1=31229&r2=31230&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/cityrep.cpp     (original)
+++ branches/S2_5/client/gui-qt/cityrep.cpp     Mon Dec 28 10:00:19 2015
@@ -1178,6 +1178,8 @@
   delete c_i_d;
   delete list_model;
   delete filter_model;
+  gui()->qt_settings.city_repo_sort_col = header()->sortIndicatorSection();
+  gui()->qt_settings.city_report_sort = header()->sortIndicatorOrder();
 }
 
 /***************************************************************************
@@ -1187,7 +1189,10 @@
 {
   layout = new QVBoxLayout;
   city_wdg = new city_widget(this);
-
+  if (gui()->qt_settings.city_repo_sort_col != -1) {
+    city_wdg->sortByColumn(gui()->qt_settings.city_repo_sort_col,
+                           gui()->qt_settings.city_report_sort);
+  }
   layout->addWidget(city_wdg);
   setLayout(layout);
 }

Modified: branches/S2_5/client/gui-qt/fc_client.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.cpp?rev=31230&r1=31229&r2=31230&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/fc_client.cpp   (original)
+++ branches/S2_5/client/gui-qt/fc_client.cpp   Mon Dec 28 10:00:19 2015
@@ -582,6 +582,9 @@
   } else {
     qt_settings.infotab_height = 29;
   }
+  qt_settings.player_repo_sort_col = -1;
+  qt_settings.city_repo_sort_col = -1;
+
 }
 
 /****************************************************************************

Modified: branches/S2_5/client/gui-qt/fc_client.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/fc_client.h?rev=31230&r1=31229&r2=31230&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/fc_client.h     (original)
+++ branches/S2_5/client/gui-qt/fc_client.h     Mon Dec 28 10:00:19 2015
@@ -127,6 +127,10 @@
 {
   int infotab_width; /* in percent */
   int infotab_height; /* in percent */
+  int player_repo_sort_col;
+  Qt::SortOrder player_report_sort;
+  int city_repo_sort_col;
+  Qt::SortOrder city_report_sort;
 };
 
 class fc_client : public QMainWindow

Modified: branches/S2_5/client/gui-qt/plrdlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/plrdlg.cpp?rev=31230&r1=31229&r2=31230&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/plrdlg.cpp      (original)
+++ branches/S2_5/client/gui-qt/plrdlg.cpp      Mon Dec 28 10:00:19 2015
@@ -534,6 +534,8 @@
   delete pid;
   delete list_model;
   delete filter_model;
+  gui()->qt_settings.player_repo_sort_col = header()->sortIndicatorSection();
+  gui()->qt_settings.player_report_sort = header()->sortIndicatorOrder();
 }
 
 /**************************************************************************
@@ -585,6 +587,10 @@
   connect(cancel_but, SIGNAL(pressed()), SLOT(req_caancel_threaty()));
   connect(withdraw_but, SIGNAL(pressed()), SLOT(req_wiithdrw_vision()));
   setLayout(layout);
+  if (gui()->qt_settings.player_repo_sort_col != -1) {
+    plr_wdg->sortByColumn(gui()->qt_settings.player_repo_sort_col,
+                          gui()->qt_settings.player_report_sort);
+  }
 }
 
 /**************************************************************************


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

Reply via email to