omni::BlendMask * Blend::blendMask() { if (!dataModel()) return nullptr; return dataModel()->tunings().current() ? &dataModel()->tunings(). current()->blendMask() : nullptr; }
void Tuning::setNextWindowState() { int _numStates = int(NUM_WINDOW_STATES); if (dataModel()) { switch (dataModel()->mode()) { case Session::Mode::BLEND: case Session::Mode::SCREENSETUP: _numStates = 3; break; case Session::Mode::WARP: case Session::Mode::COLORCORRECTION: case Session::Mode::LIVE: case Session::Mode::EXPORT: _numStates = 2; break; default: _numStates = int(NUM_WINDOW_STATES); } } setWindowState(static_cast<WindowState>((int(windowState_) + 1) % _numStates)); }
void Tuning::startDrag() { if (!dataModel()) return; if (dataModel()->mode() != Session::Mode::SCREENSETUP) return; QDrag *drag = new QDrag(this); QMimeData *mimeData = new QMimeData; // Generate pixmap for projector QPixmap _pixmap(128, 128); { _pixmap.fill(tuning()->color()); QPainter _p(&_pixmap); QRect _rect(0, 0, 128, 128); QFont _font("Helvetica", 32); _p.setFont(_font); _p.drawRect(_rect.adjusted(1, 1, -2, -2)); _p.drawText(_rect, Qt::AlignCenter, QString("%1").arg(index() + 1)); _p.end(); } drag->setPixmap(_pixmap); mimeData->setText(QString("%1").arg(index())); drag->setMimeData(mimeData); drag->exec(); }
void Tuning::sessionModeChange() { if (!dataModel()) return; QSignalBlocker blocker(this); if (windowState_ == NO_DISPLAY) { setGroup("Minimized"); return; } if (windowState_ == DISPLAY_ONLY) { setGroup("PreviewOnly"); return; } auto _mode = dataModel()->mode(); // Show close button only in screen- and projection setup titleBar_->setCloseButtonVisible( _mode == Session::Mode::SCREENSETUP || _mode == Session::Mode::ARRANGE); switch (_mode) { case Session::Mode::SCREENSETUP: setGroup("FOVSliders"); break; case Session::Mode::ARRANGE: if (windowState_ == ADJUSTMENT_SLIDERS) setGroup( tuning()->projector().setup() == Projector::FREE ? "FreeSetup" : "PeripheralSetup"); if (windowState_ == FOV_SLIDERS) setGroup("FOVSliders"); break; case Session::Mode::BLEND: case Session::Mode::WARP: case Session::Mode::COLORCORRECTION: case Session::Mode::EXPORT: setGroup("PreviewOnly"); break; case Session::Mode::LIVE: /// Generate calibration data for visualizer when switching to live // mode tuning()->visualizer()->generateCalibrationData(); setGroup("PreviewOnly"); break; default: break; } }
void Input::clear() { if (!dataModel()) return; dataModel()->inputs().clear(); prepareModel(); showParameterWidget(); emit inputIndexChanged(); }
void Canvas::updateUnits() { auto* _paramWidget = this->parameterWidget(); if (_paramWidget && dataModel()) { /// Update parameter slider unit suffixes _paramWidget->setUnit(dataModel()->scene().unit().abbreviation()); } }
void Canvas::updateSceneSize(bool _rescaleValues) { auto* _paramWidget = this->parameterWidget(); if (_paramWidget && dataModel()) { _paramWidget->setRescaleValues(_rescaleValues); _paramWidget->setScale(dataModel()->scene().size()); } }
void Canvas::showParameterWidget() { if (this->setupParameterWidget(widget(),dataModel()->canvas())) { dataModel()->canvas()->update(); // Update parameters when canvas has changed connect(this->parameterWidget(),SIGNAL(dataModelChanged()), this,SIGNAL(dataModelChanged())); } }
bool CanvasParameters::frontendToData() { if (!dataModel()) { return false; } transform_->updateDataModel(); dataModel()->setViewMode(util::intToEnum<Canvas::ViewMode>(boxViewMode_ -> currentIndex())); return true; }
void Mapping::selectMappingType(QString const& _id) { if (!dataModel() || signalsBlocked()) return; mappingMemory_.store(dataModel()->mapping()); dataModel()->setMapping(_id); mappingMemory_.restore(dataModel()->mapping()); showParameterWidget(); emit dataModelChanged(); }
void Input::selectInputId(QString const& _id) { dataModel()->inputs().setCurrentId(_id); auto* _current = dataModel()->inputs().current(); if (_current) { for (auto& _input : dataModel()->inputs()) { input::Controller::instance()->deactivate(_input.second.get()); } input::Controller::instance()->activate(_current); _current->update(); emit inputChanged(); } }
void compressStaticly(std::istream& in, std::ostream& out) { const char* header = "AC\x01"; out.write(header, 3); std::vector<unsigned> freqs(NUM_SYMBOLS); std::vector<unsigned char> data; // read in and count frequencies int c; while ((c = in.get()) != std::char_traits<char>::eof()) { freqs[c]++; data.push_back(c); } freqs.back() = 1; // last symbol is ending symbol // store freqs to out cos decoder needs to have them for (auto freq : freqs) { out.write(reinterpret_cast<const char*>(&freq), sizeof(freq)); } ArithmeticEncoder encoder(std::make_shared<BitStreamWriter>(&out)); StaticDataModel dataModel(freqs); for (auto c : data) { encoder.encode(c, &dataModel); } encoder.encode(NUM_SYMBOLS - 1, &dataModel); // encode last symbol }
int App::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 13) qt_static_metacall(this, _c, _id, _a); _id -= 13; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bb::cascades::DataModel**>(_v) = dataModel(); break; } _id -= 1; } else if (_c == QMetaObject::WriteProperty) { _id -= 1; } else if (_c == QMetaObject::ResetProperty) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 1; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 1; } #endif // QT_NO_PROPERTIES return _id; }
void Input::changeSelection(QModelIndex _index) { if (!dataModel() || this->isLocked()) return; int _row = _index.row(); if (_row < 1 || _row > dataModel()->inputs().numberOfChildren()) { _row = -1; } if (itemId(_row) == dataModel()->inputs().currentId()) return; selectInputId(itemId(_row)); showParameterWidget(); emit inputIndexChanged(); }
void CSVSettings::ListView::buildAbstractItemViewModel() { mAbstractItemView->setModel (dataModel()); mAbstractItemView->setSelectionModel (selectionModel()); //connection needs to go here for list view update to signal to //the outside }
void FullSphere::dataToFrontend() { auto* _diameter = addOffsetWidget("Diameter", 0.5, 0.01, 1.0); /// Retrieve parameters for FullSphere canvas auto *_fullsphere = static_cast<omni::canvas::FullSphere *>(dataModel()); _diameter->setValue(_fullsphere->diameter()); CanvasParameters::dataToFrontend(); }
void Input::showParameterWidget() { this->setupParameterWidget(widget(),dataModel()->inputs().current()); if (this->parameterWidget()) { connect(this->parameterWidget(),SIGNAL(inputChanged()),this,SIGNAL(inputChanged())); connect(this,SIGNAL(inputChanged()),this->parameterWidget(),SLOT(triggerUpdate())); } }
void HalfDome::dataToFrontend() { auto* _diameter = addOffsetWidget("Diameter",0.5,0.01,1.0); /// Retrieve parameters for HalfDome canvas auto* _halfdome = static_cast<omni::canvas::HalfDome*>(dataModel()); _diameter->setValue(_halfdome->diameter()); CanvasParameters::dataToFrontend(); }
void Input::removeSelection() { if (dataModel()->inputs().empty()) return; int _row = ui_->inputList->currentIndex().row(); if (_row < 1 || _row > dataModel()->inputs().numberOfChildren()) return; auto* _item = model_->item(_row); if (!_item) return; dataModel()->inputs().removeInput(_item->text()); model_->removeRows(_row,1); this->removeParameterWidget(widget()); changeSelection(model_->index(_row,0)); emit inputRemoved(); }
void Mapping::showParameterWidget() { this->setupParameterWidget(widget(), dataModel()->mapping()); if (this->parameterWidget()) { connect(this->parameterWidget(), SIGNAL( parametersUpdated()), this, SIGNAL(dataModelChanged())); } }
void CanvasParameters::dataToFrontend() { if (!transform_) { transform_.reset(addAffineTransformWidget("Transform", &dataModel()->transform())); } if (!boxViewMode_) { boxViewMode_.reset(new QComboBox()); boxViewMode_->addItem("Inside"); boxViewMode_->addItem("Outside"); boxViewMode_->addItem("Both"); layout()->addWidget(boxViewMode_.get()); connect(boxViewMode_.get(), static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this, &CanvasParameters::updateDataModel); } boxViewMode_->setCurrentIndex(util::enumToInt(dataModel()-> viewMode())); }
void ColorCorrection::dataToFrontend() { auto _tuning = dataModel()->tunings().current(); setAllChannels(); if (!_tuning) return; setUsed(_tuning->colorCorrection().isUsed()); }
void Canvas::selectCanvasType(QString _id) { if (!dataModel() || signalsBlocked()) return; tryWithExceptionList<Exception>([&]() { canvasMemory_.store(dataModel()->canvas()); /// Dont do anything if type id has not changed if (dataModel()->canvas()->getTypeId().str() == _id) { return; } dataModel()->setCanvas(_id); canvasMemory_.restore(dataModel()->canvas()); showParameterWidget(); emit canvasTypeChanged(); }); }
void Planar::dataToFrontend() { auto* _length = addOffsetWidget("Length",0.1,0.01,1.0); auto* _width = addOffsetWidget("Width",0.1,0.01,1.0); /// Retrieve parameters for Planar canvas auto* _planar = static_cast<omni::canvas::Planar*>(dataModel()); _width->setValue(_planar->width()); _length->setValue(_planar->height()); return CanvasParameters::dataToFrontend(); }
void USCXMLInvoker::invoke(const InvokeRequest& req) { _invokedInterpreter = Interpreter::fromURI(req.src); DataModel dataModel(_invokedInterpreter->getDataModel()); if (dataModel) { } if (_invokedInterpreter) { _invokedInterpreter->setParentQueue(this); _invokedInterpreter->start(); } }
void ColorCorrection::setChannel(proj::Channel _channel) { if (!dataModel()) return; auto _tuning = dataModel()->tunings().current(); if (!_tuning) return; this->locked([&] { ui_->btnAll->setChecked(_channel == Channel::ALL); ui_->btnRed->setChecked(_channel == Channel::RED); ui_->btnGreen->setChecked(_channel == Channel::GREEN); ui_->btnBlue->setChecked(_channel == Channel::BLUE); auto *_colorCorrection = &_tuning->colorCorrection(); ui_->graph->setChannel(_channel); ui_->graph->setDataModel(_colorCorrection); ui_->params->setChannel(_channel); ui_->params->setDataModel(_colorCorrection->correction(_channel)); }); }
void Input::addInput(QAction* _action) { if (!dataModel()) return; auto _idInput = dataModel()->inputs().addInput(_action->text()); auto& _id = _idInput.first; auto& _input = _idInput.second; if (!_input) return; if (_input->canAdd()) { addItem(_id,_input); selectInputId(_id); showParameterWidget(); emit inputIndexChanged(); } else { dataModel()->inputs().removeInput(_id); } }
void ScreenSetup::assignNewTuningToNextFreeScreen() { auto* _tuning = dataModel()->tunings()[dataModel()->tunings().size()-1]; if (!_tuning) return; /// Iterate through all screens and subscreens for (auto& _screenItem : screenItems_) { auto* _item = _screenItem.second.get(); auto* _screen = _screenItem.first; int _numSubScreens = _item->numSubScreens(); for (int _subScreenIndex = 0; _subScreenIndex < _numSubScreens; ++_subScreenIndex) { auto* _subScreenItem = _item->item(_subScreenIndex); if (_subScreenItem->tuningWidget()) continue; // If sub screen item has no tuning widget assigned its free. // So we can assign the tuning here _tuning->setScreen(_screen,_subScreenIndex); assignTuning(_tuning); this->update(); return; // Nothing more to do } } }
void Canvas::dataToFrontend() { if (!dataModel()->canvas()) { dataModel()->setCanvas("HalfDome"); selectCanvasType("HalfDome"); } // Search combobox for available canvas types int _index = 0; for (int i = 0; i < ui_->boxCanvasSelect->count(); ++i) { QString _id = ui_->boxCanvasSelect->itemData(i).toString(); if (_id == dataModel()->canvas()->getTypeId().str()) { _index = i; } } ui_->boxCanvasSelect->setCurrentIndex(_index); showParameterWidget(); }
void Mapping::dataToFrontend() { if (!dataModel()->mapping()) { dataModel()->setMapping("TexCoords"); } // Search combobox for available mapping types int _index = 0; for (int i = 0; i < ui_->boxMappingSelect->count(); ++i) { QString _id = ui_->boxMappingSelect->itemData(i).toString(); if (_id == dataModel()->mapping()->getTypeId().str()) { _index = i; } } ui_->boxMappingSelect->setCurrentIndex(_index); showParameterWidget(); emit dataModelChanged(); }