From: asl Date: Mon, 3 Apr 2006 10:14:02 +0000 (+0000) Subject: 1) if there is only one module, then toolbar and combobox with modules aren`t created X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e2f453ef4970ea70ad0eb9e2c35096aafbf53b06;p=modules%2Fgui.git 1) if there is only one module, then toolbar and combobox with modules aren`t created 2) `refresh` command is removed temporary 3) extension of files is `*.xml` temporary --- diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 6e461adc0..9cdc71850 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -445,63 +445,68 @@ void LightApp_Application::createActions() if ( modIcon.isNull() ) modIcon = QPixmap( imageEmptyIcon ); - QToolBar* modTBar = new QtxToolBar( true, desk ); - modTBar->setLabel( tr( "INF_TOOLBAR_MODULES" ) ); + if( aModuleList.count()>1 ) + { + QToolBar* modTBar = new QtxToolBar( true, desk ); + modTBar->setLabel( tr( "INF_TOOLBAR_MODULES" ) ); - QActionGroup* modGroup = new QActionGroup( this ); - modGroup->setExclusive( true ); - modGroup->setUsesDropDown( true ); + QActionGroup* modGroup = new QActionGroup( this ); + modGroup->setExclusive( true ); + modGroup->setUsesDropDown( true ); - a = createAction( -1, tr( "APP_NAME" ), defIcon, tr( "APP_NAME" ), - tr( "PRP_APP_MODULE" ), 0, desk, true ); - modGroup->add( a ); - myActions.insert( QString(), a ); + a = createAction( -1, tr( "APP_NAME" ), defIcon, tr( "APP_NAME" ), + tr( "PRP_APP_MODULE" ), 0, desk, true ); + modGroup->add( a ); + myActions.insert( QString(), a ); - QMap iconMap; - moduleIconNames( iconMap ); + QMap iconMap; + moduleIconNames( iconMap ); - const int iconSize = 20; + 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; - } - delete l; + 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; + } + + delete l; - modTBar->addSeparator(); + modTBar->addSeparator(); - QStringList modList; - modules( modList, false ); + QStringList modList; + modules( modList, false ); - for ( it = modList.begin(); it != modList.end(); ++it ) - { - if ( !isLibExists( *it ) ) - continue; + for ( it = modList.begin(); it != modList.end(); ++it ) + { + if ( !isLibExists( *it ) ) + continue; - QString iconName; - if ( iconMap.contains( *it ) ) - iconName = iconMap[*it]; + QString iconName; + if ( iconMap.contains( *it ) ) + iconName = iconMap[*it]; - QString modName = moduleName( *it ); + QString modName = moduleName( *it ); - QPixmap icon = resMgr->loadPixmap( modName, iconName, false ); - if ( icon.isNull() ) - icon = modIcon; + QPixmap icon = resMgr->loadPixmap( modName, iconName, false ); + if ( icon.isNull() ) + icon = modIcon; - icon.convertFromImage( icon.convertToImage().smoothScale( iconSize, iconSize, QImage::ScaleMin ) ); + icon.convertFromImage( icon.convertToImage().smoothScale( iconSize, iconSize, QImage::ScaleMin ) ); - QAction* a = createAction( -1, *it, icon, *it, tr( "PRP_MODULE" ).arg( *it ), 0, desk, true ); - a->addTo( modTBar ); - modGroup->add( a ); + QAction* a = createAction( -1, *it, icon, *it, tr( "PRP_MODULE" ).arg( *it ), 0, desk, true ); + a->addTo( modTBar ); + modGroup->add( a ); - myActions.insert( *it, a ); - } + myActions.insert( *it, a ); + } - SUIT_Tools::simplifySeparators( modTBar ); + SUIT_Tools::simplifySeparators( modTBar ); + connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) ); + } // New window int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, MenuWindowId, 100 ); @@ -527,8 +532,6 @@ void LightApp_Application::createActions() SHIFT+Key_R, desk, false, this, SLOT( onRenameWindow() ) ); createMenu( RenameId, windowMenu, -1 ); - connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) ); - int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 ); createMenu( PreferencesId, fileMenu, 15, -1 ); createMenu( separator(), fileMenu, -1, 15, -1 ); @@ -1367,9 +1370,7 @@ void LightApp_Application::onDesktopActivated() */ QString LightApp_Application::getFileFilter() const { - //return "(*.bin)"; - // HDF persistence - return "(*.hdf)"; + return "(*.xml)"; } /*! Gets file name*/ @@ -2093,8 +2094,8 @@ void LightApp_Application::contextMenuPopup( const QString& type, QPopupMenu* th if ( !ob || type != ob->popupClientType() ) return; - thePopup->insertSeparator(); - thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) ); + //thePopup->insertSeparator(); + //thePopup->insertItem( tr( "MEN_REFRESH" ), this, SLOT( onRefresh() ) ); } /*!Create empty study.*/