moved buttons added optional fade

This commit is contained in:
lostjared
2018-09-17 19:43:07 -07:00
parent 678f8b80fe
commit e700a81897
4 changed files with 29 additions and 4 deletions

View File

@@ -149,18 +149,20 @@ void AC_MainWindow::createControls() {
btn_moveup = new QPushButton(tr("Move Up"), this);
btn_movedown = new QPushButton(tr("Move Down"), this);
btn_sub = new QPushButton(tr("Subfilter"), this);
btn_clr = new QPushButton(tr("Clear Sub"), 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);
btn_sub->setGeometry(10, 145, 100, 20);
btn_clr->setGeometry(115, 145, 100, 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()));
connect(btn_clr, SIGNAL(clicked()), this, SLOT(clear_subfilter()));
QLabel *r_label = new QLabel(tr("Red: "), this);
r_label->setGeometry(10, 255, 50, 20);
@@ -345,7 +347,14 @@ void AC_MainWindow::createMenu() {
repeat_v = new QAction(tr("Repeat"), this);
repeat_v->setCheckable(true);
repeat_v->setChecked(false);
fade_on = new QAction(tr("Fade"), this);
fade_on->setCheckable(true);
fade_on->setChecked(true);
options->addAction(fade_on);
options->addAction(repeat_v);
connect(fade_on, SIGNAL(triggered()), this, SLOT(setFade()));
connect(repeat_v, SIGNAL(triggered()), this, SLOT(repeat_vid()));
connect(clear_image, SIGNAL(triggered()), this, SLOT(clear_img()));
connect(clear_sub, SIGNAL(triggered()), this, SLOT(clear_subfilter()));
@@ -1174,6 +1183,11 @@ void AC_MainWindow::setSubFilter(const QString &filter_num) {
}
}
void AC_MainWindow::setFade() {
bool fc = fade_on->isChecked();
playback->setFadeFilter(fc);
}
void AC_MainWindow::frameInc() {
frame_index++;
QString frame_string;

View File

@@ -26,7 +26,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, *btn_sub;
QPushButton *btn_add, *btn_remove, *btn_moveup, *btn_movedown, *btn_sub, *btn_clr;
QTextEdit *log_text;
QCheckBox *chk_negate;
QComboBox *combo_rgb;
@@ -47,6 +47,7 @@ public:
QAction *clear_sub;
QAction *clear_image;
QAction *repeat_v;
QAction *fade_on;
double speed_actions[7];
QRadioButton *filter_single, *filter_custom;
void updateList();
@@ -100,6 +101,7 @@ public slots:
void clear_subfilter();
void clear_img();
void repeat_vid();
void setFade();
private:
void createControls();
void createMenu();

View File

@@ -18,6 +18,7 @@ Playback::Playback(QObject *parent) : QThread(parent) {
flip_frame1 = false;
flip_frame2 = false;
repeat_video = false;
fadefilter = true;
}
void Playback::Play() {
@@ -235,7 +236,7 @@ void Playback::run() {
mutex_shown.unlock();
ac::orig_frame = frame.clone();
if(single_mode == true && alpha > 0) {
filterFade(frame, current_filter, prev_filter, alpha);
if(fadefilter == true) filterFade(frame, current_filter, prev_filter, alpha);
drawEffects(frame);
alpha -= 0.08;
} else if(single_mode == true) {
@@ -368,6 +369,12 @@ void Playback::setImage(const cv::Mat &frame) {
mutex.unlock();
}
void Playback::setFadeFilter(bool f) {
mutex.lock();
fadefilter = f;
mutex.unlock();
}
void Playback::setColorKey(const cv::Mat &image) {
mutex.lock();
colorkey_set = true;

View File

@@ -39,9 +39,11 @@ private:
double alpha;
bool flip_frame1, flip_frame2;
bool repeat_video;
bool fadefilter;
public:
Playback(QObject *parent = 0);
~Playback();
void setFadeFilter(bool f);
void setFrameIndex(const long &index);
bool getFrame(QImage &img, const int &index);
void setRGB(int r, int g, int b);