Author: mir3x Date: Mon Nov 16 19:47:58 2015 New Revision: 30626 URL: http://svn.gna.org/viewcvs/freeciv?rev=30626&view=rev Log: Added shortcuts on map view via mouse + modifier key(shift, ctrl, alt). Those shortcuts are the same like in gtk client, they allow to: Wake up sentries, Append focus unit, Quickselect a sea unit, Adjust workers, Quickselect a land unit, Copy/Paste Production.
See patch #6577 Modified: branches/S2_5/client/gui-qt/mapctrl.cpp branches/S2_5/client/gui-qt/mapview.cpp Modified: branches/S2_5/client/gui-qt/mapctrl.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapctrl.cpp?rev=30626&r1=30625&r2=30626&view=diff ============================================================================== --- branches/S2_5/client/gui-qt/mapctrl.cpp (original) +++ branches/S2_5/client/gui-qt/mapctrl.cpp Mon Nov 16 19:47:58 2015 @@ -167,13 +167,16 @@ **************************************************************************/ void map_view::mousePressEvent(QMouseEvent *event) { - struct tile *ptile = NULL; + struct tile *ptile = nullptr; + struct city *pcity = nullptr; bool alt; bool ctrl; + bool shft; QPoint pos; alt = false; ctrl = false; + shft = false; if (event->modifiers() & Qt::AltModifier) { alt = true; @@ -181,28 +184,59 @@ if (event->modifiers() & Qt::ControlModifier) { ctrl = true; } + if (event->modifiers() & Qt::ShiftModifier) { + shft = true; + } pos = gui()->mapview_wdg->mapFromGlobal(QCursor::pos()); - + ptile = canvas_pos_to_tile(pos.x(), pos.y()); + pcity = ptile ? tile_city(ptile) : NULL; + + /* Right Mouse Button pressed */ if (event->button() == Qt::RightButton) { - if (alt && ctrl){ - ptile = canvas_pos_to_tile(pos.x(), pos.y()); - if (ptile) { + if (alt && ctrl && ptile) { gui()->infotab->chtwdg->make_link(ptile); - } + /* <SHIFT + CONTROL> + RMB: Paste Production. */ + } else if (shft && ctrl && pcity != NULL) { + clipboard_paste_production(pcity); + /* <SHIFT> + RMB on city/unit: Copy Production. */ + } else if (shft && clipboard_copy_production(ptile)) { + /* <CONTROL> + RMB : Quickselect a land unit. */ + } else if (ctrl) { + action_button_pressed(event->pos().x(),event->pos().y(), SELECT_LAND); + /* <SHIFT> + <ALT> + RMB : Show/hide workers. */ + } else if (shft && alt) { + key_city_overlay(event->pos().x(), event->pos().y()); } else { - recenter_button_pressed(event->x(), event->y()); + recenter_button_pressed(event->pos().x(), event->pos().y()); } } /* Left Button */ if (event->button() == Qt::LeftButton) { - action_button_pressed(event->pos().x(), event->pos().y(), SELECT_POPUP); - } + /* <SHIFT> + <CONTROL> + LMB : Adjust workers. */ + if (shft && ctrl) { + adjust_workers_button_pressed(event->pos().x(), event->pos().y()); + /* <CONTROL> + LMB : Quickselect a sea unit. */ + } else if (ctrl) { + action_button_pressed(event->pos().x(), event->pos().y(), SELECT_SEA); + /* <SHIFT> + LMB: Append focus unit. */ + } else if (ptile && shft) { + action_button_pressed(event->pos().x(), event->pos().y(), + SELECT_APPEND); + } else { + action_button_pressed(event->pos().x(), event->pos().y(), SELECT_POPUP); + } + } + /* Middle Button */ if (event->button() == Qt::MiddleButton) { - ptile = canvas_pos_to_tile(pos.x(), pos.y()); - gui()->popup_tile_info(ptile); - } + /* <CONTROL> + MMB: Wake up sentries. */ + if (ctrl) { + wakeup_button_pressed(event->pos().x(), event->pos().y()); + } else { + gui()->popup_tile_info(ptile); + } + } } /************************************************************************** Modified: branches/S2_5/client/gui-qt/mapview.cpp URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=30626&r1=30625&r2=30626&view=diff ============================================================================== --- branches/S2_5/client/gui-qt/mapview.cpp (original) +++ branches/S2_5/client/gui-qt/mapview.cpp Mon Nov 16 19:47:58 2015 @@ -1083,6 +1083,7 @@ const struct sprite *sprite; int d; QSize delta; + QFontMetrics fm(this->font()); if (client_is_global_observer()) { return; @@ -1111,6 +1112,8 @@ "rates. Use mouse wheel to change them")); } + setMinimumHeight(fm.height() + 1 + client_research_sprite()->pm->height() + + get_tax_sprite(tileset, O_LUXURY)->pm->height() + 10); delta = gui()->mapview_wdg->size() - gui()->end_turn_rect->sizeHint(); move(delta.width(), delta.height()); } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits