Author: mir3x
Date: Mon Dec 29 17:39:52 2014
New Revision: 27443

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

See patch #5600


Modified:
    trunk/client/gui-qt/cityrep.cpp
    trunk/client/gui-qt/cityrep.h
    trunk/client/gui-qt/dialogs.cpp
    trunk/client/gui-qt/menu.cpp
    trunk/client/gui-qt/plrdlg.cpp
    trunk/client/gui-qt/plrdlg.h
    trunk/client/gui-qt/repodlgs.cpp
    trunk/client/gui-qt/repodlgs.h
    trunk/client/gui-qt/spaceshipdlg.cpp
    trunk/client/gui-qt/spaceshipdlg.h

Modified: trunk/client/gui-qt/cityrep.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.cpp?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/cityrep.cpp     (original)
+++ trunk/client/gui-qt/cityrep.cpp     Mon Dec 29 17:39:52 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: trunk/client/gui-qt/cityrep.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/cityrep.h?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/cityrep.h       (original)
+++ trunk/client/gui-qt/cityrep.h       Mon Dec 29 17:39:52 2014
@@ -201,4 +201,6 @@
   int index;
 };
 
+void popdown_city_report();
+
 #endif /* FC__CITYREP_H */

Modified: trunk/client/gui-qt/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/dialogs.cpp     (original)
+++ trunk/client/gui-qt/dialogs.cpp     Mon Dec 29 17:39:52 2014
@@ -53,6 +53,13 @@
 #define BUTTON_MOVE ACTION_MOVE
 #define BUTTON_CANCEL BUTTON_MOVE + 1
 #define BUTTON_COUNT BUTTON_MOVE + 2
+
+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);
@@ -2044,13 +2051,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: trunk/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/menu.cpp        (original)
+++ trunk/client/gui-qt/menu.cpp        Mon Dec 29 17:39:52 2014
@@ -618,7 +618,10 @@
   act = menu->addAction(_("Clean Nuclear Fallout"));
   menu_list.insertMulti(FALLOUT, act);
   act->setShortcut(QKeySequence(tr("n")));
-  connect(act, SIGNAL(triggered()), this, SLOT(slot_clean_fallout()));
+  act = menu->addAction(_("Help build Wonder"));
+  act->setShortcut(QKeySequence(tr("b")));
+  menu_list.insertMulti(BUILD_WONDER, act);
+  connect(act, SIGNAL(triggered()), this, SLOT(slot_build_city()));
 
   /* Civilization menu */
   menu = this->addMenu(_("Civilization"));

Modified: trunk/client/gui-qt/plrdlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/plrdlg.cpp?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/plrdlg.cpp      (original)
+++ trunk/client/gui-qt/plrdlg.cpp      Mon Dec 29 17:39:52 2014
@@ -710,3 +710,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: trunk/client/gui-qt/plrdlg.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/plrdlg.h?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/plrdlg.h        (original)
+++ trunk/client/gui-qt/plrdlg.h        Mon Dec 29 17:39:52 2014
@@ -165,6 +165,7 @@
 };
 
 void popup_players_dialog(bool raise);
+void popdown_players_report(void);
 
 
 #endif /* FC__PLRDLG_H */

Modified: trunk/client/gui-qt/repodlgs.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.cpp?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/repodlgs.cpp    (original)
+++ trunk/client/gui-qt/repodlgs.cpp    Mon Dec 29 17:39:52 2014
@@ -1405,3 +1405,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: trunk/client/gui-qt/repodlgs.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/repodlgs.h?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/repodlgs.h      (original)
+++ trunk/client/gui-qt/repodlgs.h      Mon Dec 29 17:39:52 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: trunk/client/gui-qt/spaceshipdlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/spaceshipdlg.cpp?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/spaceshipdlg.cpp        (original)
+++ trunk/client/gui-qt/spaceshipdlg.cpp        Mon Dec 29 17:39:52 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: trunk/client/gui-qt/spaceshipdlg.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/spaceshipdlg.h?rev=27443&r1=27442&r2=27443&view=diff
==============================================================================
--- trunk/client/gui-qt/spaceshipdlg.h  (original)
+++ trunk/client/gui-qt/spaceshipdlg.h  Mon Dec 29 17:39:52 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