Author: mir3x
Date: Wed Dec  2 14:17:39 2015
New Revision: 30845

URL: http://svn.gna.org/viewcvs/freeciv?rev=30845&view=rev
Log:
Qt-client city dialog layout some changes:
Centered map of working tiles, 
Set minimum size for units and 2 labels.

See patch #6643


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

Modified: branches/S2_5/client/gui-qt/citydlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=30845&r1=30844&r2=30845&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/citydlg.cpp     (original)
+++ branches/S2_5/client/gui-qt/citydlg.cpp     Wed Dec  2 14:17:39 2015
@@ -90,8 +90,13 @@
   qunit = punit;
 
   if (punit) {
-    unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset),
-                                    tileset_unit_with_upkeep_height(tileset));
+    if (supported) {
+      unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset),
+                                      
tileset_unit_with_upkeep_height(tileset));
+    } else {
+      unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset),
+                                      tileset_unit_height(tileset));
+    }
     unit_pixmap->map_pixmap.fill(Qt::transparent);
     put_unit(punit, unit_pixmap, 0, 0);
     if (supported) {
@@ -346,8 +351,13 @@
     delete unit_pixmap;
   }
   if (qunit) {
-    unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset),
-                                    tileset_unit_with_upkeep_height(tileset));
+    if (supported) {
+      unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset),
+                                      
tileset_unit_with_upkeep_height(tileset));
+    } else {
+      unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset),
+                                      tileset_unit_height(tileset));
+    }
     unit_pixmap->map_pixmap.fill(QColor(200, 200, 200));
     put_unit(qunit, unit_pixmap, 0, 0);
     if (supported) {
@@ -368,8 +378,13 @@
     delete unit_pixmap;
   }
   if (qunit) {
-    unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset),
-                                    tileset_unit_with_upkeep_height(tileset));
+    if (supported) {
+      unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset),
+                                      
tileset_unit_with_upkeep_height(tileset));
+    } else {
+      unit_pixmap = qtg_canvas_create(tileset_full_tile_width(tileset),
+                                      tileset_unit_height(tileset));
+    }
     unit_pixmap->map_pixmap.fill(Qt::transparent);
     put_unit(qunit, unit_pixmap, 0, 0);
     if (supported) {
@@ -437,12 +452,11 @@
 ****************************************************************************/
 void unit_info::init_layout()
 {
-  QSizePolicy size_expanding_policy(QSizePolicy::Expanding,
-                                    QSizePolicy::Expanding);
-  QSizePolicy size_fixed_policy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+  QSizePolicy size_fixed_policy(QSizePolicy::Fixed, 
+                                QSizePolicy::MinimumExpanding, 
+                                QSizePolicy::Slider);
   layout->setContentsMargins(3, 6, 3, 6);
   setSizePolicy(size_fixed_policy);
-  setFixedHeight(tileset_unit_with_upkeep_height(tileset) + 6);
   setLayout(layout);
 }
 
@@ -455,7 +469,7 @@
   int i = unit_list.count();
   int j;
   unit_item *ui;
-  
+
   setUpdatesEnabled(false);
   hide();
   for (j = 0; j < i; j++) {
@@ -465,6 +479,7 @@
   show();
   setUpdatesEnabled(true);
   layout->update();
+  updateGeometry();
 }
 
 /****************************************************************************
@@ -690,12 +705,12 @@
 
   /** Overview tab initialization */
   {
+    QScrollArea *scroll;
+    QScrollArea *scroll2;
     QGroupBox *map_box = new QGroupBox(this);
-    QVBoxLayout *v_layout = new QVBoxLayout;
+    QHBoxLayout *v_layout = new QHBoxLayout;
     QGroupBox *prod_box = new QGroupBox(this);
     QGridLayout *prod_layout = new QGridLayout;
-    QScrollArea *scroll;
-    QScrollArea *scroll2;
 
     info_widget = new QWidget(overview_tab); /** City information widget
                                         * texts about surpluses and so on */
@@ -714,6 +729,9 @@
       info_grid_layout->addWidget(qlt[iter], iter, 1);
     }
     info_widget->setLayout(info_grid_layout);
+    info_widget->setMinimumHeight(2 * fm.height() + 24
+                                  + tileset_tile_height(tileset)
+                                  + tileset_unit_with_upkeep_height(tileset));
     production_combo = new progress_bar(parent);
     production_combo->setToolTip(_("Click to change current production"));
 
@@ -748,17 +766,23 @@
     map_box->setLayout(v_layout);
     map_box->setTitle(_("City map"));
     supp_units = new QLabel();
+    supp_units->setFixedHeight(fm.height() + 4);
     curr_units = new QLabel();
+    curr_units->setFixedHeight(fm.height() + 4);
     supported_units = new unit_info(this, true);
     scroll = new QScrollArea;
     scroll->setWidgetResizable(true);
-    scroll->setMaximumHeight(tileset_unit_with_upkeep_height(tileset) * 2);
+    scroll->setMinimumHeight(tileset_unit_with_upkeep_height(tileset) + 6);
+    scroll->setMaximumHeight(tileset_unit_with_upkeep_height(tileset) + 6
+                              + scroll->horizontalScrollBar()->height());
     scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     scroll->setWidget(supported_units);
     current_units = new unit_info(this, false);
     scroll2 = new QScrollArea;
     scroll2->setWidgetResizable(true);
-    scroll2->setMaximumHeight(tileset_tile_height(tileset) * 2);
+    scroll2->setMinimumHeight(tileset_unit_height(tileset) + 6);
+    scroll2->setMaximumHeight(tileset_unit_height(tileset) + 6
+                              + scroll2->horizontalScrollBar()->height());
     scroll2->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
     scroll2->setWidget(current_units);
     prod_layout->addWidget(item_button, 0, 1, 1, 1);
@@ -1700,6 +1724,8 @@
   production_combo_p->blockSignals(false);
   production_combo->blockSignals(false);
   setUpdatesEnabled(true);
+  updateGeometry();
+  update();
 }
 
 void city_dialog::update_settings()
@@ -2010,7 +2036,6 @@
 
   current_units->update_units();
   current_units->setUpdatesEnabled(true);
-
 }
 
 /****************************************************************************


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

Reply via email to