Feature #323 » 0016-Ruledit-Add-extra-flag-editing.patch
tools/ruledit/edit_extra.cpp | ||
---|---|---|
#include "edit_extra.h"
|
||
#define FLAGROWS 15
|
||
/**********************************************************************//**
|
||
Setup edit_extra object
|
||
**************************************************************************/
|
||
... | ... | |
QGridLayout *extra_layout = new QGridLayout();
|
||
QLabel *label;
|
||
int row = 0;
|
||
int rowcount;
|
||
int column;
|
||
ui = ui_in;
|
||
extra = extra_in;
|
||
natives_layout = new QGridLayout();
|
||
flag_layout = new QGridLayout();
|
||
setWindowTitle(QString::fromUtf8(extra_rule_name(extra)));
|
||
... | ... | |
natives_layout->addWidget(check, i + 1, 1);
|
||
}
|
||
rowcount = 0;
|
||
column = 0;
|
||
for (int i = 0; i < EF_LAST_USER_FLAG; i++) {
|
||
enum extra_flag_id flag = (enum extra_flag_id)i;
|
||
QCheckBox *check = new QCheckBox();
|
||
label = new QLabel(extra_flag_id_name(flag));
|
||
flag_layout->addWidget(label, rowcount, column + 1);
|
||
check->setChecked(BV_ISSET(extra->flags, flag));
|
||
flag_layout->addWidget(check, rowcount, column);
|
||
if (++rowcount >= FLAGROWS) {
|
||
column += 2;
|
||
rowcount = 0;
|
||
}
|
||
}
|
||
refresh();
|
||
main_layout->addLayout(extra_layout);
|
||
main_layout->addLayout(natives_layout);
|
||
main_layout->addLayout(flag_layout);
|
||
setLayout(main_layout);
|
||
}
|
||
... | ... | |
**************************************************************************/
|
||
void edit_extra::closeEvent(QCloseEvent *cevent)
|
||
{
|
||
int rowcount;
|
||
int column;
|
||
// Save values from text fields.
|
||
gfx_tag_given();
|
||
gfx_tag_alt_given();
|
||
... | ... | |
}
|
||
}
|
||
BV_CLR_ALL(extra->flags);
|
||
rowcount = 0;
|
||
column = 0;
|
||
for (int i = 0; i < EF_LAST_USER_FLAG; i++) {
|
||
QCheckBox *check = static_cast<QCheckBox *>(flag_layout->itemAtPosition(rowcount, column)->widget());
|
||
if (check->isChecked()) {
|
||
BV_SET(extra->flags, i);
|
||
}
|
||
if (++rowcount >= FLAGROWS) {
|
||
rowcount = 0;
|
||
column += 2;
|
||
}
|
||
}
|
||
extra->ruledit_dlg = nullptr;
|
||
}
|
||
tools/ruledit/edit_extra.h | ||
---|---|---|
QLineEdit *rmact_gfx_alt2;
|
||
QGridLayout *natives_layout;
|
||
QGridLayout *flag_layout;
|
||
protected:
|
||
void closeEvent(QCloseEvent *cevent);
|
- « Previous
- 1
- 2
- Next »