From: mkr Date: Tue, 19 Jun 2007 07:08:04 +0000 (+0000) Subject: Porting to Qt4. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ff6456b64e2c1c8efec593a71da64543bb037693;p=modules%2Fgui.git Porting to Qt4. --- diff --git a/src/LightApp/LightApp_AboutDlg.cxx b/src/LightApp/LightApp_AboutDlg.cxx index 7dc4a48ae..1ab621df7 100644 --- a/src/LightApp/LightApp_AboutDlg.cxx +++ b/src/LightApp/LightApp_AboutDlg.cxx @@ -26,31 +26,41 @@ #include #include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include /*!Constructor.*/ LightApp_AboutDlg::LightApp_AboutDlg( const QString& defName, const QString& defVer, QWidget* parent ) -: QtxDialog( parent, "salome_about_dialog", true, false, None ) +: QtxDialog( parent, true, false, None ) { + setObjectName( "salome_about_dialog" ); + SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); QPixmap ico = resMgr->loadPixmap( "LightApp", tr( "ICO_ABOUT" ), false ); if ( !ico.isNull() ) - setIcon( ico ); + setWindowIcon( ico ); QPalette pal = palette(); - QColorGroup cg = pal.active(); - cg.setColor( QColorGroup::Foreground, Qt::darkBlue ); - cg.setColor( QColorGroup::Background, Qt::white ); - pal.setActive( cg ); pal.setInactive( cg ); pal.setDisabled( cg ); + + pal.setBrush( QPalette::Active, QPalette::WindowText, QBrush( Qt::darkBlue ) ); + pal.setBrush( QPalette::Active, QPalette::Window, QBrush( Qt::white ) ); + + pal.setBrush( QPalette::Inactive, QPalette::WindowText, QBrush( Qt::darkBlue ) ); + pal.setBrush( QPalette::Inactive, QPalette::Window, QBrush( Qt::white ) ); + + pal.setBrush( QPalette::Disabled, QPalette::WindowText, QBrush( Qt::darkBlue ) ); + pal.setBrush( QPalette::Disabled, QPalette::Window, QBrush( Qt::white ) ); + setPalette(pal); QVBoxLayout* main = new QVBoxLayout( mainFrame() ); - QGroupBox* base = new QGroupBox( 1, Qt::Horizontal, "", mainFrame() ); - base->setFrameStyle( QFrame::NoFrame ); + QtxGridBox* base = new QtxGridBox( 1, Qt::Horizontal, mainFrame(), 0, 0 ); base->setInsideMargin( 0 ); main->addWidget( base ); @@ -99,7 +109,7 @@ LightApp_AboutDlg::LightApp_AboutDlg( const QString& defName, const QString& def QString capText = tr( "ABOUT_CAPTION" ); if ( capText.contains( "%1" ) ) capText = capText.arg( defName ); - setCaption( capText ); + setWindowTitle( capText ); setSizeGripEnabled( false ); } @@ -142,7 +152,7 @@ void LightApp_AboutDlg::checkLabel( QLabel* lab ) const if ( !lab ) return; - bool vis = !lab->text().stripWhiteSpace().isEmpty() || + bool vis = !lab->text().trimmed().isEmpty() || ( lab->pixmap() && !lab->pixmap()->isNull() ); vis ? lab->show() : lab->hide(); } diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 3024d7c04..d0558c041 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -22,8 +22,8 @@ // Copyright (C) CEA 2005 #ifndef DISABLE_PYCONSOLE - #include "PythonConsole_PyInterp.h" // WARNING! This include must be the first! - #include + #include "PyConsole_Interp.h" // WARNING! This include must be the first! + #include #endif #include "LightApp_Application.h" @@ -44,6 +44,8 @@ #include "LightApp_SelectionMgr.h" #include "LightApp_DataObject.h" +#include "SALOME_Event.h" + #include #include #include @@ -60,11 +62,12 @@ #include #include #include -#include +#include #include -#include -#include +// temporary commented +//#include +//#include #ifndef DISABLE_GLVIEWER #include @@ -110,22 +113,25 @@ // #include //#endif -#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 +#include +#include +#include + +using namespace Qt; #define FIRST_HELP_ID 1000000 @@ -194,14 +200,14 @@ myPrefs( 0 ) SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr(); QPixmap aLogo = aResMgr->loadPixmap( "LightApp", tr( "APP_DEFAULT_ICO" ), false ); - desktop()->setIcon( aLogo ); + desktop()->setWindowIcon( aLogo ); desktop()->setDockableMenuBar( true ); desktop()->setDockableStatusBar( false ); // base logo (salome itself) - desktop()->addLogo( "_app_base", aResMgr->loadPixmap( "LightApp", tr( "APP_BASE_LOGO" ), false ) ); + desktop()->logoInsert( "_app_base", aResMgr->loadPixmap( "LightApp", tr( "APP_BASE_LOGO" ), false ) ); // extra logo (salome-based application) - desktop()->addLogo( "_app_extra", aResMgr->loadPixmap( "LightApp", tr( "APP_EXTRA_LOGO" ), false ) ); + desktop()->logoInsert( "_app_extra", aResMgr->loadPixmap( "LightApp", tr( "APP_EXTRA_LOGO" ), false ) ); clearViewManagers(); @@ -258,7 +264,7 @@ myPrefs( 0 ) if ( famdb.contains(f.family()) || !aResMgr->hasValue( "PyConsole", "additional_families" ) ) return; - QStringList anAddFamilies = QStringList::split( ";", aResMgr->stringValue( "PyConsole", "additional_families" ) ); + QStringList anAddFamilies = aResMgr->stringValue( "PyConsole", "additional_families" ).split( ";", QString::SkipEmptyParts ); QString aFamily; for ( QStringList::Iterator it = anAddFamilies.begin(); it != anAddFamilies.end(); ++it ) { @@ -286,20 +292,22 @@ LightApp_Application::~LightApp_Application() /*!Start application.*/ void LightApp_Application::start() { - if ( desktop() ) - desktop()->loadGeometry( resourceMgr(), "desktop" ); - + if ( desktop() ) { + desktop()->retrieveGeometry( resourceMgr()->stringValue( "desktop", "geometry", "(800%)x(800%) (+400%) (+400%) :(full)" ) ); + //desktop()->retrieveGeometry( SUIT_Session::session()->resourceMgr()->stringValue( "desktop", "state", "normal" )); + //desktop()->retrieveGeometry( SUIT_Session::session()->resourceMgr()->stringValue( "desktop", "pos_x", "center" )); + //desktop()->retrieveGeometry( SUIT_Session::session()->resourceMgr()->stringValue( "desktop", "pos_y", "center" )); + //desktop()->retrieveGeometry( SUIT_Session::session()->resourceMgr()->stringValue( "desktop", "widht", "800" )); + //desktop()->retrieveGeometry( SUIT_Session::session()->resourceMgr()->stringValue( "desktop", "height", "800" )); + } + CAM_Application::start(); - QAction* a = action( ViewWindowsId ); - if ( a && a->inherits( "QtxDockAction" ) ) - ((QtxDockAction*)a)->setAutoPlace( true ); - updateWindows(); updateViewManagers(); putInfo( "" ); - desktop()->statusBar()->message( "" ); + desktop()->statusBar()->showMessage( "" ); LightApp_EventFilter::Init(); } @@ -330,10 +338,9 @@ QString LightApp_Application::applicationVersion() const path += QString( "bin/salome/VERSION" ); QFile vf( path ); - if ( vf.open( IO_ReadOnly ) ) + if ( vf.open( QIODevice::ReadOnly ) ) { - QString line; - vf.readLine( line, 1024 ); + QString line( vf.readLine( 1024 ) ); vf.close(); if ( !line.isEmpty() ) @@ -341,9 +348,9 @@ QString LightApp_Application::applicationVersion() const while ( !line.isEmpty() && line.at( line.length() - 1 ) == QChar( '\n' ) ) line.remove( line.length() - 1, 1 ); - int idx = line.findRev( ":" ); + int idx = line.lastIndexOf( ":" ); if ( idx != -1 ) - _app_version = line.mid( idx + 1 ).stripWhiteSpace(); + _app_version = line.mid( idx + 1 ).trimmed(); } } } @@ -423,9 +430,9 @@ void LightApp_Application::createActionForViewer( const int id, const QString& suffix, const int accel ) { - QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ), QIconSet(), - tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ), - tr( QString( "NEW_WINDOW_%1" ).arg( suffix ) ), + QAction* a = createAction( id, tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), QIcon(), + tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), + tr( QString( "NEW_WINDOW_%1" ).arg( suffix ).toLatin1().constData() ), accel, desktop(), false, this, SLOT( onNewWindow() ) ); createMenu( a, parentId, -1 ); } @@ -439,7 +446,7 @@ void LightApp_Application::createActions() SUIT_ResourceMgr* resMgr = resourceMgr(); //! Preferences - createAction( PreferencesId, tr( "TOT_DESK_PREFERENCES" ), QIconSet(), + createAction( PreferencesId, tr( "TOT_DESK_PREFERENCES" ), QIcon(), tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ), CTRL+Key_F, desk, false, this, SLOT( onPreferences() ) ); @@ -453,33 +460,35 @@ void LightApp_Application::createActions() int id = LightApp_Application::UserID + FIRST_HELP_ID; // help for KERNEL and GUI - QCString dir; + QString dir;//QByteArray dir; QString aFileName = "index.htm"; QString root; QAction* a; - if (dir = getenv("GUI_ROOT_DIR")) { + dir = getenv("GUI_ROOT_DIR"); + if ( !dir.isEmpty() ) { root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + Qtx::addSlash("salome") + Qtx::addSlash("gui") + Qtx::addSlash("GUI") ); if ( QFileInfo( root + aFileName ).exists() ) { - a = createAction( id, tr( QString("GUI Help") ), QIconSet(), - tr( QString("GUI Help") ), - tr( QString("GUI Help") ), + a = createAction( id, tr( QString("GUI Help").toLatin1().constData() ), QIcon(), + tr( QString("GUI Help").toLatin1().constData() ), + tr( QString("GUI Help").toLatin1().constData() ), 0, desk, false, this, SLOT( onHelpContentsModule() ) ); - a->setName( QString("GUI") ); + a->setObjectName( QString("GUI") ); createMenu( a, helpModuleMenu, -1 ); id++; } } - if (dir = getenv("KERNEL_ROOT_DIR")) { + dir = getenv("KERNEL_ROOT_DIR"); + if ( !dir.isEmpty() ) { QString aFN = "index.html"; root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + Qtx::addSlash("salome") ); if ( QFileInfo( root + aFN ).exists() ) { - a = createAction( id, tr( QString("KERNEL Help") ), QIconSet(), - tr( QString("KERNEL Help") ), - tr( QString("KERNEL Help") ), + a = createAction( id, tr( QString("KERNEL Help").toLatin1().constData() ), QIcon(), + tr( QString("KERNEL Help").toLatin1().constData() ), + tr( QString("KERNEL Help").toLatin1().constData() ), 0, desk, false, this, SLOT( onHelpContentsModule() ) ); - a->setName( QString("KERNEL") ); + a->setObjectName( QString("KERNEL") ); createMenu( a, helpModuleMenu, -1 ); id++; } @@ -493,16 +502,17 @@ void LightApp_Application::createActions() QString modName = moduleName( *it ); - if (dir = getenv( modName + "_ROOT_DIR")) { + dir = getenv( (modName + "_ROOT_DIR").toLatin1().constData() ); + if ( !dir.isEmpty() ) { root = Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + Qtx::addSlash("salome") + Qtx::addSlash("gui") + Qtx::addSlash(modName) ); if ( QFileInfo( root + aFileName ).exists() ) { - QAction* a = createAction( id, tr( moduleTitle(modName) + QString(" Help") ), QIconSet(), - tr( moduleTitle(modName) + QString(" Help") ), - tr( moduleTitle(modName) + QString(" Help") ), + QAction* a = createAction( id, tr( (moduleTitle(modName) + QString(" Help")).toLatin1().constData() ), QIcon(), + tr( (moduleTitle(modName) + QString(" Help")).toLatin1().constData() ), + tr( (moduleTitle(modName) + QString(" Help")).toLatin1().constData() ), 0, desk, false, this, SLOT( onHelpContentsModule() ) ); - a->setName( modName ); + a->setObjectName( modName ); createMenu( a, helpModuleMenu, -1 ); id++; } @@ -530,15 +540,16 @@ void LightApp_Application::createActions() if( modList.count()>1 ) { QToolBar* modTBar = new QtxToolBar( true, desk ); - modTBar->setLabel( tr( "INF_TOOLBAR_MODULES" ) ); + modTBar->setObjectName( "ModuleToolBar" ); + modTBar->setWindowTitle( tr( "INF_TOOLBAR_MODULES" ) ); QActionGroup* modGroup = new QActionGroup( this ); modGroup->setExclusive( true ); - modGroup->setUsesDropDown( true ); + //modGroup->setUsesDropDown( true ); // to use a new class for this purpose a = createAction( -1, tr( "APP_NAME" ), defIcon, tr( "APP_NAME" ), tr( "PRP_APP_MODULE" ), 0, desk, true ); - modGroup->add( a ); + modGroup->addAction( a ); myActions.insert( QString(), a ); QMap iconMap; @@ -546,15 +557,13 @@ void LightApp_Application::createActions() const int iconSize = 20; - modGroup->addTo( modTBar ); - QObjectList *l = modTBar->queryList( "QComboBox" ); - QObjectListIt oit( *l ); - while ( QObject* obj = oit.current() ) { - QComboBox* cb = (QComboBox*)obj; - if ( cb ) cb->setFocusPolicy( QWidget::NoFocus ); - ++oit; + modTBar->addActions(modGroup->actions()); + QList l = modTBar->findChildren(); + QListIterator oit( l ); + while ( oit.hasNext() ) { + QComboBox* cb = oit.next(); + if ( cb ) cb->setFocusPolicy( Qt::NoFocus ); } - delete l; modTBar->addSeparator(); @@ -574,15 +583,15 @@ void LightApp_Application::createActions() { icon = modIcon; printf( "****************************************************************\n" ); - printf( "* Icon for %s not found. Using the default one.\n", (*it).latin1() ); + printf( "* Icon for %s not found. Using the default one.\n", (*it).toLatin1().constData() ); printf( "****************************************************************\n" ); } - icon.convertFromImage( icon.convertToImage().smoothScale( iconSize, iconSize, QImage::ScaleMin ) ); + icon.fromImage( icon.toImage().scaled( iconSize, iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation ) ); QAction* a = createAction( -1, *it, icon, *it, tr( "PRP_MODULE" ).arg( *it ), 0, desk, true ); - a->addTo( modTBar ); - modGroup->add( a ); + modTBar->addAction( a ); + modGroup->addAction( a ); myActions.insert( *it, a ); } @@ -611,7 +620,7 @@ void LightApp_Application::createActions() #endif - createAction( RenameId, tr( "TOT_RENAME" ), QIconSet(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ), + createAction( RenameId, tr( "TOT_RENAME" ), QIcon(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ), SHIFT+Key_R, desk, false, this, SLOT( onRenameWindow() ) ); createMenu( RenameId, windowMenu, -1 ); @@ -632,7 +641,7 @@ void LightApp_Application::onModuleActivation( QAction* a ) if ( !a ) return; - QString modName = a->menuText(); + QString modName = a->text(); if ( modName == tr( "APP_NAME" ) ) modName = QString::null; @@ -661,7 +670,7 @@ void LightApp_Application::onModuleActivation( QAction* a ) case 0: default: putInfo( tr("INF_CANCELLED") ); - myActions[QString()]->setOn( true ); + myActions[QString()]->setChecked( true ); cancelled = true; } } @@ -763,11 +772,12 @@ bool LightApp_Application::onOpenDoc( const QString& aName ) // Look among opened studies if (activeStudy()) { // at least one study is opened SUIT_Session* aSession = SUIT_Session::session(); - QPtrList aAppList = aSession->applications(); - QPtrListIterator it (aAppList); + QList aAppList = aSession->applications(); + QListIterator it (aAppList); SUIT_Application* aApp = 0; // iterate on all applications - for (; (aApp = it.current()) && !isAlreadyOpen; ++it) { + while ( it.hasNext() && !isAlreadyOpen ) { + if ( !(aApp = it.next()) ) break; if (aApp->activeStudy()->studyName() == aName) { isAlreadyOpen = true; // Already opened, ask user what to do @@ -934,19 +944,19 @@ public: if ( !myApp.isEmpty()) { - aCommand.sprintf("%s %s %s",myApp.latin1(),myParams.latin1(),myHelpFile.latin1()); + aCommand.sprintf("%s %s %s",myApp.toLatin1().constData(),myParams.toLatin1().constData(),myHelpFile.toLatin1().constData()); QProcess* proc = new QProcess(); - proc->addArgument( aCommand ); //myStatus = system(aCommand); //if(myStatus != 0) - if(!proc->start()) + proc->start(aCommand); + if (proc->waitForStarted()) { - QCustomEvent* ce2000 = new QCustomEvent( 2000 ); + SALOME_CustomEvent* ce2000 = new SALOME_CustomEvent( 2000 ); QString* msg = new QString( QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").arg(myApp).arg(myHelpFile) ); ce2000->setData( msg ); - postEvent( myLApp, ce2000 ); + QApplication::postEvent( myLApp, ce2000 ); } } } @@ -966,16 +976,16 @@ void LightApp_Application::onHelpContentsModule() { const QAction* obj = (QAction*) sender(); - QString aComponentName = obj->name(); + QString aComponentName = obj->objectName(); QString aFileName = "index.htm"; QString aFileNameKernel = "index.html"; - QCString dir = getenv( aComponentName + "_ROOT_DIR"); + QString dir = getenv( (aComponentName + "_ROOT_DIR").toLatin1().constData() ); QString homeDir = !aComponentName.compare(QString("KERNEL")) ? Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + Qtx::addSlash("salome") ) : Qtx::addSlash( Qtx::addSlash(dir) + Qtx::addSlash("share") + Qtx::addSlash("doc") + Qtx::addSlash("salome") + Qtx::addSlash("gui") + Qtx::addSlash(aComponentName) ); - QString helpFile = QFileInfo( homeDir + (!aComponentName.compare(QString("KERNEL")) ? aFileNameKernel : aFileName) ).absFilePath(); + QString helpFile = QFileInfo( homeDir + (!aComponentName.compare(QString("KERNEL")) ? aFileNameKernel : aFileName) ).absoluteFilePath(); SUIT_ResourceMgr* resMgr = resourceMgr(); QString platform; #ifdef WIN32 @@ -1009,10 +1019,10 @@ void LightApp_Application::onHelpContentsModule() */ void LightApp_Application::onHelpContextModule(const QString& theComponentName, const QString& theFileName) { - QCString dir = getenv( theComponentName + "_ROOT_DIR"); + QString dir = getenv( (theComponentName + "_ROOT_DIR").toLatin1().constData() ); QString homeDir = Qtx::addSlash(Qtx::addSlash(dir)+Qtx::addSlash("share")+Qtx::addSlash("doc")+Qtx::addSlash("salome")+Qtx::addSlash("gui")+Qtx::addSlash(theComponentName)); - QString helpFile = QFileInfo( homeDir + theFileName ).absFilePath(); + QString helpFile = QFileInfo( homeDir + theFileName ).absoluteFilePath(); SUIT_ResourceMgr* resMgr = resourceMgr(); QString platform; #ifdef WIN32 @@ -1104,25 +1114,28 @@ void LightApp_Application::addWindow( QWidget* wid, const int flag, const int st // asv: connecting a slot for storing visibility flag of a window connect( newWC, SIGNAL( visibilityChanged ( bool ) ), SLOT( onVisibilityChanged( bool ) ) ); myWindows.insert( flag, newWC ); - if ( winMap.contains( flag ) ) - desktop()->moveDockWindow( myWindows[flag], (Dock)winMap[flag] ); - - myWindows[flag]->setResizeEnabled( true ); - myWindows[flag]->setCloseMode( QDockWindow::Always ); - myWindows[flag]->setName( QString( "dock_window_%1" ).arg( flag ) ); - myWindows[flag]->setFixedExtentWidth( wid->width() ); - myWindows[flag]->setFixedExtentHeight( wid->height() ); + if ( winMap.contains( flag ) ) { + desktop()->removeDockWidget( myWindows[flag] ); + desktop()->addDockWidget( (DockWidgetArea)winMap[flag], myWindows[flag] ); + } + + //myWindows[flag]->setResizeEnabled( true ); + myWindows[flag]->setFeatures( QDockWidget::DockWidgetClosable ); + myWindows[flag]->setObjectName( QString( "dock_window_%1" ).arg( flag ) ); + //myWindows[flag]->setFixedExtentWidth( wid->width() ); + //myWindows[flag]->setFixedExtentHeight( wid->height() ); + myWindows[flag]->resize( wid->width(), wid->height() ); } QFont f; #ifndef DISABLE_PYCONSOLE - if( wid->inherits( "PythonConsole" ) ) + if( wid->inherits( "PyConsole_Console" ) ) { if( resourceMgr()->hasValue( "PyConsole", "font" ) ) f = resourceMgr()->fontValue( "PyConsole", "font" ); else { - f = ( ( PythonConsole* )wid )->font(); + f = ( ( PyConsole_Console* )wid )->font(); resourceMgr()->setValue( "PyConsole", "font", f ); } } @@ -1190,7 +1203,7 @@ bool LightApp_Application::isWindowVisible( const int type ) const if ( myWindows.contains( type ) ) { SUIT_Desktop* desk = ((LightApp_Application*)this)->desktop(); - res = desk && desk->appropriate( myWindows[type] ); + //res = desk && desk->appropriate( myWindows[type] ); } return res; } @@ -1205,11 +1218,11 @@ void LightApp_Application::setWindowShown( const int type, const bool on ) if ( !desktop() || !myWindows.contains( type ) ) return; - QDockWindow* dw = myWindows[type]; - desktop()->setAppropriate( dw, on ); + QDockWidget* dw = myWindows[type]; + //desktop()->setAppropriate( dw, on ); if( on ) dw->show(); - else if( dw->isShown() ) + else if( dw->isVisible() ) { dw->hide(); myWindowsVisible[ type ] = true; @@ -1219,14 +1232,15 @@ void LightApp_Application::setWindowShown( const int type, const bool on ) /*! \return Object Browser */ -OB_Browser* LightApp_Application::objectBrowser() +// temporary commented +/*OB_Browser* LightApp_Application::objectBrowser() { OB_Browser* ob = 0; QWidget* wid = window( WT_ObjectBrowser ); if ( wid && wid->inherits( "OB_Browser" ) ) ob = (OB_Browser*)wid; return ob; -} +}*/ /*! \return Log Window @@ -1244,12 +1258,12 @@ LogWindow* LightApp_Application::logWindow() /*! \return Python Console */ -PythonConsole* LightApp_Application::pythonConsole() +PyConsole_Console* LightApp_Application::pythonConsole() { - PythonConsole* console = 0; + PyConsole_Console* console = 0; QWidget* wid = getWindow( WT_PyConsole ); - if ( wid->inherits( "PythonConsole" ) ) - console = (PythonConsole*)wid; + if ( wid->inherits( "PyConsole_Console" ) ) + console = (PyConsole_Console*)wid; return console; } #endif @@ -1263,29 +1277,33 @@ void LightApp_Application::updateObjectBrowser( const bool updateModels ) // update existing data models if ( updateModels ) { - const bool isAutoUpdate = objectBrowser() ? objectBrowser()->isAutoUpdate() : true; + // temporary commented + /*const bool isAutoUpdate = objectBrowser() ? objectBrowser()->isAutoUpdate() : true; if( objectBrowser() ) - objectBrowser()->setAutoUpdate( false ); + objectBrowser()->setAutoUpdate( false );*/ LightApp_Study* study = dynamic_cast(activeStudy()); if ( study ) { CAM_Study::ModelList dm_list; study->dataModels( dm_list ); - for ( CAM_Study::ModelListIterator it( dm_list ); it.current(); ++it ) { - CAM_DataModel* camDM = it.current(); + QListIterator it( dm_list ); + while ( it.hasNext() ) { + CAM_DataModel* camDM = it.next(); if ( camDM && camDM->inherits( "LightApp_DataModel" ) ) ((LightApp_DataModel*)camDM)->update(); } } - if( objectBrowser() ) - objectBrowser()->setAutoUpdate( isAutoUpdate ); + // temporary commented + /*if( objectBrowser() ) + objectBrowser()->setAutoUpdate( isAutoUpdate );*/ } - if ( objectBrowser() ) + // temporary commented + /*if ( objectBrowser() ) { objectBrowser()->updateGeometry(); objectBrowser()->updateTree( 0, false ); - } + }*/ } /*! @@ -1443,13 +1461,15 @@ void LightApp_Application::onStudyCreated( SUIT_Study* theStudy ) //aRoot->setName( tr( "DATA_MODELS" ) ); } getWindow( WT_ObjectBrowser ); - if ( objectBrowser() != 0 ) - objectBrowser()->setRootObject( aRoot ); + // temporary commented + /*if ( objectBrowser() != 0 ) + objectBrowser()->setRootObject( aRoot );*/ activateModule( defaultModule() ); - if ( objectBrowser() ) - objectBrowser()->openLevels(); + // temporary commented + /*if ( objectBrowser() ) + objectBrowser()->openLevels();*/ activateWindows(); } @@ -1467,13 +1487,15 @@ void LightApp_Application::onStudyOpened( SUIT_Study* theStudy ) //aRoot->dump(); } getWindow( WT_ObjectBrowser ); - if ( objectBrowser() ) - objectBrowser()->setRootObject( aRoot ); + // temporary commented + /*if ( objectBrowser() ) + objectBrowser()->setRootObject( aRoot );*/ activateModule( defaultModule() ); - if ( objectBrowser() ) - objectBrowser()->openLevels(); + // temporary commented + /*if ( objectBrowser() ) + objectBrowser()->openLevels();*/ activateWindows(); @@ -1528,7 +1550,7 @@ QString LightApp_Application::getFileName( bool open, const QString& initial, co { if ( !parent ) parent = desktop(); - QStringList fls = QStringList::split( ";;", filters, false ); + QStringList fls = filters.split( ";;", QString::SkipEmptyParts ); return SUIT_FileDlg::getFileName( parent, initial, fls, caption, open, true ); } @@ -1546,7 +1568,7 @@ QStringList LightApp_Application::getOpenFileNames( const QString& initial, cons { if ( !parent ) parent = desktop(); - QStringList fls = QStringList::split( ";;", filters, false ); + QStringList fls = filters.split( ";;", QString::SkipEmptyParts ); return SUIT_FileDlg::getOpenFileNames( parent, initial, fls, caption, true ); } @@ -1559,7 +1581,7 @@ void LightApp_Application::onRefresh() /*!Private SLOT. On preferences.*/ void LightApp_Application::onPreferences() { - QApplication::setOverrideCursor( Qt::waitCursor ); + QApplication::setOverrideCursor( Qt::WaitCursor ); LightApp_PreferencesDlg* prefDlg = new LightApp_PreferencesDlg( preferences( true ), desktop()); @@ -1570,7 +1592,7 @@ void LightApp_Application::onPreferences() if ( ( prefDlg->exec() == QDialog::Accepted || prefDlg->isSaved() ) && resourceMgr() ) { if ( desktop() ) - desktop()->saveGeometry( resourceMgr(), "desktop" ); + resourceMgr()->setValue( "desktop", "geometry", desktop()->storeGeometry() ); resourceMgr()->save(); } @@ -1638,7 +1660,8 @@ QWidget* LightApp_Application::createWindow( const int flag ) QWidget* wid = 0; if ( flag == WT_ObjectBrowser ) { - OB_Browser* ob = new OB_Browser( desktop() ); + // temporary commented + /*OB_Browser* ob = new OB_Browser( desktop() ); ob->setAutoUpdate( true ); //ob->setAutoOpenLevel( 1 ); // commented by ASV as a fix to bug IPAL10107 ob->setCaption( tr( "OBJECT_BROWSER" ) ); @@ -1656,12 +1679,13 @@ QWidget* LightApp_Application::createWindow( const int flag ) wid = ob; ob->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) ); + */ } #ifndef DISABLE_PYCONSOLE else if ( flag == WT_PyConsole ) { - PythonConsole* pyCons = new PythonConsole( desktop() ); - pyCons->setCaption( tr( "PYTHON_CONSOLE" ) ); + PyConsole_Console* pyCons = new PyConsole_Console( desktop() ); + pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) ); wid = pyCons; // pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) ); } @@ -1669,7 +1693,7 @@ QWidget* LightApp_Application::createWindow( const int flag ) else if ( flag == WT_LogWindow ) { LogWindow* logWin = new LogWindow( desktop() ); - logWin->setCaption( tr( "LOG_WINDOW" ) ); + logWin->setWindowTitle( tr( "LOG_WINDOW" ) ); wid = logWin; logWin->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) ); } @@ -1682,9 +1706,9 @@ QWidget* LightApp_Application::createWindow( const int flag ) */ void LightApp_Application::defaultWindows( QMap& aMap ) const { - aMap.insert( WT_ObjectBrowser, Qt::DockLeft ); + aMap.insert( WT_ObjectBrowser, Qt::LeftDockWidgetArea ); #ifndef DISABLE_PYCONSOLE - aMap.insert( WT_PyConsole, Qt::DockBottom ); + aMap.insert( WT_PyConsole, Qt::BottomDockWidgetArea ); #endif // aMap.insert( WT_LogWindow, Qt::DockBottom ); } @@ -1715,13 +1739,15 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const that->myPrefs = _prefs_; - QPtrList appList = SUIT_Session::session()->applications(); - for ( QPtrListIterator appIt ( appList ); appIt.current(); ++appIt ) + QList appList = SUIT_Session::session()->applications(); + QListIterator appIt ( appList ); + while ( appIt.hasNext() ) { - if ( !appIt.current()->inherits( "LightApp_Application" ) ) + SUIT_Application* anItem = appIt.next(); + if ( !anItem->inherits( "LightApp_Application" ) ) continue; - LightApp_Application* app = (LightApp_Application*)appIt.current(); + LightApp_Application* app = (LightApp_Application*)anItem; QStringList modNameList; app->modules( modNameList, false ); @@ -1733,16 +1759,19 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const ModuleList modList; app->modules( modList ); - for ( ModuleListIterator itr( modList ); itr.current(); ++itr ) + QListIterator itr( modList ); + while ( itr.hasNext() ) { LightApp_Module* mod = 0; - if ( itr.current()->inherits( "LightApp_Module" ) ) - mod = (LightApp_Module*)itr.current(); + + CAM_Module* anItem = itr.next(); + if ( anItem->inherits( "LightApp_Module" ) ) + mod = (LightApp_Module*)anItem; if ( mod && !_prefs_->hasModule( mod->moduleName() ) ) { int modCat = _prefs_->addPreference( mod->moduleName() ); - _prefs_->setItemProperty( modCat, "info", QString::null ); + _prefs_->setItemProperty( modCat, "info", QString() ); if( toCreate ) mod->createPreferences(); } @@ -1769,7 +1798,7 @@ void LightApp_Application::moduleAdded( CAM_Module* mod ) if ( myPrefs && lightMod && !myPrefs->hasModule( lightMod->moduleName() )) { int modCat = myPrefs->addPreference( mod->moduleName() ); - myPrefs->setItemProperty( modCat, "info", QString::null ); + myPrefs->setItemProperty( modCat, "info", QString() ); lightMod->createPreferences(); } } @@ -1802,7 +1831,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) #endif int apppref = pref->addPreference( tr( "PREF_APP" ), extgroup, LightApp_Preferences::File, "ExternalBrowser", platform ); pref->setItemProperty( apppref, "existing", true ); - pref->setItemProperty( apppref, "flags", QFileInfo::ExeUser ); + pref->setItemProperty( apppref, "flags", QFile::ExeUser ); pref->setItemProperty( apppref, "readOnly", false ); pref->addPreference( tr( "PREF_PARAM" ), extgroup, LightApp_Preferences::String, "ExternalBrowser", "parameters" ); @@ -1864,7 +1893,7 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref ) aLegendPosList.append( tr("PREF_TOP") ); aLegendPosList.append( tr("PREF_BOTTOM") ); - QValueList anIndexesList; + QList anIndexesList; anIndexesList.append(0); anIndexesList.append(1); anIndexesList.append(2); @@ -1953,11 +1982,12 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString if ( sec == QString( "OCCViewer" ) && param == QString( "trihedron_size" ) ) { double sz = resMgr->doubleValue( sec, param, -1 ); - QPtrList lst; + QList lst; viewManagers( OCCViewer_Viewer::Type(), lst ); - for ( QPtrListIterator it( lst ); it.current() && sz >= 0; ++it ) + QListIterator it( lst ); + while ( it.hasNext() && sz >= 0 ) { - SUIT_ViewModel* vm = it.current()->getViewModel(); + SUIT_ViewModel* vm = it.next()->getViewModel(); if ( !vm || !vm->inherits( "OCCViewer_Viewer" ) ) continue; @@ -1973,12 +2003,13 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString { double sz = resMgr->doubleValue( "VTKViewer", "trihedron_size", -1 ); bool isRelative = resMgr->booleanValue( "VTKViewer", "relative_size", true ); - QPtrList lst; + QList lst; #ifndef DISABLE_SALOMEOBJECT viewManagers( SVTK_Viewer::Type(), lst ); - for ( QPtrListIterator it( lst ); it.current() && sz >= 0; ++it ) + QListIterator it( lst ); + while ( it.hasNext() && sz >= 0 ) { - SUIT_ViewModel* vm = it.current()->getViewModel(); + SUIT_ViewModel* vm = it.next()->getViewModel(); if ( !vm || !vm->inherits( "SVTK_Viewer" ) ) continue; @@ -1996,13 +2027,14 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString #ifndef DISABLE_OCCVIEWER if ( sec == QString( "OCCViewer" ) && ( param == QString( "iso_number_u" ) || param == QString( "iso_number_v" ) ) ) { - QPtrList lst; + QList lst; viewManagers( OCCViewer_Viewer::Type(), lst ); int u = resMgr->integerValue( sec, "iso_number_u" ); int v = resMgr->integerValue( sec, "iso_number_v" ); - for ( QPtrListIterator it( lst ); it.current(); ++it ) + QListIterator it( lst ); + while ( it.hasNext() ) { - OCCViewer_ViewManager* mgr = dynamic_cast( it.current() ); + OCCViewer_ViewManager* mgr = dynamic_cast( it.next() ); if( mgr && mgr->getOCCViewer() ) mgr->getOCCViewer()->setIsos( u, v ); } @@ -2013,7 +2045,8 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString { if( param=="auto_size" || param=="auto_size_first" ) { - OB_Browser* ob = objectBrowser(); + // temporary commented + /*OB_Browser* ob = objectBrowser(); if( !ob ) return; @@ -2025,7 +2058,7 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString for( int i=1; ilistView()->columns(); i++ ) if( ob->listView()->columnWidth( i )>0 ) ob->listView()->adjustColumn( i ); - updateObjectBrowser( false ); + updateObjectBrowser( false );*/ } } @@ -2055,7 +2088,7 @@ void LightApp_Application::savePreferences() if ( resourceMgr() ) { if ( desktop() ) - desktop()->saveGeometry( resourceMgr(), "desktop" ); + resourceMgr()->setValue( "desktop", "geometry", desktop()->storeGeometry() ); resourceMgr()->save(); } } @@ -2070,11 +2103,11 @@ void LightApp_Application::updateDesktopTitle() { aTitle += QString( " " ) + aVer; if ( activeStudy() ) { - QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false ); + QString sName = SUIT_Tools::file( activeStudy()->studyName().trimmed(), false ); aTitle += QString( " - [%1]" ).arg( sName ); } - desktop()->setCaption( aTitle ); + desktop()->setWindowTitle( aTitle ); } /*! @@ -2097,7 +2130,7 @@ void LightApp_Application::updateModuleActions() modName = activeModule()->moduleName(); if ( myActions.contains( modName ) ) - myActions[modName]->setOn( true ); + myActions[modName]->setChecked( true ); } /*! @@ -2144,11 +2177,13 @@ void LightApp_Application::updateWindows() for ( QMap::ConstIterator it = winMap.begin(); it != winMap.end(); ++it ) { getWindow( it.key() ); - Dock dock; int index, extraOffset; bool nl; - if ( desktop()->getLocation( myWindows[it.key()], dock, index, nl, extraOffset ) + DockWidgetArea dock = desktop()->dockWidgetArea( myWindows[it.key()] ); + if ( dock != NoDockWidgetArea && - dock != (Dock)it.data() ) - desktop()->moveDockWindow( myWindows[it.key()], (Dock)it.data() ); + dock != (DockWidgetArea)it.value() ) { + desktop()->removeDockWidget( myWindows[it.key()] ); + desktop()->addDockWidget( (DockWidgetArea)it.value(), myWindows[it.key()] ); + } } loadWindowsGeometry(); @@ -2162,7 +2197,7 @@ void LightApp_Application::updateWindows() !myWindowsVisible[ itr.key() ] ) continue; - setWindowShown( itr.key(), !itr.data()->isEmpty() && winMap.contains( itr.key() ) ); + setWindowShown( itr.key(), !itr.value()->isEmpty() && winMap.contains( itr.key() ) ); } } @@ -2187,25 +2222,11 @@ void LightApp_Application::loadWindowsGeometry() if( !store ) return; - QtxDockAction* dockMgr = 0; - - QAction* a = action( ViewWindowsId ); - if ( a && a->inherits( "QtxDockAction" ) ) - dockMgr = (QtxDockAction*)a; - - if ( !dockMgr ) - return; - QString modName; if ( activeModule() ) - modName = activeModule()->name(""); - - QString section = QString( "windows_geometry" ); - if ( !modName.isEmpty() ) - section += QString( "." ) + modName; + modName = activeModule()->objectName(); - dockMgr->loadGeometry( resourceMgr(), section, false ); - dockMgr->restoreGeometry(); + desktop()->restoreState( resourceMgr()->stringValue( "windows_geometry", modName ).toLatin1() ); } /*! @@ -2217,25 +2238,11 @@ void LightApp_Application::saveWindowsGeometry() if( !store ) return; - QtxDockAction* dockMgr = 0; - - QAction* a = action( ViewWindowsId ); - if ( a && a->inherits( "QtxDockAction" ) ) - dockMgr = (QtxDockAction*)a; - - if ( !dockMgr ) - return; - QString modName; if ( activeModule() ) - modName = activeModule()->name(""); + modName = activeModule()->objectName(); - QString section = QString( "windows_geometry" ); - if ( !modName.isEmpty() ) - section += QString( "." ) + modName; - - dockMgr->storeGeometry(); - dockMgr->saveGeometry( resourceMgr(), section, false ); + resourceMgr()->setValue( "windows_geometry", modName, desktop()->saveState() ); } /*! @@ -2246,7 +2253,7 @@ void LightApp_Application::activateWindows() if ( activeStudy() ) { for ( WindowMap::Iterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) - itr.data()->activate( activeStudy()->id() ); + itr.value()->activate( activeStudy()->id() ); } } @@ -2283,16 +2290,17 @@ void LightApp_Application::moduleIconNames( QMap& iconMap ) co /*! Inserts items in popup, which necessary for current application */ -void LightApp_Application::contextMenuPopup( const QString& type, QPopupMenu* thePopup, QString& title ) +void LightApp_Application::contextMenuPopup( const QString& type, QMenu* thePopup, QString& title ) { CAM_Application::contextMenuPopup( type, thePopup, title ); - OB_Browser* ob = objectBrowser(); + // temporary commented + /*OB_Browser* ob = objectBrowser(); if ( !ob || type != ob->popupClientType() ) - return; + return;*/ - thePopup->insertSeparator(); - thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) ); + thePopup->addSeparator(); + thePopup->addAction( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) ); } /*! @@ -2301,8 +2309,9 @@ void LightApp_Application::contextMenuPopup( const QString& type, QPopupMenu* th void LightApp_Application::createEmptyStudy() { CAM_Application::createEmptyStudy(); - if ( objectBrowser() ) - objectBrowser()->updateTree(); + // temporary commented + /*if ( objectBrowser() ) + objectBrowser()->updateTree();*/ } /*! @@ -2312,8 +2321,9 @@ void LightApp_Application::createEmptyStudy() bool LightApp_Application::activateModule( CAM_Module* mod ) { bool res = CAM_Application::activateModule( mod ); - if ( objectBrowser() ) - objectBrowser()->updateTree(); + // temporary commented + /*if ( objectBrowser() ) + objectBrowser()->updateTree();*/ return res; } @@ -2333,7 +2343,7 @@ void LightApp_Application::onWCDestroyed( QObject* ob ) // remove destroyed widget container from windows map for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) { - if ( itr.data() != ob ) + if ( itr.value() != ob ) continue; int key = itr.key(); @@ -2376,9 +2386,9 @@ void LightApp_Application::onRenameWindow() return; bool ok; - QString name = QInputDialog::getText( tr( "TOT_RENAME" ), tr( "PRP_RENAME" ), QLineEdit::Normal, w->caption(), &ok, w ); + QString name = QInputDialog::getText( w, tr( "TOT_RENAME" ), tr( "PRP_RENAME" ), QLineEdit::Normal, w->windowTitle(), &ok ); if( ok && !name.isEmpty() ) - w->setCaption( name ); + w->setWindowTitle( name ); } /*! @@ -2397,9 +2407,9 @@ bool LightApp_Application::isLibExists( const QString& moduleTitle ) const QStringList paths; #ifdef WIN32 - paths = QStringList::split( ";", ::getenv( "PATH" ) ); + paths = QString(::getenv( "PATH" )).split( ";", QString::SkipEmptyParts ); #else - paths = QStringList::split( ":", ::getenv( "LD_LIBRARY_PATH" ) ); + paths = QString(::getenv( "LD_LIBRARY_PATH" )).split( ":", QString::SkipEmptyParts ); #endif bool isLibFound = false; @@ -2418,7 +2428,7 @@ bool LightApp_Application::isLibExists( const QString& moduleTitle ) const if ( !isLibFound ) { printf( "****************************************************************\n" ); - printf( "* Warning: library %s cannot be found\n", moduleTitle.latin1() ); + printf( "* Warning: library %s cannot be found\n", moduleTitle.toLatin1().constData() ); printf( "* Module will not be available\n" ); printf( "****************************************************************\n" ); } @@ -2432,9 +2442,9 @@ bool LightApp_Application::isLibExists( const QString& moduleTitle ) const // Check the python library #ifdef WIN32 - paths = QStringList::split( ";", ::getenv( "PATH" ) ); + paths = QString(::getenv( "PATH" )).split( ";", QString::SkipEmptyParts ); #else - paths = QStringList::split( ":", ::getenv( "PYTHONPATH" ) ); + paths = QString(::getenv( "PYTHONPATH" )).split( ":", QString::SkipEmptyParts ); #endif bool isPyLib = false, isPyGuiLib = false; QStringList::const_iterator anIt = paths.begin(), aLast = paths.end(); @@ -2454,11 +2464,11 @@ bool LightApp_Application::isLibExists( const QString& moduleTitle ) const } printf( "****************************************************************\n" ); - printf( "* Warning: python library for %s cannot be found:\n", moduleTitle.latin1() ); + printf( "* Warning: python library for %s cannot be found:\n", moduleTitle.toLatin1().constData() ); if (!isPyLib) - printf( "* No module named %s\n", moduleName( moduleTitle ).latin1() ); + printf( "* No module named %s\n", moduleName( moduleTitle ).toLatin1().constData() ); if (!isPyGuiLib) - printf( "* No module named %s\n", (moduleName( moduleTitle ) + QString("GUI")).latin1() ); + printf( "* No module named %s\n", (moduleName( moduleTitle ) + QString("GUI")).toLatin1().constData() ); printf( "****************************************************************\n" ); return true; } @@ -2488,7 +2498,7 @@ void LightApp_Application::onVisibilityChanged( bool visible ) const QObject* win = sender(); for ( WindowMap::ConstIterator itr = myWindows.begin(); itr != myWindows.end(); ++itr ) - if ( itr.data() == win ) + if ( itr.value() == win ) { myWindowsVisible[ itr.key() ] = visible; return; @@ -2502,7 +2512,7 @@ bool LightApp_Application::event( QEvent* e ) { if( e && e->type()==2000 ) { - QCustomEvent* ce = ( QCustomEvent* )e; + SALOME_CustomEvent* ce = ( SALOME_CustomEvent* )e; QString* d = ( QString* )ce->data(); if( SUIT_MessageBox::question(0, tr("WRN_WARNING"), d ? *d : "", diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index b061966ba..e357f0580 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -32,11 +32,11 @@ #include class LogWindow; -class OB_Browser; +//class OB_Browser; #ifndef DISABLE_PYCONSOLE - class PythonConsole; + class PyConsole_Console; #endif -class STD_Application; +//class STD_Application; class LightApp_WidgetContainer; class LightApp_Preferences; class LightApp_SelectionMgr; @@ -48,7 +48,7 @@ class CAM_Module; class QString; class QWidget; class QStringList; -class QPixmap; +//class QPixmap; #ifdef WIN32 #pragma warning( disable:4251 ) @@ -107,9 +107,9 @@ public: LightApp_SelectionMgr* selectionMgr() const; LogWindow* logWindow(); - OB_Browser* objectBrowser(); + //OB_Browser* objectBrowser(); #ifndef DISABLE_PYCONSOLE - PythonConsole* pythonConsole(); + PyConsole_Console* pythonConsole(); #endif virtual void updateObjectBrowser( const bool = true ); @@ -141,7 +141,7 @@ public: virtual void start(); - virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); + virtual void contextMenuPopup( const QString&, QMenu*, QString& ); virtual void createEmptyStudy(); diff --git a/src/LightApp/LightApp_DataModel.cxx b/src/LightApp/LightApp_DataModel.cxx index 702ef7b33..7b14e8786 100644 --- a/src/LightApp/LightApp_DataModel.cxx +++ b/src/LightApp/LightApp_DataModel.cxx @@ -28,11 +28,9 @@ #include "LightApp_Module.h" #include "LightApp_Application.h" -#include +// temporary commented +//#include -#include -#include -#include #include /*! @@ -99,8 +97,9 @@ void LightApp_DataModel::build() void LightApp_DataModel::updateWidgets() { LightApp_Application* app = dynamic_cast( module()->application() ); - if( app ) - app->objectBrowser()->updateTree( 0, false ); + // temporary commented + /*if( app ) + app->objectBrowser()->updateTree( 0, false );*/ } /*! @@ -114,8 +113,9 @@ void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* ) if( modelRoot ) { ch = modelRoot->children(); - for ( DataObjectListIterator it( ch ); it.current(); ++it ) - it.current()->setParent( 0 ); + QListIterator it( ch ); + while ( it.hasNext() ) + it.next()->setParent( 0 ); } build(); @@ -124,15 +124,19 @@ void LightApp_DataModel::update( LightApp_DataObject*, LightApp_Study* ) if( modelRoot ) { DataObjectList new_ch = modelRoot->children(); - for ( DataObjectListIterator it1( new_ch ); it1.current(); ++it1 ) - aMap.insert( it1.current(), 0 ); + QListIterator it1( new_ch ); + while ( it1.hasNext() ) + aMap.insert( it1.next(), 0 ); } updateWidgets(); - for( DataObjectListIterator it( ch ); it.current(); ++it ) - if( !aMap.contains( it.current() ) ) - delete it.current(); + QListIterator it( ch ); + while ( it.hasNext() ) { + SUIT_DataObject* aDO = it.next(); + if( !aMap.contains( aDO ) ) + delete aDO; + } } /*! diff --git a/src/LightApp/LightApp_DataObject.cxx b/src/LightApp/LightApp_DataObject.cxx index a4df6dfa8..378cf63b7 100644 --- a/src/LightApp/LightApp_DataObject.cxx +++ b/src/LightApp/LightApp_DataObject.cxx @@ -24,12 +24,8 @@ #include "CAM_DataModel.h" #include "CAM_Module.h" -#include -#include #include -#include - /*! Class: LightApp_DataObject::Key Level: Internal diff --git a/src/LightApp/LightApp_DataObject.h b/src/LightApp/LightApp_DataObject.h index 4d3613dad..ec2469b0b 100644 --- a/src/LightApp/LightApp_DataObject.h +++ b/src/LightApp/LightApp_DataObject.h @@ -22,9 +22,10 @@ #include "LightApp.h" #include "CAM_DataObject.h" -#include "CAM_DataModel.h" #include "CAM_RootObject.h" +class CAM_DataModel; + class LightApp_Study; /*!Description : Data Object has empty entry so it's children must redefine metod entry() and return some unique string*/ diff --git a/src/LightApp/LightApp_DataOwner.cxx b/src/LightApp/LightApp_DataOwner.cxx index dd3c22f16..6288ce1ec 100644 --- a/src/LightApp/LightApp_DataOwner.cxx +++ b/src/LightApp/LightApp_DataOwner.cxx @@ -19,10 +19,6 @@ #include "LightApp_DataOwner.h" -#include "LightApp_DataObject.h" - -#include - /*!Constructor. Initialize by \a theEntry.*/ LightApp_DataOwner::LightApp_DataOwner( const QString& theEntry ) : myEntry( theEntry ) diff --git a/src/LightApp/LightApp_DataSubOwner.cxx b/src/LightApp/LightApp_DataSubOwner.cxx index c64c739eb..fd8c6e014 100644 --- a/src/LightApp/LightApp_DataSubOwner.cxx +++ b/src/LightApp/LightApp_DataSubOwner.cxx @@ -18,8 +18,6 @@ // #include "LightApp_DataSubOwner.h" -#include "LightApp_DataObject.h" - /*!Constructor.Initialize by \a entry and \a index*/ LightApp_DataSubOwner::LightApp_DataSubOwner( const QString& entry, const int index ) : LightApp_DataOwner( entry ), diff --git a/src/LightApp/LightApp_Dialog.cxx b/src/LightApp/LightApp_Dialog.cxx index 27219f5f1..f05267c34 100644 --- a/src/LightApp/LightApp_Dialog.cxx +++ b/src/LightApp/LightApp_Dialog.cxx @@ -21,20 +21,23 @@ #include #include +#include -#include -#include -#include +#include +#include +#include +#include /*! Constructor */ LightApp_Dialog::LightApp_Dialog( QWidget* parent, const char* name, bool modal, - bool allowResize, const int f, WFlags wf ) -: QtxDialog( parent, name, modal, allowResize, f, wf ), + bool allowResize, const int f, Qt::WindowFlags wf ) +: QtxDialog( parent, modal, allowResize, f, wf ), myIsExclusive( true ), myIsBusy( false ) { + setObjectName( name ); setObjectPixmap( "LightApp", tr( "ICON_SELECT" ) ); } @@ -76,14 +79,14 @@ void LightApp_Dialog::updateButtons( const int _id ) aLast = myObjects.end(); for( ; anIt!=aLast; anIt++ ) { - QToolButton* but = (QToolButton*)anIt.data().myBtn; - if( but && but->isOn() ) + QToolButton* but = (QToolButton*)anIt.value().myBtn; + if( but && but->isChecked() ) { if( id==-1 ) id = anIt.key(); if( anIt.key()!=id ) - but->setOn( false ); + but->setChecked( false ); } } } @@ -130,7 +133,7 @@ void LightApp_Dialog::setObjectShown( const int id, const bool shown ) obj.myBtn->setShown( shown ); obj.myLabel->setShown( shown ); if( !shown ) - ( ( QToolButton* )obj.myBtn )->setOn( false ); + ( ( QToolButton* )obj.myBtn )->setChecked( false ); } } @@ -140,7 +143,7 @@ void LightApp_Dialog::setObjectShown( const int id, const bool shown ) */ bool LightApp_Dialog::isObjectShown( const int id ) const { - return myObjects.contains( id ) && myObjects[ id ].myEdit->isShown(); + return myObjects.contains( id ) && myObjects[ id ].myEdit->isVisible(); } /*! @@ -157,7 +160,7 @@ void LightApp_Dialog::setObjectEnabled( const int id, const bool en ) obj.myBtn->setEnabled( en ); // obj.myLabel->setEnabled( en ); if( !en ) - ( ( QToolButton* )obj.myBtn )->setOn( false ); + ( ( QToolButton* )obj.myBtn )->setChecked( false ); } } @@ -200,7 +203,7 @@ void LightApp_Dialog::selectObject( const QStringList& _names, ObjectMap::iterator anIt = myObjects.begin(), aLast = myObjects.end(); for( ; anIt!=aLast; anIt++ ) - if( anIt.data().myBtn->isOn() ) + if( anIt.value().myBtn->isChecked() ) selectObject( anIt.key(), _names, _types, _ids, update ); } @@ -338,8 +341,8 @@ int LightApp_Dialog::createObject( const QString& label, QWidget* parent, const myObjects[ nid ].myLabel = lab; QToolButton* but = new QToolButton( parent ); - but->setIconSet( QIconSet( myPixmap ) ); - but->setToggleButton( true ); + but->setIcon( QIcon( myPixmap ) ); + but->setCheckable( true ); but->setMaximumWidth( but->height() ); but->setMinimumWidth( but->height() ); connect( but, SIGNAL( toggled( bool ) ), this, SLOT( onToggled( bool ) ) ); @@ -542,7 +545,7 @@ void LightApp_Dialog::objectTypes( const int id, TypesList& list ) const */ void LightApp_Dialog::onToggled( bool on ) { - QButton* but = ( QButton* )sender(); + QAbstractButton* but = ( QAbstractButton* )sender(); int id = -1; if( !but ) @@ -551,7 +554,7 @@ void LightApp_Dialog::onToggled( bool on ) ObjectMap::const_iterator anIt = myObjects.begin(), aLast = myObjects.end(); for( ; anIt!=aLast && id==-1; anIt++ ) - if( anIt.data().myBtn==but ) + if( anIt.value().myBtn==but ) id = anIt.key(); if( id!=-1 ) @@ -637,7 +640,7 @@ void LightApp_Dialog::setObjectPixmap( const QPixmap& p ) ObjectMap::const_iterator anIt = myObjects.begin(), aLast = myObjects.end(); for( ; anIt!=aLast; anIt++ ) - ( ( QToolButton* )anIt.data().myBtn )->setIconSet( p ); + ( ( QToolButton* )anIt.value().myBtn )->setIcon( p ); } /*! @@ -687,7 +690,7 @@ void LightApp_Dialog::setNameIndication( const int id, const NameIndication ni ) aLast = myObjects.end(); for( ; anIt!=aLast; anIt++ ) { - anIt.data().myNI = ni; + anIt.value().myNI = ni; setReadOnly( anIt.key(), isReadOnly( anIt.key() ) ); aNext = anIt; aNext++; updateObject( anIt.key(), aNext==aLast ); @@ -759,7 +762,7 @@ QString LightApp_Dialog::countOfTypes( const TypesList& types ) const QMap::const_iterator aMIt = typesCount.begin(), aMLast = typesCount.end(); for( ; aMIt!=aMLast; aMIt++ ) - typeCount.append( QString( "%1 %2" ).arg( aMIt.data() ).arg( typeName( aMIt.key() ) ) ); + typeCount.append( QString( "%1 %2" ).arg( aMIt.value() ).arg( typeName( aMIt.key() ) ) ); return typeCount.join( ", " ); } @@ -789,7 +792,7 @@ const QString& LightApp_Dialog::typeName( const int type ) const */ void LightApp_Dialog::activateObject( const int theId ) { - if ( myObjects.contains( theId ) && !myObjects[ theId ].myBtn->isOn() ) + if ( myObjects.contains( theId ) && !myObjects[ theId ].myBtn->isChecked() ) myObjects[ theId ].myBtn->toggle(); } @@ -802,8 +805,8 @@ void LightApp_Dialog::deactivateAll() aLast = myObjects.end(); for( ; anIt!=aLast; anIt++ ) { - QToolButton* btn = ( QToolButton* )anIt.data().myBtn; - btn->setOn( false ); + QToolButton* btn = ( QToolButton* )anIt.value().myBtn; + btn->setChecked( false ); } } @@ -892,12 +895,12 @@ void LightApp_Dialog::onTextChanged( const QString& text ) ObjectMap::const_iterator anIt = myObjects.begin(), aLast = myObjects.end(); for( ; anIt!=aLast; anIt++ ) - if( anIt.data().myEdit == edit ) + if( anIt.value().myEdit == edit ) id = anIt.key(); if( id>=0 && !isReadOnly( id ) ) { - QStringList list = QStringList::split( " ", text ); + QStringList list = text.split( " ", QString::SkipEmptyParts ); emit objectChanged( id, list ); } } diff --git a/src/LightApp/LightApp_Dialog.h b/src/LightApp/LightApp_Dialog.h index 6e3b3b8a0..f4a3a81d8 100644 --- a/src/LightApp/LightApp_Dialog.h +++ b/src/LightApp/LightApp_Dialog.h @@ -25,12 +25,12 @@ #include "LightApp.h" #include -#include -#include -#include +#include +#include +#include class QLineEdit; -class QButton; +class QAbstractButton; class QLabel; class SUIT_ResourceMgr; @@ -52,7 +52,7 @@ class LIGHTAPP_EXPORT LightApp_Dialog : public QtxDialog Q_OBJECT public: - typedef QValueList TypesList; + typedef QList TypesList; typedef QMap SelectedObjects; enum ObjectWg @@ -76,7 +76,7 @@ public: public: LightApp_Dialog( QWidget* = 0, const char* = 0, bool = false, - bool = false, const int = Standard, WFlags = 0 ); + bool = false, const int = Standard, Qt::WindowFlags = 0 ); virtual ~LightApp_Dialog(); virtual void show(); @@ -272,12 +272,12 @@ private: private: typedef struct { - QLineEdit* myEdit; - QButton* myBtn; - QLabel* myLabel; - QStringList myNames, myIds; - TypesList myTypes, myPossibleTypes; - NameIndication myNI; + QLineEdit* myEdit; + QAbstractButton* myBtn; + QLabel* myLabel; + QStringList myNames, myIds; + TypesList myTypes, myPossibleTypes; + NameIndication myNI; } Object; diff --git a/src/LightApp/LightApp_Displayer.cxx b/src/LightApp/LightApp_Displayer.cxx index 0845d5cc9..8c92f18ef 100644 --- a/src/LightApp/LightApp_Displayer.cxx +++ b/src/LightApp/LightApp_Displayer.cxx @@ -29,7 +29,7 @@ #include #include -#include +#include #ifndef DISABLE_SALOMEOBJECT #include "SALOME_InteractiveObject.hxx" #endif @@ -88,11 +88,10 @@ void LightApp_Displayer::Redisplay( const QString& entry, const bool updateViewe if ( app ) { SUIT_Desktop* desk = app->desktop(); - QPtrList wnds = desk->windows(); - SUIT_ViewWindow* wnd; - for ( wnd = wnds.first(); wnd; wnd = wnds.next() ) + QListIterator itWnds( desk->windows() ); + while ( itWnds.hasNext() ) { - SUIT_ViewManager* vman = wnd->getViewManager(); + SUIT_ViewManager* vman = itWnds.next()->getViewManager(); if( !vman ) continue; @@ -123,7 +122,7 @@ void LightApp_Displayer::Erase( const QString& entry, const bool forced, SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); if ( vf ) { - SALOME_Prs* prs = vf->CreatePrs( entry.latin1() ); + SALOME_Prs* prs = vf->CreatePrs( entry.toLatin1() ); if ( prs ) { vf->Erase( prs, forced ); if ( updateViewer ) @@ -163,7 +162,7 @@ bool LightApp_Displayer::IsDisplayed( const QString& entry, SALOME_View* theView { #ifndef DISABLE_SALOMEOBJECT Handle( SALOME_InteractiveObject ) temp = new SALOME_InteractiveObject(); - temp->setEntry( entry.latin1() ); + temp->setEntry( entry.toLatin1() ); res = vf->isVisible( temp ); #endif } @@ -193,7 +192,7 @@ SALOME_Prs* LightApp_Displayer::buildPresentation( const QString& entry, SALOME_ SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView(); if ( vf ) - prs = vf->CreatePrs( entry.latin1() ); + prs = vf->CreatePrs( entry.toLatin1() ); return prs; } diff --git a/src/LightApp/LightApp_Driver.cxx b/src/LightApp/LightApp_Driver.cxx index 3676f2c89..08c1d2cdf 100644 --- a/src/LightApp/LightApp_Driver.cxx +++ b/src/LightApp/LightApp_Driver.cxx @@ -23,14 +23,11 @@ #include #include #include -#include -#include #include -#include #include -#include -#include +#include +#include #ifdef WIN32 #include @@ -84,7 +81,7 @@ bool LightApp_Driver::SaveDatasInFile( const char* theFileName, bool isMultiFile if(aFileBuffer == NULL) return false; - myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).dirPath( true ) + "/" ).latin1() ; + myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ; int aCurrentPos = 0; @@ -143,7 +140,7 @@ bool LightApp_Driver::ReadDatasFromFile( const char* theFileName, bool isMultiFi ifstream aFile(theFileName); #endif - myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).dirPath( true ) + "/" ).latin1() ; + myTmpDir = QDir::convertSeparators( QFileInfo( theFileName ).absolutePath() + "/" ).toLatin1().constData() ; aFile.seekg(0, ios::end); int aFileBufferSize = aFile.tellg(); diff --git a/src/LightApp/LightApp_EventFilter.cxx b/src/LightApp/LightApp_EventFilter.cxx index 77ab42c9f..c9c2f89a2 100644 --- a/src/LightApp/LightApp_EventFilter.cxx +++ b/src/LightApp/LightApp_EventFilter.cxx @@ -21,7 +21,7 @@ #include -#include +#include LightApp_EventFilter* LightApp_EventFilter::myFilter = NULL; diff --git a/src/LightApp/LightApp_EventFilter.h b/src/LightApp/LightApp_EventFilter.h index 16b43f767..32c30fa19 100644 --- a/src/LightApp/LightApp_EventFilter.h +++ b/src/LightApp/LightApp_EventFilter.h @@ -22,7 +22,7 @@ #include "LightApp.h" -#include +#include #if defined WIN32 #pragma warning( disable: 4251 ) diff --git a/src/LightApp/LightApp_GLSelector.cxx b/src/LightApp/LightApp_GLSelector.cxx index d7c14c59b..b7807e8ca 100644 --- a/src/LightApp/LightApp_GLSelector.cxx +++ b/src/LightApp/LightApp_GLSelector.cxx @@ -19,9 +19,9 @@ #include "LightApp_GLSelector.h" #include "LightApp_DataOwner.h" -#include "LightApp_DataObject.h" #include +#include /*!Constructor. Initialize by GLViewer_Viewer2d and SUIT_SelectionMgr.*/ LightApp_GLSelector::LightApp_GLSelector( GLViewer_Viewer2d* viewer, SUIT_SelectionMgr* mgr ) diff --git a/src/LightApp/LightApp_GLSelector.h b/src/LightApp/LightApp_GLSelector.h index b63601604..dd31ff1db 100644 --- a/src/LightApp/LightApp_GLSelector.h +++ b/src/LightApp/LightApp_GLSelector.h @@ -25,8 +25,7 @@ #include -#include -#include +#include class LightApp_DataObject; @@ -34,7 +33,7 @@ class LightApp_DataObject; \class LightApp_GLSelector Custom selector to get/set selection from GL viewer */ -class LIGHTAPP_EXPORT LightApp_GLSelector : public SUIT_Selector +class LIGHTAPP_EXPORT LightApp_GLSelector : public QObject, public SUIT_Selector { Q_OBJECT diff --git a/src/LightApp/LightApp_HDFDriver.cxx b/src/LightApp/LightApp_HDFDriver.cxx index 292cdd88b..20aba1ec5 100644 --- a/src/LightApp/LightApp_HDFDriver.cxx +++ b/src/LightApp/LightApp_HDFDriver.cxx @@ -18,7 +18,6 @@ // #include "LightApp_HDFDriver.h" -#include "HDFexplorer.hxx" #include "HDFOI.hxx" // OCCT Includes diff --git a/src/LightApp/LightApp_Module.cxx b/src/LightApp/LightApp_Module.cxx index 86be51db3..eac7e67a3 100644 --- a/src/LightApp/LightApp_Module.cxx +++ b/src/LightApp/LightApp_Module.cxx @@ -36,10 +36,12 @@ #include "LightApp_UpdateFlags.h" #include "LightApp_ShowHideOp.h" -#include "SUIT_Operation.h" #include #include +#include +#include #include +#include #ifndef DISABLE_VTKVIEWER #ifndef DISABLE_SALOMEOBJECT @@ -73,13 +75,14 @@ #endif #endif -#include +// temporary commented +//#include #include -#include -#include -#include +#include +#include +#include /*!Constructor.*/ LightApp_Module::LightApp_Module( const QString& name ) @@ -121,11 +124,12 @@ void LightApp_Module::viewManagers( QStringList& ) const } /*!Context menu popup.*/ -void LightApp_Module::contextMenuPopup( const QString& client, QPopupMenu* menu, QString& /*title*/ ) +void LightApp_Module::contextMenuPopup( const QString& client, QMenu* menu, QString& /*title*/ ) { - LightApp_Selection* sel = createSelection(); - sel->init( client, getApp()->selectionMgr() ); - popupMgr()->updatePopup( menu, sel ); + LightApp_Selection* sel = createSelection( client, getApp()->selectionMgr() ); + popupMgr()->setSelection( sel ); + popupMgr()->setMenu( menu ); + popupMgr()->updateMenu(); delete sel; } @@ -135,8 +139,9 @@ void LightApp_Module::contextMenuPopup( const QString& client, QPopupMenu* menu, void LightApp_Module::updateObjBrowser( bool theIsUpdateDataModel, SUIT_DataObject* theDataObject ) { - bool upd = getApp()->objectBrowser()->isAutoUpdate(); - getApp()->objectBrowser()->setAutoUpdate( false ); + // temporary commented + /*bool upd = getApp()->objectBrowser()->isAutoUpdate(); + getApp()->objectBrowser()->setAutoUpdate( false );*/ if( theIsUpdateDataModel ){ if( CAM_DataModel* aDataModel = dataModel() ){ @@ -151,8 +156,9 @@ void LightApp_Module::updateObjBrowser( bool theIsUpdateDataModel, } } } - getApp()->objectBrowser()->setAutoUpdate( upd ); - getApp()->objectBrowser()->updateTree( 0, false ); + // temporary commented + /*getApp()->objectBrowser()->setAutoUpdate( upd ); + getApp()->objectBrowser()->updateTree( 0, false );*/ } /*!NOT IMPLEMENTED*/ @@ -193,7 +199,7 @@ bool LightApp_Module::deactivateModule( SUIT_Study* study ) // abort all operations MapOfOperation::const_iterator anIt; for( anIt = myOperations.begin(); anIt != myOperations.end(); anIt++ ) { - anIt.data()->abort(); + anIt.value()->abort(); } return CAM_Module::activateModule( study ); @@ -236,8 +242,9 @@ void LightApp_Module::update( const int theFlags ) if( LightApp_DataModel* aModel = dynamic_cast( aDataModel ) ) aModel->update( 0, dynamic_cast( getApp()->activeStudy() ) ); } - if ( theFlags & UF_ObjBrowser ) - getApp()->objectBrowser()->updateTree( 0 ); + // temporary commented + /*if ( theFlags & UF_ObjBrowser ) + getApp()->objectBrowser()->updateTree( 0 );*/ if ( theFlags & UF_Controls ) updateControls(); if ( theFlags & UF_Viewer ) @@ -286,9 +293,9 @@ CAM_DataModel* LightApp_Module::createDataModel() } /*!Create and return instance of LightApp_Selection.*/ -LightApp_Selection* LightApp_Module::createSelection() const +LightApp_Selection* LightApp_Module::createSelection( const QString& client, LightApp_SelectionMgr* mgr ) const { - return new LightApp_Selection(); + return new LightApp_Selection( client, mgr ); } /*!NOT IMPLEMENTED*/ @@ -339,9 +346,9 @@ QtxPopupMgr* LightApp_Module::popupMgr() QString oneAndNotActive = "( count( $component ) = 1 ) and ( not( activeModule in $component ) )"; QString uniform = "true in $canBeDisplayed and %1 and ( activeModule = '%2' )"; uniform = uniform.arg( oneAndNotActive ).arg( name() ); - myPopupMgr->setRule( disp, /*QString( "( not isVisible ) and " ) + */ uniform, true ); - myPopupMgr->setRule( erase, /*QString( "( isVisible ) and " ) + */ uniform, true ); - myPopupMgr->setRule( dispOnly, uniform, true ); + myPopupMgr->setRule( disp, /*QString( "( not isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule ); + myPopupMgr->setRule( erase, /*QString( "( isVisible ) and " ) + */ uniform, QtxPopupMgr::VisibleRule ); + myPopupMgr->setRule( dispOnly, uniform, QtxPopupMgr::VisibleRule ); QStringList viewers; @@ -374,7 +381,7 @@ QtxPopupMgr* LightApp_Module::popupMgr() for( ; anIt!=aLast; anIt++ ) strViewers+=temp.arg( *anIt ); strViewers+="}"; - myPopupMgr->setRule( eraseAll, QString( "client in %1" ).arg( strViewers ), true ); + myPopupMgr->setRule( eraseAll, QString( "client in %1" ).arg( strViewers ), QtxPopupMgr::VisibleRule ); } } return myPopupMgr; @@ -519,7 +526,7 @@ void LightApp_Module::onOperationDestroyed() MapOfOperation::const_iterator anIt = myOperations.begin(), aLast = myOperations.end(); for( ; anIt!=aLast; anIt++ ) - if( anIt.data()==op ) + if( anIt.value()==op ) { myOperations.remove( anIt.key() ); break; diff --git a/src/LightApp/LightApp_Module.h b/src/LightApp/LightApp_Module.h index dbfed0b70..1911a32ff 100644 --- a/src/LightApp/LightApp_Module.h +++ b/src/LightApp/LightApp_Module.h @@ -32,8 +32,8 @@ class LightApp_Preferences; class LightApp_Selection; class LightApp_Operation; class LightApp_SwitchOp; -class LightApp_ShowHideOp; class LightApp_Displayer; +class LightApp_SelectionMgr; class SUIT_Study; class SUIT_DataObject; @@ -67,7 +67,7 @@ public: virtual void windows( QMap& ) const; virtual void viewManagers( QStringList& ) const; - virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& ); + virtual void contextMenuPopup( const QString&, QMenu*, QString& ); virtual void createPreferences(); @@ -88,7 +88,7 @@ public: virtual void studyActivated() {}; virtual LightApp_Displayer* displayer(); - virtual LightApp_Selection* createSelection() const; + virtual LightApp_Selection* createSelection( const QString&, LightApp_SelectionMgr* ) const; public slots: virtual bool activateModule( SUIT_Study* ); diff --git a/src/LightApp/LightApp_ModuleDlg.cxx b/src/LightApp/LightApp_ModuleDlg.cxx index d7777bdaa..7d8450dae 100644 --- a/src/LightApp/LightApp_ModuleDlg.cxx +++ b/src/LightApp/LightApp_ModuleDlg.cxx @@ -22,11 +22,10 @@ #include -#include -#include -#include -#include -#include +#include +#include +#include +#include #ifndef WIN32 using namespace std; @@ -109,17 +108,21 @@ static const char* const default_icon[] = { */ //============================================================================================================================== LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& component, const QPixmap icon ) - : QDialog ( parent, "ActivateModuleDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) + : QDialog ( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ) { + setObjectName( "ActivateModuleDlg" ); + setModal( true ); + QPixmap defaultIcon( ( const char** ) default_icon ); - setCaption( tr( "CAPTION" ) ); + setWindowTitle( tr( "CAPTION" ) ); setSizeGripEnabled( TRUE ); QGridLayout* ActivateModuleDlgLayout = new QGridLayout( this ); ActivateModuleDlgLayout->setMargin( 11 ); ActivateModuleDlgLayout->setSpacing( 6 ); // Module's name and icon - myComponentFrame = new QFrame( this, "myComponentFrame" ); + myComponentFrame = new QFrame( this ); + myComponentFrame->setObjectName( "myComponentFrame" ); myComponentFrame->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) ); myComponentFrame->setMinimumHeight( 100 ); myComponentFrame->setFrameStyle( QFrame::Box | QFrame::Sunken ); @@ -128,15 +131,17 @@ LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& compon myComponentFrameLayout->setMargin( 11 ); myComponentFrameLayout->setSpacing( 6 ); // --> icon - myComponentIcon = new QLabel( myComponentFrame, "myComponentIcon" ); + myComponentIcon = new QLabel( myComponentFrame ); + myComponentIcon->setObjectName( "myComponentIcon" ); myComponentIcon->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); myComponentIcon->setPixmap( !icon.isNull() ? icon : defaultIcon ); myComponentIcon->setScaledContents( false ); - myComponentIcon->setAlignment( AlignCenter ); + myComponentIcon->setAlignment( Qt::AlignCenter ); // --> name - myComponentLab = new QLabel( component, myComponentFrame, "myComponentLab" ); + myComponentLab = new QLabel( component, myComponentFrame ); + myComponentLab->setObjectName( "myComponentLab" ); QFont fnt = myComponentLab->font(); fnt.setBold( TRUE ); myComponentLab->setFont( fnt ); - myComponentLab->setAlignment( AlignCenter ); + myComponentLab->setAlignment( Qt::AlignCenter ); myComponentFrameLayout->addWidget( myComponentIcon, 0, 0 ); myComponentFrameLayout->addWidget( myComponentLab, 0, 1 ); @@ -146,13 +151,16 @@ LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& compon infoLayout->setMargin( 0 ); infoLayout->setSpacing( 6 ); // --> top line - QFrame* myLine1 = new QFrame( this, "myLine1" ); + QFrame* myLine1 = new QFrame( this ); + myLine1->setObjectName( "myLine1" ); myLine1->setFrameStyle( QFrame::HLine | QFrame::Plain ); // --> info label - myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this, "myInfoLabel" ); - myInfoLabel->setAlignment( AlignCenter ); + myInfoLabel = new QLabel( tr ("ActivateComponent_DESCRIPTION"), this ); + myInfoLabel->setObjectName( "myInfoLabel" ); + myInfoLabel->setAlignment( Qt::AlignCenter ); // --> bottom line - QFrame* myLine2 = new QFrame( this, "myLine2" ); + QFrame* myLine2 = new QFrame( this ); + myLine2->setObjectName( "myLine2" ); myLine2->setFrameStyle( QFrame::HLine | QFrame::Plain ); infoLayout->addStretch(); @@ -166,16 +174,20 @@ LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& compon btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 ); // --> New - myNewBtn = new QPushButton( tr( "NEW" ), this, "myNewBtn" ); + myNewBtn = new QPushButton( tr( "NEW" ), this ); + myNewBtn->setObjectName( "myNewBtn" ); myNewBtn->setDefault( true ); myNewBtn->setAutoDefault( true ); // --> Open - myOpenBtn = new QPushButton( tr( "OPEN" ), this, "myOpenBtn" ); + myOpenBtn = new QPushButton( tr( "OPEN" ), this ); + myOpenBtn->setObjectName( "myOpenBtn" ); myOpenBtn->setAutoDefault( true ); // --> Load - myLoadBtn = new QPushButton( tr( "LOAD" ), this, "myLoadBtn" ); + myLoadBtn = new QPushButton( tr( "LOAD" ), this ); + myLoadBtn->setObjectName( "myLoadBtn" ); myLoadBtn->setAutoDefault( true ); // --> Cancel - myCancelBtn = new QPushButton( tr( "CANCEL" ), this, "myCancelBtn" ); + myCancelBtn = new QPushButton( tr( "CANCEL" ), this ); + myCancelBtn->setObjectName( "myCancelBtn" ); myCancelBtn->setAutoDefault( true ); btnLayout->addWidget( myNewBtn ); @@ -186,9 +198,9 @@ LightApp_ModuleDlg::LightApp_ModuleDlg ( QWidget * parent, const QString& compon btnLayout->addStretch(); btnLayout->addWidget( myCancelBtn ); - ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 ); - ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 ); - ActivateModuleDlgLayout->addMultiCellLayout( btnLayout, 1, 1, 0, 1 ); + ActivateModuleDlgLayout->addWidget( myComponentFrame, 0, 0 ); + ActivateModuleDlgLayout->addLayout( infoLayout, 0, 1 ); + ActivateModuleDlgLayout->addLayout( btnLayout, 1, 0, 1, 2 ); // signals and slots connections connect( myNewBtn, SIGNAL( clicked() ), this, SLOT( onButtonClicked() ) ); diff --git a/src/LightApp/LightApp_ModuleDlg.h b/src/LightApp/LightApp_ModuleDlg.h index 9b818344c..867ee7675 100644 --- a/src/LightApp/LightApp_ModuleDlg.h +++ b/src/LightApp/LightApp_ModuleDlg.h @@ -26,8 +26,8 @@ #define LIGHTAPP_MODULEDLG_H #include "LightApp.h" -#include -#include +#include +#include class QFrame; class QLabel; diff --git a/src/LightApp/LightApp_NameDlg.cxx b/src/LightApp/LightApp_NameDlg.cxx index e1bca58ce..31246058c 100644 --- a/src/LightApp/LightApp_NameDlg.cxx +++ b/src/LightApp/LightApp_NameDlg.cxx @@ -21,15 +21,14 @@ // $Header$ #include -#include -#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #ifndef WIN32 using namespace std; @@ -40,48 +39,51 @@ using namespace std; */ LightApp_NameDlg::LightApp_NameDlg( QWidget* parent ) : QDialog( parent ? parent : NULL,//application()->desktop(), -"LightApp_NameDlg", -true, -WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +Qt::WindowTitleHint | Qt::WindowSystemMenuHint ) { - setCaption( tr("TLT_RENAME") ); + setObjectName( "LightApp_NameDlg" ); + setModal( true ); + + setWindowTitle( tr("TLT_RENAME") ); setSizeGripEnabled( TRUE ); QVBoxLayout* topLayout = new QVBoxLayout( this ); topLayout->setMargin( 11 ); topLayout->setSpacing( 6 ); /***************************************************************/ - QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setMargin( 0 ); GroupC1->layout()->setSpacing( 0 ); - QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1->layout() ); + QGroupBox* GroupC1 = new QGroupBox( this ); + GroupC1->setObjectName( "GroupC1" ); + QHBoxLayout* GroupC1Layout = new QHBoxLayout( GroupC1 ); GroupC1Layout->setAlignment( Qt::AlignTop ); GroupC1Layout->setMargin( 11 ); GroupC1Layout->setSpacing( 6 ); - QLabel* TextLabel = new QLabel( GroupC1, "TextLabel1" ); + QLabel* TextLabel = new QLabel( GroupC1 ); + TextLabel->setObjectName( "TextLabel1" ); TextLabel->setText( tr( "NAME_LBL" ) ); GroupC1Layout->addWidget( TextLabel ); - myLineEdit = new QLineEdit( GroupC1, "LineEdit1" ); + myLineEdit = new QLineEdit( GroupC1 ); + myLineEdit->setObjectName( "LineEdit1" ); myLineEdit->setMinimumSize( 250, 0 ); GroupC1Layout->addWidget( myLineEdit ); /***************************************************************/ - QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setMargin( 0 ); GroupButtons->layout()->setSpacing( 0 ); - QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() ); + QGroupBox* GroupButtons = new QGroupBox( this ); + GroupButtons->setObjectName( "GroupButtons" ); + QHBoxLayout* GroupButtonsLayout = new QHBoxLayout( GroupButtons ); GroupButtonsLayout->setAlignment( Qt::AlignTop ); GroupButtonsLayout->setMargin( 11 ); GroupButtonsLayout->setSpacing( 6 ); - myButtonOk = new QPushButton( GroupButtons, "buttonOk" ); + myButtonOk = new QPushButton( GroupButtons ); + myButtonOk->setObjectName( "buttonOk" ); myButtonOk->setText( tr( "BUT_OK" ) ); myButtonOk->setAutoDefault( TRUE ); myButtonOk->setDefault( TRUE ); GroupButtonsLayout->addWidget( myButtonOk ); GroupButtonsLayout->addStretch(); - myButtonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + myButtonCancel = new QPushButton( GroupButtons ); + myButtonCancel->setObjectName( "buttonCancel" ); myButtonCancel->setText( tr( "BUT_CANCEL" ) ); myButtonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( myButtonCancel ); @@ -128,7 +130,7 @@ QString LightApp_NameDlg::name() */ void LightApp_NameDlg::accept() { - if ( name().stripWhiteSpace().isEmpty() ) + if ( name().trimmed().isEmpty() ) return; QDialog::accept(); } diff --git a/src/LightApp/LightApp_NameDlg.h b/src/LightApp/LightApp_NameDlg.h index 45f64c15b..9f8f88bbb 100644 --- a/src/LightApp/LightApp_NameDlg.h +++ b/src/LightApp/LightApp_NameDlg.h @@ -27,7 +27,7 @@ #define LIGHTAPP_NAMEDLG_H #include "LightApp.h" -#include +#include class QLineEdit; class QPushButton; diff --git a/src/LightApp/LightApp_OBSelector.cxx b/src/LightApp/LightApp_OBSelector.cxx index 175356d91..c9716877d 100644 --- a/src/LightApp/LightApp_OBSelector.cxx +++ b/src/LightApp/LightApp_OBSelector.cxx @@ -22,12 +22,13 @@ #include "LightApp_DataObject.h" #include "LightApp_Application.h" -#include +// temporary commented +//#include #include #include -#include +#include #include @@ -35,12 +36,13 @@ Constructor */ LightApp_OBSelector::LightApp_OBSelector( OB_Browser* ob, SUIT_SelectionMgr* mgr ) -: SUIT_Selector( mgr, ob ), - myBrowser( ob ) + : SUIT_Selector( mgr/* temporary commented : , ob */ )/*,*/ + // temporary commented : myBrowser( ob ) { - if ( myBrowser ) { + // temporary commented + /*if ( myBrowser ) { connect( myBrowser, SIGNAL( selectionChanged() ), this, SLOT( onSelectionChanged() ) ); - } + }*/ setModified(); } @@ -75,16 +77,20 @@ void LightApp_OBSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const if ( !myBrowser ) return; DataObjectList objlist; - myBrowser->getSelected( objlist ); + // temporary commented + //myBrowser->getSelected( objlist ); LightApp_OBSelector* that = (LightApp_OBSelector*)this; - for ( DataObjectListIterator it( objlist ); it.current(); ++it ) + QListIterator it( objlist ); + while ( it.hasNext() ) { - LightApp_DataObject* obj = dynamic_cast( it.current() ); + LightApp_DataObject* obj = dynamic_cast( it.next() ); if ( obj && app->checkDataObject(obj) ) { #ifndef DISABLE_SALOMEOBJECT Handle(SALOME_InteractiveObject) aSObj = new SALOME_InteractiveObject - ( obj->entry(), obj->componentDataType(), obj->name() ); + ( obj->entry().toLatin1().constData(), + obj->componentDataType().toLatin1().constData(), + obj->name().toLatin1().constData() ); LightApp_DataOwner* owner = new LightApp_DataOwner( aSObj ); #else LightApp_DataOwner* owner = new LightApp_DataOwner( obj->entry() ); @@ -102,8 +108,10 @@ void LightApp_OBSelector::setSelection( const SUIT_DataOwnerPtrList& theList ) if ( !myBrowser ) return; - if( myEntries.count() == 0 || - myModifiedTime < myBrowser->getModifiedTime() ) + if( myEntries.count() == 0 + // temporary commented + /*|| + myModifiedTime < myBrowser->getModifiedTime()*/ ) fillEntries( myEntries ); DataObjectList objList; @@ -114,7 +122,8 @@ void LightApp_OBSelector::setSelection( const SUIT_DataOwnerPtrList& theList ) objList.append( myEntries[owner->entry()] ); } - myBrowser->setSelected( objList ); + // temporary commented + //myBrowser->setSelected( objList ); mySelectedList.clear(); } @@ -125,7 +134,7 @@ void LightApp_OBSelector::onSelectionChanged() mySelectedList.clear(); selectionChanged(); QTime t2 = QTime::currentTime(); - qDebug( QString( "selection time = %1 msecs" ).arg( t1.msecsTo( t2 ) ) ); + qDebug( QString( "selection time = %1 msecs" ).arg( t1.msecsTo( t2 ) ).toLatin1().constData() ); } /*!Fill entries.*/ @@ -136,13 +145,14 @@ void LightApp_OBSelector::fillEntries( QMap& enti if ( !myBrowser ) return; - for ( SUIT_DataObjectIterator it( myBrowser->getRootObject(), + // temporary commented + /*for ( SUIT_DataObjectIterator it( myBrowser->getRootObject(), SUIT_DataObjectIterator::DepthLeft ); it.current(); ++it ) { LightApp_DataObject* obj = dynamic_cast( it.current() ); if ( obj ) entires.insert( obj->entry(), obj ); - } + }*/ setModified(); } diff --git a/src/LightApp/LightApp_OBSelector.h b/src/LightApp/LightApp_OBSelector.h index f6811946c..9645e951b 100644 --- a/src/LightApp/LightApp_OBSelector.h +++ b/src/LightApp/LightApp_OBSelector.h @@ -24,6 +24,8 @@ #include #include +#include + class OB_Browser; class LightApp_DataObject; @@ -31,7 +33,7 @@ class LightApp_DataObject; \class LightApp_OBSelector Custom selector to get/set selection from object browser */ -class LIGHTAPP_EXPORT LightApp_OBSelector : public SUIT_Selector +class LIGHTAPP_EXPORT LightApp_OBSelector : public QObject, public SUIT_Selector { Q_OBJECT diff --git a/src/LightApp/LightApp_OCCSelector.h b/src/LightApp/LightApp_OCCSelector.h index 905267435..676485c9e 100644 --- a/src/LightApp/LightApp_OCCSelector.h +++ b/src/LightApp/LightApp_OCCSelector.h @@ -24,6 +24,8 @@ #include #include +#include + #include class Handle_AIS_InteractiveObject; @@ -32,7 +34,7 @@ class Handle_AIS_InteractiveObject; \class LightApp_OCCSelector Custom selector to get/set selection from OCC viewer */ -class LIGHTAPP_EXPORT LightApp_OCCSelector : public SUIT_Selector +class LIGHTAPP_EXPORT LightApp_OCCSelector : public QObject, public SUIT_Selector { Q_OBJECT diff --git a/src/LightApp/LightApp_Operation.cxx b/src/LightApp/LightApp_Operation.cxx index 86450eb81..a1ab32f96 100755 --- a/src/LightApp/LightApp_Operation.cxx +++ b/src/LightApp/LightApp_Operation.cxx @@ -23,14 +23,11 @@ #include #include #include -#include #include #include #include - -#include - +#include /*! * \brief Constructor @@ -265,7 +262,7 @@ void LightApp_Operation::setDialogActive( const bool active ) if( active ) { activateSelection(); - dlg()->setActiveWindow(); + dlg()->activateWindow(); } } } diff --git a/src/LightApp/LightApp_Operation.h b/src/LightApp/LightApp_Operation.h index 8afcda91a..ab01e890b 100755 --- a/src/LightApp/LightApp_Operation.h +++ b/src/LightApp/LightApp_Operation.h @@ -28,8 +28,6 @@ #include class LightApp_Module; -class LightApp_Application; -class LightApp_Operation; class LightApp_SelectionMgr; class LightApp_Dialog; class SUIT_Desktop; diff --git a/src/LightApp/LightApp_Preferences.cxx b/src/LightApp/LightApp_Preferences.cxx index 65a7ef490..beaa1afe4 100644 --- a/src/LightApp/LightApp_Preferences.cxx +++ b/src/LightApp/LightApp_Preferences.cxx @@ -21,10 +21,6 @@ #include "LightApp_Preferences.h" -#include - -#include - /*! Constructor.Initialize by resource manager and parent QWidget. */ @@ -68,7 +64,7 @@ bool LightApp_Preferences::hasModule( const QString& mod ) const { bool res = false; for ( PrefModuleMap::ConstIterator it = myPrefMod.begin(); it != myPrefMod.end() && !res; ++it ) - res = it.data() == mod; + res = it.value() == mod; return res; } diff --git a/src/LightApp/LightApp_Preferences.h b/src/LightApp/LightApp_Preferences.h index f3d791986..6a1b3dc1c 100644 --- a/src/LightApp/LightApp_Preferences.h +++ b/src/LightApp/LightApp_Preferences.h @@ -23,11 +23,9 @@ #define LIGHTAPP_PREFERENCES_H #include - -#include #include -#include +#include class QtxResourceMgr; diff --git a/src/LightApp/LightApp_PreferencesDlg.cxx b/src/LightApp/LightApp_PreferencesDlg.cxx index 204fc2f11..efb03ca15 100644 --- a/src/LightApp/LightApp_PreferencesDlg.cxx +++ b/src/LightApp/LightApp_PreferencesDlg.cxx @@ -26,29 +26,36 @@ #include -#include -#include -#include -#include +#include +#include +#include /*! Constructor. */ LightApp_PreferencesDlg::LightApp_PreferencesDlg( LightApp_Preferences* prefs, QWidget* parent ) -: QtxDialog( parent, 0, true, true, OK | Close | Apply ), +: QtxDialog( parent, true, true, OK | Close | Apply ), myPrefs( prefs ), mySaved ( false ) { - setCaption( tr( "CAPTION" ) ); + setWindowTitle( tr( "CAPTION" ) ); - QVBoxLayout* main = new QVBoxLayout( mainFrame(), 5 ); + QVBoxLayout* main = new QVBoxLayout( mainFrame() ); + main->setMargin( 5 ); + main->setSpacing( 5 ); - QVBox* base = new QVBox( mainFrame() ); - main->addWidget( base ); + QWidget* vbox = new QWidget( mainFrame() ); + main->addWidget( vbox ); - myPrefs->reparent( base, QPoint( 0, 0 ), true ); + QVBoxLayout *base = new QVBoxLayout( vbox ); + + myPrefs->setParent( vbox ); + myPrefs->move( QPoint( 0, 0 ) ); + myPrefs->show(); setFocusProxy( myPrefs ); + base->addWidget( myPrefs ); + setButtonPosition( Right, Close ); setDialogFlags( AlignOnce ); @@ -56,10 +63,10 @@ myPrefs( prefs ), mySaved ( false ) connect( this, SIGNAL( dlgHelp() ), this, SLOT( onHelp() ) ); connect( this, SIGNAL( dlgApply() ), this, SLOT( onApply() ) ); - QButton* defBtn = userButton( insertButton( tr( "DEFAULT_BTN_TEXT" ) ) ); + QAbstractButton* defBtn = userButton( insertButton( tr( "DEFAULT_BTN_TEXT" ) ) ); if ( defBtn ) connect( defBtn, SIGNAL( clicked() ), this, SLOT( onDefault() ) ); - QButton* impBtn = userButton( insertButton( tr( "IMPORT_BTN_TEXT" ) ) ); + QAbstractButton* impBtn = userButton( insertButton( tr( "IMPORT_BTN_TEXT" ) ) ); if( impBtn ) connect( impBtn, SIGNAL( clicked() ), this, SLOT( onImportPref() ) ); } @@ -72,7 +79,9 @@ LightApp_PreferencesDlg::~LightApp_PreferencesDlg() if ( !myPrefs ) return; - myPrefs->reparent( 0, QPoint( 0, 0 ), false ); + myPrefs->setParent( 0 ); + myPrefs->move( QPoint( 0, 0 ) ); + myPrefs->hide(); myPrefs = 0; } @@ -146,14 +155,16 @@ void LightApp_PreferencesDlg::onImportPref() if( !mgr ) return; - QFileDialog dlg( ".", "*", this, "" ); - dlg.setCaption( tr("IMPORT_PREFERENCES") ); - dlg.setShowHiddenFiles( true ); + QFileDialog dlg( this, tr("IMPORT_PREFERENCES"), ".", "*" ); + dlg.setObjectName( "" ); + //dlg.setShowHiddenFiles( true ); dlg.exec(); - QString fname = dlg.selectedFile(); - if( fname.isEmpty() ) + + QStringList files = dlg.selectedFiles(); + if ( files.isEmpty() ) return; + QString fname = files[0]; if( mgr->import( fname ) ) { myPrefs->retrieve(); diff --git a/src/LightApp/LightApp_Selection.cxx b/src/LightApp/LightApp_Selection.cxx index dde1c314e..8fe825ddd 100644 --- a/src/LightApp/LightApp_Selection.cxx +++ b/src/LightApp/LightApp_Selection.cxx @@ -24,31 +24,21 @@ #include "LightApp_Application.h" #include "LightApp_Displayer.h" +#include "CAM_Module.h" + #include "SUIT_Session.h" #include "SUIT_ViewWindow.h" +#include "SUIT_ViewManager.h" +#include "SUIT_Desktop.h" +#include "SUIT_Selector.h" /*! Constructor */ -LightApp_Selection::LightApp_Selection() +LightApp_Selection::LightApp_Selection( const QString& client, LightApp_SelectionMgr* mgr ) : myStudy( 0 ) -{ -} - -/*! - Destructor. -*/ -LightApp_Selection::~LightApp_Selection() -{ -} - -/*! - Initialization. -*/ -void LightApp_Selection::init( const QString& client, LightApp_SelectionMgr* mgr) { myPopupClient = client; - myStudy = 0; if( mgr ) { @@ -62,11 +52,13 @@ void LightApp_Selection::init( const QString& client, LightApp_SelectionMgr* mgr mgr->selected( sel, client ); //2) to take such owners from other popup clients that it's entry is different with every entry from current list - QPtrList aSelectors; + QList aSelectors; mgr->selectors( aSelectors ); - for( SUIT_Selector* selector = aSelectors.first(); selector; selector = aSelectors.next() ) + QListIterator it( aSelectors ); + while ( it.hasNext() ) { - qDebug( selector->type() ); + SUIT_Selector* selector = it.next(); + qDebug( selector->type().toLatin1().constData() ); if( selector->type()!=client ) { mgr->selected( cur_sel, selector->type() ); @@ -100,6 +92,13 @@ void LightApp_Selection::init( const QString& client, LightApp_SelectionMgr* mgr } } +/*! + Destructor. +*/ +LightApp_Selection::~LightApp_Selection() +{ +} + QString LightApp_Selection::referencedToEntry( const QString& entry ) const { return myStudy->referencedToEntry( entry ); @@ -114,17 +113,17 @@ int LightApp_Selection::count() const } /*! - Gets QtxValue(); + Gets QVariant(); */ -QtxValue LightApp_Selection::param( const int ind, const QString& p ) const +QVariant LightApp_Selection::parameter( const int ind, const QString& p ) const { LightApp_Application* app = dynamic_cast( myStudy ? myStudy->application() : 0 ); if( !( ind>=0 && indmoduleTitle( param( ind, "component" ).toString() ); + QString mod_name = app->moduleTitle( parameter( ind, "component" ).toString() ); LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false ); // false in last parameter means that now we doesn't load module, if it isn't loaded @@ -136,7 +135,7 @@ QtxValue LightApp_Selection::param( const int ind, const QString& p ) const LightApp_Displayer local_d; vis = local_d.IsDisplayed( myEntries[ ind ] ); } - return QtxValue( vis, 0 ); + return QVariant( vis ); } else if( p=="component" ) @@ -146,18 +145,18 @@ QtxValue LightApp_Selection::param( const int ind, const QString& p ) const else if( p=="isComponent" ) { - return QtxValue( myStudy->isComponent( myEntries[ ind ] ), 0 ); + return QVariant( myStudy->isComponent( myEntries[ ind ] ) ); } else if( p=="isReference" ) - return QtxValue( isReference( ind ), false ); + return QVariant( isReference( ind ) ); else if( p=="displayer" ) - return param( ind, "component" ); + return parameter( ind, "component" ); else if( p=="canBeDisplayed" ) { - QString mod_name = app->moduleTitle( param( ind, "component" ).toString() ); + QString mod_name = app->moduleTitle( parameter( ind, "component" ).toString() ); LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, false ); // false in last parameter means that now we doesn't load module, if it isn't loaded @@ -171,15 +170,15 @@ QtxValue LightApp_Selection::param( const int ind, const QString& p ) const //operations under object } - return QtxValue(); + return QVariant(); } /*! Gets global parameters. client, isActiveView, activeView etc. */ -QtxValue LightApp_Selection::globalParam( const QString& p ) const +QVariant LightApp_Selection::parameter( const QString& p ) const { - if ( p == "client" ) return QtxValue( myPopupClient ); + if ( p == "client" ) return QVariant( myPopupClient ); else if ( p == "activeModule" ) { LightApp_Application* app = dynamic_cast( myStudy->application() ); @@ -188,14 +187,14 @@ QtxValue LightApp_Selection::globalParam( const QString& p ) const if( !mod_name.isEmpty() ) return mod_name; else - return QtxValue(); + return QVariant(); } - else if ( p == "isActiveView" ) return QtxValue( (bool)activeVW() ); - else if ( p == "activeView" ) return QtxValue( activeViewType() ); + else if ( p == "isActiveView" ) return QVariant( (bool)activeVW() ); + else if ( p == "activeView" ) return QVariant( activeViewType() ); #ifndef WIN32 - else return QtxPopupMgr::Selection::globalParam( p ); + else return QtxPopupSelection::parameter( p ); #else - else return Selection::globalParam( p ); + else return QtxPopupSelection::parameter( p ); //Selection::parameter( p ); //? #endif } diff --git a/src/LightApp/LightApp_Selection.h b/src/LightApp/LightApp_Selection.h index 7756a767d..c95c53d9d 100644 --- a/src/LightApp/LightApp_Selection.h +++ b/src/LightApp/LightApp_Selection.h @@ -44,18 +44,17 @@ class SUIT_ViewWindow; It is able to return values of standard object properties (isVisible,isComponent,canBeDisplayed,isReference, etc) */ -class LIGHTAPP_EXPORT LightApp_Selection : public QtxPopupMgr::Selection +class LIGHTAPP_EXPORT LightApp_Selection : public QtxPopupSelection { public: - LightApp_Selection(); + LightApp_Selection( const QString&, LightApp_SelectionMgr* ); virtual ~LightApp_Selection(); - virtual void init( const QString&, LightApp_SelectionMgr* ); virtual void processOwner( const LightApp_DataOwner* ); virtual int count() const; - virtual QtxValue param( const int, const QString& ) const; - virtual QtxValue globalParam( const QString& ) const; + virtual QVariant parameter( const int, const QString& ) const; + virtual QVariant parameter( const QString& ) const; void setModuleName( const QString ); protected: diff --git a/src/LightApp/LightApp_SelectionMgr.cxx b/src/LightApp/LightApp_SelectionMgr.cxx index ca18b5759..3240a1abe 100644 --- a/src/LightApp/LightApp_SelectionMgr.cxx +++ b/src/LightApp/LightApp_SelectionMgr.cxx @@ -33,6 +33,7 @@ #include #include #include + #include #endif /*! @@ -95,7 +96,7 @@ void LightApp_SelectionMgr::selectedObjects( SALOME_ListIO& theList, const QStri if ( !entryMap.contains( checkEntry ) ) { if ( refEntry != entry ) { QString component = study->componentDataType( refEntry ); - theList.Append( new SALOME_InteractiveObject( refEntry, component, ""/*refobj->Name().c_str()*/ ) ); + theList.Append( new SALOME_InteractiveObject( refEntry.toLatin1().constData(), component.toLatin1().constData(), ""/*refobj->Name().c_str()*/ ) ); } else if( !owner->IO().IsNull() ) theList.Append( owner->IO() ); @@ -285,16 +286,16 @@ void LightApp_SelectionMgr::selectObjects( MapIOOfMapOfInteger theMapIO, bool ap { SUIT_DataOwnerPtrList aList; - MapIOOfMapOfInteger::Iterator it; - for ( it = theMapIO.begin(); it != theMapIO.end(); ++it ) + MapIOOfMapOfInteger::Iterator it(theMapIO); + for ( ; it.More(); it.Next() ) { - if ( it.data().IsEmpty() ) - aList.append( new LightApp_DataOwner( QString(it.key()->getEntry()) ) ); + if ( it.Value().IsEmpty() ) + aList.append( new LightApp_DataOwner( QString(it.Key()->getEntry()) ) ); else { int i; - for ( i = 1; i <= it.data().Extent(); i++ ) - aList.append( new LightApp_DataSubOwner( QString(it.key()->getEntry()), it.data()( i ) ) ); + for ( i = 1; i <= it.Value().Extent(); i++ ) + aList.append( new LightApp_DataSubOwner( QString(it.Key()->getEntry()), it.Value()( i ) ) ); } } @@ -307,7 +308,7 @@ void LightApp_SelectionMgr::selectObjects( MapIOOfMapOfInteger theMapIO, bool ap */ void LightApp_SelectionMgr::selectedSubOwners( MapEntryOfMapOfInteger& theMap ) { - theMap.clear(); + theMap.Clear(); TColStd_IndexedMapOfInteger anIndexes; @@ -319,11 +320,15 @@ void LightApp_SelectionMgr::selectedSubOwners( MapEntryOfMapOfInteger& theMap ) const LightApp_DataSubOwner* subOwner = dynamic_cast( (*itr).operator->() ); if ( subOwner ) { - if ( !theMap.contains( subOwner->entry() ) ) +#ifndef WNT + if ( !theMap.IsBound( TCollection_AsciiString(subOwner->entry().toLatin1().data()) ) ) +#else + if ( !theMap.IsBound( subOwner->entry().toLatin1().data() ) ) +#endif { anIndexes.Clear(); GetIndexes( subOwner->entry(), anIndexes ); - theMap.insert( subOwner->entry(), anIndexes ); + theMap.Bind( subOwner->entry().toLatin1().data(), anIndexes ); } } } diff --git a/src/LightApp/LightApp_SelectionMgr.h b/src/LightApp/LightApp_SelectionMgr.h index be758e079..ccc0c3eca 100644 --- a/src/LightApp/LightApp_SelectionMgr.h +++ b/src/LightApp/LightApp_SelectionMgr.h @@ -25,13 +25,15 @@ #ifndef DISABLE_SALOMEOBJECT #include - #include + #include + #include class SALOME_ListIO; class TColStd_IndexedMapOfInteger; class TColStd_MapOfInteger; + class TCollection_AsciiString; #else -#include +#include #endif class LightApp_Application; @@ -51,8 +53,8 @@ public: LightApp_Application* application() const; #ifndef DISABLE_SALOMEOBJECT - typedef QMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger; - typedef QMap< QString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger; + typedef NCollection_DataMap< Handle(SALOME_InteractiveObject), TColStd_IndexedMapOfInteger > MapIOOfMapOfInteger; + typedef NCollection_DataMap< TCollection_AsciiString, TColStd_IndexedMapOfInteger > MapEntryOfMapOfInteger; void selectedObjects( SALOME_ListIO&, const QString& = QString::null, const bool = true ) const; void setSelectedObjects( const SALOME_ListIO&, const bool = false ); diff --git a/src/LightApp/LightApp_ShowHideOp.cxx b/src/LightApp/LightApp_ShowHideOp.cxx index 657e30d9d..22762198d 100644 --- a/src/LightApp/LightApp_ShowHideOp.cxx +++ b/src/LightApp/LightApp_ShowHideOp.cxx @@ -19,11 +19,9 @@ #include "LightApp_ShowHideOp.h" #include "LightApp_Application.h" -#include "LightApp_DataOwner.h" #include "LightApp_Module.h" #include "LightApp_Study.h" #include "LightApp_Displayer.h" -#include "CAM_Study.h" #include "LightApp_SelectionMgr.h" #include "LightApp_Selection.h" @@ -67,11 +65,10 @@ void LightApp_ShowHideOp::startOperation() if( !mod ) return; - LightApp_Selection* sel = mod->createSelection(); + LightApp_Selection* sel = mod->createSelection( "", mgr ); if( !sel ) return; - sel->init( "", mgr ); if( sel->count()==0 && myActionType!=ERASE_ALL ) { abort(); @@ -81,7 +78,7 @@ void LightApp_ShowHideOp::startOperation() QString mod_name; if( sel->count()>0 ) { - QString aStr = sel->param( 0, "displayer" ).toString(); + QString aStr = sel->parameter( 0, "displayer" ).toString(); mod_name = app->moduleTitle( aStr ); } else if( app->activeModule() ) diff --git a/src/LightApp/LightApp_ShowHideOp.h b/src/LightApp/LightApp_ShowHideOp.h index 687c16dd2..52266e824 100644 --- a/src/LightApp/LightApp_ShowHideOp.h +++ b/src/LightApp/LightApp_ShowHideOp.h @@ -22,8 +22,6 @@ #include "LightApp_Operation.h" -class LightApp_Displayer; - /*! \class LightApp_ShowHideOp Standard operation allowing to show/hide selected objects diff --git a/src/LightApp/LightApp_Study.cxx b/src/LightApp/LightApp_Study.cxx index a37df3ba7..6c3ae1bad 100644 --- a/src/LightApp/LightApp_Study.cxx +++ b/src/LightApp/LightApp_Study.cxx @@ -19,6 +19,7 @@ #include "LightApp_Study.h" #include "CAM_DataModel.h" +#include "CAM_Module.h" #include "LightApp_Application.h" #include "LightApp_DataModel.h" #include "LightApp_DataObject.h" @@ -28,21 +29,8 @@ #include "SUIT_ResourceMgr.h" #include "SUIT_DataObjectIterator.h" -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - #include -#include +#include /*! Constructor. @@ -65,16 +53,18 @@ LightApp_Study::~LightApp_Study() /*! Create document. */ -void LightApp_Study::createDocument() +bool LightApp_Study::createDocument( const QString& theStr ) { setStudyName( QString( "Study%1" ).arg( LightApp_Application::studyId() ) ); // create myRoot setRoot( new LightApp_RootObject( this ) ); - CAM_Study::createDocument(); + bool aRet = CAM_Study::createDocument( theStr ); emit created( this ); + + return aRet; } /*! @@ -92,8 +82,9 @@ bool LightApp_Study::openDocument( const QString& theFileName ) // update loaded data models: call open() and update() on them. ModelList dm_s; dataModels( dm_s ); - for ( ModelListIterator it( dm_s ); it.current(); ++it ) - openDataModel( studyName(), it.current() ); + QListIterator it( dm_s ); + while ( it.hasNext() ) + openDataModel( studyName(), it.next() ); // this will build a SUIT_DataObject-s tree under myRoot member field // passing "false" in order NOT to rebuild existing data models' trees - it was done in previous step // but tree that corresponds to not-loaded data models will be updated any way. @@ -122,8 +113,9 @@ bool LightApp_Study::loadDocument( const QString& theStudyName ) ModelList dm_s; dataModels( dm_s ); - for ( ModelListIterator it( dm_s ); it.current(); ++it ) - openDataModel( studyName(), it.current() ); + QListIterator it( dm_s ); + while ( it.hasNext() ) + openDataModel( studyName(), it.next() ); // this will build a SUIT_DataObject-s tree under myRoot member field // passing "false" in order NOT to rebuild existing data models' trees - it was done in previous step @@ -148,13 +140,15 @@ bool LightApp_Study::saveDocumentAs( const QString& theFileName ) ModelList list; dataModels( list ); - LightApp_DataModel* aModel = (LightApp_DataModel*)list.first(); - QStringList listOfFiles; bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); - for ( ; aModel; aModel = (LightApp_DataModel*)list.next() ) + QListIterator itList( list ); + while ( itList.hasNext() ) { - std::vector anOldList = myDriver->GetListOfFiles( aModel->module()->name() ); + LightApp_DataModel* aModel = (LightApp_DataModel*)itList.next(); + if ( !aModel ) continue; + + std::vector anOldList = myDriver->GetListOfFiles( aModel->module()->name().toLatin1().constData() ); listOfFiles.clear(); aModel->saveAs( theFileName, this, listOfFiles ); if ( !listOfFiles.isEmpty() ) @@ -165,7 +159,7 @@ bool LightApp_Study::saveDocumentAs( const QString& theFileName ) // removing previous temporary files. These files are not removed before saving // because they may be required for it. - std::vector aNewList = myDriver->GetListOfFiles( aModel->module()->name() ); + std::vector aNewList = myDriver->GetListOfFiles( aModel->module()->name().toLatin1().constData() ); std::set aNewNames; std::set toRemove; @@ -205,11 +199,13 @@ bool LightApp_Study::saveDocument() { ModelList list; dataModels( list ); - LightApp_DataModel* aModel = (LightApp_DataModel*)list.first(); - myDriver->ClearDriverContents(); QStringList listOfFiles; - for ( ; aModel; aModel = (LightApp_DataModel*)list.next() ) { + QListIterator itList( list ); + while ( itList.hasNext() ) { + LightApp_DataModel* aModel = (LightApp_DataModel*)itList.next(); + if ( !aModel ) continue; + listOfFiles.clear(); aModel->save( listOfFiles ); saveModuleData(aModel->module()->name(), listOfFiles); @@ -298,8 +294,9 @@ bool LightApp_Study::isModified() const ModelList list; dataModels( list ); LightApp_DataModel* aModel = 0; - for ( QPtrListIterator it( list ); it.current() && !isAnyChanged; ++it ){ - aModel = dynamic_cast( it.current() ); + QListIterator it( list ); + while ( it.hasNext() && !isAnyChanged ) { + aModel = dynamic_cast( it.next() ); if ( aModel ) isAnyChanged = aModel->isModified(); } @@ -335,10 +332,10 @@ void LightApp_Study::saveModuleData(QString theModuleName, QStringList theListOf for ( QStringList::Iterator it = theListOfFiles.begin(); it != theListOfFiles.end(); ++it ) { if ( (*it).isEmpty() ) continue; - aListOfFiles[anIndex] = (*it).latin1(); + aListOfFiles[anIndex] = (*it).toLatin1().constData(); anIndex++; } - myDriver->SetListOfFiles(theModuleName, aListOfFiles); + myDriver->SetListOfFiles(theModuleName.toLatin1().constData(), aListOfFiles); } /*! @@ -346,7 +343,7 @@ void LightApp_Study::saveModuleData(QString theModuleName, QStringList theListOf */ void LightApp_Study::openModuleData(QString theModuleName, QStringList& theListOfFiles) { - std::vector aListOfFiles = myDriver->GetListOfFiles(theModuleName); + std::vector aListOfFiles = myDriver->GetListOfFiles(theModuleName.toLatin1().constData()); int i, aLength = aListOfFiles.size() - 1; if (aLength < 0) return; @@ -368,7 +365,7 @@ bool LightApp_Study::saveStudyData( const QString& theFileName ) return false; bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); - bool aRes = myDriver->SaveDatasInFile(theFileName.latin1(), isMultiFile); + bool aRes = myDriver->SaveDatasInFile(theFileName.toLatin1(), isMultiFile); return aRes; } @@ -382,7 +379,7 @@ bool LightApp_Study::openStudyData( const QString& theFileName ) return false; bool isMultiFile = resMgr->booleanValue( "Study", "multi_file", false ); - bool aRes = myDriver->ReadDatasFromFile(theFileName.latin1(), isMultiFile); + bool aRes = myDriver->ReadDatasFromFile(theFileName.toLatin1(), isMultiFile); return aRes; } diff --git a/src/LightApp/LightApp_Study.h b/src/LightApp/LightApp_Study.h index b9de680b8..c45394d47 100644 --- a/src/LightApp/LightApp_Study.h +++ b/src/LightApp/LightApp_Study.h @@ -23,12 +23,11 @@ #include #include -#include -#include #include "string" #include "vector" +class SUIT_Study; class SUIT_Application; class CAM_DataModel; @@ -45,7 +44,7 @@ public: LightApp_Study( SUIT_Application* ); virtual ~LightApp_Study(); - virtual void createDocument(); + virtual bool createDocument( const QString& ); virtual bool openDocument( const QString& ); virtual bool loadDocument( const QString& ); diff --git a/src/LightApp/LightApp_SwitchOp.cxx b/src/LightApp/LightApp_SwitchOp.cxx index 67283f365..8fc5baf7f 100755 --- a/src/LightApp/LightApp_SwitchOp.cxx +++ b/src/LightApp/LightApp_SwitchOp.cxx @@ -24,10 +24,11 @@ #include #include #include -#include -#include -#include -#include + +#include +#include +#include +#include /*! * \brief Constructor @@ -93,14 +94,16 @@ LightApp_Operation* LightApp_SwitchOp::operation( QWidget* theWg ) const // try to find operation corresponding to the dialog if ( aDlg != 0 && study() != 0 ) { - QPtrListIterator anIter( study()->operations() ); - while( SUIT_Operation* anOp = anIter.current() ) + QListIterator anIter( study()->operations() ); + while( anIter.hasNext() ) { - if ( anOp->inherits( "LightApp_Operation" ) && + SUIT_Operation* anOp = anIter.next(); + + if ( anOp && + anOp->inherits( "LightApp_Operation" ) && ((LightApp_Operation*)anOp)->dlg() == aDlg ) return ((LightApp_Operation*)anOp); - ++anIter; - } + } } return 0; diff --git a/src/LightApp/LightApp_SwitchOp.h b/src/LightApp/LightApp_SwitchOp.h index a85d2e3da..857644e3b 100755 --- a/src/LightApp/LightApp_SwitchOp.h +++ b/src/LightApp/LightApp_SwitchOp.h @@ -21,7 +21,7 @@ #define LightApp_SwitchOp_H #include "LightApp.h" -#include +#include class LightApp_Module; class LightApp_Operation; diff --git a/src/LightApp/LightApp_VTKSelector.cxx b/src/LightApp/LightApp_VTKSelector.cxx index 99214fb9f..bd4c4100d 100644 --- a/src/LightApp/LightApp_VTKSelector.cxx +++ b/src/LightApp/LightApp_VTKSelector.cxx @@ -19,6 +19,8 @@ #include "LightApp_VTKSelector.h" #include "LightApp_DataOwner.h" +#include "SUIT_Desktop.h" + #ifndef DISABLE_VTKVIEWER #include "SVTK_ViewModelBase.h" #include "SVTK_ViewManager.h" @@ -224,7 +226,7 @@ LightApp_VTKSelector aSelector->AddOrRemoveIndex(anIO,anOwner->GetIds(),false); }else if(const LightApp_DataOwner* anOwner = dynamic_cast(aDataOwner)){ Handle(SALOME_InteractiveObject) anIO = - new SALOME_InteractiveObject(anOwner->entry().latin1(),""); + new SALOME_InteractiveObject(anOwner->entry().toLatin1(),""); aSelector->AddIObject(anIO); anAppendList.Append(anIO); } @@ -243,7 +245,7 @@ LightApp_VTKSelector QMap< QString, Handle( SALOME_InteractiveObject )>::const_iterator RIt = toRemove.begin(), REnd = toRemove.end(); for( ; RIt!=REnd; RIt++ ) - aSelector->RemoveIObject( RIt.data() ); + aSelector->RemoveIObject( RIt.value() ); aView->onSelectionChanged(); } diff --git a/src/LightApp/LightApp_VTKSelector.h b/src/LightApp/LightApp_VTKSelector.h index 0f185cc53..ff68f3507 100644 --- a/src/LightApp/LightApp_VTKSelector.h +++ b/src/LightApp/LightApp_VTKSelector.h @@ -23,10 +23,11 @@ #include "LightApp.h" #include "LightApp_DataOwner.h" +#include + class SUIT_Desktop; #ifndef DISABLE_VTKVIEWER - #include #include #include "SVTK_Selection.h" #ifndef DISABLE_SALOMEOBJECT @@ -73,7 +74,7 @@ class LIGHTAPP_EXPORT LightApp_SVTKDataOwner : public LightApp_DataOwner \class LightApp_VTKSelector Custom selector to get/set selection from object browser */ -class LIGHTAPP_EXPORT LightApp_VTKSelector : public SUIT_Selector +class LIGHTAPP_EXPORT LightApp_VTKSelector : public QObject, public SUIT_Selector { Q_OBJECT; diff --git a/src/LightApp/LightApp_WidgetContainer.cxx b/src/LightApp/LightApp_WidgetContainer.cxx index aa6f831d2..e6ac9401f 100644 --- a/src/LightApp/LightApp_WidgetContainer.cxx +++ b/src/LightApp/LightApp_WidgetContainer.cxx @@ -18,17 +18,18 @@ // #include "LightApp_WidgetContainer.h" -#include -#include +#include +#include /*! Constructor. */ LightApp_WidgetContainer::LightApp_WidgetContainer( const int type, QWidget* parent ) -: QDockWindow( QDockWindow::InDock, parent ), -myType( type ) + : QDockWidget( /*QDockWindow::InDock,*/ parent ), + myType( type ) { - setWidget( myStack = new QWidgetStack( this ) ); + setObjectName(QString("WC_%1").arg(type)); + setWidget( myStack = new QStackedWidget( this ) ); myStack->show(); } @@ -44,14 +45,16 @@ LightApp_WidgetContainer::~LightApp_WidgetContainer() */ bool LightApp_WidgetContainer::isEmpty() const { - const QObjectList* lst = myStack->children(); - if ( !lst ) + const QList lst = myStack->children(); + if ( lst.isEmpty() ) return true; bool res = true; - for ( QObjectListIt it( *lst ); it.current() && res; ++it ) + QListIterator it( lst ); + while ( it.hasNext() && res ) { - if ( it.current()->isWidgetType() && myStack->id( (QWidget*)it.current() ) != -1 ) + QObject* anItem = it.next(); + if ( anItem->isWidgetType() && myStack->indexOf( (QWidget*)anItem ) != -1 ) res = false; } return res; @@ -85,11 +88,11 @@ int LightApp_WidgetContainer::insert( const int id, QWidget* wid ) if ( contains( id ) ) remove( id ); - int stackId = myStack->addWidget( wid, id ); - if ( !myStack->visibleWidget() ) - myStack->raiseWidget( wid ); + int stackId = myStack->insertWidget( id, wid ); + if ( !myStack->currentWidget() ) + myStack->setCurrentWidget( wid ); - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); + setWindowTitle( myStack->currentWidget() ? myStack->currentWidget()->windowTitle() : QString::null ); return stackId; } @@ -101,7 +104,7 @@ void LightApp_WidgetContainer::remove( const int id ) { remove( myStack->widget( id ) ); - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); + setWindowTitle( myStack->currentWidget() ? myStack->currentWidget()->windowTitle() : QString::null ); } /*! @@ -111,7 +114,7 @@ void LightApp_WidgetContainer::remove( QWidget* wid ) { myStack->removeWidget( wid ); - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); + setWindowTitle( myStack->currentWidget() ? myStack->currentWidget()->windowTitle() : QString::null ); } /*! @@ -119,9 +122,9 @@ void LightApp_WidgetContainer::remove( QWidget* wid ) */ void LightApp_WidgetContainer::activate( const int id ) { - myStack->raiseWidget( id ); + myStack->setCurrentIndex( id ); - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); + setWindowTitle( myStack->currentWidget() ? myStack->currentWidget()->windowTitle() : QString::null ); } /*! @@ -129,9 +132,9 @@ void LightApp_WidgetContainer::activate( const int id ) */ void LightApp_WidgetContainer::activate( QWidget* wid ) { - myStack->raiseWidget( wid ); + myStack->setCurrentWidget( wid ); - setCaption( myStack->visibleWidget() ? myStack->visibleWidget()->caption() : QString::null ); + setWindowTitle( myStack->currentWidget() ? myStack->currentWidget()->windowTitle() : QString::null ); } /*! @@ -147,5 +150,5 @@ QWidget* LightApp_WidgetContainer::widget( const int id ) const */ QWidget* LightApp_WidgetContainer::active() const { - return myStack->visibleWidget(); + return myStack->currentWidget(); } diff --git a/src/LightApp/LightApp_WidgetContainer.h b/src/LightApp/LightApp_WidgetContainer.h index 1679ec0c7..8fc496f7e 100644 --- a/src/LightApp/LightApp_WidgetContainer.h +++ b/src/LightApp/LightApp_WidgetContainer.h @@ -21,15 +21,15 @@ #include "LightApp.h" -#include +#include class QWidget; -class QWidgetStack; +class QStackedWidget; /*! Class which privade widget container. */ -class LIGHTAPP_EXPORT LightApp_WidgetContainer : public QDockWindow +class LIGHTAPP_EXPORT LightApp_WidgetContainer : public QDockWidget { Q_OBJECT @@ -53,8 +53,8 @@ public: QWidget* widget( const int ) const; private: - int myType; - QWidgetStack* myStack; + int myType; + QStackedWidget* myStack; }; #endif diff --git a/src/LightApp/Makefile.am b/src/LightApp/Makefile.am index b15ed5e42..3eeb30824 100755 --- a/src/LightApp/Makefile.am +++ b/src/LightApp/Makefile.am @@ -154,7 +154,7 @@ nodist_salomeres_DATA= \ libLightApp_la_CPPFLAGS=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(CAS_CPPFLAGS) \ $(HDF5_INCLUDES) @KERNEL_CXXFLAGS@ -I$(srcdir)/../SUIT -I$(srcdir)/../STD \ -I$(srcdir)/../CAM -I$(srcdir)/../ObjBrowser -I$(srcdir)/../LogWindow \ - -I$(srcdir)/../Prs -I$(srcdir)/../Qtx + -I$(srcdir)/../Prs -I$(srcdir)/../Qtx -I$(srcdir)/../Event libLightApp_la_LDFLAGS=$(QT_MT_LIBS) if ENABLE_VTKVIEWER @@ -173,7 +173,7 @@ else !ENABLE_OCCVIEWER libLightApp_la_CPPFLAGS+= -DDISABLE_OCCVIEWER endif if ENABLE_PYCONSOLE - libLightApp_la_CPPFLAGS+= $(PYTHON_INCLUDES) -I$(srcdir)/../PythonConsole -I$(srcdir)/../PyInterp + libLightApp_la_CPPFLAGS+= $(PYTHON_INCLUDES) -I$(srcdir)/../PyConsole -I$(srcdir)/../PyInterp libLightApp_la_LDFLAGS+= $(PYTHON_LIBS) else !ENABLE_PYCONSOLE libLightApp_la_CPPFLAGS+= -DDISABLE_PYCONSOLE @@ -207,8 +207,9 @@ else !ENABLE_SALOMEOBJECT endif libLightApp_la_LIBADD= ../SUIT/libsuit.la ../STD/libstd.la ../CAM/libCAM.la \ - ../ObjBrowser/libObjBrowser.la ../LogWindow/libLogWindow.la $(CAS_KERNEL) \ + ../LogWindow/libLogWindow.la $(CAS_KERNEL) \ ../Prs/libSalomePrs.la $(HDF5_LIBS) $(KERNEL_LDFLAGS) -lSalomeHDFPersist +#../ObjBrowser/libObjBrowser.la if ENABLE_SALOMEOBJECT libLightApp_la_LIBADD+= ../OBJECT/libSalomeObject.la @@ -229,14 +230,14 @@ if ENABLE_GLVIEWER libLightApp_la_LIBADD+= ../GLViewer/libGLViewer.la endif if ENABLE_PLOT2DVIEWER - libLightApp_la_LIBADD+= ../Plot2d/libPlot2d.la +# libLightApp_la_LIBADD+= ../Plot2d/libPlot2d.la if ENABLE_SALOMEOBJECT - libLightApp_la_LIBADD+= ../SPlot2d/libSPlot2d.la +# libLightApp_la_LIBADD+= ../SPlot2d/libSPlot2d.la endif endif if ENABLE_PYCONSOLE - libLightApp_la_LIBADD+= ../PyInterp/libPyInterp.la ../PythonConsole/libPythonConsole.la + libLightApp_la_LIBADD+= ../PyInterp/libPyInterp.la ../PyConsole/libPyConsole.la endif if ENABLE_SUPERVGRAPHVIEWER - libLightApp_la_LIBADD+= ../SUPERVGraph/libSUPERVGraph.la +# libLightApp_la_LIBADD+= ../SUPERVGraph/libSUPERVGraph.la endif diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index fa3b06bd7..5b2cab2f1 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -38,6 +38,7 @@
+ diff --git a/src/Makefile.am b/src/Makefile.am index cdb117acc..2f375f53c 100755 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -91,7 +91,7 @@ endif # VSR: this is the original packages list #SUBDIRS += Event LightApp ResExporter # VSR: already migrated to Qt4 packages -SUBDIRS += Event ResExporter +SUBDIRS += Event LightApp ResExporter if GUI_ENABLE_CORBA # VSR: this is the original packages list