Freeciv-3.3: /fast/freeciv/nightly/main/client/gui-qt/fc_client.cpp Source File

Freeciv-3.3

Loading...
Searching...
No Matches
fc_client.cpp
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996-2005 - Freeciv Development Team
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18// Qt
19#include <QApplication>
20#include <QComboBox>
21#include <QFormLayout>
22#include <QLineEdit>
23#include <QMainWindow>
24#include <QPainter>
25#include <QResizeEvent>
26#include <QScrollBar>
27#include <QSettings>
28#include <QSocketNotifier>
29#include <QSpinBox>
30#include <QStackedLayout>
31#include <QStandardPaths>
32#include <QStatusBar>
33#include <QStyleFactory>
34#include <QTabBar>
35#include <QTextBlock>
36
37#ifdef FC_QT5_MODE
38#include <QTextCodec>
39#endif // FC_QT5_MODE
40
41#include <QTextEdit>
42
43// common
44#include "game.h"
45
46// client
47#include "connectdlg_common.h"
48
49// gui-qt
50#include "fc_client.h"
51#include "fonts.h"
52#include "gui_main.h"
53#include "optiondlg.h"
54#include "sidebar.h"
55#include "sprite.h"
56
57 fc_icons* fc_icons::m_instance = 0;
58 fc_font* fc_font::m_instance = 0;
59extern "C" {
60 bool get_turn_done_button_state();
61}
62extern void write_shortcuts();
63
64 QString current_theme;
65
66/************************************************************************/
69fc_client::fc_client() : QMainWindow()
70{
71 QString wtitle;
72
73#ifdef FC_QT5_MODE
74 QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
75#endif // FC_QT5_MODE
76
84 main_wdg = nullptr;
85 connect_lan = nullptr;
86 connect_metaserver = nullptr;
87 central_layout = nullptr;
88 output_window = nullptr;
89 scenarios_view = nullptr;
90 connect_host_edit = nullptr;
91 connect_port_edit = nullptr;
92 connect_login_edit = nullptr;
93 connect_password_edit = nullptr;
94 connect_confirm_password_edit = nullptr;
95 button = nullptr;
96 button_box = nullptr;
97 server_notifier = nullptr;
98 chat_line = nullptr;
99 lan_widget = nullptr;
100 wan_widget = nullptr;
101 info_widget = nullptr;
102 saves_load = nullptr;
103 scenarios_load = nullptr;
104 meta_scan_timer = nullptr;
105 lan_scan_timer = nullptr;
106 status_bar = nullptr;
107 status_bar_label = nullptr;
108 menu_bar = nullptr;
109 mapview_wdg = nullptr;
110 sidebar_wdg = nullptr;
111 msgwdg = nullptr;
112 infotab = nullptr;
113 central_wdg = nullptr;
114 game_tab_widget = nullptr;
115 start_players_tree = nullptr;
116 unit_sel = nullptr;
117 info_tile_wdg = nullptr;
118 opened_dialog = nullptr;
119 current_file = "";
120 status_bar_queue.clear();
121 quitting = false;
122 pre_vote = nullptr;
123 x_vote = nullptr;
124 gtd = nullptr;
125 update_info_timer = nullptr;
126 unitinfo_wdg = nullptr;
127 battlelog_wdg = nullptr;
128 interface_locked = false;
129 map_scale = 1.0f;
130 map_font_scale = true;
131 for (int i = 0; i <= PAGE_GAME; i++) {
132 pages_layout[i] = nullptr;
133 pages[i] = nullptr;
134 }
135
136 wtitle = _("Freeciv (%1)");
137 wtitle = wtitle.arg(
138#ifdef FC_QT6X_MODE
139 "Qt6x"
140#elif FC_QT5_MODE
141 "Qt5"
142#else // FC_QT6X_MODE
143 "Qt6"
144#endif // FC_QT6X_MODE
145 );
146
147 setWindowTitle(wtitle);
148
149 init();
150}
151
152/************************************************************************/
155 void fc_client::init()
156{
157 fc_font::instance()->init_fonts();
158 read_settings();
159 QApplication::setFont(*fc_font::instance()->get_font(fonts::default_font));
160 QString path;
161 central_wdg = new QWidget;
162 central_layout = new QStackedLayout;
163
164 // General part not related to any single page
165 menu_bar = new mr_menu();
166 if (!gui_options.gui_qt_show_titlebar) {
167 corner_wid = new fc_corner(this);
168 menu_bar->setCornerWidget(corner_wid);
169 }
170 setMenuBar(menu_bar);
171 status_bar = statusBar();
172 status_bar_label = new QLabel;
173 status_bar_label->setAlignment(Qt::AlignCenter);
174 status_bar->addWidget(status_bar_label, 1);
175 set_status_bar(_("Welcome to Freeciv"));
176 create_cursors();
177
178 // PAGE_MAIN
179 pages[PAGE_MAIN] = new QWidget(central_wdg);
180 page = PAGE_MAIN;
181 create_main_page();
182
183 // PAGE_START
184 pages[PAGE_START] = new QWidget(central_wdg);
185 create_start_page();
186
187 // PAGE_SCENARIO
188 pages[PAGE_SCENARIO] = new QWidget(central_wdg);
189 create_scenario_page();
190
191 // PAGE_LOAD
192 pages[PAGE_LOAD] = new QWidget(central_wdg);
193 create_load_page();
194
195 // PAGE_NETWORK
196 pages[PAGE_NETWORK] = new QWidget(central_wdg);
197 create_network_page();
198 pages[PAGE_NETWORK]->setVisible(false);
199
200 // PAGE_GAME
201 gui_options.gui_qt_allied_chat_only = true;
202 path = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
203 if (!path.isEmpty()) {
204 QSettings::setPath(QSettings::NativeFormat, QSettings::UserScope, path);
205 }
206 pages[PAGE_GAME] = new QWidget(central_wdg);
207 init_mapcanvas_and_overview();
208 create_game_page();
209
210 pages[PAGE_GAME + 1] = new QWidget(central_wdg);
211 create_loading_page();
212
213 pages_layout[PAGE_GAME]->setContentsMargins(0, 0, 0, 0);
214
215 pages[PAGE_MAIN]->setLayout(pages_layout[PAGE_MAIN]);
216 pages[PAGE_NETWORK]->setLayout(pages_layout[PAGE_NETWORK]);
217 pages[PAGE_LOAD]->setLayout(pages_layout[PAGE_LOAD]);
218 pages[PAGE_SCENARIO]->setLayout(pages_layout[PAGE_SCENARIO]);
219 pages[PAGE_START]->setLayout(pages_layout[PAGE_START]);
220 pages[PAGE_GAME]->setLayout(pages_layout[PAGE_GAME]);
221 pages[PAGE_GAME + 1]->setLayout(pages_layout[PAGE_GAME + 1]);
222
223 central_layout->addWidget(pages[PAGE_MAIN]);
224 central_layout->addWidget(pages[PAGE_NETWORK]);
225 central_layout->addWidget(pages[PAGE_LOAD]);
226 central_layout->addWidget(pages[PAGE_SCENARIO]);
227 central_layout->addWidget(pages[PAGE_START]);
228 central_layout->addWidget(pages[PAGE_GAME]);
229 central_layout->addWidget(pages[PAGE_GAME + 1]);
230
231 central_wdg->setLayout(central_layout);
232 setCentralWidget(central_wdg);
233
234 resize(pages[PAGE_MAIN]->minimumSizeHint());
235 setVisible(true);
236
237 game_tab_widget->init();
238 chat_listener::listen();
239
240 QPixmapCache::setCacheLimit(80000);
241}
242
243/************************************************************************/
246fc_client::~fc_client()
247{
248 status_bar_queue.clear();
249 if (fc_shortcuts::sc()) {
250 delete fc_shortcuts::sc();
251 }
252 delete_cursors();
253}
254
255
256/************************************************************************/
262 void fc_client::fc_main(QApplication *qapp)
263{
264 qRegisterMetaType<QTextCursor>("QTextCursor");
265 qRegisterMetaType<QTextBlock>("QTextBlock");
266 fc_allocate_ow_mutex();
267 real_output_window_append(_("This is Qt-client for Freeciv."), nullptr, -1);
268 fc_release_ow_mutex();
269 chat_welcome_message(true);
270
271 set_client_state(C_S_DISCONNECTED);
272
273 startTimer(TIMER_INTERVAL);
274 connect(qapp, &QCoreApplication::aboutToQuit, this, &fc_client::closing);
275 qapp->exec();
276
277 free_mapcanvas_and_overview();
278 tileset_free_tiles(tileset);
279}
280
281/************************************************************************/
284 bool fc_client::is_closing()
285{
286 return quitting;
287}
288
289/************************************************************************/
292 void fc_client::closing()
293{
294 quitting = true;
295}
296
297/************************************************************************/
300 void fc_client::send_fake_chat_message(const QString &message)
301{
302 send_chat_message(message);
303}
304
305/************************************************************************/
308 void fc_client::chat_message_received(const QString &message,
309 const struct text_tag_list *tags)
310{
311 QTextCursor cursor;
312 QColor col = output_window->palette().color(QPalette::Text);
313 QString str = apply_tags(message, tags, col);
314
315 if (output_window != nullptr) {
316 output_window->append(str);
317 output_window->verticalScrollBar()->setSliderPosition(
318 output_window->verticalScrollBar()->maximum());
319 }
320}
321
322/************************************************************************/
325 bool fc_client::chat_active_on_page(enum client_pages check)
326{
327 if (check == PAGE_START || check == PAGE_GAME) {
328 return true;
329 }
330
331 return false;
332}
333
334/************************************************************************/
340 void fc_client::switch_page(int new_pg)
341{
342 char buf[256];
343 enum client_pages new_page;
344 int i_page;
345
346 new_page = static_cast< client_pages>(new_pg);
347
348 if ((new_page == PAGE_SCENARIO || new_page == PAGE_LOAD)
349 && !is_server_running()) {
350 current_file = "";
351 client_start_server_and_set_page(new_page);
352 return;
353 }
354
355 if (page == PAGE_NETWORK) {
356 destroy_server_scans();
357 }
358 menuBar()->setVisible(false);
359 if (status_bar != nullptr) {
360 status_bar->setVisible(true);
361 }
362 QApplication::alert(gui()->central_wdg);
363 central_layout->setCurrentWidget(pages[new_pg]);
364 page = new_page;
365 i_page = new_page;
366 switch (i_page) {
367 case PAGE_MAIN:
368 break;
369 case PAGE_START:
370 pre_vote->hide();
371 voteinfo_gui_update();
372 break;
373 case PAGE_LOAD:
374 update_load_page();
375 break;
376 case PAGE_GAME:
377 if (!gui_options.gui_qt_show_titlebar) {
378 setWindowFlags(Qt::Window | Qt::CustomizeWindowHint);
379 }
380 showMaximized();
381 // For MS Windows, it might ignore first
382 showMaximized();
383 gui()->infotab->chtwdg->update_widgets();
384 status_bar->setVisible(false);
385
386 if (gui_options.gui_qt_fullscreen) {
387 apply_fullscreen();
388 }
389
390 menuBar()->setVisible(true);
391 mapview_wdg->setFocus();
392 center_on_something();
393 voteinfo_gui_update();
394 update_info_label();
395 minimapview_wdg->reset();
396 overview_size_changed();
397 update_sidebar_tooltips();
398 qtg_real_science_report_dialog_update(nullptr);
399 show_new_turn_info();
400 break;
401 case PAGE_SCENARIO:
402 update_scenarios_page();
403 break;
404 case PAGE_NETWORK:
405 update_network_lists();
406 set_connection_state(LOGIN_TYPE);
407 connect_host_edit->setText(server_host);
408 fc_snprintf(buf, sizeof(buf), "%d", server_port);
409 connect_port_edit->setText(buf);
410 connect_login_edit->setText(user_name);
411 connect_password_edit->setDisabled(true);
412 connect_confirm_password_edit->setDisabled(true);
413 break;
414 case (PAGE_GAME + 1):
415 break;
416 default:
417 if (client.conn.used) {
418 disconnect_from_server(TRUE);
419 }
420 set_client_page(PAGE_MAIN);
421 break;
422 }
423}
424
425/************************************************************************/
428 void fc_client::apply_fullscreen()
429{
430 if (gui_options.gui_qt_fullscreen) {
431 gui()->showFullScreen();
432 gui()->game_tab_widget->showFullScreen();
433 } else {
434 // FIXME: Doesn't return properly, probably something with sidebar
435 gui()->showNormal();
436 gui()->game_tab_widget->showNormal();
437 }
438}
439
440/************************************************************************/
443 enum client_pages fc_client::current_page()
444{
445 return page;
446}
447
448/************************************************************************/
451 void fc_client::add_server_source(int sock)
452{
453 server_notifier = new QSocketNotifier(sock, QSocketNotifier::Read);
454
455 connect(server_notifier, &QSocketNotifier::activated, this,
456 &fc_client::server_input);
457}
458
459/************************************************************************/
462 void fc_client::update_fonts()
463{
464 sidebar_wdg->update_fonts();
465}
466
467/************************************************************************/
470 bool fc_client::event(QEvent *event)
471{
472 if (event->type() == QEvent::User) {
473 version_message_event vmevt =
474 dynamic_cast< version_message_event&>(*event);
475 set_status_bar(vmevt.get_message());
476 return true;
477 } else {
478 return QMainWindow::event(event);
479 }
480}
481
482/************************************************************************/
485 void fc_client::closeEvent(QCloseEvent *event)
486{
487 if (!is_client_quitting()) {
488 popup_quit_dialog();
489 event->ignore();
490 }
491}
492
493/************************************************************************/
496 void fc_client::remove_server_source()
497{
498 server_notifier->deleteLater();
499}
500
501/************************************************************************/
504 void fc_client::server_input(int sock)
505{
506 server_notifier->setEnabled(false);
507 input_from_server(sock);
508 server_notifier->setEnabled(true);
509}
510
511/************************************************************************/
514 void fc_client::timerEvent(QTimerEvent *event)
515{
516 // Prevent current timer from repeating with possibly wrong interval
517 killTimer(event->timerId());
518
519 // Call timer callback in client common code and
520 // start new timer with correct interval
521 startTimer(real_timer_callback() * 1000);
522}
523
524/************************************************************************/
527 void fc_client::quit()
528{
529 QApplication *qapp = current_app();
530
531 if (qapp != nullptr) {
532 qapp->quit();
533 }
534}
535
536/************************************************************************/
539 void fc_client::slot_disconnect()
540{
541 if (client.conn.used) {
542 disconnect_from_server(TRUE);
543 }
544
545 switch_page(PAGE_MAIN);
546}
547
548/************************************************************************/
551 void fc_client::slot_pregame_observe()
552{
553 if (client_is_observer() || client_is_global_observer()) {
554 if (game.info.is_new_game) {
555 send_chat("/take -");
556 } else {
557 send_chat("/detach");
558 }
559 obs_button->setText(_("Don't Observe"));
560 } else {
561 send_chat("/observe");
562 obs_button->setText(_("Observe"));
563 }
564}
565
566/************************************************************************/
569 void fc_client::slot_pregame_start()
570{
571 if (can_client_control()) {
572 dsend_packet_player_ready(&client.conn,
573 player_number(client_player()),
574 !client_player()->is_ready);
575 } else {
576 dsend_packet_player_ready(&client.conn, 0, TRUE);
577 }
578}
579
580/****************************************************************************
581 Deletes cursors
582****************************************************************************/
583 void fc_client::delete_cursors(void)
584{
585 int frame;
586 int cursor;
587
588 for (cursor = 0; cursor < CURSOR_LAST; cursor++) {
589 for (frame = 0; frame < NUM_CURSOR_FRAMES; frame++) {
590 delete fc_cursors[cursor][frame];
591 }
592 }
593}
594
595
596/************************************************************************/
599 void fc_client::gimme_place(QWidget *widget, QString str)
600{
601 QString x;
602
603 x = opened_repo_dlgs.key(widget);
604
605 if (x.isEmpty()) {
606 opened_repo_dlgs.insert(str, widget);
607 return;
608 }
609 log_error("Failed to find place for new tab widget");
610 return;
611}
612
613/************************************************************************/
618 bool fc_client::is_repo_dlg_open(QString str)
619{
620 QWidget *w;
621
622 w = opened_repo_dlgs.value(str);
623
624 if (w == nullptr) {
625 return false;
626 }
627
628 return true;
629}
630
631/************************************************************************/
634 int fc_client::gimme_index_of(QString str)
635{
636 int i;
637 QWidget *w;
638
639 if (str == "MAP") {
640 return 0;
641 }
642
643 w = opened_repo_dlgs.value(str);
644 i = game_tab_widget->indexOf(w);
645 return i;
646}
647
648/************************************************************************/
651 void fc_client::read_settings()
652{
653 // This can't be shared between freeciv versions as the content
654 // might be incompatible.
655 QString sname = "freeciv-qt-client-set-"
656 + QString::number(MAJOR_NEW_OPTION_FILE_NAME) + "."
657 + QString::number(MINOR_NEW_OPTION_FILE_NAME);
658 QSettings s(QSettings::IniFormat, QSettings::UserScope,
659 sname);
660
661 if (s.contains("Chat-fx-size")) {
662 qt_settings.chat_fwidth = s.value("Chat-fx-size").toFloat();
663 } else {
664 qt_settings.chat_fwidth = 0.2;
665 }
666 if (s.contains("Chat-fy-size")) {
667 qt_settings.chat_fheight = s.value("Chat-fy-size").toFloat();
668 } else {
669 qt_settings.chat_fheight = 0.4;
670 }
671 if (s.contains("Chat-fx-pos")) {
672 qt_settings.chat_fx_pos = s.value("Chat-fx-pos").toFloat();
673 } else {
674 qt_settings.chat_fx_pos = 0.0;
675 }
676 if (s.contains("Chat-fy-pos")) {
677 qt_settings.chat_fy_pos = s.value("Chat-fy-pos").toFloat();
678 } else {
679 qt_settings.chat_fy_pos = 0.6;
680 }
681 if (s.contains("unit_fx")) {
682 qt_settings.unit_info_pos_fx = s.value("unit_fx").toFloat();
683 } else {
684 qt_settings.unit_info_pos_fx = 0.33;
685 }
686 if (s.contains("unit_fy")) {
687 qt_settings.unit_info_pos_fy = s.value("unit_fy").toFloat();
688 } else {
689 qt_settings.unit_info_pos_fy = 0.88;
690 }
691 if (s.contains("minimap_x")) {
692 qt_settings.minimap_x = s.value("minimap_x").toFloat();
693 } else {
694 qt_settings.minimap_x = 0.84;
695 }
696 if (s.contains("minimap_y")) {
697 qt_settings.minimap_y = s.value("minimap_y").toFloat();
698 } else {
699 qt_settings.minimap_y = 0.79;
700 }
701 if (s.contains("minimap_width")) {
702 qt_settings.minimap_width = s.value("minimap_width").toFloat();
703 } else {
704 qt_settings.minimap_width = 0.15;
705 }
706 if (s.contains("minimap_height")) {
707 qt_settings.minimap_height = s.value("minimap_height").toFloat();
708 } else {
709 qt_settings.minimap_height = 0.2;
710 }
711 if (s.contains("battlelog_scale")) {
712 qt_settings.battlelog_scale = s.value("battlelog_scale").toFloat();
713 } else {
714 qt_settings.battlelog_scale = 1;
715 }
716
717 if (s.contains("City-dialog")) {
718 qt_settings.city_geometry = s.value("City-dialog").toByteArray();
719 }
720 if (s.contains("splitter1")) {
721 qt_settings.city_splitter1 = s.value("splitter1").toByteArray();
722 }
723 if (s.contains("splitter2")) {
724 qt_settings.city_splitter2 = s.value("splitter2").toByteArray();
725 }
726 if (s.contains("splitter3")) {
727 qt_settings.city_splitter3 = s.value("splitter3").toByteArray();
728 }
729 if (s.contains("help-dialog")) {
730 qt_settings.help_geometry = s.value("help-dialog").toByteArray();
731 }
732 if (s.contains("help_splitter1")) {
733 qt_settings.help_splitter1 = s.value("help_splitter1").toByteArray();
734 }
735 if (s.contains("opt-client-dialog")) {
736 qt_settings.options_client_geometry = s.value("opt-client-dialog").toByteArray();
737 }
738 if (s.contains("opt-server-dialog")) {
739 qt_settings.options_server_geometry = s.value("opt-server-dialog").toByteArray();
740 }
741 if (s.contains("new_turn_text")) {
742 qt_settings.show_new_turn_text = s.value("new_turn_text").toBool();
743 } else {
744 qt_settings.show_new_turn_text = true;
745 }
746 if (s.contains("show_battle_log")) {
747 qt_settings.show_battle_log = s.value("show_battle_log").toBool();
748 } else {
749 qt_settings.show_battle_log = false;
750 }
751 if (s.contains("battlelog_x")) {
752 qt_settings.battlelog_x = s.value("battlelog_x").toFloat();
753 } else {
754 qt_settings.battlelog_x = 0.0;
755 }
756 if (s.contains("minimap_y")) {
757 qt_settings.battlelog_y = s.value("battlelog_y").toFloat();
758 } else {
759 qt_settings.battlelog_y = 0.0;
760 }
761 qt_settings.player_repo_sort_col = -1;
762 qt_settings.city_repo_sort_col = -1;
763
764 if (qt_settings.chat_fx_pos < 0 || qt_settings.chat_fx_pos >= 1) {
765 qt_settings.chat_fx_pos = 0.0;
766 }
767 if (qt_settings.chat_fy_pos >= 1 || qt_settings.chat_fy_pos < 0) {
768 qt_settings.chat_fy_pos = 0.6;
769 }
770 if (qt_settings.chat_fwidth < 0.05 || qt_settings.chat_fwidth > 0.9) {
771 qt_settings.chat_fwidth = 0.2;
772 }
773 if (qt_settings.chat_fheight < 0.05 || qt_settings.chat_fheight > 0.9) {
774 qt_settings.chat_fheight = 0.33;
775 }
776 if (qt_settings.battlelog_x < 0.0) {
777 qt_settings.battlelog_x = 0.33;
778 }
779 if (qt_settings.battlelog_y < 0.0) {
780 qt_settings.battlelog_y = 0.0;
781 }
782 if (qt_settings.battlelog_scale > 5.0) {
783 qt_settings.battlelog_y = 5.0;
784 }
785 if (qt_settings.minimap_x < 0 || qt_settings.minimap_x > 1) {
786 qt_settings.chat_fx_pos = 0.84;
787 }
788 if (qt_settings.minimap_y < 0 || qt_settings.minimap_y > 1) {
789 qt_settings.chat_fx_pos = 0.79;
790 }
791}
792
793/************************************************************************/
796 void fc_client::write_settings()
797{
798 QString sname = "freeciv-qt-client-set-"
799 + QString::number(MAJOR_NEW_OPTION_FILE_NAME) + "."
800 + QString::number(MINOR_NEW_OPTION_FILE_NAME);
801 QSettings s(QSettings::IniFormat, QSettings::UserScope,
802 sname);
803
804 s.setValue("Chat-fx-size", qt_settings.chat_fwidth);
805 s.setValue("Chat-fy-size", qt_settings.chat_fheight);
806 s.setValue("Chat-fx-pos", qt_settings.chat_fx_pos);
807 s.setValue("Chat-fy-pos", qt_settings.chat_fy_pos);
808 s.setValue("City-dialog", qt_settings.city_geometry);
809 s.setValue("splitter1", qt_settings.city_splitter1);
810 s.setValue("splitter2", qt_settings.city_splitter2);
811 s.setValue("splitter3", qt_settings.city_splitter3);
812 s.setValue("help-dialog", qt_settings.help_geometry);
813 s.setValue("help_splitter1", qt_settings.help_splitter1);
814 s.setValue("opt-client-dialog", qt_settings.options_client_geometry);
815 s.setValue("opt-server-dialog", qt_settings.options_server_geometry);
816 s.setValue("unit_fx", qt_settings.unit_info_pos_fx);
817 s.setValue("unit_fy", qt_settings.unit_info_pos_fy);
818 s.setValue("minimap_x", qt_settings.minimap_x);
819 s.setValue("minimap_y", qt_settings.minimap_y);
820 s.setValue("minimap_width", qt_settings.minimap_width);
821 s.setValue("minimap_height", qt_settings.minimap_height);
822 s.setValue("battlelog_scale", qt_settings.battlelog_scale);
823 s.setValue("battlelog_x", qt_settings.battlelog_x);
824 s.setValue("battlelog_y", qt_settings.battlelog_y);
825 s.setValue("new_turn_text", qt_settings.show_new_turn_text);
826 s.setValue("show_battle_log", qt_settings.show_battle_log);
827 write_shortcuts();
828}
829
830/************************************************************************/
833 void fc_client::toggle_unit_sel_widget(struct tile *ptile)
834{
835 if (unit_sel != nullptr) {
836 unit_sel->close();
837 delete unit_sel;
838 unit_sel = new units_select(ptile, gui()->mapview_wdg);
839 unit_sel->show();
840 } else {
841 unit_sel = new units_select(ptile, gui()->mapview_wdg);
842 unit_sel->show();
843 }
844}
845
846/************************************************************************/
849 void fc_client::update_unit_sel()
850{
851 if (unit_sel != nullptr) {
852 unit_sel->update_units();
853 unit_sel->create_pixmap();
854 unit_sel->update();
855 }
856}
857
858/************************************************************************/
861 void fc_client::popdown_unit_sel()
862{
863 if (unit_sel != nullptr) {
864 unit_sel->close();
865 delete unit_sel;
866 unit_sel = nullptr;
867 }
868}
869
870/************************************************************************/
873 void fc_client::remove_repo_dlg(QString str)
874{
875 // If app is closing, opened_repo_dlg is already deleted */
876 if (!is_closing()) {
877 opened_repo_dlgs.remove(str);
878 }
879}
880
881/************************************************************************/
884 void fc_client::popup_client_options()
885{
886 option_dialog_popup(_("Set local options"), client_optset, true);
887}
888
889/************************************************************************/
892 void fc_client::create_cursors(void)
893{
894 enum cursor_type curs;
895 int cursor;
896 QPixmap *pix;
897 int hot_x, hot_y;
898 struct sprite *sprite;
899 int frame;
900 QCursor *c;
901 for (cursor = 0; cursor < CURSOR_LAST; cursor++) {
902 for (frame = 0; frame < NUM_CURSOR_FRAMES; frame++) {
903 curs = static_cast< cursor_type>(cursor);
904 sprite = get_cursor_sprite(tileset, curs, &hot_x, &hot_y, frame);
905 pix = sprite->pm;
906 c = new QCursor(*pix, hot_x, hot_y);
907 fc_cursors[cursor][frame] = c;
908 }
909 }
910}
911
912/************************************************************************/
915fc_corner::fc_corner(QMainWindow *qmw): QWidget()
916{
917 QHBoxLayout *hb;
918 QPushButton *qpb;
919 int h;
920 QFont *f = fc_font::instance()->get_font(fonts::default_font);
921
922 if (f->pointSize() > 0) {
923 h = f->pointSize();
924 } else {
925 h = f->pixelSize();
926 }
927 mw = qmw;
928 hb = new QHBoxLayout();
929 qpb = new QPushButton(fc_icons::instance()->get_icon("cmin"), "");
930 qpb->setFixedSize(h, h);
931 connect(qpb, &QAbstractButton::clicked, this, &fc_corner::minimize);
932 hb->addWidget(qpb);
933 qpb = new QPushButton(fc_icons::instance()->get_icon("cmax"), "");
934 qpb->setFixedSize(h, h);
935 connect(qpb, &QAbstractButton::clicked, this, &fc_corner::maximize);
936 hb->addWidget(qpb);
937 qpb = new QPushButton(fc_icons::instance()->get_icon("cclose"), "");
938 qpb->setFixedSize(h, h);
939 connect(qpb, &QAbstractButton::clicked, this, &fc_corner::close_fc);
940 hb->addWidget(qpb);
941 setLayout(hb);
942}
943
944/************************************************************************/
947 void fc_corner::close_fc()
948{
949 mw->close();
950}
951
952/************************************************************************/
955 void fc_corner::maximize()
956{
957 if (!mw->isMaximized()) {
958 mw->showMaximized();
959 } else {
960 mw->showNormal();
961 }
962}
963
964/************************************************************************/
967 void fc_corner::minimize()
968{
969 mw->showMinimized();
970}
971
972/************************************************************************/
975fc_game_tab_widget::fc_game_tab_widget(): QStackedWidget()
976{
977}
978
979/************************************************************************/
982 void fc_game_tab_widget::init()
983{
984 connect(this, &QStackedWidget::currentChanged, this, &fc_game_tab_widget::current_changed);
985}
986
987/************************************************************************/
990fc_icons::fc_icons()
991{
992}
993
994/************************************************************************/
997 fc_icons *fc_icons::instance()
998{
999 if (!m_instance) {
1000 m_instance = new fc_icons;
1001 }
1002 return m_instance;
1003}
1004
1005/************************************************************************/
1008 void fc_icons::drop()
1009{
1010 if (m_instance) {
1011 delete m_instance;
1012 m_instance = 0;
1013 }
1014}
1015
1016/************************************************************************/
1019 QIcon fc_icons::get_icon(const QString &id)
1020{
1021 QIcon icon;
1022 QString str;
1023 QByteArray pn_bytes;
1024 QByteArray png_bytes;
1025
1026 str = QString("themes") + DIR_SEPARATOR + "gui-qt" + DIR_SEPARATOR;
1027 // Try custom icon from theme
1028 pn_bytes = str.toUtf8();
1029 png_bytes = QString(pn_bytes.data() + current_theme + DIR_SEPARATOR
1030 + id + ".png").toUtf8();
1031 icon.addFile(fileinfoname(get_data_dirs(),
1032 png_bytes.data()));
1033 str = str + "icons" + DIR_SEPARATOR;
1034 // Try icon from icons dir
1035 if (icon.isNull()) {
1036 pn_bytes = str.toUtf8();
1037 png_bytes = QString(pn_bytes.data() + id + ".png").toUtf8();
1038 icon.addFile(fileinfoname(get_data_dirs(),
1039 png_bytes.data()));
1040 }
1041
1042 return QIcon(icon);
1043}
1044
1045/************************************************************************/
1048 QPixmap *fc_icons::get_pixmap(const QString &id)
1049{
1050 QPixmap *pm;
1051 bool status;
1052 QString str;
1053 QByteArray png_bytes;
1054
1055 pm = new QPixmap;
1056 if (QPixmapCache::find(id, pm)) {
1057 return pm;
1058 }
1059 str = QString("themes") + DIR_SEPARATOR + "gui-qt" + DIR_SEPARATOR;
1060 png_bytes = QString(str + current_theme + DIR_SEPARATOR
1061 + id + ".png").toUtf8();
1062 status = pm->load(fileinfoname(get_data_dirs(),
1063 png_bytes.data()));
1064
1065 if (!status) {
1066 str = str + "icons" + DIR_SEPARATOR;
1067 png_bytes = QString(str + id + ".png").toUtf8();
1068 pm->load(fileinfoname(get_data_dirs(), png_bytes.data()));
1069 }
1070 QPixmapCache::insert(id, *pm);
1071
1072 return pm;
1073}
1074
1075/************************************************************************/
1078 QString fc_icons::get_path(const QString &id)
1079{
1080 QString str;
1081 QByteArray png_bytes;
1082
1083 str = QString("themes") + DIR_SEPARATOR + "gui-qt"
1084 + DIR_SEPARATOR + "icons" + DIR_SEPARATOR;
1085 png_bytes = QString(str + id + ".png").toUtf8();
1086
1087 return fileinfoname(get_data_dirs(),
1088 png_bytes.data());
1089}
1090
1091/************************************************************************/
1094 void fc_game_tab_widget::resizeEvent(QResizeEvent *event)
1095{
1096 QSize size;
1097
1098 size = event->size();
1099 if (C_S_RUNNING <= client_state()) {
1100 gui()->sidebar_wdg->resize_me(size.height());
1101 map_canvas_resized(size.width(), size.height());
1102 gui()->infotab->resize(qRound((size.width()
1103 * gui()->qt_settings.chat_fwidth)),
1104 qRound((size.height()
1105 * gui()->qt_settings.chat_fheight)));
1106 gui()->infotab->move(qRound((size.width()
1107 * gui()->qt_settings.chat_fx_pos)),
1108 qRound((size.height()
1109 * gui()->qt_settings.chat_fy_pos)));
1110 gui()->infotab->restore_chat();
1111 gui()->minimapview_wdg->move(qRound(gui()->qt_settings.minimap_x
1112 * mapview.width),
1113 qRound(gui()->qt_settings.minimap_y
1114 * mapview.height));
1115 gui()->minimapview_wdg->resize(qRound(gui()->qt_settings.minimap_width
1116 * mapview.width),
1117 qRound(gui()->qt_settings.minimap_height
1118 * mapview.height));
1119 gui()->battlelog_wdg->set_scale(gui()->qt_settings.battlelog_scale);
1120 gui()->battlelog_wdg->move(qRound(gui()->qt_settings.battlelog_x
1121 * mapview.width),
1122 qRound(gui()->qt_settings.battlelog_y
1123 * mapview.height));
1124 gui()->x_vote->move(width() / 2 - gui()->x_vote->width() / 2, 0);
1125 gui()->update_sidebar_tooltips();
1126 side_disable_endturn(get_turn_done_button_state());
1127 gui()->mapview_wdg->resize(event->size().width(),size.height());
1128 gui()->unitinfo_wdg->update_actions(nullptr);
1129 }
1130 event->setAccepted(true);
1131}
1132
1133/************************************************************************/
1136 void fc_game_tab_widget::current_changed(int index)
1137{
1138 QList<fc_sidewidget*> objs;
1139 fc_sidewidget *sw;
1140
1141 if (gui()->is_closing()) {
1142 return;
1143 }
1144 objs = gui()->sidebar_wdg->objects;
1145
1146 foreach(sw, objs) {
1147 sw->update_final_pixmap();
1148 }
1149 currentWidget()->hide();
1150 widget(index)->show();
1151
1152 // Set focus to map instead sidebar
1153 if (gui()->mapview_wdg && gui()->current_page() == PAGE_GAME
1154 && index == 0) {
1155 gui()->mapview_wdg->setFocus();
1156 }
1157
1158}
1159
1160/************************************************************************/
1163pregame_options::pregame_options(QWidget *parent) : QWidget(parent)
1164{
1165}
1166
1167/************************************************************************/
1170 void pregame_options::init()
1171{
1172 QFormLayout *layout;
1173 QPushButton *qclient_options;
1174 QHBoxLayout *hbox = nullptr;
1175 QPushButton *but;
1176 int level;
1177
1178 layout = new QFormLayout(this);
1179 nation = new QPushButton(this);
1180 qclient_options = new QPushButton(_("Client Options"));
1181 max_players = new QSpinBox(this);
1182 ailevel = new QComboBox(this);
1183 cruleset = new QComboBox(this);
1184 max_players->setRange(1, MAX_NUM_PLAYERS);
1185
1186 // Text and icon set by update_buttons()
1187 connect(nation, &QPushButton::clicked,
1188 this, &pregame_options::pick_nation);
1189 connect(qclient_options, SIGNAL(clicked()), parentWidget(),
1190 SLOT(popup_client_options()));
1191 for (level = 0; level < AI_LEVEL_COUNT; level++) {
1192 if (is_settable_ai_level(static_cast<ai_level>(level))) {
1193 const char *level_name = ai_level_translated_name(
1194 static_cast<ai_level>(level));
1195 ailevel->addItem(level_name, level);
1196 }
1197 }
1198 ailevel->setCurrentIndex(-1);
1199
1200 connect(max_players, SIGNAL(valueChanged(int)),
1201 SLOT(max_players_change(int)));
1202 connect(ailevel, SIGNAL(currentIndexChanged(int)),
1203 SLOT(ailevel_change(int)));
1204 connect(cruleset, SIGNAL(currentIndexChanged(int)),
1205 SLOT(ruleset_change(int)));
1206
1207 but = new QPushButton;
1208 but->setText(_("More Game Options"));
1209 but->setIcon(fc_icons::instance()->get_icon("preferences-other"));
1210 QObject::connect(but, &QAbstractButton::clicked, this,
1211 &pregame_options::popup_server_options);
1212
1213 layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
1214 layout->addRow(_("Nation:"), nation);
1215 layout->addRow(_("Rules:"), cruleset);
1216
1217 hbox = new QHBoxLayout();
1218 hbox->addWidget(max_players);
1219 hbox->addWidget(ailevel);
1220 layout->addRow(_("Players:"), hbox);
1221 layout->addWidget(but);
1222 layout->addWidget(qclient_options);
1223 setLayout(layout);
1224
1225 update_buttons();
1226}
1227
1228/************************************************************************/
1231 void pregame_options::set_rulesets(int num_rulesets, char **rulesets)
1232{
1233 int i;
1234 int def_idx = -1;
1235
1236 cruleset->clear();
1237 cruleset->blockSignals(true);
1238 for (i = 0; i < num_rulesets; i++) {
1239 cruleset->addItem(rulesets[i], i);
1240 if (!strcmp("default", rulesets[i])) {
1241 def_idx = i;
1242 }
1243 }
1244
1245 // HACK: server should tell us the current ruleset.
1246 cruleset->setCurrentIndex(def_idx);
1247 cruleset->blockSignals(false);
1248}
1249
1250/************************************************************************/
1254 void pregame_options::set_aifill(int aifill)
1255{
1256 max_players->blockSignals(true);
1257 max_players->setValue(aifill);
1258 max_players->blockSignals(false);
1259}
1260
1261/************************************************************************/
1264 void pregame_options::update_buttons()
1265{
1266 struct sprite *psprite = nullptr;
1267 QPixmap *pixmap = nullptr;
1268 const struct player *pplayer = client_player();
1269
1270 // Update the "Select Nation" button
1271 if (pplayer != nullptr) {
1272 if (pplayer->nation != nullptr) {
1273 // Defeat keyboard shortcut mnemonics
1274 nation->setText(QString(nation_adjective_for_player(pplayer))
1275 .replace("&", "&&"));
1276 psprite = get_nation_shield_sprite(tileset, pplayer->nation);
1277 pixmap = psprite->pm;
1278 nation->setIconSize(pixmap->size());
1279 nation->setIcon(QIcon(*pixmap));
1280 } else {
1281 nation->setText(_("Random"));
1282 nation->setIcon(fc_icons::instance()->get_icon("flush-random"));
1283 }
1284 }
1285}
1286
1287/************************************************************************/
1290 void pregame_options::update_ai_level()
1291{
1292 enum ai_level level = server_ai_level();
1293
1294 if (ai_level_is_valid(level)) {
1295 int i = ailevel->findData(level);
1296
1297 ailevel->setCurrentIndex(i);
1298 } else {
1299 ailevel->setCurrentIndex(-1);
1300 }
1301}
1302
1303/************************************************************************/
1306 void pregame_options::max_players_change(int i)
1307{
1308 option_int_set(optset_option_by_name(server_optset, "aifill"), i);
1309}
1310
1311/************************************************************************/
1314 void pregame_options::ailevel_change(int i)
1315{
1316 QVariant v = ailevel->currentData();
1317
1318 if (v.isValid()) {
1319 enum ai_level k = static_cast<ai_level>(v.toInt());
1320
1321 // Suppress changes provoked by server rather than local user
1322 if (server_ai_level() != k) {
1323 const char *name = ai_level_cmd(k);
1324
1325 send_chat_printf("/%s", name);
1326 }
1327 }
1328}
1329
1330/************************************************************************/
1333 void pregame_options::ruleset_change(int i)
1334{
1335 if (!cruleset->currentText().isEmpty()) {
1336 QByteArray rn_bytes;
1337
1338 rn_bytes = cruleset->currentText().toUtf8();
1339 set_ruleset(rn_bytes.data());
1340 }
1341}
1342
1343/************************************************************************/
1346 void pregame_options::pick_nation()
1347{
1348 popup_races_dialog(client_player());
1349}
1350
1351/************************************************************************/
1354 void pregame_options::popup_server_options()
1355{
1356 option_dialog_popup(_("Set server options"), server_optset, false);
1357}
str
#define str
Definition astring.c:76
get_font
static QFont * get_font(enum client_font font)
Definition canvas.cpp:379
width
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
apply_tags
QString apply_tags(QString str, const struct text_tag_list *tags, QColor bg_color)
Definition chatline.cpp:555
send_chat_printf
int send_chat_printf(const char *format,...)
Definition chatline_common.c:55
send_chat
int send_chat(const char *message)
Definition chatline_common.c:46
fc_allocate_ow_mutex
void fc_allocate_ow_mutex(void)
Definition chatline_common.c:71
fc_release_ow_mutex
void fc_release_ow_mutex(void)
Definition chatline_common.c:79
chat_welcome_message
void chat_welcome_message(bool gui_has_copying_mitem)
Definition chatline_common.c:177
chat_listener::send_chat_message
void send_chat_message(const QString &message)
Definition chatline.cpp:109
chatwdg::update_widgets
void update_widgets()
Definition chatline.cpp:486
fc_client::game_tab_widget
fc_game_tab_widget * game_tab_widget
Definition fc_client.h:259
fc_client::chat_message_received
void chat_message_received(const QString &message, const struct text_tag_list *tags)
Definition fc_client.cpp:308
fc_client::apply_fullscreen
void apply_fullscreen()
Definition fc_client.cpp:428
fc_client::info_tile_wdg
info_tile * info_tile_wdg
Definition fc_client.h:218
fc_client::status_bar_queue
QStringList status_bar_queue
Definition fc_client.h:351
fc_client::server_notifier
QSocketNotifier * server_notifier
Definition fc_client.h:201
fc_client::connect_host_edit
QLineEdit * connect_host_edit
Definition fc_client.h:188
fc_client::popdown_unit_sel
void popdown_unit_sel()
Definition fc_client.cpp:861
fc_client::output_window
QTextEdit * output_window
Definition fc_client.h:181
fc_client::interface_locked
bool interface_locked
Definition fc_client.h:273
fc_client::~fc_client
~fc_client()
Definition fc_client.cpp:246
fc_client::init
void init()
Definition fc_client.cpp:155
fc_client::update_sidebar_tooltips
void update_sidebar_tooltips()
Definition pages.cpp:2112
fc_client::qt_settings
fc_settings qt_settings
Definition fc_client.h:268
fc_client::gtd
goto_dialog * gtd
Definition fc_client.h:265
fc_client::menu_bar
mr_menu * menu_bar
Definition fc_client.h:257
fc_client::quitting
bool quitting
Definition fc_client.h:354
fc_client::meta_scan_timer
QTimer * meta_scan_timer
Definition fc_client.h:212
fc_client::battlelog_wdg
hud_battle_log * battlelog_wdg
Definition fc_client.h:272
fc_client::closing
void closing()
Definition fc_client.cpp:292
fc_client::connect_lan
QWidget * connect_lan
Definition fc_client.h:174
fc_client::lan_widget
QTableWidget * lan_widget
Definition fc_client.h:205
fc_client::fc_client
fc_client()
Definition fc_client.cpp:69
fc_client::connect_metaserver
QWidget * connect_metaserver
Definition fc_client.h:175
fc_client::connect_confirm_password_edit
QLineEdit * connect_confirm_password_edit
Definition fc_client.h:192
fc_client::chat_line
chat_input * chat_line
Definition fc_client.h:203
fc_client::unitinfo_wdg
hud_units * unitinfo_wdg
Definition fc_client.h:271
fc_client::map_font_scale
bool map_font_scale
Definition fc_client.h:280
fc_client::opened_dialog
choice_dialog * opened_dialog
Definition fc_client.h:219
fc_client::pre_vote
pregamevote * pre_vote
Definition fc_client.h:262
fc_client::saves_load
QTableWidget * saves_load
Definition fc_client.h:208
fc_client::read_settings
void read_settings()
Definition fc_client.cpp:651
fc_client::msgwdg
messagewdg * msgwdg
Definition fc_client.h:260
fc_client::set_status_bar
void set_status_bar(QString str, int timeout=2000)
Definition pages.cpp:438
fc_client::button
QPushButton * button
Definition fc_client.h:194
fc_client::is_repo_dlg_open
bool is_repo_dlg_open(QString str)
Definition fc_client.cpp:618
fc_client::server_input
void server_input(int sock)
Definition fc_client.cpp:504
fc_client::page
enum client_pages page
Definition fc_client.h:349
fc_client::current_page
enum client_pages current_page()
Definition fc_client.cpp:443
fc_client::unit_sel
units_select * unit_sel
Definition fc_client.h:263
fc_client::connect_password_edit
QLineEdit * connect_password_edit
Definition fc_client.h:191
fc_client::quit
void quit()
Definition fc_client.cpp:527
fc_client::minimapview_wdg
minimap_view * minimapview_wdg
Definition fc_client.h:232
fc_client::status_bar
QStatusBar * status_bar
Definition fc_client.h:216
fc_client::wan_widget
QTableWidget * wan_widget
Definition fc_client.h:206
fc_client::gimme_place
void gimme_place(QWidget *widget, QString str)
Definition fc_client.cpp:599
fc_client::fc_cursors
QCursor * fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES]
Definition fc_client.h:266
fc_client::mapview_wdg
map_view * mapview_wdg
Definition fc_client.h:230
fc_client::delete_cursors
void delete_cursors(void)
Definition fc_client.cpp:583
fc_client::central_layout
QStackedLayout * central_layout
Definition fc_client.h:179
fc_client::write_settings
void write_settings()
Definition fc_client.cpp:796
fc_client::infotab
info_tab * infotab
Definition fc_client.h:261
fc_client::create_start_page
void create_start_page()
Definition pages.cpp:628
fc_client::slot_disconnect
void slot_disconnect()
Definition fc_client.cpp:539
fc_client::pages
QWidget * pages[(int) PAGE_GAME+2]
Definition fc_client.h:173
fc_client::slot_pregame_observe
void slot_pregame_observe()
Definition fc_client.cpp:551
fc_client::info_widget
QTableWidget * info_widget
Definition fc_client.h:207
fc_client::set_connection_state
void set_connection_state(enum connection_state state)
Definition pages.cpp:253
fc_client::obs_button
QPushButton * obs_button
Definition fc_client.h:195
fc_client::update_info_label
void update_info_label()
Definition mapview.cpp:999
fc_client::status_bar_label
QLabel * status_bar_label
Definition fc_client.h:217
fc_client::pages_layout
QGridLayout * pages_layout[PAGE_GAME+2]
Definition fc_client.h:178
fc_client::main_wdg
QWidget * main_wdg
Definition fc_client.h:172
fc_client::connect_login_edit
QLineEdit * connect_login_edit
Definition fc_client.h:190
fc_client::add_server_source
void add_server_source(int)
Definition fc_client.cpp:451
fc_client::scenarios_view
QTextEdit * scenarios_view
Definition fc_client.h:182
fc_client::button_box
QDialogButtonBox * button_box
Definition fc_client.h:199
fc_client::destroy_server_scans
void destroy_server_scans(void)
Definition pages.cpp:983
fc_client::create_cursors
void create_cursors(void)
Definition fc_client.cpp:892
fc_client::switch_page
void switch_page(int i)
Definition fc_client.cpp:340
fc_client::create_network_page
void create_network_page()
Definition pages.cpp:290
fc_client::start_players_tree
QTreeWidget * start_players_tree
Definition fc_client.h:210
fc_client::chat_active_on_page
bool chat_active_on_page(enum client_pages)
Definition fc_client.cpp:325
fc_client::create_load_page
void create_load_page()
Definition pages.cpp:482
fc_client::lan_scan_timer
QTimer * lan_scan_timer
Definition fc_client.h:213
fc_client::connect_port_edit
QLineEdit * connect_port_edit
Definition fc_client.h:189
fc_client::sidebar_wdg
fc_sidebar * sidebar_wdg
Definition fc_client.h:231
fc_client::create_main_page
void create_main_page()
Definition pages.cpp:137
fc_client::event
bool event(QEvent *event)
Definition fc_client.cpp:470
fc_client::map_scale
float map_scale
Definition fc_client.h:279
fc_client::create_loading_page
void create_loading_page()
Definition pages.cpp:470
fc_client::update_fonts
void update_fonts()
Definition fc_client.cpp:462
fc_client::update_network_lists
void update_network_lists()
Definition pages.cpp:1013
fc_client::central_wdg
QWidget * central_wdg
Definition fc_client.h:256
fc_client::fc_main
void fc_main(QApplication *qapp)
Definition fc_client.cpp:262
fc_client::opened_repo_dlgs
QMap< QString, QWidget * > opened_repo_dlgs
Definition fc_client.h:350
fc_client::current_file
QString current_file
Definition fc_client.h:352
fc_client::closeEvent
void closeEvent(QCloseEvent *event)
Definition fc_client.cpp:485
fc_client::x_vote
xvote * x_vote
Definition fc_client.h:264
fc_client::remove_repo_dlg
void remove_repo_dlg(QString str)
Definition fc_client.cpp:873
fc_client::slot_pregame_start
void slot_pregame_start()
Definition fc_client.cpp:569
fc_client::update_info_timer
QTimer * update_info_timer
Definition fc_client.h:214
fc_client::toggle_unit_sel_widget
void toggle_unit_sel_widget(struct tile *ptile)
Definition fc_client.cpp:833
fc_client::popup_client_options
void popup_client_options()
Definition fc_client.cpp:884
fc_client::update_unit_sel
void update_unit_sel()
Definition fc_client.cpp:849
fc_client::update_load_page
void update_load_page(void)
Definition pages.cpp:1398
fc_client::scenarios_load
QTableWidget * scenarios_load
Definition fc_client.h:209
fc_client::gimme_index_of
int gimme_index_of(QString str)
Definition fc_client.cpp:634
fc_client::corner_wid
fc_corner * corner_wid
Definition fc_client.h:258
fc_client::send_fake_chat_message
void send_fake_chat_message(const QString &message)
Definition fc_client.cpp:300
fc_client::timerEvent
void timerEvent(QTimerEvent *)
Definition fc_client.cpp:514
fc_client::is_closing
bool is_closing()
Definition fc_client.cpp:284
fc_client::create_scenario_page
void create_scenario_page()
Definition pages.cpp:561
fc_client::remove_server_source
void remove_server_source()
Definition fc_client.cpp:496
fc_client::update_scenarios_page
void update_scenarios_page(void)
Definition pages.cpp:1429
fc_client::create_game_page
void create_game_page()
Definition pages.cpp:712
fc_corner
Definition fc_client.h:156
fc_corner::minimize
void minimize()
Definition fc_client.cpp:967
fc_corner::mw
QMainWindow * mw
Definition fc_client.h:158
fc_corner::maximize
void maximize()
Definition fc_client.cpp:955
fc_corner::close_fc
void close_fc()
Definition fc_client.cpp:947
fc_corner::fc_corner
fc_corner(QMainWindow *qmw)
Definition fc_client.cpp:915
fc_font
Definition fonts.h:39
fc_font::m_instance
static fc_font * m_instance
Definition fonts.h:43
fc_font::init_fonts
void init_fonts()
Definition fonts.cpp:77
fc_font::instance
static fc_font * instance()
Definition fonts.cpp:41
fc_font::get_font
QFont * get_font(QString name)
Definition fonts.cpp:63
fc_game_tab_widget::fc_game_tab_widget
fc_game_tab_widget()
Definition fc_client.cpp:975
fc_game_tab_widget::init
void init()
Definition fc_client.cpp:982
fc_game_tab_widget::resizeEvent
void resizeEvent(QResizeEvent *event)
Definition fc_client.cpp:1094
fc_game_tab_widget::current_changed
void current_changed(int index)
Definition fc_client.cpp:1136
fc_icons
Definition fc_client.h:88
fc_icons::fc_icons
fc_icons()
Definition fc_client.cpp:990
fc_icons::get_icon
QIcon get_icon(const QString &id)
Definition fc_client.cpp:1019
fc_icons::drop
static void drop()
Definition fc_client.cpp:1008
fc_icons::m_instance
static fc_icons * m_instance
Definition fc_client.h:93
fc_icons::get_pixmap
QPixmap * get_pixmap(const QString &id)
Definition fc_client.cpp:1048
fc_icons::instance
static fc_icons * instance()
Definition fc_client.cpp:997
fc_icons::get_path
QString get_path(const QString &id)
Definition fc_client.cpp:1078
fc_shortcuts::sc
static fc_shortcuts * sc()
Definition shortcuts.cpp:278
fc_sidewidget
Definition sidebar.h:50
fc_sidewidget::update_final_pixmap
void update_final_pixmap()
Definition sidebar.cpp:393
hud_battle_log::set_scale
void set_scale(float s)
Definition hudwidget.cpp:2039
hud_units::update_actions
void update_actions(unit_list *punits)
Definition hudwidget.cpp:576
info_tab::restore_chat
void restore_chat()
Definition messagewin.cpp:65
info_tab::chtwdg
chatwdg * chtwdg
Definition messagewin.h:79
listener< chat_listener >::listen
void listen()
Definition listener.h:149
minimap_view::reset
void reset()
Definition mapview.cpp:731
pregame_options::pick_nation
void pick_nation()
Definition fc_client.cpp:1346
pregame_options::popup_server_options
void popup_server_options()
Definition fc_client.cpp:1354
pregame_options::nation
QPushButton * nation
Definition fc_client.h:374
pregame_options::update_ai_level
void update_ai_level()
Definition fc_client.cpp:1290
pregame_options::ailevel
QComboBox * ailevel
Definition fc_client.h:372
pregame_options::ailevel_change
void ailevel_change(int i)
Definition fc_client.cpp:1314
pregame_options::set_rulesets
void set_rulesets(int num_rulesets, char **rulesets)
Definition fc_client.cpp:1231
pregame_options::set_aifill
void set_aifill(int aifill)
Definition fc_client.cpp:1254
pregame_options::max_players_change
void max_players_change(int i)
Definition fc_client.cpp:1306
pregame_options::init
void init()
Definition fc_client.cpp:1170
pregame_options::cruleset
QComboBox * cruleset
Definition fc_client.h:373
pregame_options::pregame_options
pregame_options(QWidget *parent)
Definition fc_client.cpp:1163
pregame_options::ruleset_change
void ruleset_change(int i)
Definition fc_client.cpp:1333
pregame_options::update_buttons
void update_buttons()
Definition fc_client.cpp:1264
pregame_options::max_players
QSpinBox * max_players
Definition fc_client.h:375
units_select
Definition dialogs.h:203
units_select::update_units
void update_units()
Definition dialogs.cpp:4768
units_select::create_pixmap
void create_pixmap()
Definition dialogs.cpp:4467
version_message_event
Definition chatline.h:147
is_client_quitting
bool is_client_quitting(void)
Definition client_main.c:1644
can_client_control
bool can_client_control(void)
Definition client_main.c:1261
client_is_global_observer
bool client_is_global_observer(void)
Definition client_main.c:1353
client_is_observer
bool client_is_observer(void)
Definition client_main.c:1091
user_name
char user_name[512]
Definition client_main.c:145
real_timer_callback
double real_timer_callback(void)
Definition client_main.c:1190
server_host
char server_host[512]
Definition client_main.c:144
client
struct civclient client
Definition client_main.c:153
client_state
enum client_states client_state(void)
Definition client_main.c:1034
server_port
int server_port
Definition client_main.c:148
set_client_state
void set_client_state(enum client_states newstate)
Definition client_main.c:852
client_player
#define client_player()
Definition client_main.h:106
TIMER_INTERVAL
#define TIMER_INTERVAL
Definition client_main.h:30
C_S_DISCONNECTED
@ C_S_DISCONNECTED
Definition client_main.h:45
C_S_RUNNING
@ C_S_RUNNING
Definition client_main.h:47
server_ai_level
enum ai_level server_ai_level(void)
Definition climisc.c:1508
center_on_something
void center_on_something(void)
Definition climisc.c:430
disconnect_from_server
void disconnect_from_server(bool leaving_sound)
Definition clinet.c:306
input_from_server
void input_from_server(int fd)
Definition clinet.c:411
incite_cost
char * incite_cost
Definition comments.c:74
set_ruleset
void set_ruleset(const char *ruleset)
Definition connectdlg_common.c:792
is_server_running
bool is_server_running(void)
Definition connectdlg_common.c:124
connectdlg_common.h
event
enum event_type event
Definition events.c:81
get_turn_done_button_state
bool get_turn_done_button_state()
Definition mapctrl_common.c:522
current_theme
QString current_theme
Definition fc_client.cpp:64
write_shortcuts
void write_shortcuts()
Definition shortcuts.cpp:792
fc_client.h
LOGIN_TYPE
@ LOGIN_TYPE
Definition fc_client.h:56
gui
class fc_client * gui()
Definition gui_main.cpp:81
MAX_NUM_PLAYERS
#define MAX_NUM_PLAYERS
Definition fc_types.h:36
_
#define _(String)
Definition fcintl.h:67
fonts.h
game
struct civ_game game
Definition game.c:61
game.h
layout
static PangoLayout * layout
Definition canvas.c:325
real_output_window_append
void real_output_window_append(const char *astring, const struct text_tag_list *tags, int conn_id)
Definition chatline.c:875
popup_races_dialog
void popup_races_dialog(struct player *pplayer)
Definition dialogs.c:1215
popup_quit_dialog
void popup_quit_dialog(void)
Definition gui_main.c:2372
overview_size_changed
void overview_size_changed(void)
Definition mapview.c:326
option_dialog_popup
void option_dialog_popup(const char *name, const struct option_set *poptset)
Definition optiondlg.c:972
current_page
static enum client_pages current_page
Definition pages.c:78
voteinfo_gui_update
void voteinfo_gui_update(void)
Definition voteinfo_bar.c:214
gui_main.h
optiondlg.h
sprite.h
qapp
static QApplication * qapp
Definition gui_main.cpp:68
current_app
QApplication * current_app()
Definition gui_main.cpp:226
show_new_turn_info
void show_new_turn_info()
Definition hudwidget.cpp:1661
name
const char * name
Definition inputfile.c:127
log_error
#define log_error(message,...)
Definition log.h:103
side_disable_endturn
void side_disable_endturn(bool do_restore)
Definition sidebar.cpp:676
init_mapcanvas_and_overview
void init_mapcanvas_and_overview(void)
Definition mapview_common.c:3655
mapview
struct view mapview
Definition mapview_common.c:75
free_mapcanvas_and_overview
void free_mapcanvas_and_overview(void)
Definition mapview_common.c:3664
map_canvas_resized
bool map_canvas_resized(int width, int height)
Definition mapview_common.c:3564
fonts::default_font
const char *const default_font
Definition fonts.h:27
nation_adjective_for_player
const char * nation_adjective_for_player(const struct player *pplayer)
Definition nation.c:169
server_optset
const struct option_set * server_optset
Definition options.c:4281
client_optset
const struct option_set * client_optset
Definition options.c:1315
gui_options
struct client_options gui_options
Definition options.c:71
optset_option_by_name
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:466
option_int_set
bool option_int_set(struct option *poption, int val)
Definition options.c:913
MAJOR_NEW_OPTION_FILE_NAME
#define MAJOR_NEW_OPTION_FILE_NAME
Definition options.h:38
MINOR_NEW_OPTION_FILE_NAME
#define MINOR_NEW_OPTION_FILE_NAME
Definition options.h:42
dsend_packet_player_ready
int dsend_packet_player_ready(struct connection *pc, int player_no, bool is_ready)
Definition packets_gen.c:2533
is_settable_ai_level
bool is_settable_ai_level(enum ai_level level)
Definition player.c:1925
player_number
int player_number(const struct player *pplayer)
Definition player.c:837
ai_level_cmd
#define ai_level_cmd(_level_)
Definition player.h:569
qtg_real_science_report_dialog_update
void qtg_real_science_report_dialog_update(void *unused)
Definition repodlgs.cpp:1159
level
struct setting_list * level[OLEVELS_NUM]
Definition settings.c:190
fileinfoname
const char * fileinfoname(const struct strvec *dirs, const char *filename)
Definition shared.c:1094
get_data_dirs
const struct strvec * get_data_dirs(void)
Definition shared.c:886
DIR_SEPARATOR
#define DIR_SEPARATOR
Definition shared.h:127
sidebar.h
size
size_t size
Definition specvec.h:72
x
struct sprite int x
Definition sprite_g.h:31
aifill
const char * aifill(int amount)
Definition srv_main.c:2505
civ_game::info
struct packet_game_info info
Definition game.h:89
civclient::conn
struct connection conn
Definition client_main.h:96
client_options::gui_qt_fullscreen
bool gui_qt_fullscreen
Definition options.h:443
client_options::gui_qt_allied_chat_only
bool gui_qt_allied_chat_only
Definition options.h:445
client_options::gui_qt_show_titlebar
bool gui_qt_show_titlebar
Definition options.h:456
connection::used
bool used
Definition connection.h:139
fc_settings::city_splitter2
QByteArray city_splitter2
Definition fc_client.h:135
fc_settings::city_geometry
QByteArray city_geometry
Definition fc_client.h:133
fc_settings::help_geometry
QByteArray help_geometry
Definition fc_client.h:137
fc_settings::unit_info_pos_fx
float unit_info_pos_fx
Definition fc_client.h:141
fc_settings::options_client_geometry
QByteArray options_client_geometry
Definition fc_client.h:139
fc_settings::unit_info_pos_fy
float unit_info_pos_fy
Definition fc_client.h:142
fc_settings::chat_fwidth
float chat_fwidth
Definition fc_client.h:123
fc_settings::chat_fheight
float chat_fheight
Definition fc_client.h:124
fc_settings::help_splitter1
QByteArray help_splitter1
Definition fc_client.h:138
fc_settings::chat_fx_pos
float chat_fx_pos
Definition fc_client.h:125
fc_settings::battlelog_scale
float battlelog_scale
Definition fc_client.h:147
fc_settings::battlelog_x
float battlelog_x
Definition fc_client.h:148
fc_settings::city_splitter3
QByteArray city_splitter3
Definition fc_client.h:136
fc_settings::minimap_x
float minimap_x
Definition fc_client.h:143
fc_settings::minimap_height
float minimap_height
Definition fc_client.h:146
fc_settings::show_battle_log
bool show_battle_log
Definition fc_client.h:129
fc_settings::city_repo_sort_col
int city_repo_sort_col
Definition fc_client.h:131
fc_settings::minimap_width
float minimap_width
Definition fc_client.h:145
fc_settings::battlelog_y
float battlelog_y
Definition fc_client.h:149
fc_settings::options_server_geometry
QByteArray options_server_geometry
Definition fc_client.h:140
fc_settings::chat_fy_pos
float chat_fy_pos
Definition fc_client.h:126
fc_settings::city_splitter1
QByteArray city_splitter1
Definition fc_client.h:134
fc_settings::show_new_turn_text
bool show_new_turn_text
Definition fc_client.h:128
fc_settings::minimap_y
float minimap_y
Definition fc_client.h:144
fc_settings::player_repo_sort_col
int player_repo_sort_col
Definition fc_client.h:127
message
Definition messagewin_common.h:29
packet_game_info::is_new_game
bool is_new_game
Definition packets_gen.h:190
player
Definition player.h:249
player::nation
struct nation_type * nation
Definition player.h:260
sprite
Definition sprite.h:22
sprite::pm
QPixmap * pm
Definition sprite.h:25
tile
Definition tile.h:50
tileset
Definition tilespec.c:482
view::height
int height
Definition mapview_common.h:38
view::width
int width
Definition mapview_common.h:38
widget
Definition widget.h:112
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
TRUE
#define TRUE
Definition support.h:46
tileset_free_tiles
void tileset_free_tiles(struct tileset *t)
Definition tilespec.c:6643
get_nation_shield_sprite
struct sprite * get_nation_shield_sprite(const struct tileset *t, const struct nation_type *pnation)
Definition tilespec.c:6804
get_cursor_sprite
struct sprite * get_cursor_sprite(const struct tileset *t, enum cursor_type cursor, int *hot_x, int *hot_y, int frame)
Definition tilespec.c:6999
NUM_CURSOR_FRAMES
#define NUM_CURSOR_FRAMES
Definition tilespec.h:305
cursor_type
cursor_type
Definition tilespec.h:289
CURSOR_LAST
@ CURSOR_LAST
Definition tilespec.h:301
client_start_server_and_set_page
void client_start_server_and_set_page(enum client_pages page)
Definition update_queue.c:506
set_client_page
void set_client_page(enum client_pages page)
Definition update_queue.c:496