Author: mir3x
Date: Thu Dec 24 09:32:51 2015
New Revision: 31178

URL: http://svn.gna.org/viewcvs/freeciv?rev=31178&view=rev
Log:
Added right click for units/improvements/technologies on research 
diagram to open help page.

See patch #6699


Modified:
    branches/S2_5/client/gui-qt/repodlgs.cpp

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=31178&r1=31177&r2=31178&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/repodlgs.cpp    (original)
+++ branches/S2_5/client/gui-qt/repodlgs.cpp    Thu Dec 24 09:32:51 2015
@@ -250,6 +250,8 @@
 void research_diagram::mousePressEvent(QMouseEvent *event)
 {
   Tech_type_id tech = get_tech_on_reqtree(req, event->x(), event->y());
+  req_tooltip_help *rttp;
+  int i;
 
   if (event->button() == Qt::LeftButton && can_client_issue_orders()) {
     switch (player_invention_state(client_player(), tech)) {
@@ -261,6 +263,24 @@
       break;
     case TECH_KNOWN:
       break;
+    }
+  }  else if (event->button() == Qt::RightButton) {
+    for (i = 0; i < tt_help.count(); i++) {
+      rttp = tt_help.at(i);
+      if (rttp->rect.contains(event->pos())) {
+        if (rttp->tech_id != -1) {
+          popup_help_dialog_typed(advance_name_for_player(client_player(),
+                                  rttp->tech_id), HELP_TECH);
+        } else if (rttp->timpr != nullptr) {
+          popup_help_dialog_typed(improvement_name_translation(rttp->timpr),
+                                  HELP_IMPROVEMENT);
+        } else if (rttp->tunit != nullptr) {
+          popup_help_dialog_typed(utype_name_translation(rttp->tunit),
+                                  HELP_UNIT);
+        } else {
+          return;
+        }
+      }
     }
   }
 }


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

Reply via email to