From af2805e4133844a259cc587735bf160e53d83c82 Mon Sep 17 00:00:00 2001 From: akl Date: Wed, 21 May 2008 08:46:36 +0000 Subject: [PATCH] NPAL19776(installation of Salome without gui in install wisard is not good): correct and improve 'installation without GUI' mechanism to get a list of corresponding modules from XML file. --- src/SALOME_InstallWizard.cxx | 35 ++++++++++++++++++++--------------- src/SALOME_InstallWizard.hxx | 10 ++++++++-- src/SALOME_XmlHandler.cxx | 4 +++- 3 files changed, 31 insertions(+), 18 deletions(-) diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index ecf6de8..c5905e1 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -727,8 +727,10 @@ MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& xmlFileName ) platforms = elem.attribute( "platforms" ).stripWhiteSpace(); QStringList platList = QStringList::split( ",", platforms ); for ( uint j = 0; j < platList.count(); j++ ) { - if ( !platList[j].isEmpty() && xmlMap.find( platList[j] ) == xmlMap.end() ) - xmlMap[ platList[j] ] = xmlList[i]; + if ( !platList[j].isEmpty() ) + if ( xmlMap.find( platList[j] ) == xmlMap.end() || + xmlMap[ platList[j] ] == "config.xml" ) + xmlMap[ platList[j] ] = xmlList[i]; } // if ( !curPlatform.isEmpty() && xmlMap.find( curPlatform ) != xmlMap.end() ) // return xmlMap; @@ -1909,8 +1911,8 @@ void SALOME_InstallWizard::setPrerequisites( QCheckListItem* item ) return; // get all prerequisites QStringList dependOn = productsMap[ item ].getDependancies(); - // install MED without GUI case - if ( installGuiBtn->state() != QButton::On && item->text(0) == "MED" ) { + // install SALOME without GUI case + if ( installGuiBtn->state() != QButton::On && woGuiModules.contains( item->text(0) ) != 0 ) { dependOn.remove( "GUI" ); } // setting prerequisites @@ -1947,12 +1949,6 @@ void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item ) for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) { if ( itProd.data().getType() == productsMap[ item ].getType() ) { QStringList dependOn = itProd.data().getDependancies(); - // install MED without GUI case - if ( installGuiBtn->state() != QButton::On && - itProd.data().getName() == "MED" && - itemName != "KERNEL" ) { - continue; - } for ( int i = 0; i < (int)dependOn.count(); i++ ) { if ( dependOn[ i ] == itemName ) { if ( itProd.key()->isOn() ) { @@ -2091,9 +2087,9 @@ void SALOME_InstallWizard::launchScript() shellProcess->addArgument( "FALSE" ); // ... binaries directory shellProcess->addArgument( binDir ); - // ... install MED with GUI or not? - if ( prodProc == "MED" ) { - if ( installGuiBtn->state() != QButton::On && prodProc == "MED" ) + // ... install SALOME with GUI or not? + if ( woGuiModules.contains( prodProc ) != 0 ) { + if ( installGuiBtn->state() != QButton::On ) shellProcess->addArgument( "FALSE" ); else shellProcess->addArgument( "TRUE" ); @@ -2223,8 +2219,7 @@ void SALOME_InstallWizard::onInstallGuiBtn() } else { QString itemName = itProd.data().getName(); - if ( itemName != "KERNEL" && itemName != "MED" && - itemName != "SAMPLES" && itemName != "DOCUMENTATION" ) { + if ( woGuiModules.contains( itemName ) == 0 ) { itProd.key()->setOn( false ); itProd.key()->setEnabled( false ); } @@ -2472,6 +2467,16 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) if ( tempFolder->text().isEmpty() ) parser->setTempDir( tempFolder ); parser->readXmlFile( xmlFileName ); + // create a list of SALOME modules, that support installation without GUI mode + if ( woGuiModules.isEmpty() ) { + MapProducts::Iterator mapIter; + for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); mapIter++ ) { + Dependancies dep = mapIter.data(); + if ( dep.supportWoGuiMode() ) + woGuiModules.append( dep.getName() ); + } + } + // update required size for each product updateSizeColumn(); // take into account command line parameters diff --git a/src/SALOME_InstallWizard.hxx b/src/SALOME_InstallWizard.hxx index ae0c77d..85eb75f 100644 --- a/src/SALOME_InstallWizard.hxx +++ b/src/SALOME_InstallWizard.hxx @@ -56,7 +56,8 @@ class Dependancies const QString& vers = QString::null, const QString& descr = QString::null, const QString& tp = QString::null, - bool pickup = false ) + bool pickup = false, + bool woGui = false ) : smbName( name ), dependsOn( depend ), sizeBinaryTotal( Binsize ), @@ -66,7 +67,8 @@ class Dependancies version( vers ), description( descr ), type( tp ), - pickupEnv( pickup ) {} + pickupEnv( pickup ), + woGuiMode( woGui ) {} // gets symbolic name QString getName() const { return smbName; } @@ -92,6 +94,8 @@ class Dependancies QString getType() const { return type; } // returns true if this product needs to pick-up environment bool pickUpEnvironment() { return pickupEnv; } + // returns true if this product supports installation without GUI mode + bool supportWoGuiMode() { return woGuiMode; } private: QString smbName; // symbolic name @@ -104,6 +108,7 @@ class Dependancies QString description; // product's description QString type; // product's type (salome sources, binaries or prerequisite) bool pickupEnv; // "Pick-up environment" flag + bool woGuiMode; // support of installation without GUI flag }; /*! @@ -344,6 +349,7 @@ class SALOME_InstallWizard: public InstallWizard QStringList toInstall; // list of products being installed QStringList notInstall; // list of products being not installed QStringList prodSequence; // specified list of products being installed + QStringList woGuiModules; // list of SALOME modules, that support installation without GUI mode InstallationType installType; // type of the installation QString curPlatform; // current operating system QString refPlatform; // referenced operating system (selected by user). It is defined, diff --git a/src/SALOME_XmlHandler.cxx b/src/SALOME_XmlHandler.cxx index 95af105..cddc6e8 100644 --- a/src/SALOME_XmlHandler.cxx +++ b/src/SALOME_XmlHandler.cxx @@ -244,6 +244,7 @@ void StructureParser::getProductsInfo( const QDomNode &theNode ) QString name = prodElem.attribute( "name" ).stripWhiteSpace(); QString type = prodElem.attribute( "type" ).stripWhiteSpace().lower(); bool pickUp = isBoolAttributeSet( instElem.attribute( "pickupenv" ) ); + bool woGuiMode = isBoolAttributeSet( instElem.attribute( "woguimode" ) ); QString script = instElem.attribute( "script" ); QStringList typesList = QStringList::split( ",", type ); if ( typesList.find( "component" ) != typesList.end() ) @@ -268,7 +269,8 @@ void StructureParser::getProductsInfo( const QDomNode &theNode ) instElem.attribute( "version" ), descr, type, - pickUp ) ); + pickUp, + woGuiMode ) ); } } } -- 2.39.2