diff --git a/src/main_window.cpp b/src/main_window.cpp index 3f38e84..f1b9f44 100644 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -170,6 +170,7 @@ void AC_MainWindow::createControls() { std::sort(fnames.begin(), fnames.end()); + /* for(unsigned long i = 0; i < fnames.size(); ++i) { filters->addItem(fnames[i].c_str()); } @@ -183,7 +184,7 @@ void AC_MainWindow::createControls() { for(unsigned int i = 0; i < plugins.plugin_list.size(); ++i) { std::string name = "plugin " + plugins.plugin_list[i]->name(); filters->addItem(name.c_str()); - } + }*/ connect(filters, SIGNAL(currentIndexChanged(int)), this, SLOT(comboFilterChanged(int))); connect(menu_cat, SIGNAL(currentIndexChanged(int)), this, SLOT(menuFilterChanged(int))); @@ -529,7 +530,21 @@ void AC_MainWindow::createMenu() { select_random_filter = new QAction(tr("Set Random Filter"), this); connect(select_random_filter, SIGNAL(triggered()), this, SLOT(setRandomFilterValue())); select_random_filter->setShortcut(tr("Space")); + controls_menu->addAction(select_random_filter); + select_next_filter = new QAction(tr("Next Filter"), this); + + connect(select_next_filter, SIGNAL(triggered()), this, SLOT(next_filter())); + + select_next_filter->setShortcut(tr("Ctrl+I")); + controls_menu->addAction(select_next_filter); + + select_prev_filter = new QAction(tr("Prev Filter"), this); + + connect(select_prev_filter, SIGNAL(triggered()), this, SLOT(prev_filter())); + + select_prev_filter->setShortcut(tr("Ctrl+O")); + controls_menu->addAction(select_prev_filter); } @@ -1401,9 +1416,14 @@ void AC_MainWindow::menuFilterChanged(int index) { loading = true; std::string menu_n = menuNames[index]; filters->clear(); - auto v = ac::filter_menu_map[menu_n].menu_list; + std::vector *v = ac::filter_menu_map[menu_n].menu_list; + + auto end = v->end(); + for(auto it = v->begin(); it != end; ++it) { + end = std::remove(it + 1, end, *it); + } for(auto in = v->begin(); in != v->end(); ++in) { - filters->addItem(in->c_str()); + filters->addItem(in->c_str()); } filters->setCurrentIndex(0); loading = false; @@ -1694,3 +1714,16 @@ void AC_MainWindow::setCustomCycle_Menu() { bool chk = cycle_custom->isChecked(); playback->setCustomCycle(chk); } + +void AC_MainWindow::next_filter() { + int count = filters->count(); + int index = filters->currentIndex(); + if(index < count) { + ++index; + filters->setCurrentIndex(index); + } +} + +void AC_MainWindow::prev_filter() { + +} diff --git a/src/main_window.h b/src/main_window.h index ad07fac..5db801e 100644 --- a/src/main_window.h +++ b/src/main_window.h @@ -60,6 +60,7 @@ public: QAction *show_options_window; QAction *show_control_window; QAction *select_random_filter; + QAction *select_next_filter, *select_prev_filter; QAction *cycle_custom; double speed_actions[7]; QRadioButton *filter_single, *filter_custom; @@ -130,6 +131,8 @@ public slots: void showPrefWindow(); void setRandomFilterValue(); void setCustomCycle_Menu(); + void next_filter(); + void prev_filter(); private: void createControls(); void createMenu(); diff --git a/src/playback_thread.cpp b/src/playback_thread.cpp index d99bc68..3a6d369 100644 --- a/src/playback_thread.cpp +++ b/src/playback_thread.cpp @@ -356,7 +356,7 @@ void Playback::run() { if(_custom_cycle_index > static_cast(cur.size()-1)) _custom_cycle_index = 0; - if(_custom_cycle_index >= 0 && _custom_cycle_index < cur.size()) { + if(_custom_cycle_index >= 0 && _custom_cycle_index < static_cast(cur.size())) { drawFilter(frame, cur[_custom_cycle_index]); msleep(duration/2); }