Author: mir3x Date: Thu Nov 17 10:13:56 2016 New Revision: 34537 URL: http://svn.gna.org/viewcvs/freeciv?rev=34537&view=rev Log: Qt client - remembered minimap postion and width
See patch #7989 Modified: trunk/client/gui-qt/fc_client.cpp trunk/client/gui-qt/fc_client.h trunk/client/gui-qt/mapview.cpp trunk/client/gui-qt/mapview.h trunk/client/gui-qt/menu.cpp trunk/client/gui-qt/menu.h Modified: trunk/client/gui-qt/fc_client.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.cpp?rev=34537&r1=34536&r2=34537&view=diff ============================================================================== --- trunk/client/gui-qt/fc_client.cpp (original) +++ trunk/client/gui-qt/fc_client.cpp Thu Nov 17 10:13:56 2016 @@ -607,6 +607,27 @@ } else { qt_settings.unit_info_pos_y = 0; } + if (s.contains("minimap_x")) { + qt_settings.minimap_x = s.value("minimap_x").toFloat(); + } else { + qt_settings.minimap_x = 0.84; + } + if (s.contains("minimap_y")) { + qt_settings.minimap_y = s.value("minimap_y").toFloat(); + } else { + qt_settings.minimap_y = 0.79; + } + if (s.contains("minimap_width")) { + qt_settings.minimap_width = s.value("minimap_width").toFloat(); + } else { + qt_settings.minimap_width = 0.15; + } + if (s.contains("minimap_height")) { + qt_settings.minimap_height = s.value("minimap_height").toFloat(); + } else { + qt_settings.minimap_height = 0.2; + } + if (s.contains("City-dialog")) { qt_settings.city_geometry = s.value("City-dialog").toByteArray(); } @@ -645,6 +666,10 @@ s.setValue("splitter3", qt_settings.city_splitter3); s.setValue("unit_x", qt_settings.unit_info_pos_x); s.setValue("unit_y", qt_settings.unit_info_pos_y); + s.setValue("minimap_x", qt_settings.minimap_x); + s.setValue("minimap_y", qt_settings.minimap_y); + s.setValue("minimap_width", qt_settings.minimap_width); + s.setValue("minimap_height", qt_settings.minimap_height); write_shortcuts(); } @@ -914,10 +939,14 @@ (size.height() * gui()->qt_settings.chat_y_pos) /10000 - 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()->minimapview_wdg->move(gui()->qt_settings.minimap_x + * mapview.width, + gui()->qt_settings.minimap_y + * mapview.height); + gui()->minimapview_wdg->resize(gui()->qt_settings.minimap_width + * mapview.width, + gui()->qt_settings.minimap_height + * mapview.height); gui()->x_vote->move(width() / 2 - gui()->x_vote->width() / 2, 0); gui()->update_sidebar_tooltips(); side_disable_endturn(get_turn_done_button_state()); Modified: trunk/client/gui-qt/fc_client.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/fc_client.h?rev=34537&r1=34536&r2=34537&view=diff ============================================================================== --- trunk/client/gui-qt/fc_client.h (original) +++ trunk/client/gui-qt/fc_client.h Thu Nov 17 10:13:56 2016 @@ -136,6 +136,10 @@ QByteArray city_splitter3; int unit_info_pos_x; int unit_info_pos_y; + float minimap_x; + float minimap_y; + float minimap_width; + float minimap_height; }; /**************************************************************************** Modified: trunk/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=34537&r1=34536&r2=34537&view=diff ============================================================================== --- trunk/client/gui-qt/mapview.cpp (original) +++ trunk/client/gui-qt/mapview.cpp Thu Nov 17 10:13:56 2016 @@ -511,8 +511,6 @@ setCursor(Qt::CrossCursor); rw = new resize_widget(this); rw->put_to_corner(); - cw = new close_widget(this); - cw->put_to_corner(); pix = new QPixmap; scale_factor = 1.0; } @@ -782,7 +780,6 @@ painter->drawRect(0, 0, width() - 1, height() - 1); draw_viewport(painter); rw->put_to_corner(); - cw->put_to_corner(); } /**************************************************************************** @@ -793,9 +790,14 @@ QSize size; size = event->size(); - if (C_S_RUNNING <= client_state()) { + if (C_S_RUNNING <= client_state() && size.width() > 0 + && size.height() > 0) { w_ratio = static_cast<float>(width()) / gui_options.overview.width; h_ratio = static_cast<float>(height()) / gui_options.overview.height; + gui()->qt_settings.minimap_width = static_cast<float>(size.width()) + / mapview.width; + gui()->qt_settings.minimap_height = static_cast<float>(size.height()) + / mapview.height; } update_image(); } @@ -877,8 +879,15 @@ return; } if (event->buttons() & Qt::LeftButton) { + QPoint p, r; + p = event->pos(); + r = mapTo(gui()->mapview_wdg, p); + p = r - p; move(event->globalPos() - cursor); setCursor(Qt::SizeAllCursor); + gui()->qt_settings.minimap_x = static_cast<float>(p.x()) / mapview.width; + gui()->qt_settings.minimap_y = static_cast<float>(p.y()) + / mapview.height; } } @@ -1210,8 +1219,14 @@ void overview_size_changed(void) { gui()->minimapview_wdg->resize(0, 0); - gui()->minimapview_wdg->resize(gui()->mapview_wdg->width()/6, - gui()->mapview_wdg->height()/4); + gui()->minimapview_wdg->move(gui()->qt_settings.minimap_x + * mapview.width, + gui()->qt_settings.minimap_y + * mapview.height); + gui()->minimapview_wdg->resize(gui()->qt_settings.minimap_width + * mapview.width, + gui()->qt_settings.minimap_height + * mapview.height); } /************************************************************************** Modified: trunk/client/gui-qt/mapview.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.h?rev=34537&r1=34536&r2=34537&view=diff ============================================================================== --- trunk/client/gui-qt/mapview.h (original) +++ trunk/client/gui-qt/mapview.h Thu Nov 17 10:13:56 2016 @@ -219,7 +219,6 @@ void scale(double factor); void scale_point(int &x, int &y); void unscale_point(int &x, int &y); - close_widget *cw; double scale_factor; float w_ratio, h_ratio; QBrush background; Modified: trunk/client/gui-qt/menu.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=34537&r1=34536&r2=34537&view=diff ============================================================================== --- trunk/client/gui-qt/menu.cpp (original) +++ trunk/client/gui-qt/menu.cpp Thu Nov 17 10:13:56 2016 @@ -1020,11 +1020,12 @@ minimap_status->setChecked(true); connect(minimap_status, SIGNAL(triggered()), this, SLOT(slot_minimap_view())); - minimap_status = menu->addAction(_("Lock interface")); - minimap_status->setCheckable(true); - minimap_status->setShortcut(QKeySequence(shortcut_to_string( - fc_shortcuts::sc()->get_shortcut(SC_IFACE_LOCK)))); - minimap_status->setChecked(false); + lock_status = menu->addAction(_("Lock interface")); + lock_status->setCheckable(true); + lock_status->setShortcut(QKeySequence(shortcut_to_string( + fc_shortcuts::sc()->get_shortcut(SC_IFACE_LOCK)))); + lock_status->setChecked(false); + connect(lock_status, SIGNAL(triggered()), this, SLOT(slot_lock())); connect(minimap_status, SIGNAL(triggered()), this, SLOT(slot_lock())); menu->addSeparator(); act = menu->addAction(_("City Outlines")); @@ -2800,7 +2801,7 @@ *****************************************************************/ void mr_menu::slot_minimap_view() { - if (minimap_status->isChecked()){ + if (minimap_status->isChecked()) { ::gui()->minimapview_wdg->show(); } else { ::gui()->minimapview_wdg->hide(); Modified: trunk/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.h?rev=34537&r1=34536&r2=34537&view=diff ============================================================================== --- trunk/client/gui-qt/menu.h (original) +++ trunk/client/gui-qt/menu.h Thu Nov 17 10:13:56 2016 @@ -292,6 +292,7 @@ void execute_shortcut(int sid); QString shortcut_2_menustring(int sid); QAction *minimap_status; + QAction *lock_status; QAction *chat_status; QAction *messages_status; bool delayed_order; _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits