Repository navigation
Expand file tree
/
Copy pathmainwindow.cpp
More file actions
58 lines (49 loc) · 1.58 KB
/
Copy pathmainwindow.cpp
File metadata and controls
58 lines (49 loc) · 1.58 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
#include <QMessageBox>
#include <iostream>
#include <QString>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
player = ui->playerLabel->getPlayer();
connect(ui->reverseRoiCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onReverseRoiCheckBoxStateChanged(int)));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_openFileButton_clicked()
{
QString filename = QFileDialog::getOpenFileName(this,
tr("Open Video"),
".",
tr("Video Files (*.avi *.mpg *.mp4")
);
if (!filename.isEmpty())
{
this->player->loadVideo(filename.toStdString());
this->player->play();
}
}
void MainWindow::on_exportButton_clicked()
{
auto loopData = this->ui->playerLabel->getPlayer()->getLoopData();
if (loopData != nullptr)
{
QString fileName = QFileDialog::getSaveFileName(this,
tr("Save video file"), QString::fromUtf8((loopData->filename + "_roi").c_str()),
tr("Videos (*.mp4)"));
this->ui->playerLabel->writeFile(fileName.toStdString());
}
}
void MainWindow::onReverseRoiCheckBoxStateChanged(int state)
{
auto playerLabel = this->ui->playerLabel;
auto loopRoi = playerLabel->getLoopRoi();
loopRoi->reverse = state;
playerLabel->updateRoiFrames();
}