summaryrefslogtreecommitdiff
path: root/bytewindow.cpp
diff options
context:
space:
mode:
authorToni Uhlig <matzeton@googlemail.com>2023-07-30 20:55:52 +0200
committerToni Uhlig <matzeton@googlemail.com>2023-07-30 20:55:52 +0200
commit2da24be2e8f8ffa60e371557d75183b67fd2ea24 (patch)
treeec436bf94ad75fed1e0779d35a2bd7a64833babd /bytewindow.cpp
parent98c665b409595238d73f550f95c7bf83ec6142da (diff)
Added UI to insert/delete bytes into a packet.
Signed-off-by: Toni Uhlig <matzeton@googlemail.com>
Diffstat (limited to 'bytewindow.cpp')
-rw-r--r--bytewindow.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/bytewindow.cpp b/bytewindow.cpp
new file mode 100644
index 0000000..444399b
--- /dev/null
+++ b/bytewindow.cpp
@@ -0,0 +1,50 @@
+#include "bytewindow.h"
+#include "ui_bytewindow.h"
+
+ByteWindow::ByteWindow(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::ByteWindow)
+{
+ ui->setupUi(this);
+}
+
+ByteWindow::~ByteWindow()
+{
+ delete ui;
+}
+
+void ByteWindow::set(ByteWindowOption option, int offset, int size)
+{
+ switch (option) {
+ case ByteWindowOption::BWO_UNKNOWN:
+ case ByteWindowOption::BWO_INSERT:
+ ui->radioButtonInsert->click();
+ break;
+ case ByteWindowOption::BWO_DELETE:
+ ui->radioButtonDelete->click();
+ break;
+ }
+
+ ui->spinBoxIndex->setValue(offset);
+ ui->spinBoxSize->setValue(size);
+}
+
+ByteWindowOption ByteWindow::getOption()
+{
+ if (ui->radioButtonInsert->isChecked())
+ return ByteWindowOption::BWO_INSERT;
+ if (ui->radioButtonDelete->isChecked())
+ return ByteWindowOption::BWO_DELETE;
+
+ return ByteWindowOption::BWO_UNKNOWN;
+}
+
+int ByteWindow::getOffset()
+{
+ return ui->spinBoxIndex->value();
+}
+
+int ByteWindow::getSize()
+{
+ return ui->spinBoxSize->value();
+}