Feature #349 ยป 0050-Ruledit-Unify-buildings-flag-editing-with-other-flag.patch
tools/ruledit/edit_impr.cpp | ||
---|---|---|
#include "edit_impr.h"
|
||
#define FLAGROWS 15
|
||
/**********************************************************************//**
|
||
Setup edit_impr object
|
||
**************************************************************************/
|
||
... | ... | |
QPushButton *button;
|
||
QMenu *menu;
|
||
int row;
|
||
int rowcount;
|
||
int column;
|
||
ui = ui_in;
|
||
impr = impr_in;
|
||
... | ... | |
connect(button, SIGNAL(pressed()), this, SLOT(helptext()));
|
||
impr_layout->addWidget(button, row++, 1);
|
||
rowcount = 0;
|
||
column = 0;
|
||
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);
|
||
flag_layout->addWidget(label, rowcount, column + 1);
|
||
check->setChecked(BV_ISSET(impr->flags, flag));
|
||
flag_layout->addWidget(check, i, 1);
|
||
flag_layout->addWidget(check, rowcount, column);
|
||
if (++rowcount >= FLAGROWS) {
|
||
column += 2;
|
||
rowcount = 0;
|
||
}
|
||
}
|
||
refresh();
|
||
... | ... | |
**************************************************************************/
|
||
void edit_impr::closeEvent(QCloseEvent *cevent)
|
||
{
|
||
int rowcount;
|
||
int column;
|
||
close_help();
|
||
// Save values from text fields.
|
||
... | ... | |
sound_tag_alt2_given();
|
||
BV_CLR_ALL(impr->flags);
|
||
rowcount = 0;
|
||
column = 0;
|
||
for (int i = 0; i < IF_COUNT; i++) {
|
||
QCheckBox *check = static_cast<QCheckBox *>(flag_layout->itemAtPosition(i, 1)->widget());
|
||
QCheckBox *check = static_cast<QCheckBox *>(flag_layout->itemAtPosition(rowcount, column)->widget());
|
||
if (check->isChecked()) {
|
||
BV_SET(impr->flags, i);
|
||
}
|
||
if (++rowcount >= FLAGROWS) {
|
||
rowcount = 0;
|
||
column += 2;
|
||
}
|
||
}
|
||
impr->ruledit_dlg = nullptr;
|