Author: mir3x
Date: Fri Sep 16 12:09:31 2016
New Revision: 33819

URL: http://svn.gna.org/viewcvs/freeciv?rev=33819&view=rev
Log:
Qt client - Sidebar not drawn correctly when loading savegame with pending 
diplomacy meeting

Reported by Jacob Nevins <jtn>

See bug #25051


Modified:
    trunk/client/gui-qt/fc_client.cpp
    trunk/client/gui-qt/mapview.cpp
    trunk/client/gui-qt/mapview.h
    trunk/client/gui-qt/sidebar.cpp
    trunk/client/gui-qt/sidebar.h

Modified: trunk/client/gui-qt/fc_client.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=33819&r1=33818&r2=33819&view=diff
==============================================================================
--- trunk/client/gui-qt/fc_client.cpp   (original)
+++ trunk/client/gui-qt/fc_client.cpp   Fri Sep 16 12:09:31 2016
@@ -805,6 +805,27 @@
 ****************************************************************************/
 void fc_game_tab_widget::resizeEvent(QResizeEvent *event)
 {
+  QSize size;
+  size = event->size();
+  if (C_S_RUNNING <= client_state()) {
+    gui()->sidebar_wdg->resize_me(size.width(), size.height());
+    map_canvas_resized(size.width(), size.height());
+    size.setWidth(event->size().width() - gui()->sidebar_wdg->width());
+    gui()->infotab->resize((size.width()
+                             * gui()->qt_settings.chat_width) / 100,
+                             (size.height()
+                             * gui()->qt_settings.chat_height) / 100);
+    gui()->infotab->move(0 , size.height() - gui()->infotab->height());
+    gui()->infotab->restore_chat();
+    gui()->minimapview_wdg->move(event->size().width() -
+                                 gui()->minimapview_wdg->width() - 10,
+                                 size.height() -
+                                 gui()->minimapview_wdg->height() - 10);
+    gui()->x_vote->move(width() / 2 - gui()->x_vote->width() / 2, 0);
+    gui()->update_sidebar_tooltips();
+    side_disable_endturn(get_turn_done_button_state());
+    gui()->mapview_wdg->resize(event->size().width(),size.height());
+  }
   event->setAccepted(true);
 }
 

Modified: trunk/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=33819&r1=33818&r2=33819&view=diff
==============================================================================
--- trunk/client/gui-qt/mapview.cpp     (original)
+++ trunk/client/gui-qt/mapview.cpp     Fri Sep 16 12:09:31 2016
@@ -226,6 +226,7 @@
   timer->start(200);
   resize(0, 0);
   setMouseTracking(true);
+  setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
 
   font_options_listener::listen();
 }
@@ -294,33 +295,6 @@
 void map_view::leaveEvent(QEvent *event)
 {
   update_cursor(CURSOR_DEFAULT);
-}
-
-/**************************************************************************
-  Resize Event
-**************************************************************************/
-void map_view::resizeEvent(QResizeEvent *event)
-{
-  QSize size;
-  size = event->size();
-  if (C_S_RUNNING <= client_state()) {
-    map_canvas_resized(size.width(), size.height());
-    gui()->sidebar_wdg->resize_me(size.width(), size.height());
-    gui()->infotab->resize((size.width()
-                             * gui()->qt_settings.chat_width) / 100,
-                             (size.height()
-                             * gui()->qt_settings.chat_height) / 100);
-    gui()->infotab->move(0 , size.height() - gui()->infotab->height());
-    gui()->infotab->restore_chat();
-    gui()->minimapview_wdg->move(size.width() -
-                                 gui()->minimapview_wdg->width() - 10,
-                                 size.height() -
-                                 gui()->minimapview_wdg->height() - 10);
-    gui()->x_vote->move(width() / 2 - gui()->x_vote->width() / 2, 0);
-    gui()->update_sidebar_tooltips();
-    side_disable_endturn(get_turn_done_button_state());
-  }
-  event->setAccepted(true);
 }
 
 

Modified: trunk/client/gui-qt/mapview.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.h?rev=33819&r1=33818&r2=33819&view=diff
==============================================================================
--- trunk/client/gui-qt/mapview.h       (original)
+++ trunk/client/gui-qt/mapview.h       Fri Sep 16 12:09:31 2016
@@ -137,7 +137,6 @@
   void mouseMoveEvent(QMouseEvent *event);
   void focusOutEvent(QFocusEvent *event);
   void leaveEvent(QEvent *event);
-  void resizeEvent(QResizeEvent *event);
 private slots:
   void timer_event();
 private:

Modified: trunk/client/gui-qt/sidebar.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/sidebar.cpp?rev=33819&r1=33818&r2=33819&view=diff
==============================================================================
--- trunk/client/gui-qt/sidebar.cpp     (original)
+++ trunk/client/gui-qt/sidebar.cpp     Fri Sep 16 12:09:31 2016
@@ -434,7 +434,7 @@
   layout = new QVBoxLayout;
   layout->setContentsMargins(0, 0, 0, 0);
   setLayout(layout);
-  setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
+  setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Ignored);
 }
 
 /***************************************************************************
@@ -483,13 +483,13 @@
 **************************************************************************/
 void fc_sidebar::resize_me(int wdth, int hght)
 {
-  int w, h, non_std, non_std_count;;
+  int w, h, non_std, non_std_count;
   w = wdth / 10;
   h = hght;
   w = qMin(100, w);
 
-  if (qAbs(width() - w) > 2) {
-    setFixedWidth(w);
+  if (w == width() && h == height()) {
+    return;
   }
 
   if (sidebar_img) {
@@ -513,7 +513,7 @@
   }
 
   h = h - non_std;
-  h = h / (objects.count() - non_std_count) - 7;
+  h = h / (objects.count() - non_std_count) - 2;
   /* resize all standard sidewidgets */
   foreach (fc_sidewidget * sw,  objects) {
     if (sw->standard == SW_STD) {

Modified: trunk/client/gui-qt/sidebar.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/sidebar.h?rev=33819&r1=33818&r2=33819&view=diff
==============================================================================
--- trunk/client/gui-qt/sidebar.h       (original)
+++ trunk/client/gui-qt/sidebar.h       Fri Sep 16 12:09:31 2016
@@ -117,4 +117,5 @@
 };
 
 
-#endif /* FC__SIDEBAR_H */
+#endif /* FC__SIDEBAR_H */
+


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

Reply via email to