From b10ff04787f728267c2ffa1dc0e5cd2e1128f22d Mon Sep 17 00:00:00 2001 From: mkr Date: Fri, 18 Nov 2005 11:22:57 +0000 Subject: [PATCH] Add the possibility to launch Salome with --modules option. --- src/CAM/CAM_Application.cxx | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/src/CAM/CAM_Application.cxx b/src/CAM/CAM_Application.cxx index 057804d7d..8d6557e82 100755 --- a/src/CAM/CAM_Application.cxx +++ b/src/CAM/CAM_Application.cxx @@ -12,6 +12,7 @@ #include #include #include +#include #ifdef WIN32 #include @@ -407,8 +408,34 @@ void CAM_Application::readModuleList() SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); - QString modStr = resMgr->stringValue( "launch", "modules", QString::null ); - QStringList modList = QStringList::split( ",", modStr ); + QStringList modList; + + // parse command line arguments + int nbArgs = qApp->argc(); + char** CmdLine = qApp->argv(); + QString CmdStr; + for ( int i = 0; i < nbArgs; i++ ) + { + CmdStr.append(CmdLine[i]); + CmdStr.append(" "); + } + int startId = CmdStr.find("--modules ("); + if ( startId != -1 ) { // application launch with --modules option + startId = CmdStr.find("(", startId); + int stopId = CmdStr.find(" )", startId); + QString ModStr = CmdStr.mid( startId+1, stopId - (startId+1) ).stripWhiteSpace(); + int i = 0; + while ( i < ModStr.length() ) + { + int nextId = ModStr.find( ":", i ); + modList.append( ModStr.mid( i, nextId - i ).stripWhiteSpace() ); + i = nextId + 1; + } + } + else { + QString modStr = resMgr->stringValue( "launch", "modules", QString::null ); + modList = QStringList::split( ",", modStr ); + } for ( QStringList::const_iterator it = modList.begin(); it != modList.end(); ++it ) { -- 2.39.2