void EFXEditor::setEFX(EFX* efx) { assert(efx); if (m_efx) { /* If another EFX function has been edited with this dialog, * set its preview point array NULL so it doesn't try to * update its preview anymore */ m_efx->setPreviewPointArray(NULL); } /* Causes the EFX function to update the preview point array */ slotAlgorithmSelected(m_efx->algorithm()); /* Take the new EFX function for editing */ m_efx = efx; /* Set the preview point array for the new EFX */ m_efx->setPreviewPointArray(m_previewArea->pointArray()); /* Select the EFX's algorithm from the algorithm combo */ for (int i = 0; i < m_algorithmCombo->count(); i++) { if (m_algorithmCombo->text(i) == m_efx->algorithm()) { m_algorithmCombo->setCurrentItem(i); break; } } /* Get the algorithm parameters */ m_widthSpin->setValue(m_efx->width()); m_heightSpin->setValue(m_efx->height()); m_xOffsetSpin->setValue(m_efx->xOffset()); m_yOffsetSpin->setValue(m_efx->yOffset()); m_rotationSpin->setValue(m_efx->rotation()); m_xFrequencySpin->setValue(m_efx->xFrequency()); m_yFrequencySpin->setValue(m_efx->yFrequency()); m_xPhaseSpin->setValue(m_efx->xPhase()); m_yPhaseSpin->setValue(m_efx->yPhase()); /* Get advanced parameters */ m_runOrderGroup->setButton(m_efx->runOrder()); m_directionGroup->setButton(m_efx->direction()); m_modulationBusCombo->setCurrentItem(m_efx->modulationBus()); fillChannelCombos(); fillSceneCombos(); }
void EFXEditor::initMovementPage() { new QHBoxLayout(m_previewFrame); m_previewArea = new EFXPreviewArea(m_previewFrame); m_previewFrame->layout()->setMargin(0); m_previewFrame->layout()->addWidget(m_previewArea); /* Get supported algorithms and fill the algorithm combo with them */ m_algorithmCombo->addItems(EFX::algorithmList()); connect(m_loop, SIGNAL(clicked()), this, SLOT(slotLoopClicked())); connect(m_singleShot, SIGNAL(clicked()), this, SLOT(slotSingleShotClicked())); connect(m_pingPong, SIGNAL(clicked()), this, SLOT(slotPingPongClicked())); connect(m_forward, SIGNAL(clicked()), this, SLOT(slotForwardClicked())); connect(m_backward, SIGNAL(clicked()), this, SLOT(slotBackwardClicked())); connect(m_algorithmCombo, SIGNAL(activated(const QString&)), this, SLOT(slotAlgorithmSelected(const QString&))); connect(m_widthSpin, SIGNAL(valueChanged(int)), this, SLOT(slotWidthSpinChanged(int))); connect(m_heightSpin, SIGNAL(valueChanged(int)), this, SLOT(slotHeightSpinChanged(int))); connect(m_xOffsetSpin, SIGNAL(valueChanged(int)), this, SLOT(slotXOffsetSpinChanged(int))); connect(m_yOffsetSpin, SIGNAL(valueChanged(int)), this, SLOT(slotYOffsetSpinChanged(int))); connect(m_rotationSpin, SIGNAL(valueChanged(int)), this, SLOT(slotRotationSpinChanged(int))); connect(m_startOffsetSpin, SIGNAL(valueChanged(int)), this, SLOT(slotStartOffsetSpinChanged(int))); connect(m_xFrequencySpin, SIGNAL(valueChanged(int)), this, SLOT(slotXFrequencySpinChanged(int))); connect(m_yFrequencySpin, SIGNAL(valueChanged(int)), this, SLOT(slotYFrequencySpinChanged(int))); connect(m_xPhaseSpin, SIGNAL(valueChanged(int)), this, SLOT(slotXPhaseSpinChanged(int))); connect(m_yPhaseSpin, SIGNAL(valueChanged(int)), this, SLOT(slotYPhaseSpinChanged(int))); QString algo(EFX::algorithmToString(m_efx->algorithm())); /* Select the EFX's algorithm from the algorithm combo */ for (int i = 0; i < m_algorithmCombo->count(); i++) { if (m_algorithmCombo->itemText(i) == algo) { m_algorithmCombo->setCurrentIndex(i); break; } } /* Causes the EFX function to update the preview point array */ slotAlgorithmSelected(algo); /* Get the algorithm parameters */ m_widthSpin->setValue(m_efx->width()); m_heightSpin->setValue(m_efx->height()); m_xOffsetSpin->setValue(m_efx->xOffset()); m_yOffsetSpin->setValue(m_efx->yOffset()); m_rotationSpin->setValue(m_efx->rotation()); m_startOffsetSpin->setValue(m_efx->startOffset()); m_xFrequencySpin->setValue(m_efx->xFrequency()); m_yFrequencySpin->setValue(m_efx->yFrequency()); m_xPhaseSpin->setValue(m_efx->xPhase()); m_yPhaseSpin->setValue(m_efx->yPhase()); /* Running order */ switch (m_efx->runOrder()) { default: case Function::Loop: m_loop->setChecked(true); break; case Function::SingleShot: m_singleShot->setChecked(true); break; case Function::PingPong: m_pingPong->setChecked(true); break; } /* Direction */ switch (m_efx->direction()) { default: case Function::Forward: m_forward->setChecked(true); break; case Function::Backward: m_backward->setChecked(true); break; } redrawPreview(); }