-
Notifications
You must be signed in to change notification settings - Fork 1
/
qmapperdbmodel.cpp
94 lines (73 loc) · 2.11 KB
/
qmapperdbmodel.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#include "qmapperdbmodel.h"
QMapperDbModel::QMapperDbModel()
{
}
void QMapperDbModel::LoadFromTest(int testDB)
{
//make some devices with sigs
//some hard coded test situations
//we use same devices and signals for each test sample:
QString dev1name = "TestDev01";
mapperDevNames.append(dev1name);
for (int i=0; i<3; ++i)
{
QString signame = "signame" + QString::number(i+1);
QStandardItem* newSig = new QStandardItem(signame);
newSig->insertRow(0, new QStandardItem(dev1name));
newSig->insertRow(1, new QStandardItem("output"));
mapperSignals.append(newSig);
qDebug() << "signal " <<mapperSignals.size()-1<< " is output";
}
dev1name = "Synth01";
mapperDevNames.append(dev1name);
for (int i=0; i<5; ++i)
{
QString signame = "signame" + QString::number(i+1);
QStandardItem* newSig = new QStandardItem(signame);
newSig->insertRow(0, new QStandardItem(dev1name));
newSig->insertRow(1, new QStandardItem("input"));
mapperSignals.append(newSig);
qDebug() << "signal " <<mapperSignals.size()-1<< " is input";
}
/*
signal 0 is output
signal 1 is output
signal 2 is output
signal 3 is input
signal 4 is input
signal 5 is input
signal 6 is input
signal 7 is input
*/
//make some maps
if (testDB == 0)
{
mapperMapsSrc.append(0);
mapperMapsDst.append(4);
mapperMapsSrc.append(0);
mapperMapsDst.append(5);
mapperMapsSrc.append(2);
mapperMapsDst.append(7);
}
else if (testDB == 1)
{
mapperMapsSrc.append(1);
mapperMapsDst.append(4);
mapperMapsSrc.append(1);
mapperMapsDst.append(5);
mapperMapsSrc.append(2);
mapperMapsDst.append(7);
}
}
const QString QMapperDbModel::getSigName(int idx)
{
return mapperSignals.at(idx)->text();
}
const QString QMapperDbModel::getSigDevName(int idx)
{
return mapperSignals.at(idx)->child(0)->text();
}
const bool QMapperDbModel::isOutputSig(int idx)
{
return (mapperSignals.at(idx)->child(1)->text() == "output");
}