Freeciv-3.3
Loading...
Searching...
No Matches
helpdlg.cpp
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
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 <QGraphicsDropShadowEffect>
21#include <QGroupBox>
22#include <QHBoxLayout>
23#include <QProgressBar>
24#include <QPushButton>
25#include <QScreen>
26#include <QScrollArea>
27#include <QSplitter>
28#include <QStack>
29#include <QStringList>
30#include <QTextBrowser>
31#include <QTreeWidget>
32#include <QVBoxLayout>
33
34// utility
35#include "fcintl.h"
36
37// common
38#include "movement.h"
39#include "nation.h"
40#include "specialist.h"
41#include "terrain.h"
42#include "unit.h"
43
44// client
45#include "helpdata.h"
46
47// gui-qt
48#include "fc_client.h"
49#include "fonts.h"
50#include "helpdlg.h"
51#include "sprite.h"
52
53#define MAX_HELP_TEXT_SIZE 8192
54#define REQ_LABEL_NEVER _("(Never)")
55#define REQ_LABEL_NONE _("?tech:None")
56static help_dialog *help_dlg = nullptr;
57static canvas *terrain_canvas(struct terrain *terrain,
58 const struct extra_type *resource = nullptr,
59 enum extra_cause cause = EC_COUNT);
60
61/**********************************************************************/
72
73/**********************************************************************/
80{
81 int pos;
82 const help_item *topic;
83
84 if (help_dlg == nullptr) {
85 help_dlg = new help_dialog();
86 } else {
88 }
89
90 topic = get_help_item_spec(item, htype, &pos);
91 if (pos >= 0) {
92 help_dlg->set_topic(topic);
93 }
94 help_dlg->setVisible(true);
95 help_dlg->activateWindow();
96}
97
98/**********************************************************************/
102{
103 if (help_dlg) {
104 help_dlg->setVisible(false);
105 help_dlg->deleteLater();
106 help_dlg = nullptr;
107 }
108}
109
110/**********************************************************************/
114{
115 if (help_dlg) {
117 }
118}
119
120/**********************************************************************/
124{
126 QPushButton *but;
127 QTreeWidgetItem *first;
129 QWidget *buttons;
130
131 setWindowTitle(_("Freeciv Help Browser"));
132 history_pos = -1;
133 update_history = true;
134 layout = new QVBoxLayout(this);
135
136 splitter = new QSplitter(this);
137 layout->addWidget(splitter, 10);
138
139 tree_wdg = new QTreeWidget();
140 tree_wdg->setHeaderHidden(true);
141 make_tree();
142 splitter->addWidget(tree_wdg);
143
145 connect(
146 tree_wdg,
147 &QTreeWidget::currentItemChanged,
149 );
150 help_wdg->layout()->setContentsMargins(0, 0, 0, 0);
151 splitter->addWidget(help_wdg);
152
153 buttons = new QWidget;
154 hbox = new QHBoxLayout;
155 prev_butt = new QPushButton(style()->standardIcon(
156 QStyle::QStyle::SP_ArrowLeft), (""));
157 connect(prev_butt, &QAbstractButton::clicked, this,
159 hbox->addWidget(prev_butt);
160 next_butt = new QPushButton(style()->standardIcon(
161 QStyle::QStyle::SP_ArrowRight), (""));
162 connect(next_butt, &QAbstractButton::clicked, this,
164 hbox->addWidget(next_butt);
165 hbox->addStretch(20);
166 but = new QPushButton(style()->standardIcon(
167 QStyle::SP_DialogHelpButton), _("About Qt"));
168 connect(but, &QPushButton::pressed, &QApplication::aboutQt);
169 hbox->addWidget(but, Qt::AlignRight);
170 but = new QPushButton(style()->standardIcon(
171 QStyle::SP_DialogDiscardButton), _("Close"));
172 connect(but, &QPushButton::pressed, this, &QWidget::close);
173 hbox->addWidget(but, Qt::AlignRight);
174 buttons->setLayout(hbox);
175 layout->addWidget(buttons, 0, Qt::AlignBottom);
176
177
178 first = tree_wdg->topLevelItem(0);
179 if (first) {
180 tree_wdg->setCurrentItem(first);
181 }
182}
183
184/**********************************************************************/
191
192/**********************************************************************/
196{
197 gui()->qt_settings.help_geometry = saveGeometry();
198 gui()->qt_settings.help_splitter1 = splitter->saveState();
199}
200
201/**********************************************************************/
205{
207
208 if (!gui()->qt_settings.help_geometry.isNull()) {
209 restoreGeometry(gui()->qt_settings.help_geometry);
210 splitter->restoreState(gui()->qt_settings.help_splitter1);
211 } else {
212 QRect rect = QApplication::primaryScreen()->availableGeometry();
213
214 resize((rect.width() * 3) / 5, (rect.height() * 3) / 6);
215 sizes << rect.width() / 10 << rect.width() / 3;
216 splitter->setSizes(sizes);
217 }
218}
219
220/**********************************************************************/
224{
225 gui()->qt_settings.help_geometry = saveGeometry();
226 gui()->qt_settings.help_splitter1 = splitter->saveState();
227}
228
229/**********************************************************************/
233{
234 char *title;
235 int dep;
237 QIcon icon;
239 sprite *spite;
240 struct advance *padvance;
241 struct canvas *pcan;
242 struct extra_type *pextra;
243 struct government *gov;
244 struct impr_type *imp;
245 struct nation_type *nation;
246 struct terrain *pterrain;
247 struct unit_type *f_type;
248 struct drawn_sprite sprs[80];
249
251 const char *s;
252 int last;
253 title = pitem->topic;
254
255 for (s = pitem->topic; *s == ' '; s++) {
256 // Nothing
257 }
258
261 dep = s - pitem->topic;
262 hash.insert(dep, item);
263
264 if (dep == 0) {
265 tree_wdg->addTopLevelItem(item);
266 } else {
267 last = dep - 1;
268 spite = nullptr;
269
270 switch (pitem->type) {
271 case HELP_EXTRA:
274 icon = QIcon(*sprs->sprite->pm);
275 break;
276
277 case HELP_GOVERNMENT:
280 if (spite) {
281 icon = QIcon(*spite->pm);
282 }
283 break;
284
285 case HELP_IMPROVEMENT:
286 case HELP_WONDER:
289 if (spite) {
290 icon = QIcon(*spite->pm);
291 }
292 break;
293 case HELP_NATIONS:
294 nation = nation_by_translated_plural(s);
296 if (spite) {
297 icon = QIcon(*spite->pm);
298 }
299 break;
300 case HELP_TECH:
304
306 if (spite) {
307 icon = QIcon(*spite->pm);
308 }
309 }
310 break;
311
312 case HELP_TERRAIN:
313 pterrain = terrain_by_translated_name(s);
314 pcan = terrain_canvas(pterrain);
315 if (pcan) {
316 icon = QIcon(pcan->map_pixmap);
317 delete pcan;
318 }
319 break;
320
321 case HELP_UNIT:
323 if (f_type) {
326 }
327 if (spite) {
328 icon = QIcon(*spite->pm);
329 }
330 break;
331
332 default:
333 break;
334 }
335
336 if (!icon.isNull()) {
337 item->setIcon(0, icon);
338 }
339
340 hash.value(last)->addChild(item);
341 }
343}
344
345/**********************************************************************/
349{
350 help_wdg->set_topic(topic);
351 // Reverse search of the item to select.
352 QHash<QTreeWidgetItem *, const help_item *>::const_iterator
353 i = topics_map.cbegin();
354 for ( ; i != topics_map.cend(); ++i) {
355 if (i.value() == topic) {
356 tree_wdg->setCurrentItem(i.key());
357 break;
358 }
359 }
360}
361
362/**********************************************************************/
366{
368
369 update_history = false;
370 if (history_pos < item_history.count()) {
371 history_pos++;
372 }
373 i = item_history.value(history_pos);
374 if (i != nullptr) {
375 tree_wdg->setCurrentItem(i);
376 }
377}
378
379/**********************************************************************/
383{
385
386 update_history = false;
387 if (history_pos > 0) {
388 history_pos--;
389 }
390 i = item_history.value(history_pos);
391 if (i != nullptr) {
392 tree_wdg->setCurrentItem(i);
393 }
394}
395
396/**********************************************************************/
400{
401 if (history_pos == 0) {
402 prev_butt->setEnabled(false);
403 } else {
404 prev_butt->setEnabled(true);
405 }
406 if (history_pos >= item_history.size() - 1) {
407 next_butt->setEnabled(false);
408 } else {
409 next_butt->setEnabled(true);
410 }
411}
412
413/**********************************************************************/
417{
418
419 if (prev == item) {
420 return;
421 }
422
424
425 if (update_history) {
426 history_pos++;
427 item_history.append(item);
428 } else {
429 update_history = true;
430 }
432}
433
434/**********************************************************************/
438 QWidget(parent),
439 main_widget(nullptr), text_browser(nullptr), bottom_panel(nullptr),
440 info_panel(nullptr), splitter(nullptr), info_layout(nullptr)
441{
442 setup_ui();
443}
444
445/**********************************************************************/
449 QWidget(parent),
450 main_widget(nullptr), text_browser(nullptr), bottom_panel(nullptr),
451 info_panel(nullptr), splitter(nullptr), info_layout(nullptr)
452{
453 setup_ui();
454 set_topic(topic);
455}
456
457/**********************************************************************/
461 // Nothing to do here
462}
463
464/**********************************************************************/
468{
471
472 layout = new QVBoxLayout();
474
475 box_wdg = new QFrame(this);
476 layout->addWidget(box_wdg);
478 box_wdg->setLayout(group_layout);
479 box_wdg->setFrameShape(QFrame::StyledPanel);
480 box_wdg->setFrameShadow(QFrame::Raised);
481
482 title_label = new QLabel(box_wdg);
483 title_label->setProperty(fonts::default_font, "true");
484 group_layout->addWidget(title_label);
485
486 text_browser = new QTextBrowser(this);
487 text_browser->setProperty(fonts::help_text, "true");
488 layout->addWidget(text_browser);
490
491 update_fonts();
492 splitter_sizes << 200 << 400;
493}
494
495/**********************************************************************/
519{
520 QWidget *right;
521 enum Qt::Orientation main_layout;
522 enum Qt::Orientation bottom_layout;
523
524 if (horizontal) {
525 main_layout = Qt::Horizontal;
526 bottom_layout = Qt::Vertical;
527 } else {
528 main_layout = Qt::Vertical;
529 bottom_layout = Qt::Horizontal;
530 }
531
532 layout()->removeWidget(main_widget);
533 main_widget->setParent(nullptr);
534
535 if (bottom_panel) {
537 splitter->addWidget(text_browser);
538 splitter->setStretchFactor(0, 100);
539 splitter->addWidget(bottom_panel);
540 splitter->setStretchFactor(1, 0);
541 right = splitter;
542 } else {
543 right = text_browser;
544 }
545
546 if (info_panel) {
547 splitter = new QSplitter(main_layout);
548 splitter->addWidget(info_panel);
549 splitter->setStretchFactor(0, 25);
550 splitter->addWidget(right);
551 splitter->setStretchFactor(1, 75);
552 splitter->setSizes(splitter_sizes);
554 info_panel->setLayout(info_layout);
555 } else {
556 main_widget = right;
557 }
558
559 layout()->addWidget(main_widget);
560 qobject_cast<QVBoxLayout *>(layout())->setStretchFactor(main_widget, 100);
561}
562
563/**********************************************************************/
567{
569 QFont *f;
570
572
574 for (int i = 0; i < l.size(); ++i) {
575 if (l.at(i)->property(fonts::help_label).isValid()) {
576 l.at(i)->setFont(*f);
577 }
578 }
580 for (int i = 0; i < l.size(); ++i) {
581 if (l.at(i)->property(fonts::help_text).isValid()) {
582 l.at(i)->setFont(*f);
583 }
584 }
586 for (int i = 0; i < l.size(); ++i) {
587 if (l.at(i)->property(fonts::default_font).isValid()) {
588 l.at(i)->setFont(*f);
589 }
590 }
591}
592
593/**********************************************************************/
597{
598 // Save the splitter sizes to avoid jumps
599 if (info_panel) {
600 splitter_sizes = splitter->sizes();
601 }
602 // Unparent the widget we want to keep
603 text_browser->setParent(nullptr);
604 // Delete everything else
605 if (text_browser != main_widget) {
606 main_widget->deleteLater();
607 }
608 // Reset pointers to defaults
610 bottom_panel = nullptr;
611 info_panel = nullptr;
612 splitter = nullptr;
613 info_layout = nullptr;
614}
615
616/**********************************************************************/
620{
621 info_panel = new QWidget();
622 info_layout = new QVBoxLayout();
623}
624
625/**********************************************************************/
629{
630 QLabel *label = new QLabel();
632
633 label->setAlignment(Qt::AlignHCenter);
634 label->setPixmap(*pm);
635
636 if (shadow) {
638 effect->setBlurRadius(3);
639 effect->setOffset(0, 2);
640 label->setGraphicsEffect(effect);
641 }
642
643 info_layout->addWidget(label);
644}
645
646/**********************************************************************/
650{
651 QLabel *label = new QLabel(text);
652 label->setWordWrap(true);
653 label->setTextFormat(Qt::RichText);
654 label->setProperty(fonts::help_label, "true");
655 info_layout->addWidget(label);
656}
657
658/**********************************************************************/
666void help_widget::add_info_progress(const QString &text, int progress,
667 int min, int max, const QString &value)
668{
670 QLabel *label;
671 QProgressBar *bar;
672 QWidget *wdg;
673
674 wdg = new QWidget();
675 layout = new QGridLayout(wdg);
676 layout->setContentsMargins(0, 0, 0, 0);
677 layout->setVerticalSpacing(0);
678
679 label = new QLabel(text, wdg);
680 layout->addWidget(label, 0, 0);
681 label->setProperty(fonts::help_label, "true");
682 label = new QLabel(wdg);
683 if (value.isEmpty()) {
684 label->setNum(progress);
685 } else {
686 label->setText(value);
687 }
688 label->setProperty(fonts::help_label, "true");
689 layout->addWidget(label, 0, 1, Qt::AlignRight);
690
691 bar = new QProgressBar(wdg);
692 bar->setMaximumHeight(4);
693 bar->setRange(min, max != min ? max : min + 1);
694 bar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
695 bar->setTextVisible(false);
696 bar->setValue(progress);
697 layout->addWidget(bar, 1, 0, 1, 2);
698
699 info_layout->addWidget(wdg);
700}
701
702/**********************************************************************/
706 enum unit_activity act,
707 const char *label)
708{
709 struct universal for_terr;
710 enum extra_cause cause = activity_to_extra_cause(act);
711
712 for_terr.kind = VUT_TERRAIN;
713 for_terr.value.terrain = pterr;
714
715 extra_type_by_cause_iterate(cause, pextra) {
716 if (pextra->buildable
717 && universal_fulfills_requirements(FALSE, &(pextra->reqs),
718 &for_terr)) {
719 QLabel *tb;
720 QString str;
721
722 tb = new QLabel(this);
723 tb->setProperty(fonts::help_label, "true");
724 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
725 tb->setTextFormat(Qt::RichText);
726
727 str = str + QString(label)
730 .toHtmlEscaped()
731 + "\n";
732 tb->setText(str.trimmed());
733 connect(tb, &QLabel::linkActivated,
735 info_layout->addWidget(tb);
736 }
738}
739
740/**********************************************************************/
744{
745 QString s;
746 s = QString(str).toHtmlEscaped().replace(" ", "&nbsp;");
747 return " <a href=" + QString::number(hpt)
748 + "," + s + ">" + s + "</a> ";
749}
750
751/**********************************************************************/
755{
756 info_layout->addSpacing(2 * info_layout->spacing());
757}
758
759/**********************************************************************/
763{
764 info_layout->addStretch();
765}
766
767/**********************************************************************/
772{
774 int n;
775 QString st;
776 enum help_page_type type;
777
778 sl = link.split(",");
779 n = sl.at(0).toInt();
780 type = static_cast<help_page_type>(n);
781 st = sl.at(1);
782 st = st.replace("\u00A0", " ");
783
785 && strcmp(qPrintable(st),
787 && strcmp(qPrintable(st),
790 }
791}
792
793/**********************************************************************/
797{
798 char *title = topic->topic;
799 bool orient = true;
800
801 for ( ; *title == ' '; ++title) {
802 // Do nothing
803 }
804 title_label->setTextFormat(Qt::PlainText);
805 title_label->setText(title);
806
807 undo_layout();
808
809 switch (topic->type) {
810 case HELP_ANY:
811 case HELP_COUNTER:
812 case HELP_MULTIPLIER:
813 case HELP_RULESET:
814 case HELP_TILESET:
815 case HELP_MUSICSET:
816 case HELP_TEXT:
817 set_topic_other(topic, title);
818 break;
819 case HELP_EXTRA:
820 orient = set_topic_extra(topic, title);
821 break;
822 case HELP_GOODS:
823 set_topic_goods(topic, title);
824 break;
825 case HELP_GOVERNMENT:
827 break;
828 case HELP_IMPROVEMENT:
829 case HELP_WONDER:
831 break;
832 case HELP_NATIONS:
833 set_topic_nation(topic, title);
834 break;
835 case HELP_SPECIALIST:
837 break;
838 case HELP_TECH:
839 set_topic_tech(topic, title);
840 break;
841 case HELP_TERRAIN:
842 set_topic_terrain(topic, title);
843 break;
844 case HELP_UNIT:
845 set_topic_unit(topic, title);
846 break;
847 case HELP_LAST: // Just to avoid warning
848 break;
849 }
850
852}
853
854/**********************************************************************/
860
861/**********************************************************************/
865 const char *title)
866{
867 if (topic->text) {
868 text_browser->setPlainText(topic->text);
869 } else {
870 text_browser->setPlainText(""); // Something better to do ?
871 }
872}
873
874/**********************************************************************/
878 const char *title)
879{
880 char buffer[MAX_HELP_TEXT_SIZE];
881 int upkeep, max_upkeep;
882 struct advance *tech;
883 struct canvas *canvas;
884 const struct unit_type *obsolete;
885 struct unit_type *utype, *max_utype;
887 QString str;
888
890 if (utype) {
891 helptext_unit(buffer, sizeof(buffer), client.conn.playing,
892 topic->text, utype, TRUE);
893 text_browser->setPlainText(buffer);
894
895 // Create information panel
898
899 // Unit icon
903 );
904 canvas->map_pixmap.fill(Qt::transparent);
905 put_unittype(utype, canvas, 1.0f, 0, 0);
908
909 add_info_progress(_("Attack:"), utype->attack_strength, 0,
910 max_utype->attack_strength);
911 add_info_progress(_("Defense:"), utype->defense_strength,
912 0, max_utype->defense_strength);
913 add_info_progress(_("Moves:"), utype->move_rate, 0, max_utype->move_rate,
914 move_points_text(utype->move_rate, true));
915
917
918 add_info_progress(_("Hitpoints:"), utype->hp, 0, max_utype->hp);
921 add_info_progress(_("Firepower:"), utype->firepower, 0,
922 max_utype->firepower);
923
924 // Upkeep
925 upkeep = utype->upkeep[O_FOOD] + utype->upkeep[O_GOLD]
926 + utype->upkeep[O_LUXURY] + utype->upkeep[O_SCIENCE]
927 + utype->upkeep[O_SHIELD] + utype->upkeep[O_TRADE]
928 + utype->happy_cost;
929 max_upkeep = max_utype->upkeep[O_FOOD] + max_utype->upkeep[O_GOLD]
930 + max_utype->upkeep[O_LUXURY] + max_utype->upkeep[O_SCIENCE]
931 + max_utype->upkeep[O_SHIELD] + max_utype->upkeep[O_TRADE]
932 + max_utype->happy_cost;
933 add_info_progress(_("Basic upkeep:"), upkeep, 0, max_upkeep,
935
937
938 // Tech requirement
939 tech = utype_primary_tech_req(utype);
940 if (advance_number(tech) != A_NONE) {
941 QLabel *tb;
942
943 tb = new QLabel(this);
944 // TRANS: this and similar literal strings interpreted as (Qt) HTML
945 str = _("Requires");
946 str = "<b>" + str + "</b> "
948
949 tb->setProperty(fonts::help_label, "true");
950 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
951 tb->setTextFormat(Qt::RichText);
952 tb->setText(str.trimmed());
953 connect(tb, &QLabel::linkActivated,
955 info_layout->addWidget(tb);
956 } else {
957 add_info_label(_("No technology required."));
958 }
959
960 // Obsolescence
961 obsolete = utype->obsoleted_by;
962 if (obsolete) {
964 if (advance_number(tech) != A_NONE) {
965 QLabel *tb;
966
967 tb = new QLabel(this);
968 str = _("Obsoleted by");
969 str = "<b>" + str + "</b> "
972 + ")";
973 tb->setProperty(fonts::help_label, "true");
974 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
975 tb->setTextFormat(Qt::RichText);
976 tb->setText(str.trimmed());
977 connect(tb, &QLabel::linkActivated,
979 info_layout->addWidget(tb);
980 } else {
982 // TRANS: Current unit obsoleted by other unit
983 QString(_("Obsoleted by %1."))
985 .toHtmlEscaped());
986 }
987 } else {
988 add_info_label(_("Never obsolete."));
989 }
990
992
993 delete max_utype;
994 } else {
995 set_topic_other(topic, title);
996 }
997}
998
999/**********************************************************************/
1003 const char *title)
1004{
1005 char buffer[MAX_HELP_TEXT_SIZE];
1006 int type, value;
1007 struct sprite *spr;
1009 char req_buf[512];
1010 QString str, s1, s2;
1011 QLabel *tb;
1012
1013 if (itype) {
1014 helptext_building(buffer, sizeof(buffer), client.conn.playing,
1015 topic->text, itype);
1016 text_browser->setPlainText(buffer);
1019 if (spr) {
1020 add_info_pixmap(spr->pm);
1021 }
1022 str = _("Base Cost:");
1023 str = "<b>" + str + "</b>" + " "
1024 + QString::number(impr_base_build_shield_cost(itype))
1025 .toHtmlEscaped();
1027 if (!is_great_wonder(itype)) {
1028 str = _("Upkeep:");
1029 str = "<b>" + str + "</b>" + " "
1030 + QString::number(itype->upkeep).toHtmlEscaped();
1032 }
1033
1035 if (!preq->present) {
1036 continue;
1037 }
1038 universal_extraction(&preq->source, &type, &value);
1039 if (type == VUT_ADVANCE) {
1041 sizeof(req_buf)), HELP_TECH);
1042 } else if (type == VUT_GOVERNMENT) {
1044 sizeof(req_buf)), HELP_GOVERNMENT);
1045 } else if (type == VUT_TERRAIN) {
1047 sizeof(req_buf)), HELP_TERRAIN);
1048 }
1049 break;
1051
1052 if (!s1.isEmpty()) {
1053 tb = new QLabel(this);
1054 str = _("Requirement:");
1055 str = "<b>" + str + "</b> " + s1;
1056 tb->setProperty(fonts::help_label, "true");
1057 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1058 tb->setTextFormat(Qt::RichText);
1059 tb->setText(str.trimmed());
1060 connect(tb, &QLabel::linkActivated,
1062 info_layout->addWidget(tb);
1063 }
1064
1065 requirement_vector_iterate(&itype->obsolete_by, pobs) {
1066 if (pobs->source.kind == VUT_ADVANCE) {
1067 s2 = link_me(advance_name_translation(pobs->source.value.advance),
1068 HELP_TECH);
1069 break;
1070 }
1072
1073 str = _("Obsolete by:");
1074 str = "<b>" + str + "</b> " + s2;
1075 if (!s2.isEmpty()) {
1076 tb = new QLabel(this);
1077 tb->setProperty(fonts::help_label, "true");
1078 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1079 tb->setTextFormat(Qt::RichText);
1080 tb->setText(str.trimmed());
1081 connect(tb, &QLabel::linkActivated,
1083 info_layout->addWidget(tb);
1084 }
1086 } else {
1087 set_topic_other(topic, title);
1088 }
1089}
1090
1091/**********************************************************************/
1095 const char *title)
1096{
1097 char buffer[MAX_HELP_TEXT_SIZE];
1098 struct sprite *spr;
1099 QLabel *tb;
1101 QString str;
1102
1104 int n = advance_number(padvance);
1105
1108 if (spr) {
1109 add_info_pixmap(spr->pm);
1110 }
1111
1114 if (VUT_ADVANCE == preq->source.kind
1115 && preq->source.value.advance == padvance) {
1116 tb = new QLabel(this);
1117 tb->setProperty(fonts::help_label, "true");
1118 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1119 tb->setTextFormat(Qt::RichText);
1120 str = _("Allows");
1121 str = "<b>" + str + "</b> "
1123 tb->setText(str.trimmed());
1124 connect(tb, &QLabel::linkActivated,
1126 info_layout->addWidget(tb);
1127 }
1130
1131 improvement_iterate(pimprove) {
1132 if (valid_improvement(pimprove)) {
1133 requirement_vector_iterate(&pimprove->reqs, preq) {
1134 if (VUT_ADVANCE == preq->source.kind
1135 && preq->source.value.advance == padvance) {
1136 str = _("Allows");
1137 str = "<b>" + str + "</b> "
1139 is_great_wonder(pimprove) ? HELP_WONDER
1141 tb = new QLabel(this);
1142 tb->setProperty(fonts::help_label, "true");
1143 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1144 tb->setTextFormat(Qt::RichText);
1145 tb->setText(str.trimmed());
1146 connect(tb, &QLabel::linkActivated,
1148 info_layout->addWidget(tb);
1149 }
1151
1152 requirement_vector_iterate(&pimprove->obsolete_by, pobs) {
1153 if (pobs->source.kind == VUT_ADVANCE
1154 && pobs->source.value.advance == padvance) {
1155 str = _("Obsoletes");
1156 str = "<b>" + str + "</b> "
1158 is_great_wonder(pimprove) ? HELP_WONDER
1160 tb = new QLabel(this);
1161 tb->setProperty(fonts::help_label, "true");
1162 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1163 tb->setTextFormat(Qt::RichText);
1164 tb->setText(str.trimmed());
1165 connect(tb, &QLabel::linkActivated,
1167 info_layout->addWidget(tb);
1168 }
1170 }
1172
1174
1176 continue;
1177 }
1178
1179 str = _("Allows");
1180 str = "<b>" + str + "</b> "
1182 tb = new QLabel(this);
1183 tb->setProperty(fonts::help_label, "true");
1184 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1185 tb->setTextFormat(Qt::RichText);
1186 tb->setText(str.trimmed());
1187 connect(tb, &QLabel::linkActivated,
1189 info_layout->addWidget(tb);
1191
1193 helptext_advance(buffer, sizeof(buffer), client.conn.playing,
1194 topic->text, n);
1195 text_browser->setPlainText(buffer);
1196 } else {
1197 set_topic_other(topic, title);
1198 }
1199}
1200
1201/**********************************************************************/
1205 const struct extra_type *resource,
1206 enum extra_cause cause)
1207{
1208 struct canvas *canvas;
1209 struct drawn_sprite sprs[80];
1210 int canvas_y, count, i, width, height;
1211 struct extra_type *pextra;
1212
1216
1218 canvas->map_pixmap.fill(Qt::transparent);
1219 for (i = 0; i < 3; ++i) {
1221 i, terrain);
1222 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1223 }
1224
1225 pextra = nullptr;
1226 if (cause != EC_COUNT) {
1227 extra_type_by_cause_iterate(cause, e) {
1228 pextra = e;
1229 break;
1231
1232 count = fill_basic_extra_sprite_array(tileset, sprs, pextra);
1233 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1234 }
1235
1236 if (resource != nullptr) {
1238 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1239 }
1240
1241 return canvas;
1242}
1243
1244/**********************************************************************/
1249 const struct canvas *image,
1250 const QString &legend,
1251 const QString &tooltip)
1252{
1254 QLabel *label;
1256
1257 label = new QLabel();
1258 effect = new QGraphicsDropShadowEffect(label);
1259 effect->setBlurRadius(3);
1260 effect->setOffset(0, 2);
1261 label->setGraphicsEffect(effect);
1262 label->setPixmap(image->map_pixmap);
1263 layout->addWidget(label, 0, 0, 2, 1);
1264
1265 label = new QLabel(title);
1266 label->setTextFormat(Qt::PlainText);
1267 layout->addWidget(label, 0, 1, Qt::AlignBottom);
1268 label->setProperty(fonts::default_font, "true");
1269
1270 label = new QLabel(legend);
1271 label->setTextFormat(Qt::PlainText);
1272 layout->addWidget(label, 1, 1, Qt::AlignTop);
1273 label->setProperty(fonts::help_label, "true");
1274
1275 if (!tooltip.isEmpty()) {
1276 label->setToolTip(tooltip);
1277 label->setCursor(Qt::WhatsThisCursor);
1278 }
1279
1280 layout->setColumnStretch(0, 0);
1281 layout->setColumnStretch(1, 100);
1282
1283 return layout;
1284}
1285
1286/**********************************************************************/
1290 const char *title)
1291{
1292 char buffer[MAX_HELP_TEXT_SIZE];
1293 struct terrain *pterrain, *max;
1294 QVBoxLayout *vbox;
1295 bool show_panel = false;
1296 QScrollArea *area;
1297 QWidget *panel;
1298 QString str;
1299
1301 if (pterrain) {
1302 struct universal for_terr;
1303 canvas *canvas;
1304
1305 for_terr.kind = VUT_TERRAIN;
1306 for_terr.value.terrain = pterrain;
1307
1308 helptext_terrain(buffer, sizeof(buffer), client.conn.playing,
1309 topic->text, pterrain);
1310 text_browser->setPlainText(buffer);
1311
1312 // Create information panel
1314 max = terrain_max_values();
1315
1316 // Create terrain icon. Use shadow to help distinguish terrain.
1317 canvas = terrain_canvas(pterrain);
1320
1321 add_info_progress(_("Food:"), pterrain->output[O_FOOD],
1322 0, max->output[O_FOOD]);
1323 add_info_progress(_("Production:"), pterrain->output[O_SHIELD],
1324 0, max->output[O_SHIELD]);
1325 add_info_progress(_("Trade:"), pterrain->output[O_TRADE],
1326 0, max->output[O_TRADE]);
1327
1329
1330 add_info_progress(_("Move cost:"), pterrain->movement_cost,
1331 0, max->movement_cost);
1332 add_info_progress(_("Defense bonus:"), MIN(100, pterrain->defense_bonus),
1333 0, 100,
1334 // TRANS: Display a percentage, eg "50%".
1335 QString(_("%1%")).arg(pterrain->defense_bonus));
1336
1338
1339 if (pterrain->cultivate_result != T_NONE
1341 nullptr, &for_terr)) {
1342 QLabel *tb;
1343 char cult_buffer[1024];
1344
1345 fc_snprintf(cult_buffer, sizeof(cult_buffer), PL_("%d turn", "%d turns",
1346 pterrain->cultivate_time),
1347 pterrain->cultivate_time);
1348 str = N_("Cultiv. Rslt/Time:");
1351 + QString(cult_buffer).toHtmlEscaped();
1352 tb = new QLabel(this);
1353 tb->setProperty(fonts::help_label, "true");
1354 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1355 tb->setTextFormat(Qt::RichText);
1356 tb->setText(str.trimmed());
1357 connect(tb, &QLabel::linkActivated,
1359 info_layout->addWidget(tb);
1360 }
1361
1362 if (pterrain->plant_result != T_NONE
1364 QLabel *tb;
1365 char plant_buffer[1024];
1366
1367 fc_snprintf(plant_buffer, sizeof(plant_buffer), PL_("%d turn", "%d turns",
1368 pterrain->plant_time),
1369 pterrain->plant_time);
1370 str = N_("Plant Rslt/Time:");
1373 + QString(plant_buffer).toHtmlEscaped();
1374 tb = new QLabel(this);
1375 tb->setProperty(fonts::help_label, "true");
1376 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1377 tb->setTextFormat(Qt::RichText);
1378 tb->setText(str.trimmed());
1379 connect(tb, &QLabel::linkActivated,
1381 info_layout->addWidget(tb);
1382 }
1383
1384 if (pterrain->transform_result != T_NONE
1386 nullptr, &for_terr)) {
1387 QLabel *tb;
1388 char tf_buffer[1024];
1389
1390 fc_snprintf(tf_buffer, sizeof(tf_buffer), PL_("%d turn", "%d turns",
1391 pterrain->transform_time),
1392 pterrain->transform_time);
1393 str = N_("Trans. Rslt/Time:");
1396 + QString(tf_buffer).toHtmlEscaped();
1397 tb = new QLabel(this);
1398 tb->setProperty(fonts::help_label, "true");
1399 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1400 tb->setTextFormat(Qt::RichText);
1401 tb->setText(str.trimmed());
1402 connect(tb, &QLabel::linkActivated,
1404 info_layout->addWidget(tb);
1405 }
1406
1408 // TRANS: This and similar literal strings interpreted as (Qt) HTML
1410 _("Build as irrigation"));
1411 }
1414 _("Build as mine"));
1415 }
1418 _("Build as road"));
1419 }
1422 _("Build as base"));
1423 }
1424
1426
1427 // Create bottom widget
1428 panel = new QWidget();
1429 vbox = new QVBoxLayout(panel);
1430
1431 if (*(pterrain->resources)) {
1432 struct extra_type **r;
1433
1434 // TODO: include resource frequency information
1435 for (r = pterrain->resources; *r; r++) {
1436 canvas = terrain_canvas(pterrain, *r);
1437 vbox->addLayout(create_terrain_widget(
1439 canvas,
1440 // TRANS: %1 food, %2 shields, %3 trade
1441 QString(_("Tile output becomes %1, %2, %3."))
1442 .arg(pterrain->output[O_FOOD] + (*r)->data.resource->output[O_FOOD])
1443 .arg(pterrain->output[O_SHIELD] + (*r)->data.resource->output[O_SHIELD])
1444 .arg(pterrain->output[O_TRADE] + (*r)->data.resource->output[O_TRADE]),
1445 // TRANS: Tooltip decorating strings like "1, 2, 3".
1446 _("Output (Food, Shields, Trade) of a tile where the resource is "
1447 "present.")));
1449 show_panel = true;
1450 }
1451 }
1452
1453 vbox->addStretch(100);
1454 vbox->setSizeConstraint(QLayout::SetMinimumSize);
1455 if (show_panel) {
1456 area = new QScrollArea();
1457 area->setWidget(panel);
1458 set_bottom_panel(area);
1459 } else {
1460 panel->deleteLater();
1461 }
1462
1463 delete max;
1464 } else {
1465 set_topic_other(topic, title);
1466 }
1467}
1468
1469/**********************************************************************/
1475 const char *title)
1476{
1477 char buffer[MAX_HELP_TEXT_SIZE];
1479
1480 if (pextra) {
1481 canvas *canvas;
1482 int canvas_y, count, width, height;
1483 struct drawn_sprite sprs[80];
1484
1485 helptext_extra(buffer, sizeof(buffer), client.conn.playing,
1486 topic->text, pextra);
1487 text_browser->setPlainText(buffer);
1488
1489 // Create information panel
1491
1492 // Create extra icon.
1497 canvas->map_pixmap.fill(Qt::transparent);
1498 count = fill_basic_extra_sprite_array(tileset, sprs, pextra);
1499 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1502
1503 return false;
1504 } else {
1505 set_topic_other(topic, title);
1506
1507 return true;
1508 }
1509}
1510
1511/**********************************************************************/
1515 const char *title)
1516{
1517 char buffer[MAX_HELP_TEXT_SIZE];
1519 if (pspec) {
1520 helptext_specialist(buffer, sizeof(buffer), client.conn.playing,
1521 topic->text, pspec);
1522 text_browser->setPlainText(buffer);
1523 } else {
1524 set_topic_other(topic, title);
1525 }
1526}
1527
1528/**********************************************************************/
1532 const char *title)
1533{
1534 char buffer[MAX_HELP_TEXT_SIZE];
1536 if (pgov) {
1537 helptext_government(buffer, sizeof(buffer), client.conn.playing,
1538 topic->text, pgov);
1539 text_browser->setPlainText(buffer);
1540 } else {
1541 set_topic_other(topic, title);
1542 }
1543}
1544
1545/**********************************************************************/
1549 const char *title)
1550{
1551 char buffer[MAX_HELP_TEXT_SIZE];
1553 if (pnation) {
1554 helptext_nation(buffer, sizeof(buffer), pnation, topic->text);
1555 text_browser->setPlainText(buffer);
1556 } else {
1557 set_topic_other(topic, title);
1558 }
1559}
1560
1561/**********************************************************************/
1565 const char *title)
1566{
1567 char buffer[MAX_HELP_TEXT_SIZE];
1569 if (pgood) {
1570 helptext_goods(buffer, sizeof(buffer), client.conn.playing,
1571 topic->text, pgood);
1572 text_browser->setText(buffer);
1573 } else {
1574 set_topic_other(topic, title);
1575 }
1576}
1577
1578/**********************************************************************/
1589{
1590 Terrain_type_id i, count;
1591 struct terrain *terrain;
1592 struct terrain *max = new struct terrain;
1593
1594 max->base_time = 0;
1595 max->defense_bonus = 0;
1596 max->irrigation_food_incr = 0;
1597 max->irrigation_time = 0;
1598 max->mining_shield_incr = 0;
1599 max->mining_time = 0;
1600 max->movement_cost = 0;
1601 max->output[O_FOOD] = 0;
1602 max->output[O_GOLD] = 0;
1603 max->output[O_LUXURY] = 0;
1604 max->output[O_SCIENCE] = 0;
1605 max->output[O_SHIELD] = 0;
1606 max->output[O_TRADE] = 0;
1607 max->pillage_time = 0;
1608 max->road_output_incr_pct[O_FOOD] = 0;
1609 max->road_output_incr_pct[O_GOLD] = 0;
1613 max->road_output_incr_pct[O_TRADE] = 0;
1614 max->road_time = 0;
1615 max->transform_time = 0;
1616 count = terrain_count();
1617 for (i = 0; i < count; ++i) {
1619#define SET_MAX(v) \
1620 max->v = max->v > terrain->v ? max->v : terrain->v
1621 SET_MAX(base_time);
1622 SET_MAX(defense_bonus);
1623 SET_MAX(irrigation_food_incr);
1624 SET_MAX(irrigation_time);
1625 SET_MAX(mining_shield_incr);
1626 SET_MAX(mining_time);
1627 SET_MAX(movement_cost);
1628 SET_MAX(output[O_FOOD]);
1629 SET_MAX(output[O_GOLD]);
1630 SET_MAX(output[O_LUXURY]);
1631 SET_MAX(output[O_SCIENCE]);
1632 SET_MAX(output[O_SHIELD]);
1633 SET_MAX(output[O_TRADE]);
1634 SET_MAX(pillage_time);
1635 SET_MAX(road_output_incr_pct[O_FOOD]);
1636 SET_MAX(road_output_incr_pct[O_GOLD]);
1637 SET_MAX(road_output_incr_pct[O_LUXURY]);
1638 SET_MAX(road_output_incr_pct[O_SCIENCE]);
1639 SET_MAX(road_output_incr_pct[O_SHIELD]);
1640 SET_MAX(road_output_incr_pct[O_TRADE]);
1641 SET_MAX(road_time);
1642 SET_MAX(transform_time);
1643#undef SET_MAX
1644 }
1645 return max;
1646}
1647
1648/**********************************************************************/
1658{
1659 struct unit_type *max = new struct unit_type;
1660
1661 max->uclass = uclass;
1662 max->attack_strength = 0;
1663 max->bombard_rate = 0;
1664 max->build_cost = 0;
1665 max->city_size = 0;
1666 max->convert_time = 0;
1667 max->defense_strength = 0;
1668 max->firepower = 0;
1669 max->fuel = 0;
1670 max->happy_cost = 0;
1671 max->hp = 0;
1672 max->move_rate = 0;
1673 max->pop_cost = 0;
1674 max->upkeep[O_FOOD] = 0;
1675 max->upkeep[O_GOLD] = 0;
1676 max->upkeep[O_LUXURY] = 0;
1677 max->upkeep[O_SCIENCE] = 0;
1678 max->upkeep[O_SHIELD] = 0;
1679 max->upkeep[O_TRADE] = 0;
1680 max->vision_radius_sq = 0;
1681
1682 unit_type_iterate(utype) {
1683 if (utype->uclass == uclass) {
1684
1685#define SET_MAX(v) \
1686 max->v = max->v > utype->v ? max->v : utype->v
1687
1688 SET_MAX(attack_strength);
1689 SET_MAX(bombard_rate);
1690 SET_MAX(build_cost);
1691 SET_MAX(city_size);
1692 SET_MAX(convert_time);
1693 SET_MAX(defense_strength);
1694 SET_MAX(firepower);
1695 SET_MAX(fuel);
1696 SET_MAX(happy_cost);
1697 SET_MAX(hp);
1698 SET_MAX(move_rate);
1699 SET_MAX(pop_cost);
1700 SET_MAX(upkeep[O_FOOD]);
1701 SET_MAX(upkeep[O_GOLD]);
1702 SET_MAX(upkeep[O_LUXURY]);
1703 SET_MAX(upkeep[O_SCIENCE]);
1704 SET_MAX(upkeep[O_SHIELD]);
1705 SET_MAX(upkeep[O_TRADE]);
1706 SET_MAX(vision_radius_sq);
1707
1708#undef SET_MAX
1709
1710 }
1712
1713 return max;
1714}
#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni)
Definition actions.h:710
#define str
Definition astring.c:76
#define n
Definition astring.c:77
void qtg_canvas_free(struct canvas *store)
Definition canvas.cpp:48
struct canvas * qtg_canvas_create(int width, int height)
Definition canvas.cpp:36
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
struct canvas int int canvas_y
Definition canvas_g.h:43
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
static fc_font * instance()
Definition fonts.cpp:41
QFont * get_font(QString name)
Definition fonts.cpp:63
QTreeWidget * tree_wdg
Definition helpdlg.h:51
void hideEvent(QHideEvent *event)
Definition helpdlg.cpp:195
int history_pos
Definition helpdlg.h:56
bool update_history
Definition helpdlg.h:61
QPushButton * prev_butt
Definition helpdlg.h:49
help_dialog(QWidget *parent=0)
Definition helpdlg.cpp:123
void history_forward()
Definition helpdlg.cpp:365
QPushButton * next_butt
Definition helpdlg.h:50
void set_topic(const help_item *item)
Definition helpdlg.cpp:348
help_widget * help_wdg
Definition helpdlg.h:52
void make_tree()
Definition helpdlg.cpp:232
void showEvent(QShowEvent *event)
Definition helpdlg.cpp:204
QHash< QTreeWidgetItem *, const help_item * > topics_map
Definition helpdlg.h:55
void item_changed(QTreeWidgetItem *item, QTreeWidgetItem *prev)
Definition helpdlg.cpp:416
void update_fonts()
Definition helpdlg.cpp:187
QSplitter * splitter
Definition helpdlg.h:53
void closeEvent(QCloseEvent *event)
Definition helpdlg.cpp:223
void update_buttons()
Definition helpdlg.cpp:399
QList< QTreeWidgetItem * > item_history
Definition helpdlg.h:54
void history_back()
Definition helpdlg.cpp:382
void add_info_separator()
Definition helpdlg.cpp:754
QString link_me(const char *str, help_page_type hpt)
Definition helpdlg.cpp:743
void show_info_panel()
Definition helpdlg.cpp:619
void update_fonts()
Definition helpdlg.cpp:566
void set_topic_specialist(const help_item *item, const char *title)
Definition helpdlg.cpp:1514
void info_panel_done()
Definition helpdlg.cpp:762
void add_info_progress(const QString &label, int progress, int min, int max, const QString &value=QString())
Definition helpdlg.cpp:666
QSplitter * splitter
Definition helpdlg.h:89
void anchor_clicked(const QString &link)
Definition helpdlg.cpp:771
void set_bottom_panel(QWidget *widget)
Definition helpdlg.cpp:857
QWidget * main_widget
Definition helpdlg.h:85
void setup_ui()
Definition helpdlg.cpp:467
void add_info_pixmap(QPixmap *pm, bool shadow=false)
Definition helpdlg.cpp:628
void add_info_label(const QString &text)
Definition helpdlg.cpp:649
QVBoxLayout * info_layout
Definition helpdlg.h:90
void set_topic_tech(const help_item *item, const char *title)
Definition helpdlg.cpp:1094
void add_extras_of_act_for_terrain(struct terrain *pterr, enum unit_activity act, const char *label)
Definition helpdlg.cpp:705
QFrame * box_wdg
Definition helpdlg.h:82
void set_topic_other(const help_item *item, const char *title)
Definition helpdlg.cpp:864
void set_topic(const help_item *item)
Definition helpdlg.cpp:796
bool set_topic_extra(const help_item *item, const char *title)
Definition helpdlg.cpp:1474
void set_topic_nation(const help_item *item, const char *title)
Definition helpdlg.cpp:1548
QLayout * create_terrain_widget(const QString &title, const struct canvas *image, const QString &legend, const QString &tooltip=QString())
Definition helpdlg.cpp:1248
void undo_layout()
Definition helpdlg.cpp:596
QList< int > splitter_sizes
Definition helpdlg.h:91
struct unit_type * uclass_max_values(struct unit_class *uclass)
Definition helpdlg.cpp:1657
QTextBrowser * text_browser
Definition helpdlg.h:86
help_widget(QWidget *parent=0)
Definition helpdlg.cpp:437
void set_topic_terrain(const help_item *item, const char *title)
Definition helpdlg.cpp:1289
void do_layout(bool horizontal)
Definition helpdlg.cpp:518
void set_topic_goods(const help_item *item, const char *title)
Definition helpdlg.cpp:1564
QWidget * info_panel
Definition helpdlg.h:88
void set_topic_building(const help_item *item, const char *title)
Definition helpdlg.cpp:1002
void set_topic_government(const help_item *item, const char *title)
Definition helpdlg.cpp:1531
void set_topic_unit(const help_item *item, const char *title)
Definition helpdlg.cpp:877
QWidget * bottom_panel
Definition helpdlg.h:87
QLabel * title_label
Definition helpdlg.h:83
struct terrain * terrain_max_values()
Definition helpdlg.cpp:1588
void reactivate()
Definition dialogs.cpp:343
struct civclient client
static struct fc_sockaddr_list * list
Definition clinet.c:102
char * incite_cost
Definition comments.c:76
enum event_type event
Definition events.c:81
struct extra_type * extra_type_by_translated_name(const char *name)
Definition extras.c:235
enum extra_cause activity_to_extra_cause(enum unit_activity act)
Definition extras.c:1090
const char * extra_name_translation(const struct extra_type *pextra)
Definition extras.c:194
#define extra_type_by_cause_iterate_end
Definition extras.h:339
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:333
int Tech_type_id
Definition fc_types.h:236
int Terrain_type_id
Definition fc_types.h:232
@ O_SHIELD
Definition fc_types.h:101
@ O_FOOD
Definition fc_types.h:101
@ O_TRADE
Definition fc_types.h:101
@ O_SCIENCE
Definition fc_types.h:101
@ O_LUXURY
Definition fc_types.h:101
@ O_GOLD
Definition fc_types.h:101
const char * skip_intl_qualifier_prefix(const char *str)
Definition fcintl.c:48
#define Q_(String)
Definition fcintl.h:70
#define PL_(String1, String2, n)
Definition fcintl.h:71
#define _(String)
Definition fcintl.h:67
#define N_(String)
Definition fcintl.h:69
const char * government_name_translation(const struct government *pgovern)
Definition government.c:143
struct government * government_by_translated_name(const char *name)
Definition government.c:40
#define governments_iterate(NAME_pgov)
Definition government.h:124
#define governments_iterate_end
Definition government.h:127
static PangoLayout * layout
Definition canvas.c:325
static struct tile * pos
Definition finddlg.c:53
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
Definition helpdlg.c:196
#define REQ_LABEL_NEVER
Definition helpdlg.c:144
#define REQ_LABEL_NONE
Definition helpdlg.c:143
const char * tooltip
Definition repodlgs.c:1315
const char * title
Definition repodlgs.c:1314
GType type
Definition repodlgs.c:1313
static GHashTable * hash
Definition wldlg.c:322
static struct canvas * terrain_canvas
Definition mapview.c:78
void helptext_government(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct government *gov)
Definition helpdata.c:4335
void helptext_advance(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, int i)
Definition helpdata.c:3294
char * helptext_unit(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct unit_type *utype, bool class_help)
Definition helpdata.c:1932
void helptext_extra(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct extra_type *pextra)
Definition helpdata.c:3789
void helptext_goods(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct goods_type *pgood)
Definition helpdata.c:4254
char * helptext_unit_upkeep_str(const struct unit_type *utype)
Definition helpdata.c:4997
const char * helptext_extra_for_terrain_str(struct extra_type *pextra, struct terrain *pterrain, enum unit_activity act)
Definition helpdata.c:3755
void helptext_specialist(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct specialist *pspec)
Definition helpdata.c:4300
const struct help_item * get_help_item_spec(const char *name, enum help_page_type htype, int *pos)
Definition helpdata.c:1288
char * helptext_building(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct impr_type *pimprove)
Definition helpdata.c:1381
void helptext_terrain(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct terrain *pterrain)
Definition helpdata.c:3515
void helptext_nation(char *buf, size_t bufsz, struct nation_type *pnation, const char *user_text)
Definition helpdata.c:5034
#define help_items_iterate(pitem)
Definition helpdata.h:72
#define help_items_iterate_end
Definition helpdata.h:76
void popdown_help_dialog(void)
Definition helpdlg.cpp:101
#define SET_MAX(v)
void popup_help_dialog_string(const char *item)
Definition helpdlg.cpp:68
static help_dialog * help_dlg
Definition helpdlg.cpp:56
void update_help_fonts()
Definition helpdlg.cpp:113
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
Definition helpdlg.cpp:79
#define MAX_HELP_TEXT_SIZE
Definition helpdlg.cpp:53
help_page_type
Definition helpdlg_g.h:20
@ HELP_ANY
Definition helpdlg_g.h:20
@ HELP_MUSICSET
Definition helpdlg_g.h:23
@ HELP_MULTIPLIER
Definition helpdlg_g.h:24
@ HELP_TERRAIN
Definition helpdlg_g.h:21
@ HELP_EXTRA
Definition helpdlg_g.h:21
@ HELP_NATIONS
Definition helpdlg_g.h:24
@ HELP_LAST
Definition helpdlg_g.h:25
@ HELP_IMPROVEMENT
Definition helpdlg_g.h:20
@ HELP_UNIT
Definition helpdlg_g.h:20
@ HELP_COUNTER
Definition helpdlg_g.h:24
@ HELP_SPECIALIST
Definition helpdlg_g.h:22
@ HELP_GOVERNMENT
Definition helpdlg_g.h:22
@ HELP_GOODS
Definition helpdlg_g.h:22
@ HELP_WONDER
Definition helpdlg_g.h:21
@ HELP_TECH
Definition helpdlg_g.h:21
@ HELP_RULESET
Definition helpdlg_g.h:23
@ HELP_TEXT
Definition helpdlg_g.h:20
@ HELP_TILESET
Definition helpdlg_g.h:23
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
int impr_base_build_shield_cost(const struct impr_type *pimprove)
bool is_great_wonder(const struct impr_type *pimprove)
struct impr_type * improvement_by_translated_name(const char *name)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
void put_drawn_sprites(struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y, int count, struct drawn_sprite *pdrawn, bool fog)
void put_unittype(const struct unit_type *putype, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
const char * move_points_text(int mp, bool reduce)
Definition movement.c:1016
static mpgui * gui
Definition mpgui_qt.cpp:52
const char *const default_font
Definition fonts.h:27
const char *const notify_label
Definition fonts.h:28
const char *const help_label
Definition fonts.h:29
const char *const help_text
Definition fonts.h:30
struct nation_type * nation_by_translated_plural(const char *name)
Definition nation.c:106
void universal_extraction(const struct universal *source, int *kind, int *value)
bool universal_fulfills_requirements(bool check_necessary, const struct requirement_vector *reqs, const struct universal *source)
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
#define requirement_vector_iterate_end
#define requirement_vector_iterate(req_vec, preq)
#define MIN(x, y)
Definition shared.h:55
struct specialist * specialist_by_translated_name(const char *name)
Definition specialist.c:130
QPixmap map_pixmap
Definition canvas.h:25
struct connection conn
Definition client_main.h:96
struct player * playing
Definition connection.h:151
struct resource_type * resource
Definition extras.h:156
char * topic
Definition helpdata.h:26
enum help_page_type type
Definition helpdata.h:27
char * text
Definition helpdata.h:26
Definition climisc.h:82
struct terrain * cultivate_result
Definition terrain.h:108
struct extra_type ** resources
Definition terrain.h:97
int road_time
Definition terrain.h:106
int plant_time
Definition terrain.h:112
struct terrain * plant_result
Definition terrain.h:111
int irrigation_food_incr
Definition terrain.h:114
int defense_bonus
Definition terrain.h:93
int cultivate_time
Definition terrain.h:109
int movement_cost
Definition terrain.h:92
int pillage_time
Definition terrain.h:125
int output[O_LAST]
Definition terrain.h:95
int transform_time
Definition terrain.h:124
int mining_time
Definition terrain.h:118
int road_output_incr_pct[O_LAST]
Definition terrain.h:104
struct terrain * transform_result
Definition terrain.h:122
int irrigation_time
Definition terrain.h:115
int base_time
Definition terrain.h:105
int mining_shield_incr
Definition terrain.h:117
struct unit_class * uclass
Definition unittype.h:563
int pop_cost
Definition unittype.h:520
int defense_strength
Definition unittype.h:523
int firepower
Definition unittype.h:532
int build_cost
Definition unittype.h:519
int convert_time
Definition unittype.h:538
int city_size
Definition unittype.h:557
const struct unit_type * obsoleted_by
Definition unittype.h:536
int vision_radius_sq
Definition unittype.h:529
int move_rate
Definition unittype.h:524
int bombard_rate
Definition unittype.h:554
int upkeep[O_LAST]
Definition unittype.h:545
int attack_strength
Definition unittype.h:522
int happy_cost
Definition unittype.h:544
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
#define nullptr
Definition support.h:55
struct advance * advance_by_number(const Tech_type_id atype)
Definition tech.c:107
struct advance * advance_by_translated_name(const char *name)
Definition tech.c:185
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:300
bool is_regular_advance(struct advance *padvance)
Definition tech.c:290
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
#define A_NONE
Definition tech.h:43
Terrain_type_id terrain_count(void)
Definition terrain.c:118
struct terrain * terrain_by_translated_name(const char *name)
Definition terrain.c:202
const char * terrain_name_translation(const struct terrain *pterrain)
Definition terrain.c:238
struct terrain * terrain_by_number(const Terrain_type_id type)
Definition terrain.c:156
#define T_NONE
Definition terrain.h:61
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
Definition tilespec.c:7017
struct sprite * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
Definition tilespec.c:7007
int tileset_full_tile_height(const struct tileset *t)
Definition tilespec.c:815
int fill_basic_extra_sprite_array(const struct tileset *t, struct drawn_sprite *sprs, const struct extra_type *pextra)
Definition tilespec.c:7428
int fill_basic_terrain_layer_sprite_array(struct tileset *t, struct drawn_sprite *sprs, int layer, struct terrain *pterrain)
Definition tilespec.c:7395
int tileset_tile_height(const struct tileset *t)
Definition tilespec.c:791
int tileset_full_tile_width(const struct tileset *t)
Definition tilespec.c:802
struct sprite * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum unit_activity activity, enum direction8 facing)
Definition tilespec.c:7029
struct sprite * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *pnation)
Definition tilespec.c:6980
struct sprite * get_tech_sprite(const struct tileset *t, Tech_type_id tech)
Definition tilespec.c:6998
struct goods_type * goods_by_translated_name(const char *name)
bool is_tech_req_for_utype(const struct unit_type *ptype, struct advance *padv)
Definition unittype.c:2730
int utype_build_shield_cost_base(const struct unit_type *punittype)
Definition unittype.c:1474
struct advance * utype_primary_tech_req(const struct unit_type *ptype)
Definition unittype.c:2716
struct unit_type * unit_type_by_translated_name(const char *name)
Definition unittype.c:1758
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1566
#define unit_type_iterate(_p)
Definition unittype.h:862
#define unit_type_iterate_end
Definition unittype.h:869