Fawkes API  Fawkes Development Version
fuse_transfer_widget.h
1 
2 /***************************************************************************
3  * fuse_transfer_widget.h - Fuse transfer widget
4  *
5  * Created: Wed Mar 19 17:11:01 2008
6  * Copyright 2008 Daniel Beck
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef _FIREVISION_TOOLS_FIRESTATION_FUSE_TRANSFER_WIDGET_H_
24 #define _FIREVISION_TOOLS_FIRESTATION_FUSE_TRANSFER_WIDGET_H_
25 
26 #include <core/utils/lock_queue.h>
27 #include <fvutils/net/fuse_client_handler.h>
28 
29 #include <gtkmm.h>
30 
31 namespace firevision {
32 class FuseClient;
33 class YuvColormap;
34 } // namespace firevision
36 
38 {
39 public:
41  virtual ~FuseTransferWidget();
42 
43  void add_fountain_service(const char *name, const char *host_name, uint16_t port);
44  void remove_fountain_service(const char *name);
45 
47 
48  void set_upload_btn(Gtk::Button *btn_upload);
49  void set_download_btn(Gtk::Button *btn_download);
50  void set_local_img(Gtk::Image *img_local);
51  void set_local_layer_selector(Gtk::Scale *scl);
52  void set_remote_img(Gtk::Image *img_remote);
53  void set_remote_layer_selector(Gtk::Scale *scl);
54  void set_local_lut_list_trv(Gtk::TreeView *lut_list);
55  void set_remote_lut_list_trv(Gtk::TreeView *lut_list);
56 
57  // Fuse client handler
58  void fuse_invalid_server_version(uint32_t local_version, uint32_t remote_version) noexcept;
59  void fuse_connection_established() noexcept;
60  void fuse_connection_died() noexcept;
62 
63 private:
64  class LutRecord : public Gtk::TreeModelColumnRecord
65  {
66  public:
67  LutRecord()
68  {
69  add(filename);
70  add(service_name);
71  add(host_name);
72  add(port);
73  add(lut_id);
74  add(width);
75  add(height);
76  add(depth);
77  add(bytes_per_cell);
78  add(type);
79  }
80 
81  /// @cond INTERNALS
82  typedef enum { LUT_COLORMAP, LUT_MIRROR } LutType;
83 
84  Gtk::TreeModelColumn<Glib::ustring> filename;
85  Gtk::TreeModelColumn<Glib::ustring> service_name;
86  Gtk::TreeModelColumn<Glib::ustring> host_name;
87  Gtk::TreeModelColumn<unsigned int> port;
88  Gtk::TreeModelColumn<Glib::ustring> lut_id;
89  Gtk::TreeModelColumn<unsigned int> width;
90  Gtk::TreeModelColumn<unsigned int> height;
91  Gtk::TreeModelColumn<unsigned int> depth;
92  Gtk::TreeModelColumn<unsigned int> bytes_per_cell;
93  Gtk::TreeModelColumn<LutRecord::LutType> type;
94  /// @endcond
95  };
96 
97  // signal handler
98  void update_local_lut_list();
99  void update_remote_lut_list();
100  void get_lut_list();
101  void delete_clients();
102  void update_local_lut();
103  void update_remote_lut();
104  void upload_lut();
105 
106  void local_lut_selected();
107  void remote_lut_selected();
108 
109  /// @cond INTERNALS
110  struct ClientData
111  {
112  firevision::FuseClient *client;
113  std::string service_name;
114  std::string host_name;
115  uint16_t port;
116  bool active;
117  };
118  /// @endcond
119 
120  fawkes::LockQueue<ClientData> m_new_clients;
122 
123  ClientData m_cur_client;
124 
125  Glib::Dispatcher m_signal_update_local_lut_list;
126  Glib::Dispatcher m_signal_update_remote_lut_list;
127  Glib::Dispatcher m_signal_get_lut_list;
128  Glib::Dispatcher m_signal_delete_client;
129  Glib::Dispatcher m_signal_update_remote_lut;
130 
131  ColormapViewerWidget *m_local_colormap_viewer;
132  ColormapViewerWidget *m_remote_colormap_viewer;
133 
134  Gtk::Button * m_btn_upload;
135  Gtk::Button * m_btn_download;
136  Gtk::Image * m_img_local;
137  Gtk::Image * m_img_remote;
138  Gtk::TreeView *m_trv_local_lut_list;
139  Gtk::TreeView *m_trv_remote_lut_list;
140 
141  Glib::RefPtr<Gtk::ListStore> m_remote_lut_list;
142  Glib::RefPtr<Gtk::ListStore> m_local_lut_list;
143  LutRecord m_lut_record;
144 
145  firevision::YuvColormap *m_current_colormap;
146  firevision::YuvColormap *m_local_colormap;
147  firevision::YuvColormap *m_remote_colormap;
148 };
149 
150 #endif /* FIREVISION_TOOLS_FIRESTATION_FUSE_TRANSFER_WIDGET_H__ */
Select a layer from a colormap and render it to a Gtk::Image.
This class implements the logic for a GUI that allows to transfer LUTs via FUSE.
void fuse_connection_died() noexcept
Connection died.
void set_remote_lut_list_trv(Gtk::TreeView *lut_list)
Set the TreeView for the list of remote LUTs.
void set_local_layer_selector(Gtk::Scale *scl)
Assign a Scale to switch between the layers of the loal colormap.
void fuse_inbound_received(firevision::FuseNetworkMessage *m) noexcept
Message received.
void set_current_colormap(firevision::YuvColormap *colormap)
Set the current colormap.
void add_fountain_service(const char *name, const char *host_name, uint16_t port)
Tell the widget that a new FUSE service has been discovered.
void set_remote_img(Gtk::Image *img_remote)
Set the Image to display the remote LUT.
void fuse_connection_established() noexcept
Connection has been established.
void set_local_img(Gtk::Image *img_local)
Set the Image to display the local LUT.
void remove_fountain_service(const char *name)
Tell the widget that a service is not available any more.
virtual ~FuseTransferWidget()
Destructor.
void set_upload_btn(Gtk::Button *btn_upload)
Set the button to trigger the LUT upload.
FuseTransferWidget()
Constructor.
void set_remote_layer_selector(Gtk::Scale *scl)
Assign a Scale to switch between the layers of the remote colormap.
void set_download_btn(Gtk::Button *btn_download)
Set the button to trigger the LUT download.
void set_local_lut_list_trv(Gtk::TreeView *lut_list)
Set the TreeView for the list of local LUTs.
void fuse_invalid_server_version(uint32_t local_version, uint32_t remote_version) noexcept
Invalid version string received.
FUSE Network Message.
Definition: fuse_message.h:40
YUV Colormap.
Definition: yuvcm.h:36