-
Notifications
You must be signed in to change notification settings - Fork 247
Expand file tree
/
Copy pathoffline.cpp
More file actions
66 lines (55 loc) · 2.48 KB
/
offline.cpp
File metadata and controls
66 lines (55 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "offline.h"
#include "common/widgets/pipeline_selector.h"
#include "common/widgets/timed_message.h"
#include "core/plugin.h"
#include "core/style.h"
#include "explorer/explorer.h"
#include "handlers/processing/processing.h"
#include "imgui/imgui.h"
#include "main_ui.h"
#include <string>
namespace satdump
{
extern bool offline_en;
namespace offline
{
std::unique_ptr<PipelineUISelector> pipeline_selector;
widgets::TimedMessage error_message;
void setup()
{
pipeline_selector = std::make_unique<PipelineUISelector>(false);
pipeline_selector->inputfileselect.setDefaultDir(satdump_cfg.main_cfg["satdump_directories"]["default_input_directory"]["value"].get<std::string>());
pipeline_selector->outputdirselect.setDefaultDir(satdump_cfg.main_cfg["satdump_directories"]["default_output_directory"]["value"].get<std::string>());
}
void render()
{
pipeline_selector->renderSelectionBox();
ImGui::Spacing();
ImGui::Separator();
ImGui::Spacing();
pipeline_selector->drawMainparams();
ImGui::Spacing();
// ImGui::Separator();
ImGui::Spacing();
pipeline_selector->renderParamTable();
if (ImGui::Button("Start"))
{
nlohmann::json params2 = pipeline_selector->getParameters();
if (!pipeline_selector->inputfileselect.isValid())
error_message.set_message(style::theme.red, "Input file is invalid!");
else if (!pipeline_selector->outputdirselect.isValid())
error_message.set_message(style::theme.red, "Output folder is invalid!");
else
{
eventBus->fire_event<explorer::ExplorerAddHandlerEvent>(
{std::make_shared<handlers::OffProcessingHandler>(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});
offline_en = false;
}
}
error_message.draw();
}
} // namespace offline
} // namespace satdump