-
Notifications
You must be signed in to change notification settings - Fork 0
/
qmlinterface.h
240 lines (180 loc) · 8.3 KB
/
qmlinterface.h
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
#ifndef QMLINTERFACE_H
#define QMLINTERFACE_H
//#define DEBUG_QMLINTERFACE_H
#include <QObject>
#include <QProcess>
#include <QMutex>
#include <Qtimer>
#include <QNetworkInterface>
#include <QNetworkAddressEntry>
#include <QSettings>
#include <QDir>
#include <QValidator>
#include <QDate>
#include <QDebug>
#include "qmlstandarditemmodel.h"
#include "qmlsortfilterproxymodel.h"
class QmlInterface : public QObject
{
Q_OBJECT
public:
// qstandardItemmodel 에서 사용할 컬럼 정의
enum {
INDEX_QML_ZONES_ID,
INDEX_QML_ZONES_NAME,
INDEX_QML_ZONES_DANTENAME,
INDEX_QML_ZONES_DEVICE_TYPE,
INDEX_QML_ZONES_CHANNELNO,
INDEX_QML_ZONES_PRIMARYIP,
INDEX_QML_ZONES_SECONDARYIP,
INDEX_QML_ZONES_SELECTED,
INDEX_QML_ZONES_LOOPBACK,
INDEX_QML_ZONES_CONNECTION,
INDEX_QML_ZONES_COLOR,
INDEX_QML_ZONES_DISABLED,
INDEX_QML_ZONES_TXLABELS,
INDEX_QML_ZONES_RXVOLUME,
INDEX_QML_ZONES_RXSUBSCRIPTION,
INDEX_QML_ZONES_RXPROCESSING,
INDEX_QML_ZONES_COUNT
};
enum {
INDEX_QML_GROUPS_ID,
INDEX_QML_GROUPS_NAME,
INDEX_QML_GROUPS_SOURCE,
INDEX_QML_GROUPS_RXDANTENAMELIST,
INDEX_QML_GROUPS_RXCHANNELLIST,
INDEX_QML_GROUPS_SELECTED,
INDEX_QML_GROUPS_PROCESSING,
INDEX_QML_GROUPS_COUNT
};
enum {
INDEX_QML_NETWORK_INTERFACES_NAME,
INDEX_QML_NETWORK_INTERFACES_IP,
INDEX_QML_NETWORK_INTERFACES_NETMASK,
INDEX_QML_NETWORK_INTERFACES_MAC,
INDEX_QML_NETWORK_INTERFACES_LINKSPEED,
INDEX_QML_NETWORK_INTERFACES_ISUP,
INDEX_QML_NETWORK_INTERFACES_NETWORK_INTERFACE_INDEX, // dante 에서 사용되는 network card index 를 지칭함.
INDEX_QML_NETWORK_INTERFACES_SELECTED,
INDEX_QML_NETWORKINTERFACES_COUNT
};
public:
explicit QmlInterface(QObject *parent = 0);
~QmlInterface();
void initQmlModel();
void initQmlZonesModel();
void initQmlGroupsModel();
void initRegisteredTxZonesModel();
void initQmlNetworkInterfacesModel();
QmlStandardItemModel* modelRegisteredTxChannels() { return m_qmlModelRegisteredTxChannels; }
QmlStandardItemModel* modelGroups() { return m_qmlModelGroups; }
QmlStandardItemModel* modelMacros() { return m_qmlModelMacros; }
QmlStandardItemModel* modelAllZones() { return m_qmlModelAllZones; }
QmlStandardItemModel* modelNetworkInterfaces() { return m_qmlModelNetworkInterfaces; }
QmlSortFilterProxyModel* modelTxZones() { return m_qmlModelTxZones; }
QmlSortFilterProxyModel* modelRxZones(){ return m_qmlModelRxZones; }
// for qml <-> c++
Q_INVOKABLE bool isVisibleVK(QString imageName);
Q_INVOKABLE void showVirtualKeyboard(bool show );
Q_INVOKABLE void setGroupSelected(int row);
Q_INVOKABLE void removeGroups(int row);
Q_INVOKABLE void setRxZoneAllSelected(bool selected);
Q_INVOKABLE void setRxZoneSelected(QString danteName, QString channelNo, QString selected);
Q_INVOKABLE void setRxZoneSelected(int row);
Q_INVOKABLE void setRxZoneSelected(int row, bool selected);
Q_INVOKABLE void setRxZoneDisabled(QString danteName, bool on );
Q_INVOKABLE void setTxZoneSelected(QString danteName, QString channelNo, bool selected);
Q_INVOKABLE void setTxZoneSelected(int row, bool selected);
Q_INVOKABLE void setRegisteredTxZonesSelected(int row);
Q_INVOKABLE void setZoneRectWidth(int width);
Q_INVOKABLE void setZoneRectHeight(int height);
Q_INVOKABLE void setNetworkInterfaceSelected(int row);
Q_INVOKABLE void refreshNetworkInterfaces();
Q_INVOKABLE void reloadDevices();
Q_INVOKABLE QPoint zoneRectSize();
Q_INVOKABLE void setZoneName(QString deviceType, QString danteName, QString channelNo, QString name);
Q_INVOKABLE void setDanteName(QString danteName, QString newName);
Q_INVOKABLE void setGroupName(QString id, QString groupName );
Q_INVOKABLE void setEnableVirtualKeyboard(bool on);
Q_INVOKABLE bool isEnableVirtualKeyboard();
Q_INVOKABLE void insertTxRegisteredZones(int dragIndex, int targetIndex);
Q_INVOKABLE void moveTxRegisteredZones(int sourceIndex, int dstIndex );
Q_INVOKABLE void removeTxRegisteredZones(int dragIndex);
Q_INVOKABLE void onBtnGroupAddClicked();
Q_INVOKABLE void onBtnGroupRemoveClicked();
Q_INVOKABLE void onBtnDBDownloadClicked();
Q_INVOKABLE void onBtnSubsOnClicked();
Q_INVOKABLE void onBtnSubsOffClicked();
Q_INVOKABLE void onBtnCheckDeviceInfoClicked();
Q_INVOKABLE void onBtnLogShowClicked();
Q_INVOKABLE void onBtnDbManagementClicked();
QString firebirdDBInstallLocation();
Q_INVOKABLE void onBtnDbInitializeClicked();
Q_INVOKABLE void onBtnDbBackupClicked();
Q_INVOKABLE void onBtnDbRestoreClicked();
Q_INVOKABLE void setLoopback(QString danteName, bool on );
Q_INVOKABLE void onBtnLoopbackOnClicked(int leftRow, int rightRow);
Q_INVOKABLE void onBtnLoopbackOffClicked(int leftRow, int rightRow);
Q_INVOKABLE void onBtnSelAllClicked();
Q_INVOKABLE void onBtnDeselAllClicked();
Q_INVOKABLE void onTxtDBNameEditingFinished(QString data);
Q_INVOKABLE void onTxtServerIPEditingFinished(QString data);
Q_INVOKABLE void onTxtUserNameEditingFinished(QString data);
Q_INVOKABLE void onTxtPasswordEditingFinished(QString data);
Q_INVOKABLE QRegExpValidator* ipValidator();
int rowInRegisteredTxZones(QString danteName, QString channelNo);
void insertRegisteredTxZonesToDB(QList <QStandardItem*> items);
void removeRegisteredTxZonesFromDB(QString danteName, QString channelNo);
// loopback, subs on/off 를 위해 외부에서 사용되는 함수
QVariantMap AllRxZonesInfo();
QVariantMap selectedRxZonesInfo();
QString selectedTxZonesInfo();
QString loopbackTxInfo();
QString loopbackRxInfo();
private:
QmlStandardItemModel* m_qmlModelRegisteredTxChannels;
QmlStandardItemModel* m_qmlModelGroups;
QmlStandardItemModel* m_qmlModelMacros;
QmlStandardItemModel* m_qmlModelAllZones;
QmlStandardItemModel* m_qmlModelNetworkInterfaces;
QmlSortFilterProxyModel* m_qmlModelTxZones;
QmlSortFilterProxyModel* m_qmlModelRxZones;
QString m_loopbackRxInfo;
QString m_loopbackTxInfo;
signals:
void sgDBNameChanged(QString str);
void sgServerIPChanged(QString str);
void sgUserNameChanged(QString str);
void sgPasswordChanged(QString str);
void sgSetDanteName(QString from, QString to );
// qml 버튼이 눌리면 발생되는 signal
// qml 에서 직접 signal 을 만들어 사용하는 경우 해당 component 가 등록이 되어야 하기 때문에 불편함.
void sgBtnSubsOnClicked();
void sgBtnSubsOffClicked();
void sgBtnCheckDeviceInfoClicked();
void sgBtnLoopbackOperationOnClicked();
void sgBtnLoopbackOperationOffClicked();
void sgBtnLogShowClicked();
void sgBtnDbManagementClicked();
// qml 기타 설정에서 network interface 를 클릭할때 발생하는 시그널
void sgNetworkInterfaceSelected(QString name, QString macAddr, QString interfaceIndex);
void sgSetLoopback(QString danteName, bool on ) ;
// qml 에서 reload 아이콘을 클릭한 경우 browsing API 에 있는 내부 장비리스트를 전부 지우고 다시 검색 하게 함.
void sgReloadDevices();
public slots:
//conmon manager 에서 current interface 에 대한 정보가 올라오면 실행되는 함수.
void onCurrentNetworkInterface(QString name, QString macAddr);
void onDeviceOk(QString danteName);
void onDeviceError(QString danteName);
void onIpAddressChanged(QString danteName, QString ip);
void onRoutingGetNetworkLoopback(QString danteName, bool on);
void onRoutingGetRxChannelSubscription(QString danteName, int rxChannel, QString subscription);
// browsing channel 관련 정보 업데이트
void onAddTxChannel(QString danteName, QString channelNo);
void onRemoveTxChannel(QString danteName, QString channelNo);
void onAddTxLabel(QString danteName, QString channelNo, QString labelName);
void onRemoveTxLabel(QString danteName, QString channelNo, QString labelName);
void onRemoveDevice(QString danteName);
};
#endif // QMLINTERFACE_H