Author: mir3x
Date: Sat Nov  7 17:30:13 2015
New Revision: 30464

URL: http://svn.gna.org/viewcvs/freeciv?rev=30464&view=rev
Log:
Fixed overview often not refreshed and viewport 
being badly positioned after changing view (eg. disconnecting 
and reconnecting, or observing someone else )

See bug #24027


Modified:
    branches/S2_6/client/gui-qt/fc_client.cpp
    branches/S2_6/client/gui-qt/mapctrl.cpp
    branches/S2_6/client/gui-qt/mapview.cpp
    branches/S2_6/client/gui-qt/mapview.h

Modified: branches/S2_6/client/gui-qt/fc_client.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/fc_client.cpp?rev=30464&r1=30463&r2=30464&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/fc_client.cpp   (original)
+++ branches/S2_6/client/gui-qt/fc_client.cpp   Sat Nov  7 17:30:13 2015
@@ -302,6 +302,8 @@
     center_on_something();
     voteinfo_gui_update();
     update_info_label();
+    minimapview_wdg->reset();
+    overview_size_changed();
     break;
   case PAGE_SCENARIO:
     update_scenarios_page();

Modified: branches/S2_6/client/gui-qt/mapctrl.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/mapctrl.cpp?rev=30464&r1=30463&r2=30464&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/mapctrl.cpp     (original)
+++ branches/S2_6/client/gui-qt/mapctrl.cpp     Sat Nov  7 17:30:13 2015
@@ -191,7 +191,6 @@
       }
     } else {
       recenter_button_pressed(event->x(), event->y());
-      ::gui()->minimapview_wdg->update_image();
     }
   }
 

Modified: branches/S2_6/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/mapview.cpp?rev=30464&r1=30463&r2=30464&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/mapview.cpp     (original)
+++ branches/S2_6/client/gui-qt/mapview.cpp     Sat Nov  7 17:30:13 2015
@@ -590,6 +590,13 @@
 
 }
 
+/**************************************************************************
+  Sets minimap scale to default
+**************************************************************************/
+void minimap_view::reset()
+{
+  scale_factor = 1;
+}
 
 /**************************************************************************
   Updates minimap's pixmap
@@ -1382,6 +1389,7 @@
     }
   }
   num_dirty_rects = 0;
+  gui()->minimapview_wdg->update_image();
 }
 
 /****************************************************************************
@@ -1485,8 +1493,8 @@
 ****************************************************************************/
 void get_overview_area_dimensions(int *width, int *height)
 {
-  *width = ::gui()->minimapview_wdg->width();
-  *height = ::gui()->minimapview_wdg->height();
+  *width = 0;
+  *height = 0;
 }
 
 /****************************************************************************
@@ -1501,6 +1509,7 @@
 {
   int map_width, map_height, over_width, over_height, ow, oh, oldx, oldy;
   float ratio;
+
   map_width = gui()->mapview_wdg->width();
   map_height = gui()->mapview_wdg->height();
   over_width = 2 * gui_options.overview.width;
@@ -1533,6 +1542,8 @@
   if (over_height < 48) {
     over_height = 48;
   }
+  /* Magic trick here */
+  gui()->minimapview_wdg->resize(0, 0);
   gui()->minimapview_wdg->resize(over_width, over_height);
   gui()->minimapview_wdg->move(oldx - over_width, oldy - over_height);
 }

Modified: branches/S2_6/client/gui-qt/mapview.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/mapview.h?rev=30464&r1=30463&r2=30464&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/mapview.h       (original)
+++ branches/S2_6/client/gui-qt/mapview.h       Sat Nov  7 17:30:13 2015
@@ -213,6 +213,7 @@
   void paint(QPainter * painter, QPaintEvent * event);
   virtual void update_menu();
   void update_image();
+  void reset();
 
 protected:
   void paintEvent(QPaintEvent * event);


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

Reply via email to