Freeciv-3.1
Loading...
Searching...
No Matches
helpdlg.h
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#ifndef FC__HELPDLG_H
15#define FC__HELPDLG_H
16
17// Qt
18#include <QDialog>
19#include <QHash>
20#include <QList>
21
22// common
23#include "extras.h"
24
25// client
26#include "helpdlg_g.h"
27
28// gui-qt
29#include "dialogs.h"
30
31
32// Forward declarations
33struct canvas;
34struct help_item;
35
36class QFrame;
37class QLabel;
38class QSplitter;
39class QTextBrowser;
40class QTreeWidget;
41class QTreeWidgetItem;
42class QVBoxLayout;
43
44class help_widget;
45
46class help_dialog : public qfc_dialog
47{
48 Q_OBJECT
49 QPushButton *prev_butt;
50 QPushButton *next_butt;
51 QTreeWidget *tree_wdg;
53 QSplitter *splitter;
54 QList<QTreeWidgetItem *> item_history;
55 QHash<QTreeWidgetItem *, const help_item *> topics_map;
57 void make_tree();
58public:
59 help_dialog(QWidget *parent = 0);
60 void update_fonts();
62
63public slots:
64 void set_topic(const help_item *item);
65 void history_forward();
66 void history_back();
67
68protected:
69 void showEvent(QShowEvent *event);
70 void hideEvent(QHideEvent *event);
71 void closeEvent(QCloseEvent *event);
72
73private slots:
74 void item_changed(QTreeWidgetItem *item, QTreeWidgetItem *prev);
75private:
76 void update_buttons();
77};
78
79class help_widget : public QWidget
80{
81 Q_OBJECT
82 QFrame *box_wdg;
83 QLabel *title_label;
84
85 QWidget *main_widget;
86 QTextBrowser *text_browser;
87 QWidget *bottom_panel;
88 QWidget *info_panel;
89 QSplitter *splitter;
90 QVBoxLayout *info_layout;
91 QList<int> splitter_sizes;
92
93 void setup_ui();
95
96 void do_layout(bool horizontal);
97 void undo_layout();
98
99 void show_info_panel();
100 void add_info_pixmap(QPixmap *pm, bool shadow = false);
101 void add_info_label(const QString &text);
102 void add_info_progress(const QString& label, int progress,
103 int min, int max,
104 const QString& value = QString());
105 void add_extras_of_act_for_terrain(struct terrain *pterr,
106 enum unit_activity act,
107 const char *label);
108 void add_info_separator();
109 void add_info_widget(QWidget *widget);
110 void info_panel_done();
111
112 void set_bottom_panel(QWidget *widget);
113
114 QLayout *create_terrain_widget(const QString& title,
115 const struct canvas* image,
116 const QString& legend,
117 const QString& tooltip = QString());
118
119 void set_topic_other(const help_item *item, const char *title);
120
121 void set_topic_any(const help_item *item, const char *title);
122 void set_topic_text(const help_item *item, const char *title);
123 void set_topic_unit(const help_item *item, const char *title);
124 void set_topic_building(const help_item *item, const char *title);
125 void set_topic_tech(const help_item *item, const char *title);
126 void set_topic_terrain(const help_item *item, const char *title);
127 bool set_topic_extra(const help_item *item, const char *title);
128 void set_topic_specialist(const help_item *item, const char *title);
129 void set_topic_government(const help_item *item, const char *title);
130 void set_topic_nation(const help_item *item, const char *title);
131 void set_topic_goods(const help_item *item, const char *title);
132
133public:
134 help_widget(QWidget *parent = 0);
135 help_widget(const help_item *item, QWidget *parent = 0);
136 ~help_widget();
137 void update_fonts();
138private:
139 QString link_me(const char *str, help_page_type hpt);
140
141public slots:
142 void set_topic(const help_item *item);
143private slots:
144 void anchor_clicked(const QString &link);
145
146public:
147 struct terrain *terrain_max_values();
148 struct unit_type *uclass_max_values(struct unit_class *uclass);
149};
150
151void update_help_fonts();
152
153#endif /* FC__HELPDLG_H */
#define str
Definition astring.c:76
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
void history_forward()
Definition helpdlg.cpp:363
QPushButton * next_butt
Definition helpdlg.h:50
void set_topic(const help_item *item)
Definition helpdlg.cpp:346
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:414
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:397
QList< QTreeWidgetItem * > item_history
Definition helpdlg.h:54
void history_back()
Definition helpdlg.cpp:380
void add_info_separator()
Definition helpdlg.cpp:752
QString link_me(const char *str, help_page_type hpt)
Definition helpdlg.cpp:741
void show_info_panel()
Definition helpdlg.cpp:617
void add_info_widget(QWidget *widget)
void update_fonts()
Definition helpdlg.cpp:564
void set_topic_specialist(const help_item *item, const char *title)
Definition helpdlg.cpp:1508
void info_panel_done()
Definition helpdlg.cpp:760
void add_info_progress(const QString &label, int progress, int min, int max, const QString &value=QString())
Definition helpdlg.cpp:664
QSplitter * splitter
Definition helpdlg.h:89
void anchor_clicked(const QString &link)
Definition helpdlg.cpp:769
void set_bottom_panel(QWidget *widget)
Definition helpdlg.cpp:853
QWidget * main_widget
Definition helpdlg.h:85
void setup_ui()
Definition helpdlg.cpp:465
void add_info_pixmap(QPixmap *pm, bool shadow=false)
Definition helpdlg.cpp:626
void add_info_label(const QString &text)
Definition helpdlg.cpp:647
QVBoxLayout * info_layout
Definition helpdlg.h:90
void set_topic_tech(const help_item *item, const char *title)
Definition helpdlg.cpp:1090
void add_extras_of_act_for_terrain(struct terrain *pterr, enum unit_activity act, const char *label)
Definition helpdlg.cpp:703
QFrame * box_wdg
Definition helpdlg.h:82
void set_topic_other(const help_item *item, const char *title)
Definition helpdlg.cpp:860
void set_topic(const help_item *item)
Definition helpdlg.cpp:794
bool set_topic_extra(const help_item *item, const char *title)
Definition helpdlg.cpp:1468
void set_topic_nation(const help_item *item, const char *title)
Definition helpdlg.cpp:1542
QLayout * create_terrain_widget(const QString &title, const struct canvas *image, const QString &legend, const QString &tooltip=QString())
Definition helpdlg.cpp:1245
void undo_layout()
Definition helpdlg.cpp:594
QList< int > splitter_sizes
Definition helpdlg.h:91
struct unit_type * uclass_max_values(struct unit_class *uclass)
Definition helpdlg.cpp:1654
QTextBrowser * text_browser
Definition helpdlg.h:86
void set_topic_terrain(const help_item *item, const char *title)
Definition helpdlg.cpp:1286
void do_layout(bool horizontal)
Definition helpdlg.cpp:516
void set_topic_goods(const help_item *item, const char *title)
Definition helpdlg.cpp:1558
void set_topic_any(const help_item *item, const char *title)
QWidget * info_panel
Definition helpdlg.h:88
void set_topic_building(const help_item *item, const char *title)
Definition helpdlg.cpp:998
void set_topic_government(const help_item *item, const char *title)
Definition helpdlg.cpp:1525
void set_topic_unit(const help_item *item, const char *title)
Definition helpdlg.cpp:873
QWidget * bottom_panel
Definition helpdlg.h:87
QLabel * title_label
Definition helpdlg.h:83
struct terrain * terrain_max_values()
Definition helpdlg.cpp:1582
void set_topic_text(const help_item *item, const char *title)
void set_main_widget(QWidget *main_widget)
enum event_type event
Definition events.c:81
const char * tooltip
Definition repodlgs.c:1314
const char * title
Definition repodlgs.c:1313
void update_help_fonts()
Definition helpdlg.cpp:113
help_page_type
Definition helpdlg_g.h:20
struct player_slot * slots
Definition player.c:50
Definition climisc.h:82