added secondary video support

This commit is contained in:
Jared Bruni
2019-11-01 14:36:39 -07:00
parent 837362bb5c
commit 7513fbcf39
2 changed files with 36 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
#include "image_window.h"
ImageWindow::ImageWindow(QWidget *parent) : QDialog(parent) {
setFixedSize(800, 360);
setFixedSize(800, 400);
setWindowTitle(tr("Acid Cam v2 - Image Manager"));
createControls();
}
@@ -37,6 +37,18 @@ void ImageWindow::createControls() {
connect(image_set_cycle, SIGNAL(clicked()), this, SLOT(image_SetCycle()));
connect(image_files, SIGNAL(currentRowChanged(int)), this, SLOT(image_RowChanged(int)));
//image_files->addItem("TEST!!");
btn_setvideo = new QPushButton(tr("Set Video"), this);
btn_setvideo->setGeometry(15, 360, 100, 25);
btn_clear = new QPushButton(tr("Clear Video"), this);
btn_clear->setGeometry(115, 360, 100, 25);
lbl_video = new QLabel(tr("Video Not Set "), this);
lbl_video->setGeometry(215, 360, 800-360, 25);
connect(btn_setvideo, SIGNAL(clicked()), this, SLOT(video_Set()));
connect(btn_clear, SIGNAL(clicked()), this, SLOT(video_Clr()));
}
void ImageWindow::image_AddFiles() {
@@ -105,3 +117,22 @@ void ImageWindow::image_SetCycle() {
void ImageWindow::setPlayback(Playback *play) {
playback = play;
}
void ImageWindow::video_Set() {
QString file_name = QFileDialog::getOpenFileName(this,"Select A video file to open","/home","Video (*.mov *.mp4 *.mkv *.m4v)");
std::string vname = file_name.toStdString();
ac::v_cap.open(vname);
if(ac::v_cap.isOpened() == false) {
QMessageBox::information(this, "Error could not open file", "File not supported");
return;
}
lbl_video->setText("File Opened and Active");
}
void ImageWindow::video_Clr() {
if(ac::v_cap.isOpened()) {
ac::v_cap.release();
lbl_video->setText("Video closed..");
}
}

View File

@@ -16,6 +16,8 @@ public slots:
void image_SetFile();
void image_RowChanged(int index);
void image_SetCycle();
void video_Set();
void video_Clr();
private:
QListWidget *image_files;
QPushButton *add_files, *rmv_file, *set_file;
@@ -25,6 +27,8 @@ private:
QLineEdit *image_frames;
QPushButton *image_set_cycle;
Playback *playback;
QPushButton *btn_setvideo, *btn_clear;
QLabel *lbl_video;
};
#endif