diff --git a/ApplicationComponents/lqPlayerControlsController.cxx b/ApplicationComponents/lqPlayerControlsController.cxx index 30720f7897d8673bdaf198257cf8ce0b5a9fdff3..ee45b7f141495e7d3a5acbd14245a47b319faf44 100644 --- a/ApplicationComponents/lqPlayerControlsController.cxx +++ b/ApplicationComponents/lqPlayerControlsController.cxx @@ -32,8 +32,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "lqPlayerControlsController.h" #include <QApplication> -#include <QtDebug> #include <QPointer> +#include <QtDebug> #include <lqSensorListWidget.h> @@ -41,50 +41,57 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include <pqLiveSourceBehavior.h> #include <pqSMAdaptor.h> -#include <vtkSMProxy.h> +#include <vtkSMIntVectorProperty.h> #include <vtkSMProperty.h> #include <vtkSMPropertyHelper.h> -#include <vtkSMIntVectorProperty.h> +#include <vtkSMProxy.h> -// vtkAnimationScene doesn't have a enum for PLAYMODE_SNAP_TO_TIMESTEP despite this mode is implemented +// vtkAnimationScene doesn't have a enum for PLAYMODE_SNAP_TO_TIMESTEP despite this mode is +// implemented constexpr int PLAYMODE_SNAP_TO_TIMESTEP = 2; // Scene Property Helpers -namespace { +namespace +{ void SetProperty(QPointer<pqAnimationScene> scene, const char* property, int value) { - vtkSMIntVectorProperty::SafeDownCast(scene->getProxy()->GetProperty(property))->SetElements1(value); + vtkSMIntVectorProperty::SafeDownCast(scene->getProxy()->GetProperty(property)) + ->SetElements1(value); scene->getProxy()->UpdateProperty(property); } -//int GetProperty(QPointer<pqAnimationScene> scene, const char* property) -//{ -// return pqSMAdaptor::getElementProperty(scene->getProxy()->GetProperty(property)).toInt(); -//} +// int GetProperty(QPointer<pqAnimationScene> scene, const char* property) +// { +// return pqSMAdaptor::getElementProperty(scene->getProxy()->GetProperty(property)).toInt(); +// } } // Debugging helper void debugScene(pqAnimationScene* scene) { - if (scene){ + if (scene) + { QPair<double, double> range = scene->getClockTimeRange(); - std::cout << "Range: "<< range.first << " to "<< range.second << std::endl; - std::cout << "Time : "<< scene->getAnimationTime() << std::endl; - auto timesteps = scene->getTimeSteps(); // LITERALLY this->getServer()->getTimeKeeper()->getTimeSteps(); + std::cout << "Range: " << range.first << " to " << range.second << std::endl; + std::cout << "Time : " << scene->getAnimationTime() << std::endl; + auto timesteps = + scene->getTimeSteps(); // LITERALLY this->getServer()->getTimeKeeper()->getTimeSteps(); double min = *std::min_element(timesteps.begin(), timesteps.end()); double max = *std::max_element(timesteps.begin(), timesteps.end()); - std::cout << "Timesteps : "<< "0-"<< timesteps.size() << ", mM: "<< min << " to " << max << std::endl; - }else{ - std::cout << "Scene is NULL "<< std::endl; + std::cout << "Timesteps : " + << "0-" << timesteps.size() << ", mM: " << min << " to " << max << std::endl; + } + else + { + std::cout << "Scene is NULL " << std::endl; } } - //----------------------------------------------------------------------------- lqPlayerControlsController::lqPlayerControlsController(QObject* _parent) - : pqVCRController(_parent), speed(1.0) + : pqVCRController(_parent) + , speed(1.0) { - } //----------------------------------------------------------------------------- @@ -94,20 +101,22 @@ void lqPlayerControlsController::setAnimationScene(pqAnimationScene* scene) // Regular VCR controller slot Superclass::setAnimationScene(scene); // Connects the following signals - //QObject::connect(this->Scene, SIGNAL(tick(int)) , this, SLOT(onTick())); - //QObject::connect(this->Scene, SIGNAL(loopChanged()) , this, SLOT(onLoopPropertyChanged())); - //QObject::connect(this->Scene, SIGNAL(clockTimeRangesChanged()), this, SLOT(onTimeRangesChanged())); - //QObject::connect(this->Scene, SIGNAL(beginPlay()) , this, SLOT(onBeginPlay())); - //QObject::connect(this->Scene, SIGNAL(endPlay()) , this, SLOT(onEndPlay())); + // QObject::connect(this->Scene, SIGNAL(tick(int)) , this, SLOT(onTick())); + // QObject::connect(this->Scene, SIGNAL(loopChanged()) , this, + // SLOT(onLoopPropertyChanged())); QObject::connect(this->Scene, SIGNAL(clockTimeRangesChanged()), + // this, SLOT(onTimeRangesChanged())); QObject::connect(this->Scene, SIGNAL(beginPlay()) , this, + // SLOT(onBeginPlay())); QObject::connect(this->Scene, SIGNAL(endPlay()) , this, + // SLOT(onEndPlay())); // Connect additional Signals: - if(scene){ - QObject::connect(this->Scene, SIGNAL(timeStepsChanged()) , this, SLOT(onTimeStepsChanged())); - //frameCountChanged // Not necessary, timeStepsChanged() cover this case - //cues - //playModeChanged() - //animationTime (double time) - //timeLabelChanged() + if (scene) + { + QObject::connect(this->Scene, SIGNAL(timeStepsChanged()), this, SLOT(onTimeStepsChanged())); + // frameCountChanged // Not necessary, timeStepsChanged() cover this case + // cues + // playModeChanged() + // animationTime (double time) + // timeLabelChanged() } } @@ -126,16 +135,18 @@ void lqPlayerControlsController::onTimeStepsChanged() { if (this->Scene) { - auto timesteps = this->Scene->getTimeSteps(); // LITERALLY this->getServer()->getTimeKeeper()->getTimeSteps(); - int nframes = timesteps.size() ? timesteps.size()-1 : 0; - Q_EMIT this->frameRanges(0, nframes ); + // LITERALLY this->getServer()->getTimeKeeper()->getTimeSteps(); + auto timesteps = this->Scene->getTimeSteps(); + int nframes = timesteps.size() ? timesteps.size() - 1 : 0; + Q_EMIT this->frameRanges(0, nframes); } } //----------------------------------------------------------------------------- void lqPlayerControlsController::onPause() { - if(!lqSensorListWidget::instance()->isInLiveSensorMode()){ + if (!lqSensorListWidget::instance()->isInLiveSensorMode()) + { // Prevent Noisy warnings if (!this->Scene) { @@ -143,13 +154,18 @@ void lqPlayerControlsController::onPause() } // Regular VCR controller Play Superclass::onPause(); - }else{ + } + else + { // Do not Notify Animation scene in LivestreamMode // Call pqLiveSourceBehavior bool paused = pqLiveSourceBehavior::isPaused(); - if(paused){ + if (paused) + { pqLiveSourceBehavior::resume(); - }else{ + } + else + { pqLiveSourceBehavior::pause(); } // Manually notify toolbar @@ -160,7 +176,8 @@ void lqPlayerControlsController::onPause() //----------------------------------------------------------------------------- void lqPlayerControlsController::onPlay() { - if(!lqSensorListWidget::instance()->isInLiveSensorMode()){ + if (!lqSensorListWidget::instance()->isInLiveSensorMode()) + { // Prevent Noisy warnings if (!this->Scene) { @@ -172,13 +189,18 @@ void lqPlayerControlsController::onPlay() // Regular VCR controller Play Superclass::onPlay(); - }else{ + } + else + { // Do not Notify Animation scene in LivestreamMode // Call pqLiveSourceBehavior bool paused = pqLiveSourceBehavior::isPaused(); - if(paused){ + if (paused) + { pqLiveSourceBehavior::resume(); - }else{ + } + else + { pqLiveSourceBehavior::pause(); } // Manually notify toolbar @@ -188,7 +210,7 @@ void lqPlayerControlsController::onPlay() //----------------------------------------------------------------------------- void lqPlayerControlsController::onSpeedChange(double speed) { - if(!this->Scene) + if (!this->Scene) return; // Update speed value this->speed = speed; @@ -196,7 +218,8 @@ void lqPlayerControlsController::onSpeedChange(double speed) // It's a bit useless to set the PlayMode here, as it is overriden each time // a new source with timestamps is added. // The override is performed in vtkSMAnimationSceneProxy::UpdateAnimationUsingDataTimeSteps - // where the PlayMode is set to SNAP_TO_TIMESTEPS. This function is called by pqApplyBehavior::applied + // where the PlayMode is set to SNAP_TO_TIMESTEPS. This function is called by + // pqApplyBehavior::applied this->setPlayMode(this->speed); // Pause for user safety @@ -209,28 +232,28 @@ void lqPlayerControlsController::onSpeedChange(double speed) //----------------------------------------------------------------------------- void lqPlayerControlsController::onSeekFrame(int index) { - if(!this->Scene) + if (!this->Scene) return; const auto& timesteps = this->Scene->getTimeSteps(); - if(index >=timesteps.size()) + if (index >= timesteps.size()) return; // Set Scene Time - this->setSceneTime(timesteps[index]) ; + this->setSceneTime(timesteps[index]); } //----------------------------------------------------------------------------- void lqPlayerControlsController::onSeekTime(double time) { - if(!this->Scene) + if (!this->Scene) return; if (time < 0) return; // Set Scene Time - this->setSceneTime(time) ; + this->setSceneTime(time); } //----------------------------------------------------------------------------- @@ -258,8 +281,9 @@ void lqPlayerControlsController::onPreviousFrame() } //----------------------------------------------------------------------------- -void lqPlayerControlsController::setPlayMode(double speed){ - if(!this->Scene) +void lqPlayerControlsController::setPlayMode(double speed) +{ + if (!this->Scene) return; if (speed <= 0) diff --git a/ApplicationComponents/lqPlayerControlsController.h b/ApplicationComponents/lqPlayerControlsController.h index 2c293038de0dc255ff27dee2688bc8c84ff99569..713f688f73f5a823670ee06dc15f5b90de1bcd8b 100644 --- a/ApplicationComponents/lqPlayerControlsController.h +++ b/ApplicationComponents/lqPlayerControlsController.h @@ -32,7 +32,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #ifndef LQPLAYERCONTROLSCONTROLLER_H #define LQPLAYERCONTROLSCONTROLLER_H - #include "pqComponentsModule.h" #include <QObject> @@ -65,15 +64,16 @@ public slots: virtual void onTimeRangesChanged() Q_DECL_OVERRIDE; void onTimeStepsChanged(); // Received alongside 'onTimeRangesChanged' virtual void onPause() Q_DECL_OVERRIDE; - virtual void onPlay() Q_DECL_OVERRIDE; + virtual void onPlay() Q_DECL_OVERRIDE; void onSpeedChange(double speed); void onSeekFrame(int index); - void onSeekTime (double time); + void onSeekTime(double time); - void onPreviousFrame(); // cannot override as the method is not virtual, but not needed in our case - void onNextFrame(); // cannot override as the method is not virtual, but not needed in our case + // cannot override as theses methods are not virtual, but not needed in our case + void onPreviousFrame(); + void onNextFrame(); Q_SIGNALS: void speedChange(double); // Signal speed has changed @@ -89,7 +89,6 @@ protected: private: Q_DISABLE_COPY(lqPlayerControlsController) - }; #endif // LQPLAYERCONTROLSCONTROLLER_H diff --git a/ApplicationComponents/lqPlayerControlsToolbar.cxx b/ApplicationComponents/lqPlayerControlsToolbar.cxx index afb40f36771cab229de554732ab2069429167a54..dba764d534e96b5790f2820304476d398aa61583 100644 --- a/ApplicationComponents/lqPlayerControlsToolbar.cxx +++ b/ApplicationComponents/lqPlayerControlsToolbar.cxx @@ -33,16 +33,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "ui_lqPlayerControlsToolbar.h" -#include <limits> #include <cmath> +#include <limits> -#include <QLabel> #include <QComboBox> -#include <QSlider> -#include <QSpinBox> #include <QDoubleSpinBox> +#include <QLabel> #include <QList> #include <QPair> +#include <QSlider> +#include <QSpinBox> #include <QString> #include <QToolTip> @@ -50,26 +50,25 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "pqAnimationManager.h" #include "pqLiveSourceBehavior.h" #include "pqPVApplicationCore.h" -#include "pqUndoStack.h" #include "pqTimeKeeper.h" +#include "pqUndoStack.h" #include "lqPlayerControlsController.h" -#include "lqStreamRecordReaction.h" #include "lqSensorListWidget.h" +#include "lqStreamRecordReaction.h" #include "vtkSMTimeKeeperProxy.h" class lqPlayerControlsToolbar::pqInternals : public Ui::lqPlayerControlsToolbar { public: - pqInternals(): - speedComboBox(nullptr), - frameSlider(nullptr), - timeSpinBox(nullptr), - frameQSpinBox(nullptr), - frameLabel(nullptr) + pqInternals() + : speedComboBox(nullptr) + , frameSlider(nullptr) + , timeSpinBox(nullptr) + , frameQSpinBox(nullptr) + , frameLabel(nullptr) { - } QComboBox* speedComboBox; @@ -77,12 +76,11 @@ public: QDoubleSpinBox* timeSpinBox; QSpinBox* frameQSpinBox; QLabel* frameLabel; - }; //----------------------------------------------------------------------------- lqPlayerControlsToolbar::lqPlayerControlsToolbar(QWidget* parentObject, - bool advancedOptionsForRecording) + bool advancedOptionsForRecording) : QToolBar(parentObject) { this->UI = new pqInternals(); @@ -92,75 +90,92 @@ lqPlayerControlsToolbar::lqPlayerControlsToolbar(QWidget* parentObject, // ParaView VCR Controller code this->Controller = new lqPlayerControlsController(this); - QObject::connect(ui.actionVCRPlay , SIGNAL(triggered()), this->Controller, SLOT(onPlay())); - QObject::connect(ui.actionVCRFirstFrame , SIGNAL(triggered()), this->Controller, SLOT(onFirstFrame())); - QObject::connect(ui.actionVCRPreviousFrame, SIGNAL(triggered()), this->Controller, SLOT(onPreviousFrame())); - QObject::connect(ui.actionVCRNextFrame , SIGNAL(triggered()), this->Controller, SLOT(onNextFrame())); - QObject::connect(ui.actionVCRLastFrame , SIGNAL(triggered()), this->Controller, SLOT(onLastFrame())); - QObject::connect(ui.actionVCRLoop , SIGNAL(toggled(bool)), this->Controller, SLOT(onLoop(bool))); - - QObject::connect(this->Controller, SIGNAL(enabled(bool)), ui.actionVCRPlay , SLOT(setEnabled(bool))); - QObject::connect(this->Controller, SIGNAL(enabled(bool)), ui.actionVCRFirstFrame, SLOT(setEnabled(bool))); - QObject::connect(this->Controller, SIGNAL(enabled(bool)), ui.actionVCRPreviousFrame, SLOT(setEnabled(bool))); - QObject::connect(this->Controller, SIGNAL(enabled(bool)), ui.actionVCRNextFrame, SLOT(setEnabled(bool))); - QObject::connect(this->Controller, SIGNAL(enabled(bool)), ui.actionVCRLastFrame, SLOT(setEnabled(bool))); - QObject::connect(this->Controller, SIGNAL(enabled(bool)), ui.actionVCRLoop , SLOT(setEnabled(bool))); - - QObject::connect(this->Controller, SIGNAL(timeRanges(double, double)), this, SLOT(setTimeRanges(double, double))); - QObject::connect(this->Controller, SIGNAL(frameRanges(int, int)) , this, SLOT(setFrameRanges(int, int))); + QObject::connect(ui.actionVCRPlay, SIGNAL(triggered()), this->Controller, SLOT(onPlay())); + QObject::connect( + ui.actionVCRFirstFrame, SIGNAL(triggered()), this->Controller, SLOT(onFirstFrame())); + QObject::connect( + ui.actionVCRPreviousFrame, SIGNAL(triggered()), this->Controller, SLOT(onPreviousFrame())); + QObject::connect( + ui.actionVCRNextFrame, SIGNAL(triggered()), this->Controller, SLOT(onNextFrame())); + QObject::connect( + ui.actionVCRLastFrame, SIGNAL(triggered()), this->Controller, SLOT(onLastFrame())); + QObject::connect(ui.actionVCRLoop, SIGNAL(toggled(bool)), this->Controller, SLOT(onLoop(bool))); + + QObject::connect( + this->Controller, SIGNAL(enabled(bool)), ui.actionVCRPlay, SLOT(setEnabled(bool))); + QObject::connect( + this->Controller, SIGNAL(enabled(bool)), ui.actionVCRFirstFrame, SLOT(setEnabled(bool))); + QObject::connect( + this->Controller, SIGNAL(enabled(bool)), ui.actionVCRPreviousFrame, SLOT(setEnabled(bool))); + QObject::connect( + this->Controller, SIGNAL(enabled(bool)), ui.actionVCRNextFrame, SLOT(setEnabled(bool))); + QObject::connect( + this->Controller, SIGNAL(enabled(bool)), ui.actionVCRLastFrame, SLOT(setEnabled(bool))); + QObject::connect( + this->Controller, SIGNAL(enabled(bool)), ui.actionVCRLoop, SLOT(setEnabled(bool))); + + QObject::connect(this->Controller, + SIGNAL(timeRanges(double, double)), + this, + SLOT(setTimeRanges(double, double))); + QObject::connect( + this->Controller, SIGNAL(frameRanges(int, int)), this, SLOT(setFrameRanges(int, int))); QObject::connect(this->Controller, SIGNAL(loop(bool)), ui.actionVCRLoop, SLOT(setChecked(bool))); QObject::connect(this->Controller, SIGNAL(playing(bool)), this, SLOT(onPlaying(bool))); - //CUSTOM - QObject::connect(this->Controller, SIGNAL(speedChange(double)), this, SLOT(onSpeedChanged(double))); + // CUSTOM + QObject::connect( + this->Controller, SIGNAL(speedChange(double)), this, SLOT(onSpeedChanged(double))); QObject::connect(this->Controller, SIGNAL(timestepChanged()), this, SLOT(onTimestepChanged())); // Widget Speed ComboBox this->insertWidget(this->UI->actionRecord, new QLabel("Speed:", this)); this->UI->speedComboBox = new QComboBox(this); - this->UI->speedComboBox->addItem("x 0.1" ,0.1 ); - this->UI->speedComboBox->addItem("x 0.25" ,0.25); - this->UI->speedComboBox->addItem("x 0.5" ,0.5 ); - this->UI->speedComboBox->addItem("x 1" ,1. ); - this->UI->speedComboBox->addItem("x 2" ,2. ); - this->UI->speedComboBox->addItem("x 3" ,3. ); - this->UI->speedComboBox->addItem("x 5" ,5. ); - this->UI->speedComboBox->addItem("x 10" ,10. ); - this->UI->speedComboBox->addItem("x 20" ,20. ); - this->UI->speedComboBox->addItem("x 100" ,100.); - this->UI->speedComboBox->addItem("All Frame" ,0. ); + this->UI->speedComboBox->addItem("x 0.1", 0.1); + this->UI->speedComboBox->addItem("x 0.25", 0.25); + this->UI->speedComboBox->addItem("x 0.5", 0.5); + this->UI->speedComboBox->addItem("x 1", 1.); + this->UI->speedComboBox->addItem("x 2", 2.); + this->UI->speedComboBox->addItem("x 3", 3.); + this->UI->speedComboBox->addItem("x 5", 5.); + this->UI->speedComboBox->addItem("x 10", 10.); + this->UI->speedComboBox->addItem("x 20", 20.); + this->UI->speedComboBox->addItem("x 100", 100.); + this->UI->speedComboBox->addItem("All Frame", 0.); this->insertWidget(this->UI->actionRecord, this->UI->speedComboBox); - QObject::connect(this->UI->speedComboBox, SIGNAL(activated(int)), - this, SLOT(onComboSpeedSelected(int))); - QObject::connect(this, SIGNAL(speedChange(double)), //This is the UI Update - this->Controller, SLOT(onSpeedChange(double))); + QObject::connect( + this->UI->speedComboBox, SIGNAL(activated(int)), this, SLOT(onComboSpeedSelected(int))); + QObject::connect(this, + SIGNAL(speedChange(double)), // This is the UI Update + this->Controller, + SLOT(onSpeedChange(double))); // Widget Seek Slider this->UI->frameSlider = new QSlider(Qt::Horizontal, this); this->insertWidget(this->UI->actionRecord, this->UI->frameSlider); - this->connect(this->UI->frameSlider, SIGNAL(valueChanged(int)), - this->Controller, SLOT(onSeekFrame(int))); - QObject::connect(this->UI->frameSlider, &QSlider::valueChanged, // Show Frame Number, sliderMoved - [&](int value) { - QToolTip::showText(QCursor::pos(), QString("%1").arg(value), nullptr); - }); + this->connect( + this->UI->frameSlider, SIGNAL(valueChanged(int)), this->Controller, SLOT(onSeekFrame(int))); + QObject::connect(this->UI->frameSlider, + &QSlider::valueChanged, // Show Frame Number, sliderMoved + [&](int value) { QToolTip::showText(QCursor::pos(), QString("%1").arg(value), nullptr); }); this->UI->frameSlider->setTracking(true); // Make sure internal Value / Position are sync this->UI->frameSlider->setTickInterval(1); // Tapping the slider increments by one - // Widget Time this->insertWidget(this->UI->actionRecord, new QLabel("Time", this)); this->UI->timeSpinBox = new QDoubleSpinBox(this); this->insertWidget(this->UI->actionRecord, this->UI->timeSpinBox); - this->connect(this->UI->timeSpinBox, SIGNAL(valueChanged(double)), - this->Controller, SLOT(onSeekTime(double))); + this->connect(this->UI->timeSpinBox, + SIGNAL(valueChanged(double)), + this->Controller, + SLOT(onSeekTime(double))); // Widget Frame this->insertWidget(this->UI->actionRecord, new QLabel("Frame", this)); this->UI->frameQSpinBox = new QSpinBox(this); this->insertWidget(this->UI->actionRecord, this->UI->frameQSpinBox); - this->connect(this->UI->frameQSpinBox, SIGNAL(valueChanged(int)), - this->Controller, SLOT(onSeekFrame(int))); + this->connect( + this->UI->frameQSpinBox, SIGNAL(valueChanged(int)), this->Controller, SLOT(onSeekFrame(int))); // Widget Frame Label this->UI->frameLabel = new QLabel(); @@ -170,20 +185,22 @@ lqPlayerControlsToolbar::lqPlayerControlsToolbar(QWidget* parentObject, new lqStreamRecordReaction(this->UI->actionRecord, true, advancedOptionsForRecording); // Toggle Toolbar based on lqSensorListWidget - this->connect(lqSensorListWidget::instance(), SIGNAL(lidarStreamModeChanged(bool)), SLOT(onSetLiveMode(bool))); + this->connect(lqSensorListWidget::instance(), + SIGNAL(lidarStreamModeChanged(bool)), + SLOT(onSetLiveMode(bool))); // Safe Init Widgets Values - this->setTimeRanges(0,0); - this->setFrameRanges(0,0); + this->setTimeRanges(0, 0); + this->setFrameRanges(0, 0); this->onSpeedChanged(1.0); // Init Controller QObject::connect(pqPVApplicationCore::instance()->animationManager(), - SIGNAL(activeSceneChanged(pqAnimationScene*)), this->Controller, + SIGNAL(activeSceneChanged(pqAnimationScene*)), + this->Controller, SLOT(setAnimationScene(pqAnimationScene*))); this->Controller->setAnimationScene( pqPVApplicationCore::instance()->animationManager()->getActiveScene()); - } //----------------------------------------------------------------------------- @@ -199,7 +216,7 @@ void lqPlayerControlsToolbar::setTimeRanges(double start, double end) // start/end literally = QPair<double, double> range = this->Scene->getClockTimeRange(); // Action First / Last Frames this->UI->actionVCRFirstFrame->setToolTip(QString("First Time (%1)").arg(start, 0, 'g')); - this->UI->actionVCRLastFrame-> setToolTip(QString("Last Time (%1)").arg(end, 0, 'g')); + this->UI->actionVCRLastFrame->setToolTip(QString("Last Time (%1)").arg(end, 0, 'g')); // Time Spinbox this->UI->timeSpinBox->setMinimum(start); @@ -214,8 +231,10 @@ void lqPlayerControlsToolbar::setFrameRanges(int min, int max) // Slider this->UI->frameSlider->setMinimum(min); this->UI->frameSlider->setMaximum(max); - this->UI->frameSlider->setSliderPosition(min); //wipwip necessarry ? - this->UI->frameSlider->setToolTip(QString("Frames %1/%2/%3").arg(min).arg(min).arg(max)); //wipwip factorize with sliderPosition() ? + this->UI->frameSlider->setSliderPosition(min); // wipwip necessarry ? + this->UI->frameSlider->setToolTip( + QString("Frames %1/%2/%3").arg(min).arg(min).arg(max)); // wipwip factorize with + // sliderPosition() ? // Frame Spinbox this->UI->frameQSpinBox->setMinimum(min); @@ -224,7 +243,7 @@ void lqPlayerControlsToolbar::setFrameRanges(int min, int max) //----------------------------------------------------------------------------- void lqPlayerControlsToolbar::onPlaying(bool playing) { - //PV code, set custom Play/Pause icons + // PV code, set custom Play/Pause icons if (playing) { disconnect(this->UI->actionVCRPlay, SIGNAL(triggered()), this->Controller, SLOT(onPlay())); @@ -251,7 +270,7 @@ void lqPlayerControlsToolbar::onSpeedChanged(double speed) // Try to select existing configuration int searchIndex = this->UI->speedComboBox->findData(speed); - if(searchIndex != -1) + if (searchIndex != -1) { this->UI->speedComboBox->setCurrentIndex(searchIndex); return; @@ -280,25 +299,27 @@ void lqPlayerControlsToolbar::onToggled(bool enable) this->UI->timeSpinBox->setEnabled(enable); this->UI->frameQSpinBox->setEnabled(enable); this->UI->frameLabel->setEnabled(enable); - } //----------------------------------------------------------------------------- void lqPlayerControlsToolbar::onSetLiveMode(bool liveModeEnabled) { this->onToggled(!liveModeEnabled); - + // WIP MOVE THIS TO CONTROLLER - // Sync button with state, It is paused when opening a new reader, and shall be in play mode when opening a stream - if(liveModeEnabled){ + // Sync button with state, It is paused when opening a new reader, and shall be in play mode when + // opening a stream + if (liveModeEnabled) + { // Make LiveSource are running pqLiveSourceBehavior::resume(); this->onPlaying(true); - }else{ + } + else + { this->onPlaying(false); } - } //----------------------------------------------------------------------------- @@ -307,7 +328,7 @@ void lqPlayerControlsToolbar::onTimestepChanged() // Force All Widgets to update to current Time / Frame Value pqTimeKeeper* tk = pqApplicationCore::instance()->getActiveServer()->getTimeKeeper(); double time = tk->getTime(); - int value = tk->getTimeStepValueIndex(time); + int value = tk->getTimeStepValueIndex(time); // Slider Position, no better method to sync pos / internal value this->UI->frameSlider->blockSignals(true); @@ -326,4 +347,3 @@ void lqPlayerControlsToolbar::onTimestepChanged() // TODO could add more tootips } - diff --git a/ApplicationComponents/lqPlayerControlsToolbar.h b/ApplicationComponents/lqPlayerControlsToolbar.h index 3120af478f6d5674bf1fbcad240cafe9775f25b2..ee30d763b3d4d1a4317daf149e9bd4f48d07a929 100644 --- a/ApplicationComponents/lqPlayerControlsToolbar.h +++ b/ApplicationComponents/lqPlayerControlsToolbar.h @@ -46,7 +46,7 @@ class LQAPPLICATIONCOMPONENTS_EXPORT lqPlayerControlsToolbar : public QToolBar Q_OBJECT public: - lqPlayerControlsToolbar(QWidget* parentObject=0, bool advancedOptionsForRecording=false); + lqPlayerControlsToolbar(QWidget* parentObject = 0, bool advancedOptionsForRecording = false); ~lqPlayerControlsToolbar(); protected Q_SLOTS: @@ -54,10 +54,11 @@ protected Q_SLOTS: void setTimeRanges(double, double); // VCR Controller default, updates time ranges void onPlaying(bool); // VCR Controller default - void setFrameRanges(int, int); // updates frames ranges + void setFrameRanges(int, int); // updates frames ranges void onSpeedChanged(double speed); // Update UI on speed change - void onToggled(bool enable); // Toggle Enable/Disable - void onSetLiveMode(bool liveModeEnabled); // Convenience slot for inverted Toggling on livemode signal + void onToggled(bool enable); // Toggle Enable/Disable + // Convenience slot for inverted Toggling on livemode signal + void onSetLiveMode(bool liveModeEnabled); // UI Input signals void onComboSpeedSelected(int index); // Speed ComboBox changed by user @@ -75,7 +76,6 @@ private: class pqInternals; pqInternals* UI; - }; #endif // LQPLAYERCONTROLSTOOLBAR_H diff --git a/ApplicationComponents/lqPythonQtDecorators.h b/ApplicationComponents/lqPythonQtDecorators.h index 6d08e8aa8f7edec86bd4f32d2ee58d072f113aca..e3d589a9b030e38ec9c09be20123a16de2c77f4e 100644 --- a/ApplicationComponents/lqPythonQtDecorators.h +++ b/ApplicationComponents/lqPythonQtDecorators.h @@ -61,35 +61,44 @@ public slots: // lqLidarCoreManager lqLidarCoreManager* static_lqLidarCoreManager_instance() { - return lqLidarCoreManager::instance(); + return lqLidarCoreManager::instance(); } - void static_lqLidarCoreManager_saveFramesToPCAP( - vtkSMSourceProxy* arg0, int arg1, int arg2, const QString& arg3) + void static_lqLidarCoreManager_saveFramesToPCAP(vtkSMSourceProxy* arg0, + int arg1, + int arg2, + const QString& arg3) { lqLidarCoreManager::saveFramesToPCAP(arg0, arg1, arg2, arg3); } - void static_lqLidarCoreManager_saveFramesToLAS(vtkLidarReader* arg0, vtkPolyData* arg1, - int arg2, int arg3, const QString& arg4, int arg5) + void static_lqLidarCoreManager_saveFramesToLAS(vtkLidarReader* arg0, + vtkPolyData* arg1, + int arg2, + int arg3, + const QString& arg4, + int arg5) { lqLidarCoreManager::saveFramesToLAS(arg0, arg1, arg2, arg3, arg4, arg5); } // WIP we can absolutely forward the paraview.simple.view into a pqRenderView* here, see LAS below - void static_lqLidarCoreManager_resetCameraLidar() { + void static_lqLidarCoreManager_resetCameraLidar() + { lqLidarCoreManager::instance()->onResetCameraLidar(); } - void static_lqLidarCoreManager_resetCenterToLidarCenter() { + void static_lqLidarCoreManager_resetCenterToLidarCenter() + { lqLidarCoreManager::instance()->onResetCenterToLidarCenter(); } - void static_lqLidarCoreManager_resetCameraToForwardView() { + void static_lqLidarCoreManager_resetCameraToForwardView() + { lqLidarCoreManager::instance()->onResetCameraToForwardView(); } // lqSensorListWidget lqSensorListWidget* static_lqSensorListWidget_instance() { - return lqSensorListWidget::instance(); + return lqSensorListWidget::instance(); } pqPipelineSource* static_lqSensorListWidget_getActiveLidarSource() @@ -117,7 +126,6 @@ public slots: { return lqSensorListWidget::instance()->getPosOrSource(); } - }; -#endif //lqPythonQtDecorators_h +#endif // lqPythonQtDecorators_h