Freeciv-3.3
Loading...
Searching...
No Matches
edit_gov.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 <QGridLayout>
20#include <QLineEdit>
21#include <QPushButton>
22
23// common
24#include "government.h"
25
26// ruledit
27#include "helpeditor.h"
28#include "ruledit.h"
29#include "ruledit_qt.h"
30
31#include "edit_gov.h"
32
33
34/**********************************************************************/
38{
39 QHBoxLayout *main_layout = new QHBoxLayout(this);
41 QLabel *label;
42 QPushButton *button;
43 int row;
44
45 ui = ui_in;
46 gov = gov_in;
47
48 setWindowTitle(QString::fromUtf8(government_rule_name(gov)));
49
50 row = 0;
51
52 label = new QLabel(QString::fromUtf8(R__("Graphics tag")));
53 label->setParent(this);
54
55 gfx_tag = new QLineEdit(this);
56 connect(gfx_tag, SIGNAL(returnPressed()), this, SLOT(gfx_tag_given()));
57
58 gov_layout->addWidget(label, row, 0);
59 gov_layout->addWidget(gfx_tag, row++, 1);
60
61 label = new QLabel(QString::fromUtf8(R__("Alt graphics tag")));
62 label->setParent(this);
63
64 gfx_tag_alt = new QLineEdit(this);
66
67 gov_layout->addWidget(label, row, 0);
68 gov_layout->addWidget(gfx_tag_alt, row++, 1);
69
70 label = new QLabel(QString::fromUtf8(R__("Sound tag")));
71 label->setParent(this);
72
73 sound_tag = new QLineEdit(this);
74 connect(sound_tag, SIGNAL(returnPressed()), this, SLOT(sound_tag_given()));
75
76 gov_layout->addWidget(label, row, 0);
77 gov_layout->addWidget(sound_tag, row++, 1);
78
79 label = new QLabel(QString::fromUtf8(R__("Alt sound tag")));
80 label->setParent(this);
81
82 sound_tag_alt = new QLineEdit(this);
84
85 gov_layout->addWidget(label, row, 0);
86 gov_layout->addWidget(sound_tag_alt, row++, 1);
87
88 label = new QLabel(QString::fromUtf8(R__("Second alt sound tag")));
89 label->setParent(this);
90
91 sound_tag_alt2 = new QLineEdit(this);
93
94 gov_layout->addWidget(label, row, 0);
95 gov_layout->addWidget(sound_tag_alt2, row++, 1);
96
97 button = new QPushButton(QString::fromUtf8(R__("Helptext")), this);
98 connect(button, SIGNAL(pressed()), this, SLOT(helptext()));
99 gov_layout->addWidget(button, row++, 1);
100
101 refresh();
102
103 main_layout->addLayout(gov_layout);
104
105 setLayout(main_layout);
106}
107
108/**********************************************************************/
112{
113 close_help();
114
115 // Save values from text fields.
121
122 gov->ruledit_dlg = nullptr;
123}
124
125/**********************************************************************/
129{
130 gfx_tag->setText(gov->graphic_str);
131 gfx_tag_alt->setText(gov->graphic_alt);
132 sound_tag->setText(gov->sound_str);
133 sound_tag_alt->setText(gov->sound_alt);
134 sound_tag_alt2->setText(gov->sound_alt2);
135}
136
137/**********************************************************************/
141{
142 QByteArray tag_bytes = gfx_tag->text().toUtf8();
143
145}
146
147/**********************************************************************/
156
157/**********************************************************************/
161{
162 QByteArray tag_bytes = sound_tag->text().toUtf8();
163
165}
166
167/**********************************************************************/
176
177/**********************************************************************/
186
187/**********************************************************************/
191{
193}
struct government * gov
Definition edit_gov.h:42
QLineEdit * sound_tag
Definition edit_gov.h:45
QLineEdit * sound_tag_alt2
Definition edit_gov.h:47
void sound_tag_alt_given()
Definition edit_gov.cpp:170
ruledit_gui * ui
Definition edit_gov.h:41
void gfx_tag_alt_given()
Definition edit_gov.cpp:150
void sound_tag_alt2_given()
Definition edit_gov.cpp:180
void refresh()
Definition edit_gov.cpp:128
void closeEvent(QCloseEvent *cevent)
Definition edit_gov.cpp:111
void gfx_tag_given()
Definition edit_gov.cpp:140
QLineEdit * sound_tag_alt
Definition edit_gov.h:46
void helptext()
Definition edit_gov.cpp:190
void sound_tag_given()
Definition edit_gov.cpp:160
QLineEdit * gfx_tag_alt
Definition edit_gov.h:44
edit_gov(ruledit_gui *ui_in, struct government *gov_in)
Definition edit_gov.cpp:37
QLineEdit * gfx_tag
Definition edit_gov.h:43
void close_help()
void open_help(struct strvec **help)
char * incite_cost
Definition comments.c:76
#define R__(String)
Definition fcintl.h:75
const char * government_rule_name(const struct government *pgovern)
Definition government.c:133
struct strvec * helptext
Definition government.h:65
void * ruledit_dlg
Definition government.h:56
char graphic_alt[MAX_LEN_NAME]
Definition government.h:58
char sound_alt2[MAX_LEN_NAME]
Definition government.h:61
char sound_str[MAX_LEN_NAME]
Definition government.h:59
char graphic_str[MAX_LEN_NAME]
Definition government.h:57
char sound_alt[MAX_LEN_NAME]
Definition government.h:60
#define sz_strlcpy(dest, src)
Definition support.h:195