Author: mir3x
Date: Sun Dec 20 19:54:32 2015
New Revision: 31115

URL: http://svn.gna.org/viewcvs/freeciv?rev=31115&view=rev
Log:
Removed unit selection from menu, 
added the same shortuct (ctrl+space) on map view 
which will trigger unit selection dialog under mouse cursor. 
Eg. for easy picking units from city. 

Reported by Marko Lindqvist <cazfi>

See bug #24177


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

Modified: branches/S2_6/client/gui-qt/mapctrl.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/mapctrl.cpp?rev=31115&r1=31114&r2=31115&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/mapctrl.cpp     (original)
+++ branches/S2_6/client/gui-qt/mapctrl.cpp     Sun Dec 20 19:54:32 2015
@@ -102,8 +102,11 @@
 **************************************************************************/
 void map_view::keyPressEvent(QKeyEvent * event)
 {
+  struct tile *ptile;
+  QPoint local_pos;
   Qt::KeyboardModifiers key_mod = QApplication::keyboardModifiers();
   bool is_shift = key_mod.testFlag(Qt::ShiftModifier);
+  bool is_ctrl = key_mod.testFlag(Qt::ControlModifier);
 
   if (C_S_RUNNING == client_state()) {
     if (is_shift) {
@@ -155,6 +158,15 @@
       return;
     case Qt::Key_Escape:
       key_cancel_action();
+      return;
+    case Qt::Key_Space:
+      if (is_ctrl) {
+        local_pos = gui()->mapview_wdg->mapFromGlobal(QCursor::pos());
+        ptile = canvas_pos_to_tile(local_pos.x(), local_pos.y());
+        if (ptile != nullptr && unit_list_size(ptile->units) > 0) {
+          gui()->toggle_unit_sel_widget(ptile);
+        }
+      }
       return;
     default:
       break;

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=31115&r1=31114&r2=31115&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/menu.cpp        (original)
+++ branches/S2_6/client/gui-qt/menu.cpp        Sun Dec 20 19:54:32 2015
@@ -556,11 +556,6 @@
   connect(act, SIGNAL(triggered()), this, 
           SLOT(slot_select_same_everywhere()));
   menu->addSeparator();
-  act = menu->addAction(_("Unit selection dialog"));
-  menu_list.insertMulti(STANDARD, act);
-  act->setShortcut(QKeySequence(tr("ctrl+space")));
-  connect(act, SIGNAL(triggered()), this, SLOT(slot_selection_dialog()));
-  menu->addSeparator();
   act = menu->addAction(_("Wait"));
   act->setShortcut(QKeySequence(tr("w")));
   menu_list.insertMulti(STANDARD, act);
@@ -1942,16 +1937,6 @@
   unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_TILE);
 }
 
-/***************************************************************************
-  Action "SHOW UNIT SELECTION DIALOG"
-***************************************************************************/
-void mr_menu::slot_selection_dialog()
-{
-  struct unit *punit = head_of_units_in_focus();
-  if (punit != NULL && punit->tile){
-    unit_select_dialog_popup(punit->tile);
-  }
-}
 
 /***************************************************************************
   Action "WAIT"

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=31115&r1=31114&r2=31115&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/menu.h  (original)
+++ branches/S2_6/client/gui-qt/menu.h  Sun Dec 20 19:54:32 2015
@@ -227,7 +227,6 @@
   void slot_select_same_continent();
   void slot_select_same_everywhere();
   void slot_done_moving();
-  void slot_selection_dialog();
   void slot_wait();
   void slot_filter();
   void slot_filter_other();


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

Reply via email to