-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMainWindow.cpp
More file actions
72 lines (60 loc) · 2.26 KB
/
MainWindow.cpp
File metadata and controls
72 lines (60 loc) · 2.26 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
#include "../MainWindow.h"
namespace BioTracker {
namespace Gui {
MainWindow::MainWindow(Core::BioTrackerApp &biotracker)
: m_ui(this)
, m_algorithmSelection(m_ui.widget_alg, biotracker)
, m_notification(m_ui.dockWidgetNotificationContents, biotracker)
, m_openCameraDialog(m_ui.centralWidget, biotracker)
, m_tools(m_ui.groupBoxContents) {
initalizeVideoView(biotracker);
{
QFile file(QString::fromStdString(ConfigParam::GEOMETRY_FILE.string()));
if (file.open(QIODevice::ReadOnly)) {
restoreGeometry(file.readAll());
}
}
{
QFile file(QString::fromStdString(ConfigParam::STATE_FILE.string()));
if (file.open(QIODevice::ReadOnly)) {
restoreState(file.readAll());
}
}
}
void MainWindow::initalizeVideoView(Core::BioTrackerApp &biotracker) {
m_videoView = std::make_unique<VideoView>(m_ui.trackingArea, biotracker);
m_ui.videoViewLayout->addWidget(m_videoView.get());
m_videoControl = std::make_unique<VideoControlWidget>(m_ui.videoControls,
biotracker, m_videoView.get());
}
void MainWindow::closeEvent(QCloseEvent *event) {
const auto dialog = QMessageBox::warning(
this, "Exit", "Do you really want to close the application?",
QMessageBox::Yes | QMessageBox::No);
if (dialog == QMessageBox::Yes) {
{
QFile file(QString::fromStdString(ConfigParam::GEOMETRY_FILE.string()));
if (file.open(QIODevice::WriteOnly)) {
file.write(saveGeometry());
}
}
{
QFile file(QString::fromStdString(ConfigParam::STATE_FILE.string()));
if (file.open(QIODevice::WriteOnly)) {
file.write(saveState());
}
}
QMainWindow::closeEvent(event);
} else {
event->ignore();
}
}
void MainWindow::frameCalculated(const size_t, const std::string filename, const double) {
setWindowTitle("BioTracker [" + QString::fromStdString(Util::stem_filename(filename)) + "]");
}
void MainWindow::trackerSelected(std::shared_ptr<Core::TrackingAlgorithm> tracker) {
m_tools.addWidget(tracker->getToolsWidget());
m_ui.groupBox_tools->repaint();
}
} // Gui
} // BioTracker