Author: mir3x
Date: Mon Dec 29 17:34:43 2014
New Revision: 27442

URL: http://svn.gna.org/viewcvs/freeciv?rev=27442&view=rev
Log:
Updated function popdown_all_game_dialogs to close all reports and 
notifications on disconnect.

See patch #5600


Modified:
    branches/S2_5/client/gui-qt/cityrep.cpp
    branches/S2_5/client/gui-qt/cityrep.h
    branches/S2_5/client/gui-qt/dialogs.cpp
    branches/S2_5/client/gui-qt/mapview.cpp
    branches/S2_5/client/gui-qt/plrdlg.cpp
    branches/S2_5/client/gui-qt/plrdlg.h
    branches/S2_5/client/gui-qt/repodlgs.cpp
    branches/S2_5/client/gui-qt/repodlgs.h
    branches/S2_5/client/gui-qt/spaceshipdlg.cpp
    branches/S2_5/client/gui-qt/spaceshipdlg.h

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=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/cityrep.cpp     (original)
+++ branches/S2_5/client/gui-qt/cityrep.cpp     Mon Dec 29 17:34:43 2014
@@ -940,6 +940,24 @@
   }
 }
 
+/**************************************************************************
+  Closes city report
+**************************************************************************/
+void popdown_city_report()
+{
+  int i;
+  city_report *cr;
+  QWidget *w;
+
+  if (gui()->is_repo_dlg_open("CTS")) {
+    i = gui()->gimme_index_of("CTS");
+    fc_assert(i != -1);
+    w = gui()->game_tab_widget->widget(i);
+    cr = reinterpret_cast<city_report *>(w);
+    cr->deleteLater();
+  }
+}
+
 /****************************************************************
  After a selection rectangle is defined, make the cities that
  are hilited on the canvas exclusively hilited in the

Modified: branches/S2_5/client/gui-qt/cityrep.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/cityrep.h?rev=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/cityrep.h       (original)
+++ branches/S2_5/client/gui-qt/cityrep.h       Mon Dec 29 17:34:43 2014
@@ -201,4 +201,6 @@
   int index;
 };
 
+void popdown_city_report();
+
 #endif /* FC__CITYREP_H */

Modified: branches/S2_5/client/gui-qt/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/dialogs.cpp?rev=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/dialogs.cpp     (original)
+++ branches/S2_5/client/gui-qt/dialogs.cpp     Mon Dec 29 17:34:43 2014
@@ -46,6 +46,13 @@
 #include "dialogs.h"
 #include "qtg_cxxside.h"
 #include "sprite.h"
+
+extern void popdown_all_spaceships_dialogs();
+extern void popdown_players_report();
+extern void popdown_economy_report();
+extern void popdown_units_report();
+extern void popdown_science_report();
+extern void popdown_city_report();
 
 static void diplomat_keep_moving(QVariant data1, QVariant data2);
 static void diplomat_incite(QVariant data1, QVariant data2);
@@ -1877,13 +1884,24 @@
 {
   int i;
   QList <choice_dialog *> cd_list;
+  QList <notify_dialog *> nd_list;
 
   cd_list = gui()->game_tab_widget->findChildren <choice_dialog *>();
   for (i = 0; i < cd_list.count(); i++) {
       cd_list[i]->close();
   }
+  nd_list = gui()->game_tab_widget->findChildren <notify_dialog *>();
+  for (i = 0; i < nd_list.count(); i++) {
+      nd_list[i]->close();
+  }
 
   popdown_help_dialog();
+  popdown_players_report();
+  popdown_all_spaceships_dialogs();
+  popdown_economy_report();
+  popdown_units_report();
+  popdown_science_report();
+  popdown_city_report();
 }
 
 /****************************************************************

Modified: branches/S2_5/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/mapview.cpp     (original)
+++ branches/S2_5/client/gui-qt/mapview.cpp     Mon Dec 29 17:34:43 2014
@@ -231,13 +231,15 @@
    * try position pos_x, pos_y,
    * check middle and borders if aren't  above other widget
    */
+
   for (i = 0; i < widgets.count(); i++) {
-    if (widgets[i]->was_destroyed == true) {
+    if (widgets[i]->isVisible() == false) {
       continue;
     }
     x = widgets[i]->pos().x();
     y = widgets[i]->pos().y();
-    if (x == 0 && y ==0) { 
+
+    if (x == 0 && y ==0) {
       continue;
     }
     xe = widgets[i]->pos().x() + widgets[i]->width();

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=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/plrdlg.cpp      (original)
+++ branches/S2_5/client/gui-qt/plrdlg.cpp      Mon Dec 29 17:34:43 2014
@@ -702,3 +702,21 @@
     pr->update_report();
   }
 }
+
+/**************************************************************************
+  Closes players report
+**************************************************************************/
+void popdown_players_report()
+{
+  int i;
+  plr_report *pr;
+  QWidget *w;
+
+  if (gui()->is_repo_dlg_open("PLR")) {
+    i = gui()->gimme_index_of("PLR");
+    fc_assert(i != -1);
+    w = gui()->game_tab_widget->widget(i);
+    pr = reinterpret_cast<plr_report *>(w);
+    pr->deleteLater();
+  }
+}

Modified: branches/S2_5/client/gui-qt/plrdlg.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/plrdlg.h?rev=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/plrdlg.h        (original)
+++ branches/S2_5/client/gui-qt/plrdlg.h        Mon Dec 29 17:34:43 2014
@@ -165,6 +165,7 @@
 };
 
 void popup_players_dialog(bool raise);
+void popdown_players_report(void);
 
 
 #endif /* FC__PLRDLG_H */

Modified: branches/S2_5/client/gui-qt/repodlgs.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/repodlgs.cpp?rev=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/repodlgs.cpp    (original)
+++ branches/S2_5/client/gui-qt/repodlgs.cpp    Mon Dec 29 17:34:43 2014
@@ -1404,3 +1404,57 @@
     sci_rep->redraw();
   }
 }
+
+/****************************************************************************
+  Closes economy report
+****************************************************************************/
+void popdown_economy_report()
+{
+  int i;
+  eco_report *eco_rep;
+  QWidget *w;
+
+  if (gui()->is_repo_dlg_open("ECO")) {
+    i = gui()->gimme_index_of("ECO");
+    fc_assert(i != -1);
+    w = gui()->game_tab_widget->widget(i);
+    eco_rep = reinterpret_cast<eco_report*>(w);
+    eco_rep->deleteLater();
+  }
+}
+
+/****************************************************************************
+  Closes science report
+****************************************************************************/
+void popdown_science_report()
+{
+  int i;
+  science_report *sci_rep;
+  QWidget *w;
+
+  if (gui()->is_repo_dlg_open("SCI")) {
+    i = gui()->gimme_index_of("SCI");
+    fc_assert(i != -1);
+    w = gui()->game_tab_widget->widget(i);
+    sci_rep = reinterpret_cast<science_report*>(w);
+    sci_rep->deleteLater();
+  }
+}
+
+/****************************************************************************
+  Closes units report
+****************************************************************************/
+void popdown_units_report()
+{
+  int i;
+  units_report *units_rep;
+  QWidget *w;
+
+  if (gui()->is_repo_dlg_open("UNI")) {
+    i = gui()->gimme_index_of("UNI");
+    fc_assert(i != -1);
+    w = gui()->game_tab_widget->widget(i);
+    units_rep = reinterpret_cast<units_report*>(w);
+    units_rep->deleteLater();
+  }
+}

Modified: branches/S2_5/client/gui-qt/repodlgs.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/repodlgs.h?rev=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/repodlgs.h      (original)
+++ branches/S2_5/client/gui-qt/repodlgs.h      Mon Dec 29 17:34:43 2014
@@ -196,5 +196,8 @@
 
 
 bool comp_less_than(const qlist_item &q1, const qlist_item &q2);
+void popdown_economy_report();
+void popdown_units_report();
+void popdown_science_report();
 
 #endif /* FC__REPODLGS_H */

Modified: branches/S2_5/client/gui-qt/spaceshipdlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/spaceshipdlg.cpp?rev=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/spaceshipdlg.cpp        (original)
+++ branches/S2_5/client/gui-qt/spaceshipdlg.cpp        Mon Dec 29 17:34:43 2014
@@ -162,3 +162,25 @@
     ss_rep->update_report();
   }
 }
+
+/**************************************************************************
+  Close all spaceships dialogs
+**************************************************************************/
+void popdown_all_spaceships_dialogs()
+{
+  int i;
+  ss_report *ss_rep;
+  QWidget *w;
+
+  if (!gui()->is_repo_dlg_open("SPS")) {
+    return;
+  }
+  else {
+    i = gui()->gimme_index_of("SPS");
+    fc_assert(i != -1);
+    w = gui()->game_tab_widget->widget(i);
+    ss_rep = reinterpret_cast<ss_report*>(w);
+    ss_rep->deleteLater();
+  }
+}
+

Modified: branches/S2_5/client/gui-qt/spaceshipdlg.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/spaceshipdlg.h?rev=27442&r1=27441&r2=27442&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/spaceshipdlg.h  (original)
+++ branches/S2_5/client/gui-qt/spaceshipdlg.h  Mon Dec 29 17:34:43 2014
@@ -57,5 +57,6 @@
 };
 
 void popup_spaceship_dialog(struct player *pplayer);
+void popdown_all_spaceships_dialogs();
 
 #endif /* FC__SPACESHIPDLG_H */


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

Reply via email to