working on adding search

This commit is contained in:
lostjared
2018-08-10 11:10:40 -07:00
parent 6ebce2994a
commit df3f231135
16 changed files with 53 additions and 54 deletions

0
src/display_window.cpp Executable file → Normal file
View File

0
src/display_window.h Executable file → Normal file
View File

0
src/main.cpp Executable file → Normal file
View File

41
src/main_window.cpp Executable file → Normal file
View File

@@ -66,6 +66,9 @@ AC_MainWindow::AC_MainWindow(QWidget *parent) : QMainWindow(parent) {
cap_video = new CaptureVideo(this);
cap_video->setParent(this);
search_box = new SearchWindow(this);
search_box->setParent(this);
statusBar()->showMessage(tr("Acid Cam v2 Loaded - Use File Menu to Start"));
take_snapshot = false;
disp = new DisplayWindow(this);
@@ -232,12 +235,12 @@ void AC_MainWindow::createControls() {
log_text->setGeometry(10, 325, 780,310);
log_text->setReadOnly(true);
QString text = tr("Acid Cam Filters v");
text += ac::version.c_str();
text += " loaded.\n";
QString text;
QTextStream stream(&text);
stream << tr("Acid Cam Filters v");
stream << ac::version.c_str();
stream << " loaded " << filters->count() << " filters.\n";
log_text->setText(text);
chk_negate = new QCheckBox(tr("Negate"), this);
chk_negate->setGeometry(120,215,100, 20);
chk_negate->setCheckState(Qt::Unchecked);
@@ -323,6 +326,10 @@ void AC_MainWindow::createMenu() {
controls_showvideo->setEnabled(false);
controls_showvideo->setCheckable(true);
open_search = new QAction(tr("Search Filters"), this);
open_search->setShortcut(tr("Ctrl+S"));
controls_menu->addAction(open_search);
connect(open_search,SIGNAL(triggered()), this, SLOT(openSearch()));
connect(controls_snapshot, SIGNAL(triggered()), this, SLOT(controls_Snap()));
connect(controls_pause, SIGNAL(triggered()), this, SLOT(controls_Pause()));
connect(controls_step, SIGNAL(triggered()), this, SLOT(controls_Step()));
@@ -504,11 +511,7 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
struct tm *m;
m = localtime(&t);
QString ext;
#if defined(__APPLE__) || defined(__linux__)
ext = (type == 0) ? ".mov" : ".avi";
#else
ext = (type == 0) ? ".mov" : ".mov";
#endif
Log(tr("Capture Device Opened [Camera]\n"));
std::ostringstream time_stream;
time_stream << "-" << (m->tm_year + 1900) << "." << (m->tm_mon + 1) << "." << m->tm_mday << "_" << m->tm_hour << "." << m->tm_min << "." << m->tm_sec << "_";
@@ -543,12 +546,8 @@ bool AC_MainWindow::startCamera(int res, int dev, const QString &outdir, bool re
if(recording) {
video_file_name = output_name;
#if defined(__linux__) || defined(__APPLE__)
writer = cv::VideoWriter(output_name.toStdString(), (type == 0) ? CV_FOURCC('m', 'p', '4', 'v') : CV_FOURCC('X','V','I','D'), video_fps, cv::Size(res_w, res_h), true);
#else
writer = cv::VideoWriter(output_name.toStdString(), CV_FOURCC('m', 'p', '4', 'v'), video_fps, cv::Size(res_w, res_h), true);
#endif
if(!writer.isOpened()) {
Log(tr("Could not create video writer..\n"));
QMessageBox::information(this, tr("Error"), tr("Incorrect Pathname/Or you do not have permission to write to the directory."));
@@ -614,11 +613,7 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
struct tm *m;
m = localtime(&t);
QString ext;
#if defined(__APPLE__) || defined(__linux__)
ext = (type == 0) ? ".mov" : ".avi";
#else
ext = (type == 0) ? ".mov" : ".mov";
#endif
std::ostringstream time_stream;
time_stream << "-" << (m->tm_year + 1900) << "." << (m->tm_mon + 1) << "." << m->tm_mday << "_" << m->tm_hour << "." << m->tm_min << "." << m->tm_sec << "_";
stream_ << outdir << "/" << "Video" << time_stream.str().c_str() << "AC2.Output." << (++index) << ext;
@@ -626,11 +621,8 @@ bool AC_MainWindow::startVideo(const QString &filename, const QString &outdir, b
if(recording) {
video_file_name = output_name;
#if defined(__linux__) || defined(__APPLE__)
writer = cv::VideoWriter(output_name.toStdString(), (type == 0) ? CV_FOURCC('m', 'p', '4', 'v') : CV_FOURCC('X','V','I','D'), video_fps, cv::Size(res_w, res_h), true);
#else
writer = cv::VideoWriter(output_name.toStdString(), CV_FOURCC('m', 'p', '4', 'v'), video_fps, cv::Size(res_w, res_h), true);
#endif
if(!writer.isOpened()) {
Log("Error could not open video writer.\n");
QMessageBox::information(this, tr("Error invalid path"), tr("Incorrect Pathname/Or you do not have permission to write to the directory."));
@@ -885,9 +877,12 @@ void AC_MainWindow::frameInc() {
void AC_MainWindow::help_About() {
QString about_str;
QTextStream stream(&about_str);
stream << tr("<b>Acid Cam Qt version: ") << ac_version << "</b><br><br> ";
stream << tr("<b>Acid Cam Qt version: ") << ac_version << " filters: " << ac::version.c_str() << "</b><br><br> ";
stream << tr("Engineering by <b>Jared Bruni</b><br><br><b>This software is dedicated to all the people that struggle with mental illness. </b><br><br><b>My Social Media Accounts</b><br><br>\n\n <a href=\"http://github.com/lostjared\">GitHub</a><br>\n<a href=\"http://youtube.com/lostjared\">YouTube</a><br><a href=\"http://instagram.com/lostjared\">Instagram</a><br><a href=\"http://facebook.com/LostSideDead0x\">LostSideDead Facebook</a><br><a href=\"http://facebook.com/lostsidedead\">My Facebook</a><br><a href=\"http://twitter.com/jaredbruni\">Twitter</a><br><br><br>\n");
QMessageBox::information(this, tr("About Acid Cam"), about_str);
}
void AC_MainWindow::openSearch() {
search_box->show();
}

4
src/main_window.h Executable file → Normal file
View File

@@ -12,6 +12,7 @@
#include "new_dialog.h"
#include "display_window.h"
#include "playback_thread.h"
#include "search_box.h"
class AC_MainWindow : public QMainWindow {
Q_OBJECT
@@ -33,6 +34,7 @@ public:
QAction *file_exit, *file_new_capture, *file_new_video;
QAction *controls_snapshot, *controls_pause, *controls_step, *controls_stop, *controls_setimage,*controls_setkey,*controls_showvideo, *clear_images, *reset_filters;
QAction *help_about;
QAction *open_search;
QRadioButton *filter_single, *filter_custom;
public slots:
@@ -65,12 +67,14 @@ public slots:
void comboFilterChanged(int pos);
void setFilterSingle();
void setFilterCustom();
void openSearch();
private:
void createControls();
void createMenu();
DisplayWindow *disp;
CaptureCamera *cap_camera;
CaptureVideo *cap_video;
SearchWindow *search_box;
cv::VideoCapture capture_camera, capture_video;
cv::VideoWriter writer;
unsigned long video_frames;

14
src/new_dialog.cpp Executable file → Normal file
View File

@@ -48,13 +48,10 @@ void CaptureCamera::createControls() {
connect(btn_start, SIGNAL(clicked()), this, SLOT(btn_Start()));
connect(btn_select, SIGNAL(clicked()), this, SLOT(btn_Select()));
#if defined(__APPLE__) || defined(__linux__)
video_type = new QComboBox(this);
video_type->setGeometry(80, 90, 90, 25);
video_type->addItem("MOV");
video_type->addItem("AVI");
#endif
}
void CaptureCamera::setParent(AC_MainWindow *p) {
@@ -82,11 +79,7 @@ void CaptureCamera::btn_Select() {
void CaptureCamera::btn_Start() {
int vtype;
#if defined(__APPLE__) || defined(__linux__)
vtype = video_type->currentIndex();
#else
vtype = 1;
#endif
if(output_dir->text().length() > 0) {
if(win_parent->startCamera(combo_res->currentIndex(), combo_device->currentIndex(), output_dir->text(), chk_record->isChecked(), vtype)) {
@@ -124,13 +117,10 @@ void CaptureVideo::createControls() {
chk_record = new QCheckBox(tr("Record"), this);
chk_record->setGeometry(110, 60, 80, 20);
#if defined(__APPLE__) || defined(__linux__)
video_type = new QComboBox(this);
video_type->setGeometry(180, 55, 120, 25);
video_type->addItem("MOV");
video_type->addItem("AVI");
#endif
connect(btn_setedit, SIGNAL(clicked()), this, SLOT(btn_SetSourceFile()));
connect(btn_setout, SIGNAL(clicked()), this, SLOT(btn_SetOutputDir()));
connect(btn_start, SIGNAL(clicked()), this, SLOT(btn_Start()));
@@ -182,11 +172,7 @@ void CaptureVideo::btn_Start() {
}
int num;
#if defined(__APPLE__) || defined(__linux__)
num = video_type->currentIndex();
#else
num = 1;
#endif
if(win_parent->startVideo(edit_src->text(), edit_outdir->text(), chk_record->isChecked(), num)) {
hide();

0
src/new_dialog.h Executable file → Normal file
View File

0
src/playback_thread.cpp Executable file → Normal file
View File

0
src/playback_thread.h Executable file → Normal file
View File

0
src/plugin.cpp Executable file → Normal file
View File

0
src/plugin.h Executable file → Normal file
View File

18
src/qtheaders.h Executable file → Normal file
View File

@@ -6,23 +6,7 @@
#ifndef _QT_HEADERS__
#define _QT_HEADERS__
#ifdef __linux__
#define ac_version "v1.14"
#endif
#ifdef __APPLE__
#define ac_version "v1.14"
#endif
#ifdef _WIN32
#define ac_version "v1.14"
#endif
#ifndef ac_version
#define ac_version "v1.14"
#endif
#define ac_version "v1.15"
#include<QApplication>
#include<QMainWindow>
#include<QDialog>

13
src/search_box.cpp Normal file
View File

@@ -0,0 +1,13 @@
#include "search_box.h"
SearchWindow::SearchWindow(QWidget *parent) : QDialog(parent) {
setFixedSize(640, 480);
setWindowTitle("Search Filters");
setWindowIcon(QPixmap(":/images/icon.png"));
createControls();
}
void SearchWindow::createControls() {
}

17
src/search_box.h Normal file
View File

@@ -0,0 +1,17 @@
#ifndef __SEARCHBOX__H__
#define __SEARCHBOX__H__
#include "qtheaders.h"
class SearchWindow : public QDialog {
Q_OBJECT
public:
SearchWindow(QWidget *parent = 0);
void createControls();
};
#endif

0
src/select_image.cpp Executable file → Normal file
View File

0
src/select_image.h Executable file → Normal file
View File