Ejemplo n.º 1
0
        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()));
            }
        }
Ejemplo n.º 2
0
 /// Set slider ranges
 void CanvasParameters::setScale(float _scale) {
   ParameterWidget::setScale(_scale);
   if (transform_) {
     transform_->setOffsetRangeScale(_scale);
   }
   emit dataModelChanged();
 }
Ejemplo n.º 3
0
 void CanvasParameters::setRescaleValues(bool _rescale) {
   ParameterWidget::setRescaleValues(_rescale);
   if (transform_) {
     transform_->setRescaleOffsetValues(_rescale);
   }
   emit dataModelChanged();
 }
Ejemplo n.º 4
0
    void Mapping::showParameterWidget() {
      this->setupParameterWidget(widget(), dataModel()->mapping());

      if (this->parameterWidget()) {
        connect(this->parameterWidget(), SIGNAL(
                  parametersUpdated()), this,
                SIGNAL(dataModelChanged()));
      }
    }
Ejemplo n.º 5
0
void DataModelManager::removeItem(qint32 nIndex)
{
    if(nIndex >= 0 && nIndex < m_arrData.count())
    {
        m_arrData.at(nIndex)->deleteLater();
        m_arrData.removeAt(nIndex);
        emit dataModelChanged();
    }
}
Ejemplo n.º 6
0
    void Mapping::selectMappingType(QString const& _id)
    {
      if (!dataModel() || signalsBlocked()) return;

      mappingMemory_.store(dataModel()->mapping());
      dataModel()->setMapping(_id);
      mappingMemory_.restore(dataModel()->mapping());

      showParameterWidget();
      emit dataModelChanged();
    }
Ejemplo n.º 7
0
/**
 * This slot is connected to the dataChanged signal of the FavoritesService and is executed
 * when the data in the service is changed. When the data is changed, we delete
 * all the data in the DataModel and insert the new data.
 *
 * @param favorites The data to be inserted in the datamodel.
 */
void FavoritesViewModel::favoritesDataChanged(const QVariantList &favorites) {
    // clear the data.
    this->dataModel->clear();

    // repopulate the datamodel
    for(int i=0; i<favorites.length(); i++) {
        this->dataModel->insert(favorites[i].toMap());
    }

    emit dataModelChanged(dataModel);
}
Ejemplo n.º 8
0
 void CanvasParameters::setDataModel(canvas::Interface* _canvas) {
   {
     QSignalBlocker blocker(this);
     mixin_data_model_type::setDataModel(_canvas);
     if (_canvas->scene()) {
       setScale(_canvas->scene()->size());
       setUnit(_canvas->scene()->unit().abbreviation());
       updateFrontend();
     }
   }
   emit dataModelChanged();
 }
Ejemplo n.º 9
0
void DataLayer::setDataModel(Day* currentDay)
{
    if (_currentDay != NULL)
    {
         _currentDay->deleteLater();
    }
    _currentDay = currentDay;
    _dataModel  = _currentDay->getAppointments();
    emit dataModelChanged();

    saveDataToFile();
    setPending(false);
}
Ejemplo n.º 10
0
    void ColorCorrection::setUsed(bool _isUsed) {
      auto _tuning = dataModel()->tunings().current();

      if (!_tuning) return;

      this->locked([&] {
        auto& _colorCorrection = _tuning->colorCorrection();
        _colorCorrection.setUsed(_isUsed);

        ui_->chkIsUsed->setChecked(_isUsed);
        ui_->btnAll->setEnabled(_isUsed);
        ui_->btnRed->setEnabled(_isUsed);
        ui_->btnGreen->setEnabled(_isUsed);
        ui_->btnBlue->setEnabled(_isUsed);
        ui_->graph->setEnabled(_isUsed);
        ui_->params->setEnabled(_isUsed);
        emit dataModelChanged();
      });
    }
Ejemplo n.º 11
0
void DataModelManager::appendItem(QVariantMap arrValues)
{
    if(m_bDataClassSet)
    {
        QObject *pObject = m_oDataClassMetaObject.newInstance();
        if(pObject != NULL)
        {
            const QStringList c_arrProperties = DataObjectProperties();
            foreach (const QString strProperty, c_arrProperties)
            {
                if(arrValues.contains(strProperty)) // je-li hodnota nastavena, nastaví se
                {
                    pObject->setProperty(strProperty.toStdString().c_str(), arrValues.find(strProperty).value());
                }
            }
            m_arrData.append(pObject);
            emit dataModelChanged();
        }
    }
}
Ejemplo n.º 12
0
    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();
    }
Ejemplo n.º 13
0
      void Tuning::setup()
      {
        this->setFocusPolicy(Qt::TabFocus);
        this->installEventFilter(this->parent());
        layout_ = new TuningLayout(this);
        setLayout(layout_);

        setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);

        /// Setup title bar
        titleBar_.reset(new TitleBar("Projector", this));
        connect(titleBar_.get(), SIGNAL(
                  closeButtonClicked()),              this,
                SLOT(prepareRemove()));
        connect(titleBar_.get(), SIGNAL(colorChanged(
                                          QColor const &)), this,
                SLOT(updateParameters()));
        connect(titleBar_.get(), SIGNAL(
                  freeSetupSelected()),               this,
                SLOT(
                  resetToFreeSetup()));
        connect(titleBar_.get(), SIGNAL(
                  peripheralSetupSelected()),         this,
                SLOT(resetToPeripheralSetup()));
        layout_->addWidget(titleBar_.get(), TuningLayout::Role::TITLE);

        /// Setup preview window
        glView_.reset(new TuningGLView(this));
        QSizePolicy _sizePolicy(QSizePolicy::Ignored,
                                QSizePolicy::Expanding);
        glView_->setSizePolicy(_sizePolicy);
        glView_->setKeepAspectRatio(true);
        glView_->setBorder(0.0);
        glView_->setViewOnly(true);
        glView_->setUpdateFrequency(10.0); // 10.0 fps
        glView_->installEventFilter(this);

        connect(glView_.get(), SIGNAL(dataModelChanged()), this,
                SIGNAL(dataModelChanged()));

        layout_->addWidget(glView_.get(), TuningLayout::Role::PREVIEW);

        /// FOV view slider
        /// @todo Connect this with threshold slider
        auto *_fov =  addWidget("FOV", 60.0, 10.0, 160.0);
        _fov->setSingleStep(1.0);
        _fov->setPageStep(5.0);
        _fov->setSuffix("°");
        connect(_fov, SIGNAL(valueChanged()), this, SLOT(setFov()));

        auto *_keystone = addWidget("Keystone", 0.0, -1.0, 2.0);
        _keystone->setSingleStep(0.01);
        _keystone->setPageStep(0.1);
        connect(_keystone, SIGNAL(valueChanged()), this,
                SLOT(setKeyStone()));

        /// Throw ratio slider
        /// @todo Connect this with FOV slider
        auto *_throwRatio = addWidget("Throw Ratio", 1.0, 0.2, 5.0);
        _throwRatio->setSingleStep(0.01);
        _throwRatio->setPageStep(0.05);

        //    _throwRatio->setScale(RangedFloat::Scale::RECIPROCAL);
        connect(_throwRatio, SIGNAL(valueChanged()), this,
                SLOT(setThrowRatio()));

        /// Yaw angle slider (all projector setups)
        auto && _yaw = addAngleWidget("Yaw", 0.0, 0.0, 360.0);
        _yaw->setSingleStep(0.1);
        _yaw->setPageStep(1.0);

        /// Tower height slider (PeripheralSetup only)
        auto && _towerHeight = addOffsetWidget("Tower Height",
                                               0.2,
                                               -0.5,
                                               1.0);

        /// Distance slider (PeripheralSetup only)
        auto && _distance = addOffsetWidget("Distance", 0.4, 0.0, 1.0);

        /// Shift offset slider (PeripheralSetup only)
        auto && _shift = addOffsetWidget("Shift", 0.0, -0.2, 0.2);

        /// X offset slider (FreeSetup only)
        auto && _x = addOffsetWidget("X", 0.0, -1.0, 1.0);

        /// Y offset slider (FreeSetup only)
        auto && _y = addOffsetWidget("Y", 0.0, -1.0, 1.0);

        /// Z offset slider (FreeSetup only)
        auto && _z = addOffsetWidget("Z", 0.0, -1.0, 1.0);

        /// Pitch angle slider (both setups)
        auto && _pitch = addAngleWidget("Pitch", 30.0, -180.0, 180.0);
        _pitch->setSingleStep(0.1);
        _pitch->setPageStep(1.0);
        _pitch->setPivot(0.0);

        /// Roll angle slider (both setups)
        auto && _roll = addAngleWidget("Roll", 0.0, -180.0, 180.0);
        _roll->setSingleStep(0.1);
        _roll->setPageStep(1.0);
        _roll->setPivot(0.0);

        /// Delta yaw angle slider (PeripheralSetup only)
        auto && _deltaYaw = addAngleWidget("Delta Yaw", 0.0, -45.0, 45.0);
        _deltaYaw->setSingleStep(0.1);
        _deltaYaw->setPageStep(1.0);
        _deltaYaw->setPivot(0.0);

        widgetgroup_type _titleAndPreview(
        {
          { titleBar_.get(), TuningLayout::Role::TITLE },
          { glView_.get(), TuningLayout::Role::PREVIEW }
        });

        auto addParameters =
          [&](widgetgroup_type const& _group,
              std::vector<QWidget *>const& _widgets) -> widgetgroup_type
          {
            widgetgroup_type _result = _group;

            for (auto& _widget :
                 _widgets) _result.emplace_back(_widget,
                                                TuningLayout::Role::PARAMETER);


            return _result;
          };

        addGroup("Minimized",
                 { { titleBar_.get(),
                     TuningLayout::Role::TITLE } });

        /// Make slider groups
        addGroup("PreviewOnly", _titleAndPreview);
        addGroup("FOVSliders",
                 addParameters(_titleAndPreview,
                               { _fov, _throwRatio, _keystone }));
        addGroup("FreeSetup",
                 addParameters(_titleAndPreview,
                               { _yaw, _pitch, _roll, _x, _y, _z, _fov,
                                 _throwRatio, _keystone }));
        addGroup("PeripheralSetup",
                 addParameters(_titleAndPreview,
                               { _yaw, _pitch, _distance, _towerHeight,
                                 _shift, _deltaYaw, _roll, _fov,
                                 _throwRatio, _keystone }));

        /// Setup/update mode
        sessionModeChange();

        for (int i = 0; i < layout_->count(); ++i) {
          auto _widget = layout_->itemAt(i)->widget();

          if (!_widget) continue;
          _widget->installEventFilter(this);
          _widget->installEventFilter(this->parent());
        }
      }
Ejemplo n.º 14
0
 /// Set scale of ranges for offsets
 void AffineTransform::setOffsetRangeScale(float _scale) {
   mixin_scale_type::setScale(_scale);
   if (mixin_scale_type::rescaleValues()) {
     emit dataModelChanged();
   }
 }