From: abn Date: Thu, 9 Oct 2014 08:09:26 +0000 (+0200) Subject: Merge branch 'abn/port_pv42' X-Git-Tag: V7_5_0a1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bae87bd664530e90e6106a91a0e24051fc971b7d;hp=ff5c08fcc5489b7f89257453ff19fedd76e66f81;p=modules%2Fparavis.git Merge branch 'abn/port_pv42' Conflicts: src/Plugins/MEDReader/IO/vtkMEDReader.cxx src/Plugins/ParaMEDCorba/vtkParaMEDCorbaSource.cxx --- diff --git a/src/PVGUI/CMakeLists.txt b/src/PVGUI/CMakeLists.txt index fc2bcaba..cc6fcf1d 100644 --- a/src/PVGUI/CMakeLists.txt +++ b/src/PVGUI/CMakeLists.txt @@ -30,6 +30,7 @@ INCLUDE_DIRECTORIES(${OMNIORB_INCLUDE_DIR} ${Boost_INCLUDE_DIRS} ${QT_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} + ${CMAKE_CURRENT_BINARY_DIR} ) # additional preprocessor / compiler flags @@ -58,6 +59,12 @@ SET(_link_LIBRARIES # --- headers --- +SET(_ui_files + resources/pqCustomSettingsWidget.ui + ) + +QT4_WRAP_UI(_ui_FORMS_HEADERS ${_ui_files}) + # header files / to be processed by moc SET(_moc_HEADERS PVGUI_Module.h @@ -79,7 +86,7 @@ SET(_other_HEADERS ) # header files / to install -SET(PVGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS}) +SET(PVGUI_HEADERS ${_moc_HEADERS} ${_other_HEADERS} ${_ui_FORMS_HEADERS}) # --- resources --- @@ -123,8 +130,8 @@ QT4_ADD_RESOURCES(_rcc_SOURCES ${_rcc_RESOURCES}) QT4_WRAP_CPP(_moc_SOURCES ${_moc_HEADERS}) # sources / EDF specific stuff -INCLUDE(vtkWrapClientServer) -VTK_WRAP_ClientServer(vtkEDFCutterCS vtkEDFCutter_SRCS ${GUI_ROOT_DIR}/include/salome/vtkEDFCutter.h) +#INCLUDE(vtkWrapClientServer) +#VTK_WRAP_ClientServer(vtkEDFCutterCS vtkEDFCutter_SRCS ${GUI_ROOT_DIR}/include/salome/vtkEDFCutter.h) # sources / static SET(_other_SOURCES @@ -165,8 +172,9 @@ SET(PVGUI_SOURCES ${_other_SOURCES} ${_moc_SOURCES} ${_rcc_SOURCES} - ${vtkEDFCutter_SRCS} +# ${vtkEDFCutter_SRCS} ${_VTK_wrap_SOURCES} + ${_ui_FORMS_HEADERS} ) # --- rules --- diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index caa1fa87..ecb3715e 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -122,11 +122,12 @@ #include #include #include -#include +//#include #include #include #include #include +#include #include #include @@ -143,22 +144,29 @@ #include #include #include -#include #include #include #include #include #include #include -#include #include -#include #include -#include #include +#include +#include +#include +#include + +#include #include +// Trace related +#include +#include +#include +#include //---------------------------------------------------------------------------- pqPVApplicationCore* PVGUI_Module::MyCoreApp = 0; @@ -234,25 +242,6 @@ PVGUI_Module* ParavisModule = 0; SALOME module wrapping ParaView GUI. */ - -/* - Fix for the issue 21730: [CEA 596] Slice of polyhedron in PARAVIS returns no cell. - Wrap vtkEDFCutter filter. -*/ - -extern "C" void vtkEDFCutterCS_Initialize(vtkClientServerInterpreter*); -static void vtkEDFHelperInit(); - -void vtkEDFHelperInit(vtkClientServerInterpreter* interp){ - vtkEDFCutterCS_Initialize(interp); -} - -void vtkEDFHelperInit() { - vtkClientServerInterpreterInitializer::GetInitializer()-> - RegisterCallback(&vtkEDFHelperInit); -} - - _PTR(SComponent) ClientFindOrCreateParavisComponent(_PTR(Study) theStudyDocument) { @@ -406,10 +395,10 @@ void PVGUI_Module::initialize( CAM_Application* app ) //pqPluginManager* pgm = pqApplicationCore::instance()->getPluginManager(); pqInterfaceTracker* pgm = pqApplicationCore::instance()->interfaceTracker(); - // * adds support for standard paraview views. - pgm->addInterface(new pqStandardViewModules(pgm)); - //pgm->addInterface(new pqStandardSummaryPanelImplementation(pgm)); + // Register standard types of property widgets. pgm->addInterface(new pqStandardPropertyWidgetInterface(pgm)); + // Register standard types of view-frame actions. + pgm->addInterface(new pqStandardViewFrameActionsImplementation(pgm)); // Load plugins distributed with application. pqApplicationCore::instance()->loadDistributedPlugins(); @@ -417,27 +406,30 @@ void PVGUI_Module::initialize( CAM_Application* app ) // Define application behaviors. //new pqQtMessageHandlerBehavior(this); new pqDataTimeStepBehavior(this); - new pqViewFrameActionsBehavior(this); new pqSpreadSheetVisibilityBehavior(this); new pqPipelineContextMenuBehavior(this); - new pqObjectPickingBehavior(this); // NEW in 4.1 + new pqObjectPickingBehavior(this); new pqDefaultViewBehavior(this); - new pqAlwaysConnectedBehavior(this); - new pqPVNewSourceBehavior(this); - new pqDeleteBehavior(this); new pqUndoRedoBehavior(this); + new pqAlwaysConnectedBehavior(this); new pqCrashRecoveryBehavior(this); new pqAutoLoadPluginXMLBehavior(this); new pqPluginDockWidgetsBehavior(aDesktop); - //new pqVerifyRequiredPluginBehavior(this); + new pqVerifyRequiredPluginBehavior(this); new pqPluginActionGroupBehavior(aDesktop); - //new pqFixPathsInStateFilesBehavior(this); + new pqFixPathsInStateFilesBehavior(this); new pqCommandLineOptionsBehavior(this); new pqPersistentMainWindowStateBehavior(aDesktop); - new pqObjectPickingBehavior(aDesktop); new pqCollaborationBehavior(this); - //new pqMultiServerBehavior(this); new pqViewStreamingBehavior(this); + new pqPluginSettingsBehavior(this); + + pqApplyBehavior* applyBehavior = new pqApplyBehavior(this); + foreach (pqPropertiesPanel* ppanel, aDesktop->findChildren()) + { + applyBehavior->registerPanel(ppanel); + } + // Setup quick-launch shortcuts. QShortcut *ctrlSpace = new QShortcut(Qt::CTRL + Qt::Key_Space, aDesktop); @@ -455,13 +447,16 @@ void PVGUI_Module::initialize( CAM_Application* app ) } // Find Plugin Menus - QList currentMenus = aDesktop->findChildren(); - QList::iterator im; - for (im = currentMenus.begin(); im != currentMenus.end(); ++im) { - if(!activeMenus.contains(*im)) { - myMenus.append(*im); - } - } + // [ABN] TODO: fix this - triggers a SEGFAULT at deactivation() time. +// QList currentMenus = aDesktop->findChildren(); +// QList::iterator im; +// for (im = currentMenus.begin(); im != currentMenus.end(); ++im) { +// if(!activeMenus.contains(*im)) { +// QString s = (*im)->title(); +// std::cout << " MENU "<< s.toStdString() << std::endl; +// myMenus.append(*im); +// } +// } SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); QString aPath = resMgr->stringValue("resources", "PARAVIS", QString()); @@ -546,24 +541,24 @@ void PVGUI_Module::onFinishedAddingServer(pqServer* /*server*/) } 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())); +// 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() { @@ -614,54 +609,26 @@ void PVGUI_Module::onVariableChanged(pqVariableType t, const QString) { } } -void PVGUI_Module::execPythonCommand(const QString& cmd, bool inSalomeConsole) -{ - if ( inSalomeConsole ) { - if ( PyInterp_Dispatcher::Get()->IsBusy() ) return; - SalomeApp_Application* app = - dynamic_cast< SalomeApp_Application* >(SUIT_Session::session()->activeApplication()); - PyConsole_Console* pyConsole = app->pythonConsole(); - if (pyConsole) - pyConsole->exec(cmd); - } - else - { - pqPythonManager* manager = qobject_cast - ( pqApplicationCore::instance()->manager( "PYTHON_MANAGER" ) ); - if ( manager ) - { - pqPythonDialog* pyDiag = manager->pythonShellDialog(); - if ( pyDiag ) - { - pqPythonShell* shell = pyDiag->shell(); - if ( shell ) { - shell->executeScript(cmd); - } - } - } - } -} - /*! \brief Launches a tracing of current server */ void PVGUI_Module::timerEvent(QTimerEvent* te ) { -#ifndef WNT - if ( PyInterp_Dispatcher::Get()->IsBusy() ) - { - // Reschedule for later - MESSAGE("interpreter busy -> rescheduling trace start."); - startTimer(500); - } - else - { +//#ifndef WNT +// if ( PyInterp_Dispatcher::Get()->IsBusy() ) +// { +// // Reschedule for later +// MESSAGE("interpreter busy -> rescheduling trace start."); +// startTimer(500); +// } +// else +// { MESSAGE("about to start trace...."); - execPythonCommand("from paraview import smtrace;smtrace.start_trace()", false); + startTrace(); MESSAGE("trace STARTED...."); - } +// } killTimer( te->timerId() ); -#endif +//#endif } /*! @@ -763,6 +730,8 @@ bool PVGUI_Module::pvInit() */ // End of Initializer code + MyCoreApp->settings(); + vtkOutputWindow::SetInstance(PVGUI_OutputWindowAdapter::New()); new pqTabbedMultiViewWidget(); // it registers as "MULTIVIEW_WIDGET on creation @@ -1058,6 +1027,36 @@ void PVGUI_Module::openFile(const char* theName) pqLoadDataReaction::loadData(aFiles); } +/**! + * Start trace invoking the newly introduced C++ API (PV 4.2) + * (inspired from pqTraceReaction::start()) + */ +void PVGUI_Module::startTrace() +{ + vtkSMSessionProxyManager* pxm = pqActiveObjects::instance().activeServer()->proxyManager(); + + vtkSmartPointer proxy; + proxy.TakeReference(pxm->NewProxy("pythontracing", "PythonTraceOptions")); + if (proxy) + { + vtkNew controller; + controller->InitializeProxy(proxy); + } + vtkSMTrace* trace = vtkSMTrace::StartTrace(); + if (proxy) + { + // Set manually the properties entered via the dialog box poping-up when requiring + // a trace start in PV4.2 (trace options) + trace->SetPropertiesToTraceOnCreate(vtkSMTrace::RECORD_USER_MODIFIED_PROPERTIES); + trace->SetFullyTraceSupplementalProxies(false); + } +} + +void PVGUI_Module::stopTrace() +{ + vtkSMTrace::StopTrace(); +} + void PVGUI_Module::executeScript(const char *script) { #ifndef WNT @@ -1102,24 +1101,13 @@ static const QString MYReplaceStr("paraview.simple"); static const QString MYReplaceImportStr("except: from pvsimple import *"); QString PVGUI_Module::getTraceString() { - QString traceString; -#ifndef WNT - { - PyLockWrapper lck; // Acquire GIL - - const char * code = "from paraview import smtrace;" - "__smtraceString = smtrace.get_trace_string()"; - PyRun_SimpleString(code); - // Now get the value of __smtraceString - PyObject* main_module = PyImport_AddModule((char*)"__main__"); - PyObject* global_dict = PyModule_GetDict(main_module); - PyObject* string_object = PyDict_GetItemString(global_dict, "__smtraceString"); - char* string_ptr = string_object ? PyString_AsString(string_object) : 0; - if (string_ptr) { - traceString = string_ptr; - } - } // release GIL + vtkSMTrace *tracer = vtkSMTrace::GetActiveTracer(); + if (!tracer) // trace is not started + return QString(""); + QString traceString(tracer->GetCurrentTrace()); + + // Replace import "paraview.simple" by "pvsimple" if ((!traceString.isNull()) && traceString.length() != 0) { int aPos = traceString.indexOf(MYReplaceStr); while (aPos != -1) { @@ -1132,7 +1120,7 @@ QString PVGUI_Module::getTraceString() traceString = traceString.replace(aImportPos, MYReplaceImportStr.length(), "except:\n import pvsimple\n from pvsimple import *"); } } -#endif + return traceString; } @@ -1192,7 +1180,7 @@ void PVGUI_Module::onImportFromVisu(QString theEntry) SalomeApp_Study* activeStudy = dynamic_cast(application()->activeStudy()); if(!activeStudy) return; - // get SALOMEDS client study + // get SALOMEDS client study _PTR(Study) aStudy = activeStudy->studyDS(); if(!aStudy) return; @@ -1288,8 +1276,9 @@ void PVGUI_Module::createPreferences() setPreferenceProperty(aSaveType, "indexes", aIndices); //rnv: imp 21712: [CEA 581] Preference to display legend by default - int aDispColoreLegend = addPreference( tr( "PREF_SHOW_COLOR_LEGEND" ), aParaVisSettingsTab, - LightApp_Preferences::Bool, "PARAVIS", "show_color_legend"); + // [ABN]: now fixed in ParaView. +// int aDispColoreLegend = addPreference( tr( "PREF_SHOW_COLOR_LEGEND" ), aParaVisSettingsTab, +// LightApp_Preferences::Bool, "PARAVIS", "show_color_legend"); } /*! @@ -1382,10 +1371,8 @@ void PVGUI_Module::onShowTrace() */ void PVGUI_Module::onRestartTrace() { - QString script = "from paraview import smtrace\n"; - script += "smtrace.stop_trace()\n"; - script += "smtrace.start_trace()\n"; - execPythonCommand(script, false); + stopTrace(); + startTrace(); } /*! @@ -1684,10 +1671,10 @@ extern "C" { bool flag = false; PVGUI_EXPORT CAM_Module* createModule() { - if(!flag) { - vtkEDFHelperInit(); - flag = true; - } +// if(!flag) { +// vtkEDFHelperInit(); +// flag = true; +// } return new PVGUI_Module(); } diff --git a/src/PVGUI/PVGUI_Module.h b/src/PVGUI/PVGUI_Module.h index 0b30e767..9208709a 100644 --- a/src/PVGUI/PVGUI_Module.h +++ b/src/PVGUI/PVGUI_Module.h @@ -154,6 +154,8 @@ public: void clearParaviewState(); QString getTraceString(); + void startTrace(); + void stopTrace(); void saveTrace(const char* theName); pqServer* getActiveServer(); @@ -221,9 +223,6 @@ private: //! restore visibility of the common dockable windows (OB, PyConsole, ... etc.) void restoreCommonWindowsState(); - //! run Python command (either in SALOME's Python interpreter, or in ParaView's Python's interpreter) - void execPythonCommand(const QString& cmd, bool inSalomeConsole=false); - private slots: void showHelpForProxy( const QString&, const QString& ); diff --git a/src/PVGUI/PVGUI_Module_actions.cxx b/src/PVGUI/PVGUI_Module_actions.cxx index 638a3673..1fdefc33 100644 --- a/src/PVGUI/PVGUI_Module_actions.cxx +++ b/src/PVGUI/PVGUI_Module_actions.cxx @@ -41,8 +41,8 @@ #include // #include #include -#include -#include +//#include +//#include #include #include @@ -61,7 +61,7 @@ #include #include #include -#include +//#include #include #include #include @@ -255,11 +255,11 @@ void PVGUI_Module::pvCreateActions() new pqApplicationSettingsReaction(anAction);*/ // View Settings - anAction = new QAction(tr("MEN_VIEW_SETTINGS"), this); - anAction->setToolTip(tr("TOP_VIEW_SETTINGS")); - anAction->setStatusTip(tr("STB_VIEW_SETTINGS")); - registerAction(ViewSettingsId, anAction); - new pqViewSettingsReaction(anAction); +// anAction = new QAction(tr("MEN_VIEW_SETTINGS"), this); +// anAction->setToolTip(tr("TOP_VIEW_SETTINGS")); +// anAction->setStatusTip(tr("STB_VIEW_SETTINGS")); +// registerAction(ViewSettingsId, anAction); +// new pqViewSettingsReaction(anAction); // --- Menu "View" //pqViewManager* viewManager = qobject_cast( @@ -465,7 +465,7 @@ void PVGUI_Module::pvCreateMenus() createMenu( separator(), aPVMnu ); //createMenu( SettingsId, aPVMnu ); - createMenu( ViewSettingsId, aPVMnu ); + //createMenu( ViewSettingsId, aPVMnu ); createMenu( separator(), aPVMnu ); // --- Menu "View" diff --git a/src/PVGUI/PVGUI_Module_widgets.cxx b/src/PVGUI/PVGUI_Module_widgets.cxx index 76624da9..b2650935 100644 --- a/src/PVGUI/PVGUI_Module_widgets.cxx +++ b/src/PVGUI/PVGUI_Module_widgets.cxx @@ -54,30 +54,16 @@ #include #include #include -#include -#include +//#include +#include -#include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include -#include -#include -#include -#include -#include #include #include #include #include +#include class ResizeHelper : public pqPVAnimationWidget { @@ -107,7 +93,8 @@ protected: /*! \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc. - ParaView pqMainWIndowCore class is fully responsible for these dock widgets' contents. + ParaView pqMainWindowCore class is fully responsible for these dock widgets' contents. + ==> To update this function, see the reference set up of ParaView in Application/Paraview/ParaviewMainWindow.ui */ void PVGUI_Module::setupDockWidgets() { @@ -126,42 +113,24 @@ void PVGUI_Module::setupDockWidgets() pipelineBrowserDock->setWidget(browser); myDockWidgets[pipelineBrowserDock] = true; - //Object inspector - QDockWidget* objectInspectorDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk ); - objectInspectorDock->setObjectName("objectInspectorDock"); - objectInspectorDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea ); - desk->addDockWidget( Qt::LeftDockWidgetArea, objectInspectorDock ); - - pqObjectInspectorWidget* objectInspectorWidget = new pqObjectInspectorWidget(objectInspectorDock); - objectInspectorDock->setObjectName("objectInspectorWidget"); - objectInspectorWidget->setShowOnAccept(true); - objectInspectorDock->setWidget(objectInspectorWidget); - connect( objectInspectorWidget, SIGNAL( helpRequested(const QString&, const QString&) ), this, SLOT( showHelpForProxy(const QString&, const QString&) ) ); - myDockWidgets[objectInspectorDock] = true; - - //Display Dock - QDockWidget* displayDock = new QDockWidget( tr( "TTL_DISPLAY" ), desk ); - displayDock->setObjectName("displayDock"); - QWidget* displayWidgetFrame = new QWidget(displayDock); - displayWidgetFrame->setObjectName("displayWidgetFrame"); - displayDock->setWidget(displayWidgetFrame); - - QScrollArea* displayScrollArea = new QScrollArea(displayWidgetFrame); - displayScrollArea->setObjectName("displayScrollArea"); - displayScrollArea->setWidgetResizable(true); - - QVBoxLayout* verticalLayout = new QVBoxLayout(displayWidgetFrame); - verticalLayout->setSpacing(0); - verticalLayout->setContentsMargins(0, 0, 0, 0); - - pqDisplayProxyEditorWidget* displayWidget = new pqDisplayProxyEditorWidget(displayDock); - displayWidget->setObjectName("displayWidget"); - displayScrollArea->setWidget(displayWidget); - verticalLayout->addWidget(displayScrollArea); - - myDockWidgets[displayDock] = true; - - // information dock + // Properties dock (previously called OBJECT_INSPECTOR) + QDockWidget* propertiesDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk ); + propertiesDock->setObjectName("propertiesDock"); + propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea ); + desk->addDockWidget( Qt::LeftDockWidgetArea, propertiesDock ); + + pqPropertiesPanel* propertiesPanel = new pqPropertiesPanel(propertiesDock); + propertiesDock->setObjectName("propertiesPanel"); + propertiesDock->setWidget(propertiesPanel); + connect( propertiesPanel, SIGNAL( helpRequested(const QString&, const QString&) ), this, SLOT( showHelpForProxy(const QString&, const QString&) ) ); + // hook delete to pqDeleteReaction. + QAction* tempDeleteAction = new QAction(this); + pqDeleteReaction* handler = new pqDeleteReaction(tempDeleteAction); + handler->connect(propertiesPanel, SIGNAL(deleteRequested(pqPipelineSource*)), SLOT(deleteSource(pqPipelineSource*))); + + myDockWidgets[propertiesDock] = true; + + // Information dock QDockWidget* informationDock = new QDockWidget(tr( "TTL_INFORMATION" ), desk); informationDock->setObjectName("informationDock"); @@ -187,10 +156,8 @@ void PVGUI_Module::setupDockWidgets() myDockWidgets[informationDock] = true; desk->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North); - desk->tabifyDockWidget(objectInspectorDock, displayDock); - desk->tabifyDockWidget(objectInspectorDock, informationDock); - objectInspectorDock->raise(); - + desk->tabifyDockWidget(informationDock, propertiesDock); + propertiesDock->raise(); // Statistic View QDockWidget* statisticsViewDock = new QDockWidget( tr( "TTL_STATISTICS_VIEW" ), desk ); @@ -296,7 +263,7 @@ void PVGUI_Module::setupDockWidgets() // Set up the dock window corners to give the vertical docks more room. desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); - + // Setup the default dock configuration ... statisticsViewDock->hide(); comparativePanelDock->hide(); diff --git a/src/PVGUI/PVGUI_ParaViewSettingsPane.cxx b/src/PVGUI/PVGUI_ParaViewSettingsPane.cxx index 6b524e3e..ac9e5431 100644 --- a/src/PVGUI/PVGUI_ParaViewSettingsPane.cxx +++ b/src/PVGUI/PVGUI_ParaViewSettingsPane.cxx @@ -23,625 +23,345 @@ // #include "PVGUI_ParaViewSettingsPane.h" -#include "ui_pqOptionsDialog.h" +#include "ui_pqCustomSettingsWidget.h" -#include -#include -#include -#include "pqApplicationCore.h" -#include "pqApplicationOptions.h" -#include "pqGlobalRenderViewOptions.h" -#include "pqPluginManager.h" -#include "pqViewOptionsInterface.h" -#include "pqInterfaceTracker.h" - -#include -#include -#include -#include -#include - - -class OptionsDialogModelItem -{ -public: - OptionsDialogModelItem(); - OptionsDialogModelItem(const QString &name); - ~OptionsDialogModelItem(); - - OptionsDialogModelItem *Parent; - QString Name; - QList Children; -}; - - -class OptionsDialogModel : public QAbstractItemModel -{ -public: - OptionsDialogModel(QObject *parent=0); - virtual ~OptionsDialogModel(); +#include - virtual int rowCount(const QModelIndex &parent=QModelIndex()) const; - virtual int columnCount(const QModelIndex &parent=QModelIndex()) const; - virtual QModelIndex index(int row, int column, - const QModelIndex &parent=QModelIndex()) const; - virtual QModelIndex parent(const QModelIndex &child) const; - - virtual QVariant data(const QModelIndex &index, - int role=Qt::DisplayRole) const; - - QModelIndex getIndex(const QString &path) const; - QString getPath(const QModelIndex &index) const; - void addPath(const QString &path); - bool removeIndex(const QModelIndex &index); - -private: - QModelIndex getIndex(OptionsDialogModelItem *item) const; +#include -private: - OptionsDialogModelItem *Root; -}; +#include "pqActiveObjects.h" +#include "pqApplicationCore.h" +#include "pqProxyWidget.h" +#include "pqSearchBox.h" +#include "pqServer.h" +#include "pqSettings.h" +#include "pqUndoStack.h" +#include "vtkNew.h" +#include "vtkPVXMLElement.h" +#include "vtkSmartPointer.h" +#include "vtkSMProperty.h" +#include "vtkSMPropertyHelper.h" +#include "vtkSMPropertyIterator.h" +#include "vtkSMProxy.h" +#include "vtkSMProxyIterator.h" +#include "vtkSMSessionProxyManager.h" +#include "vtkSMSettings.h" + +#include +#include +#include +#include +#include +#include +#include +#include -class OptionsDialogForm : public Ui::pqOptionsFrame +class PVGUI_ParaViewSettingsPane::pqInternals { public: - OptionsDialogForm(); - ~OptionsDialogForm(); + Ui::CustomSettingsWidget Ui; - QMap Pages; - OptionsDialogModel *Model; - int ApplyUseCount; - //bool ApplyNeeded; + // Map from tab indices to stack widget indices. This is needed because there + // are more widgets in the stacked widgets than just what we add. + QMap TabToStackedWidgets; }; +bool PVGUI_ParaViewSettingsPane::ShowRestartRequired = false; //---------------------------------------------------------------------------- -OptionsDialogModelItem::OptionsDialogModelItem() - : Name(), Children() -{ - this->Parent = 0; -} - -OptionsDialogModelItem::OptionsDialogModelItem(const QString &name) - : Name(name), Children() -{ - this->Parent = 0; -} - -OptionsDialogModelItem::~OptionsDialogModelItem() -{ - QList::Iterator iter = this->Children.begin(); - for( ; iter != this->Children.end(); ++iter) - { - delete *iter; - } -} - - -//---------------------------------------------------------------------------- -OptionsDialogModel::OptionsDialogModel(QObject *parentObject) - : QAbstractItemModel(parentObject) -{ - this->Root = new OptionsDialogModelItem(); -} - -OptionsDialogModel::~OptionsDialogModel() -{ - delete this->Root; -} - -int OptionsDialogModel::rowCount(const QModelIndex &parentIndex) const -{ - OptionsDialogModelItem *item = this->Root; - if(parentIndex.isValid()) - { - item = reinterpret_cast( - parentIndex.internalPointer()); - } - - return item->Children.size(); -} - -int OptionsDialogModel::columnCount(const QModelIndex &) const -{ - return 1; -} - -QModelIndex OptionsDialogModel::index(int row, int column, - const QModelIndex &parentIndex) const -{ - OptionsDialogModelItem *item = this->Root; - if(parentIndex.isValid()) - { - item = reinterpret_cast( - parentIndex.internalPointer()); - } - - if(column == 0 && row >= 0 && row < item->Children.size()) - { - return this->createIndex(row, column, item->Children[row]); - } - - return QModelIndex(); -} - -QModelIndex OptionsDialogModel::parent(const QModelIndex &child) const -{ - if(child.isValid()) - { - OptionsDialogModelItem *item = - reinterpret_cast(child.internalPointer()); - return this->getIndex(item->Parent); - } - - return QModelIndex(); -} - -QVariant OptionsDialogModel::data(const QModelIndex &idx, int role) const -{ - if(idx.isValid()) +PVGUI_ParaViewSettingsPane::PVGUI_ParaViewSettingsPane(QWidget *widgetParent) + : QtxUserDefinedContent(widgetParent), + Internals (new PVGUI_ParaViewSettingsPane::pqInternals()) +{ + Ui::CustomSettingsWidget &ui = this->Internals->Ui; + ui.setupUi(this); + ui.tabBar->setDocumentMode(false); + ui.tabBar->setDrawBase(false); + ui.tabBar->setExpanding(false); + ui.tabBar->setUsesScrollButtons(true); + + // Hide restart message + ui.restartRequiredLabel->setVisible(PVGUI_ParaViewSettingsPane::ShowRestartRequired); + + QList proxies_to_show; + + pqServer* server = pqActiveObjects::instance().activeServer(); + vtkNew iter; + iter->SetSession(server->session()); + iter->SetModeToOneGroup(); + for (iter->Begin("settings"); !iter->IsAtEnd(); iter->Next()) { - OptionsDialogModelItem *item = - reinterpret_cast(idx.internalPointer()); - if(role == Qt::DisplayRole || role == Qt::ToolTipRole) + vtkSMProxy* proxy = iter->GetProxy(); + if (proxy) { - return QVariant(item->Name); + proxies_to_show.push_back(proxy); } } - return QVariant(); -} - -QModelIndex OptionsDialogModel::getIndex(const QString &path) const -{ - OptionsDialogModelItem *item = this->Root; - QStringList names = path.split("."); - QStringList::Iterator iter = names.begin(); - for( ; item && iter != names.end(); ++iter) + // Add color palette. + if (vtkSMProxy* proxy = server->proxyManager()->GetProxy("global_properties", "ColorPalette")) { - OptionsDialogModelItem *child = 0; - QList::Iterator jter = item->Children.begin(); - for( ; jter != item->Children.end(); ++jter) - { - if((*jter)->Name == *iter) - { - child = *jter; - break; - } - } - - item = child; + proxies_to_show.push_back(proxy); } - if(item && item != this->Root) + foreach (vtkSMProxy* proxy, proxies_to_show) { - return this->getIndex(item); + QString proxyName = proxy->GetXMLName(); + + QScrollArea *scrollArea = new QScrollArea(this); + scrollArea->setObjectName(QString("ScrollArea%1").arg(proxyName)); + scrollArea->setWidgetResizable(true); + scrollArea->setAlignment(Qt::AlignLeft|Qt::AlignVCenter); + scrollArea->setFrameShape(QFrame::NoFrame); + + QWidget* container = new QWidget(scrollArea); + container->setObjectName("Container"); + container->setContentsMargins(6, 0, 6, 0); + + QVBoxLayout* vbox = new QVBoxLayout(container); + vbox->setMargin(0); + vbox->setSpacing(0); + + pqProxyWidget* widget = new pqProxyWidget(proxy, container); + widget->setObjectName("ProxyWidget"); + widget->setApplyChangesImmediately(false); + widget->setView(NULL); + + widget->connect(this, SIGNAL(accepted()), SLOT(apply())); + widget->connect(this, SIGNAL(rejected()), SLOT(reset())); + this->connect(widget, SIGNAL(restartRequired()), SLOT(showRestartRequiredMessage())); + vbox->addWidget(widget); + + QSpacerItem* spacer = new QSpacerItem(0, 0,QSizePolicy::Fixed, + QSizePolicy::MinimumExpanding); + vbox->addItem(spacer); + + scrollArea->setWidget(container); + // show panel widgets + widget->updatePanel(); + + int tabIndex = ui.tabBar->addTab(proxy->GetXMLLabel()); + int stackIndex = ui.stackedWidget->addWidget(scrollArea); + this->Internals->TabToStackedWidgets[tabIndex] = stackIndex; + + this->connect(widget, SIGNAL(changeAvailable()), SLOT(onChangeAvailable())); + widget->connect(this, SIGNAL(filterWidgets(bool, QString)), SLOT(filterWidgets(bool, QString))); } - return QModelIndex(); -} + // Disable some buttons to start +// ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(false); +// ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); -QString OptionsDialogModel::getPath(const QModelIndex &idx) const -{ - if(idx.isValid()) - { - QString path; - OptionsDialogModelItem *item = - reinterpret_cast(idx.internalPointer()); - if(item) - { - path = item->Name; - item = item->Parent; - } +// 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(ui.tabBar, SIGNAL(currentChanged(int)), this, SLOT(onTabIndexChanged(int))); - while(item && item != this->Root) - { - path.prepend(".").prepend(item->Name); - item = item->Parent; - } + this->connect(ui.SearchBox, SIGNAL(advancedSearchActivated(bool)), SLOT(filterPanelWidgets())); + this->connect(ui.SearchBox, SIGNAL(textChanged(QString)), SLOT(filterPanelWidgets())); - return path; - } + // After all the tabs are set up, select the first + this->onTabIndexChanged(0); - return QString(); + this->filterPanelWidgets(); } -void OptionsDialogModel::addPath(const QString &path) +//----------------------------------------------------------------------------- +PVGUI_ParaViewSettingsPane::~PVGUI_ParaViewSettingsPane() { - OptionsDialogModelItem *item = this->Root; - QStringList names = path.split("."); - QStringList::Iterator iter = names.begin(); - for( ; iter != names.end(); ++iter) - { - OptionsDialogModelItem *child = 0; - QList::Iterator jter = item->Children.begin(); - for( ; jter != item->Children.end(); ++jter) - { - if((*jter)->Name == *iter) - { - child = *jter; - break; - } - } - - if(!child) - { - child = new OptionsDialogModelItem(*iter); - child->Parent = item; - QModelIndex parentIndex = this->getIndex(item); - int row = item->Children.size(); - this->beginInsertRows(parentIndex, row, row); - item->Children.append(child); - this->endInsertRows(); - } - - item = child; - } + delete this->Internals; + this->Internals = NULL; } -bool OptionsDialogModel::removeIndex(const QModelIndex &idx) +void PVGUI_ParaViewSettingsPane::store(QtxResourceMgr* , QtxPreferenceMgr* ) { - if(idx.isValid()) - { - OptionsDialogModelItem *item = - reinterpret_cast(idx.internalPointer()); - if(item->Children.size() == 0) - { - QModelIndex parentIndex = this->getIndex(item->Parent); - this->beginRemoveRows(parentIndex, idx.row(), idx.row()); - item->Parent->Children.removeAt(idx.row()); - this->endRemoveRows(); - delete item; - return true; - } - } - - return false; + emit this->accepted(); } -QModelIndex OptionsDialogModel::getIndex( - OptionsDialogModelItem *item) const +void PVGUI_ParaViewSettingsPane::retrieve(QtxResourceMgr* , QtxPreferenceMgr* ) { - if(item && item->Parent) - { - return this->createIndex(item->Parent->Children.indexOf(item), 0, item); - } - - return QModelIndex(); +// onRestoreDefaults(); } - -//---------------------------------------------------------------------------- -OptionsDialogForm::OptionsDialogForm() - : Ui::pqOptionsFrame(), Pages() -{ - this->Model = new OptionsDialogModel(); - this->ApplyUseCount = 0; - //this->ApplyNeeded = false; +void PVGUI_ParaViewSettingsPane::showEvent(QShowEvent * ev) +{ +// // Connect SALOME's default button to ParaView's default restore. +// LightApp_PreferencesDlg * prefDg; +// QWidget *w = this->parentWidget(); +// // UGLY!!! +// while (w) +// { +// LightApp_PreferencesDlg * prefDg = dynamic_cast( w ); +// if (prefDg) +// break; +// w = w->parentWidget(); +// } +// if (prefDg) +// prefDg->connect(btn, SIGNAL(clicked()), this, SLOT(onRestoreDefaults())); + ev->accept(); } -OptionsDialogForm::~OptionsDialogForm() +void PVGUI_ParaViewSettingsPane::hideEvent(QHideEvent * ev) { - delete this->Model; + // Connect SALOME's default button to ParaView's default restore. + ev->accept(); } - -//---------------------------------------------------------------------------- -PVGUI_ParaViewSettingsPane::PVGUI_ParaViewSettingsPane(QWidget *widgetParent) - : QtxUserDefinedContent(widgetParent) -{ - this->Form = new OptionsDialogForm(); - this->Form->setupUi(this); - this->Form->PageNames->setModel(this->Form->Model); - - // Hide the tree widget header view. - this->Form->PageNames->header()->hide(); - - // Hide the apply and reset buttons until they are needed. - //this->Form->ApplyButton->setEnabled(false); - //this->Form->ResetButton->setEnabled(false); - //this->Form->ApplyButton->hide(); - //this->Form->ResetButton->hide(); - - this->connect(this->Form->PageNames->selectionModel(), - SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), - this, SLOT(changeCurrentPage())); - //this->connect(this->Form->ApplyButton, SIGNAL(clicked()), - // this, SLOT(applyChanges())); - //this->connect(this->Form->ResetButton, SIGNAL(clicked()), - // this, SLOT(resetChanges())); - //this->connect(this->Form->CloseButton, SIGNAL(clicked()), - // this, SLOT(accept())); - - // Code From pqApplicationOptionsDialog - //this->setApplyNeeded(true); - - pqApplicationOptions* appOptions = new pqApplicationOptions; - this->addOptions(appOptions); - - pqGlobalRenderViewOptions* renOptions = new pqGlobalRenderViewOptions; - this->addOptions(renOptions); - - QStringList pages = appOptions->getPageList(); - if(pages.size()) - { - this->setCurrentPage(pages[0]); - } - - /// Add panes as plugins are loaded. - QObject::connect(pqApplicationCore::instance()->getPluginManager(), - SIGNAL(guiInterfaceLoaded(QObject*)), - this, SLOT(pluginLoaded(QObject*))); - - // Load panes from already loaded plugins. - foreach (QObject* plugin_interface, pqApplicationCore::instance()->interfaceTracker()->interfaces()) - //pqApplicationCore::instance()->getPluginManager()->interfaces()) - { - this->pluginLoaded(plugin_interface); - } +//----------------------------------------------------------------------------- +void PVGUI_ParaViewSettingsPane::clicked(QAbstractButton *button) +{ +// Ui::CustomSettingsWidget &ui = this->Internals->Ui; +// QDialogButtonBox::ButtonRole role = ui.buttonBox->buttonRole(button); +// switch (role) +// { +// case QDialogButtonBox::AcceptRole: +// case QDialogButtonBox::ApplyRole: +// emit this->accepted(); +// break; +// +// case QDialogButtonBox::ResetRole: +// case QDialogButtonBox::RejectRole: +// emit this->rejected(); +// break; +// default: +// break; +// } } -PVGUI_ParaViewSettingsPane::~PVGUI_ParaViewSettingsPane() -{ - delete this->Form; -} -/* -bool PVGUI_ParaViewSettingsPane::isApplyNeeded() const -{ - return this->Form->ApplyNeeded; -} -*/ -/* -void PVGUI_ParaViewSettingsPane::setApplyNeeded(bool applyNeeded) -{ - if(applyNeeded != this->Form->ApplyNeeded) +//----------------------------------------------------------------------------- +void PVGUI_ParaViewSettingsPane::onAccepted() +{ + // If there are any properties that needed to save their values in QSettings, + // do that. Otherwise, save to the vtkSMSettings singleton. + vtkSMSettings * settings = vtkSMSettings::GetInstance(); + pqServer* server = pqActiveObjects::instance().activeServer(); + vtkNew iter; + iter->SetSession(server->session()); + iter->SetModeToOneGroup(); + for (iter->Begin("settings"); !iter->IsAtEnd(); iter->Next()) { - if(!applyNeeded) + vtkSMProxy* proxy = iter->GetProxy(); + settings->SetProxySettings(proxy); + vtkSmartPointer iter2; + iter2.TakeReference(proxy->NewPropertyIterator()); + for (iter2->Begin(); !iter2->IsAtEnd(); iter2->Next()) { - this->Form->ApplyNeeded = false; - //this->Form->ApplyButton->setEnabled(false); - //this->Form->ResetButton->setEnabled(false); - } - else if(this->Form->ApplyUseCount > 0) - { - this->Form->ApplyNeeded = true; - //this->Form->ApplyButton->setEnabled(true); - //this->Form->ResetButton->setEnabled(true); + vtkSMProperty* smproperty = iter2->GetProperty(); + if (smproperty && smproperty->GetHints() && + smproperty->GetHints()->FindNestedElementByName("SaveInQSettings")) + { + QString key = QString("%1.%2").arg(iter->GetKey()).arg(iter2->GetKey()); + this->saveInQSettings(key.toLatin1().data(), smproperty); + } } } -} -*/ -void PVGUI_ParaViewSettingsPane::addOptions(const QString &path, pqOptionsPage *options) -{ - if(!options) - { - return; - } - - // See if the page is a container. - pqOptionsContainer *container = qobject_cast(options); - if(!container && path.isEmpty()) - { - return; - } - // See if the page/container uses the apply button. - if(options->isApplyUsed()) + // Save color palette settings + vtkSMProxy* paletteProxy = server->proxyManager()->GetProxy("global_properties", "ColorPalette"); + if (paletteProxy) { - this->Form->ApplyUseCount++; - /*if(this->Form->ApplyUseCount == 1) - { - //this->Form->ApplyButton->show(); - //this->Form->ResetButton->show(); - //QObject::connect(this, SIGNAL(accepted()), this, SLOT(applyChanges())); - }*/ - - //this->connect(options, SIGNAL(changesAvailable()), - //this, SLOT(enableButtons())); + settings->SetProxySettings(paletteProxy); } - // Add the widget to the stack. - this->Form->Stack->addWidget(options); - - // Add the page(s) to the map and the model. - if(container) - { - // If the path is not empty, use it as the page prefix. - QString prefix; - if(!path.isEmpty()) - { - prefix = path; - prefix.append("."); - } - - container->setPagePrefix(prefix); + // Disable buttons +// Ui::CustomSettingsWidget &ui = this->Internals->Ui; +// ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(false); +// ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); - // Get the list of pages from the container. - QStringList pathList = container->getPageList(); - QStringList::Iterator iter = pathList.begin(); - for( ; iter != pathList.end(); ++iter) - { - this->Form->Pages.insert(prefix + *iter, options); - this->Form->Model->addPath(prefix + *iter); - } - } - else - { - this->Form->Pages.insert(path, options); - this->Form->Model->addPath(path); - } + // In theory, the above changes are undo-redo able, the only things that's not + // undo-able is the "serialized" values. Hence we just clear the undo stack. + CLEAR_UNDO_STACK(); } -void PVGUI_ParaViewSettingsPane::addOptions(pqOptionsContainer *options) +//----------------------------------------------------------------------------- +void PVGUI_ParaViewSettingsPane::onRejected() { - this->addOptions(QString(), options); + // Disable buttons +// Ui::CustomSettingsWidget &ui = this->Internals->Ui; +// ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(false); +// ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false); } -void PVGUI_ParaViewSettingsPane::removeOptions(pqOptionsPage *options) +//----------------------------------------------------------------------------- +void PVGUI_ParaViewSettingsPane::onRestoreDefaults() { - if(!options) - { - return; - } + pqServer* server = pqActiveObjects::instance().activeServer(); + vtkSMSession * session = server->session(); - // Remove the widget from the stack. - this->Form->Stack->removeWidget(options); - - // See if the options use the apply button. - if(options->isApplyUsed()) + vtkNew iter; + iter->SetSession(session); + iter->SetModeToOneGroup(); + for (iter->Begin("settings"); !iter->IsAtEnd(); iter->Next()) { - this->Form->ApplyUseCount--; - /*if(this->Form->ApplyUseCount == 0) + vtkSMProxy* proxy = iter->GetProxy(); + if (proxy) { - //this->Form->ApplyNeeded = false; - //this->Form->ApplyButton->setEnabled(false); - //this->Form->ResetButton->setEnabled(false); - //this->Form->ApplyButton->hide(); - //this->Form->ResetButton->hide(); - //QObject::disconnect(this, SIGNAL(accepted()), this, SLOT(applyChanges())); - }*/ - - this->disconnect(options, 0, this, 0); + proxy->ResetPropertiesToXMLDefaults(); + } } - // Search the map for the paths to remove. - QMap::Iterator iter = this->Form->Pages.begin(); - while(iter != this->Form->Pages.end()) + vtkSMProxy* paletteProxy = server->proxyManager()->GetProxy("global_properties", "ColorPalette"); + if (paletteProxy) { - if(*iter == options) - { - QString path = iter.key(); - iter = this->Form->Pages.erase(iter); - - // Remove the item from the tree model as well. - QModelIndex index = this->Form->Model->getIndex(path); - QPersistentModelIndex parentIndex = index.parent(); - if(this->Form->Model->removeIndex(index)) - { - // Remove any empty parent items. - while(parentIndex.isValid() && - this->Form->Model->rowCount(parentIndex) == 0) - { - index = parentIndex; - parentIndex = index.parent(); - - // Make sure the index path isn't in the map. - path = this->Form->Model->getPath(index); - if(this->Form->Pages.find(path) == this->Form->Pages.end()) - { - if(!this->Form->Model->removeIndex(index)) - { - break; - } - } - } - } - } - else - { - ++iter; - } + paletteProxy->ResetPropertiesToXMLDefaults(); } } -void PVGUI_ParaViewSettingsPane::setCurrentPage(const QString &path) +//----------------------------------------------------------------------------- +void PVGUI_ParaViewSettingsPane::onTabIndexChanged(int index) { - QModelIndex current = this->Form->Model->getIndex(path); - this->Form->PageNames->setCurrentIndex(current); + int stackWidgetIndex = this->Internals->TabToStackedWidgets[index]; + Ui::CustomSettingsWidget &ui = this->Internals->Ui; + ui.stackedWidget->setCurrentIndex(stackWidgetIndex); } -void PVGUI_ParaViewSettingsPane::applyChanges() +//----------------------------------------------------------------------------- +void PVGUI_ParaViewSettingsPane::filterPanelWidgets() { - //if(this->Form->ApplyNeeded) - // { - BEGIN_UNDO_SET("Changed View Settings"); - emit this->aboutToApplyChanges(); - QMap::Iterator iter = this->Form->Pages.begin(); - for( ; iter != this->Form->Pages.end(); ++iter) - { - (*iter)->applyChanges(); - } - - //this->setApplyNeeded(false); - emit this->appliedChanges(); - END_UNDO_SET(); - //} + Ui::CustomSettingsWidget &ui = this->Internals->Ui; + emit this->filterWidgets( + ui.SearchBox->isAdvancedSearchActive(), ui.SearchBox->text()); } -void PVGUI_ParaViewSettingsPane::resetChanges() +//----------------------------------------------------------------------------- +void PVGUI_ParaViewSettingsPane::onChangeAvailable() { - //if(this->Form->ApplyNeeded) - //{ - QMap::Iterator iter = this->Form->Pages.begin(); - for( ; iter != this->Form->Pages.end(); ++iter) - { - (*iter)->resetChanges(); - } +// Ui::CustomSettingsWidget &ui = this->Internals->Ui; +// ui.buttonBox->button(QDialogButtonBox::Reset)->setEnabled(true); +// ui.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(true); +} - //this->setApplyNeeded(false); - //} +//----------------------------------------------------------------------------- +void PVGUI_ParaViewSettingsPane::showRestartRequiredMessage() +{ + Ui::CustomSettingsWidget &ui = this->Internals->Ui; + ui.restartRequiredLabel->setVisible(true); + PVGUI_ParaViewSettingsPane::ShowRestartRequired = true; } -void PVGUI_ParaViewSettingsPane::changeCurrentPage() +//----------------------------------------------------------------------------- +void PVGUI_ParaViewSettingsPane::saveInQSettings( + const char* key, vtkSMProperty* smproperty) { - // Get the current index from the view. - QModelIndex current = this->Form->PageNames->currentIndex(); + pqSettings* settings = pqApplicationCore::instance()->settings(); - // Look up the path for the current index. - QString path = this->Form->Model->getPath(current); - QMap::Iterator iter = this->Form->Pages.find(path); - if(iter == this->Form->Pages.end()) + // FIXME: handle all property types. This will only work for single value + // properties. + if (smproperty->IsA("vtkSMIntVectorProperty") || + smproperty->IsA("vtkSMIdTypeVectorProperty")) { - // If no page is found, show the blank page. - this->Form->Stack->setCurrentWidget(this->Form->BlankPage); + settings->setValue(key, vtkSMPropertyHelper(smproperty).GetAsInt()); } - else + else if (smproperty->IsA("vtkSMDoubleVectorProperty")) { - this->Form->Stack->setCurrentWidget(*iter); - pqOptionsContainer *container = qobject_cast(*iter); - if(container) - { - // Get the path prefix from the container. - QString prefix = container->getPagePrefix(); - if(!prefix.isEmpty()) - { - // Remove the prefix from the path. - path.remove(0, prefix.length()); - } - - // Set the page on the container object. - container->setPage(path); - } + settings->setValue(key, vtkSMPropertyHelper(smproperty).GetAsDouble()); } -} - -//----------------------------------------------------------------------------- -void PVGUI_ParaViewSettingsPane::pluginLoaded(QObject* iface) -{ - pqViewOptionsInterface* viewOptions = - qobject_cast(iface); - if (viewOptions) + else if (smproperty->IsA("vtkSMStringVectorProperty")) { - foreach(QString viewtype, viewOptions->viewTypes()) - { - // Try to create global view options - pqOptionsContainer* globalOptions = - viewOptions->createGlobalViewOptions(viewtype, this); - if (globalOptions) - { - this->addOptions(globalOptions); - } - } + settings->setValue(key, vtkSMPropertyHelper(smproperty).GetAsString()); } } -void PVGUI_ParaViewSettingsPane::store(QtxResourceMgr* , QtxPreferenceMgr* ) -{ - applyChanges(); -} - -void PVGUI_ParaViewSettingsPane::retrieve(QtxResourceMgr* , QtxPreferenceMgr* ) -{ -} - diff --git a/src/PVGUI/PVGUI_ParaViewSettingsPane.h b/src/PVGUI/PVGUI_ParaViewSettingsPane.h index a0fcc0d9..31729139 100644 --- a/src/PVGUI/PVGUI_ParaViewSettingsPane.h +++ b/src/PVGUI/PVGUI_ParaViewSettingsPane.h @@ -28,16 +28,18 @@ #include -#include - -#include "vtkPVConfig.h" - -class pqOptionsContainer; -class OptionsDialogForm; -class pqOptionsPage; -class QString; - - +class QAbstractButton; +class vtkSMProperty; +class QShowEvent; +class QHideEvent; + +/**! + * Almost identical copy/paste of what is found in + * /Qt/Components/pqSettingsDialog.h + * This is (almost) the same, except for the inheritance to QtxUserDefinedContent providing the link + * to SALOME preference mechanism. + * The UI content of pqSettingsDialog is put in a (PARAVIS) widget called pqCustomSettingsWidget. + */ class PVGUI_ParaViewSettingsPane : public QtxUserDefinedContent { Q_OBJECT @@ -46,78 +48,45 @@ public: PVGUI_ParaViewSettingsPane(QWidget *parent=0); virtual ~PVGUI_ParaViewSettingsPane(); - /// \brief - /// Gets whether or not there are changes to apply. - /// \return - /// True if there are changes to apply. - //bool isApplyNeeded() const; - - /// \brief - /// Sets whether or not there are changes to apply. - /// \param applyNeeded True if there are changes to apply. - //void setApplyNeeded(bool applyNeeded); - - /// \brief - /// Adds a page to the options dialog. - /// - /// When the options object is a page container, the path parameter - /// becomes the path prefix for the container pages. - /// - /// \param path The name hierarchy for the options page. - /// \param options The options page. - void addOptions(const QString &path, pqOptionsPage *options); - - /// \brief - /// Adds a container to the options dialog. - /// - /// Each page listed for the container is added to the root of the - /// selection tree. - /// - /// \param options The options container to add. - void addOptions(pqOptionsContainer *options); - - /// \brief - /// Removes the options page from the options dialog. - /// - /// The page name is removed from the selection tree. If the page - /// is an options container, all the names are removed. - /// - /// \param options The options page/container to remove. - void removeOptions(pqOptionsPage *options); - /// Implementation of QtxUserDefinedContent interface virtual void store(QtxResourceMgr* theRes, QtxPreferenceMgr* thePref); virtual void retrieve(QtxResourceMgr* theRes, QtxPreferenceMgr* thePref); + signals: + void accepted(); // emulate the initial QDialogBox signal since some stuff are connected to it. -public slots: - /// \brief - /// Sets the current options page. - /// \param path The name of the options page to show. - void setCurrentPage(const QString &path); +protected: + virtual void showEvent(QShowEvent * ev); + virtual void hideEvent(QHideEvent * ev); - /// Calls each page to apply any changes. - void applyChanges(); + // ---- From now on, this the same interface as in pqSettingsDialog + private slots: + void clicked(QAbstractButton*); + void onAccepted(); + void onRejected(); + void onRestoreDefaults(); - /// Calls each page to reset any changes. - void resetChanges(); + void onTabIndexChanged(int index); + void onChangeAvailable(); + void showRestartRequiredMessage(); -signals: - /// Emitted before the option changes are applied. - void aboutToApplyChanges(); + void filterPanelWidgets(); - /// Emitted after the option changes have been applied. - void appliedChanges(); + signals: + void filterWidgets(bool showAdvanced, const QString& text); -protected slots: - void pluginLoaded(QObject* plugin_interface); + private: + void saveInQSettings(const char* key, vtkSMProperty* smproperty); -private slots: - /// Changes the current page to match the user selection. - void changeCurrentPage(); + private: + Q_DISABLE_COPY(PVGUI_ParaViewSettingsPane); + class pqInternals; + pqInternals* Internals; -private: - OptionsDialogForm *Form; /// Stores the form and class data. + /// Set to true if a setting that requires a restart to take effect + /// is modified. Made static to persist across instantiations of + /// this class. + static bool ShowRestartRequired; }; #endif diff --git a/src/PVGUI/resources/pqCustomSettingsWidget.ui b/src/PVGUI/resources/pqCustomSettingsWidget.ui new file mode 100644 index 00000000..af91e80c --- /dev/null +++ b/src/PVGUI/resources/pqCustomSettingsWidget.ui @@ -0,0 +1,108 @@ + + + CustomSettingsWidget + + + + 0 + 0 + 681 + 599 + + + + + 0 + 0 + + + + Form + + + + + + 2 + + + + + pqSettingsDialog/showAdvancedProperties + + + true + + + + + + + + + + 0 + 0 + + + + + + + + + 0 + 0 + + + + QFrame::NoFrame + + + 0 + + + + + + + + + + 16777215 + 20 + + + + + 75 + true + + + + * Restart required for some settings to take effect + + + true + + + + + + + + QTabBar + QWidget +
QTabBar
+ 1 +
+ + pqSearchBox + QWidget +
pqSearchBox.h
+ 1 +
+
+ + +
diff --git a/src/PVGUI/ui_pqOptionsDialog.h b/src/PVGUI/ui_pqOptionsDialog.h deleted file mode 100644 index 638f7b70..00000000 --- a/src/PVGUI/ui_pqOptionsDialog.h +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************** -** Form generated from reading ui file 'pqOptionsDialog.ui' -** -** Created: Wed Apr 21 12:59:58 2010 -** by: Qt User Interface Compiler version 4.5.3 -** -** WARNING! All changes made in this file will be lost when recompiling ui file! -********************************************************************************/ - -#ifndef UI_PQOPTIONSDIALOG_H -#define UI_PQOPTIONSDIALOG_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -QT_BEGIN_NAMESPACE - -class Ui_pqOptionsFrame -{ -public: - QGridLayout *gridLayout; - QHBoxLayout *hboxLayout; - QSpacerItem *spacerItem; - //QPushButton *ApplyButton; - //QPushButton *ResetButton; - //QPushButton *CloseButton; - QStackedWidget *Stack; - QWidget *BlankPage; - QTreeView *PageNames; - QFrame *Separator; - - void setupUi(QWidget *pqOptionsFrame) - { - if (pqOptionsFrame->objectName().isEmpty()) - pqOptionsFrame->setObjectName(QString::fromUtf8("pqOptionsFrame")); - pqOptionsFrame->resize(514, 382); - gridLayout = new QGridLayout(pqOptionsFrame); -#ifndef Q_OS_MAC - gridLayout->setSpacing(6); -#endif -#ifndef Q_OS_MAC - gridLayout->setMargin(9); -#endif - gridLayout->setObjectName(QString::fromUtf8("gridLayout")); - hboxLayout = new QHBoxLayout(); -#ifndef Q_OS_MAC - hboxLayout->setSpacing(6); -#endif - hboxLayout->setMargin(4); - hboxLayout->setObjectName(QString::fromUtf8("hboxLayout")); - spacerItem = new QSpacerItem(0, 26, QSizePolicy::Expanding, QSizePolicy::Minimum); - - hboxLayout->addItem(spacerItem); - - //ApplyButton = new QPushButton(pqOptionsFrame); - //ApplyButton->setObjectName(QString::fromUtf8("ApplyButton")); - - //hboxLayout->addWidget(ApplyButton); - - //ResetButton = new QPushButton(pqOptionsFrame); - //ResetButton->setObjectName(QString::fromUtf8("ResetButton")); - - //hboxLayout->addWidget(ResetButton); - - //CloseButton = new QPushButton(pqOptionsFrame); - //CloseButton->setObjectName(QString::fromUtf8("CloseButton")); - //CloseButton->setDefault(true); - - //hboxLayout->addWidget(CloseButton); - - - gridLayout->addLayout(hboxLayout, 2, 0, 1, 2); - - Stack = new QStackedWidget(pqOptionsFrame); - Stack->setObjectName(QString::fromUtf8("Stack")); - BlankPage = new QWidget(); - BlankPage->setObjectName(QString::fromUtf8("BlankPage")); - Stack->addWidget(BlankPage); - - gridLayout->addWidget(Stack, 0, 1, 1, 1); - - PageNames = new QTreeView(pqOptionsFrame); - PageNames->setObjectName(QString::fromUtf8("PageNames")); - QSizePolicy sizePolicy(static_cast(0), static_cast(7)); - sizePolicy.setHorizontalStretch(0); - sizePolicy.setVerticalStretch(0); - sizePolicy.setHeightForWidth(PageNames->sizePolicy().hasHeightForWidth()); - PageNames->setSizePolicy(sizePolicy); - PageNames->setMinimumSize(QSize(160, 0)); - PageNames->setMaximumSize(QSize(160, 16777215)); - - gridLayout->addWidget(PageNames, 0, 0, 1, 1); - - Separator = new QFrame(pqOptionsFrame); - Separator->setObjectName(QString::fromUtf8("Separator")); - Separator->setFrameShape(QFrame::HLine); - Separator->setFrameShadow(QFrame::Sunken); - - gridLayout->addWidget(Separator, 1, 0, 1, 2); - - //QWidget::setTabOrder(CloseButton, PageNames); - //QWidget::setTabOrder(PageNames, ApplyButton); - //QWidget::setTabOrder(ApplyButton, ResetButton); - - retranslateUi(pqOptionsFrame); - - Stack->setCurrentIndex(0); - - - QMetaObject::connectSlotsByName(pqOptionsFrame); - } // setupUi - - void retranslateUi(QWidget *pqOptionsFrame) - { - pqOptionsFrame->setWindowTitle(QApplication::translate("pqOptionsFrame", "Options", 0, QApplication::UnicodeUTF8)); - //ApplyButton->setText(QApplication::translate("pqOptionsFrame", "&Apply", 0, QApplication::UnicodeUTF8)); - //ResetButton->setText(QApplication::translate("pqOptionsFrame", "&Reset", 0, QApplication::UnicodeUTF8)); - //CloseButton->setText(QApplication::translate("pqOptionsFrame", "&Ok", 0, QApplication::UnicodeUTF8)); -#ifndef QT_NO_WHATSTHIS - PageNames->setWhatsThis(QApplication::translate("pqOptionsFrame", "Select a category to show the options for that category.", 0, QApplication::UnicodeUTF8)); -#endif // QT_NO_WHATSTHIS - Q_UNUSED(pqOptionsFrame); - } // retranslateUi - -}; - -namespace Ui { - class pqOptionsFrame: public Ui_pqOptionsFrame {}; -} // namespace Ui - -QT_END_NAMESPACE - -#endif // UI_PQOPTIONSDIALOG_H diff --git a/src/Plugins/CMakeLists.txt b/src/Plugins/CMakeLists.txt index cba2bb54..52b6e529 100755 --- a/src/Plugins/CMakeLists.txt +++ b/src/Plugins/CMakeLists.txt @@ -27,11 +27,8 @@ IF(WIN32) ENDIF() SET(_subdirs - #Filter - #ToolBar MEDReader - TableReader - NavigationMode +# TableReader ElevationSurface ScaleVector EllipseBuilder diff --git a/src/Plugins/Filter/CMakeLists.txt b/src/Plugins/Filter/CMakeLists.txt deleted file mode 100755 index af2a8203..00000000 --- a/src/Plugins/Filter/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (C) 2010-2014 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# create a paraview plugin containing server manager xml and the server -# manager classes to build -# this plugin can be loaded on the server side - -ADD_PARAVIEW_PLUGIN(SMSampleFilter "1.0" - SERVER_MANAGER_XML SampleFilter.xml - SERVER_MANAGER_SOURCES vtkMySampleFilter.cxx) - -INSTALL( - TARGETS SMSampleFilter - DESTINATION lib/paraview -) diff --git a/src/Plugins/Filter/SampleFilter.xml b/src/Plugins/Filter/SampleFilter.xml deleted file mode 100755 index 9d7d4ca0..00000000 --- a/src/Plugins/Filter/SampleFilter.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - -Documentation text - - - - - - - - - - - - - - diff --git a/src/Plugins/Filter/vtkMySampleFilter.cxx b/src/Plugins/Filter/vtkMySampleFilter.cxx deleted file mode 100644 index 3acb9f41..00000000 --- a/src/Plugins/Filter/vtkMySampleFilter.cxx +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2010-2014 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "vtkMySampleFilter.h" - -#include - -//vtkCxxRevisionMacro(vtkMySampleFilter, "$Revision$"); -vtkStandardNewMacro(vtkMySampleFilter); - -//---------------------------------------------------------------------------- -vtkMySampleFilter::vtkMySampleFilter() -{ -} - -//---------------------------------------------------------------------------- -vtkMySampleFilter::~vtkMySampleFilter() -{ -} - -//---------------------------------------------------------------------------- -void vtkMySampleFilter::PrintSelf(ostream& os, vtkIndent indent) -{ - this->Superclass::PrintSelf(os,indent); -} - diff --git a/src/Plugins/Filter/vtkMySampleFilter.h b/src/Plugins/Filter/vtkMySampleFilter.h deleted file mode 100644 index a13a6c40..00000000 --- a/src/Plugins/Filter/vtkMySampleFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (C) 2010-2014 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef __vtkMySampleFilter_h -#define __vtkMySampleFilter_h - -#include - -class vtkMySampleFilter : public vtkExtractEdges -{ -public: - static vtkMySampleFilter* New(); - vtkTypeMacro(vtkMySampleFilter, vtkExtractEdges); - void PrintSelf(ostream& os, vtkIndent indent); - -protected: - vtkMySampleFilter(); - ~vtkMySampleFilter(); - -private: - vtkMySampleFilter(const vtkMySampleFilter&); // Not implemented. - void operator=(const vtkMySampleFilter&); // Not implemented. -}; - -#endif diff --git a/src/Plugins/NavigationMode/CMakeLists.txt b/src/Plugins/NavigationMode/CMakeLists.txt deleted file mode 100644 index 7742acc4..00000000 --- a/src/Plugins/NavigationMode/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -# Copyright (C) 2010-2014 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# NavigationMode plugin. -# This is auto-start plugin providing navigation -# mode in 3D viewer in Post-Pro style. - -CMAKE_MINIMUM_REQUIRED(VERSION 2.4) -if(COMMAND cmake_policy) - cmake_policy(SET CMP0003 NEW) -endif(COMMAND cmake_policy) - -project(NavigationMode) - -# Find ParaView -FIND_PACKAGE(ParaView REQUIRED) -if(NOT ParaView_FOUND) - MESSAGE(FATAL_ERROR "Please locate ParaView." ) -ENDIF(NOT ParaView_FOUND) -INCLUDE(${PARAVIEW_USE_FILE}) - -# Standard CMake option for building libraries shared or static by default. -OPTION(BUILD_SHARED_LIBS - "Build with shared libraries." - ${VTK_BUILD_SHARED_LIBS}) - -QT4_WRAP_CPP(MOC_SRCS pqSetModeStarter.h) - -ADD_PARAVIEW_AUTO_START(IFACES IFACE_SRCS CLASS_NAME pqSetModeStarter - STARTUP onStartup) - -ADD_PARAVIEW_PLUGIN(NavigationMode "1.0" - GUI_INTERFACES ${IFACES} - SOURCES pqSetModeStarter.cxx ${MOC_SRCS} ${RCS_SRCS} ${IFACE_SRCS}) - -# Install -INSTALL( - TARGETS NavigationMode - RUNTIME DESTINATION lib/paraview - LIBRARY DESTINATION lib/paraview - ARCHIVE DESTINATION lib/paraview -) \ No newline at end of file diff --git a/src/Plugins/NavigationMode/pqSetModeStarter.cxx b/src/Plugins/NavigationMode/pqSetModeStarter.cxx deleted file mode 100644 index 59553fe8..00000000 --- a/src/Plugins/NavigationMode/pqSetModeStarter.cxx +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (C) 2010-2014 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "pqSetModeStarter.h" - -#include - -#include -#include -#include - - -//----------------------------------------------------------------------------- -pqSetModeStarter::pqSetModeStarter(QObject* p/*=0*/) -: QObject(p) -{ -} - -//----------------------------------------------------------------------------- -pqSetModeStarter::~pqSetModeStarter() -{ -} - - -//----------------------------------------------------------------------------- -void pqSetModeStarter::onStartup() -{ - this->setStandardMode(); -} - -//----------------------------------------------------------------------------- -void pqSetModeStarter::setStandardMode() -{ - pqSettings* settings = pqApplicationCore::instance()->settings(); - settings->beginGroup("renderModule"); - if (!settings->contains("InteractorStyle/CameraManipulators")) { - // Set Post-Pro-like settings - QStringList strs; - pqRenderView::ManipulatorType manips[9]; - const pqRenderView::ManipulatorType* default3DManips = pqRenderView::getDefault3DManipulatorTypes(); - - // Copy default settings, make changes for Ctrl+MB and MB modes - for(int i=0; i<9; i++) - { - manips[i] = default3DManips[i]; - - // Ctrl+MB - if (manips[i].Shift == 0 && manips[i].Control == 1) { - if (manips[i].Mouse == 1) - manips[i].Name = QByteArray("Zoom"); - else if (manips[i].Mouse == 2) - manips[i].Name = QByteArray("Pan"); - else if (manips[i].Mouse == 3) - manips[i].Name = QByteArray("Rotate"); - } - - // MB only - if (manips[i].Shift == 0 && manips[i].Control == 0) { - if (manips[i].Mouse == 1) - manips[i].Name = QByteArray("Rotate"); - else if (manips[i].Mouse == 2) - manips[i].Name = QByteArray("Pan"); - else if (manips[i].Mouse == 3) - manips[i].Name = QByteArray("Zoom"); - } - } - - // Save settings - for(int i=0; i<9; i++) - { - strs << QString("Manipulator%1Mouse%2Shift%3Control%4Name%5") - .arg(i+1) - .arg(manips[i].Mouse) - .arg(manips[i].Shift) - .arg(manips[i].Control) - .arg(QString(manips[i].Name)); - } - - settings->setValue("InteractorStyle/CameraManipulators", strs); - } - settings->endGroup(); - - // Loop through render views and apply the settings - QList views = - pqApplicationCore::instance()->getServerManagerModel()-> - findItems(); - - foreach(pqRenderViewBase* view, views) { - view->restoreSettings(true); - } -} diff --git a/src/Plugins/NavigationMode/pqSetModeStarter.h b/src/Plugins/NavigationMode/pqSetModeStarter.h deleted file mode 100644 index 098446f9..00000000 --- a/src/Plugins/NavigationMode/pqSetModeStarter.h +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (C) 2010-2014 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#ifndef __pqSetModeStarter_h -#define __pqSetModeStarter_h - -#include - -class pqSetModeStarter : public QObject -{ - Q_OBJECT - typedef QObject Superclass; -public: - pqSetModeStarter(QObject* p=0); - ~pqSetModeStarter(); - - // Callback for startup. - void onStartup(); - - // Callback for shutdown. - void shutdown() {} - -private: - void setStandardMode(); - -private: - pqSetModeStarter(const pqSetModeStarter&); // Not implemented. - void operator=(const pqSetModeStarter&); // Not implemented. -}; - -#endif - - diff --git a/src/Plugins/ToolBar/CMakeLists.txt b/src/Plugins/ToolBar/CMakeLists.txt deleted file mode 100755 index af3d1f4c..00000000 --- a/src/Plugins/ToolBar/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright (C) 2010-2014 CEA/DEN, EDF R&D -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 2.1 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# -# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -# - -# create a plugin that implements a sample toolbar action - -QT4_WRAP_CPP(MOC_SRCS MyToolBarActions.h) - -# we implement a pqConePanel.h for the ConeSource -ADD_PARAVIEW_ACTION_GROUP(IFACES IFACE_SRCS CLASS_NAME MyToolBarActions - GROUP_NAME "ToolBar/MyActions") - -# create a plugin for this panel -ADD_PARAVIEW_PLUGIN(GUISampleToolBar "1.0" - GUI_INTERFACES ${IFACES} - SOURCES MyToolBarActions.cxx ${MOC_SRCS} ${IFACE_SRCS}) - -INSTALL( - TARGETS GUISampleToolBar - DESTINATION lib/paraview -) diff --git a/src/Plugins/ToolBar/MyToolBarActions.cxx b/src/Plugins/ToolBar/MyToolBarActions.cxx deleted file mode 100755 index 201842f4..00000000 --- a/src/Plugins/ToolBar/MyToolBarActions.cxx +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (C) 2010-2014 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include "MyToolBarActions.h" - -#include -#include -#include - -MyToolBarActions::MyToolBarActions(QObject* p) - : QActionGroup(p) -{ - QIcon icon = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical); - - QAction* a = this->addAction(new QAction(icon, "MyAction", this)); - QObject::connect(a, SIGNAL(triggered(bool)), this, SLOT(onAction())); -} - -MyToolBarActions::~MyToolBarActions() -{ -} - -void MyToolBarActions::onAction() -{ - QMessageBox::information(NULL, "MyAction", "MyAction was invoked\n"); -} - diff --git a/src/Plugins/ToolBar/MyToolBarActions.h b/src/Plugins/ToolBar/MyToolBarActions.h deleted file mode 100755 index f641299e..00000000 --- a/src/Plugins/ToolBar/MyToolBarActions.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2010-2014 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include - -class MyToolBarActions : public QActionGroup -{ - Q_OBJECT -public: - MyToolBarActions(QObject* p); - ~MyToolBarActions(); - -public slots: - void onAction(); - -}; -