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  bool pool_doc_info_bar_dismissed = false;
34 
35  void close_appwindows(std::set<Gtk::Window *> wins);
36  Preferences &get_preferences();
37 
38  void open_pool(const std::string &pool_json, ObjectType type = ObjectType::INVALID, const UUID &uu = UUID(),
39  guint32 timestamp = 0);
40 
41  class PreferencesWindow *show_preferences_window(guint32 timestamp = 0);
42 
43  typedef sigc::signal<void, UUID> type_signal_pool_updated;
44  type_signal_pool_updated signal_pool_updated()
45  {
46  return s_signal_pool_updated;
47  }
48 
49 protected:
50  // Override default signal handlers:
51  void on_activate() override;
52  void on_startup() override;
53  void on_shutdown();
54  void on_open(const Gio::Application::type_vec_files &files, const Glib::ustring &hint) override;
55 
56  std::string sock_broadcast_ep;
57 
58 
59 private:
60  class PoolProjectManagerAppWindow *create_appwindow();
61  void on_hide_window(Gtk::Window *window);
62  void on_action_quit();
63  void on_action_new_window();
64  void on_action_about();
65  void load_from_config(const std::string &config_filename);
66  Preferences preferences;
67  class PreferencesWindow *preferences_window = nullptr;
68 
69  type_signal_pool_updated s_signal_pool_updated;
70 
71 
72 public:
73  zmq::socket_t sock_broadcast;
74 };
75 } // namespace horizon
nlohmann::json
basic_json<> json
default JSON class
Definition: json_fwd.hpp:61
horizon::Preferences
Definition: preferences.hpp:97
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:165
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:25