roviz  0.7
Code Documentation of roviz
roviz_item_base_dev.h
1 #ifndef ROVIZ_ITEM_BASE_DEV_H
2 #define ROVIZ_ITEM_BASE_DEV_H
3 
4 #include <string>
5 #include <functional>
6 #include <QScopedPointer>
7 #include <QMenu>
8 #include "item/abstract_item.h"
9 #include "core/export_handling.h"
10 #include "backend_dev/roviz_item_base_dev_p.h"
11 #include "core/input.h"
12 #include "core/output.h"
13 #include "config/config_storage_type.h"
14 
15 class QGraphicsSceneMouseEvent;
16 class ConfigImpl;
17 class TrimImpl;
18 
25 class ROVIZ_EXPORT RovizItemBaseDev : public AbstractItem
26 {
27  Q_OBJECT
28  friend class RovizItemBaseDevPrivate;
29 
30 public:
34  explicit RovizItemBaseDev(std::string type_name);
35  virtual ~RovizItemBaseDev();
36 
45  virtual QWidget *widget(void);
46 
54  virtual void pause(void) = 0;
56  virtual void unpause(void) = 0;
57  virtual bool running(void) const = 0;
58  virtual void join(void) = 0;
59 
60 protected:
61  template<class T>
62  Input<T> addInputBase(std::string name, RovizItem *item);
63 
64  template<class T>
65  Output<T> addOutputBase(std::string name);
66 
67  TrimImpl *getTrimImpl(std::string name, double default_value, double min, double max, int steps, bool logarithmic, std::function<void (double)> notifier_func);
68 
69  // Note: The signatures of the getConfigImpl() functions is distinct for every type,
70  // so we don't really need a template here. We also wouldn't need one in RovizItem
71  // in the first place, but in the future, there might come more configs with the same
72  // signature and introducing templates at that point would mean rewriting all plugins.
73  // If a config with the same signature comes up in the futere, we can safely switch to
74  // a template here without breaking the plugins.
75 
76  ConfigImpl *getConfigImpl(const std::string &name, const typename ConfigStorageType<int>::type &default_value, int min, int max, bool restart_when_changed);
77  ConfigImpl *getConfigImpl(const std::string &name, const typename ConfigStorageType<double>::type &default_value, double min, double max, bool restart_when_changed);
78  ConfigImpl *getConfigImpl(const std::string &name, const typename ConfigStorageType<std::string>::type &default_value, std::function<bool (std::string&)> checker, bool restart_when_changed);
79  ConfigImpl *getConfigImpl(const std::string &name, const typename ConfigStorageType<std::list<std::string> >::type &default_index, const std::list<std::string> &possibilities, bool restart_when_changed);
80  ConfigImpl *getConfigImpl(const std::string &name, const typename ConfigStorageType<bool>::type &default_value, bool restart_when_changed);
81  ConfigImpl *getConfigImpl(const std::string &name, const typename ConfigStorageType<FilePath>::type &default_value, enum FilePath::Mode file_mode, const std::string &filter, bool restart_when_changed);
82 
83 public slots:
84  virtual void start(void);
85  virtual void stop(void);
86  void restart(void);
88 
89 protected:
93  void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) override;
94 
100  void contextMenuPrepare(QMenu &menu) const override;
101 
102 private:
103  QScopedPointer<RovizItemBaseDevPrivate> _this;
104 };
105 
106 #endif // ROVIZ_ITEM_BASE_DEV_H
Class that connects a type that can be stored in a config and it&#39;s value type.
Definition: config_storage_type.h:20
Base class for all config implementations.
Definition: config_impl.h:11
Represents the output of an item.
Definition: output.h:18
The interface of a Trim implementation.
Definition: trim_impl.h:7
Represents the input of an item.
Definition: input.h:19
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
A simple default implementation of the mouseDoubleClickEvent. Override to do custom things (e...
Definition: abstract_item.cpp:248
Base class for all items that use the roviz framework.
Definition: roviz_item.h:43
virtual void contextMenuPrepare(QMenu &menu) const
This method is called with an empty QMenu whenever a contextmenu on the current item is requested...
Definition: abstract_item.cpp:244
Base class that binds RovizItem to the itemframework/Qt.
Definition: roviz_item_base_dev.h:25
The AbstractItem class is the base class for all items.
Definition: abstract_item.h:69
Private part of RovizItemDevBase.
Definition: roviz_item_base_dev_p.h:21