BALL  1.5.0
serverWidget.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_KERNEL_SERVERWIDGET_H
6 #define BALL_VIEW_KERNEL_SERVERWIDGET_H
7 
8 #ifndef BALL_COMMON_H
9 # include <BALL/common.h>
10 #endif
11 
12 #ifndef BALL_DATATYPE_HASHMAP_H
13 # include <BALL/DATATYPE/hashMap.h>
14 #endif
15 
16 #ifndef BALL_VIEW_KERNEL_MODULARWIDGET_H
18 #endif
19 
20 #ifndef BALL_CONCEPT_OBJECTCREATOR_H
22 #endif
23 
24 #ifndef BALL_SYSTEM_NETWORKING_H
25 # include <BALL/SYSTEM/networking.h>
26 #endif
27 
28 #ifndef BALL_VIEW_KERNEL_THREADS_H
30 #endif
31 
32 #include <QtCore/QTimer>
33 #include <QtWidgets/QLabel>
34 
35 class QLabel;
36 
37 namespace BALL
38 {
39  class Composite;
40 
41  namespace VIEW
42  {
43  class ServerPreferences;
44  class Preferences;
45 
60  : public QObject,
61  public ModularWidget
62  {
63  Q_OBJECT
64 
65  public:
66 
68 
69 
72 
73 
78  class BALL_DEPRECATED BALL_VIEW_EXPORT NotCompositeObject: public Exception::GeneralException
79  {
80  public:
81 
82  NotCompositeObject(const char* file, int line);
83  };
84 
86 
91  : public virtual BALLThread,
92  public virtual TCPServerThread
93  {
94  public:
95  BALLViewServer(ServerWidget* parent, Size port, bool restart = true);
96 
100  void sendObject();
101 
102  virtual void run();
103 
115  virtual void handleConnection();
116 
118  void setLocked(bool is_locked);
119 
120  protected:
123 
126 
129  };
130 
134 
142  ServerWidget(QWidget* parent = 0, const char* name = 0);
143 
144  // only for Python interface
145  ServerWidget(const ServerWidget& server);
146 
148 
151 
154  virtual ~ServerWidget();
155 
160  virtual void clear();
162 
166 
169  virtual void activate() {};
170 
173  virtual void deactivate() {};
174 
178  void setPort(const int port);
179 
184  int getPort() const;
185 
192 
199 
203 
207 
215  virtual void initializeWidget(MainControl& main_control);
216 
225  virtual void finalizeWidget(MainControl& main_control);
226 
239  virtual void initializePreferencesTab(Preferences &preferences);
240 
253  virtual void finalizePreferencesTab(Preferences &preferences);
254 
266  virtual void applyPreferences();
267 
269 
272 
278  virtual bool isValid() const;
279 
286  virtual void dump(std::ostream& s = std::cout, Size depth = 0) const;
287 
295  virtual void changeLock(bool lock);
296 
298 
301  public Q_SLOTS:
302  void handleLocking(bool lock);
303 
304  Q_SIGNALS:
305  void lockRequested(bool lock);
306 
308  private:
309 
311  BALLViewServer server_;
312 
315  ObjectCreator *object_creator_;
316 
317  // the port to bind to
318  int port_;
319 
320  ServerPreferences *server_preferences_;
321  QLabel *server_icon_;
322  static const char *mini_ray_xpm_[];
323  };
324 
325 
326 # ifndef BALL_NO_INLINE_FUNCTIONS
327 # include <BALL/VIEW/KERNEL/serverWidget.iC>
328 # endif
329 
330  }// namespace VIEW
331 }// namespace BALL
332 
333 #endif // BALL_VIEW_KERNEL_SERVER_H
BALL::VIEW::ServerWidget::BALLViewServer::CompositeHashMap
HashMap< unsigned long, Composite * > CompositeHashMap
Definition: serverWidget.h:124
BALL::VIEW::ServerWidget::clear
virtual void clear()
BALL::VIEW::ServerWidget::getPort
int getPort() const
BALL::VIEW::ServerWidget::finalizePreferencesTab
virtual void finalizePreferencesTab(Preferences &preferences)
BALL::VIEW::ServerWidget::BALLViewServer::parent_widget_
ServerWidget * parent_widget_
Definition: serverWidget.h:121
BALL::VIEW::ServerWidget::getObjectCreator
ObjectCreator & getObjectCreator()
hashMap.h
BALL::HashMap< unsigned long, Composite * >
BALL::VIEW::ServerWidget::registerObjectCreator
void registerObjectCreator(const ObjectCreator &s)
BALL::VIEW::ServerPreferences
Definition: serverPreferences.h:40
objectCreator.h
BALL::VIEW::ServerWidget::NotCompositeObject
Definition: serverWidget.h:79
BALL::VIEW::ServerWidget::applyPreferences
virtual void applyPreferences()
BALL::VIEW::ServerWidget::BALLViewServer::composite_hashmap_
CompositeHashMap composite_hashmap_
Definition: serverWidget.h:125
BALL::VIEW::ServerWidget::BALLViewServer::setLocked
void setLocked(bool is_locked)
BALL::VIEW::ServerWidget::dump
virtual void dump(std::ostream &s=std::cout, Size depth=0) const
BALL_EMBEDDABLE
#define BALL_EMBEDDABLE(TYPE, BASE)
Definition: embeddable.h:31
networking.h
BALL::VIEW::ServerWidget::BALLViewServer::run
virtual void run()
BALL::VIEW::MainControl
Definition: mainControl.h:118
BALL
Definition: constants.h:13
QWidget
BALL::VIEW::ServerWidget::unregisterObjectCreator
void unregisterObjectCreator()
BALL::VIEW::ServerWidget::initializePreferencesTab
virtual void initializePreferencesTab(Preferences &preferences)
BALL::VIEW::BALLThread
Definition: threads.h:72
BALL::TCPServerThread
Definition: networking.h:97
BALL::VIEW::ServerWidget::deactivate
virtual void deactivate()
Definition: serverWidget.h:173
BALL::VIEW::ServerWidget::handleLocking
void handleLocking(bool lock)
BALL::VIEW::ServerWidget::changeLock
virtual void changeLock(bool lock)
modularWidget.h
BALL::VIEW::ServerWidget::activate
virtual void activate()
Definition: serverWidget.h:169
BALL::VIEW::ServerWidget::BALLViewServer
Definition: serverWidget.h:93
BALL::Composite
Definition: composite.h:74
BALL_SIZE_TYPE
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
BALL::VIEW::ServerWidget::lockRequested
void lockRequested(bool lock)
BALL::VIEW::ServerWidget::setPort
void setPort(const int port)
BALL::VIEW::ServerWidget::BALLViewServer::received_composite_
Composite * received_composite_
Definition: serverWidget.h:122
BALL::VIEW::ServerWidget::BALLViewServer::port_
Size port_
Definition: serverWidget.h:127
BALL::VIEW::ServerWidget::getObjectCreator
const ObjectCreator & getObjectCreator() const
BALL::VIEW::ServerWidget::BALLViewServer::handleConnection
virtual void handleConnection()
BALL::VIEW::ServerWidget::BALLViewServer::is_locked_
bool is_locked_
Definition: serverWidget.h:128
BALL::VIEW::ServerWidget::BALLViewServer::sendObject
void sendObject()
BALL::VIEW::ServerWidget::~ServerWidget
virtual ~ServerWidget()
BALL::VIEW::ServerWidget::isValid
virtual bool isValid() const
BALL::ObjectCreator
Definition: objectCreator.h:36
common.h
BALL::VIEW::Preferences
Definition: preferences.h:43
BALL::VIEW::ServerWidget::initializeWidget
virtual void initializeWidget(MainControl &main_control)
BALL::VIEW::ServerWidget::finalizeWidget
virtual void finalizeWidget(MainControl &main_control)
threads.h
BALL::VIEW::ServerWidget::BALLViewServer::BALLViewServer
BALLViewServer(ServerWidget *parent, Size port, bool restart=true)
BALL::VIEW::ServerWidget::ServerWidget
ServerWidget(const ServerWidget &server)
BALL::VIEW::ServerWidget
Definition: serverWidget.h:62
BALL::VIEW::ServerWidget::NotCompositeObject::NotCompositeObject
NotCompositeObject(const char *file, int line)
QObject
BALL::VIEW::ModularWidget
Definition: modularWidget.h:63
BALL::VIEW::ServerWidget::ServerWidget
ServerWidget(QWidget *parent=0, const char *name=0)
BALL_DEPRECATED
#define BALL_DEPRECATED
Definition: COMMON/global.h:64