4 #include "util/uuid.hpp"
6 #include "util/win32_undef.hpp"
7 #include "nlohmann/json_fwd.hpp"
8 #include "util/editor_process.hpp"
9 #include "util/window_state_store.hpp"
10 #include "util/status_dispatcher.hpp"
11 #include "pool-prj-mgr-process.hpp"
12 #include "project/project.hpp"
13 #include "prj-mgr/prj-mgr_views.hpp"
14 #include "pool-mgr/view_create_pool.hpp"
15 #include "common/common.hpp"
32 void open_file_view(
const Glib::RefPtr<Gio::File> &file);
34 bool close_pool_or_project();
35 bool really_close_pool_or_project();
36 void wait_for_all_processes();
37 std::string get_filename()
const;
40 const std::vector<std::string> &env = {},
bool read_only =
false,
41 bool is_temp =
false);
43 const std::vector<std::string> &args);
45 std::map<UUID, PoolProjectManagerProcess *> get_processes();
47 class Pool *pool =
nullptr;
50 typedef sigc::signal<void, std::string, int, bool> type_signal_process_exited;
51 type_signal_process_exited signal_process_exited()
53 return s_signal_process_exited;
56 typedef sigc::signal<void, std::string> type_signal_process_saved;
57 type_signal_process_saved signal_process_saved()
59 return s_signal_process_saved;
66 bool can_close =
true;
68 std::vector<UUID> procs_need_save;
73 std::string get_proc_filename(
const UUID &uu);
74 void process_save(
const UUID &uu);
75 void process_close(
const UUID &uu);
76 void cleanup_pool_cache();
78 enum class ViewMode { OPEN, POOL, DOWNLOAD, PROJECT, CREATE_PROJECT, CREATE_POOL };
79 ViewMode get_view_mode()
const;
81 UUID get_pool_uuid()
const;
82 void pool_notebook_go_to(ObjectType type,
const UUID &uu);
83 void open_pool(
const std::string &pool_json, ObjectType type = ObjectType::INVALID,
const UUID &uu =
UUID());
84 void handle_download(
bool back_to_start =
false);
85 void update_pool_cache_status_now();
88 Glib::RefPtr<Gtk::Builder> builder;
89 Gtk::Stack *stack =
nullptr;
90 Gtk::Button *button_open =
nullptr;
91 Gtk::Button *button_close =
nullptr;
92 Gtk::Button *button_update =
nullptr;
93 Gtk::Button *button_download =
nullptr;
94 Gtk::Button *button_do_download =
nullptr;
95 Gtk::Button *button_cancel =
nullptr;
96 Gtk::MenuButton *button_new =
nullptr;
97 Gtk::Button *button_create =
nullptr;
98 Gtk::Button *button_save =
nullptr;
99 Gtk::Spinner *spinner_update =
nullptr;
100 Gtk::Revealer *download_revealer =
nullptr;
101 Gtk::Label *download_label =
nullptr;
102 Gtk::Spinner *download_spinner =
nullptr;
103 Gtk::ProgressBar *download_progress =
nullptr;
104 Gtk::MenuButton *hamburger_menu_button =
nullptr;
106 Gtk::Entry *download_gh_username_entry =
nullptr;
107 Gtk::Entry *download_gh_repo_entry =
nullptr;
108 Gtk::Entry *download_dest_dir_entry =
nullptr;
109 Gtk::Button *download_dest_dir_button =
nullptr;
111 Gtk::HeaderBar *header =
nullptr;
112 Gtk::ListBox *recent_pools_listbox =
nullptr;
113 Gtk::ListBox *recent_projects_listbox =
nullptr;
114 std::vector<Gtk::ListBox *> recent_listboxes;
115 Gtk::Box *pool_box =
nullptr;
118 Gtk::Label *pool_update_status_label =
nullptr;
119 Gtk::Revealer *pool_update_status_rev =
nullptr;
120 Gtk::Button *pool_update_status_close_button =
nullptr;
121 Gtk::ProgressBar *pool_update_progress =
nullptr;
122 sigc::connection pool_update_conn;
124 Gtk::InfoBar *info_bar =
nullptr;
125 Gtk::Label *info_bar_label =
nullptr;
126 Gtk::Button *show_output_button =
nullptr;
128 Gtk::InfoBar *info_bar_pool_not_added =
nullptr;
130 Gtk::MenuItem *menu_new_pool =
nullptr;
131 Gtk::MenuItem *menu_new_project =
nullptr;
135 Gtk::InfoBar *info_bar_pool_doc =
nullptr;
137 Gtk::InfoBar *info_bar_version =
nullptr;
138 Gtk::Label *version_label =
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 static void git_checkout_progress_cb(
const char *path,
size_t completed_steps,
size_t total_steps,
void *payload);
206 bool downloading =
false;
207 bool download_cancel =
false;
209 void set_version_info(
const std::string &s);
210 bool project_read_only =
false;
213 zmq::context_t &zctx;
214 void set_pool_updating(
bool v,
bool success);
215 void set_pool_update_status_text(
const std::string &txt);
216 void set_pool_update_progress(
float progress);
Definition: output_window.hpp:8
Definition: part_browser_window.hpp:15
Definition: pool_cache_window.hpp:15
Definition: pool_notebook.hpp:20
Definition: pool_parametric.hpp:10
Definition: pool-prj-mgr-app_win.hpp:64
Definition: pool-prj-mgr-app_win.hpp:21
Definition: pool-prj-mgr-app.hpp:16
Definition: pool-prj-mgr-process.hpp:6
Definition: view_create_pool.hpp:8
Definition: prj-mgr_views.hpp:9
Definition: prj-mgr_views.hpp:34
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:23
Definition: status_dispatcher.hpp:8
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Definition: window_state_store.hpp:20
a class to store JSON values
Definition: json.hpp:166
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61