4 #include "util/uuid.hpp"
11 #include "nlohmann/json_fwd.hpp"
12 #include "util/editor_process.hpp"
13 #include "util/window_state_store.hpp"
14 #include "util/status_dispatcher.hpp"
15 #include "pool-prj-mgr-process.hpp"
16 #include "project/project.hpp"
17 #include "prj-mgr/prj-mgr_views.hpp"
18 #include "pool-mgr/view_create_pool.hpp"
19 #include "common/common.hpp"
35 void open_file_view(
const Glib::RefPtr<Gio::File> &file);
37 bool close_pool_or_project();
38 bool really_close_pool_or_project();
39 void wait_for_all_processes();
40 std::string get_filename()
const;
43 const std::vector<std::string> &env = {},
bool read_only =
false,
44 bool is_temp =
false);
46 const std::vector<std::string> &args);
48 std::map<UUID, PoolProjectManagerProcess *> get_processes();
50 class Pool *pool =
nullptr;
53 typedef sigc::signal<void, std::string, int, bool> type_signal_process_exited;
54 type_signal_process_exited signal_process_exited()
56 return s_signal_process_exited;
62 bool can_close =
true;
64 std::vector<UUID> procs_need_save;
69 std::string get_proc_filename(
const UUID &uu);
70 void process_save(
const UUID &uu);
71 void process_close(
const UUID &uu);
72 void cleanup_pool_cache();
74 enum class ViewMode { OPEN, POOL, DOWNLOAD, PROJECT, CREATE_PROJECT, CREATE_POOL };
75 ViewMode get_view_mode()
const;
77 UUID get_pool_uuid()
const;
78 void pool_notebook_go_to(ObjectType type,
const UUID &uu);
79 void open_pool(
const std::string &pool_json, ObjectType type = ObjectType::INVALID,
const UUID &uu =
UUID());
80 void handle_download(
bool back_to_start =
false);
83 Glib::RefPtr<Gtk::Builder> builder;
84 Gtk::Stack *stack =
nullptr;
85 Gtk::Button *button_open =
nullptr;
86 Gtk::Button *button_close =
nullptr;
87 Gtk::Button *button_update =
nullptr;
88 Gtk::Button *button_download =
nullptr;
89 Gtk::Button *button_do_download =
nullptr;
90 Gtk::Button *button_cancel =
nullptr;
91 Gtk::MenuButton *button_new =
nullptr;
92 Gtk::Button *button_create =
nullptr;
93 Gtk::Button *button_save =
nullptr;
94 Gtk::Spinner *spinner_update =
nullptr;
95 Gtk::Revealer *download_revealer =
nullptr;
96 Gtk::Label *download_label =
nullptr;
97 Gtk::Spinner *download_spinner =
nullptr;
98 Gtk::MenuButton *hamburger_menu_button =
nullptr;
100 Gtk::Entry *download_gh_username_entry =
nullptr;
101 Gtk::Entry *download_gh_repo_entry =
nullptr;
102 Gtk::Entry *download_dest_dir_entry =
nullptr;
103 Gtk::Button *download_dest_dir_button =
nullptr;
105 Gtk::HeaderBar *header =
nullptr;
106 Gtk::ListBox *recent_pools_listbox =
nullptr;
107 Gtk::ListBox *recent_projects_listbox =
nullptr;
108 std::vector<Gtk::ListBox *> recent_listboxes;
109 Gtk::Box *pool_box =
nullptr;
112 Gtk::Label *pool_update_status_label =
nullptr;
113 Gtk::Revealer *pool_update_status_rev =
nullptr;
114 Gtk::Button *pool_update_status_close_button =
nullptr;
115 Gtk::ProgressBar *pool_update_progress =
nullptr;
116 sigc::connection pool_update_conn;
118 Gtk::InfoBar *info_bar =
nullptr;
119 Gtk::Label *info_bar_label =
nullptr;
120 Gtk::Button *show_output_button =
nullptr;
122 Gtk::InfoBar *info_bar_pool_not_added =
nullptr;
124 Gtk::MenuItem *menu_new_pool =
nullptr;
125 Gtk::MenuItem *menu_new_project =
nullptr;
129 std::unique_ptr<Project> project =
nullptr;
130 std::string project_filename;
131 bool project_needs_save =
false;
136 ViewMode view_mode = ViewMode::OPEN;
137 void set_view_mode(ViewMode mode);
139 void update_recent_items();
143 void handle_recent();
144 void handle_update();
145 void handle_do_download();
146 void handle_new_project();
147 void handle_new_pool();
148 void handle_create();
149 void handle_cancel();
153 bool on_delete_event(GdkEventAny *ev)
override;
155 void download_thread(std::string gh_username, std::string gh_repo, std::string dest_dir);
161 std::map<UUID, PoolProjectManagerProcess> processes;
162 std::map<int, bool> pids_need_save;
167 const UUID uuid_pool_manager =
"1b9eecbe-7408-4b99-9aec-170d3658004a";
168 const UUID uuid_project_manager =
"144a4ad6-4c7c-4136-9920-f58f954c678e";
170 type_signal_process_exited s_signal_process_exited;
176 void handle_place_part(
const UUID &uu);
177 void handle_assign_part(
const UUID &uu);
180 zmq::socket_t sock_mgr;
181 std::string sock_mgr_ep;
184 bool check_schema_update(
const std::string &base_path);
186 bool download_back_to_start =
false;
188 bool check_autosave(PoolProjectManagerProcess::Type type,
const std::vector<std::string> &filenames);
191 zmq::context_t &zctx;
192 void set_pool_updating(
bool v,
bool success);
193 void set_pool_update_status_text(
const std::string &txt);
194 void set_pool_update_progress(
float progress);