Working on new camera session dialog

This commit is contained in:
lostjared
2017-02-02 07:25:16 -08:00
parent 5a4c8b3f5d
commit 4e99e6828e
5 changed files with 56 additions and 2 deletions

View File

@@ -38,7 +38,10 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
createMenu();
cap_camera = new CaptureCamera(this);
cap_camera->setParent(this);
cap_video = new CaptureVideo(this);
cap_video->setParent(this);
statusBar()->showMessage(tr("Acid Cam v2 Loaded - Use File Menu to Start"));
}
@@ -130,7 +133,7 @@ void AC_MainWindow::createMenu() {
controls_stop->setShortcut(tr("Ctrl+C"));
controls_menu->addAction(controls_stop);
controls_snapshot = new QAction(tr("&Snap"), this);
controls_snapshot = new QAction(tr("Take &Snapshot"), this);
controls_snapshot->setShortcut(tr("Ctrl+S"));
controls_menu->addAction(controls_snapshot);
@@ -200,6 +203,19 @@ void AC_MainWindow::Log(const QString &s) {
log_text->setTextCursor(tmpCursor);
}
bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool record) {
// setup device
// if successful
file_new_capture->setEnabled(false);
file_new_video->setEnabled(false);
return true;
}
void AC_MainWindow::controls_Stop() {
}

View File

@@ -9,6 +9,7 @@ class AC_MainWindow : public QMainWindow {
public:
AC_MainWindow(QWidget *parent = 0);
void Log(const QString &s);
bool startCamera(int res, int dev, const QString &outdir, bool record);
QListWidget *filters, *custom_filters;
QPushButton *btn_add, *btn_remove, *btn_moveup, *btn_movedown;

View File

@@ -1,4 +1,6 @@
#include "new_dialog.h"
#include "main_window.h"
CaptureCamera::CaptureCamera(QWidget *parent) : QDialog(parent) {
setFixedSize(290, 120);
@@ -38,12 +40,28 @@ void CaptureCamera::createControls() {
connect(btn_select, SIGNAL(clicked()), this, SLOT(btn_Select()));
}
void CaptureCamera::setParent(AC_MainWindow *p) {
win_parent = p;
}
void CaptureCamera::btn_Select() {
QString dir = QFileDialog::getExistingDirectory(this, tr("Open Directory"), "/home",QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if(dir != "") {
output_dir->setText(dir);
}
}
void CaptureCamera::btn_Start() {
if(output_dir->text().length() > 0) {
if(win_parent->startCamera(combo_res->currentIndex(), combo_device->currentIndex(), output_dir->text(), chk_record->isChecked())) {
hide();
} else {
QMessageBox::information(this, "Could not open Capture device", "Make sure you Webcam is pluged in. If you have more than one Webcam use the proper device index.");
}
}
}
CaptureVideo::CaptureVideo(QWidget *parent) : QDialog(parent) {
@@ -56,3 +74,11 @@ CaptureVideo::CaptureVideo(QWidget *parent) : QDialog(parent) {
void CaptureVideo::createControls() {
}
void CaptureVideo::setParent(AC_MainWindow *p) {
win_parent = p;
}

View File

@@ -3,21 +3,27 @@
#include "qtheaders.h"
class AC_MainWindow;
class CaptureCamera : public QDialog {
Q_OBJECT
public:
CaptureCamera(QWidget *parent = 0);
void createControls();
void setParent(AC_MainWindow *p);
QComboBox *combo_res, *combo_device;
QLineEdit *output_dir;
QCheckBox *chk_record;
QPushButton *btn_start, *btn_select;
public slots:
void btn_Select();
void btn_Start();
private:
AC_MainWindow *win_parent;
};
class CaptureVideo : public QDialog {
@@ -25,6 +31,10 @@ class CaptureVideo : public QDialog {
public:
CaptureVideo(QWidget *parent = 0);
void createControls();
void setParent(AC_MainWindow *p);
private:
AC_MainWindow *win_parent;
};

View File

@@ -18,6 +18,7 @@
#include<QLabel>
#include<QTextStream>
#include<QLineEdit>
#include<QFileDialog>
#include"ac.h"
#include"fractal.h"
#include<unordered_map>