Horizon
pool-prj-mgr-app.hpp
1 #pragma once
2 #include <gtkmm.h>
3 #include "util/uuid.hpp"
4 #include "nlohmann/json_fwd.hpp"
5 #include <map>
6 #include <set>
7 #include <zmq.hpp>
8 #include <glibmm/datetime.h>
9 #ifdef G_OS_WIN32
10 #undef ERROR
11 #undef DELETE
12 #undef DUPLICATE
13 #endif
14 #include "preferences/preferences.hpp"
15 
16 namespace horizon {
17 using json = nlohmann::json;
18 
19 class PoolProjectManagerApplication : public Gtk::Application {
20 protected:
22 
23 public:
24  static Glib::RefPtr<PoolProjectManagerApplication> create();
25  std::string get_config_filename();
26  const std::string &get_ep_broadcast() const;
27  void send_json(int pid, const json &j);
28  zmq::context_t zctx;
29 
30  std::map<std::string, Glib::DateTime> recent_items;
31 
32  std::deque<UUID> part_favorites;
33 
34  void close_appwindows(std::set<Gtk::Window *> wins);
35  Preferences &get_preferences();
36 
37  void open_pool(const std::string &pool_json, ObjectType type = ObjectType::INVALID, const UUID &uu = UUID(),
38  guint32 timestamp = 0);
39 
40  class PreferencesWindow *show_preferences_window(guint32 timestamp = 0);
41 
42 protected:
43  // Override default signal handlers:
44  void on_activate() override;
45  void on_startup() override;
46  void on_shutdown();
47  void on_open(const Gio::Application::type_vec_files &files, const Glib::ustring &hint) override;
48 
49  std::string sock_broadcast_ep;
50 
51 
52 private:
53  class PoolProjectManagerAppWindow *create_appwindow();
54  void on_hide_window(Gtk::Window *window);
55  void on_action_quit();
56  void on_action_new_window();
57  void on_action_about();
58  void load_from_config(const std::string &config_filename);
59  Preferences preferences;
60  class PreferencesWindow *preferences_window = nullptr;
61 
62 
63 public:
64  zmq::socket_t sock_broadcast;
65 };
66 } // namespace horizon
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
horizon::Preferences
Definition: preferences.hpp:73
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:161
horizon::UUID
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
horizon::PreferencesWindow
Definition: preferences_window.hpp:7
horizon::PoolProjectManagerApplication
Definition: pool-prj-mgr-app.hpp:19
horizon::PoolProjectManagerAppWindow
Definition: pool-prj-mgr-app_win.hpp:24