Freeciv-3.3: /fast/freeciv/nightly/main/client/gui-qt/optiondlg.h Source File

Freeciv-3.3

Loading...
Searching...
No Matches
optiondlg.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__OPTIONDLG_H
15#define FC__OPTIONDLG_H
16
17extern "C" {
18#include "optiondlg_g.h"
19}
20
21// Qt
22#include <QDialog>
23#include <QMap>
24
25// qt-client
26#include "dialogs.h"
27
28class Qdialog;
29class QVBoxLayout;
30class QTabWidget;
31class QDialogButtonBox;
32class QWidget;
33class QString;
34
35 QString split_text(QString text, bool cut);
36 QString cut_helptext(QString text);
37
38void option_dialog_popup(QString name, const struct option_set *poptset,
39 bool client);
40
41/****************************************************************************
42 Dialog for client/server options
43****************************************************************************/
44class option_dialog : public qfc_dialog
45{
46 Q_OBJECT
47 QVBoxLayout *main_layout;
48 QTabWidget *tab_widget;
49 QDialogButtonBox *button_box;
50 QList <QString> categories;
51 QMap <QString, QWidget *> widget_map;
52
53public:
54 option_dialog(const QString &name, const option_set *options, bool client_set,
55 QWidget *parent = nullptr);
56 ~option_dialog();
57 void fill(const struct option_set *poptset);
58 void add_option(struct option *poption);
59 void option_dialog_refresh(struct option *poption);
60 void option_dialog_reset(struct option *poption);
61 void full_refresh();
62 void apply_options();
63
64private:
65 bool client_settings; // As opposed to server ones
66 const option_set *curr_options;
67 void set_bool(struct option *poption, bool value);
68 void set_int(struct option *poption, int value);
69 void set_string(struct option *poption, const char *string);
70 void set_enum(struct option *poption, int index);
71 void set_bitwise(struct option *poption, unsigned value);
72 void set_color(struct option *poption, struct ft_color color);
73 void set_button_color(QPushButton *button, const char *colorname);
74 void set_font(struct option *poption, QString s);
75 void get_color(struct option *poption, QByteArray &a1, QByteArray &a2);
76 bool get_bool(struct option *poption);
77 int get_int(struct option *poption);
78 QFont get_font(struct option *poption);
79 QByteArray get_button_font(struct option *poption);
80 QByteArray get_string(struct option *poption);
81 int get_enum(struct option *poption);
82 unsigned get_bitwise(struct option *poption);
83 void full_reset();
84
85protected:
86 void showEvent(QShowEvent *event);
87 void hideEvent(QHideEvent *event);
88 void closeEvent(QCloseEvent *event);
89
90private slots:
91 void apply_option(int response);
92 void select_color();
93 void select_font();
94};
95
96#endif // FC__OPTIONDLG_H
qfc_dialog
Definition dialogs.h:74
client
struct civclient client
Definition client_main.c:150
incite_cost
char * incite_cost
Definition comments.c:74
event
enum event_type event
Definition events.c:81
option_dialog_popup
void option_dialog_popup(const char *name, const struct option_set *poptset)
Definition optiondlg.c:972
split_text
QString split_text(QString text, bool cut)
Definition optiondlg.cpp:62
cut_helptext
QString cut_helptext(QString text)
Definition optiondlg.cpp:105
dialogs.h
name
const char * name
Definition inputfile.c:127
optiondlg_g.h
slots
struct player_slot * slots
Definition player.c:51
color
Definition colors.h:21
ft_color
Definition featured_text.h:141
option_dialog
Definition optiondlg.c:41
option_dialog::get_bitwise
unsigned get_bitwise(struct option *poption)
Definition optiondlg.cpp:453
option_dialog::curr_options
const option_set * curr_options
Definition optiondlg.h:66
option_dialog::select_color
void select_color()
Definition optiondlg.cpp:854
option_dialog::hideEvent
void hideEvent(QHideEvent *event)
Definition optiondlg.cpp:894
option_dialog::tab_widget
QTabWidget * tab_widget
Definition optiondlg.h:48
option_dialog::widget_map
QMap< QString, QWidget * > widget_map
Definition optiondlg.h:51
option_dialog::get_button_font
QByteArray get_button_font(struct option *poption)
Definition optiondlg.cpp:841
option_dialog::get_color
void get_color(struct option *poption, QByteArray &a1, QByteArray &a2)
Definition optiondlg.cpp:235
option_dialog::get_bool
bool get_bool(struct option *poption)
Definition optiondlg.cpp:313
option_dialog::button_box
QDialogButtonBox * button_box
Definition optiondlg.h:49
option_dialog::set_string
void set_string(struct option *poption, const char *string)
Definition optiondlg.cpp:372
option_dialog::set_int
void set_int(struct option *poption, int value)
Definition optiondlg.cpp:328
option_dialog::full_reset
void full_reset()
Definition optiondlg.cpp:554
option_dialog::categories
QList< QString > categories
Definition optiondlg.h:50
option_dialog::showEvent
void showEvent(QShowEvent *event)
Definition optiondlg.cpp:878
option_dialog::get_string
QByteArray get_string(struct option *poption)
Definition optiondlg.cpp:393
option_dialog::~option_dialog
~option_dialog()
Definition optiondlg.cpp:193
option_dialog::get_enum
int get_enum(struct option *poption)
Definition optiondlg.cpp:421
option_dialog::select_font
void select_font()
Definition optiondlg.cpp:808
option_dialog::add_option
void add_option(struct option *poption)
Definition optiondlg.cpp:608
option_dialog::set_bool
void set_bool(struct option *poption, bool value)
Definition optiondlg.cpp:298
option_dialog::set_enum
void set_enum(struct option *poption, int index)
Definition optiondlg.cpp:410
option_dialog::apply_option
void apply_option(int response)
Definition optiondlg.cpp:204
option_dialog::closeEvent
void closeEvent(QCloseEvent *event)
Definition optiondlg.cpp:906
option_dialog::main_layout
QVBoxLayout * main_layout
Definition optiondlg.h:47
option_dialog::apply_options
void apply_options()
Definition optiondlg.cpp:257
option_dialog::full_refresh
void full_refresh()
Definition optiondlg.cpp:544
option_dialog::set_font
void set_font(struct option *poption, QString s)
Definition optiondlg.cpp:341
option_dialog::get_font
QFont get_font(struct option *poption)
Definition optiondlg.cpp:828
option_dialog::poptset
const struct option_set * poptset
Definition optiondlg.c:42
option_dialog::option_dialog_reset
void option_dialog_reset(struct option *poption)
Definition optiondlg.cpp:564
option_dialog::set_color
void set_color(struct option *poption, struct ft_color color)
Definition optiondlg.cpp:494
option_dialog::fill
void fill(const struct option_set *poptset)
Definition optiondlg.cpp:598
option_dialog::option_dialog_refresh
void option_dialog_refresh(struct option *poption)
Definition optiondlg.cpp:510
option_dialog::get_int
int get_int(struct option *poption)
Definition optiondlg.cpp:361
option_dialog::set_button_color
void set_button_color(QPushButton *button, const char *colorname)
Definition optiondlg.cpp:474
option_dialog::set_bitwise
void set_bitwise(struct option *poption, unsigned value)
Definition optiondlg.cpp:432
option_dialog::client_settings
bool client_settings
Definition optiondlg.h:65
option_set
Definition options.c:444
option
Definition options.c:514