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

Widget for selecting a mapping mode and the parameters. More...

#include <Mapping.h>

Inheritance diagram for omni::ui::Mapping:
Inheritance graph
[legend]
Collaboration diagram for omni::ui::Mapping:
Collaboration graph
[legend]

Public Slots

void selectMappingType (QString const &)
 

Signals

void dataModelChanged ()
 

Public Member Functions

 Mapping (QWidget *=nullptr)
 
 ~Mapping ()
 
- Public Member Functions inherited from omni::ui::DockWidget
 DockWidget (QWidget *=nullptr)
 
template<typename UI >
 DockWidget (UI &_ui, QWidget *_parent=nullptr)
 
virtual ~DockWidget ()
 
- Public Member Functions inherited from omni::ui::mixin::DataModel< DATAMODEL, SHARED >
 DataModel ()
 
void setDataModel (pointer_type _dataModel)
 Set new data model. More...
 
pointer_type dataModel ()
 Return pointer to data model. More...
 
const pointer_type dataModel () const
 Return pointer to data model (const version) More...
 
virtual void updateFrontend ()
 Push data to frontend widgets and all child widgets. More...
 
virtual void updateDataModel ()
 Update the data model interface. More...
 

Private Member Functions

void dataToFrontend ()
 Update widgets from current mapping. More...
 
bool frontendToData ()
 Assign widget values to current mapping. More...
 
void showParameterWidget ()
 
- Private Member Functions inherited from omni::ui::mixin::ParameterWidget<>
void removeParameterWidget (PARENT_WIDGET *_widget)
 Remove parameter widget from given widget. More...
 
bool setupParameterWidget (PARENT_WIDGET *_widget, INTERFACE *_interface)
 Setup widget for interface and place it onto widget. More...
 
widget_typeparameterWidget ()
 Return pointer to parameterWidget. More...
 

Private Attributes

std::unique_ptr< Ui::Mapping > ui_
 
TypeIdMemory< mapping::InterfacemappingMemory_
 Memory for storing/restoring settings of previously selected mapping. More...
 

Additional Inherited Members

- Public Types inherited from omni::ui::mixin::DataModel< DATAMODEL, SHARED >
typedef DATAMODEL data_model_type
 Data type. More...
 
typedef DataModel
< data_model_type, SHARED > 
type
 This type. More...
 
typedef detail::PointerType
< data_model_type, SHARED > 
pointer_type_handler
 Pointer type handler. More...
 
typedef pointer_type_handler::type pointer_type
 Derived pointer type. More...
 
- Protected Member Functions inherited from omni::ui::DockWidget
template<typename UI >
void setup (UI &_ui)
 Setup ui form UI parameter is smart pointer (e.g. unique_ptr) to UI form. More...
 
- Protected Member Functions inherited from omni::ui::mixin::Locked
template<typename F >
void locked (F f)
 Lock widget and execute given functor. More...
 
bool isLocked () const
 Return true if widget is locked. More...
 
- Private Types inherited from omni::ui::mixin::ParameterWidget<>
typedef QWidget widget_type
 

Detailed Description

Widget for selecting a mapping mode and the parameters.

Constructor & Destructor Documentation

omni::ui::Mapping::Mapping ( QWidget *  _parent = nullptr)
29  :
30  DockWidget(_parent)
31  {
32  this->setup(ui_);
33 
34  connect(ui_->boxMappingSelect, SIGNAL(currentIndexChanged(
35  QString)), this,
36  SLOT(selectMappingType(QString)));
37 
38  for (auto& _idMappingClass : omni::mapping::Factory::classes()) {
39  QString _id = _idMappingClass.first.str();
40  ui_->boxMappingSelect->addItem(QIcon(QString(":/mapping/") + _id +
41  QString(".png")), _id);
42  }
43  }
void setup(UI &_ui)
Setup ui form UI parameter is smart pointer (e.g. unique_ptr) to UI form.
Definition: DockWidget.h:44
DockWidget(QWidget *=nullptr)
Definition: DockWidget.cpp:24
void selectMappingType(QString const &)
Definition: Mapping.cpp:78
static class_map_type const & classes()
Gives readonly access to registered classes.
Definition: factory.hpp:108
std::unique_ptr< Ui::Mapping > ui_
Definition: Mapping.h:66
omni::ui::Mapping::~Mapping ( )
46  {}

Member Function Documentation

void omni::ui::Mapping::dataModelChanged ( )
signal
void omni::ui::Mapping::dataToFrontend ( )
privatevirtual

Update widgets from current mapping.

Implements omni::ui::mixin::DataModel< DATAMODEL, SHARED >.

49  {
50  if (!dataModel()->mapping())
51  {
52  dataModel()->setMapping("TexCoords");
53  }
54 
55  // Search combobox for available mapping types
56  int _index = 0;
57 
58  for (int i = 0; i < ui_->boxMappingSelect->count(); ++i)
59  {
60  QString _id = ui_->boxMappingSelect->itemData(i).toString();
61 
62  if (_id == dataModel()->mapping()->getTypeId().str())
63  {
64  _index = i;
65  }
66  }
67 
68  ui_->boxMappingSelect->setCurrentIndex(_index);
70  emit dataModelChanged();
71  }
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
void showParameterWidget()
Definition: Mapping.cpp:90
std::unique_ptr< Ui::Mapping > ui_
Definition: Mapping.h:66
bool omni::ui::Mapping::frontendToData ( )
privatevirtual

Assign widget values to current mapping.

Implements omni::ui::mixin::DataModel< DATAMODEL, SHARED >.

74  {
75  return false;
76  }
void omni::ui::Mapping::selectMappingType ( QString const &  _id)
slot
79  {
80  if (!dataModel() || this->isLocked()) return;
81 
82  mappingMemory_.store(dataModel()->mapping());
83  dataModel()->setMapping(_id);
84  mappingMemory_.restore(dataModel()->mapping());
85 
87  emit dataModelChanged();
88  }
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
void showParameterWidget()
Definition: Mapping.cpp:90
void restore(interface_type *_t) const
Restore object with interface in memory, if exists.
Definition: TypeIdMemory.h:56
bool isLocked() const
Return true if widget is locked.
Definition: Locked.h:40
void store(interface_type const *_t)
Store object with interface in memory.
Definition: TypeIdMemory.h:44
TypeIdMemory< mapping::Interface > mappingMemory_
Memory for storing/restoring settings of previously selected mapping.
Definition: Mapping.h:70
void omni::ui::Mapping::showParameterWidget ( )
private
90  {
91  this->setupParameterWidget(widget(), dataModel()->mapping());
92 
93  if (this->parameterWidget()) {
94  connect(this->parameterWidget(), SIGNAL(
95  parametersUpdated()), this,
96  SIGNAL(dataModelChanged()));
97  }
98  }
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
bool setupParameterWidget(PARENT_WIDGET *_widget, INTERFACE *_interface)
Setup widget for interface and place it onto widget.
Definition: ParameterWidget.h:51
widget_type * parameterWidget()
Return pointer to parameterWidget.
Definition: ParameterWidget.h:73

Field Documentation

TypeIdMemory<mapping::Interface> omni::ui::Mapping::mappingMemory_
private

Memory for storing/restoring settings of previously selected mapping.

std::unique_ptr<Ui::Mapping> omni::ui::Mapping::ui_
private

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