-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.h
124 lines (112 loc) · 3.43 KB
/
mainwindow.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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QTimer>
#include <QLabel>
#include <QList>
#include <QQueue>
#include <QPushButton>
#include <QMessageBox>
#include <QFileDialog>
#include <QSocketNotifier>
#include <QModelIndexList>
#include <QStandardItemModel>
#include "tcpsocket.h"
#include "configfile.h"
#include "winconfig.h"
#include "winlist.h"
#include "MtbModules.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
#define SERVO_MIN (0)
#define SERVO_MAX (255)
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
int servo_pos_act;
int servo_pos_last;
QTimer *timer_update_view;
QTimer *timer_autoclick;
tcpsocket *socket;
configfile cfgfile;
bool fileMode;
void changeLayoutType(int type);
private:
const QString winlabel = tr("MTB-daemon konfigurátor");
Ui::MainWindow *ui;
WinConfig *winConfig;
WinList *winList;
QLabel *io_label[28];
QPushButton *io_obutton[28];
QPushButton *io_ibutton[16];
int outputs[28];
int inputs[16];
TMtbModuleTypes MtbModuleTypes;
QStandardItemModel moduleModel;
QList<QString> moduleList;
int moduleSelected;
QList<TMtbModuleState> *ml; // pointer to active module list
void refreshModuleList(void);
void refreshModuleListModel(void);
/*
// ukoly co čekají ve fronte na splnění
typedef struct stask {
enum povel {povelObnovModuly, povelNactiInfo};
int param1;
} Ttask;
QQueue<Ttask> ukoly;
*/
void setFileMode(bool amode);
void initIOstatus(void);
void sendServoPos(void);
void countButtonPos(void);
void on_lvModule_changed(const int linenum);
void on_lvModule_settings();
public slots:
void timer_tick();
void timer_autoclick_tick();
void on_configChanged(int _moduleNum, TMtbModuleConfigGeneric* _cfg, int _modulytype);
void mtbModuleListChanged();
private slots:
void on_pb_set_stop_clicked();
void on_pb_connect_clicked();
void on_pb_disconnect_clicked();
void pbOutsClicked();
void onSocketConnect();
void onSocketDisconnect();
void on_getModuleStateOut(QJsonObject json);
void on_getModuleStateIn(QJsonObject json);
void on_responseModuleList();
void on_responseModuleInfo();
void on_pb_servoposset_clicked();
void on_pb_servoposset2_clicked();
void pbPlusminusClicked();
void on_pbReboot_clicked();
void on_pbDaemonSave_clicked();
void on_pbDaemonReload_clicked();
void on_pb_browsefw_clicked();
void on_pb_fw_upgrade_clicked();
void on_pbSettings_clicked();
void on_pbModuleChangeAddress_clicked();
void on_pbModuleChangeName_clicked();
void on_pbModuleChangeType_clicked();
void on_lvModuleList_activated(const QModelIndex &index);
void on_lvModuleList_clicked(const QModelIndex &index);
void on_pbLoadOffline_clicked();
void on_pbSaveOffline_clicked();
void on_pbModuleRemove_clicked();
void on_pbModuleAdd_clicked();
void on_lvModuleList_doubleClicked();
void on_pbLoc_clicked();
void on_pbModuleListRefresh_clicked();
void on_pbModuleList_clicked();
void on_pbForceAddress_clicked();
void on_pbAllOn_clicked();
void on_pbAllOff_clicked();
};
#endif // MAINWINDOW_H