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"
36 void open_file_view(
const Glib::RefPtr<Gio::File> &file);
38 bool close_pool_or_project();
39 bool really_close_pool_or_project();
40 void wait_for_all_processes();
41 std::string get_filename()
const;
44 const std::vector<std::string> &env = {},
bool read_only =
false,
45 bool is_temp =
false);
47 const std::vector<std::string> &args);
49 std::map<UUID, PoolProjectManagerProcess *> get_processes();
51 class Pool *pool =
nullptr;
54 typedef sigc::signal<void, std::string, int, bool> type_signal_process_exited;
55 type_signal_process_exited signal_process_exited()
57 return s_signal_process_exited;
60 typedef sigc::signal<void, std::string> type_signal_process_saved;
61 type_signal_process_saved signal_process_saved()
63 return s_signal_process_saved;
70 bool can_close =
true;
72 std::vector<UUID> procs_need_save;
77 std::string get_proc_filename(
const UUID &uu);
78 void process_save(
const UUID &uu);
79 void process_close(
const UUID &uu);
80 void cleanup_pool_cache();
82 enum class ViewMode { OPEN, POOL, DOWNLOAD, PROJECT, CREATE_PROJECT, CREATE_POOL };
83 ViewMode get_view_mode()
const;
85 UUID get_pool_uuid()
const;
86 void pool_notebook_go_to(ObjectType type,
const UUID &uu);
87 void open_pool(
const std::string &pool_json, ObjectType type = ObjectType::INVALID,
const UUID &uu =
UUID());
88 void handle_download(
bool back_to_start =
false);
89 void update_pool_cache_status_now();
92 Glib::RefPtr<Gtk::Builder> builder;
93 Gtk::Stack *stack =
nullptr;
94 Gtk::Button *button_open =
nullptr;
95 Gtk::Button *button_close =
nullptr;
96 Gtk::Button *button_update =
nullptr;
97 Gtk::Button *button_download =
nullptr;
98 Gtk::Button *button_do_download =
nullptr;
99 Gtk::Button *button_cancel =
nullptr;
100 Gtk::MenuButton *button_new =
nullptr;
101 Gtk::Button *button_create =
nullptr;
102 Gtk::Button *button_save =
nullptr;
103 Gtk::Spinner *spinner_update =
nullptr;
104 Gtk::Revealer *download_revealer =
nullptr;
105 Gtk::Label *download_label =
nullptr;
106 Gtk::Spinner *download_spinner =
nullptr;
107 Gtk::MenuButton *hamburger_menu_button =
nullptr;
109 Gtk::Entry *download_gh_username_entry =
nullptr;
110 Gtk::Entry *download_gh_repo_entry =
nullptr;
111 Gtk::Entry *download_dest_dir_entry =
nullptr;
112 Gtk::Button *download_dest_dir_button =
nullptr;
114 Gtk::HeaderBar *header =
nullptr;
115 Gtk::ListBox *recent_pools_listbox =
nullptr;
116 Gtk::ListBox *recent_projects_listbox =
nullptr;
117 std::vector<Gtk::ListBox *> recent_listboxes;
118 Gtk::Box *pool_box =
nullptr;
121 Gtk::Label *pool_update_status_label =
nullptr;
122 Gtk::Revealer *pool_update_status_rev =
nullptr;
123 Gtk::Button *pool_update_status_close_button =
nullptr;
124 Gtk::ProgressBar *pool_update_progress =
nullptr;
125 sigc::connection pool_update_conn;
127 Gtk::InfoBar *info_bar =
nullptr;
128 Gtk::Label *info_bar_label =
nullptr;
129 Gtk::Button *show_output_button =
nullptr;
131 Gtk::InfoBar *info_bar_pool_not_added =
nullptr;
133 Gtk::MenuItem *menu_new_pool =
nullptr;
134 Gtk::MenuItem *menu_new_project =
nullptr;
138 Gtk::InfoBar *info_bar_pool_doc =
nullptr;
140 std::unique_ptr<Project> project =
nullptr;
141 std::string project_filename;
142 bool project_needs_save =
false;
146 std::unique_ptr<class PoolCacheMonitor> pool_cache_monitor;
149 ViewMode view_mode = ViewMode::OPEN;
150 void set_view_mode(ViewMode mode);
152 void update_recent_items();
156 void handle_recent();
157 void handle_update();
158 void handle_do_download();
159 void handle_new_project();
160 void handle_new_pool();
161 void handle_create();
162 void handle_cancel();
166 bool on_delete_event(GdkEventAny *ev)
override;
168 void download_thread(std::string gh_username, std::string gh_repo, std::string dest_dir);
174 std::map<UUID, PoolProjectManagerProcess> processes;
175 std::map<int, bool> pids_need_save;
180 const UUID uuid_pool_manager =
"1b9eecbe-7408-4b99-9aec-170d3658004a";
181 const UUID uuid_project_manager =
"144a4ad6-4c7c-4136-9920-f58f954c678e";
183 type_signal_process_exited s_signal_process_exited;
184 type_signal_process_saved s_signal_process_saved;
190 void handle_place_part(
const UUID &uu);
191 void handle_assign_part(
const UUID &uu);
194 zmq::socket_t sock_mgr;
195 std::string sock_mgr_ep;
198 bool check_schema_update(
const std::string &base_path);
200 bool download_back_to_start =
false;
202 bool check_autosave(PoolProjectManagerProcess::Type type,
const std::vector<std::string> &filenames);
204 static int git_transfer_cb(
const git_transfer_progress *stats,
void *payload);
205 bool downloading =
false;
206 bool download_cancel =
false;
209 zmq::context_t &zctx;
210 void set_pool_updating(
bool v,
bool success);
211 void set_pool_update_status_text(
const std::string &txt);
212 void set_pool_update_progress(
float progress);