-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodeDialog.cpp
More file actions
65 lines (58 loc) · 1.38 KB
/
Copy pathNodeDialog.cpp
File metadata and controls
65 lines (58 loc) · 1.38 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "NodeDialog.h"
#include "Lib/ModbusLib/ModBusLib.h"
#include "Lib/OMC8000Lib/OMC8000Lib.h"
#include "ui_NodeDialog.h"
NodeDialog::NodeDialog(EModelType type, QWidget *parent) :
QDialog(parent),
ui(new Ui::NodeDialog)
{
ui->setupUi(this);
switch(type)
{
case EModelType_ModBus:
ui->type->addItem(QString("BOOL"));
ui->type->addItem(QString("BYTE"));
ui->type->addItem(QString("WORD"));
break;
case EModelType_OMC8000:
ui->type->addItem(QString("BOOL"));
ui->type->addItem(QString("BYTE"));
ui->type->addItem(QString("WORD"));
ui->type->addItem(QString("DWORD"));
ui->type->addItem(QString("REAL32"));
break;
}
}
NodeDialog::~NodeDialog()
{
delete ui;
}
void NodeDialog::on_buttonBox_accepted()
{
nodeData.id.clear();
nodeData.id.append(ui->id->text());
switch(ui->type->currentIndex())
{
case 0:
nodeData.type = NodeType_Bit;
break;
case 1:
nodeData.type = NodeType_Byte;
break;
case 2:
nodeData.type = NodeType_Word;
break;
case 3:
nodeData.type = NodeType_DWord;
break;
case 4:
nodeData.type = NodeType_Real32;
break;
}
nodeData.offset = ui->offset->value();
this->setResult(1);
}
void NodeDialog::on_buttonBox_rejected()
{
this->setResult(0);
}