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;
63 bool can_close =
true;
65 std::vector<UUID> procs_need_save;
70 std::string get_proc_filename(
const UUID &uu);
71 void process_save(
const UUID &uu);
72 void process_close(
const UUID &uu);
73 void cleanup_pool_cache();
75 enum class ViewMode { OPEN, POOL, DOWNLOAD, PROJECT, CREATE_PROJECT, CREATE_POOL };
76 ViewMode get_view_mode()
const;
78 UUID get_pool_uuid()
const;
79 void pool_notebook_go_to(ObjectType type,
const UUID &uu);
80 void open_pool(
const std::string &pool_json, ObjectType type = ObjectType::INVALID,
const UUID &uu =
UUID());
81 void handle_download(
bool back_to_start =
false);
82 void update_pool_cache_status_now();
85 Glib::RefPtr<Gtk::Builder> builder;
86 Gtk::Stack *stack =
nullptr;
87 Gtk::Button *button_open =
nullptr;
88 Gtk::Button *button_close =
nullptr;
89 Gtk::Button *button_update =
nullptr;
90 Gtk::Button *button_download =
nullptr;
91 Gtk::Button *button_do_download =
nullptr;
92 Gtk::Button *button_cancel =
nullptr;
93 Gtk::MenuButton *button_new =
nullptr;
94 Gtk::Button *button_create =
nullptr;
95 Gtk::Button *button_save =
nullptr;
96 Gtk::Spinner *spinner_update =
nullptr;
97 Gtk::Revealer *download_revealer =
nullptr;
98 Gtk::Label *download_label =
nullptr;
99 Gtk::Spinner *download_spinner =
nullptr;
100 Gtk::MenuButton *hamburger_menu_button =
nullptr;
102 Gtk::Entry *download_gh_username_entry =
nullptr;
103 Gtk::Entry *download_gh_repo_entry =
nullptr;
104 Gtk::Entry *download_dest_dir_entry =
nullptr;
105 Gtk::Button *download_dest_dir_button =
nullptr;
107 Gtk::HeaderBar *header =
nullptr;
108 Gtk::ListBox *recent_pools_listbox =
nullptr;
109 Gtk::ListBox *recent_projects_listbox =
nullptr;
110 std::vector<Gtk::ListBox *> recent_listboxes;
111 Gtk::Box *pool_box =
nullptr;
114 Gtk::Label *pool_update_status_label =
nullptr;
115 Gtk::Revealer *pool_update_status_rev =
nullptr;
116 Gtk::Button *pool_update_status_close_button =
nullptr;
117 Gtk::ProgressBar *pool_update_progress =
nullptr;
118 sigc::connection pool_update_conn;
120 Gtk::InfoBar *info_bar =
nullptr;
121 Gtk::Label *info_bar_label =
nullptr;
122 Gtk::Button *show_output_button =
nullptr;
124 Gtk::InfoBar *info_bar_pool_not_added =
nullptr;
126 Gtk::MenuItem *menu_new_pool =
nullptr;
127 Gtk::MenuItem *menu_new_project =
nullptr;
131 std::unique_ptr<Project> project =
nullptr;
132 std::string project_filename;
133 bool project_needs_save =
false;
137 std::unique_ptr<class PoolCacheMonitor> pool_cache_monitor;
140 ViewMode view_mode = ViewMode::OPEN;
141 void set_view_mode(ViewMode mode);
143 void update_recent_items();
147 void handle_recent();
148 void handle_update();
149 void handle_do_download();
150 void handle_new_project();
151 void handle_new_pool();
152 void handle_create();
153 void handle_cancel();
157 bool on_delete_event(GdkEventAny *ev)
override;
159 void download_thread(std::string gh_username, std::string gh_repo, std::string dest_dir);
165 std::map<UUID, PoolProjectManagerProcess> processes;
166 std::map<int, bool> pids_need_save;
171 const UUID uuid_pool_manager =
"1b9eecbe-7408-4b99-9aec-170d3658004a";
172 const UUID uuid_project_manager =
"144a4ad6-4c7c-4136-9920-f58f954c678e";
174 type_signal_process_exited s_signal_process_exited;
180 void handle_place_part(
const UUID &uu);
181 void handle_assign_part(
const UUID &uu);
184 zmq::socket_t sock_mgr;
185 std::string sock_mgr_ep;
188 bool check_schema_update(
const std::string &base_path);
190 bool download_back_to_start =
false;
192 bool check_autosave(PoolProjectManagerProcess::Type type,
const std::vector<std::string> &filenames);
194 static int git_transfer_cb(
const git_transfer_progress *stats,
void *payload);
195 bool downloading =
false;
196 bool download_cancel =
false;
199 zmq::context_t &zctx;
200 void set_pool_updating(
bool v,
bool success);
201 void set_pool_update_status_text(
const std::string &txt);
202 void set_pool_update_progress(
float progress);