Omnidome
Fulldome Mapping Software Toolkit
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Input.h
Go to the documentation of this file.
1 /* Copyright (c) 2014-2015 "Omnidome" by cr8tr
2  * Dome Mapping Projection Software (http://omnido.me).
3  * Omnidome was created by Michael Winkelmann aka Wilston Oreo (@WilstonOreo)
4  *
5  * This file is part of Omnidome.
6  *
7  * Omnidome is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU Affero General Public License as
9  * published by the Free Software Foundation, either version 3 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU Affero General Public License for more details.
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef OMNI_UI_INPUT_H_
21 #define OMNI_UI_INPUT_H_
22 
23 #include <memory>
24 #include "DockWidget.h"
25 #include <QAction>
26 #include <QStandardItemModel>
27 #include <omni/input/Interface.h>
30 
31 namespace omni {
32  class Session;
33 
34  namespace ui {
35  namespace Ui {
36  class Input;
37  }
38 
39  /// Input List widget
40  class Input :
41  public DockWidget,
42  public mixin::SharedDataModel<Session>,
43  private mixin::ParameterWidget<> {
44  Q_OBJECT
46 
47  public:
48  Input(QWidget * = nullptr);
49  ~Input();
50 
51  public slots:
52  void addInput(QAction *);
53 
54  /// Removes all selected inputs
55  void removeSelection();
56 
57  /// Removes all inputs
58  void clear();
59 
60  /// Select input at model index
61  void changeSelection(QModelIndex);
62 
63  signals:
64  void inputChanged();
65  void inputRemoved();
66  void dataModelChanged();
67  void inputIndexChanged();
68 
69  private:
70  /// Update sliders from given blend mask
71  void dataToFrontend();
72 
73  /// Assign slider values to blend mask
74  inline bool frontendToData() {
75  return false;
76  }
77 
78  void setupInputMenu(QMenu*);
79 
80  void inputUpdatedEmitter();
81 
82  void selectInputId(QString const&);
83 
84  /// Setup the item model with columns etc
85  void prepareModel();
86 
88 
89  QString itemId(int _row) const;
90 
91  /// Add an item to input list widget
92  void addItem(QString const& _id,
94 
95  void parameterWidgetSetupOptions(QWidget *_paramWidget) const;
96 
97  void showParameterWidget();
98 
99  std::unique_ptr<Ui::Input> ui_;
100  std::unique_ptr<QStandardItemModel> model_;
101  };
102  }
103 }
104 
105 
106 #endif /* OMNI_UI_INPUT_H_ */
A session consists of a canvas, a mapping, a list of tunings and one or several inputs.
Definition: Session.h:41
~Input()
Definition: Input.cpp:56
#define OMNI_UI_SHARED_DATAMODEL(MODEL)
Definition: DataModel.h:216
void addInput(QAction *)
Definition: Input.cpp:104
Input List widget.
Definition: Input.h:40
QString itemId(int _row) const
Definition: Input.cpp:171
std::unique_ptr< Ui::Input > ui_
Definition: Input.h:99
void prepareModel()
Setup the item model with columns etc.
Definition: Input.cpp:202
void parameterWidgetSetupOptions(QWidget *_paramWidget) const
Additional options. Is called during setup process.
Definition: Input.cpp:250
void showParameterWidget()
Definition: Input.cpp:193
void addItem(QString const &_id, input::Interface *)
Add an item to input list widget.
Definition: Input.cpp:227
Input(QWidget *=nullptr)
Definition: Input.cpp:36
void inputIndexChanged()
Generic input interface.
Definition: Interface.h:53
void selectInputId(QString const &)
Definition: Input.cpp:126
Setup and remove a parameter widget for a certain plugin interface.
Definition: ParameterWidget.h:34
bool frontendToData()
Assign slider values to blend mask.
Definition: Input.h:74
std::unique_ptr< QStandardItemModel > model_
Definition: Input.h:100
void clear()
Removes all inputs.
Definition: Input.cpp:162
void removeSelection()
Removes all selected inputs.
Definition: Input.cpp:143
Holds a specific data model with frontend update mechanism.
Definition: DataModel.h:87
void dataToFrontend()
Update sliders from given blend mask.
Definition: Input.cpp:92
DockWidget is scroll area with an embedded widget.
Definition: DockWidget.h:27
void inputUpdatedEmitter()
Definition: Input.cpp:139
void dataModelChanged()
input::Interface Input
Definition: Interface.h:225
bool showSettingsDialog(input::Interface *)
void setupInputMenu(QMenu *)
Definition: Input.cpp:61
void changeSelection(QModelIndex)
Select input at model index.
Definition: Input.cpp:177