}
*/
+ // Initialize ParaView client
pvInit();
+ // Create GUI elements (menus, toolbars, dock widgets)
+ if ( !Implementation ){
+ LightApp_Application* anApp = getApp();
+
+ // Simulate ParaView client main window
+ Implementation = new pqImplementation( anApp->desktop() );
+
+ setupDockWidgets();
+
+ pvCreateActions();
+ pvCreateMenus();
+ pvCreateToolBars();
+
+ setupDockWidgetsContextMenu();
+
+ // Now that we're ready, initialize everything ...
+ Implementation->Core.initializeStates();
+ }
}
/*!
{
if ( !pqImplementation::myPVMain ){
// Obtain command-line arguments
+ // Workaround to avoid pqOptions messages: pass only the executable path to vtkPVMain
int argc = 0;
QStringList args = QApplication::arguments();
char** argv = new char*[args.size()];
*/
void PVGUI_Module::showView( bool toShow )
{
- // TODO: check if ParaView view already exists
- if ( !Implementation ){
- LightApp_Application* anApp = getApp();
- SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
- PVGUI_ViewManager* viewMgr = new PVGUI_ViewManager( anApp->activeStudy(), anApp->desktop() );
+ LightApp_Application* anApp = getApp();
+ PVGUI_ViewManager* viewMgr = dynamic_cast<PVGUI_ViewManager*>( anApp->getViewManager( PVGUI_Viewer::Type(), false ) );
+ if ( !viewMgr ) {
+ viewMgr = new PVGUI_ViewManager( anApp->activeStudy(), anApp->desktop() );
anApp->addViewManager( viewMgr );
connect( viewMgr, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ),
anApp, SLOT( onCloseView( SUIT_ViewManager* ) ) );
- //connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), vm, SLOT( onViewCreated( SUIT_ViewWindow* ) ) );
- //connect( viewMgr, SIGNAL( deleteView( SUIT_ViewWindow* ) ), this, SLOT( onViewDeleted( SUIT_ViewWindow* ) ) );
- SUIT_ViewWindow* wnd = viewMgr->createViewWindow();
+ }
- // Simulate ParaView client main window
- Implementation = new pqImplementation( anApp->desktop() );
- PVGUI_ViewWindow* pvWnd = dynamic_cast<PVGUI_ViewWindow*>( wnd );
+ PVGUI_ViewWindow* pvWnd = dynamic_cast<PVGUI_ViewWindow*>( viewMgr->getActiveView() );
+ if ( !pvWnd ) {
+ pvWnd = dynamic_cast<PVGUI_ViewWindow*>( viewMgr->createViewWindow() );
pvWnd->setMultiViewManager( &Implementation->Core.multiViewManager() );
-
- setupDockWidgets();
-
- pvCreateActions();
- pvCreateMenus();
- pvCreateToolBars();
-
- setupDockWidgetsContextMenu();
-
- // Now that we're ready, initialize everything ...
- Implementation->Core.initializeStates();
}
- else
- restoreDockWidgetsState();
+
+ pvWnd->setShown( toShow );
}
/*!
bool isDone = LightApp_Module::activateModule( study );
if ( !isDone ) return false;
+ showView( true );
+
if ( mySourcesMenuId != -1 ) menuMgr()->show(mySourcesMenuId);
if ( myFiltersMenuId != -1 ) menuMgr()->show(myFiltersMenuId);
setMenuShown( true );
setToolShown( true );
- showView( true );
-
toolMgr()->toolBar(tr("TOOL_LOOKMARKS"))->installEventFilter(this);
// Make default server connection
if ( Implementation )
Implementation->Core.makeDefaultConnectionIfNoneExists();
+ restoreDockWidgetsState();
+
return isDone;
}
{
toolMgr()->toolBar(tr("TOOL_LOOKMARKS"))->removeEventFilter(this);
+ showView( false );
+
// hide menus
menuMgr()->hide(mySourcesMenuId);
menuMgr()->hide(myFiltersMenuId);
pqImplementation(QWidget* parent) :
AssistantClient(0),
Core(parent),
- RecentFilesMenu(0)//,
- //ViewMenu(0),
- //ToolbarsMenu(0)
+ RecentFilesMenu(0)
{
}
~pqImplementation()
{
- //delete this->ViewMenu;
- //delete this->ToolbarsMenu;
if(this->AssistantClient) {
this->AssistantClient->closeAssistant();
delete this->AssistantClient;
}
QPointer<QAssistantClient> AssistantClient;
- //Ui::MainWindow UI;
pqMainWindowCore Core;
pqRecentFilesMenu* RecentFilesMenu;
- //pqViewMenu* ViewMenu;
- //pqViewMenu* ToolbarsMenu;
- //QLineEdit* CurrentTimeWidget;
- //QSpinBox* CurrentTimeIndexWidget;
QPointer<pqServer> ActiveServer;
QString DocumentationDir;
/*!
\brief Destructor.
+ As pqViewManager persists through the whole session,
+ the destructor first removes it from the children of this PVGUI_ViewWindow
+ to prevent its unexpected deletion.
*/
PVGUI_ViewWindow::~PVGUI_ViewWindow()
{
+ if ( myPVMgr ) {
+ myPVMgr->setParent( 0 );
+ myPVMgr->hide();
+ myPVMgr = 0;
+ setCentralWidget( 0 );
+ }
}
-/*!
- \brief Custom event filter.
- \param watched event receiver object
- \param e event
- \return \c true if further event processing should be stopped
-*/
-bool PVGUI_ViewWindow::eventFilter( QObject* watched, QEvent* e )
-{
- return SUIT_ViewWindow::eventFilter( watched, e );
-}
-
-
/*!
\brief Get the visual parameters of the view window.
\return visual parameters of this view window formatted to the string
{
myPVMgr = viewMgr;
myPVMgr->setParent( this );
- // This is mandatory, see setParent() documentation
+ // This is mandatory, see setParent() method in Qt 4 documentation
myPVMgr->show();
setCentralWidget( myPVMgr );
- myPVMgr->installEventFilter( this );
}
/*!