Author: mir3x
Date: Tue Oct 25 23:43:06 2016
New Revision: 34249

URL: http://svn.gna.org/viewcvs/freeciv?rev=34249&view=rev
Log:
Qt client - added tooltips to city dialog close/next/prev buttons.

See patch #7868

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

Modified: branches/S2_6/client/gui-qt/citydlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/citydlg.cpp?rev=34249&r1=34248&r2=34249&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/citydlg.cpp     (original)
+++ branches/S2_6/client/gui-qt/citydlg.cpp     Tue Oct 25 23:43:06 2016
@@ -1242,7 +1242,7 @@
               *v_layout, *work_but_layout;
   QHeaderView *header;
   QLabel *lab2, *label, *ql, *some_label;
-  QPushButton *button2, *qpush2;
+  QPushButton *qpush2;
   QScrollArea *scroll, *scroll2, *scroll3;
   QSizePolicy size_expanding_policy(QSizePolicy::Expanding,
                                     QSizePolicy::Expanding);
@@ -1415,32 +1415,36 @@
   button = new QPushButton;
   button->setIcon(fc_icons::instance()->get_icon("city-close"));
   button->setIconSize(QSize(56, 56));
+  button->setToolTip(_("Close city dialog"));
   connect(button, SIGNAL(clicked()), SLOT(hide()));
 
   next_city_but = new QPushButton();
   next_city_but->setIcon(fc_icons::instance()->get_icon("city-right"));
   next_city_but->setIconSize(QSize(56, 56));
+  next_city_but->setToolTip(_("Show next city"));
   connect(next_city_but, SIGNAL(clicked()), SLOT(next_city()));
 
   prev_city_but = new QPushButton();
   connect(prev_city_but, SIGNAL(clicked()), SLOT(prev_city()));
   prev_city_but->setIcon(fc_icons::instance()->get_icon("city-left"));
   prev_city_but->setIconSize(QSize(56, 56));
-
-  button2 = new QPushButton();
-  button2->setIcon(fc_icons::instance()->get_icon("city-switch"));
-  button2->setIconSize(QSize(56, 28));
-  connect(button2, SIGNAL(clicked()), SLOT(show_happiness()));
+  prev_city_but->setToolTip(_("Show previous city"));
+
+  happiness_button = new QPushButton();
+  happiness_button->setIcon(fc_icons::instance()->get_icon("city-switch"));
+  happiness_button->setIconSize(QSize(56, 28));
+  connect(happiness_button, SIGNAL(clicked()), SLOT(show_happiness()));
+  update_happiness_button();
 
   button->setFixedSize(64, 64);
   prev_city_but->setFixedSize(64, 64);
   next_city_but->setFixedSize(64, 64);
-  button2->setFixedSize(64, 32);
+  happiness_button->setFixedSize(64, 32);
   vbox_layout = new QVBoxLayout;
   vbox_layout->addWidget(prev_city_but);
   vbox_layout->addWidget(next_city_but);
   vbox_layout->addWidget(button);
-  vbox_layout->addWidget(button2, Qt::AlignHCenter);
+  vbox_layout->addWidget(happiness_button, Qt::AlignHCenter);
   hbox_layout = new QHBoxLayout;
 
   hbox_layout->addLayout(vbox_layout, Qt::AlignLeft);
@@ -1722,6 +1726,18 @@
 }
 
 /****************************************************************************
+  Sets tooltip for happiness/pruction button switcher
+****************************************************************************/
+void city_dialog::update_happiness_button()
+{
+  if (happines_shown == false) {
+    happiness_button->setToolTip(_("Show happiness information"));
+  } else {
+    happiness_button->setToolTip(_("Show city production"));
+  }
+}
+
+/****************************************************************************
   Shows happiness tab
 ****************************************************************************/
 void city_dialog::show_happiness()
@@ -1747,6 +1763,7 @@
   setUpdatesEnabled(true);
   update();
   happines_shown = !happines_shown;
+  update_happiness_button();
 }
 
 

Modified: branches/S2_6/client/gui-qt/citydlg.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/citydlg.h?rev=34249&r1=34248&r2=34249&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/citydlg.h       (original)
+++ branches/S2_6/client/gui-qt/citydlg.h       Tue Oct 25 23:43:06 2016
@@ -422,6 +422,7 @@
   QPushButton *work_add_but;
   QPushButton *work_rem_but;
   QPushButton *but_menu_worklist;
+  QPushButton *happiness_button;
   QPixmap *citizen_pixmap;
   unit_info *current_units;
   unit_info *supported_units;
@@ -452,6 +453,7 @@
   void update_disabled();
   void update_sliders();
   void update_prod_buttons();
+  void update_happiness_button();
 
 private slots:
   void next_city();


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

Reply via email to