SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
explorer.h
1#pragma once
2
3#include "common/widgets/menuitem_fileopen.h"
4#include "dsp/task_queue.h"
5#include "handlers/handler.h"
6
7#include "imgui/dialogs/widget.h"
8#include <cstdint>
9#include <memory>
10
11namespace satdump
12{
13 namespace explorer
14 {
15 // Predef
17
18 // Events
20 {
21 std::shared_ptr<handlers::Handler> &curr_handler;
22 std::shared_ptr<handlers::Handler> &master_handler;
23 };
24
26 {
27 std::string type;
28 std::shared_ptr<handlers::Handler> &h;
29 };
30
32 {
33 std::shared_ptr<handlers::Handler> h;
34 bool open = false;
35 bool is_processing = false;
36 };
37
39 {
40 std::string path;
41 std::vector<std::pair<std::string, std::function<void(std::string, ExplorerApplication *)>>> &loaders;
42 };
43
44 // Actual explorer
45 class ExplorerApplication
46 {
47 public:
48 void draw();
49
50 protected:
51 const std::string app_id;
52
53 float panel_ratio = 0.23;
54 float last_width = -1.0f;
55
56 void drawPanel();
57 void drawContents();
58 void drawMenuBar();
59
60 // Groups definitions. TODOREWORK don't hardcode
61 std::map<std::string, std::vector<std::string>> group_definitions = {
62 {"Recorders", {"recorder", "newrec_test_handler"}},
63 {"Products", {"dataset_handler", "image_product_handler", "punctiform_product_handler"}},
64 };
65
66 // Explorer main handlers
67 std::shared_ptr<handlers::Handler> curr_handler;
68 std::shared_ptr<handlers::Handler> processing_handler;
69 std::map<std::string, std::shared_ptr<handlers::Handler>> groups_handlers;
70 std::shared_ptr<handlers::Handler> master_handler;
71 std::shared_ptr<handlers::Handler> trash_handler;
72
73 // File open
74 widget::MenuItemFileOpen file_open_dialog;
75 TaskQueue file_open_queue;
76
77 std::string quickOpenString;
78
79 protected:
80 intptr_t satdump_logo_texture = 0;
81 std::string tip_of_the_day = "The tip of the day is that this tip failed to load... Sorry about that.";
82
83 public:
84 // TODOREWORK last opened by time
85 std::map<std::string, std::shared_ptr<handlers::Handler>> last_selected_handler;
86
87 public:
88 void addHandler(std::shared_ptr<handlers::Handler> h, bool open = false, bool is_processing = false);
89 void tryOpenFileInExplorer(std::string path);
90 void tryOpenSomethingInExplorer(std::function<void(ExplorerApplication *)> f);
91
92 public:
93 ExplorerApplication();
94 ~ExplorerApplication();
95 };
96
97 } // namespace explorer
98}; // namespace satdump
Definition task_queue.h:12