Project

General

Profile

Feature #156 » 0021-Ruledit-Add-buildings-flags-editing.patch

S3_1 - Marko Lindqvist, 01/09/2024 01:51 AM

View differences:

tools/ruledit/edit_impr.cpp
#endif
// Qt
#include <QCheckBox>
#include <QGridLayout>
#include <QLineEdit>
#include <QMenu>
......
**************************************************************************/
edit_impr::edit_impr(ruledit_gui *ui_in, struct impr_type *impr_in) : QDialog()
{
QVBoxLayout *main_layout = new QVBoxLayout(this);
QHBoxLayout *main_layout = new QHBoxLayout(this);
QGridLayout *impr_layout = new QGridLayout();
QLabel *label;
QMenu *menu;
......
ui = ui_in;
impr = impr_in;
flag_layout = new QGridLayout();
setWindowTitle(QString::fromUtf8(improvement_rule_name(impr)));
label = new QLabel(QString::fromUtf8(R__("Build Cost")));
......
impr_layout->addWidget(label, row, 0);
impr_layout->addWidget(sound_tag_alt, row++, 1);
for (int i = 0; i < IF_COUNT; i++) {
enum impr_flag_id flag = (enum impr_flag_id)i;
QCheckBox *check = new QCheckBox();
label = new QLabel(impr_flag_id_name(flag));
flag_layout->addWidget(label, i, 0);
check->setChecked(BV_ISSET(impr->flags, flag));
flag_layout->addWidget(check, i, 1);
}
refresh();
main_layout->addLayout(impr_layout);
main_layout->addLayout(flag_layout);
setLayout(main_layout);
}
......
sound_tag_given();
sound_tag_alt_given();
BV_CLR_ALL(impr->flags);
for (int i = 0; i < IF_COUNT; i++) {
QCheckBox *check = static_cast<QCheckBox *>(flag_layout->itemAtPosition(i, 1)->widget());
if (check->isChecked()) {
BV_SET(impr->flags, i);
}
}
impr->ruledit_dlg = nullptr;
}
tools/ruledit/edit_impr.h
// Qt
#include <QDialog>
class QGridLayout;
class QLineEdit;
class QSpinBox;
class QToolButton;
......
QLineEdit *sound_tag;
QLineEdit *sound_tag_alt;
QGridLayout *flag_layout;
protected:
void closeEvent(QCloseEvent *cevent);
(2-2/2)