#include <TuningList.h>
omni::ui::proj::TuningList::TuningList |
( |
QWidget * |
_parent = nullptr | ) |
|
44 layout_->setSizeConstraint(QLayout::SetMinAndMaxSize);
46 layout_->setContentsMargins(0, 0, 16, 0);
48 this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
55 this->setWidgetResizable(
true);
QWidget * contents_
Definition: TuningList.h:142
QLayout * layout_
Definition: TuningList.h:143
omni::ui::proj::TuningList::~TuningList |
( |
| ) |
|
void omni::ui::proj::TuningList::addTuning |
( |
| ) |
|
|
slot |
Add a new tuning and tuning widget, with automatically detected settings.
105 QString _setupId =
"PeripheralSetup";
112 1]->projector().setup();
114 if (_setup) _setupId = _setup->getTypeId();
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
void addTuning()
Add a new tuning and tuning widget, with automatically detected settings.
Definition: TuningList.cpp:102
void omni::ui::proj::TuningList::addTuning |
( |
QString const & |
_projSetupId | ) |
|
|
slot |
Add tuning with specific projector setup.
124 QMessageBox::information(
this,
"Information",
126 "You have reached the maximum of %1 projectors.").arg(
131 auto *_tuning =
dataModel()->tunings().add(
false);
133 if (!_tuning)
return;
136 _tuning->projector().setup(_projSetupId,
dataModel()->scene().size());
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
QColor getTuningColor()
Get most differing color for a new tuning.
Definition: TuningList.cpp:179
#define OMNI_MAX_NUMBER_TUNINGS
Definition: TuningList.cpp:31
void addTuning()
Add a new tuning and tuning widget, with automatically detected settings.
Definition: TuningList.cpp:102
void setTuningIndex(int)
Set current tuning index manually (currentIndexChanged signal is emitted)
Definition: TuningList.cpp:395
Add widget from existing tuning.
148 for (
auto& _sessionTuning :
dataModel()->tunings())
150 if (_sessionTuning.get() == _tuning)
159 auto _widget =
widgets_.back().get();
162 _widget->connect(_widget, SIGNAL(selected(
165 _widget->connect(_widget, SIGNAL(closed(
168 _widget->connect(_widget, SIGNAL(
169 projectorSetupChanged()),
this,
171 _widget->connect(_widget, SIGNAL(
174 _widget->sessionModeChange();
void dataModelChanged()
Signal which is emitted when parameters of one tuning have changed.
void removeTuning(int _index)
Remove tuning.
Definition: TuningList.cpp:236
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
QWidget * contents_
Definition: TuningList.h:142
void tuningAdded()
Signal is emitted when a tuning was added.
void setTuningIndex(int)
Set current tuning index manually (currentIndexChanged signal is emitted)
Definition: TuningList.cpp:395
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void tuningChanged()
Emitted when a single tuning has changed.
void omni::ui::proj::TuningList::clear |
( |
| ) |
|
|
slot |
Remove all tunings from session and all associated widgets.
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
void removeWidgets()
Removes all widgets in the scroll area Unlike clear() it does not remove tunings from session...
Definition: TuningList.cpp:283
void omni::ui::proj::TuningList::currentIndexChanged |
( |
int |
| ) |
|
|
signal |
Signal which is emitted when the current tuning has changed.
void omni::ui::proj::TuningList::dataModelChanged |
( |
| ) |
|
|
signal |
Signal which is emitted when parameters of one tuning have changed.
void omni::ui::proj::TuningList::dataToFrontend |
( |
| ) |
|
|
privatevirtual |
Update sliders from current session.
Implements omni::ui::mixin::DataModel< DATAMODEL, SHARED >.
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
void removeWidgets()
Removes all widgets in the scroll area Unlike clear() it does not remove tunings from session...
Definition: TuningList.cpp:283
void sessionModeChange()
Change current mode for all tuning widgets.
Definition: TuningList.cpp:260
void addTuning()
Add a new tuning and tuning widget, with automatically detected settings.
Definition: TuningList.cpp:102
void omni::ui::proj::TuningList::disableAllTunings |
( |
| ) |
|
|
slot |
Disable all tunings and fullscreen.
320 _widget->fullscreenToggle(
false);
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::enableAllTunings |
( |
| ) |
|
|
slot |
Enable all tunings and fullscreen.
327 _widget->fullscreenToggle(
true);
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::enableSelectedTuningOnly |
( |
| ) |
|
|
slot |
Enable selected tuning and show only this in fullscreen.
334 _widget->fullscreenToggle(_widget->index() ==
dataModel()->tunings().currentIndex());
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
bool omni::ui::proj::TuningList::eventFilter |
( |
QObject * |
obj, |
|
|
QEvent * |
event |
|
) |
| |
|
protected |
370 if (event->type() == QEvent::KeyPress) {
371 auto *keyEvent =
static_cast<QKeyEvent *
>(event);
374 return QWidget::eventFilter(obj, event);
void keyPressEvent(QKeyEvent *)
Definition: TuningList.cpp:345
bool omni::ui::proj::TuningList::frontendToData |
( |
| ) |
|
|
inlineprivatevirtual |
QColor omni::ui::proj::TuningList::getTuningColor |
( |
| ) |
|
|
private |
Get most differing color for a new tuning.
Find first color in spectrum that is not already used
Compare R,G,B channels for both colors, alpha can be
Return the first color which is not equal to an existing
182 static std::vector<QColor> _colors;
193 int _saturation = float(OMNI_MAX_NUMBER_TUNINGS / 2 - i / 2) /
194 OMNI_MAX_NUMBER_TUNINGS * 2.0 * 255.0;
195 _colors.push_back(QColor::fromHsv(_hue, _saturation,
208 int _numTunings =
dataModel()->tunings().size();
210 if (
dataModel()->tunings().size() > OMNI_MAX_NUMBER_TUNINGS)
return QColor(
"#000000");
215 auto _color = _colors[j];
216 bool _colorsEqual =
false;
218 for (
int i = 0; i < _numTunings; ++i)
220 auto _tuningColor =
dataModel()->tunings()[i]->color();
224 _colorsEqual |= _color.red() == _tuningColor.red() &&
225 _color.green() == _tuningColor.green() &&
226 _color.blue() == _tuningColor.blue();
230 if (!_colorsEqual)
return _color;
233 return _colors[_numTunings - 1];
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
#define OMNI_MAX_NUMBER_TUNINGS
Definition: TuningList.cpp:31
std::set< TuningGLView * > omni::ui::proj::TuningList::getViews |
( |
int |
_index | ) |
const |
Return fullscreen and preview widget from index.
91 std::set<TuningGLView *> _views;
93 if ((_index < 0) || (_index >=
widgets_.size()))
return _views;
95 auto *_widget =
widgets_[_index].get();
96 _views.insert(_widget->fullscreenWidget());
97 _views.insert(_widget->previewWidget());
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::keyPressEvent |
( |
QKeyEvent * |
_event | ) |
|
|
protected |
346 int _tuningIndex =
dataModel()->tunings().currentIndex();
347 auto *_widget =
widget(_tuningIndex);
349 if (!_widget)
return;
351 if (_widget->hasFocus() && !_widget->isSelected())
return;
353 if (_event->key() == Qt::Key_Up) {
354 if (!_widget->focusPrev(
false) && (_tuningIndex > 0)) {
360 if (_event->key() == Qt::Key_Down) {
361 if (!_widget->focusNext(
false) &&
362 (_tuningIndex <
dataModel()->tunings().size() - 1)) {
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
void setTuningIndex(int)
Set current tuning index manually (currentIndexChanged signal is emitted)
Definition: TuningList.cpp:395
Tuning * widget(int _index)
Return tuning widget at index, nullptr if index is not valid.
Definition: TuningList.cpp:62
void omni::ui::proj::TuningList::removeTuning |
( |
int |
_index | ) |
|
|
slot |
Remove tuning.
238 if ((_index < 0) || (_index >=
widgets_.size()))
return;
241 contents_->layout()->removeWidget(_widget.get());
242 _widget->setParent(
nullptr);
248 for (
int i = 0; i <
dataModel()->tunings().size(); ++i)
250 dataModel()->tunings()[i]->makeVisualizer();
void dataModelChanged()
Signal which is emitted when parameters of one tuning have changed.
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
QWidget * contents_
Definition: TuningList.h:142
void setTuningIndex(int)
Set current tuning index manually (currentIndexChanged signal is emitted)
Definition: TuningList.cpp:395
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void tuningRemoved()
Signal is emitted when a tuning was removed.
void omni::ui::proj::TuningList::removeWidgets |
( |
| ) |
|
|
private |
Removes all widgets in the scroll area Unlike clear() it does not remove tunings from session.
287 contents_->layout()->removeWidget(_widget.get());
288 _widget->setParent(
nullptr);
QWidget * contents_
Definition: TuningList.h:142
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::resizeEvent |
( |
QResizeEvent * |
event | ) |
|
|
protected |
340 for (
auto& _widget :
widgets_) _widget->layout()->update();
342 QScrollArea::resizeEvent(event);
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::sessionModeChange |
( |
| ) |
|
|
slot |
Change current mode for all tuning widgets.
264 auto _currentIndex =
dataModel()->tunings().currentIndex();
267 _widget->sessionModeChange();
270 if ((_currentIndex >= 0) && (_currentIndex < widgets_.size())) {
271 widgets_[_currentIndex]->setFocus();
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::setCurrentTuning |
( |
| ) |
|
|
slot |
Set current tuning from currently selected widget.
385 if (_widget->isSelected())
389 _widget->setSelected(
false);
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
void setTuningIndex(int)
Set current tuning index manually (currentIndexChanged signal is emitted)
Definition: TuningList.cpp:395
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::setTuningIndex |
( |
int |
_index | ) |
|
|
slot |
Set current tuning index manually (currentIndexChanged signal is emitted)
397 int _oldIndex =
dataModel()->tunings().currentIndex();
399 dataModel()->tunings().setCurrentIndex(_index);
402 if ((_widget->index() != _index) && _widget->isSelected()) {
403 _widget->setSelected(
false);
void dataModelChanged()
Signal which is emitted when parameters of one tuning have changed.
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
void currentIndexChanged(int)
Signal which is emitted when the current tuning has changed.
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::tuningAdded |
( |
| ) |
|
|
signal |
Signal is emitted when a tuning was added.
void omni::ui::proj::TuningList::tuningChanged |
( |
| ) |
|
|
signal |
Emitted when a single tuning has changed.
void omni::ui::proj::TuningList::tuningRemoved |
( |
| ) |
|
|
signal |
Signal is emitted when a tuning was removed.
void omni::ui::proj::TuningList::updateSceneSize |
( |
bool |
_rescaleValues | ) |
|
|
slot |
Adjust sliders to scene scale.
304 _widget->setRescaleValues(_rescaleValues);
305 _widget->setScale(
dataModel()->scene().size());
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
bool isLocked() const
Return true if widget is locked.
Definition: Locked.h:40
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::updateUnits |
( |
| ) |
|
|
slot |
Set unit of sliders.
313 _widget->setUnit(
dataModel()->scene().unit().abbreviation());
pointer_type dataModel()
Return pointer to data model.
Definition: DataModel.h:118
bool isLocked() const
Return true if widget is locked.
Definition: Locked.h:40
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
void omni::ui::proj::TuningList::updateViews |
( |
| ) |
|
|
slot |
Updates/Repaints GL Views of all tunings widgets.
296 for (
auto& _widget :
widgets_) _widget->updateViews();
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
Tuning * omni::ui::proj::TuningList::widget |
( |
int |
_index | ) |
|
Return tuning widget at index, nullptr if index is not valid.
63 return (_index >= 0) && (_index <
widgets_.size()) ?
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
Tuning const * omni::ui::proj::TuningList::widget |
( |
int |
_index | ) |
const |
Return tuning widget at index, nullptr if index is not valid (const)
68 return (_index >= 0) && (_index <
widgets_.size()) ?
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
74 if (_widget->tuning() == _tuning)
return _widget.get();
std::vector< QUniquePtr< Tuning > > widgets_
Definition: TuningList.h:145
QWidget* omni::ui::proj::TuningList::contents_ |
|
private |
QLayout* omni::ui::proj::TuningList::layout_ |
|
private |
std::vector<QUniquePtr<Tuning> > omni::ui::proj::TuningList::widgets_ |
|
private |
The documentation for this class was generated from the following files: