15 #include <QGridLayout>
17 #include <QListWidget>
19 #include <QPushButton>
20 #include <QRadioButton>
41 QVBoxLayout *main_layout =
new QVBoxLayout(
this);
42 QGridLayout *bldg_layout =
new QGridLayout();
44 QPushButton *add_button;
45 QPushButton *delete_button;
46 QPushButton *reqs_button;
47 QPushButton *effects_button;
54 connect(
bldg_list, &QListWidget::itemSelectionChanged,
this,
58 bldg_layout->setSizeConstraint(QLayout::SetMaximumSize);
60 label =
new QLabel(QString::fromUtf8(
R__(
"Rule Name")));
61 label->setParent(
this);
62 rname =
new QLineEdit(
this);
63 rname->setText(QStringLiteral(
"None"));
65 bldg_layout->addWidget(label, 0, 0);
66 bldg_layout->addWidget(
rname, 0, 2);
68 label =
new QLabel(QString::fromUtf8(
R__(
"Name")));
69 label->setParent(
this);
71 connect(
same_name, &QAbstractButton::toggled,
this,
73 name =
new QLineEdit(
this);
74 name->setText(QStringLiteral(
"None"));
76 bldg_layout->addWidget(label, 1, 0);
78 bldg_layout->addWidget(
name, 1, 2);
81 new QPushButton(QString::fromUtf8(
R__(
"Requirements")),
this);
82 connect(reqs_button, &QAbstractButton::pressed,
this,
84 bldg_layout->addWidget(reqs_button, 2, 2);
86 effects_button =
new QPushButton(QString::fromUtf8(
R__(
"Effects")),
this);
87 connect(effects_button, &QAbstractButton::pressed,
this,
89 bldg_layout->addWidget(effects_button, 3, 2);
91 add_button =
new QPushButton(QString::fromUtf8(
R__(
"Add Building")),
this);
92 connect(add_button, &QAbstractButton::pressed,
this,
94 bldg_layout->addWidget(add_button, 4, 0);
98 new QPushButton(QString::fromUtf8(
R__(
"Remove this Building")),
this);
99 connect(delete_button, &QAbstractButton::pressed,
this,
101 bldg_layout->addWidget(delete_button, 4, 2);
106 main_layout->addLayout(bldg_layout);
108 setLayout(main_layout);
120 if (!pimpr->ruledit_disabled) {
121 QListWidgetItem *
item =
141 name->setText(dispn);
142 rname->setText(rulen);
143 if (dispn == rulen) {
144 name->setEnabled(
false);
148 name->setEnabled(
true);
151 name->setText(QStringLiteral(
"None"));
152 rname->setText(QStringLiteral(
"None"));
154 name->setEnabled(
false);
163 QList<QListWidgetItem *> select_list =
bldg_list->selectedItems();
165 if (!select_list.isEmpty()) {
168 bn_bytes = select_list.at(0)->text().toUtf8();
179 QByteArray name_bytes;
180 QByteArray rname_bytes;
185 rname_bytes =
rname->text().toUtf8();
199 name_bytes =
name->text().toUtf8();
200 rname_bytes =
rname->text().toUtf8();
250 if (pimpr->ruledit_disabled) {
252 pimpr->ruledit_disabled =
false;
284 name->setEnabled(!checked);
310 uni.
kind = VUT_IMPROVEMENT;
void display_msg(const char *msg)
Display status message.
void open_req_edit(const QString &target, struct requirement_vector *preqs)
Open req_edit dialog.
requirers_dlg * create_requirers(const char *title)
Create requirers dlg.
void open_effect_edit(const QString &target, struct universal *uni, enum effect_filter_main_class efmc)
Open effect_edit dialog.
struct impr_type * selected
void add_now2()
User requested new building.
void refresh()
Refresh the information.
void edit_reqs()
User wants to edit reqs.
bool initialize_new_bldg(struct impr_type *pimpr)
Initialize new tech for use.
void name_given()
User entered name for the building.
void update_bldg_info(struct impr_type *pimpr)
Update info of the building.
void select_bldg()
User selected building from the list.
tab_building(ruledit_gui *ui_in)
Setup tab_building object.
void edit_effects()
User wants to edit effects.
void delete_now()
User requested building deletion.
void same_name_toggle(bool checked)
Toggled whether rule_name and name should be kept identical.
const char * improvement_rule_name(const struct impr_type *pimprove)
Return the (untranslated) rule name of the improvement.
struct impr_type * improvement_by_rule_name(const char *name)
Does a linear search of improvement_types[].name.vernacular Returns nullptr when none match.
struct impr_type * improvement_by_number(const Impr_type_id id)
Returns the improvement type for the given index/ID.
Impr_type_id improvement_index(const struct impr_type *pimprove)
Return the improvement index.
#define improvement_iterate_end
#define improvement_iterate(_p)
static void name_set(struct name_translation *ptrans, const char *domain, const char *vernacular_name)
static const char * untranslated_name(const struct name_translation *ptrans)
static void names_set(struct name_translation *ptrans, const char *domain, const char *vernacular_name, const char *rule_name)
void show_experimental(QWidget *wdg)
Show widget if experimental features enabled, hide otherwise.
void ruledit_qt_display_requirers(const char *msg, void *data)
Display requirer list.
struct packet_ruleset_control control
struct requirement_vector reqs
struct name_translation name
const struct impr_type * building
bool is_building_needed(struct impr_type *pimpr, requirers_cb cb, void *data)
Check if anything in ruleset needs building.