This repository was archived by the owner on Apr 14, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmainwindow.cpp.orig
More file actions
245 lines (177 loc) · 6.14 KB
/
mainwindow.cpp.orig
File metadata and controls
245 lines (177 loc) · 6.14 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
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
241
242
243
244
245
#include "mainwindow.h"
//#include "ui_mainwindow.h"
#include "ui_mainwindow.h"
#include "camera.h"
#include "videoqlabel.h"
<<<<<<< HEAD
#include "calibration.h"
#include "frame_holder.h"
=======
#include "video_dispatch.h"
>>>>>>> b295794928b92c070c358a0a3feba7c85cdd6221
#include <QMainWindow>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QMessageBox>
#include <QGroupBox>
#include <QPushButton>
#include <QMainWindow>
#include <QLabel>
#include <QHBoxLayout>
#include <QTabWidget>
#include <QAction>
#include <QMenuBar>
#include <QMenu>
#include <QWidget>
#include <QApplication>
#include <QTimer>
#include <QCloseEvent>
#include <QGridLayout>
// Constructor:
//*********************************************************************************************************************
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
createMenu();
// main layout:
QWidget *centralWidget = new QWidget(this);
QHBoxLayout *mainLayout = new QHBoxLayout;
centralWidget->setLayout(mainLayout);
// ui->setupUi(this);
// left box:
//**************************************************
QWidget *leftBox = new QWidget(centralWidget);
QVBoxLayout *leftBoxLayout = new QVBoxLayout(leftBox);
leftBox->setLayout(leftBoxLayout);
leftBox->setStyleSheet("background-color:#e9e9e9;");
createLeftBoxLayout(leftBoxLayout);
QGroupBox *algorithmStartBox = createAlgorithmBox();
leftBoxLayout->addWidget(algorithmStartBox);
QGroupBox *calibrationBox = createCalibrationBox();
leftBoxLayout->addWidget(calibrationBox);
QGroupBox *mouseBox = createMouseBox();
leftBoxLayout->addWidget(mouseBox);
//right box:
//**************************************************
QWidget *rightBox = new QWidget;
// video box QLabel
VideoQLabel *videoBox = new VideoQLabel(rightBox);
videoBox->setActiveClick(true);
videoBox->setText("Video stream window");
QGridLayout *rightBoxLayout = new QGridLayout;
rightBoxLayout->addWidget(videoBox);
rightBox->setLayout(rightBoxLayout);
rightBox->setStyleSheet("background-color:#e9e9e9;");
// add boxes to main layout:
mainLayout->addWidget(leftBox,1);
mainLayout->addWidget(rightBox,3);
// set central widget of QMainWindow
setCentralWidget(centralWidget);
// calibration measures
calibration = new Calibration();
FrameHolder *holder = new FrameHolder();
calibration->setFrameHolder(holder);
dispatcher = new VideoDispatcher();
dispatcher->attach(videoBox);
dispatcher->attach(holder);
initiateTimer();
connect(videoBox,SIGNAL(mousePressed(QPoint,QSize)),calibration,SLOT(receiveClickedPixel(QPoint,QSize)));
calibration->setState(GATHERING);
}
// Destructor:
//*********************************************************************************************************************
MainWindow::~MainWindow()
{
}
void MainWindow::createMenu(){
saveAction = new QAction("Save", this);
loadAction = new QAction("Load", this);
quitAction = new QAction("Quit", this);
connect(saveAction, SIGNAL(triggered()), this, SLOT(save()));
connect(loadAction, SIGNAL(triggered()), this, SLOT(load()));
connect(quitAction, SIGNAL(triggered()), this, SLOT(quit()));
QMenuBar *menuBar = new QMenuBar(this);
QMenu *menuFile = new QMenu("File",menuBar);
menuBar->addMenu(menuFile);
menuFile->addAction(saveAction);
menuFile->addAction(loadAction);
menuFile->addAction(quitAction);
setMenuBar(menuBar);
}
// methods:
//*********************************************************************************************************************
QGroupBox* MainWindow::createAlgorithmBox(){
QGroupBox *algorithmStartBox = new QGroupBox("Algorithm:");
startButton = new QPushButton("Start");
connect(startButton, SIGNAL(clicked()), this, SLOT(start()));
QWidget *comboWidget = new QWidget;
QLabel *comboLabel = new QLabel("Choose camera:");
QHBoxLayout *comboLayout = new QHBoxLayout;
camerasCombo= new QComboBox;
/***************************************************************
*
* Napisać kod znajdujący kamery
*
*
* *************************************************************/
camerasCombo->addItem("A");
camerasCombo->addItem("B");
camerasCombo->addItem("C");
comboLayout->addWidget(comboLabel);
comboLayout->addWidget(camerasCombo);
comboWidget->setLayout(comboLayout);
stopButton = new QPushButton("Stop");
connect(stopButton,SIGNAL(clicked()), this, SLOT(stop()));
QVBoxLayout *boxLayout = new QVBoxLayout;
boxLayout->addWidget(startButton);
boxLayout->addWidget(comboWidget);
boxLayout->addWidget(stopButton);
algorithmStartBox->setLayout(boxLayout);
return algorithmStartBox;
}
QGroupBox* MainWindow::createCalibrationBox(){
QGroupBox *algorithmCalibrationBox = new QGroupBox("Calibration:");
return algorithmCalibrationBox;
}
QGroupBox* MainWindow::createMouseBox(){
QGroupBox *algorithmMouseBox = new QGroupBox("Mouse:");
return algorithmMouseBox;
}
void MainWindow::initiateTimer(){
paintTimer = new QTimer(this);
connect(paintTimer,SIGNAL(timeout()),dispatcher,SLOT(dispatchFrame()));
paintTimer->start(1000/DEFAULT_FPS);
}
void MainWindow::closeEvent(QCloseEvent *event){
quit();
}
void MainWindow::createLeftBoxLayout(QVBoxLayout *layout){
/* QTabWidget *tabs = new QtabWidget();
QWidget *primary = new QWidget();
QWidget *Calibration = new Qwidget();*/
}
void MainWindow::cleanUp(){
paintTimer->stop();
delete dispatcher;
}
// Slots:
//*********************************************************************************************************************
void MainWindow::save(){
}
void MainWindow::load(){
}
void MainWindow::quit(){
/*QMessageBox::StandardButton reply;
reply = QMessageBox::question(this, "Mouth", "Do you really want to quit?",
QMessageBox::Yes|QMessageBox::No);
if (reply == QMessageBox::Yes){
cleanUp();
qApp->quit();
}*/
cleanUp();
qApp->quit();
}
// butons:
void MainWindow::start(){
}
void MainWindow::stop(){
}