From 438dc9f606e66c1bc9125a7e429e13aaeeec4564 Mon Sep 17 00:00:00 2001 From: abn Date: Thu, 7 Jul 2016 10:22:55 +0200 Subject: [PATCH] [MEDCalc]: connecting ParaView VCR toolbar. --- src/MEDCalc/gui/MEDModule.cxx | 30 +++++++++++++++++++++++++++++- src/MEDCalc/gui/MEDModule.hxx | 5 +++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/MEDCalc/gui/MEDModule.cxx b/src/MEDCalc/gui/MEDModule.cxx index 448cc7f04..4278c0a9b 100644 --- a/src/MEDCalc/gui/MEDModule.cxx +++ b/src/MEDCalc/gui/MEDModule.cxx @@ -42,15 +42,22 @@ #ifndef DISABLE_PVVIEWER #include "PVViewer_ViewModel.h" +#include "PVViewer_GUIElements.h" #endif #include +#include +#include + + //! The only instance of the reference to engine MED_ORB::MED_Gen_var MEDModule::myEngine; MEDModule::MEDModule() : - SalomeApp_Module("MED"), _studyEditor(0), _datasourceController(0), _workspaceController(0), _presentationController(0), _processingController(0) + SalomeApp_Module("MED"), _studyEditor(0), + _datasourceController(0), _workspaceController(0), _presentationController(0), + _processingController(0), _pvGuiElements(0) { // Note also that we can't use the getApp() function here because // the initialize(...) function has not been called yet. @@ -237,6 +244,27 @@ MEDModule::createModuleWidgets() { connect(_workspaceController, SIGNAL(workspaceSignal(const MEDCALC::MedEvent*)), _presentationController, SLOT(processWorkspaceEvent(const MEDCALC::MedEvent*))); + + // Now that the workspace controller is created, ParaView core application has normally been started, + // and hidden GUI elements have been created. We can fire the VCR toolbar activation: + initToolbars(); +} + +void +MEDModule::initToolbars() +{ + // VCR and Time toolbars: + SUIT_Desktop* dsk = getApp()->desktop(); + _pvGuiElements = PVViewer_GUIElements::GetInstance(dsk); + + _pvGuiElements->getVCRToolbar(); // make sure VCR toolbar is built + _pvGuiElements->setToolBarVisible(false); + _pvGuiElements->setVCRTimeToolBarVisible(true); + + // Emit signal in order to make sure that animation scene is set - same trick as in PARAVIS module activation + QMetaObject::invokeMethod( pqPVApplicationCore::instance()->animationManager(), + "activeSceneChanged", + Q_ARG( pqAnimationScene*, pqPVApplicationCore::instance()->animationManager()->getActiveScene() ) ); } void diff --git a/src/MEDCalc/gui/MEDModule.hxx b/src/MEDCalc/gui/MEDModule.hxx index f05d6616e..d5cfa816f 100644 --- a/src/MEDCalc/gui/MEDModule.hxx +++ b/src/MEDCalc/gui/MEDModule.hxx @@ -40,6 +40,7 @@ #include class SalomeApp_Application; +class PVViewer_GUIElements; /*! * This class defines the gui of the MED module. @@ -87,9 +88,12 @@ public slots: virtual bool deactivateModule(SUIT_Study* theStudy); virtual void onDblClick(const QModelIndex& index); + + private: void createModuleWidgets(); void createModuleActions(); + void initToolbars(); static void init(); private: @@ -100,6 +104,7 @@ private: PresentationController* _presentationController; ProcessingController* _processingController; static MED_ORB::MED_Gen_var myEngine; + PVViewer_GUIElements* _pvGuiElements; }; #endif -- 2.39.2