19#include <QApplication>
60 _(
"Build New City"), suggestname);
61 ask->setAttribute(Qt::WA_DeleteOnClose);
62 QObject::connect(ask, &hud_input_box::finished, [=](
int result) {
63 if (result == QDialog::Accepted) {
94 QPoint global_pos, local_pos;
97 global_pos = QCursor::pos();
98 local_pos =
gui()->mapview_wdg->mapFromGlobal(global_pos);
121 Qt::KeyboardModifiers key_mod = QApplication::keyboardModifiers();
122 bool is_shift = key_mod.testFlag(Qt::ShiftModifier);
126 switch (
event->key()) {
136 switch (
event->key()) {
157 gui()->mapview_wdg->height() / 2);
166 gui()->mapview_wdg->height());
175 case Qt::Key_PageDown:
193 if (
gui()->infotab->chat_maximized) {
194 gui()->infotab->restore_chat();
199 if (!
gui()->infotab->chat_maximized) {
200 gui()->infotab->maximize_chat();
201 gui()->infotab->chtwdg->chat_line->setFocus();
220 Qt::KeyboardModifiers md;
222 struct tile *ctile =
nullptr;
223 struct city *pcity =
nullptr;
225 md = QApplication::keyboardModifiers();
226 bt = QApplication::mouseButtons();
227 pos = mapFromGlobal(QCursor::pos());
230 pcity = ctile ?
tile_city(ctile) :
nullptr;
238 if (bt == sc->
mouse && md == sc->
mod
239 &&
gui()->trade_gen.hover_city) {
241 gui()->trade_gen.add_tile(ctile);
242 gui()->mapview_wdg->repaint();
248 if (bt == sc->
mouse && md == sc->
mod
249 &&
gui()->rallies.hover_city) {
256 gui()->rallies.hover_tile =
true;
257 gui()->rallies.rally_city = rcity;
260 _(
"Selected city %s. Now choose rally point."),
271 if (bt == Qt::LeftButton &&
gui()->rallies.hover_tile && ctile != NULL) {
273 struct city *rcity =
gui()->rallies.rally_city;
279 _(
"Tile %s set as rally point from city %s."),
284 _(
"Could not set rally point for city %s."),
289 gui()->rallies.rally_city = NULL;
290 gui()->rallies.hover_tile =
false;
295 if (bt == Qt::LeftButton &&
gui()->menu_bar->delayed_order) {
297 gui()->menu_bar->set_tile_for_order(ctile);
300 gui()->menu_bar->delayed_order =
false;
305 if (bt == Qt::LeftButton &&
gui()->infotab->chat_maximized) {
306 gui()->infotab->restore_chat();
308 if (bt == Qt::LeftButton &&
gui()->menu_bar->quick_airlifting) {
318 gui()->menu_bar->quick_airlifting =
false;
324 if (!
gui()->menu_bar->delayed_order) {
326 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod
327 && pcity !=
nullptr) {
335 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod
336 && ctile !=
nullptr && unit_list_size(ctile->
units) > 0) {
337 gui()->toggle_unit_sel_widget(ctile);
343 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod
344 && ctile !=
nullptr) {
351 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod
352 &&
gui()->battlelog_wdg !=
nullptr) {
353 gui()->battlelog_wdg->show();
359 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod
360 && pcity !=
nullptr) {
367 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod) {
374 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod) {
375 QPixmapCache::clear();
382 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod) {
389 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod) {
396 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod) {
403 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod
404 && ctile !=
nullptr) {
405 gui()->infotab->chtwdg->make_link(ctile);
411 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod
412 && pcity !=
nullptr) {
419 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod
420 && pcity !=
nullptr) {
428 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod) {
435 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod) {
444 if ((((key && key == sc->
key) || (bt == sc->
mouse
454 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod) {
465 if (((key && key == sc->
key) || bt == sc->
mouse)
466 && md == sc->
mod && ctile !=
nullptr) {
467 gui()->popup_tile_info(ctile);
473 if (((key && key == sc->
key) || bt == sc->
mouse) && md == sc->
mod) {
487 Qt::KeyboardModifiers md;
488 md = QApplication::keyboardModifiers();
489 pos = mapFromGlobal(QCursor::pos());
492 if (bt == sc->
mouse && md == sc->
mod) {
493 gui()->popdown_tile_info();
498 if (bt == sc->
mouse && md == sc->
mod) {
499 if (
gui()->trade_gen.hover_city
500 ||
gui()->rallies.hover_city) {
501 gui()->trade_gen.hover_city =
false;
502 gui()->rallies.hover_city =
false;
void output_window_append(const struct ft_color color, const char *featured_text)
int city_buy_production(struct city *pcity)
info_tile * info_tile_wdg
void popup_tile_info(struct tile *ptile)
static fc_shortcuts * sc()
fc_shortcut * get_shortcut(shortcut_id id)
void keyPressEvent(QKeyEvent *event)
void mouseMoveEvent(QMouseEvent *event)
void mousePressEvent(QMouseEvent *event)
void mouseReleaseEvent(QMouseEvent *event)
void shortcut_released(Qt::MouseButton mb)
void shortcut_pressed(int key)
enum client_states client_state(void)
enum known_type client_tile_get_known(const struct tile *ptile)
void key_recall_previous_focus_unit(void)
void key_cancel_action(void)
void clear_hover_state(void)
void key_unit_move(enum direction8 gui_dir)
enum cursor_hover_state hover_state
void finish_city(struct tile *ptile, const char *name)
struct unit * find_visible_unit(struct tile *ptile)
void control_mouse_cursor(struct tile *ptile)
void cancel_city(struct tile *ptile)
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
const char * tile_link(const struct tile *ptile)
const struct ft_color ftc_client
const char * city_link(const struct city *pcity)
void exit_goto_state(void)
bool goto_is_active(void)
bool send_rally_tile(struct city *pcity, struct tile *ptile, bool persistent)
#define fc_assert_ret(condition)
void qreload_lua_script()
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
void popup_newcity_dialog(struct unit *punit, const char *suggestname)
int city_buy_production(struct city *pcity)
void create_line_at_mouse_pos(void)
void set_turn_done_button_state(bool state)
void side_disable_endturn(bool do_restore)
void update_rect_at_mouse_pos(void)
void update_turn_done_tooltip(void)
void qreload_lua_script()
void update_line(int canvas_x, int canvas_y)
void maybe_activate_keyboardless_goto(int canvas_x, int canvas_y)
void adjust_workers_button_pressed(int canvas_x, int canvas_y)
void release_goto_button(int canvas_x, int canvas_y)
void recenter_button_pressed(int canvas_x, int canvas_y)
void action_button_pressed(int canvas_x, int canvas_y, enum quickselect_type qtype)
void wakeup_button_pressed(int canvas_x, int canvas_y)
bool keyboardless_goto_button_down
void key_city_overlay(int canvas_x, int canvas_y)
bool keyboardless_goto_active
void clipboard_paste_production(struct city *pcity)
bool clipboard_copy_production(struct tile *ptile)
void mapdeco_set_crosshair(const struct tile *ptile, bool crosshair)
struct tile * canvas_pos_to_tile(float canvas_x, float canvas_y, float zoom)
void mapdeco_set_gotoroute(const struct unit *punit)
void mapdeco_clear_gotoroutes(void)
void mapdeco_clear_crosshairs(void)
struct client_options gui_options
char gui_qt_default_theme_name[512]
Qt::KeyboardModifiers mod
int fc_snprintf(char *str, size_t n, const char *format,...)
struct city * tile_city(const struct tile *ptile)
const char * tileset_basename(const struct tileset *t)
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
bool unit_has_orders(const struct unit *punit)