27 Q_ASSERT(manager != NULL);
39 myRules->setSelectionMode(QAbstractItemView::SingleSelection);
40 myRules->setSelectionBehavior(QAbstractItemView::SelectRows);
41 myRules->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
42 myRules->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
50 myRules->verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
53 addWidget(tr(
"Message rules (blue: uses token set by current rule as pre-condition, red: rule that sets token for pre-condition of current rule)"),
myRules,
false,
nullptr,
nullptr);
55 QHBoxLayout* buttons =
new QHBoxLayout();
57 QPushButton* add =
new QPushButton(tr(
"insert rule"),
this);
58 buttons->addWidget(add);
59 connect(add, SIGNAL(clicked(
bool)),
this, SLOT(
onAddRule(
bool)));
60 QPushButton* remove =
new QPushButton(tr(
"remove rule"),
this);
61 buttons->addWidget(remove);
62 connect(remove, SIGNAL(clicked(
bool)),
this, SLOT(
onDeleteRule(
bool)));
64 QPushButton* up =
new QPushButton(tr(
"move up"),
this);
65 buttons->addWidget(up);
66 connect(up, SIGNAL(clicked(
bool)),
this, SLOT(
onMoveUp(
bool)));
67 QPushButton* down =
new QPushButton(tr(
"move down"),
this);
68 buttons->addWidget(down);
69 connect(down, SIGNAL(clicked(
bool)),
this, SLOT(
onMoveDown(
bool)));
71 QPushButton* copy =
new QPushButton(tr(
"copy"),
this);
72 buttons->addWidget(copy);
73 connect(copy, SIGNAL(clicked(
bool)),
this, SLOT(
onDuplicate(
bool)));
75 QPushButton* reset =
new QPushButton(tr(
"reset all changes"),
this);
76 buttons->addWidget(reset);
77 connect(reset, SIGNAL(clicked(
bool)),
this, SLOT(
onReset(
bool)));
82 myUse =
new QTreeWidget(
this);
109 QTreeWidgetItem* root = NULL;
112 root =
new QTreeWidgetItem(
myUse, QStringList(tr(
"Maps")));
113 root->setExpanded(
true);
116 new QTreeWidgetItem(root, QStringList(map->
path()));
126 QStringList includes = rule->
include();
127 foreach(QString include, includes)
129 if (include.isEmpty())
132 if (!include.startsWith(
'/'))
134 int last = file->
path().lastIndexOf(QDir::separator());
137 include = file->
path().left(last + 1) + include;
144 root =
new QTreeWidgetItem(
myUse, QStringList(tr(
"Messages")));
145 root->setExpanded(
true);
148 new QTreeWidgetItem(root, QStringList(file->
path()));
174 int row =
myRules->selectionModel()->currentIndex().row() + 1;
176 myRules->selectionModel()->select(
myModel->
index(row, 0, QModelIndex()), QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
186 int index =
myRules->currentIndex().row();
196 int index =
myRules->currentIndex().row();
197 if (index < 0 || index >=
myItem->
rules().size() - 1)
206 int index =
myRules->currentIndex().row();
218 if (QMessageBox::question(
this,
"Confirm reset",
"Reset message to its initial values?") != QMessageBox::StandardButton::Yes)