diff --git a/src/main_window.cpp b/src/main_window.cpp index 13216fe..cee3c36 100644 --- a/src/main_window.cpp +++ b/src/main_window.cpp @@ -13,6 +13,8 @@ #include std::unordered_map filter_map; +std::unordered_map filter_map_main; +std::vector solo_filter; void custom_filter(cv::Mat &); const char *filter_names[] = { "AC Self AlphaBlend", "Reverse Self AlphaBlend", @@ -72,6 +74,9 @@ void generate_map() { std::string name = "plugin " + plugins.plugin_list[j]->name(); filter_map[name] = FilterValue(2, j, -1); } + + filter_map_main = ac::filter_map; + solo_filter = ac::solo_filter; } @@ -1866,9 +1871,9 @@ void AC_MainWindow::save_CustomFile() { void AC_MainWindow::setRandomFilterValue() { menu_cat->setCurrentIndex(0); resetMenu(); - int index = rand()%ac::solo_filter.size(); - std::string filter_name = ac::solo_filter[index]; - int filter_index = ac::filter_map[filter_name]; + int index = rand()%solo_filter.size(); + std::string filter_name = solo_filter[index]; + int filter_index = filter_map_main[filter_name]; filters->setCurrentIndex(filter_index); } diff --git a/src/options_window.cpp b/src/options_window.cpp index 6a13c32..4ccccf9 100644 --- a/src/options_window.cpp +++ b/src/options_window.cpp @@ -65,7 +65,7 @@ void OptionsWindow::setValues() { if(delay_value > 0) playback->setCustomCycleDelay(delay_value); - ac::setMaxAllocated(max_frames); + playback->setMaxAlloc(max_frames); QString text; int level_ = atoi(level->text().toStdString().c_str()); @@ -75,8 +75,8 @@ void OptionsWindow::setValues() { QMessageBox::information(this, tr("Error requires valid level/wait"), tr("Requires Level/Intensity greater than zero value")); return; } - ac::setVariableWait(wait_); - ac::setColorLevel(level_); + + playback->setWaitColorLevel(wait_, level_); QTextStream stream(&text); stream << tr("Thread Count set to: ") << thread_count << tr(" and Intensity set to: ") << intensity << tr("\nMaximum Stored Frames: ") << max_frames << tr("\n") << tr("Delay: ") << delay_value << "\n" << tr("Wait: ") << wait_ << "\n" << tr("Level: ") << level_ << "\n"; QMessageBox::information(this, tr("Pref Value Set"), text); diff --git a/src/playback_thread.cpp b/src/playback_thread.cpp index 6d59e8d..cdc8d1e 100644 --- a/src/playback_thread.cpp +++ b/src/playback_thread.cpp @@ -159,6 +159,13 @@ unsigned long Playback::allocatedFrames() { } +void Playback::setWaitColorLevel(int w, int l) { + mutex.lock(); + ac::setVariableWait(w); + ac::setColorLevel(l); + mutex.unlock(); +} + void Playback::setSubFilter_(int s) { mutex.lock(); ac::setSubFilter(s); diff --git a/src/playback_thread.h b/src/playback_thread.h index 1853e59..92b0d38 100644 --- a/src/playback_thread.h +++ b/src/playback_thread.h @@ -66,6 +66,7 @@ public: void setMaxAlloc(int a); unsigned int getObjectSize(); unsigned long allocatedFrames(); + void setWaitColorLevel(int c, int l); void setColorMap(int c); void setPngPath(std::string path); void Play();