From: vsr Date: Tue, 21 Aug 2007 08:23:52 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: qt4_porting_delivery_220807~21 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=93eaeb549b1b6bf4e182d7138f96ce7ffc105dd8;p=modules%2Fgui.git *** empty log message *** --- diff --git a/bin/runLightSalome.csh b/bin/runLightSalome.csh index 3a751e993..053654e5a 100755 --- a/bin/runLightSalome.csh +++ b/bin/runLightSalome.csh @@ -1,7 +1,88 @@ #!/bin/csh -f +# +# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# File : runLightSalome.csh +# Author : Vadim SANDLER, Open CASCADE S.A.S, vadim.sandler@opencascade.com +# + +### +# set default value for the LightAppConfig variable, which +# is necessary for loading of .ini or .xml resources file +### -# this variable necessary for loading .ini or .xml file if ( ! $?LightAppConfig ) setenv LightAppConfig ${GUI_ROOT_DIR}/share/salome/resources/gui if ( ! $?LightAppResources ) setenv LightAppResources ${GUI_ROOT_DIR}/share/salome/resources/gui +### +# process --modules=... command line option (get list of modules) +### + +set modules="" + +foreach arg ( X $* ) + if ( "$arg" != "X" ) then + switch ( $arg ) + case --modules=*: + set modules=`echo $arg | awk -F= '{ print $2 }' | sed -e "s%,% %g"` + breaksw + default: + breaksw + endsw + endif +end + +set modules="KERNEL GUI $modules" + +### +# exclude modules duplication +### + +set mods="" + +foreach mod ( $modules ) + echo $mods | grep -E "\<$mod\>" >/dev/null + if ( "$?" == "1" ) then + set mods="$mods $mod" + endif +end + +### +# set additional environment +### + +foreach mod ( $mods ) + if ( "$arg" != "X" ) then + set root_dir=`printenv ${mod}_ROOT_DIR` + if ( "$root_dir" != "" ) then + set mod_lower=`echo $mod | tr "A-Z" "a-z"` + setenv PATH ${root_dir}/bin/salome:${PATH} + setenv LD_LIBRARY_PATH ${root_dir}/lib/salome:${LD_LIBRARY_PATH} + if ( "$mod" != "KERNEL" && "$mod" != "GUI" ) then + setenv LightAppConfig ${LightAppConfig}:${root_dir}/share/salome/resources/${mod_lower} + endif + endif + endif +end + +### +# start application +### + SUITApp LightApp -style salome $* & diff --git a/bin/runLightSalome.sh b/bin/runLightSalome.sh index b09cb94cb..ea135a94e 100755 --- a/bin/runLightSalome.sh +++ b/bin/runLightSalome.sh @@ -18,8 +18,15 @@ # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # +# File : runLightSalome.sh +# Author : Vadim SANDLER, Open CASCADE S.A.S, vadim.sandler@opencascade.com +# + +### +# set default value for the LightAppConfig variable, which +# is necessary for loading of .ini or .xml resources file +### -# this variable necessary for loading .ini or .xml file if [ -z "$LightAppConfig" ] ; then export LightAppConfig=${GUI_ROOT_DIR}/share/salome/resources/gui fi @@ -27,23 +34,56 @@ if [ -z "$LightAppResources" ] ; then export LightAppResources=${GUI_ROOT_DIR}/share/salome/resources/gui fi -modules="KERNEL GUI" +### +# process --modules=... command line option (get list of modules) +### + +modules="" for arg in X $* ; do if [ "$arg" != "X" ] ; then case $arg in - --modules=* ) modules="$modules "`echo $arg | awk -F= '{ print $2 }' | sed -e "s%,% %g"` ;; + --modules=* ) modules=`echo $arg | awk -F= '{ print $2 }' | sed -e "s%,% %g"` ;; *) ;; esac fi done +modules="KERNEL GUI $modules" + +### +# exclude modules duplication +### + +mods="" + for mod in $modules ; do + echo $mods | grep -E "\<$mod\>" >/dev/null 2>&1 + if [ "$?" == "1" ] ; then + mods="$mods $mod" + fi +done + +### +# set additional environment +### + +for mod in $mods ; do if [ "$arg" != "X" ] ; then root_dir=`printenv ${mod}_ROOT_DIR` - export PATH=${root_dir}/bin/salome:${PATH} - export LD_LIBRARY_PATH=${root_dir}/lib/salome:${LD_LIBRARY_PATH} + if [ "$root_dir" != "" ] ; then + mod_lower=`echo $mod | tr "A-Z" "a-z"` + export PATH=${root_dir}/bin/salome:${PATH} + export LD_LIBRARY_PATH=${root_dir}/lib/salome:${LD_LIBRARY_PATH} + if [ "$mod" != "KERNEL" ] && [ "$mod" != "GUI" ] ; then + export LightAppConfig=${LightAppConfig}:${root_dir}/share/salome/resources/${mod_lower} + fi + fi fi done +### +# start application +### + SUITApp LightApp -style salome $* & diff --git a/src/CAM/CAM_Application.cxx b/src/CAM/CAM_Application.cxx index ce462811c..7eef172f8 100755 --- a/src/CAM/CAM_Application.cxx +++ b/src/CAM/CAM_Application.cxx @@ -549,18 +549,41 @@ void CAM_Application::readModuleList() QStringList modList; - QStringList args = QApplication::arguments(); + QString args = QApplication::arguments().join( " " ); + + QRegExp rx1("--modules=([\\w,]*)"); + rx1.setMinimal( false ); + QRegExp rx2("--modules\\s+\\(\\s*(.*)\\s*\\)"); + rx2.setMinimal( true ); + int pos = 0; + while ( 1 ) { + QString modules; + int pos1 = rx1.indexIn( args, pos ); + int pos2 = rx2.indexIn( args, pos ); + if ( pos1 != -1 && pos2 != -1 ) { + modules = pos1 < pos2 ? rx1.cap( 1 ) : rx2.cap(1); + pos = pos1 < pos2 ? pos1 + rx1.matchedLength() : pos2 + rx2.matchedLength(); + } + else if ( pos1 != -1 ) { + modules = rx1.cap( 1 ); + pos = pos1 + rx1.matchedLength(); + } + else if ( pos2 != -1 ) { + modules = rx2.cap( 1 ); + pos = pos2 + rx2.matchedLength(); + } + else { + break; + } - QRegExp rx("--modules\\s+\\(\\s*(.*)\\s*\\)"); - rx.setMinimal( true ); - if ( rx.indexIn( args.join(" ") ) >= 0 && rx.numCaptures() > 0 ) { - QString modules = rx.cap(1); - QStringList mods = modules.split( ":", QString::SkipEmptyParts ); + modList.clear(); + QStringList mods = modules.split( QRegExp( "[:|,\\s]" ), QString::SkipEmptyParts ); for ( int i = 0; i < mods.count(); i++ ) { if ( !mods[i].trimmed().isEmpty() ) modList.append( mods[i].trimmed() ); } } + if ( modList.isEmpty() ) { QString mods = resMgr->stringValue( "launch", "modules", QString() ); modList = mods.split( ",", QString::SkipEmptyParts ); @@ -569,18 +592,22 @@ void CAM_Application::readModuleList() for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it ) { QString modName = (*it).trimmed(); + if ( modName.isEmpty() ) - continue; + continue; // empty module name + + if ( !moduleTitle( modName ).isEmpty() ) + continue; // already added QString modTitle = resMgr->stringValue( *it, "name", QString() ); if ( modTitle.isEmpty() ) - { - printf( "****************************************************************\n" ); - printf( "* Warning: %s not found in resources.\n", (*it).toLatin1().data() ); - printf( "* Module will not be available\n" ); - printf( "****************************************************************\n" ); - continue; - } + { + printf( "****************************************************************\n" ); + printf( "* Warning: %s not found in resources.\n", (*it).toLatin1().data() ); + printf( "* Module will not be available\n" ); + printf( "****************************************************************\n" ); + continue; + } QString modIcon = resMgr->stringValue( *it, "icon", QString() ); diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 68446a9e8..590a215d3 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -1621,7 +1621,7 @@ QWidget* LightApp_Application::createWindow( const int flag ) if ( flag == WT_ObjectBrowser ) { LightApp_Browser* ob = new LightApp_Browser( new LightApp_DataObject(), desktop() ); - ob->treeView()->setSortMenuEnabled( true ); + ob->setSortMenuEnabled( true ); ob->setAutoUpdate( true ); //ob->setAutoOpenLevel( 1 ); // commented by ASV as a fix to bug IPAL10107 ob->setWindowTitle( tr( "OBJECT_BROWSER" ) ); diff --git a/src/LightApp/LightApp_ModuleAction.cxx b/src/LightApp/LightApp_ModuleAction.cxx index 8ceb1f958..ef1723e67 100755 --- a/src/LightApp/LightApp_ModuleAction.cxx +++ b/src/LightApp/LightApp_ModuleAction.cxx @@ -24,7 +24,7 @@ #include #include -#include +#include /*! \class LightApp_ModuleAction::ActionSet @@ -161,9 +161,10 @@ QWidget* LightApp_ModuleAction::ComboAction::createWidget( QWidget* parent ) return 0; QWidget* dumb = new QWidget( parent ); - QHBoxLayout* l = new QHBoxLayout( dumb );l->setSpacing(0);l->setMargin(0); + QVBoxLayout* l = new QVBoxLayout( dumb ); + l->setSpacing( 0 ); l->setMargin( 0 ); QtxComboBox* cb = new QtxComboBox( dumb ); - cb->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred ); + cb->setSizeAdjustPolicy( QComboBox::AdjustToContents ); cb->setFocusPolicy( Qt::NoFocus ); l->addWidget( cb ); diff --git a/src/LightApp/resources/LightApp.ini b/src/LightApp/resources/LightApp.ini index fb5a7018a..d88c79409 100755 --- a/src/LightApp/resources/LightApp.ini +++ b/src/LightApp/resources/LightApp.ini @@ -14,8 +14,3 @@ Plot2d = $(GUI_ROOT_DIR)/share/salome/resources/gui GLViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui OCCViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui VTKViewer = $(GUI_ROOT_DIR)/share/salome/resources/gui -LIGHT = $(LIGHT_ROOT_DIR)/share/salome/resources/light - -[LIGHT] -name = Light -icon = LIGHT diff --git a/src/LightApp/resources/LightApp.xml b/src/LightApp/resources/LightApp.xml index c87bc8f18..17be0872e 100644 --- a/src/LightApp/resources/LightApp.xml +++ b/src/LightApp/resources/LightApp.xml @@ -43,7 +43,6 @@ -
@@ -54,11 +53,6 @@
-
- - - -
diff --git a/src/ObjBrowser/OB_Browser.cxx b/src/ObjBrowser/OB_Browser.cxx index d30b7b6a2..ea3c955f2 100755 --- a/src/ObjBrowser/OB_Browser.cxx +++ b/src/ObjBrowser/OB_Browser.cxx @@ -167,15 +167,6 @@ OB_Browser::~OB_Browser() //setUpdater( 0 ); } -/*! - \brief Get tree view widget. - \return tree view widget of the object browser -*/ -QtxTreeView* OB_Browser::treeView() const -{ - return myView; -} - /*! \brief Get popup menu client type. \return popup client type @@ -248,6 +239,27 @@ void OB_Browser::setRootIsDecorated( const bool decor ) myView->setRootIsDecorated( decor ); } +/* + \brief Check if "Sorting" popup menu command for the header is enabled. + \return \c true if "Sorting" menu command is enabled + \sa setSortMenuEnabled() +*/ +bool OB_Browser::sortMenuEnabled() const +{ + return myView->sortMenuEnabled(); +} + +/* + \brief Enable/disable "Sorting" popup menu command for the header. + \param enableSortMenu if \c true, enable "Sorting" menu command + \sa sortMenuEnabled() +*/ +void OB_Browser::setSortMenuEnabled( const bool enabled ) +{ + if ( enabled != sortMenuEnabled() ) + myView->setSortMenuEnabled( enabled ); +} + /*! \brief Get number of levels which should be automatically expanded when updating the data tree. @@ -739,6 +751,15 @@ OB_Browser::DataObjectKey OB_Browser::objectKey( SUIT_DataObject* obj ) const } */ +/*! + \brief Get tree view widget. + \return tree view widget of the object browser +*/ +QtxTreeView* OB_Browser::treeView() const +{ + return myView; +} + /*! \brief Process context menu request event. \param e context menu event diff --git a/src/ObjBrowser/OB_Browser.h b/src/ObjBrowser/OB_Browser.h index cc4fbe365..df6836b69 100755 --- a/src/ObjBrowser/OB_Browser.h +++ b/src/ObjBrowser/OB_Browser.h @@ -52,8 +52,6 @@ public: OB_Browser( QWidget* = 0, QAbstractItemModel* = 0 ); virtual ~OB_Browser(); - QtxTreeView* treeView() const; - virtual QString popupClientType() const; QAbstractItemModel* model() const; @@ -65,6 +63,9 @@ public: bool rootIsDecorated() const; void setRootIsDecorated( const bool ); + bool sortMenuEnabled() const; + void setSortMenuEnabled( const bool ); + int autoOpenLevel() const; void setAutoOpenLevel( const int ); void openLevels( const int = -1 ); @@ -119,6 +120,7 @@ private slots: protected: //void adjustWidth( QListViewItem* ); //virtual void updateText(); + QtxTreeView* treeView() const; virtual void contextMenuEvent( QContextMenuEvent* ); diff --git a/src/Qtx/QtxListAction.cxx b/src/Qtx/QtxListAction.cxx index 813d052ee..6aea24408 100755 --- a/src/Qtx/QtxListAction.cxx +++ b/src/Qtx/QtxListAction.cxx @@ -570,7 +570,7 @@ void QtxListAction::ListFrame::removePostedEvens( QObject* o, int type ) \param parent parent object */ QtxListAction::QtxListAction( QObject* parent ) -: QWidgetAction( parent ), +: QtxAction( parent ), myFrame( 0 ) { initialize(); @@ -585,13 +585,9 @@ QtxListAction::QtxListAction( QObject* parent ) */ QtxListAction::QtxListAction( const QIcon& icon, const QString& menuText, int accel, QObject* parent ) -: QWidgetAction( parent ), +: QtxAction( menuText, icon, menuText, accel, parent ), myFrame( 0 ) { - setIcon( icon ); - setText( menuText ); - setShortcut( accel ); - initialize(); } @@ -602,12 +598,9 @@ QtxListAction::QtxListAction( const QIcon& icon, const QString& menuText, \param parent parent object */ QtxListAction::QtxListAction( const QString& menuText, int accel, QObject* parent ) -: QWidgetAction( parent ), +: QtxAction( menuText, menuText, accel, parent ), myFrame( 0 ) { - setText( menuText ); - setShortcut( accel ); - initialize(); } @@ -620,13 +613,9 @@ QtxListAction::QtxListAction( const QString& menuText, int accel, QObject* paren */ QtxListAction::QtxListAction( const QString& text, const QString& menuText, int accel, QObject* parent ) -: QWidgetAction( parent ), +: QtxAction( text, menuText, accel, parent ), myFrame( 0 ) { - setText( menuText ); - setShortcut( accel ); - setToolTip( text ); - initialize(); } @@ -640,14 +629,9 @@ QtxListAction::QtxListAction( const QString& text, const QString& menuText, */ QtxListAction::QtxListAction( const QString& text, const QIcon& icon, const QString& menuText, int accel, QObject* parent ) -: QWidgetAction( parent ), +: QtxAction( text, icon, menuText, accel, parent ), myFrame( 0 ) { - setIcon( icon ); - setText( menuText ); - setShortcut( accel ); - setToolTip( text ); - initialize(); } diff --git a/src/Qtx/QtxListAction.h b/src/Qtx/QtxListAction.h index 182698551..956f65c73 100755 --- a/src/Qtx/QtxListAction.h +++ b/src/Qtx/QtxListAction.h @@ -23,15 +23,14 @@ #define QTXLISTACTION_H #include "Qtx.h" - +#include "QtxAction.h" #include -#include #ifdef WIN32 #pragma warning( disable:4251 ) #endif -class QTX_EXPORT QtxListAction : public QWidgetAction +class QTX_EXPORT QtxListAction : public QtxAction { Q_OBJECT diff --git a/src/Qtx/QtxTreeView.cxx b/src/Qtx/QtxTreeView.cxx index b3016bfed..09100e5a7 100644 --- a/src/Qtx/QtxTreeView.cxx +++ b/src/Qtx/QtxTreeView.cxx @@ -230,6 +230,7 @@ void QtxTreeView::collapseLevels( const int levels ) \brief Expand the branch specifed by the \index and all its children recursively. \param index model index to be expanded + \sa collapseAll() */ void QtxTreeView::expandAll( const QModelIndex& index ) { @@ -240,6 +241,7 @@ void QtxTreeView::expandAll( const QModelIndex& index ) \brief Collapse the branch specifed by the \index and all its children recursively. \param index model index to be collapsed + \sa expandAll() */ void QtxTreeView::collapseAll( const QModelIndex& index ) { @@ -249,6 +251,7 @@ void QtxTreeView::collapseAll( const QModelIndex& index ) /* \brief Enable/disable "Sorting" popup menu command for the header. \param enableSortMenu if \c true, enable "Sorting" menu command + \sa sortMenuEnabled() */ void QtxTreeView::setSortMenuEnabled( const bool enableSortMenu ) { @@ -260,6 +263,7 @@ void QtxTreeView::setSortMenuEnabled( const bool enableSortMenu ) /* \brief Check if "Sorting" popup menu command for the header is enabled. \return \c true if "Sorting" menu command is enabled + \sa setSortMenuEnabled() */ bool QtxTreeView::sortMenuEnabled() const {