diff --git a/src-core/handlers/product/image_product_handler.h b/src-core/handlers/product/image_product_handler.h index ebff57804..2845a4703 100644 --- a/src-core/handlers/product/image_product_handler.h +++ b/src-core/handlers/product/image_product_handler.h @@ -71,10 +71,10 @@ namespace satdump void saveResult(std::string directory); - void addSubHandler(std::shared_ptr handler) + void addSubHandler(std::shared_ptr handler, bool ontop = false) { - // Handler::addSubHandler(handler); - img_handler->addSubHandler(handler); + // Handler::addSubHandler(handler, ontop); + img_handler->addSubHandler(handler, ontop); } void delSubHandler(std::shared_ptr handler, bool now = false) diff --git a/src-core/handlers/product/punctiform_product_handler.h b/src-core/handlers/product/punctiform_product_handler.h index ce0e4345c..fca8a3af1 100644 --- a/src-core/handlers/product/punctiform_product_handler.h +++ b/src-core/handlers/product/punctiform_product_handler.h @@ -43,7 +43,7 @@ namespace satdump void drawMenuBar(); // - void addSubHandler(std::shared_ptr handler) { img_handler.addSubHandler(handler); } + void addSubHandler(std::shared_ptr handler, bool ontop = false) { img_handler.addSubHandler(handler, ontop); } void delSubHandler(std::shared_ptr handler, bool now = false) { img_handler.delSubHandler(handler, true); } diff --git a/src-core/handlers/trash/trash_handler.h b/src-core/handlers/trash/trash_handler.h index 7564604b9..dd2dd515b 100644 --- a/src-core/handlers/trash/trash_handler.h +++ b/src-core/handlers/trash/trash_handler.h @@ -30,7 +30,7 @@ namespace satdump void setConfig(nlohmann::json p); nlohmann::json getConfig(); - void addSubHandler(std::shared_ptr handler) + void addSubHandler(std::shared_ptr handler, bool ontop = false) { // Do nothing! } diff --git a/src-interface/explorer/explorer.cpp b/src-interface/explorer/explorer.cpp index bbfa6f56d..b3bcf2df8 100644 --- a/src-interface/explorer/explorer.cpp +++ b/src-interface/explorer/explorer.cpp @@ -83,11 +83,7 @@ namespace satdump }); } - ExplorerApplication::~ExplorerApplication() - { - if (file_open_thread.joinable()) - file_open_thread.join(); - } + ExplorerApplication::~ExplorerApplication() {} void ExplorerApplication::drawPanel() { @@ -252,8 +248,6 @@ namespace satdump void ExplorerApplication::tryOpenFileInExplorer(std::string path) { - if (file_open_thread.joinable()) - file_open_thread.join(); auto fun = [this, path]() { eventBus->fire_event({}); @@ -321,7 +315,7 @@ namespace satdump eventBus->fire_event({}); }; - file_open_thread = std::thread(fun); + file_open_queue.push(fun); } } // namespace explorer }; // namespace satdump diff --git a/src-interface/explorer/explorer.h b/src-interface/explorer/explorer.h index 1d15b6179..4546d6375 100644 --- a/src-interface/explorer/explorer.h +++ b/src-interface/explorer/explorer.h @@ -3,6 +3,7 @@ #include "../app.h" #include "common/widgets/menuitem_fileopen.h" +#include "dsp/task_queue.h" #include "handlers/handler.h" #include "imgui/dialogs/widget.h" @@ -40,7 +41,7 @@ namespace satdump // File open widget::MenuItemFileOpen file_open_dialog; - std::thread file_open_thread; // TODOREWORK? + TaskQueue file_open_queue; std::string quickOpenString; diff --git a/src-interface/explorer/processing/processing.cpp b/src-interface/explorer/processing/processing.cpp index aaad9f2b6..e14eb9a68 100644 --- a/src-interface/explorer/processing/processing.cpp +++ b/src-interface/explorer/processing/processing.cpp @@ -44,6 +44,8 @@ namespace satdump void OffProcessingHandler::process(pipeline::Pipeline downlink_pipeline, std::string input_level, std::string input_file, std::string output_file, nlohmann::json parameters) { + eventBus->fire_event({}); + pipeline_name = downlink_pipeline.name; logger->info("Starting processing pipeline " + downlink_pipeline.id + "..."); @@ -89,6 +91,8 @@ namespace satdump } pipeline_name = "PROCESSING_DONE"; // TODOREWORK MASSIVE HACK! + + eventBus->fire_event({}); } void OffProcessingHandler::drawMenu() {}