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 <fvutils/net/fuse_client_handler.h>
27 #include <core/utils/lock_queue.h>
28 
29 #include <gtkmm.h>
30 
31 namespace firevision {
32  class FuseClient;
33  class YuvColormap;
34 }
36 
38 {
39  public:
41  virtual ~FuseTransferWidget();
42 
43  void add_fountain_service( const char* name,
44  const char* host_name,
45  uint16_t port );
46  void remove_fountain_service(const char* name);
47 
48  void set_current_colormap(firevision::YuvColormap* colormap);
49 
50  void set_upload_btn(Gtk::Button* btn_upload);
51  void set_download_btn(Gtk::Button* btn_download);
52  void set_local_img(Gtk::Image* img_local);
53  void set_local_layer_selector(Gtk::Scale* scl);
54  void set_remote_img(Gtk::Image* img_remote);
55  void set_remote_layer_selector(Gtk::Scale* scl);
56  void set_local_lut_list_trv(Gtk::TreeView* lut_list);
57  void set_remote_lut_list_trv(Gtk::TreeView* lut_list);
58 
59  // Fuse client handler
60  void fuse_invalid_server_version(uint32_t local_version,
61  uint32_t remote_version) throw();
62  void fuse_connection_established() throw();
63  void fuse_connection_died() throw();
64  void fuse_inbound_received(firevision::FuseNetworkMessage *m) throw();
65 
66  private:
67  class LutRecord : public Gtk::TreeModelColumnRecord
68  {
69  public:
70  LutRecord()
71  {
72  add(filename);
73  add(service_name);
74  add(host_name);
75  add(port);
76  add(lut_id);
77  add(width);
78  add(height);
79  add(depth);
80  add(bytes_per_cell);
81  add(type);
82  }
83 
84  /// @cond INTERNALS
85  typedef enum
86  {
87  LUT_COLORMAP,
88  LUT_MIRROR
89  } LutType;
90 
91  Gtk::TreeModelColumn<Glib::ustring> filename;
92  Gtk::TreeModelColumn<Glib::ustring> service_name;
93  Gtk::TreeModelColumn<Glib::ustring> host_name;
94  Gtk::TreeModelColumn<unsigned int> port;
95  Gtk::TreeModelColumn<Glib::ustring> lut_id;
96  Gtk::TreeModelColumn<unsigned int> width;
97  Gtk::TreeModelColumn<unsigned int> height;
98  Gtk::TreeModelColumn<unsigned int> depth;
99  Gtk::TreeModelColumn<unsigned int> bytes_per_cell;
100  Gtk::TreeModelColumn<LutRecord::LutType> type;
101  /// @endcond
102  };
103 
104  // signal handler
105  void update_local_lut_list();
106  void update_remote_lut_list();
107  void get_lut_list();
108  void delete_clients();
109  void update_local_lut();
110  void update_remote_lut();
111  void upload_lut();
112 
113  void local_lut_selected();
114  void remote_lut_selected();
115 
116  /// @cond INTERNALS
117  struct ClientData
118  {
119  firevision::FuseClient* client;
120  std::string service_name;
121  std::string host_name;
122  uint16_t port;
123  bool active;
124  };
125  /// @endcond
126 
127  fawkes::LockQueue<ClientData> m_new_clients;
129 
130  ClientData m_cur_client;
131 
132  Glib::Dispatcher m_signal_update_local_lut_list;
133  Glib::Dispatcher m_signal_update_remote_lut_list;
134  Glib::Dispatcher m_signal_get_lut_list;
135  Glib::Dispatcher m_signal_delete_client;
136  Glib::Dispatcher m_signal_update_remote_lut;
137 
138  ColormapViewerWidget* m_local_colormap_viewer;
139  ColormapViewerWidget* m_remote_colormap_viewer;
140 
141  Gtk::Button* m_btn_upload;
142  Gtk::Button* m_btn_download;
143  Gtk::Image* m_img_local;
144  Gtk::Image* m_img_remote;
145  Gtk::TreeView* m_trv_local_lut_list;
146  Gtk::TreeView* m_trv_remote_lut_list;
147 
148  Glib::RefPtr<Gtk::ListStore> m_remote_lut_list;
149  Glib::RefPtr<Gtk::ListStore> m_local_lut_list;
150  LutRecord m_lut_record;
151 
152  firevision::YuvColormap* m_current_colormap;
153  firevision::YuvColormap* m_local_colormap;
154  firevision::YuvColormap* m_remote_colormap;
155 };
156 
157 #endif /* __FIREVISION_TOOLS_FIRESTATION_FUSE_TRANSFER_WIDGET_H_ */
This class implements the logic for a GUI that allows to transfer LUTs via FUSE.
YUV Colormap.
Definition: yuvcm.h:39
FUSE Network Message.
Definition: fuse_message.h:41
Select a layer from a colormap and render it to a Gtk::Image.