-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMainWindow.h
More file actions
172 lines (143 loc) · 4.93 KB
/
MainWindow.h
File metadata and controls
172 lines (143 loc) · 4.93 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
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
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QListWidget>
#include <QTextBrowser>
#include <QThread>
#include <QGraphicsWidget>
#include <QMap>
#include <QSqlDatabase>
#include <pylon/PylonIncludes.h>
#include "CameraParam.h"
#include "CameraView.h"
#include "StorageView.h"
#include "DioView.h"
#include "BarcodeView.h"
#include "ReportView.h"
#include "CameraGrabThread.h"
namespace Ui {
class MainWindow;
}
typedef struct _SCamera
{
QString cameraName;
Pylon::CInstantCamera *camera;
CameraGrabThread *grab;
} SCamera;
typedef struct _SProcess
{
QString cameraName;
bool led0;
bool led1;
bool led2;
bool led3;
int snapDelayMs;
} SProcess;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
void DisplayImage();
private:
void initializeApp();
void initializeToolbar();
void setButtonStatus (bool isOpen, bool canGrab = false, bool canStop = false);
void resetValues();
//aplication settings
void writeAppSettings();
void readAppSettings();
//camera functions
int cameraAutoenumerate();
bool cameraOpen(QString cameraName);
bool cameraOpenAll();
void cameraCloseAll();
void cameraClose(QString cameraName);
bool cameraSnap(QString cameraName);
void cameraStartGrab(QString cameraName);
void cameraStopGrab(QString cameraName);
void getAllEnumValues(QStringList &Featurelist, Pylon::CInstantCamera *camera, GenICam::gcstring EnumFeatureName);
static QImage* toQImage(CPylonImage &pylonImage, QImage::Format format = QImage::Format_RGB888);
//database
bool initializeDatabase(QString dbsHostName, QString dbsDatabase, QString dbsUser, QString dbsPassword);
void closeDatabase();
//dock windows
void createTraceWindow(bool showWindow = false, int traceSize = 100);
void createParamWindow(bool showWindow = false);
void createDevicesWindow(bool showWindow = true, bool openAllCameras = false);
void createDioWindow(bool showWindow = false);
void createReportWindow(bool showWindow = false, bool errorQueryToFile = true);
void createStorageWindow(bool showWindow = false, QString storagePath = "c:/");
void createBarcodeWindow(bool showWindow);
void closeBarcode();
void closeTrace();
void closeDio();
void closeEvent(QCloseEvent *event);
public slots:
//trace window
void addTrace(QString text, QColor color = QColor("black"));
void clearTrace(QString text = "");
//camera parameters
void initializeParam(QString cameraName);
void setParamFloatValue(QString cameraName, QString nodeName,int value);
void setParamIntergerValue(QString cameraName, QString nodeName,int value);
void setParamStringValue(QString cameraName, QString nodeName, QString value);
void saveParameters(QString cameraName);
bool loadParameters(QString cameraName);
//store images
void processImages(QString barcode);
private slots:
void toolbar_DeviceOpen();
void toolbar_DeviceClose();
void toolbar_SingleGrab();
void toolbar_MultipleGrab();
void toolbar_ContinuesGrab();
void toolbar_GrabStop();
void devices_itemClicked(QListWidgetItem*);
//on_{ObjectName}_{SignalName}
void on_actionSaveImages_triggered(bool);
void on_actionRecordImages_triggered(bool);
void on_actionCloseImages_triggered(bool);
void on_actionOpenAll_triggered(bool);
void on_actionCloseAll_triggered(bool);
//dialogs
void aboutDialog();
int closeDialog();
void readImageFile(QString camera, QString imageName, QString error = "");
void recordImageFiles(QString label);
void saveImageFiles(QString targetDir);
private:
Ui::MainWindow *ui;
CameraView *view;
DioView *dio;
QListWidget *devices;
QTextBrowser *trace;
CameraParam *param;
ReportView *report;
StorageView *storage;
BarcodeView *barcode;
QMap<QString, SCamera*> cameras;
QList<SProcess> process;
QMap<QString, QDockWidget*> leftDockTabbing;
QSqlDatabase db;
//settings
bool allowShutDown;
QString catalogPath;
QString imageFormat;
int imageQuality;
int barcodeLenght;
int storageMinLimit;
int storageMinData;
int delayAfterLight;
bool traceErrorsToFile;
//tollbar icon actions
QAction *toolbarActionOpen;
QAction *toolbarActionClose;
QAction *toolbarActionSingleGrab;
QAction *toolbarActionMultipleGrab;
QAction *toolbarActionopenContinuesGrab ;
QAction *toolbarActionPlaybackStop;
QAction *toolbarActionRecordStart;
};
#endif // MAINWINDOW_H