From 9a125c36043b04592000f5f18078236fb829a65a Mon Sep 17 00:00:00 2001 From: abn Date: Mon, 15 Sep 2014 09:32:51 +0200 Subject: [PATCH] Further clean-up and minor fix on wrongly connected Qt signals. --- src/PVGUI/PVGUI_Module.cxx | 194 ++--------------------- src/PVGUI/PVGUI_Module.h | 6 +- src/PVGUI/PVGUI_ParaViewSettingsPane.cxx | 8 +- 3 files changed, 16 insertions(+), 192 deletions(-) diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index 259e0713..7ff12a68 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -203,46 +203,6 @@ PARAVIS_ORB::PARAVIS_Gen_var PVGUI_Module::myEngine; SALOME module wrapping ParaView GUI. */ - _PTR(SComponent) - ClientFindOrCreateParavisComponent(_PTR(Study) theStudyDocument) - { - _PTR(SComponent) aSComponent = theStudyDocument->FindComponent("PARAVIS"); - if (!aSComponent) { - _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder(); - aStudyBuilder->NewCommand(); - int aLocked = theStudyDocument->GetProperties()->IsLocked(); - if (aLocked) theStudyDocument->GetProperties()->SetLocked(false); - aSComponent = aStudyBuilder->NewComponent("PARAVIS"); - _PTR(GenericAttribute) anAttr = - aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeName"); - _PTR(AttributeName) aName (anAttr); - - ORB_INIT& init = *SINGLETON_::Instance(); - CORBA::ORB_var anORB = init( qApp->argc(), qApp->argv() ); - - SALOME_NamingService *NamingService = new SALOME_NamingService( anORB ); - CORBA::Object_var objVarN = NamingService->Resolve("/Kernel/ModulCatalog"); - SALOME_ModuleCatalog::ModuleCatalog_var Catalogue = - SALOME_ModuleCatalog::ModuleCatalog::_narrow(objVarN); - SALOME_ModuleCatalog::Acomponent_var Comp = Catalogue->GetComponent( "PARAVIS" ); - if (!Comp->_is_nil()) { - aName->SetValue(Comp->componentusername()); - } - - anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributePixMap"); - _PTR(AttributePixMap) aPixmap (anAttr); - aPixmap->SetPixMap( "pqAppIcon16.png" ); - - // Create Attribute parameters for future using - anAttr = aStudyBuilder->FindOrCreateAttribute(aSComponent, "AttributeParameter"); - - aStudyBuilder->DefineComponentInstance(aSComponent, PVGUI_Module::GetEngine()->GetIOR()); - if (aLocked) theStudyDocument->GetProperties()->SetLocked(true); - aStudyBuilder->CommitCommand(); - } - return aSComponent; - } - /*! Clean up function; used to stop ParaView progress events when exception is caught by global exception handler. @@ -420,13 +380,6 @@ void PVGUI_Module::initialize( CAM_Application* app ) updateMacros(); - // we need to start trace after connection is done - connect(pqApplicationCore::instance()->getObjectBuilder(), SIGNAL(finishedAddingServer(pqServer*)), - this, SLOT(onFinishedAddingServer(pqServer*))); - - connect(pqApplicationCore::instance()->getObjectBuilder(), SIGNAL(dataRepresentationCreated(pqDataRepresentation*)), - this, SLOT(onDataRepresentationCreated(pqDataRepresentation*))); - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); bool isStop = aResourceMgr->booleanValue( "PARAVIS", "stop_trace", false ); if(!isStop) @@ -461,10 +414,6 @@ void PVGUI_Module::initialize( CAM_Application* app ) } } } - - connect(&pqActiveObjects::instance(), - SIGNAL(representationChanged(pqRepresentation*)), - this, SLOT(onRepresentationChanged(pqRepresentation*))); } bool PVGUI_Module::connectToExternalPVServer() @@ -519,35 +468,6 @@ void PVGUI_Module::onEndProgress() QApplication::restoreOverrideCursor(); } -void PVGUI_Module::onFinishedAddingServer(pqServer* /*server*/) -{ - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - bool isStop = aResourceMgr->booleanValue( "PARAVIS", "stop_trace", false ); - if(!isStop) - startTimer( 500 ); -} - -void PVGUI_Module::onDataRepresentationCreated(pqDataRepresentation* data) { -// if(!data) -// return; -// -// if(!data->getLookupTable()) -// return; -// -// SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); -// if(!aResourceMgr) -// return; -// -// bool visible = aResourceMgr->booleanValue( "PARAVIS", "show_color_legend", false ); -// pqLookupTableManager* lut_mgr = pqApplicationCore::instance()->getLookupTableManager(); -// -// if(lut_mgr) { -// lut_mgr->setScalarBarVisibility(data,visible); -// } -// -// connect(data, SIGNAL(dataUpdated()), this, SLOT(onDataRepresentationUpdated())); -} - void PVGUI_Module::onDataRepresentationUpdated() { SalomeApp_Study* activeStudy = dynamic_cast(application()->activeStudy()); if(!activeStudy) return; @@ -555,47 +475,6 @@ void PVGUI_Module::onDataRepresentationUpdated() { activeStudy->Modified(); } -void PVGUI_Module::onVariableChanged(pqVariableType t, const QString) { - - pqDisplayColorWidget* colorWidget = qobject_cast(sender()); - if( !colorWidget ) - return; - - if( t == VARIABLE_TYPE_NONE ) - return; - - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - - if(!aResourceMgr) - return; - - bool visible = aResourceMgr->booleanValue( "PARAVIS", "show_color_legend", false ); - - if(!visible) - return; - - /*//VTN: getRepresentation is protected - pqDataRepresentation* data = colorWidget->getRepresentation(); - - if( !data->getLookupTable() ) - return; - - pqLookupTableManager* lut_mgr = pqApplicationCore::instance()->getLookupTableManager(); - - if(lut_mgr) { - lut_mgr->setScalarBarVisibility(data,visible); - } - */ - pqColorToolbar* colorTooBar = qobject_cast(colorWidget->parent()); - if( !colorTooBar ) - return; - - pqScalarBarVisibilityReaction* scalarBarVisibility = colorTooBar->findChild(); - if(scalarBarVisibility) { - scalarBarVisibility->setScalarBarVisibility(visible); - } -} - /*! \brief Initialisation timer event - fired only once, after the GUI loop is ready. See creation in initialize(). @@ -683,35 +562,11 @@ bool PVGUI_Module::pvInit() MyCoreApp->getOptions()->GetTellVersion()) { return false; } - - /* VTN: Looks like trash. For porting see branded_paraview_initializer.cxx.in - // Not sure why this is needed. Andy added this ages ago with comment saying - // needed for Mac apps. Need to check that it's indeed still required. - QDir dir(QApplication::applicationDirPath()); - dir.cdUp(); - dir.cd("Plugins"); - QApplication::addLibraryPath(dir.absolutePath()); - // Load required application plugins. - QString plugin_string = ""; - QStringList plugin_list = plugin_string.split(';',QString::SkipEmptyParts); - pqBrandPluginsLoader loader; - if (loader.loadPlugins(plugin_list) == false) { - printf("Failed to load required plugins for this application\n"); - return false; - } - - // Load optional plugins. - plugin_string = ""; - plugin_list = plugin_string.split(';',QString::SkipEmptyParts); - loader.loadPlugins(plugin_list, true); //quietly skip not-found plugins. - */ - // End of Initializer code - - MyCoreApp->settings(); - + // Connect VTK log messages to SALOME messages (TODO: review this) vtkOutputWindow::SetInstance(PVGUI_OutputWindowAdapter::New()); - new pqTabbedMultiViewWidget(); // it registers as "MULTIVIEW_WIDGET on creation + // Create render view: + new pqTabbedMultiViewWidget(); // it registers as "MULTIVIEW_WIDGET" on creation for (int i = 0; i < argc; i++) free(argv[i]); @@ -780,13 +635,13 @@ void PVGUI_Module::endWaitCursor() QApplication::restoreOverrideCursor(); } -/*! - \brief Returns the ParaView multi-view manager. -*/ -pqTabbedMultiViewWidget* PVGUI_Module::getMultiViewManager() const -{ - return qobject_cast(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET")); -} +///*! +// \brief Returns the ParaView multi-view manager. +//*/ +//pqTabbedMultiViewWidget* PVGUI_Module::getMultiViewManager() const +//{ +// return qobject_cast(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET")); +//} static void ParavisMessageOutput(QtMsgType type, const char *msg) @@ -856,7 +711,7 @@ bool PVGUI_Module::activateModule( SUIT_Study* study ) if ( myRecentMenuId != -1 ) menuMgr()->show(myRecentMenuId); - ClientFindOrCreateParavisComponent(PARAVIS::GetCStudy(this)); +// ClientFindOrCreateParavisComponent(PARAVIS::GetCStudy(this)); return isDone; } @@ -1193,11 +1048,6 @@ void PVGUI_Module::createPreferences() aStrings< aWidget = getApp()->desktop()->findChildren(); - - for (int i = 0; i < aWidget.size() ; i++ ) { - if( aWidget[i] ) { - connect( aWidget[i], SIGNAL ( variableChanged ( pqVariableType, const QString ) ), - this, SLOT(onVariableChanged( pqVariableType, const QString) ), Qt::UniqueConnection ); - } - } -} - - /*! \fn CAM_Module* createModule(); \brief Export module instance (factory function). @@ -1595,10 +1427,6 @@ extern "C" { bool flag = false; PVGUI_EXPORT CAM_Module* createModule() { -// if(!flag) { -// vtkEDFHelperInit(); -// flag = true; -// } return new PVGUI_Module(); } diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 62d58427..cd16373d 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -149,7 +149,7 @@ public: virtual void initialize( CAM_Application* ); virtual void windows( QMap& ) const; - pqTabbedMultiViewWidget* getMultiViewManager() const; +// pqTabbedMultiViewWidget* getMultiViewManager() const; virtual QString engineIOR() const; @@ -244,11 +244,7 @@ private slots: //void showParaViewHelp(); //void showHelp(const QString& url); - void onFinishedAddingServer(pqServer*); - void onDataRepresentationCreated(pqDataRepresentation*); void onDataRepresentationUpdated(); - void onVariableChanged(pqVariableType, const QString); - void onRepresentationChanged(pqRepresentation*); void onStartProgress(); void onEndProgress(); diff --git a/src/PVGUI/PVGUI_ParaViewSettingsPane.cxx b/src/PVGUI/PVGUI_ParaViewSettingsPane.cxx index ac9e5431..bd7e2611 100644 --- a/src/PVGUI/PVGUI_ParaViewSettingsPane.cxx +++ b/src/PVGUI/PVGUI_ParaViewSettingsPane.cxx @@ -128,8 +128,8 @@ PVGUI_ParaViewSettingsPane::PVGUI_ParaViewSettingsPane(QWidget *widgetParent) widget->setApplyChangesImmediately(false); widget->setView(NULL); - widget->connect(this, SIGNAL(accepted()), SLOT(apply())); - widget->connect(this, SIGNAL(rejected()), SLOT(reset())); +// widget->connect(this, SIGNAL(accepted()), SLOT(apply())); +// widget->connect(this, SIGNAL(rejected()), SLOT(reset())); this->connect(widget, SIGNAL(restartRequired()), SLOT(showRestartRequiredMessage())); vbox->addWidget(widget); @@ -156,8 +156,8 @@ PVGUI_ParaViewSettingsPane::PVGUI_ParaViewSettingsPane(QWidget *widgetParent) // this->connect(ui.buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), // SLOT(onRestoreDefaults())); // this->connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton*)), SLOT(clicked(QAbstractButton*))); - this->connect(this, SIGNAL(accepted()), SLOT(onAccepted())); - this->connect(this, SIGNAL(rejected()), SLOT(onRejected())); +// this->connect(this, SIGNAL(accepted()), SLOT(onAccepted())); +// this->connect(this, SIGNAL(rejected()), SLOT(onRejected())); this->connect(ui.tabBar, SIGNAL(currentChanged(int)), this, SLOT(onTabIndexChanged(int))); this->connect(ui.SearchBox, SIGNAL(advancedSearchActivated(bool)), SLOT(filterPanelWidgets())); -- 2.39.2