summaryrefslogtreecommitdiff
path: root/bytewindow.cpp
blob: 444399bb9e39722da109a6ae2d6537c8f5920357 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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();
}