Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | Friends
omni::input::List Class Reference

Input List contains a list of inputs, accessible over an QString id Input List is the root input of a session's input tree. Input List is serializable via QDataStream. More...

#include <List.h>

Inheritance diagram for omni::input::List:
Inheritance graph
[legend]
Collaboration diagram for omni::input::List:
Collaboration graph
[legend]

Public Member Functions

 List (Interface const *=nullptr)
 
void registerInFactory () const
 A list cannot be registered in factory. More...
 
Id getTypeId () const
 Type id is "List". More...
 
std::pair< QString, Input * > addInput (Id const &_typeId)
 Add new input with given type id. Returns nullptr if input with typeid does not exist Id is automatically generated. More...
 
void removeInput (QString const &_id)
 Remove input and reset current index if necessary. More...
 
bool canHaveChildren () const
 List can have children. More...
 
QSize size () const
 List has no size. More...
 
GLuint textureId () const
 List does not have a texture. More...
 
QWidget * widget ()
 Make new parameter widget. More...
 
Inputoperator[] (QString const &_id)
 Return input at index. More...
 
Input const * operator[] (QString const &_id) const
 Returns input at index (const version) More...
 
void clear ()
 Delete all inputs. More...
 
Inputcurrent ()
 Returns pointer to current input Returns nullptr if currentIdx_ == -1 or input list is empty. More...
 
Input const * current () const
 Returns pointer to current input (const version) Returns nullptr if currentIdx_ == -1 or input list is empty. More...
 
QString currentId () const
 Return ID of current input. More...
 
void setCurrentId (QString const &)
 Set current input by ID. More...
 
Controllercontroller ()
 Return pointer to controller. More...
 
Controller const * controller () const
 Return pointer to controller (const version) More...
 
void fromPropertyMap (PropertyMap const &)
 Deserialize from property map. More...
 
void toPropertyMap (PropertyMap &) const
 Serialize to property map. More...
 
- Public Member Functions inherited from omni::input::Interface
 Interface (Interface const *_parent=nullptr)
 
virtual ~Interface ()
 Virtual destructor. More...
 
virtual void update ()
 Update interface. More...
 
size_t numberOfChildren () const
 
int width () const
 Return width from size. More...
 
int height () const
 Return height from size. More...
 
virtual categoryset_type categories () const
 Input can have a fixed set of categories. More...
 
QString infoText () const
 Optional info text. More...
 
virtual QWidget * controlWidget ()
 Make new large control widget for live mode. More...
 
virtual bool canAdd ()
 Returns true if this input can be added E.g., an input can be added after an initial settings dialog was approved or it has valid settings. More...
 
int setUpdateCallback (callback_type _updatedCallback)
 Insert a new callback when input has updated and returns its unique id. More...
 
callback_type updatedCallback (int _id)
 
void triggerUpdateCallbacks () const
 
void removeUpdateCallback (int _id)
 
InterfaceaddInput (QString const &_id, Id const &_typeId)
 Add new input with given type id. Returns nullptr if input with typeid does not exist. More...
 
InterfaceaddInput (QString const &_id, Interface *_i)
 Input with id and return pointer to input when successfully added. More...
 
QString getId (Interface const *) const
 Get id of child interface. More...
 
InterfacegetInput (QString const &_id)
 Return pointer of input with id, nullptr if input does not exist. More...
 
Interface const * getInput (QString const &_id) const
 Return pointer of input with id, nullptr if input does not exist. More...
 
container_type const & children () const
 Return children. More...
 
Interface const * parent () const
 Return parent interface (const version) More...
 
QString path () const
 Return absolute path of interface. More...
 
void setParent (Interface *)
 Set new parent. More...
 
inputlist_type getAllInputs () const
 Returns a list of input maintained by controller, except this one. More...
 
- Public Member Functions inherited from omni::TypeIdInterface
virtual ~TypeIdInterface ()
 

Private Member Functions

QString generateId () const
 Generate a new id for input. More...
 

Private Attributes

QString currentId_
 

Friends

bool operator== (List const &, List const &)
 Test for equality. More...
 

Additional Inherited Members

- Public Types inherited from omni::input::Interface
typedef Interface interface_type
 
typedef std::vector< Interface
const * > 
inputlist_type
 
typedef std::map< QString,
std::unique_ptr< Interface > > 
container_type
 
typedef std::function< void()> callback_type
 
typedef std::set< QString > categoryset_type
 

Detailed Description

Input List contains a list of inputs, accessible over an QString id Input List is the root input of a session's input tree. Input List is serializable via QDataStream.

Constructor & Destructor Documentation

omni::input::List::List ( Interface const *  _parent = nullptr)
29  : Interface(_parent)
30  {}
Interface(Interface const *_parent=nullptr)
Definition: Interface.cpp:30

Member Function Documentation

std::pair< QString, Input * > omni::input::List::addInput ( Id const &  _typeId)

Add new input with given type id. Returns nullptr if input with typeid does not exist Id is automatically generated.

Parameters
_typeIdType id of input to determine which kind of input is created
Returns
Pair with input id and pointer to added input
37  {
38  auto _id = generateId();
39 
40  return std::make_pair(_id, input::Interface::addInput(_id, _typeId));
41  }
Interface * addInput(QString const &_id, Id const &_typeId)
Add new input with given type id. Returns nullptr if input with typeid does not exist.
Definition: Interface.cpp:41
QString generateId() const
Generate a new id for input.
Definition: List.cpp:139
bool omni::input::List::canHaveChildren ( ) const
inlinevirtual

List can have children.

Reimplemented from omni::input::Interface.

66  {
67  return true;
68  }
void omni::input::List::clear ( )

Delete all inputs.

33  {
34  Interface::clear();
35  }
Controller * omni::input::List::controller ( )

Return pointer to controller.

112  {
113  return Controller::instance();
114  }
static Controller * instance()
Definition: Controller.cpp:33
Controller const * omni::input::List::controller ( ) const

Return pointer to controller (const version)

117  {
118  return Controller::instance();
119  }
static Controller * instance()
Definition: Controller.cpp:33
Input * omni::input::List::current ( )

Returns pointer to current input Returns nullptr if currentIdx_ == -1 or input list is empty.

79  {
80  return getInput(currentId_);
81  }
Interface * getInput(QString const &_id)
Return pointer of input with id, nullptr if input does not exist.
Definition: Interface.cpp:66
QString currentId_
Definition: List.h:130
Input const * omni::input::List::current ( ) const

Returns pointer to current input (const version) Returns nullptr if currentIdx_ == -1 or input list is empty.

74  {
75  return getInput(currentId_);
76  }
Interface * getInput(QString const &_id)
Return pointer of input with id, nullptr if input does not exist.
Definition: Interface.cpp:66
QString currentId_
Definition: List.h:130
QString omni::input::List::currentId ( ) const

Return ID of current input.

84  {
85  return currentId_;
86  }
QString currentId_
Definition: List.h:130
void omni::input::List::fromPropertyMap ( PropertyMap const &  _map)
virtual

Deserialize from property map.

Reimplemented from omni::input::Interface.

62  {
64  _map("currentId",currentId_);
66  }
virtual void fromPropertyMap(PropertyMap const &)
Deserialize from property map.
Definition: Interface.cpp:156
QString currentId_
Definition: List.h:130
void setCurrentId(QString const &)
Set current input by ID.
Definition: List.cpp:88
QString omni::input::List::generateId ( ) const
private

Generate a new id for input.

139  {
140  QString _id("0");
141 
142  for (size_t i = 0; i <= numberOfChildren(); ++i) {
143  _id = QString("%1").arg(i);
144 
145  if (getInput(_id) == nullptr)
146  {
147  return _id;
148  }
149  }
150  return _id;
151  }
size_t numberOfChildren() const
Definition: Interface.h:85
Interface * getInput(QString const &_id)
Return pointer of input with id, nullptr if input does not exist.
Definition: Interface.cpp:66
Id omni::input::List::getTypeId ( ) const
inlinevirtual

Type id is "List".

Implements omni::TypeIdInterface.

49  {
50  return Id("List");
51  }
Input * omni::input::List::operator[] ( QString const &  _id)

Return input at index.

52  {
53  return Interface::getInput(_id);
54  }
Interface * getInput(QString const &_id)
Return pointer of input with id, nullptr if input does not exist.
Definition: Interface.cpp:66
Input const * omni::input::List::operator[] ( QString const &  _id) const

Returns input at index (const version)

57  {
58  return Interface::getInput(_id);
59  }
Interface * getInput(QString const &_id)
Return pointer of input with id, nullptr if input does not exist.
Definition: Interface.cpp:66
void omni::input::List::registerInFactory ( ) const
inlinevirtual

A list cannot be registered in factory.

Implements omni::TypeIdInterface.

45  {
46  }
void omni::input::List::removeInput ( QString const &  _id)
virtual

Remove input and reset current index if necessary.

Reimplemented from omni::input::Interface.

44  {
46  if (_id == currentId_) {
47  setCurrentId("");
48  }
49  }
virtual void removeInput(QString const &_id)
Remove input with id.
Definition: Interface.cpp:62
QString currentId_
Definition: List.h:130
void setCurrentId(QString const &)
Set current input by ID.
Definition: List.cpp:88
void omni::input::List::setCurrentId ( QString const &  _id)

Set current input by ID.

Deactivate current input

89  {
90  if (getInput(_id) == nullptr) {
91  currentId_ = "";
92  return;
93  }
94  qDebug() << currentId_;
95 
96  /// Deactivate current input
97  if (current()) {
99  }
100 
101  currentId_ = _id;
102  qDebug() << currentId_;
103 
104  if (current()) {
105  current()->update();
107  }
108  qDebug() << current();
109  }
void activate(input::Interface *)
Activate input.
Definition: Controller.cpp:50
void deactivate(input::Interface *)
Deactivate input.
Definition: Controller.cpp:65
Controller * controller()
Return pointer to controller.
Definition: List.cpp:112
Interface * getInput(QString const &_id)
Return pointer of input with id, nullptr if input does not exist.
Definition: Interface.cpp:66
Input * current()
Returns pointer to current input Returns nullptr if currentIdx_ == -1 or input list is empty...
Definition: List.cpp:78
QString currentId_
Definition: List.h:130
virtual void update()
Update interface.
Definition: Interface.h:80
QSize omni::input::List::size ( ) const
inlinevirtual

List has no size.

Implements omni::input::Interface.

71  {
72  return QSize(0, 0);
73  }
GLuint omni::input::List::textureId ( ) const
inlinevirtual

List does not have a texture.

Implements omni::input::Interface.

76  {
77  return 0;
78  }
void omni::input::List::toPropertyMap ( PropertyMap &  _map) const
virtual

Serialize to property map.

Reimplemented from omni::input::Interface.

68  {
69  _map("currentId",currentId_);
71  }
QString currentId_
Definition: List.h:130
virtual void toPropertyMap(PropertyMap &) const
Serialize to property map.
Definition: Interface.cpp:145
QWidget* omni::input::List::widget ( )
inlinevirtual

Make new parameter widget.

Reimplemented from omni::input::Interface.

80  {
81  return nullptr;
82  }

Friends And Related Function Documentation

bool operator== ( List const &  _lhs,
List const &  _rhs 
)
friend

Test for equality.

122  {
123  if (_lhs.currentId_ != _rhs.currentId_) return false;
124 
125  if (_lhs.size() != _rhs.size()) return false;
126 
127  auto it = _lhs.begin();
128  auto jt = _rhs.begin();
129 
130  for (; (it != _lhs.end()) && (jt != _rhs.end()); ++it, ++jt)
131  {
132  if (it->first != jt->first) return false;
133 
134  if (!it->second->equal(jt->second.get())) return false;
135  }
136  return true;
137  }

Field Documentation

QString omni::input::List::currentId_
private

The documentation for this class was generated from the following files: