X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOME_InstallWizard.cxx;h=9228f170997c4f6120c4371428f56fdc9d800696;hb=6cc900a6e2e29f809caacdb3e5c43f132feae042;hp=1314744aa750dc8e67707d5fd0f2b288468b38f1;hpb=b5aea823355ebb10aec73358c120b805abc9b783;p=tools%2Finstall.git diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index 1314744..9228f17 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -3,7 +3,7 @@ // Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com) // Project : SALOME // Module : Installation Wizard -// Copyright : 2002-2008 CEA +// Copyright : 2002-2013 CEA #include "globals.h" @@ -43,6 +43,7 @@ #include #include #include +#include #ifdef WNT #include @@ -60,10 +61,48 @@ QString tmpDirName() { return QString( "/INSTALLWORK" ) + QString::number( getpid() ); } #define TEMPDIRNAME tmpDirName() +// uncomment next line to redirect all shell output (usually for errors) to /dev/null device +// #define USE_DEV_NULL + +// ================================================================ +/*! + * Script + * Helper class to generate shell command + */ +// ================================================================ +class Script +{ +public: + Script( const QString& cmd = QString::null, const QString& sep = " " ) : mySeparator( sep ) + { + append( cmd ); + } + void append( const QString& cmd ) + { + if ( !cmd.isEmpty() ) myList.append( cmd ); + } + Script& operator<<( const QString& cmd ) + { + append( cmd ); + return *this; + } + QString script() const + { + return myList.join( mySeparator ); + } + void clear() + { + myList.clear(); + } +private: + QStringList myList; + QString mySeparator; +}; + // ================================================================ /*! * ProcessThread - * Class for executing systen commands + * Class for executing system commands */ // ================================================================ static QMutex myMutex(false); @@ -276,10 +315,18 @@ static bool makeDir( const QString& theDir, QString& theCreated ) QFileInfo fi( aDir.left( start ) ); if ( !fi.exists() ) { // VSR: Create directory and set permissions to allow other users to remove it - QString script = "mkdir " + fi.absFilePath(); - script += "; chmod 777 " + fi.absFilePath(); - script += " > /dev/null"; - if ( system( script.latin1() ) ) + Script script; + script << "mkdir" << QUOTE( fi.absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + script << "&&"; + script << "chmod 777" << QUOTE( fi.absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) return false; // VSR: Remember the top of the created directory (to remove it in the end of the installation) if ( theCreated.isNull() ) @@ -290,9 +337,13 @@ static bool makeDir( const QString& theDir, QString& theCreated ) } if ( !QFileInfo( aDir ).exists() ) { // VSR: Create directory, other users should NOT have possibility to remove it!!! - QString script = "mkdir " + aDir; - script += " > /dev/null"; - if ( system( script.latin1() ) ) + Script script; + script << "mkdir" << QUOTE( aDir ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) return false; // VSR: Remember the top of the created directory (to remove it in the end of the installation) if ( theCreated.isNull() ) @@ -388,7 +439,7 @@ public: AboutDlg( SALOME_InstallWizard* parent ) : QDialog( parent, "About dialog box", true ) { // caption - setCaption( QString( "About %1" ).arg( parent->getIWName() ) ); + setCaption( tr( "About %1" ).arg( parent->getIWName() ) ); // palette QPalette pal = palette(); QColorGroup cg = pal.active(); @@ -400,34 +451,22 @@ public: QGridLayout* main = new QGridLayout( this, 1, 1, 11, 6 ); // image QLabel* logo = new QLabel( this, "logo" ); - logo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) ); - logo->setMinimumSize( 32, 32 ); logo->setMaximumSize( 32, 32 ); - logo->setPaletteBackgroundColor( QColor( 234, 250, 234 ) ); + logo->setFixedSize( 24, 24 ); logo->setFrameStyle( QLabel::NoFrame | QLabel::Plain ); logo->setPixmap( pixmap( pxAbout ) ); logo->setScaledContents( false ); logo->setAlignment( QLabel::AlignCenter ); - // decoration - QLabel* decorLeft = new QLabel( this, "decorLeft" ); - decorLeft->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) ); - decorLeft->setMinimumWidth( 32 ); decorLeft->setMaximumWidth( 32 ); - decorLeft->setPaletteBackgroundColor( QColor( 234, 250, 234 ) ); - decorLeft->setScaledContents( false ); - QLabel* decorTop = new QLabel( this, "decorTop" ); - decorTop->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); - decorTop->setMinimumHeight( 32 ); decorTop->setMaximumHeight( 32 ); - decorTop->setPaletteBackgroundColor( QColor( 234, 250, 234 ) ); - decorTop->setScaledContents( false ); // contents QLabel* title = new QLabel( this, "title" ); QString tlt = parent->getIWName(); title->setText( makeTitle( tlt ) ); QLabel* version = new QLabel( this, "version" ); - version->setText( QString( "Version: %1.%1.%1" ).arg( __IW_VERSION_MAJOR__ ) \ - .arg( __IW_VERSION_MINOR__ ) \ + version->setText( QString( "Version: %1.%1.%1" ) + .arg( __IW_VERSION_MAJOR__ ) + .arg( __IW_VERSION_MINOR__ ) .arg( __IW_VERSION_PATCH__ ) ); QLabel* copyright = new QLabel( this, "copyright" ); - copyright->setText( "Copyright © 2002-2008 CEA" ); + copyright->setText( "Copyright © 2002-2013 CEA" ); QFont font = title->font(); font.setPointSize( (int)( font.pointSize() * 1.8 ) ); title->setFont( font ); @@ -443,18 +482,15 @@ public: url->setFont( font ); // layout main->addWidget( logo, 0, 0 ); - main->addMultiCellWidget( decorLeft, 1, 5, 0, 0 ); - main->addWidget( decorTop, 0, 1 ); - main->addWidget( title, 1, 1 ); - main->addWidget( version, 2, 1 ); - main->addWidget( copyright, 3, 1 ); - main->addWidget( line, 4, 1 ); - main->addWidget( url, 5, 1 ); + main->addWidget( title, 0, 1 ); + main->addWidget( version, 1, 1 ); + main->addWidget( copyright, 2, 1 ); + main->addWidget( line, 3, 1 ); + main->addWidget( url, 4, 1 ); // resize QFontMetrics fm( title->font() ); int width = (int)( fm.width( tlt ) * 1.5 ); title->setMinimumWidth( width ); - setMaximumSize( minimumSize() ); } void mousePressEvent( QMouseEvent* ) { @@ -488,24 +524,12 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, forceSrc = aForceSrc; singleDir = aSingleDir; stateChanged = true; - binPath = QDir::currentDirPath() + "/Products/BINARIES"; - srcPath = QDir::currentDirPath() + "/Products/SOURCES"; + + QDir rootDir( rootDirPath() ); + binPath = rootDir.filePath( "Products/BINARIES" ); + srcPath = rootDir.filePath( "Products/SOURCES" ); oneProdDirName = "PRODUCTS"; - singleBinPlts << "Red Hat 8.0" - << "Red Hat 9" - << "Debian 3.1" - << "Debian 4.0" - << "Debian 4.0 64bit" - << "Mandrake 10.1" - << "Mandriva 2006.0" - << "Mandriva 2006.0 64bit" - << "Mandriva 2007.0" - << "Mandriva 2008.0" - << "Mandriva 2008.0 64bit" - << "Red Hat Enterprise WS 4" - << "Scientific SL 4.2" - << "Scientific SL 4.3"; commonPlatform = "Debian 3.1"; // @@ -513,8 +537,8 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, // // ... get current platform curPlatform = currentPlatform().join(" "); -// cout << "curOS = " << curPlatform << endl; -// curPlatform = ""; + //cout << "curOS = " << curPlatform << endl; + refPlatform = ""; // ... check XML and platform definition getXmlAndPlatform(); @@ -533,10 +557,11 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, addLogo( pixmap( pxLogo ) ); // set defaults - setVersion( "4.1.3" ); + setVersion( "7.3.0" ); setCaption( tr( "SALOME %1" ).arg( myVersion ) ); - setCopyright( tr( "Copyright (C) 2008 CEA" ) ); - setLicense( tr( "All rights reserved." ) ); + setCopyright( tr( "
Copyright © 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE
" + "
Copyright © 2003-2007 OPEN CASCADE,
EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D,
LEG, PRINCIPIA R&D, BUREAU VERITAS
" )); + setLicense( tr( "
GNU LGPL
" ) ); ___MESSAGE___( "Configuration file : " << xmlFileName.latin1() ); ___MESSAGE___( "Target directory : " << myTargetPath.latin1() ); @@ -617,13 +642,16 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, SALOME_InstallWizard::~SALOME_InstallWizard() { shellProcess->kill(); // kill it for sure - QString script = "kill -9 "; int PID = (int)shellProcess->processIdentifier(); if ( PID > 0 ) { - script += QString::number( PID ); - script += " > /dev/null"; - ___MESSAGE___( "script: " << script.latin1() ); - if ( system( script.latin1() ) ) { + Script script; + script << "kill -9" << QString::number( PID ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script: " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { + // error } } delete myThread; @@ -637,7 +665,7 @@ SALOME_InstallWizard::~SALOME_InstallWizard() QString SALOME_InstallWizard::getBasePlatform() { QString aBasePlt = ""; - if ( singleBinPlts.contains(curPlatform) ) + if ( platformsMap.find( curPlatform ) != platformsMap.end() ) aBasePlt = curPlatform; else aBasePlt = commonPlatform; @@ -658,32 +686,37 @@ QStringList SALOME_InstallWizard::currentPlatform() QFile file( osFileName ); if ( file.open( IO_ReadOnly ) ) { QTextStream stream( &file ); - QString str = stream.readLine(); + QStringList lines = QStringList::split( "\n", stream.read() ); file.close(); - // parse line - QRegExp regvar = QRegExp( "(.*)\\s+[^\\s]*[R|r]elease[^\\s]*\\s+([\\d.]*)" ); - int pos = regvar.search( str ); - if ( pos == -1 ) { - regvar = QRegExp( "(.*)\\s+[^\\s]*[L|l][I|i][N|n][U|u][X|x][^\\s]*(.*)\\s+([\\d.]*)\\s+" ); - pos = regvar.search( str ); - } - if ( pos >= 0 ) { - QStringList name; - for ( int i = 1; i < regvar.numCaptures(); i++ ) - name.append( regvar.cap( i ) ); - - // retrieve platform name - platName = QStringList::split( " ", name.join( " " ) ).join( " " ); - platName = platName.replace( "Linux", "" ).replace( "linux", "" ).replace( "LINUX", "" ).stripWhiteSpace(); - platName = platName.replace( "Welcome to", "" ).stripWhiteSpace(); - platName = QStringList::split( " ", platName ).join( " " ); - // retrieve platform version number - platVersion = regvar.cap( regvar.numCaptures() ); - // retrieve platform - utsname uname_data; - uname( &uname_data ); - if ( QString( uname_data.machine ) == "x86_64" ) - platArch = "64bit"; + for ( uint i = 0; i < lines.count(); i++ ) { + QString str = lines[i]; + if ( str.isEmpty() ) continue; + // parse line + QRegExp regvar = QRegExp( "(.*)\\s+[^\\s]*[R|r]elease[^\\s]*\\s+([\\d.]*)" ); + int pos = regvar.search( str ); + if ( pos == -1 ) { + regvar = QRegExp( "(.*)\\s+[^\\s]*[L|l][I|i][N|n][U|u][X|x][^\\s]*(.*)\\s+([\\d.]*)\\s+" ); + pos = regvar.search( str ); + } + if ( pos >= 0 ) { + QStringList name; + for ( int i = 1; i < regvar.numCaptures(); i++ ) + name.append( regvar.cap( i ) ); + + // retrieve platform name + platName = QStringList::split( " ", name.join( " " ) ).join( " " ); + platName = platName.replace( "Linux", "" ).replace( "linux", "" ).replace( "LINUX", "" ).stripWhiteSpace(); + platName = platName.replace( "Welcome to", "" ).stripWhiteSpace(); + platName = QStringList::split( " ", platName ).join( " " ); + // retrieve platform version number + platVersion = regvar.cap( regvar.numCaptures() ); + // retrieve platform + utsname uname_data; + uname( &uname_data ); + if ( QString( uname_data.machine ) == "x86_64" ) + platArch = "64bit"; + break; + } } } } @@ -693,6 +726,24 @@ QStringList SALOME_InstallWizard::currentPlatform() if ( !platArch.isEmpty() ) vals.append( platArch ); return vals; } + +// ================================================================ +/*! + * SALOME_InstallWizard::rootDirPath + * Get application root dir + */ +// ================================================================ +QString SALOME_InstallWizard::rootDirPath() +{ + static QString rootDir; + if ( rootDir.isEmpty() ) { + QDir appDir( qApp->applicationDirPath() ); + appDir.cdUp(); + rootDir = appDir.absPath(); + } + return rootDir; +} + // ================================================================ /*! * SALOME_InstallWizard::getPlatformBinPath @@ -716,13 +767,15 @@ MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& aXmlFileName ) MapXmlFiles xmlMap; QStringList xmlList; if ( !aXmlFileName.isEmpty() ) - xmlList.append( aXmlFileName ); + xmlList.append( QFileInfo( aXmlFileName ).absFilePath() ); else { - QDir dir( QDir::currentDirPath() ); - xmlList = dir.entryList( "*.xml", QDir::Files | QDir::Readable ); + QDir dir( rootDirPath() ); + QStringList entries = dir.entryList( "*.xml", QDir::Files | QDir::Readable ); + if ( entries.remove( "config.xml" ) ) + entries.append( "config.xml" ); + for ( uint i = 0; i < entries.count(); i++ ) + xmlList.append( QDir( rootDirPath() ).filePath( entries[i] ) ); } - if ( xmlList.remove( "config.xml" ) ) - xmlList.append( "config.xml" ); // XML files parsing QFile file; QDomDocument doc( "xml_doc" ); @@ -774,8 +827,8 @@ void SALOME_InstallWizard::getXmlAndPlatform() if ( !curPlatform.isEmpty() ) { // try to get XML file for current platform if ( xmlMap.find( curPlatform ) != xmlMap.end() ) { - xmlFileName = xmlMap[ getBasePlatform() ]; - QFileInfo fibp( getPlatformBinPath( getBasePlatform() ) ); + xmlFileName = xmlMap[ curPlatform ]; + QFileInfo fibp( getPlatformBinPath( curPlatform ) ); if ( !fibp.isDir() ) { warnMsg = tr( "Binaries are absent for current platform" ); } @@ -874,7 +927,7 @@ void SALOME_InstallWizard::setupIntroPage() // create logo picture logoLab = new QLabel( introPage ); logoLab->setPixmap( pixmap( pxBigLogo ) ); - logoLab->setScaledContents( false ); + logoLab->setScaledContents( true ); logoLab->setFrameStyle( QLabel::Plain | QLabel::NoFrame ); logoLab->setAlignment( AlignCenter ); // create version box @@ -1292,14 +1345,20 @@ void SALOME_InstallWizard::setupProgressPage() progressView = new ProgressView( widget ); progressView->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) ); progressView->setMinimumSize( 100, 10 ); + // possibility to ignore all errors + ignoreErrCBox = new QCheckBox( tr( "Ignore errors" ), widget ); + setAboutInfo( ignoreErrCBox, tr( "Check this option if you want to proceed installation \nprocess even there will be some errors" ) ); + ignoreErrCBox->setChecked( false ); + // product installation status bar statusLab = new QLabel( widget ); statusLab->setFrameShape( QButtonGroup::LineEditPanel ); setAboutInfo( progressView, tr( "Installation status on the selected products" ) ); // layouting layout->addRowSpacing( 0, 6 ); - layout->addWidget( resultLab, 1, 0 ); - layout->addWidget( progressView, 2, 0 ); - layout->addWidget( statusLab, 3, 0 ); + layout->addWidget( resultLab, 1, 0 ); + layout->addWidget( progressView, 2, 0 ); + layout->addWidget( ignoreErrCBox, 3, 0 ); + layout->addWidget( statusLab, 4, 0 ); // layouting pageLayout->addWidget( splitter, 0, 0 ); // adding page @@ -1339,7 +1398,7 @@ void SALOME_InstallWizard::setupReadmePage() pageLayout->addLayout( hLayout ); // loading README file - QString readmeFile = QDir::currentDirPath() + "/README"; + QString readmeFile = QDir( rootDirPath() ).filePath( "README" ); QString text; if ( readFile( readmeFile, text ) ) readme->setText( text ); @@ -1425,7 +1484,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) if ( installType == Binaries ) { // 'Binary' installation type // check binaries directory QFileInfo fib( QDir::cleanDirPath( getBinPath() ) ); - if ( !fib.exists() ) { + if ( !fib.isDir() ) { QMessageBox::warning( this, tr( "Warning" ), tr( "The directory %1 doesn't exist.\n" @@ -1445,13 +1504,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) } else { // Supported platform case - QString aPlatform = curPlatform; - if ( curPlatform != getBasePlatform() ) { - refPlatform = getBasePlatform(); - xmlFileName = platformsMap[ refPlatform ]; - aPlatform = getPlatform(); - } - QFileInfo fibp( getPlatformBinPath( aPlatform ) ); + QFileInfo fibp( getPlatformBinPath( curPlatform ) ); if ( !fibp.isDir() ) { warnLab->setText( tr( "Binaries are absent for current platform." ) ); this->setAppropriate( platformsPage, true ); @@ -1460,7 +1513,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) // check sources directory QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) ); - if ( !fis.exists() ) + if ( !fis.isDir() ) if ( QMessageBox::warning( this, tr( "Warning" ), tr( "The directory %1 doesn't exist.\n" @@ -1474,7 +1527,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) else { // 'Source' or 'Compile' installation type // check sources directory QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) ); - if ( !fis.exists() ) { + if ( !fis.isDir() ) { QMessageBox::warning( this, tr( "Warning" ), tr( "The directory %1 doesn't exist.\n" @@ -1484,6 +1537,15 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) QMessageBox::NoButton ); return false; } + else if ( !QDir( fis.filePath(), "*.tar.gz" ).count() ) { + QMessageBox::warning( this, + tr( "Warning" ), + tr( "The directory %1 doesn't contain source archives.\n" ).arg( fis.absFilePath() ), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + return false; + } if ( platformsMap.find( curPlatform ) == platformsMap.end() ) { QString aMsg = warnMsg + "."; if ( installType == Compile ) @@ -1505,6 +1567,29 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) QMessageBox::NoButton ); return false; } + else if ( installType == Binaries ) { + QString aPlatform = platBtnGrp->selected()->name(); + QFileInfo fib( getPlatformBinPath( aPlatform ) ); + if ( !fib.isDir() ) { + QMessageBox::warning( this, + tr( "Warning" ), + tr( "The directory %1 doesn't exist.\n" + "This directory must contains binary archives.\n" ).arg( fib.absFilePath() ), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + return false; + } + else if ( QDir( fib.filePath(), "*.tar.gz" ).count() == 0 ) { + QMessageBox::warning( this, + tr( "Warning" ), + tr( "The directory %1 doesn't contain binary archives.\n" ).arg( fib.absFilePath() ), + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + return false; + } + } } else if ( aPage == dirPage ) { @@ -1524,7 +1609,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) return false; } QFileInfo fi( QDir::cleanDirPath( targetDir ) ); - if ( !fi.exists() ) { + if ( !fi.isDir() ) { bool toCreate = QMessageBox::warning( this, tr( "Warning" ), @@ -1616,13 +1701,13 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) return false; } // run script that checks available disk space for installing of products // returns 1 in case of error + QDir rd( rootDirPath() ); QFileInfo fi( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ); - QString script = "./config_files/checkSize.sh '"; - script += fi.absFilePath(); - script += "' "; - script += QString( "%1" ).arg( totSize ); - ___MESSAGE___( "script = " << script.latin1() ); - if ( system( script ) ) { + Script script; + script << QUOTE( rd.filePath( "config_files/checkSize.sh" ) ); + script << QUOTE( fi.absFilePath() ) << QString::number( totSize ); + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { QMessageBox::critical( this, tr( "Out of space" ), tr( "There is no available disk space for installing of selected products" ), @@ -1636,12 +1721,11 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) // run script that check available disk space for temporary files // returns 1 in case of error QFileInfo fit( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) ); - QString tscript = "./config_files/checkSize.sh '"; - tscript += fit.absFilePath(); - tscript += "' "; - tscript += QString( "%1" ).arg( tempSize ); - ___MESSAGE___( "script = " << tscript.latin1() ); - if ( system( tscript ) ) { + Script tscript; + tscript << QUOTE( rd.filePath( "config_files/checkSize.sh" ) ); + tscript << QUOTE( fit.absFilePath() ) << QString::number( tempSize ); + ___MESSAGE___( "script = " << tscript.script().latin1() ); + if ( system( tscript.script().latin1() ) ) { QMessageBox::critical( this, tr( "Out of space" ), tr( "There is no available disk space for the temporary files" ), @@ -1677,11 +1761,12 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) } // check installation script existence else { - QFileInfo fi( QString("./config_files/") + item->text(2) ); + QDir rd( rootDirPath() ); + QFileInfo fi( rd.filePath( QString( "config_files/%1" ).arg( item->text(2) ) ) ); if ( !fi.exists() || !fi.isExecutable() ) { QMessageBox::warning( this, tr( "Error" ), - tr( "The script %1 required for %2 doesn't exist or doesn't have execute permissions.").arg("./config_files/" + item->text(2)).arg(item->text(0)), + tr( "The script %1 required for %2 doesn't exist or doesn't have execute permissions.").arg(fi.filePath()).arg(item->text(0)), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); @@ -1773,7 +1858,7 @@ void SALOME_InstallWizard::runModifyLaFiles() // ... update status label statusLab->setText( tr( "Modification of *.la files of SALOME modules..." ) ); // set process arguments - modifyLaProc->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) ); + modifyLaProc->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) ); modifyLaProc->addArgument( "modifyLaFiles.sh" ); modifyLaProc->addArgument( "modify_la_files" ); modifyLaProc->addArgument( QDir::cleanDirPath( QFileInfo( targetFolder->text().stripWhiteSpace() ).absFilePath() ) ); @@ -1803,11 +1888,7 @@ void SALOME_InstallWizard::checkModifyLaResult() QMessageBox::NoButton ); // enable button setNextEnabled( true ); - nextButton()->setText( tr( "&Start" ) ); - setAboutInfo( nextButton(), tr( "Start installation process" ) ); - // reconnect Next button - to use it as Start button - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); // enable button setBackEnabled( true ); @@ -1816,7 +1897,7 @@ void SALOME_InstallWizard::checkModifyLaResult() // ================================================================ /*! * SALOME_InstallWizard::runCheckFLib - * Run the Fortran libraries checking + * Run the Fortran and other required libraries checking */ // ================================================================ void SALOME_InstallWizard::runCheckFLib() @@ -1824,9 +1905,9 @@ void SALOME_InstallWizard::runCheckFLib() // Check Fortran libraries checkFLibProc->clearArguments(); // ... update status label - statusLab->setText( tr( "Check Fortran libraries..." ) ); + statusLab->setText( tr( "Check Fortran and other required libraries..." ) ); // ... search "not found" libraries - checkFLibProc->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) ); + checkFLibProc->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) ); checkFLibProc->addArgument( "checkFortran.sh" ); checkFLibProc->addArgument( "find_libraries" ); checkFLibProc->addArgument( QDir::cleanDirPath( QFileInfo( targetFolder->text().stripWhiteSpace() ).absFilePath() ) ); @@ -1837,26 +1918,58 @@ void SALOME_InstallWizard::runCheckFLib() // ================================================================ /*! * SALOME_InstallWizard::checkFLibResult - * Slot to take result of Fortran libraries checking + * Slot to take result of Fortran and other required libraries checking */ // ================================================================ void SALOME_InstallWizard::checkFLibResult() { if ( checkFLibProc->normalExit() && checkFLibProc->exitStatus() == 1 ) { - QStringList notFoundLibsList; + QStringList notFoundLibsList, notFoundOptLibsList; QString record = ""; + QStringList prefOptLibs = getOptionalLibs(); + // create list of strings with all 'not found' libraries while ( checkFLibProc->canReadLineStdout() ) { - record = checkFLibProc->readLineStdout(); - if ( !record.isEmpty() && !notFoundLibsList.contains( record ) ) - notFoundLibsList.append( record ); - } - QMessageBox::warning( this, - tr( "Warning" ), - tr( "The following libraries are absent on current system:\n" - "%1").arg( notFoundLibsList.join( "\n" ) ), - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton ); + record = checkFLibProc->readLineStdout().stripWhiteSpace(); + if ( !record.isEmpty() ) { + record = QStringList::split( " ", record )[0]; + if ( !notFoundLibsList.contains( record ) && + !notFoundOptLibsList.contains( record ) ) { + bool isOptional = false; + QStringList::Iterator it_opt; + for ( it_opt = prefOptLibs.begin(); it_opt != prefOptLibs.end(); ++it_opt ) + if ( record.startsWith( (*it_opt).stripWhiteSpace(), false ) ) { + isOptional = true; + break; + } + isOptional ? notFoundOptLibsList.append( record ) \ + : notFoundLibsList.append( record ); + } + } + } + QString msg = tr( "Some libraries are absent!

" ); + if ( !notFoundLibsList.isEmpty() ) { + msg += tr( "One or several mandatory libraries listed below are not found. SALOME may not work properly.
" ); + msg += notFoundLibsList.join( "
" ); + msg += "

"; + } + if ( !notFoundOptLibsList.isEmpty() ) { + msg += tr( "One or several optional libraries listed below are not found. This does not affect on the correct work of SALOME platform.
" ); + msg += notFoundOptLibsList.join( "
" ); + } + if ( !notFoundLibsList.isEmpty() ) + QMessageBox::warning( this, + tr( "Warning" ), + msg, + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); + else if ( !notFoundOptLibsList.isEmpty() ) + QMessageBox::information( this, + tr( "Information" ), + msg, + QMessageBox::Ok, + QMessageBox::NoButton, + QMessageBox::NoButton ); } // Update GUI and check installation errors completeInstallation(); @@ -1922,8 +2035,8 @@ void SALOME_InstallWizard::checkProductPage() QFileInfo fi( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ); if ( fi.exists() ) { diskSpaceProc->clearArguments(); - QString script = "./config_files/diskSpace.sh"; - diskSpaceProc->addArgument( script ); + diskSpaceProc->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) ); + diskSpaceProc->addArgument( "diskSpace.sh" ); diskSpaceProc->addArgument( fi.absFilePath() ); // run script diskSpaceProc->start(); @@ -2062,7 +2175,7 @@ void SALOME_InstallWizard::launchScript() // fill in script parameters shellProcess->clearArguments(); // ... script name - shellProcess->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) ); + shellProcess->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) ); if ( !extraProducts.contains( prodProc ) ) { item = findItem( prodProc ); shellProcess->addArgument( item->text(2) ); @@ -2072,7 +2185,7 @@ void SALOME_InstallWizard::launchScript() // ... get folder with binaries QString OS = getPlatform(); - if ( refPlatform.isEmpty() && singleBinPlts.contains(curPlatform) == 0 ) + if ( refPlatform.isEmpty() && platformsMap.find( curPlatform ) == platformsMap.end() ) OS = commonPlatform; QString binDir = getPlatformBinPath( OS ); // ... temp folder @@ -2084,7 +2197,7 @@ void SALOME_InstallWizard::launchScript() if ( notInstall.contains( prodProc ) || prodProc == "gcc" ) { shellProcess->addArgument( "try_preinstalled" ); shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() ); - shellProcess->addArgument( QDir::currentDirPath() + "/Products" ); + shellProcess->addArgument( QDir( rootDirPath() ).filePath( "Products" ) ); statusLab->setText( tr( "Collecting environment for '" ) + prodProc + "'..." ); } // ... binaries ? @@ -2157,10 +2270,18 @@ void SALOME_InstallWizard::launchScript() // run script if ( !shellProcess->start() ) { // error handling can be here + QStringList args = shellProcess->arguments(); ___MESSAGE___( "error" ); + ___MESSAGE___( "cmd: " << args.join(" ").latin1() ); } return; } + + // else try to find aborted product + prodProc = progressView->findStatus( Aborted ); + if ( !prodProc.isNull() ) + return; // installation has been aborted + ___MESSAGE___( "All products have been installed successfully" ); // all products are installed successfully MapProducts::Iterator mapIter; @@ -2172,18 +2293,16 @@ void SALOME_InstallWizard::launchScript() if ( item->isOn() && dep.pickUpEnvironment() ) { statusLab->setText( tr( "Pick-up products environment for " ) + dep.getName().latin1() + "..." ); ___MESSAGE___( "... for " << dep.getName().latin1() ); - QString script; - script += "cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; "; - script += item->text(2) + " "; - script += "pickup_env "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( QDir::currentDirPath() + "/Products" ) ).absFilePath() ) + " "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " "; - script += depproducts + " "; - script += item->text(0) + " "; - script += QUOTE( prodSequence.join( " " ) ); - ___MESSAGE___( "... --> " << script.latin1() ); - if ( system( script.latin1() ) ) { + QDir rd( rootDirPath() ); + Script script; + script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";"; + script << item->text(2) << "pickup_env"; + script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( QDir( rootDirPath() ).filePath( "Products" ) ) ).absFilePath() ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); + script << depproducts << item->text(0) << QUOTE( prodSequence.join( " " ) ); + ___MESSAGE___( "... --> " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { ___MESSAGE___( "ERROR" ); } } @@ -2213,10 +2332,7 @@ void SALOME_InstallWizard::completeInstallation() statusLab->setText( tr( "Installation completed" ) ); // button setNextEnabled( true ); - nextButton()->setText( tr( "&Next >" ) ); - setAboutInfo( nextButton(), tr( "Move to the next step of the installation procedure" ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Next >" ), tr( "Move to the next step of the installation procedure" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); // button setBackEnabled( true ); @@ -2231,7 +2347,7 @@ void SALOME_InstallWizard::completeInstallation() if ( hasErrors ) { if ( QMessageBox::warning( this, tr( "Warning" ), - tr( "There were some errors and/or warnings during the installation.\n" + tr( "There were some errors during the installation.\n" "Do you want to save the installation log?" ), tr( "&Save" ), tr( "&Cancel" ), @@ -2310,15 +2426,17 @@ void SALOME_InstallWizard::onFinishButton() ButtonList::Iterator it; for ( it = buttons.begin(); it != buttons.end(); ++it ) { if ( (*it).button() && (*it).button() == btn ) { - QString script; - script += "( cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; "; - script += + (*it).script(); - script += " execute "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " "; - script += " > /dev/null )"; - ___MESSAGE___( "script: " << script.latin1() ); - if ( (*it).script().isEmpty() || system( script.latin1() ) ) { + QDir rd( rootDirPath() ); + Script script; + script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";"; + script << (*it).script() << "execute"; + script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script: " << script.script().latin1() ); + if ( (*it).script().isEmpty() || system( script.script().latin1() ) ) { QMessageBox::warning( this, tr( "Error" ), tr( "Can't perform action!"), @@ -2426,22 +2544,30 @@ void SALOME_InstallWizard::clean(bool rmDir) myWC.wakeAll(); while ( myThread->running() ); // first remove temporary files - QString script = "cd ./config_files/; remove_tmp.sh '"; - script += tempFolder->text().stripWhiteSpace() + TEMPDIRNAME; - script += "' "; - script += QUOTE(getAllProducts(productsMap)); - script += " > /dev/null"; - ___MESSAGE___( "script = " << script.latin1() ); - if ( system( script.latin1() ) ) { + QDir rd( rootDirPath() ); + Script script; + script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";"; + script << "remove_tmp.sh" << QUOTE( tempFolder->text().stripWhiteSpace() + TEMPDIRNAME ); + script << QUOTE( getAllProducts( productsMap ) ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { + // error } // then try to remove created temporary directory //script = "rm -rf " + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME; if ( rmDir && !tmpCreated.isNull() ) { - script = "rm -rf " + tmpCreated; - script += " > /dev/null"; - if ( system( script.latin1() ) ) { + script.clear(); + script << "rm -rf" << QUOTE( tmpCreated ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + if ( system( script.script().latin1() ) ) { + // error } - ___MESSAGE___( "script = " << script.latin1() ); + ___MESSAGE___( "script = " << script.script().latin1() ); } } // ================================================================ @@ -2452,10 +2578,7 @@ void SALOME_InstallWizard::clean(bool rmDir) // ================================================================ void SALOME_InstallWizard::pageChanged( const QString & mytitle) { - nextButton()->setText( tr( "&Next >" ) ); - setAboutInfo( nextButton(), tr( "Move to the next step of the installation procedure" ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Next >" ), tr( "Move to the next step of the installation procedure" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); cancelButton()->disconnect(); connect( cancelButton(), SIGNAL( clicked()), this, SLOT( reject() ) ); @@ -2470,6 +2593,8 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) if ( buttonGrp->id( buttonGrp->selected() ) == -1 ) // set default installation type forceSrc ? srcCompileBtn->animateClick() : binBtn->animateClick(); + else + buttonGrp->selected()->animateClick(); } else if ( aPage == platformsPage ) { // installation platforms page @@ -2480,15 +2605,13 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) QRadioButton* rb = ( (QRadioButton*) platBtnGrp->child( plat ) ); if ( installType == Binaries ) { QFileInfo fib( getPlatformBinPath( plat ) ); - rb->setEnabled( fib.exists() ); + rb->setEnabled( true/*fib.isDir()*/ ); if ( platBtnGrp->id( platBtnGrp->selected() ) == -1 && plat == getBasePlatform() ) rb->animateClick(); } - else { - QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) ); - rb->setEnabled( fis.exists() ); - } - rb->setChecked( rb->isChecked() && rb->isEnabled() ); +// rb->setChecked( rb->isChecked() && rb->isEnabled() ); + if ( rb->isChecked() && rb->isEnabled() ) + rb->animateClick(); } setNextEnabled( platformsPage, platBtnGrp->id( platBtnGrp->selected() ) != -1 ); } @@ -2541,7 +2664,7 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) } // add extra products to install list extraProducts.clear(); - extraProducts.insert( "gcc", "gcc-common.sh" ); + //extraProducts.insert( "gcc", "gcc-common.sh" ); if ( refPlatform == commonPlatform && installType == Binaries ) extraProducts.insert( "DebianLibsForSalome", "DEBIANFORSALOME-3.1.sh" ); } @@ -2564,11 +2687,7 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) passedParams->clear(); passedParams->setEnabled( false ); QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f ); - nextButton()->setText( tr( "&Start" ) ); - setAboutInfo( nextButton(), tr( "Start installation process" ) ); - // reconnect Next button - to use it as Start button - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); setNextEnabled( true ); // reconnect Cancel button to terminate process @@ -2580,15 +2699,17 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) ButtonList::Iterator it; for ( it = buttons.begin(); it != buttons.end(); ++it ) { if ( (*it).button() ) { - QString script; - script += "( cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; "; - script += + (*it).script(); - script += " check_enabled "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " "; - script += " > /dev/null )"; - ___MESSAGE___( "script: " << script.latin1() ); - (*it).button()->setEnabled( !(*it).script().isEmpty() && !system( script.latin1() ) ); + QDir rd( rootDirPath() ); + Script script; + script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";"; + script << (*it).script() << "check_enabled"; + script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + ___MESSAGE___( "script: " << script.script().latin1() ); + (*it).button()->setEnabled( !(*it).script().isEmpty() && !system( script.script().latin1() ) ); } } finishButton()->setEnabled( true ); @@ -2607,16 +2728,18 @@ void SALOME_InstallWizard::onButtonGroup( int rbIndex ) int prevType = installType; QString prevPlat = getPlatform(); QWidget* aPage = InstallWizard::currentPage(); - installType = InstallationType( rbIndex ); if ( aPage == typePage ) { + installType = InstallationType( rbIndex ); // management of the check-box removeSrcBtn->setEnabled( installType == Compile ); oneModDirBtn->setEnabled( installType == Binaries /*|| installType == Compile*/ ); oneProdDirBtn->setEnabled( installType == Binaries || installType == Compile ); + refPlatform = ""; + xmlFileName = getXmlFile( curPlatform ); } else if ( aPage == platformsPage ) { refPlatform = platBtnGrp->find( rbIndex )->name(); - xmlFileName = platformsMap[ refPlatform ]; + xmlFileName = getXmlFile( refPlatform ); setNextEnabled( platformsPage, true ); } if ( prevType != installType || @@ -2706,6 +2829,8 @@ void SALOME_InstallWizard::onStart() installInfo->setFinished( false ); passedParams->clear(); passedParams->setEnabled( false ); + // disable 'Ignore errors' checkbox during installation process + ignoreErrCBox->setEnabled( false ); QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f ); // update status label @@ -2736,16 +2861,18 @@ void SALOME_InstallWizard::onStart() item = (QCheckListItem*)( item->nextSibling() ); } // if something at all is selected - if ( (int)toInstall.count() > 1 ) { + if ( (int)toInstall.count() > 0 ) { if ( installType == Compile ) { // update status label statusLab->setText( tr( "Check Fortran compiler..." ) ); // check Fortran compiler. - QString script = "./config_files/checkFortran.sh find_compilers"; - script += " " + QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); - ___MESSAGE___( "script = " << script.latin1() ); - if ( system( script ) ) { + QDir rd( rootDirPath() ); + Script script; + script << QUOTE( rd.filePath( "config_files/checkFortran.sh" ) ) << "find_compilers"; + script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { QMessageBox::critical( this, tr( "Error" ), tr( "Fortran compiler was not found at current system!\n" @@ -2758,11 +2885,7 @@ void SALOME_InstallWizard::onStart() statusLab->setText( tr( "Installation has been aborted" ) ); // enable button setNextEnabled( true ); - nextButton()->setText( tr( "&Start" ) ); - setAboutInfo( nextButton(), tr( "Start installation process" ) ); - // reconnect Next button - to use it as Start button - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); // enable button setBackEnabled( true ); @@ -2828,10 +2951,12 @@ void SALOME_InstallWizard::onStart() // create a backup of 'env_build.csh', 'env_build.sh', 'env_products.csh', 'env_products.sh' // ( backup of 'salome.csh' and 'salome.sh' is made if pick-up environment is called ) - QString script = "./config_files/backupEnv.sh "; - script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); - ___MESSAGE___( "script = " << script.latin1() ); - if ( system( script ) ) { + QDir rd( rootDirPath() ); + Script script; + script << QUOTE( rd.filePath( "config_files/backupEnv.sh" ) ); + script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); + ___MESSAGE___( "script = " << script.script().latin1() ); + if ( system( script.script().latin1() ) ) { if ( QMessageBox::warning( this, tr( "Warning" ), tr( "Backup environment files have not been created.\n" @@ -2842,13 +2967,9 @@ void SALOME_InstallWizard::onStart() // installation aborted abort(); statusLab->setText( tr( "Installation has been aborted by user" ) ); - // enable button + // update button setNextEnabled( true ); - nextButton()->setText( tr( "&Start" ) ); - setAboutInfo( nextButton(), tr( "Start installation process" ) ); - // reconnect Next button - to use it as Start button - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); // enable button setBackEnabled( true ); @@ -2900,16 +3021,9 @@ void SALOME_InstallWizard::productInstalled() installInfo->setFinished( true ); // enable button setNextEnabled( true ); - nextButton()->setText( tr( "&Start" ) ); - setAboutInfo( nextButton(), tr( "Start installation process" ) ); - // reconnect Next button - to use it as Start button - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); - //nextButton()->setText( tr( "&Next >" ) ); - //setAboutInfo( nextButton(), tr( "Move to the next step of the installation procedure" ) ); - //disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); - //disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + //doPostActions( tr( "&Next >" ), tr( "Move to the next step of the installation procedure" ) ); //connect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); // enable button setBackEnabled( true ); @@ -3070,6 +3184,10 @@ void SALOME_InstallWizard::readFromStderr( ) installInfo->scrollToBottom(); hasErrors = true; } + + // stop or proceed installation process + manageInstProc(); + // VSR: 10/11/05 - disable answer mode ==> // passedParams->setEnabled( true ); // passedParams->setFocus(); @@ -3077,6 +3195,41 @@ void SALOME_InstallWizard::readFromStderr( ) // VSR: 10/11/05 - disable answer mode <== } // ================================================================ +/*! + * SALOME_InstallWizard::manageInstProc + * QProcess slot: -->stop installation if there is an error in stderr + */ +// ================================================================ +void SALOME_InstallWizard::manageInstProc() +{ + if ( !hasErrors || ignoreErrCBox->isChecked() ) + return; //proceed installation process + + // abort the current installation + statusLab->setText( tr( "Aborting installation..." ) ); + abort(); + statusLab->setText( tr( "Installation has been aborted because some errors" ) ); + if ( QMessageBox::critical( this, + tr( "Error" ), + tr( "Installation process has been stopped, because an error occured \n" + "during an installation of the current product!\n" + "Please see the installation progress view for more details about the error.\n\n" + "Do you want to save the installation log?" ), + tr( "&Save" ), + tr( "&Cancel" ), + QString::null, + 0, + 1 ) == 0 ) + saveLog(); + // enable button + setNextEnabled( true ); + doPostActions( tr( "&Start" ), tr( "Start installation process" ) ); + connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + // enable button + setBackEnabled( true ); + installInfo->setFinished( true ); +} +// ================================================================ /*! * SALOME_InstallWizard::setDependancies * Sets dependancies for the product item @@ -3087,6 +3240,24 @@ void SALOME_InstallWizard::setDependancies( QCheckListItem* item, Dependancies d productsMap[item] = dep; } // ================================================================ +/*! + * SALOME_InstallWizard::doPostActions + * Executes some actions after finish of installation process (successful or not) + */ +// ================================================================ +void SALOME_InstallWizard::doPostActions( const QString& btnText, + const QString& btnAboutInfo ) +{ + // update button + nextButton()->setText( btnText ); + setAboutInfo( nextButton(), btnAboutInfo ); + // reconnect Next button - to use it as Start button + disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) ); + disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) ); + // enable 'Ignore errors' checkbox + ignoreErrCBox->setEnabled( true ); +} +// ================================================================ /*! * SALOME_InstallWizard::addFinishButton * Add button for the page.