-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinsertmeterdialog.cpp
46 lines (38 loc) · 998 Bytes
/
insertmeterdialog.cpp
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
#include "insertmeterdialog.h"
#include "ui_insertmeterdialog.h"
#include "moji_defy.h"
InsertMeterDialog::InsertMeterDialog(quint16 command, QVariantList hm, QWidget *parent) :
QDialog(parent),
ui(new Ui::InsertMeterDialog)
{
ui->setupUi(this);
hashmeter = hm;
wcommand = command;
}
InsertMeterDialog::~InsertMeterDialog()
{
delete ui;
}
void InsertMeterDialog::on_buttonBox_accepted()
{
QJsonObject h;
h.insert("m", QJsonArray::fromVariantList( hashmeter));
int pos = ui->sbPosition->value();
if(ui->rbAppend->isChecked())
pos = 20000;
else{
if(ui->rbPrepend->isChecked())
pos = 0;
}
h.insert("i", pos);
//0 - ignore new meter, 1 - replace old meter, 2 - abort all
int collision = 0;
if(ui->rbCollsnInsrtNewVal->isChecked())
collision = 1;
else{
if(ui->rbAbort->isChecked())
collision = 2;
}
h.insert("c", collision);
emit data2matilda(wcommand, h);
}