Freeciv-3.2
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")
57static canvas *terrain_canvas(struct terrain *terrain,
58 const struct extra_type *resource = NULL,
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 = NULL;
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;
236 int i;
238 QIcon icon;
240 sprite *spite;
241 struct advance *padvance;
242 struct canvas *pcan;
243 struct extra_type *pextra;
244 struct government *gov;
245 struct impr_type *imp;
246 struct nation_type *nation;
247 struct terrain *pterrain;
248 struct unit_type *f_type;
249 struct drawn_sprite sprs[80];
250
252 const char *s;
253 int last;
254 title = pitem->topic;
255
256 for (s = pitem->topic; *s == ' '; s++) {
257 // Nothing
258 }
259
262 dep = s - pitem->topic;
263 hash.insert(dep, item);
264
265 if (dep == 0) {
266 tree_wdg->addTopLevelItem(item);
267 } else {
268 last = dep - 1;
269 spite = nullptr;
270
271 switch (pitem->type) {
272 case HELP_EXTRA:
275 icon = QIcon(*sprs->sprite->pm);
276 break;
277
278 case HELP_GOVERNMENT:
281 if (spite) {
282 icon = QIcon(*spite->pm);
283 }
284 break;
285
286 case HELP_IMPROVEMENT:
287 case HELP_WONDER:
290 if (spite) {
291 icon = QIcon(*spite->pm);
292 }
293 break;
294 case HELP_NATIONS:
295 nation = nation_by_translated_plural(s);
297 if (spite) {
298 icon = QIcon(*spite->pm);
299 }
300 break;
301 case HELP_TECH:
305 if (spite) {
306 icon = QIcon(*spite->pm);
307 }
308 }
309 break;
310
311 case HELP_TERRAIN:
312 pterrain = terrain_by_translated_name(s);
313 pcan = terrain_canvas(pterrain);
314 if (pcan) {
315 icon = QIcon(pcan->map_pixmap);
316 delete pcan;
317 }
318 break;
319
320 case HELP_UNIT:
322 if (f_type) {
325 }
326 if (spite) {
327 icon = QIcon(*spite->pm);
328 }
329 break;
330
331 default:
332 break;
333 }
334
335 if (!icon.isNull()) {
336 item->setIcon(0, icon);
337 }
338
339 hash.value(last)->addChild(item);
340 }
342}
343
344/**********************************************************************/
348{
349 help_wdg->set_topic(topic);
350 // Reverse search of the item to select.
351 QHash<QTreeWidgetItem *, const help_item *>::const_iterator
352 i = topics_map.cbegin();
353 for ( ; i != topics_map.cend(); ++i) {
354 if (i.value() == topic) {
355 tree_wdg->setCurrentItem(i.key());
356 break;
357 }
358 }
359}
360
361/**********************************************************************/
365{
367
368 update_history = false;
369 if (history_pos < item_history.count()) {
370 history_pos++;
371 }
372 i = item_history.value(history_pos);
373 if (i != nullptr) {
374 tree_wdg->setCurrentItem(i);
375 }
376}
377
378/**********************************************************************/
382{
384
385 update_history = false;
386 if (history_pos > 0) {
387 history_pos--;
388 }
389 i = item_history.value(history_pos);
390 if (i != nullptr) {
391 tree_wdg->setCurrentItem(i);
392 }
393}
394
395/**********************************************************************/
399{
400 if (history_pos == 0) {
401 prev_butt->setEnabled(false);
402 } else {
403 prev_butt->setEnabled(true);
404 }
405 if (history_pos >= item_history.size() - 1) {
406 next_butt->setEnabled(false);
407 } else {
408 next_butt->setEnabled(true);
409 }
410}
411
412/**********************************************************************/
416{
417
418 if (prev == item) {
419 return;
420 }
421
423
424 if (update_history) {
425 history_pos++;
426 item_history.append(item);
427 } else {
428 update_history = true;
429 }
431}
432
433/**********************************************************************/
437 QWidget(parent),
438 main_widget(NULL), text_browser(NULL), bottom_panel(NULL),
439 info_panel(NULL), splitter(NULL), info_layout(NULL)
440{
441 setup_ui();
442}
443
444/**********************************************************************/
448 QWidget(parent),
449 main_widget(NULL), text_browser(NULL), bottom_panel(NULL),
450 info_panel(NULL), splitter(NULL), info_layout(NULL)
451{
452 setup_ui();
453 set_topic(topic);
454}
455
456/**********************************************************************/
460 // Nothing to do here
461}
462
463/**********************************************************************/
467{
470
471 layout = new QVBoxLayout();
473
474 box_wdg = new QFrame(this);
475 layout->addWidget(box_wdg);
477 box_wdg->setLayout(group_layout);
478 box_wdg->setFrameShape(QFrame::StyledPanel);
479 box_wdg->setFrameShadow(QFrame::Raised);
480
481 title_label = new QLabel(box_wdg);
482 title_label->setProperty(fonts::default_font, "true");
483 group_layout->addWidget(title_label);
484
485 text_browser = new QTextBrowser(this);
486 text_browser->setProperty(fonts::help_text, "true");
487 layout->addWidget(text_browser);
489
490 update_fonts();
491 splitter_sizes << 200 << 400;
492}
493
494/**********************************************************************/
518{
519 QWidget *right;
520 enum Qt::Orientation main_layout;
521 enum Qt::Orientation bottom_layout;
522
523 if (horizontal) {
524 main_layout = Qt::Horizontal;
525 bottom_layout = Qt::Vertical;
526 } else {
527 main_layout = Qt::Vertical;
528 bottom_layout = Qt::Horizontal;
529 }
530
531 layout()->removeWidget(main_widget);
532 main_widget->setParent(NULL);
533
534 if (bottom_panel) {
536 splitter->addWidget(text_browser);
537 splitter->setStretchFactor(0, 100);
538 splitter->addWidget(bottom_panel);
539 splitter->setStretchFactor(1, 0);
540 right = splitter;
541 } else {
542 right = text_browser;
543 }
544
545 if (info_panel) {
546 splitter = new QSplitter(main_layout);
547 splitter->addWidget(info_panel);
548 splitter->setStretchFactor(0, 25);
549 splitter->addWidget(right);
550 splitter->setStretchFactor(1, 75);
551 splitter->setSizes(splitter_sizes);
553 info_panel->setLayout(info_layout);
554 } else {
555 main_widget = right;
556 }
557
558 layout()->addWidget(main_widget);
559 qobject_cast<QVBoxLayout *>(layout())->setStretchFactor(main_widget, 100);
560}
561
562/**********************************************************************/
566{
568 QFont *f;
569
571
573 for (int i = 0; i < l.size(); ++i) {
574 if (l.at(i)->property(fonts::help_label).isValid()) {
575 l.at(i)->setFont(*f);
576 }
577 }
579 for (int i = 0; i < l.size(); ++i) {
580 if (l.at(i)->property(fonts::help_text).isValid()) {
581 l.at(i)->setFont(*f);
582 }
583 }
585 for (int i = 0; i < l.size(); ++i) {
586 if (l.at(i)->property(fonts::default_font).isValid()) {
587 l.at(i)->setFont(*f);
588 }
589 }
590}
591
592/**********************************************************************/
596{
597 // Save the splitter sizes to avoid jumps
598 if (info_panel) {
599 splitter_sizes = splitter->sizes();
600 }
601 // Unparent the widget we want to keep
602 text_browser->setParent(NULL);
603 // Delete everything else
604 if (text_browser != main_widget) {
605 main_widget->deleteLater();
606 }
607 // Reset pointers to defaults
611 splitter = NULL;
613}
614
615/**********************************************************************/
619{
620 info_panel = new QWidget();
621 info_layout = new QVBoxLayout();
622}
623
624/**********************************************************************/
628{
629 QLabel *label = new QLabel();
631
632 label->setAlignment(Qt::AlignHCenter);
633 label->setPixmap(*pm);
634
635 if (shadow) {
637 effect->setBlurRadius(3);
638 effect->setOffset(0, 2);
639 label->setGraphicsEffect(effect);
640 }
641
642 info_layout->addWidget(label);
643}
644
645/**********************************************************************/
649{
650 QLabel *label = new QLabel(text);
651 label->setWordWrap(true);
652 label->setTextFormat(Qt::RichText);
653 label->setProperty(fonts::help_label, "true");
654 info_layout->addWidget(label);
655}
656
657/**********************************************************************/
665void help_widget::add_info_progress(const QString &text, int progress,
666 int min, int max, const QString &value)
667{
669 QLabel *label;
670 QProgressBar *bar;
671 QWidget *wdg;
672
673 wdg = new QWidget();
674 layout = new QGridLayout(wdg);
675 layout->setContentsMargins(0, 0, 0, 0);
676 layout->setVerticalSpacing(0);
677
678 label = new QLabel(text, wdg);
679 layout->addWidget(label, 0, 0);
680 label->setProperty(fonts::help_label, "true");
681 label = new QLabel(wdg);
682 if (value.isEmpty()) {
683 label->setNum(progress);
684 } else {
685 label->setText(value);
686 }
687 label->setProperty(fonts::help_label, "true");
688 layout->addWidget(label, 0, 1, Qt::AlignRight);
689
690 bar = new QProgressBar(wdg);
691 bar->setMaximumHeight(4);
692 bar->setRange(min, max != min ? max : min + 1);
693 bar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
694 bar->setTextVisible(false);
695 bar->setValue(progress);
696 layout->addWidget(bar, 1, 0, 1, 2);
697
698 info_layout->addWidget(wdg);
699}
700
701/**********************************************************************/
705 enum unit_activity act,
706 const char *label)
707{
708 struct universal for_terr;
709 enum extra_cause cause = activity_to_extra_cause(act);
710
711 for_terr.kind = VUT_TERRAIN;
712 for_terr.value.terrain = pterr;
713
714 extra_type_by_cause_iterate(cause, pextra) {
715 if (pextra->buildable
716 && universal_fulfills_requirements(FALSE, &(pextra->reqs),
717 &for_terr)) {
718 QLabel *tb;
719 QString str;
720
721 tb = new QLabel(this);
722 tb->setProperty(fonts::help_label, "true");
723 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
724 tb->setTextFormat(Qt::RichText);
725
726 str = str + QString(label)
729 .toHtmlEscaped()
730 + "\n";
731 tb->setText(str.trimmed());
732 connect(tb, &QLabel::linkActivated,
734 info_layout->addWidget(tb);
735 }
737}
738
739/**********************************************************************/
743{
744 QString s;
745 s = QString(str).toHtmlEscaped().replace(" ", "&nbsp;");
746 return " <a href=" + QString::number(hpt)
747 + "," + s + ">" + s + "</a> ";
748}
749
750/**********************************************************************/
754{
755 info_layout->addSpacing(2 * info_layout->spacing());
756}
757
758/**********************************************************************/
762{
763 info_layout->addStretch();
764}
765
766/**********************************************************************/
771{
773 int n;
774 QString st;
775 enum help_page_type type;
776
777 sl = link.split(",");
778 n = sl.at(0).toInt();
779 type = static_cast<help_page_type>(n);
780 st = sl.at(1);
781 st = st.replace("\u00A0", " ");
782
784 && strcmp(qPrintable(st),
786 && strcmp(qPrintable(st),
789 }
790}
791
792/**********************************************************************/
796{
797 char *title = topic->topic;
798 bool orient = true;
799
800 for ( ; *title == ' '; ++title) {
801 // Do nothing
802 }
803 title_label->setTextFormat(Qt::PlainText);
804 title_label->setText(title);
805
806 undo_layout();
807
808 switch (topic->type) {
809 case HELP_ANY:
810 case HELP_COUNTER:
811 case HELP_MULTIPLIER:
812 case HELP_RULESET:
813 case HELP_TILESET:
814 case HELP_MUSICSET:
815 case HELP_TEXT:
816 set_topic_other(topic, title);
817 break;
818 case HELP_EXTRA:
819 orient = set_topic_extra(topic, title);
820 break;
821 case HELP_GOODS:
822 set_topic_goods(topic, title);
823 break;
824 case HELP_GOVERNMENT:
826 break;
827 case HELP_IMPROVEMENT:
828 case HELP_WONDER:
830 break;
831 case HELP_NATIONS:
832 set_topic_nation(topic, title);
833 break;
834 case HELP_SPECIALIST:
836 break;
837 case HELP_TECH:
838 set_topic_tech(topic, title);
839 break;
840 case HELP_TERRAIN:
841 set_topic_terrain(topic, title);
842 break;
843 case HELP_UNIT:
844 set_topic_unit(topic, title);
845 break;
846 case HELP_LAST: // Just to avoid warning
847 break;
848 }
849
851}
852
853/**********************************************************************/
859
860/**********************************************************************/
864 const char *title)
865{
866 if (topic->text) {
867 text_browser->setPlainText(topic->text);
868 } else {
869 text_browser->setPlainText(""); // Something better to do ?
870 }
871}
872
873/**********************************************************************/
877 const char *title)
878{
879 char buffer[MAX_HELP_TEXT_SIZE];
880 int upkeep, max_upkeep;
881 struct advance *tech;
882 struct canvas *canvas;
883 const struct unit_type *obsolete;
884 struct unit_type *utype, *max_utype;
886 QString str;
887
889 if (utype) {
890 helptext_unit(buffer, sizeof(buffer), client.conn.playing,
891 topic->text, utype, TRUE);
892 text_browser->setPlainText(buffer);
893
894 // Create information panel
897
898 // Unit icon
902 );
903 canvas->map_pixmap.fill(Qt::transparent);
904 put_unittype(utype, canvas, 1.0f, 0, 0);
907
908 add_info_progress(_("Attack:"), utype->attack_strength, 0,
909 max_utype->attack_strength);
910 add_info_progress(_("Defense:"), utype->defense_strength,
911 0, max_utype->defense_strength);
912 add_info_progress(_("Moves:"), utype->move_rate, 0, max_utype->move_rate,
913 move_points_text(utype->move_rate, true));
914
916
917 add_info_progress(_("Hitpoints:"), utype->hp, 0, max_utype->hp);
920 add_info_progress(_("Firepower:"), utype->firepower, 0,
921 max_utype->firepower);
922
923 // Upkeep
924 upkeep = utype->upkeep[O_FOOD] + utype->upkeep[O_GOLD]
925 + utype->upkeep[O_LUXURY] + utype->upkeep[O_SCIENCE]
926 + utype->upkeep[O_SHIELD] + utype->upkeep[O_TRADE]
927 + utype->happy_cost;
928 max_upkeep = max_utype->upkeep[O_FOOD] + max_utype->upkeep[O_GOLD]
929 + max_utype->upkeep[O_LUXURY] + max_utype->upkeep[O_SCIENCE]
930 + max_utype->upkeep[O_SHIELD] + max_utype->upkeep[O_TRADE]
931 + max_utype->happy_cost;
932 add_info_progress(_("Basic upkeep:"), upkeep, 0, max_upkeep,
934
936
937 // Tech requirement
938 tech = utype_primary_tech_req(utype);
939 if (advance_number(tech) != A_NONE) {
940 QLabel *tb;
941
942 tb = new QLabel(this);
943 // TRANS: this and similar literal strings interpreted as (Qt) HTML
944 str = _("Requires");
945 str = "<b>" + str + "</b> "
947
948 tb->setProperty(fonts::help_label, "true");
949 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
950 tb->setTextFormat(Qt::RichText);
951 tb->setText(str.trimmed());
952 connect(tb, &QLabel::linkActivated,
954 info_layout->addWidget(tb);
955 } else {
956 add_info_label(_("No technology required."));
957 }
958
959 // Obsolescence
960 obsolete = utype->obsoleted_by;
961 if (obsolete) {
963 if (advance_number(tech) != A_NONE) {
964 QLabel *tb;
965
966 tb = new QLabel(this);
967 str = _("Obsoleted by");
968 str = "<b>" + str + "</b> "
971 + ")";
972 tb->setProperty(fonts::help_label, "true");
973 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
974 tb->setTextFormat(Qt::RichText);
975 tb->setText(str.trimmed());
976 connect(tb, &QLabel::linkActivated,
978 info_layout->addWidget(tb);
979 } else {
981 // TRANS: Current unit obsoleted by other unit
982 QString(_("Obsoleted by %1."))
984 .toHtmlEscaped());
985 }
986 } else {
987 add_info_label(_("Never obsolete."));
988 }
989
991
992 delete max_utype;
993 } else {
994 set_topic_other(topic, title);
995 }
996}
997
998/**********************************************************************/
1002 const char *title)
1003{
1004 char buffer[MAX_HELP_TEXT_SIZE];
1005 int type, value;
1006 struct sprite *spr;
1008 char req_buf[512];
1009 QString str, s1, s2;
1010 QLabel *tb;
1011
1012 if (itype) {
1013 helptext_building(buffer, sizeof(buffer), client.conn.playing,
1014 topic->text, itype);
1015 text_browser->setPlainText(buffer);
1018 if (spr) {
1019 add_info_pixmap(spr->pm);
1020 }
1021 str = _("Base Cost:");
1022 str = "<b>" + str + "</b>" + " "
1023 + QString::number(impr_base_build_shield_cost(itype))
1024 .toHtmlEscaped();
1026 if (!is_great_wonder(itype)) {
1027 str = _("Upkeep:");
1028 str = "<b>" + str + "</b>" + " "
1029 + QString::number(itype->upkeep).toHtmlEscaped();
1031 }
1032
1034 if (!preq->present) {
1035 continue;
1036 }
1037 universal_extraction(&preq->source, &type, &value);
1038 if (type == VUT_ADVANCE) {
1040 sizeof(req_buf)), HELP_TECH);
1041 } else if (type == VUT_GOVERNMENT) {
1043 sizeof(req_buf)), HELP_GOVERNMENT);
1044 } else if (type == VUT_TERRAIN) {
1046 sizeof(req_buf)), HELP_TERRAIN);
1047 }
1048 break;
1050
1051 if (!s1.isEmpty()) {
1052 tb = new QLabel(this);
1053 str = _("Requirement:");
1054 str = "<b>" + str + "</b> " + s1;
1055 tb->setProperty(fonts::help_label, "true");
1056 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1057 tb->setTextFormat(Qt::RichText);
1058 tb->setText(str.trimmed());
1059 connect(tb, &QLabel::linkActivated,
1061 info_layout->addWidget(tb);
1062 }
1063
1064 requirement_vector_iterate(&itype->obsolete_by, pobs) {
1065 if (pobs->source.kind == VUT_ADVANCE) {
1066 s2 = link_me(advance_name_translation(pobs->source.value.advance),
1067 HELP_TECH);
1068 break;
1069 }
1071
1072 str = _("Obsolete by:");
1073 str = "<b>" + str + "</b> " + s2;
1074 if (!s2.isEmpty()) {
1075 tb = new QLabel(this);
1076 tb->setProperty(fonts::help_label, "true");
1077 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1078 tb->setTextFormat(Qt::RichText);
1079 tb->setText(str.trimmed());
1080 connect(tb, &QLabel::linkActivated,
1082 info_layout->addWidget(tb);
1083 }
1085 } else {
1086 set_topic_other(topic, title);
1087 }
1088}
1089
1090/**********************************************************************/
1094 const char *title)
1095{
1096 char buffer[MAX_HELP_TEXT_SIZE];
1097 struct sprite *spr;
1098 QLabel *tb;
1100 QString str;
1101
1102 if (padvance) {
1103 int n = advance_number(padvance);
1104 if (!is_future_tech(n)) {
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
1197 }
1198 } else {
1199 set_topic_other(topic, title);
1200 }
1201}
1202
1203/**********************************************************************/
1207 const struct extra_type *resource,
1208 enum extra_cause cause)
1209{
1210 struct canvas *canvas;
1211 struct drawn_sprite sprs[80];
1212 int canvas_y, count, i, width, height;
1213 struct extra_type *pextra;
1214
1218
1220 canvas->map_pixmap.fill(Qt::transparent);
1221 for (i = 0; i < 3; ++i) {
1223 i, terrain);
1224 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1225 }
1226
1227 pextra = NULL;
1228 if (cause != EC_COUNT) {
1229 extra_type_by_cause_iterate(cause, e) {
1230 pextra = e;
1231 break;
1233
1234 count = fill_basic_extra_sprite_array(tileset, sprs, pextra);
1235 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1236 }
1237
1238 if (resource != NULL) {
1240 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1241 }
1242
1243 return canvas;
1244}
1245
1246/**********************************************************************/
1251 const struct canvas *image,
1252 const QString &legend,
1253 const QString &tooltip)
1254{
1256 QLabel *label;
1258
1259 label = new QLabel();
1260 effect = new QGraphicsDropShadowEffect(label);
1261 effect->setBlurRadius(3);
1262 effect->setOffset(0, 2);
1263 label->setGraphicsEffect(effect);
1264 label->setPixmap(image->map_pixmap);
1265 layout->addWidget(label, 0, 0, 2, 1);
1266
1267 label = new QLabel(title);
1268 label->setTextFormat(Qt::PlainText);
1269 layout->addWidget(label, 0, 1, Qt::AlignBottom);
1270 label->setProperty(fonts::default_font, "true");
1271
1272 label = new QLabel(legend);
1273 label->setTextFormat(Qt::PlainText);
1274 layout->addWidget(label, 1, 1, Qt::AlignTop);
1275 label->setProperty(fonts::help_label, "true");
1276
1277 if (!tooltip.isEmpty()) {
1278 label->setToolTip(tooltip);
1279 label->setCursor(Qt::WhatsThisCursor);
1280 }
1281
1282 layout->setColumnStretch(0, 0);
1283 layout->setColumnStretch(1, 100);
1284
1285 return layout;
1286}
1287
1288/**********************************************************************/
1292 const char *title)
1293{
1294 char buffer[MAX_HELP_TEXT_SIZE];
1295 struct terrain *pterrain, *max;
1296 QVBoxLayout *vbox;
1297 bool show_panel = false;
1298 QScrollArea *area;
1299 QWidget *panel;
1300 QString str;
1301
1303 if (pterrain) {
1304 struct universal for_terr;
1305 canvas *canvas;
1306
1307 for_terr.kind = VUT_TERRAIN;
1308 for_terr.value.terrain = pterrain;
1309
1310 helptext_terrain(buffer, sizeof(buffer), client.conn.playing,
1311 topic->text, pterrain);
1312 text_browser->setPlainText(buffer);
1313
1314 // Create information panel
1316 max = terrain_max_values();
1317
1318 // Create terrain icon. Use shadow to help distinguish terrain.
1319 canvas = terrain_canvas(pterrain);
1322
1323 add_info_progress(_("Food:"), pterrain->output[O_FOOD],
1324 0, max->output[O_FOOD]);
1325 add_info_progress(_("Production:"), pterrain->output[O_SHIELD],
1326 0, max->output[O_SHIELD]);
1327 add_info_progress(_("Trade:"), pterrain->output[O_TRADE],
1328 0, max->output[O_TRADE]);
1329
1331
1332 add_info_progress(_("Move cost:"), pterrain->movement_cost,
1333 0, max->movement_cost);
1334 add_info_progress(_("Defense bonus:"), MIN(100, pterrain->defense_bonus),
1335 0, 100,
1336 // TRANS: Display a percentage, eg "50%".
1337 QString(_("%1%")).arg(pterrain->defense_bonus));
1338
1340
1341 if (pterrain->cultivate_result != T_NONE
1343 NULL, &for_terr)) {
1344 QLabel *tb;
1345 char cult_buffer[1024];
1346
1347 fc_snprintf(cult_buffer, sizeof(cult_buffer), PL_("%d turn", "%d turns",
1348 pterrain->cultivate_time),
1349 pterrain->cultivate_time);
1350 str = N_("Cultiv. Rslt/Time:");;
1353 + QString(cult_buffer).toHtmlEscaped();
1354 tb = new QLabel(this);
1355 tb->setProperty(fonts::help_label, "true");
1356 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1357 tb->setTextFormat(Qt::RichText);
1358 tb->setText(str.trimmed());
1359 connect(tb, &QLabel::linkActivated,
1361 info_layout->addWidget(tb);
1362 }
1363
1364 if (pterrain->plant_result != T_NONE
1366 QLabel *tb;
1367 char plant_buffer[1024];
1368
1369 fc_snprintf(plant_buffer, sizeof(plant_buffer), PL_("%d turn", "%d turns",
1370 pterrain->plant_time),
1371 pterrain->plant_time);
1372 str = N_("Plant Rslt/Time:");;
1375 + QString(plant_buffer).toHtmlEscaped();
1376 tb = new QLabel(this);
1377 tb->setProperty(fonts::help_label, "true");
1378 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1379 tb->setTextFormat(Qt::RichText);
1380 tb->setText(str.trimmed());
1381 connect(tb, &QLabel::linkActivated,
1383 info_layout->addWidget(tb);
1384 }
1385
1386 if (pterrain->transform_result != T_NONE
1388 NULL, &for_terr)) {
1389 QLabel *tb;
1390 char tf_buffer[1024];
1391
1392 fc_snprintf(tf_buffer, sizeof(tf_buffer), PL_("%d turn", "%d turns",
1393 pterrain->transform_time),
1394 pterrain->transform_time);
1395 str = N_("Trans. Rslt/Time:");
1398 + QString(tf_buffer).toHtmlEscaped();
1399 tb = new QLabel(this);
1400 tb->setProperty(fonts::help_label, "true");
1401 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1402 tb->setTextFormat(Qt::RichText);
1403 tb->setText(str.trimmed());
1404 connect(tb, &QLabel::linkActivated,
1406 info_layout->addWidget(tb);
1407 }
1408
1410 // TRANS: This and similar literal strings interpreted as (Qt) HTML
1412 _("Build as irrigation"));
1413 }
1416 _("Build as mine"));
1417 }
1420 _("Build as road"));
1421 }
1424 _("Build as base"));
1425 }
1426
1428
1429 // Create bottom widget
1430 panel = new QWidget();
1431 vbox = new QVBoxLayout(panel);
1432
1433 if (*(pterrain->resources)) {
1434 struct extra_type **r;
1435
1436 // TODO: include resource frequency information
1437 for (r = pterrain->resources; *r; r++) {
1438 canvas = terrain_canvas(pterrain, *r);
1439 vbox->addLayout(create_terrain_widget(
1441 canvas,
1442 // TRANS: %1 food, %2 shields, %3 trade
1443 QString(_("Tile output becomes %1, %2, %3."))
1444 .arg(pterrain->output[O_FOOD] + (*r)->data.resource->output[O_FOOD])
1445 .arg(pterrain->output[O_SHIELD] + (*r)->data.resource->output[O_SHIELD])
1446 .arg(pterrain->output[O_TRADE] + (*r)->data.resource->output[O_TRADE]),
1447 // TRANS: Tooltip decorating strings like "1, 2, 3".
1448 _("Output (Food, Shields, Trade) of a tile where the resource is "
1449 "present.")));
1451 show_panel = true;
1452 }
1453 }
1454
1455 vbox->addStretch(100);
1456 vbox->setSizeConstraint(QLayout::SetMinimumSize);
1457 if (show_panel) {
1458 area = new QScrollArea();
1459 area->setWidget(panel);
1460 set_bottom_panel(area);
1461 } else {
1462 panel->deleteLater();
1463 }
1464
1465 delete max;
1466 } else {
1467 set_topic_other(topic, title);
1468 }
1469}
1470
1471/**********************************************************************/
1477 const char *title)
1478{
1479 char buffer[MAX_HELP_TEXT_SIZE];
1481
1482 if (pextra) {
1483 canvas *canvas;
1484 int canvas_y, count, width, height;
1485 struct drawn_sprite sprs[80];
1486
1487 helptext_extra(buffer, sizeof(buffer), client.conn.playing,
1488 topic->text, pextra);
1489 text_browser->setPlainText(buffer);
1490
1491 // Create information panel
1493
1494 // Create extra icon.
1499 canvas->map_pixmap.fill(Qt::transparent);
1500 count = fill_basic_extra_sprite_array(tileset, sprs, pextra);
1501 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1504
1505 return false;
1506 } else {
1507 set_topic_other(topic, title);
1508
1509 return true;
1510 }
1511}
1512
1513/**********************************************************************/
1517 const char *title)
1518{
1519 char buffer[MAX_HELP_TEXT_SIZE];
1521 if (pspec) {
1522 helptext_specialist(buffer, sizeof(buffer), client.conn.playing,
1523 topic->text, pspec);
1524 text_browser->setPlainText(buffer);
1525 } else {
1526 set_topic_other(topic, title);
1527 }
1528}
1529
1530/**********************************************************************/
1534 const char *title)
1535{
1536 char buffer[MAX_HELP_TEXT_SIZE];
1538 if (pgov) {
1539 helptext_government(buffer, sizeof(buffer), client.conn.playing,
1540 topic->text, pgov);
1541 text_browser->setPlainText(buffer);
1542 } else {
1543 set_topic_other(topic, title);
1544 }
1545}
1546
1547/**********************************************************************/
1551 const char *title)
1552{
1553 char buffer[MAX_HELP_TEXT_SIZE];
1555 if (pnation) {
1556 helptext_nation(buffer, sizeof(buffer), pnation, topic->text);
1557 text_browser->setPlainText(buffer);
1558 } else {
1559 set_topic_other(topic, title);
1560 }
1561}
1562
1563/**********************************************************************/
1567 const char *title)
1568{
1569 char buffer[MAX_HELP_TEXT_SIZE];
1571 if (pgood) {
1572 helptext_goods(buffer, sizeof(buffer), client.conn.playing,
1573 topic->text, pgood);
1574 text_browser->setText(buffer);
1575 } else {
1576 set_topic_other(topic, title);
1577 }
1578}
1579
1580/**********************************************************************/
1591{
1592 Terrain_type_id i, count;
1593 struct terrain *terrain;
1594 struct terrain *max = new struct terrain;
1595
1596 max->base_time = 0;
1597 max->defense_bonus = 0;
1598 max->irrigation_food_incr = 0;
1599 max->irrigation_time = 0;
1600 max->mining_shield_incr = 0;
1601 max->mining_time = 0;
1602 max->movement_cost = 0;
1603 max->output[O_FOOD] = 0;
1604 max->output[O_GOLD] = 0;
1605 max->output[O_LUXURY] = 0;
1606 max->output[O_SCIENCE] = 0;
1607 max->output[O_SHIELD] = 0;
1608 max->output[O_TRADE] = 0;
1609 max->pillage_time = 0;
1610 max->road_output_incr_pct[O_FOOD] = 0;
1611 max->road_output_incr_pct[O_GOLD] = 0;
1615 max->road_output_incr_pct[O_TRADE] = 0;
1616 max->road_time = 0;
1617 max->transform_time = 0;
1618 count = terrain_count();
1619 for (i = 0; i < count; ++i) {
1621#define SET_MAX(v) \
1622 max->v = max->v > terrain->v ? max->v : terrain->v
1623 SET_MAX(base_time);
1624 SET_MAX(defense_bonus);
1625 SET_MAX(irrigation_food_incr);
1626 SET_MAX(irrigation_time);
1627 SET_MAX(mining_shield_incr);
1628 SET_MAX(mining_time);
1629 SET_MAX(movement_cost);
1630 SET_MAX(output[O_FOOD]);
1631 SET_MAX(output[O_GOLD]);
1632 SET_MAX(output[O_LUXURY]);
1633 SET_MAX(output[O_SCIENCE]);
1634 SET_MAX(output[O_SHIELD]);
1635 SET_MAX(output[O_TRADE]);
1636 SET_MAX(pillage_time);
1637 SET_MAX(road_output_incr_pct[O_FOOD]);
1638 SET_MAX(road_output_incr_pct[O_GOLD]);
1639 SET_MAX(road_output_incr_pct[O_LUXURY]);
1640 SET_MAX(road_output_incr_pct[O_SCIENCE]);
1641 SET_MAX(road_output_incr_pct[O_SHIELD]);
1642 SET_MAX(road_output_incr_pct[O_TRADE]);
1643 SET_MAX(road_time);
1644 SET_MAX(transform_time);
1645#undef SET_MAX
1646 }
1647 return max;
1648}
1649
1650/**********************************************************************/
1660{
1661 struct unit_type *max = new struct unit_type;
1662
1663 max->uclass = uclass;
1664 max->attack_strength = 0;
1665 max->bombard_rate = 0;
1666 max->build_cost = 0;
1667 max->city_size = 0;
1668 max->convert_time = 0;
1669 max->defense_strength = 0;
1670 max->firepower = 0;
1671 max->fuel = 0;
1672 max->happy_cost = 0;
1673 max->hp = 0;
1674 max->move_rate = 0;
1675 max->pop_cost = 0;
1676 max->upkeep[O_FOOD] = 0;
1677 max->upkeep[O_GOLD] = 0;
1678 max->upkeep[O_LUXURY] = 0;
1679 max->upkeep[O_SCIENCE] = 0;
1680 max->upkeep[O_SHIELD] = 0;
1681 max->upkeep[O_TRADE] = 0;
1682 max->vision_radius_sq = 0;
1683
1684 unit_type_iterate(utype) {
1685 if (utype->uclass == uclass) {
1686
1687#define SET_MAX(v) \
1688 max->v = max->v > utype->v ? max->v : utype->v
1689
1690 SET_MAX(attack_strength);
1691 SET_MAX(bombard_rate);
1692 SET_MAX(build_cost);
1693 SET_MAX(city_size);
1694 SET_MAX(convert_time);
1695 SET_MAX(defense_strength);
1696 SET_MAX(firepower);
1697 SET_MAX(fuel);
1698 SET_MAX(happy_cost);
1699 SET_MAX(hp);
1700 SET_MAX(move_rate);
1701 SET_MAX(pop_cost);
1702 SET_MAX(upkeep[O_FOOD]);
1703 SET_MAX(upkeep[O_GOLD]);
1704 SET_MAX(upkeep[O_LUXURY]);
1705 SET_MAX(upkeep[O_SCIENCE]);
1706 SET_MAX(upkeep[O_SHIELD]);
1707 SET_MAX(upkeep[O_TRADE]);
1708 SET_MAX(vision_radius_sq);
1709
1710#undef SET_MAX
1711
1712 }
1714
1715 return max;
1716}
#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni)
Definition actions.h:945
#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:364
QPushButton * next_butt
Definition helpdlg.h:50
void set_topic(const help_item *item)
Definition helpdlg.cpp:347
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:415
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:398
QList< QTreeWidgetItem * > item_history
Definition helpdlg.h:54
void history_back()
Definition helpdlg.cpp:381
void add_info_separator()
Definition helpdlg.cpp:753
QString link_me(const char *str, help_page_type hpt)
Definition helpdlg.cpp:742
void show_info_panel()
Definition helpdlg.cpp:618
void update_fonts()
Definition helpdlg.cpp:565
void set_topic_specialist(const help_item *item, const char *title)
Definition helpdlg.cpp:1516
void info_panel_done()
Definition helpdlg.cpp:761
void add_info_progress(const QString &label, int progress, int min, int max, const QString &value=QString())
Definition helpdlg.cpp:665
QSplitter * splitter
Definition helpdlg.h:89
void anchor_clicked(const QString &link)
Definition helpdlg.cpp:770
void set_bottom_panel(QWidget *widget)
Definition helpdlg.cpp:856
QWidget * main_widget
Definition helpdlg.h:85
void setup_ui()
Definition helpdlg.cpp:466
void add_info_pixmap(QPixmap *pm, bool shadow=false)
Definition helpdlg.cpp:627
void add_info_label(const QString &text)
Definition helpdlg.cpp:648
QVBoxLayout * info_layout
Definition helpdlg.h:90
void set_topic_tech(const help_item *item, const char *title)
Definition helpdlg.cpp:1093
void add_extras_of_act_for_terrain(struct terrain *pterr, enum unit_activity act, const char *label)
Definition helpdlg.cpp:704
QFrame * box_wdg
Definition helpdlg.h:82
void set_topic_other(const help_item *item, const char *title)
Definition helpdlg.cpp:863
void set_topic(const help_item *item)
Definition helpdlg.cpp:795
bool set_topic_extra(const help_item *item, const char *title)
Definition helpdlg.cpp:1476
void set_topic_nation(const help_item *item, const char *title)
Definition helpdlg.cpp:1550
QLayout * create_terrain_widget(const QString &title, const struct canvas *image, const QString &legend, const QString &tooltip=QString())
Definition helpdlg.cpp:1250
void undo_layout()
Definition helpdlg.cpp:595
QList< int > splitter_sizes
Definition helpdlg.h:91
struct unit_type * uclass_max_values(struct unit_class *uclass)
Definition helpdlg.cpp:1659
QTextBrowser * text_browser
Definition helpdlg.h:86
help_widget(QWidget *parent=0)
Definition helpdlg.cpp:436
void set_topic_terrain(const help_item *item, const char *title)
Definition helpdlg.cpp:1291
void do_layout(bool horizontal)
Definition helpdlg.cpp:517
void set_topic_goods(const help_item *item, const char *title)
Definition helpdlg.cpp:1566
QWidget * info_panel
Definition helpdlg.h:88
void set_topic_building(const help_item *item, const char *title)
Definition helpdlg.cpp:1001
void set_topic_government(const help_item *item, const char *title)
Definition helpdlg.cpp:1533
void set_topic_unit(const help_item *item, const char *title)
Definition helpdlg.cpp:876
QWidget * bottom_panel
Definition helpdlg.h:87
QLabel * title_label
Definition helpdlg.h:83
struct terrain * terrain_max_values()
Definition helpdlg.cpp:1590
void reactivate()
Definition dialogs.cpp:341
struct civclient client
static struct fc_sockaddr_list * list
Definition clinet.c:102
char * incite_cost
Definition comments.c:75
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:1076
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 Terrain_type_id
Definition fc_types.h:373
@ 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:4340
void helptext_advance(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, int i)
Definition helpdata.c:3299
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:3794
void helptext_goods(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct goods_type *pgood)
Definition helpdata.c:4259
char * helptext_unit_upkeep_str(const struct unit_type *utype)
Definition helpdata.c:5002
const char * helptext_extra_for_terrain_str(struct extra_type *pextra, struct terrain *pterrain, enum unit_activity act)
Definition helpdata.c:3760
void helptext_specialist(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct specialist *pspec)
Definition helpdata.c:4305
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:3520
void helptext_nation(char *buf, size_t bufsz, struct nation_type *pnation, const char *user_text)
Definition helpdata.c:5039
#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:1015
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:215
struct extra_type ** resources
Definition terrain.h:204
int road_time
Definition terrain.h:213
int plant_time
Definition terrain.h:219
struct terrain * plant_result
Definition terrain.h:218
int irrigation_food_incr
Definition terrain.h:221
int defense_bonus
Definition terrain.h:200
int cultivate_time
Definition terrain.h:216
int movement_cost
Definition terrain.h:199
int pillage_time
Definition terrain.h:232
int output[O_LAST]
Definition terrain.h:202
int transform_time
Definition terrain.h:231
int mining_time
Definition terrain.h:225
int road_output_incr_pct[O_LAST]
Definition terrain.h:211
struct terrain * transform_result
Definition terrain.h:229
int irrigation_time
Definition terrain.h:222
int base_time
Definition terrain.h:212
int mining_shield_incr
Definition terrain.h:224
struct unit_class * uclass
Definition unittype.h:556
int pop_cost
Definition unittype.h:513
int defense_strength
Definition unittype.h:516
int firepower
Definition unittype.h:525
int build_cost
Definition unittype.h:512
int convert_time
Definition unittype.h:531
int city_size
Definition unittype.h:550
const struct unit_type * obsoleted_by
Definition unittype.h:529
int vision_radius_sq
Definition unittype.h:522
int move_rate
Definition unittype.h:517
int bombard_rate
Definition unittype.h:547
int upkeep[O_LAST]
Definition unittype.h:538
int attack_strength
Definition unittype.h:515
int happy_cost
Definition unittype.h:537
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
struct advance * advance_by_number(const Tech_type_id atype)
Definition tech.c:107
bool is_future_tech(Tech_type_id tech)
Definition tech.c:281
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: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:56
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
Definition tilespec.c:6793
struct sprite * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
Definition tilespec.c:6783
int tileset_full_tile_height(const struct tileset *t)
Definition tilespec.c:789
int fill_basic_extra_sprite_array(const struct tileset *t, struct drawn_sprite *sprs, const struct extra_type *pextra)
Definition tilespec.c:7200
int fill_basic_terrain_layer_sprite_array(struct tileset *t, struct drawn_sprite *sprs, int layer, struct terrain *pterrain)
Definition tilespec.c:7167
int tileset_tile_height(const struct tileset *t)
Definition tilespec.c:765
int tileset_full_tile_width(const struct tileset *t)
Definition tilespec.c:776
struct sprite * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum unit_activity activity, enum direction8 facing)
Definition tilespec.c:6805
struct sprite * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *pnation)
Definition tilespec.c:6756
struct sprite * get_tech_sprite(const struct tileset *t, Tech_type_id tech)
Definition tilespec.c:6774
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:2724
int utype_build_shield_cost_base(const struct unit_type *punittype)
Definition unittype.c:1468
struct advance * utype_primary_tech_req(const struct unit_type *ptype)
Definition unittype.c:2710
struct unit_type * unit_type_by_translated_name(const char *name)
Definition unittype.c:1752
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1560
#define unit_type_iterate(_p)
Definition unittype.h:855
#define unit_type_iterate_end
Definition unittype.h:862