19#include <QApplication>
20#include <QGraphicsDropShadowEffect>
23#include <QProgressBar>
30#include <QTextBrowser>
53#define MAX_HELP_TEXT_SIZE 8192
54#define REQ_LABEL_NEVER _("(Never)")
55#define REQ_LABEL_NONE _("?tech:None")
147 &QTreeWidget::currentItemChanged,
150 help_wdg->layout()->setContentsMargins(0, 0, 0, 0);
156 QStyle::QStyle::SP_ArrowLeft), (
""));
157 connect(
prev_butt, &QAbstractButton::clicked,
this,
161 QStyle::QStyle::SP_ArrowRight), (
""));
162 connect(
next_butt, &QAbstractButton::clicked,
this,
165 hbox->addStretch(20);
167 QStyle::SP_DialogHelpButton),
_(
"About Qt"));
168 connect(
but, &QPushButton::pressed, &QApplication::aboutQt);
169 hbox->addWidget(
but, Qt::AlignRight);
171 QStyle::SP_DialogDiscardButton),
_(
"Close"));
172 connect(
but, &QPushButton::pressed,
this, &QWidget::close);
173 hbox->addWidget(
but, Qt::AlignRight);
198 gui()->qt_settings.help_splitter1 =
splitter->saveState();
208 if (!
gui()->qt_settings.help_geometry.isNull()) {
210 splitter->restoreState(
gui()->qt_settings.help_splitter1);
212 QRect rect = QApplication::primaryScreen()->availableGeometry();
214 resize((rect.width() * 3) / 5, (rect.height() * 3) / 6);
215 sizes << rect.width() / 10 << rect.width() / 3;
226 gui()->qt_settings.help_splitter1 =
splitter->saveState();
256 for (s =
pitem->topic; *s ==
' '; s++) {
271 switch (
pitem->type) {
335 if (!icon.isNull()) {
336 item->setIcon(0, icon);
351 QHash<QTreeWidgetItem *, const help_item *>::const_iterator
354 if (
i.value() == topic) {
438 main_widget(
NULL), text_browser(
NULL), bottom_panel(
NULL),
449 main_widget(
NULL), text_browser(
NULL), bottom_panel(
NULL),
478 box_wdg->setFrameShape(QFrame::StyledPanel);
479 box_wdg->setFrameShadow(QFrame::Raised);
520 enum Qt::Orientation main_layout;
524 main_layout = Qt::Horizontal;
527 main_layout = Qt::Vertical;
573 for (
int i = 0;
i <
l.size(); ++
i) {
575 l.at(
i)->setFont(*
f);
579 for (
int i = 0;
i <
l.size(); ++
i) {
581 l.at(
i)->setFont(*
f);
585 for (
int i = 0;
i <
l.size(); ++
i) {
587 l.at(
i)->setFont(*
f);
629 QLabel *label =
new QLabel();
632 label->setAlignment(Qt::AlignHCenter);
633 label->setPixmap(*pm);
639 label->setGraphicsEffect(
effect);
650 QLabel *label =
new QLabel(text);
651 label->setWordWrap(
true);
652 label->setTextFormat(Qt::RichText);
666 int min,
int max,
const QString &value)
675 layout->setContentsMargins(0, 0, 0, 0);
676 layout->setVerticalSpacing(0);
678 label =
new QLabel(text,
wdg);
679 layout->addWidget(label, 0, 0);
681 label =
new QLabel(
wdg);
682 if (value.isEmpty()) {
683 label->setNum(progress);
685 label->setText(value);
688 layout->addWidget(label, 0, 1, Qt::AlignRight);
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);
715 if (pextra->buildable
721 tb =
new QLabel(
this);
723 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
724 tb->setTextFormat(Qt::RichText);
731 tb->setText(
str.trimmed());
732 connect(
tb, &QLabel::linkActivated,
745 s =
QString(
str).toHtmlEscaped().replace(
" ",
" ");
746 return " <a href=" + QString::number(
hpt)
747 +
"," + s +
">" + s +
"</a> ";
777 sl = link.split(
",");
778 n =
sl.at(0).toInt();
781 st =
st.replace(
"\u00A0",
" ");
808 switch (topic->
type) {
942 tb =
new QLabel(
this);
945 str =
"<b>" +
str +
"</b> "
949 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
950 tb->setTextFormat(Qt::RichText);
951 tb->setText(
str.trimmed());
952 connect(
tb, &QLabel::linkActivated,
966 tb =
new QLabel(
this);
967 str =
_(
"Obsoleted by");
968 str =
"<b>" +
str +
"</b> "
973 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
974 tb->setTextFormat(Qt::RichText);
975 tb->setText(
str.trimmed());
976 connect(
tb, &QLabel::linkActivated,
1021 str =
_(
"Base Cost:");
1022 str =
"<b>" +
str +
"</b>" +
" "
1028 str =
"<b>" +
str +
"</b>" +
" "
1029 + QString::number(
itype->upkeep).toHtmlEscaped();
1034 if (!
preq->present) {
1051 if (!
s1.isEmpty()) {
1052 tb =
new QLabel(
this);
1053 str =
_(
"Requirement:");
1056 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1057 tb->setTextFormat(Qt::RichText);
1058 tb->setText(
str.trimmed());
1059 connect(
tb, &QLabel::linkActivated,
1072 str =
_(
"Obsolete by:");
1074 if (!
s2.isEmpty()) {
1075 tb =
new QLabel(
this);
1077 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1078 tb->setTextFormat(Qt::RichText);
1079 tb->setText(
str.trimmed());
1080 connect(
tb, &QLabel::linkActivated,
1116 tb =
new QLabel(
this);
1118 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1119 tb->setTextFormat(Qt::RichText);
1121 str =
"<b>" +
str +
"</b> "
1123 tb->setText(
str.trimmed());
1124 connect(
tb, &QLabel::linkActivated,
1137 str =
"<b>" +
str +
"</b> "
1141 tb =
new QLabel(
this);
1143 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1144 tb->setTextFormat(Qt::RichText);
1145 tb->setText(
str.trimmed());
1146 connect(
tb, &QLabel::linkActivated,
1155 str =
_(
"Obsoletes");
1156 str =
"<b>" +
str +
"</b> "
1160 tb =
new QLabel(
this);
1162 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1163 tb->setTextFormat(Qt::RichText);
1164 tb->setText(
str.trimmed());
1165 connect(
tb, &QLabel::linkActivated,
1180 str =
"<b>" +
str +
"</b> "
1182 tb =
new QLabel(
this);
1184 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1185 tb->setTextFormat(Qt::RichText);
1186 tb->setText(
str.trimmed());
1187 connect(
tb, &QLabel::linkActivated,
1221 for (
i = 0;
i < 3; ++
i) {
1259 label =
new QLabel();
1261 effect->setBlurRadius(3);
1263 label->setGraphicsEffect(
effect);
1264 label->setPixmap(
image->map_pixmap);
1265 layout->addWidget(label, 0, 0, 2, 1);
1267 label =
new QLabel(
title);
1268 label->setTextFormat(Qt::PlainText);
1269 layout->addWidget(label, 0, 1, Qt::AlignBottom);
1272 label =
new QLabel(legend);
1273 label->setTextFormat(Qt::PlainText);
1274 layout->addWidget(label, 1, 1, Qt::AlignTop);
1279 label->setCursor(Qt::WhatsThisCursor);
1282 layout->setColumnStretch(0, 0);
1283 layout->setColumnStretch(1, 100);
1295 struct terrain *pterrain, *max;
1311 topic->
text, pterrain);
1350 str =
N_(
"Cultiv. Rslt/Time:");;
1354 tb =
new QLabel(
this);
1356 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1357 tb->setTextFormat(Qt::RichText);
1358 tb->setText(
str.trimmed());
1359 connect(
tb, &QLabel::linkActivated,
1372 str =
N_(
"Plant Rslt/Time:");;
1376 tb =
new QLabel(
this);
1378 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1379 tb->setTextFormat(Qt::RichText);
1380 tb->setText(
str.trimmed());
1381 connect(
tb, &QLabel::linkActivated,
1395 str =
N_(
"Trans. Rslt/Time:");
1399 tb =
new QLabel(
this);
1401 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1402 tb->setTextFormat(Qt::RichText);
1403 tb->setText(
str.trimmed());
1404 connect(
tb, &QLabel::linkActivated,
1412 _(
"Build as irrigation"));
1416 _(
"Build as mine"));
1420 _(
"Build as road"));
1424 _(
"Build as base"));
1430 panel =
new QWidget();
1437 for (r = pterrain->
resources; *r; r++) {
1443 QString(
_(
"Tile output becomes %1, %2, %3."))
1448 _(
"Output (Food, Shields, Trade) of a tile where the resource is "
1455 vbox->addStretch(100);
1456 vbox->setSizeConstraint(QLayout::SetMinimumSize);
1459 area->setWidget(panel);
1462 panel->deleteLater();
1488 topic->
text, pextra);
1619 for (
i = 0;
i < count; ++
i) {
1622 max->v = max->v > terrain->v ? max->v : terrain->v
1625 SET_MAX(irrigation_food_incr);
1685 if (utype->uclass == uclass) {
1688 max->v = max->v > utype->v ? max->v : utype->v
#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni)
void qtg_canvas_free(struct canvas *store)
struct canvas * qtg_canvas_create(int width, int height)
struct canvas int int struct sprite int int int int height
struct canvas int int canvas_y
struct canvas int int struct sprite int int int width
static fc_font * instance()
QFont * get_font(QString name)
void hideEvent(QHideEvent *event)
help_dialog(QWidget *parent=0)
void set_topic(const help_item *item)
void showEvent(QShowEvent *event)
QHash< QTreeWidgetItem *, const help_item * > topics_map
void item_changed(QTreeWidgetItem *item, QTreeWidgetItem *prev)
void closeEvent(QCloseEvent *event)
QList< QTreeWidgetItem * > item_history
static struct fc_sockaddr_list * list
const char * skip_intl_qualifier_prefix(const char *str)
#define PL_(String1, String2, n)
const char * government_name_translation(const struct government *pgovern)
struct government * government_by_translated_name(const char *name)
#define governments_iterate(NAME_pgov)
#define governments_iterate_end
static PangoLayout * layout
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
static struct canvas * terrain_canvas
void helptext_government(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct government *gov)
void helptext_advance(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, int i)
char * helptext_unit(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct unit_type *utype, bool class_help)
void helptext_extra(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct extra_type *pextra)
void helptext_goods(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct goods_type *pgood)
char * helptext_unit_upkeep_str(const struct unit_type *utype)
const char * helptext_extra_for_terrain_str(struct extra_type *pextra, struct terrain *pterrain, enum unit_activity act)
void helptext_specialist(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct specialist *pspec)
const struct help_item * get_help_item_spec(const char *name, enum help_page_type htype, int *pos)
char * helptext_building(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct impr_type *pimprove)
void helptext_terrain(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct terrain *pterrain)
void helptext_nation(char *buf, size_t bufsz, struct nation_type *pnation, const char *user_text)
#define help_items_iterate(pitem)
#define help_items_iterate_end
void popdown_help_dialog(void)
void popup_help_dialog_string(const char *item)
static help_dialog * help_dlg
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
#define MAX_HELP_TEXT_SIZE
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)
const char *const default_font
const char *const notify_label
const char *const help_label
const char *const help_text
struct nation_type * nation_by_translated_plural(const char *name)
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)
struct specialist * specialist_by_translated_name(const char *name)
struct terrain * cultivate_result
struct extra_type ** resources
struct terrain * plant_result
int road_output_incr_pct[O_LAST]
struct terrain * transform_result
struct unit_class * uclass
const struct unit_type * obsoleted_by
int fc_snprintf(char *str, size_t n, const char *format,...)
struct advance * advance_by_number(const Tech_type_id atype)
bool is_future_tech(Tech_type_id tech)
struct advance * advance_by_translated_name(const char *name)
const char * advance_name_translation(const struct advance *padvance)
Tech_type_id advance_number(const struct advance *padvance)
Terrain_type_id terrain_count(void)
struct terrain * terrain_by_translated_name(const char *name)
const char * terrain_name_translation(const struct terrain *pterrain)
struct terrain * terrain_by_number(const Terrain_type_id type)
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
struct sprite * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
int tileset_full_tile_height(const struct tileset *t)
int fill_basic_extra_sprite_array(const struct tileset *t, struct drawn_sprite *sprs, const struct extra_type *pextra)
int fill_basic_terrain_layer_sprite_array(struct tileset *t, struct drawn_sprite *sprs, int layer, struct terrain *pterrain)
int tileset_tile_height(const struct tileset *t)
int tileset_full_tile_width(const struct tileset *t)
struct sprite * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum unit_activity activity, enum direction8 facing)
struct sprite * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *pnation)
struct sprite * get_tech_sprite(const struct tileset *t, Tech_type_id tech)
struct goods_type * goods_by_translated_name(const char *name)
bool is_tech_req_for_utype(const struct unit_type *ptype, struct advance *padv)
int utype_build_shield_cost_base(const struct unit_type *punittype)
struct advance * utype_primary_tech_req(const struct unit_type *ptype)
struct unit_type * unit_type_by_translated_name(const char *name)
const char * utype_name_translation(const struct unit_type *punittype)
#define unit_type_iterate(_p)
#define unit_type_iterate_end