Author: mir3x
Date: Thu Nov 17 10:03:54 2016
New Revision: 34534

URL: http://svn.gna.org/viewcvs/freeciv?rev=34534&view=rev
Log:
Qt client - added 5 actions to unit label

See patch #7988


Added:
    branches/S2_6/data/themes/gui-qt/icons/automate.png   (with props)
    branches/S2_6/data/themes/gui-qt/icons/paradrop.png   (with props)
    branches/S2_6/data/themes/gui-qt/icons/pollution.png   (with props)
    branches/S2_6/data/themes/gui-qt/icons/set_homecity.png   (with props)
    branches/S2_6/data/themes/gui-qt/icons/upgrade.png   (with props)
Modified:
    branches/S2_6/client/gui-qt/hudwidget.cpp
    branches/S2_6/client/gui-qt/menu.cpp
    branches/S2_6/client/gui-qt/shortcuts.cpp
    branches/S2_6/client/gui-qt/shortcuts.h
    branches/S2_6/data/themes/gui-qt/icons/Makefile.am

Modified: branches/S2_6/client/gui-qt/hudwidget.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/hudwidget.cpp?rev=34534&r1=34533&r2=34534&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/hudwidget.cpp   (original)
+++ branches/S2_6/client/gui-qt/hudwidget.cpp   Thu Nov 17 10:03:54 2016
@@ -864,6 +864,44 @@
     a->set_pixmap(fc_icons::instance()->get_pixmap("load"));
     actions.append(a);
   }
+  /* Set homecity */
+  if (tile_city(unit_tile(current_unit))) {
+    if (can_unit_change_homecity_to(current_unit,
+                                    tile_city(unit_tile(current_unit)))) {
+      a = new hud_action(this);
+      a->action_shortcut = SC_SETHOME;
+      a->set_pixmap(fc_icons::instance()->get_pixmap("set_homecity"));
+      actions.append(a);
+    }
+  }
+  /* Upgrade */
+  if (UU_OK == unit_upgrade_test(current_unit, FALSE)) {
+    a = new hud_action(this);
+    a->action_shortcut = SC_UPGRADE_UNIT;
+    a->set_pixmap(fc_icons::instance()->get_pixmap("upgrade"));
+    actions.append(a);
+  }
+  /* Automate */
+  if (can_unit_do_autosettlers(current_unit)) {
+    a = new hud_action(this);
+    a->action_shortcut = SC_AUTOMATE;
+    a->set_pixmap(fc_icons::instance()->get_pixmap("automate"));
+    actions.append(a);
+  }
+  /* Paradrop */
+  if (unit_has_type_flag(current_unit, UTYF_PARATROOPERS)) {
+    a = new hud_action(this);
+    a->action_shortcut = SC_PARADROP;
+    a->set_pixmap(fc_icons::instance()->get_pixmap("paradrop"));
+    actions.append(a);
+  }
+  /* Clean pollution */
+  if (can_unit_do_activity(current_unit, ACTIVITY_POLLUTION)) {
+    a = new hud_action(this);
+    a->action_shortcut = SC_PARADROP;
+    a->set_pixmap(fc_icons::instance()->get_pixmap("pollution"));
+    actions.append(a);
+  }
   /* Unload */
   if (unit_transported(current_unit)
       && can_unit_unload(current_unit, unit_transport_get(current_unit))

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=34534&r1=34533&r2=34534&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/menu.cpp        (original)
+++ branches/S2_6/client/gui-qt/menu.cpp        Thu Nov 17 10:03:54 2016
@@ -1072,7 +1072,8 @@
   act->setShortcut(QKeySequence(tr("shift+b")));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_go_build_city()));
   act = menu->addAction(_("Auto Settler"));
-  act->setShortcut(QKeySequence(tr("a")));
+  act->setShortcut(QKeySequence(shortcut_to_string(
+                   fc_shortcuts::sc()->get_shortcut(SC_AUTOMATE))));
   menu_list.insertMulti(AUTOSETTLER, act);
   connect(act, SIGNAL(triggered()), this, SLOT(slot_auto_settler()));
   menu->addSeparator();
@@ -1112,7 +1113,8 @@
   connect(act, SIGNAL(triggered()), this, SLOT(slot_transform()));
   act = menu->addAction(_("Clean Pollution"));
   menu_list.insertMulti(POLLUTION, act);
-  act->setShortcut(QKeySequence(tr("p")));
+  act->setShortcut(QKeySequence(shortcut_to_string(
+                   fc_shortcuts::sc()->get_shortcut(SC_PARADROP))));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_clean_pollution()));
   act = menu->addAction(_("Clean Nuclear Fallout"));
   menu_list.insertMulti(FALLOUT, act);
@@ -1444,8 +1446,9 @@
   menu_list = findChildren<QMenu*>();
     foreach (m, menu_list) {
         foreach (a, m->actions()) {
-          if (a->shortcut() == seq) {
+          if (a->shortcut() == seq && a->isEnabled()) {
             a->activate(QAction::Trigger);
+            return;
           }
         }
     }

Modified: branches/S2_6/client/gui-qt/shortcuts.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/shortcuts.cpp?rev=34534&r1=34533&r2=34534&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/shortcuts.cpp   (original)
+++ branches/S2_6/client/gui-qt/shortcuts.cpp   Thu Nov 17 10:03:54 2016
@@ -50,7 +50,7 @@
   RESPONSE_SAVE
 };
 
-static int num_shortcuts = 44;
+static int num_shortcuts = 46;
 fc_shortcut default_shortcuts[] = {
   {SC_SCROLL_MAP, 0, Qt::RightButton, Qt::NoModifier, "Scroll map" },
   {SC_CENTER_VIEW, Qt::Key_C, Qt::AllButtons, Qt::NoModifier,
@@ -106,7 +106,7 @@
   {SC_UNSENTRY_TILE, Qt::Key_D, Qt::AllButtons,
     Qt::ShiftModifier | Qt::ControlModifier, _("Unsentry All On Tile") },
   {SC_DO, Qt::Key_D, Qt::AllButtons, Qt::NoModifier, _("Do...") },
-  {SC_UPGRADE_UNIT, Qt::Key_U, Qt::AllButtons, Qt::ShiftModifier,
+  {SC_UPGRADE_UNIT, Qt::Key_U, Qt::AllButtons, Qt::ControlModifier,
     _("Upgrade") },
   {SC_SETHOME, Qt::Key_H, Qt::AllButtons, Qt::NoModifier,
     _("Set Home City") },
@@ -138,6 +138,10 @@
     _("Quick buy current production from map") },
   {SC_IFACE_LOCK, Qt::Key_L, Qt::AllButtons, Qt::ControlModifier
     | Qt::ShiftModifier, _("Lock/unlock interface") },
+  {SC_AUTOMATE, Qt::Key_A, Qt::AllButtons, Qt::NoModifier,
+    _("Auto worker") },
+  {SC_PARADROP, Qt::Key_P, Qt::AllButtons, Qt::NoModifier,
+    _("Paradrop/clean pollution") },
 };
 
 

Modified: branches/S2_6/client/gui-qt/shortcuts.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/shortcuts.h?rev=34534&r1=34533&r2=34534&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/shortcuts.h     (original)
+++ branches/S2_6/client/gui-qt/shortcuts.h     Thu Nov 17 10:03:54 2016
@@ -74,7 +74,9 @@
   SC_LOAD = 41,
   SC_UNLOAD = 42,
   SC_BUY_MAP = 43,
-  SC_IFACE_LOCK = 44
+  SC_IFACE_LOCK = 44,
+  SC_AUTOMATE = 45,
+  SC_PARADROP = 46
 };
 
 

Modified: branches/S2_6/data/themes/gui-qt/icons/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/icons/Makefile.am?rev=34534&r1=34533&r2=34534&view=diff
==============================================================================
--- branches/S2_6/data/themes/gui-qt/icons/Makefile.am  (original)
+++ branches/S2_6/data/themes/gui-qt/icons/Makefile.am  Thu Nov 17 10:03:54 2016
@@ -5,6 +5,7 @@
 
 pkgdata_DATA =                 \
        ai.png                  \
+       automate.png            \
        building.png            \
        buildroad.png           \
        cclose.png              \
@@ -39,15 +40,19 @@
        nuke.png                \
        list-add.png            \
        meeting-observer.png    \
+       paradrop.png            \
        plantforest.png         \
        plus.png                \
+       pollution.png           \
        preferences-other.png   \
        research.png            \
        resize.png              \
        sentry.png              \
+       set_homecity.png        \
        transform.png           \
        units.png               \
        unload.png              \
+       upgrade.png             \
        wait.png                \
        wonder.png              \
        view.png

Added: branches/S2_6/data/themes/gui-qt/icons/automate.png
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/icons/automate.png?rev=34534&view=auto
==============================================================================
Binary file - no diff available.

Propchange: branches/S2_6/data/themes/gui-qt/icons/automate.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: branches/S2_6/data/themes/gui-qt/icons/paradrop.png
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/icons/paradrop.png?rev=34534&view=auto
==============================================================================
Binary file - no diff available.

Propchange: branches/S2_6/data/themes/gui-qt/icons/paradrop.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: branches/S2_6/data/themes/gui-qt/icons/pollution.png
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/icons/pollution.png?rev=34534&view=auto
==============================================================================
Binary file - no diff available.

Propchange: branches/S2_6/data/themes/gui-qt/icons/pollution.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: branches/S2_6/data/themes/gui-qt/icons/set_homecity.png
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/icons/set_homecity.png?rev=34534&view=auto
==============================================================================
Binary file - no diff available.

Propchange: branches/S2_6/data/themes/gui-qt/icons/set_homecity.png
------------------------------------------------------------------------------
    svn:mime-type = image/png

Added: branches/S2_6/data/themes/gui-qt/icons/upgrade.png
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/themes/gui-qt/icons/upgrade.png?rev=34534&view=auto
==============================================================================
Binary file - no diff available.

Propchange: branches/S2_6/data/themes/gui-qt/icons/upgrade.png
------------------------------------------------------------------------------
    svn:mime-type = image/png


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

Reply via email to