Author: mir3x
Date: Tue Aug  2 16:57:39 2016
New Revision: 33420

URL: http://svn.gna.org/viewcvs/freeciv?rev=33420&view=rev
Log:
Qt client - disabled multiplayer menu for observers.

See bug #24895


Modified:
    branches/S2_6/client/gui-qt/menu.cpp
    branches/S2_6/client/gui-qt/menu.h

Modified: branches/S2_6/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/menu.cpp?rev=33420&r1=33419&r2=33420&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/menu.cpp        (original)
+++ branches/S2_6/client/gui-qt/menu.cpp        Tue Aug  2 16:57:39 2016
@@ -1280,33 +1280,33 @@
   menu_list.insertMulti(ORDER_TRADEROUTE, act);
   connect(act, SIGNAL(triggered()), this, SLOT(slot_build_road()));
 
-  menu = this->addMenu(_("Multiplayer"));
-  act = menu->addAction(_("Delayed Goto"));
+  multiplayer_menu = this->addMenu(_("Multiplayer"));
+  act = multiplayer_menu->addAction(_("Delayed Goto"));
   act->setShortcut(QKeySequence(tr("z")));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_delayed_goto()));
-  act = menu->addAction(_("Delayed Orders Execute"));
+  act = multiplayer_menu->addAction(_("Delayed Orders Execute"));
   act->setShortcut(QKeySequence(tr("ctrl+z")));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_execute_orders()));
-  act = menu->addAction(_("Clear Orders"));
+  act = multiplayer_menu->addAction(_("Clear Orders"));
   act->setShortcut(QKeySequence(tr("ctrl+shift+c")));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_orders_clear()));
-  act = menu->addAction(_("Add all cities to trade planning"));
+  act = multiplayer_menu->addAction(_("Add all cities to trade planning"));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_trade_add_all()));
-  act = menu->addAction(_("Calculate trade planning"));
+  act = multiplayer_menu->addAction(_("Calculate trade planning"));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_calculate()));
-  act = menu->addAction(_("Add/Remove City"));
+  act = multiplayer_menu->addAction(_("Add/Remove City"));
   act->setShortcut(QKeySequence(tr("ctrl+t")));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_trade_city()));
-  act = menu->addAction(_("Clear Trade Planning"));
+  act = multiplayer_menu->addAction(_("Clear Trade Planning"));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_clear_trade()));
-  act = menu->addAction(_("Set/Unset rally point"));
+  act = multiplayer_menu->addAction(_("Set/Unset rally point"));
   act->setShortcut(QKeySequence(tr("shift+s")));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_rally()));
-  act = menu->addAction(_("Quick Airlift"));
+  act = multiplayer_menu->addAction(_("Quick Airlift"));
   act->setShortcut(QKeySequence(tr("ctrl+y")));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_quickairlift()));
   airlift_type = new QActionGroup(this);
-  airlift_menu = menu->addMenu(_("Unit type for quickairlifting"));
+  airlift_menu = multiplayer_menu->addMenu(_("Unit type for quickairlifting"));
 
   /* Civilization menu */
   menu = this->addMenu(_("Civilization"));
@@ -1499,6 +1499,9 @@
   QAction *act;
 
   airlift_menu->clear();
+  if (client_is_observer()) {
+    return;
+  }
   unit_type_iterate(utype) {
     utype_id = utype_index(utype);
 
@@ -1549,6 +1552,12 @@
   /** Disable first all sensitive menus */
   foreach(QAction * a, menu_list) {
     a->setEnabled(false);
+  }
+
+  if (client_is_observer()) {
+    multiplayer_menu->setDisabled(true);
+  } else {
+    multiplayer_menu->setDisabled(false);
   }
 
   /* Non unit menus */

Modified: branches/S2_6/client/gui-qt/menu.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/menu.h?rev=33420&r1=33419&r2=33420&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/menu.h  (original)
+++ branches/S2_6/client/gui-qt/menu.h  Tue Aug  2 16:57:39 2016
@@ -275,6 +275,7 @@
   QMenu *menu;
   QMenu *filter_menu;
   QMenu *airlift_menu;
+  QMenu *multiplayer_menu;
   QActionGroup *filter_act;
   QActionGroup *filter_any;
   QActionGroup *airlift_type;


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

Reply via email to