diff --git a/plugins/official_products_support/loader/aws.cpp b/plugins/official_products_support/loader/aws.cpp index 45898ffae..cd2e943bc 100644 --- a/plugins/official_products_support/loader/aws.cpp +++ b/plugins/official_products_support/loader/aws.cpp @@ -299,7 +299,7 @@ namespace satdump if (success) eventBus->fire_event( - {std::make_shared("off2pro", "file", l_download_path, process_path, nlohmann::json())}); + {std::make_shared("off2pro", "file", l_download_path, process_path, nlohmann::json()), true, true}); } catch (std::exception &e) { diff --git a/plugins/official_products_support/loader/eumetsat.cpp b/plugins/official_products_support/loader/eumetsat.cpp index d5b4b8a07..ea5f1a6bd 100644 --- a/plugins/official_products_support/loader/eumetsat.cpp +++ b/plugins/official_products_support/loader/eumetsat.cpp @@ -229,7 +229,7 @@ namespace satdump if (file_downloader.download_file(nat_link, download_path, "Authorization: Bearer " + getEumetSatToken()) != 1) { eventBus->fire_event( - {std::make_shared("off2pro", "file", download_path, process_path, nlohmann::json())}); + {std::make_shared("off2pro", "file", download_path, process_path, nlohmann::json()), true, true}); } } catch (std::exception &e) diff --git a/src-core/handlers/handler.cpp b/src-core/handlers/handler.cpp index 2bd470104..647660464 100644 --- a/src-core/handlers/handler.cpp +++ b/src-core/handlers/handler.cpp @@ -155,6 +155,15 @@ namespace satdump delSubHandlersNow(); } + std::vector> Handler::getAllSubHandlers() + { + std::vector> sh; + subhandlers_mtx.lock(); + sh = subhandlers; + subhandlers_mtx.unlock(); + return sh; + } + nlohmann::json Handler::getConfig() { return {}; } } // namespace handlers } // namespace satdump \ No newline at end of file diff --git a/src-core/handlers/handler.h b/src-core/handlers/handler.h index ebf45c25b..3d88ad62a 100644 --- a/src-core/handlers/handler.h +++ b/src-core/handlers/handler.h @@ -114,6 +114,12 @@ namespace satdump */ virtual void delSubHandler(std::shared_ptr handler, bool now = false); + /** + * @brief Get all current subhandlers + * @return List of all subhandlers + */ + virtual std::vector> getAllSubHandlers(); + /** * @brief Set if a handler can be dragged around in the tree * @param v true to have it be draggable diff --git a/src-interface/explorer/explorer.cpp b/src-interface/explorer/explorer.cpp index 7ea4b5691..fcba94c46 100644 --- a/src-interface/explorer/explorer.cpp +++ b/src-interface/explorer/explorer.cpp @@ -44,6 +44,13 @@ namespace satdump trash_handler->addSubHandler(trash_h); trash_handler->setCanBeDraggedTo(false); + // Add processing handler "spot" + processing_handler = std::make_shared("ProcessingHandlerExplorer"); + processing_handler_sub = std::make_shared("Processing"); + processing_handler_sub->setCanBeDragged(false); + processing_handler->addSubHandler(processing_handler_sub); + processing_handler->setCanBeDraggedTo(false); + // Enable dropping files onto the explorer. TODOREWORK, check the explorer IS active!? eventBus->register_handler( [this](const imgui_utils::FileDropEvent &v) @@ -56,7 +63,10 @@ namespace satdump eventBus->register_handler( [this](const ExplorerAddHandlerEvent &e) { - master_handler->addSubHandler(e.h); + if (e.is_processing) + processing_handler_sub->addSubHandler(e.h); + else + master_handler->addSubHandler(e.h); if (e.open) curr_handler = e.h; }); @@ -94,6 +104,13 @@ namespace satdump ImGui::TableSetupColumn("##masterhandlertable_col", ImGuiTableColumnFlags_None); ImGui::TableNextColumn(); + if (processing_handler_sub->hasSubhandlers()) + { + processing_handler->drawTreeMenu(curr_handler); + for (auto &h : processing_handler_sub->getAllSubHandlers()) + if (h->getName() == "PROCESSING_DONE") // TODOREWORK MASSIVE HACK + processing_handler_sub->delSubHandler(h); + } master_handler->drawTreeMenu(curr_handler); trash_handler->drawTreeMenu(curr_handler); diff --git a/src-interface/explorer/explorer.h b/src-interface/explorer/explorer.h index 267d342dd..fe22ae2d6 100644 --- a/src-interface/explorer/explorer.h +++ b/src-interface/explorer/explorer.h @@ -34,6 +34,8 @@ namespace satdump // Explorer main handlers std::shared_ptr curr_handler; std::shared_ptr master_handler; + std::shared_ptr processing_handler; + std::shared_ptr processing_handler_sub; std::shared_ptr trash_handler; // File open @@ -56,6 +58,7 @@ namespace satdump { std::shared_ptr h; bool open = false; + bool is_processing = false; }; public: diff --git a/src-interface/explorer/processing/processing.cpp b/src-interface/explorer/processing/processing.cpp index fe2b41523..b0b2f14ff 100644 --- a/src-interface/explorer/processing/processing.cpp +++ b/src-interface/explorer/processing/processing.cpp @@ -43,6 +43,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) { + pipeline_name = downlink_pipeline.name; + logger->info("Starting processing pipeline " + downlink_pipeline.id + "..."); logger->debug("Input file (" + input_level + ") : " + input_file); logger->debug("Output file : " + output_file); @@ -75,6 +77,8 @@ namespace satdump explorer_app->tryOpenFileInExplorer(output_file + "/dataset.json"); // TODOREWORK Maybe just try to open the final file produced? } } + + pipeline_name = "PROCESSING_DONE"; // TODOREWORK MASSIVE HACK! } void OffProcessingHandler::drawMenu() {} diff --git a/src-interface/explorer/processing/processing.h b/src-interface/explorer/processing/processing.h index 352f09f7a..f484822bd 100644 --- a/src-interface/explorer/processing/processing.h +++ b/src-interface/explorer/processing/processing.h @@ -20,6 +20,8 @@ namespace satdump std::thread proc_thread; + std::string pipeline_name = "Pipeline"; + public: OffProcessingHandler(pipeline::Pipeline downlink_pipeline, std::string input_level, std::string input_file, std::string output_file, nlohmann::json parameters); @@ -31,7 +33,7 @@ namespace satdump void drawMenu(); void drawContents(ImVec2 win_size); - std::string getName() { return "Processing..."; } + std::string getName() { return pipeline_name; } std::string getID() { return "processing_handler"; } }; diff --git a/src-interface/offline.cpp b/src-interface/offline.cpp index 0455f3c6f..bb879ee92 100644 --- a/src-interface/offline.cpp +++ b/src-interface/offline.cpp @@ -55,7 +55,7 @@ namespace satdump {std::make_shared(pipeline_selector->selected_pipeline, pipeline_selector->selected_pipeline.steps[pipeline_selector->pipelines_levels_select_id].level, pipeline_selector->inputfileselect.getPath(), pipeline_selector->outputdirselect.getPath(), params2), - true}); + true, true}); offline_en = false; } } diff --git a/src-interface/recorder/recorder_proc.cpp b/src-interface/recorder/recorder_proc.cpp index 536dbd852..c2e8cdb56 100644 --- a/src-interface/recorder/recorder_proc.cpp +++ b/src-interface/recorder/recorder_proc.cpp @@ -224,7 +224,7 @@ namespace satdump int start_level = pipeline.live_cfg.normal_live[pipeline.live_cfg.normal_live.size() - 1]; std::string input_level = pipeline.steps[start_level].level; eventBus->fire_event( - {std::make_shared(pipeline, input_level, input_file, pipeline_output_dir, pipeline_params)}); + {std::make_shared(pipeline, input_level, input_file, pipeline_output_dir, pipeline_params), false, true}); } live_pipeline.reset(); diff --git a/src-interface/recorder/recorder_vfo.cpp b/src-interface/recorder/recorder_vfo.cpp index e9a4b7b1a..190691ca1 100644 --- a/src-interface/recorder/recorder_vfo.cpp +++ b/src-interface/recorder/recorder_vfo.cpp @@ -131,7 +131,7 @@ namespace satdump std::string output_dir = it->output_dir; nlohmann::json pipeline_params = it->pipeline_params; eventBus->fire_event( - {std::make_shared(pipeline, input_level, input_file, output_dir, pipeline_params)}); // TODOPIPELINE + {std::make_shared(pipeline, input_level, input_file, output_dir, pipeline_params), false, true}); // TODOPIPELINE } }