diff --git a/src/main_window.cpp b/src/main_window.cpp index e35e1dc..d21f22a 100755 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -136,16 +136,19 @@ void AC_MainWindow::createControls() { btn_remove = new QPushButton(tr("Remove"), this); btn_moveup = new QPushButton(tr("Move Up"), this); btn_movedown = new QPushButton(tr("Move Down"), this); + btn_sub = new QPushButton(tr("Subfilter"), this); btn_add->setGeometry(10, 215, 100, 20); btn_remove->setGeometry(400, 215, 100, 20); btn_moveup->setGeometry(500, 215, 100, 20); btn_movedown->setGeometry(600, 215, 100, 20); + btn_sub->setGeometry(700, 215, 90, 20); connect(btn_add, SIGNAL(clicked()), this, SLOT(addClicked())); connect(btn_remove, SIGNAL(clicked()), this, SLOT(rmvClicked())); connect(btn_moveup, SIGNAL(clicked()), this, SLOT(upClicked())); connect(btn_movedown, SIGNAL(clicked()), this, SLOT(downClicked())); + connect(btn_sub, SIGNAL(clicked()), this, SLOT(setSub())); QLabel *r_label = new QLabel(tr("Red: "), this); r_label->setGeometry(10, 255, 50, 20); @@ -432,6 +435,24 @@ void AC_MainWindow::downClicked() { } +void AC_MainWindow::setSub() { + int row = filters->currentIndex(); + if(row != -1) { + std::ostringstream stream; + //QListWidgetItem *item = filters->item(row); + QString filter_num = filters->currentText(); + int value_index = filter_map[filter_num.toStdString()].first; + int filter_index = filter_map[filter_num.toStdString()].second; + if(value_index == 0) { + stream << "SubFilter set to: " << filter_num.toStdString() << "\n"; + stream << "SubFilter index: " << filter_index << "\n"; + playback->setSubFilter(filter_index); + QString l = stream.str().c_str(); + Log(l); + } + } +} + void AC_MainWindow::Log(const QString &s) { QString text; text = log_text->toPlainText(); diff --git a/src/main_window.h b/src/main_window.h index 4cff4a7..a265b5d 100755 --- a/src/main_window.h +++ b/src/main_window.h @@ -22,7 +22,7 @@ public: bool startCamera(int res, int dev, const QString &outdir, bool record, int type); bool startVideo(const QString &filename, const QString &outdir, bool record, int type); QListWidget /**filters,*/ *custom_filters; - QPushButton *btn_add, *btn_remove, *btn_moveup, *btn_movedown; + QPushButton *btn_add, *btn_remove, *btn_moveup, *btn_movedown, *btn_sub; QTextEdit *log_text; QCheckBox *chk_negate; QComboBox *combo_rgb; @@ -39,6 +39,7 @@ public slots: void addClicked(); void rmvClicked(); void upClicked(); + void setSub(); void downClicked(); void file_Exit(); void file_NewVideo(); diff --git a/src/playback_thread.cpp b/src/playback_thread.cpp index bd71065..5afadd8 100755 --- a/src/playback_thread.cpp +++ b/src/playback_thread.cpp @@ -128,6 +128,12 @@ void Playback::setIndexChanged(std::string value) { alpha = 1.0; } +void Playback::setSubFilter(int index) { + mutex.lock(); + ac::setSubFilter(index); + mutex.unlock(); +} + void Playback::setSingleMode(bool val) { single_mode = val; } diff --git a/src/playback_thread.h b/src/playback_thread.h index ad495be..ca56615 100755 --- a/src/playback_thread.h +++ b/src/playback_thread.h @@ -63,6 +63,7 @@ public: void drawEffects(cv::Mat &frame); void filterFade(cv::Mat &frame, std::pair &filter1, std::pair &filter2, double alpha); void reset_filters(); + void setSubFilter(int index); signals: void procImage(const QImage image); void stopRecording();