Add rule functions and classes.
This commit is contained in:
parent
703f2d4b10
commit
4434ecc3f7
39
deleteruledialog.cpp
Normal file
39
deleteruledialog.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include "deleteruledialog.h"
|
||||
#include "ui_deleteruledialog.h"
|
||||
|
||||
DeleteRuleDialog::DeleteRuleDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DeleteRuleDialog) {
|
||||
ui->setupUi(this);
|
||||
|
||||
pRuleNames = QStringList();
|
||||
|
||||
connect(ui->pushButton_Delete, &QPushButton::clicked, this, &DeleteRuleDialog::DeleteRule);
|
||||
connect(ui->pushButton_Cancel, &QPushButton::clicked, this, &DeleteRuleDialog::Cancel);
|
||||
}
|
||||
|
||||
DeleteRuleDialog::~DeleteRuleDialog() {
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DeleteRuleDialog::SetRuleNames(QStringList ruleNames) {
|
||||
ui->listWidget_Rules->clear();
|
||||
foreach (QString ruleName, ruleNames) {
|
||||
ui->listWidget_Rules->addItem(ruleName);
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteRuleDialog::DeleteRule() {
|
||||
QList<QListWidgetItem *> items = ui->listWidget_Rules->selectedItems();
|
||||
if (items.count() == 0) { return; }
|
||||
|
||||
foreach (QListWidgetItem *item, items) {
|
||||
emit RuleDeleted(item->text());
|
||||
}
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
void DeleteRuleDialog::Cancel() {
|
||||
close();
|
||||
}
|
||||
32
deleteruledialog.h
Normal file
32
deleteruledialog.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef DELETERULEDIALOG_H
|
||||
#define DELETERULEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class DeleteRuleDialog;
|
||||
}
|
||||
|
||||
class DeleteRuleDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DeleteRuleDialog(QWidget *parent = nullptr);
|
||||
~DeleteRuleDialog();
|
||||
|
||||
void SetRuleNames(QStringList ruleNames);
|
||||
|
||||
public slots:
|
||||
void DeleteRule();
|
||||
void Cancel();
|
||||
|
||||
signals:
|
||||
void RuleDeleted(QString ruleName);
|
||||
|
||||
private:
|
||||
Ui::DeleteRuleDialog *ui;
|
||||
QStringList pRuleNames;
|
||||
};
|
||||
|
||||
#endif // DELETERULEDIALOG_H
|
||||
100
deleteruledialog.ui
Normal file
100
deleteruledialog.ui
Normal file
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DeleteRuleDialog</class>
|
||||
<widget class="QDialog" name="DeleteRuleDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>192</width>
|
||||
<height>176</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>192</width>
|
||||
<height>176</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>328</width>
|
||||
<height>310</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Select a rule to delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget_Rules">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
</font>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Delete">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_Cancel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<family>CommitMono</family>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
x
Reference in New Issue
Block a user