Salome HOME
Fix pb. with result of checking libraries.
[tools/install.git] / src / SALOME_InstallWizard.cxx
index 7387affdde4805b718625f062789de8a14213176..55872456cadd32d7a64de0f142c167cdad0488b4 100644 (file)
@@ -469,7 +469,8 @@ public:
 // ================================================================
 SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
                                           const QString& aTargetDir,
-                                          const QString& aTmpDir)
+                                          const QString& aTmpDir,
+                                          const bool     aForceSrc)
      : InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ),
        helpWindow( NULL ),
        moreMode( false ),
@@ -482,6 +483,7 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   xmlFileName  = aXmlFileName;
   myTargetPath = aTargetDir;
   myTmpPath    = aTmpDir;
+  forceSrc     = aForceSrc;
   stateChanged = true;
   binPath = QDir::currentDirPath() + "/Products/BINARIES";
   srcPath = QDir::currentDirPath() + "/Products/SOURCES";
@@ -545,17 +547,12 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
 
   // create instance of class for starting shell script to get available disk space
   diskSpaceProc = new QProcess( this, "procDiskSpace" );
-  connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) );
-
   // create instance of class for starting shell install script
   shellProcess = new QProcess( this, "shellProcess" );
-
   // create instance of class for starting shell script to modify SALOME *.la files
   modifyLaProc = new QProcess( this, "modifyLaProc" );
-  connect(modifyLaProc, SIGNAL( processExited() ), this, SLOT( checkModifyLaResult() ) );
   // create instance of class for starting shell script to check Fortran libraries
   checkFLibProc = new QProcess( this, "checkFLibProc" );
-  connect(checkFLibProc, SIGNAL( processExited() ), this, SLOT( checkFLibResult() ) );
 
   // create introduction page
   setupIntroPage();
@@ -587,11 +584,19 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   connect( this, SIGNAL( helpClicked() ),  this, SLOT( helpClicked() ) );
   connect( this, SIGNAL( aboutClicked() ), this, SLOT( onAbout() ) );
 
-  // catch signals from launched script
+  // catch signals from launched diskSpaceProc
+  connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) );
+  // catch signals from launched shellProcess
   connect(shellProcess, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) );
   connect(shellProcess, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) );
   connect(shellProcess, SIGNAL( processExited() ),   this, SLOT( productInstalled() ) );
   connect(shellProcess, SIGNAL( wroteToStdin() ),    this, SLOT( wroteToStdin() ) );
+  // catch signals from launched modifyLaProc
+  connect(modifyLaProc, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) );
+  connect(modifyLaProc, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) );
+  connect(modifyLaProc, SIGNAL( processExited() ), this, SLOT( checkModifyLaResult() ) );
+  // catch signals from launched checkFLibProc
+  connect(checkFLibProc, SIGNAL( processExited() ), this, SLOT( checkFLibResult() ) );
 
   // create validation thread
   myThread = new ProcessThread( this );
@@ -1745,6 +1750,7 @@ void SALOME_InstallWizard::updateAvailableSpace()
 // ================================================================
 void SALOME_InstallWizard::runModifyLaFiles()
 {
+  modifyLaProc->clearArguments();
   // ... update status label
   statusLab->setText( tr( "Modification of *.la files of SALOME modules..." ) );
   // set process arguments
@@ -1773,10 +1779,20 @@ void SALOME_InstallWizard::checkModifyLaResult()
     statusLab->setText( tr( "Installation has been aborted" ) );
     QMessageBox::critical( this,
                           tr( "Error" ),
-                          tr( "There is a problem during modification of *.la SALOME files"),
+                          tr( "Modification of *.la SALOME files has not been completed."),
                           QMessageBox::Ok,
                           QMessageBox::NoButton,
                           QMessageBox::NoButton );
+    // enable <Next> 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() ) );
+    connect(    this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+    // enable <Back> button
+    setBackEnabled( true );
   }
 }
 // ================================================================
@@ -1788,6 +1804,7 @@ void SALOME_InstallWizard::checkModifyLaResult()
 void SALOME_InstallWizard::runCheckFLib()
 {
   // Check Fortran libraries
+  checkFLibProc->clearArguments();
   // ... update status label
   statusLab->setText( tr( "Check Fortran libraries..." ) );
   // ... search "not found" libraries
@@ -2093,18 +2110,18 @@ void SALOME_InstallWizard::launchScript()
     // ... binaries directory
     shellProcess->addArgument( binDir );
     // ... install SALOME with GUI or not?
-    if ( installGuiBtn->state() != QButton::On ) {
-      if ( woGuiModules.find( prodProc ) != woGuiModules.end() )
-       woGuiModules[ prodProc ] == True ? 
-         shellProcess->addArgument( "FALSE" ) : 
-         shellProcess->addArgument( "TRUE" );
-    }
+    if ( woGuiModules.find( prodProc ) != woGuiModules.end() )
+      ( installGuiBtn->state() != QButton::On && woGuiModules[ prodProc ] == True ) ? 
+       shellProcess->addArgument( "FALSE" ) : 
+       shellProcess->addArgument( "TRUE" );
     // ... single installation directory for SALOME modules, if this option was selected
     if ( oneModDirBtn->isChecked() ) {
       MapProducts::Iterator mapIter;
       for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter )
-       if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "component" )
+       if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "component" ) {
          shellProcess->addArgument( oneModDirName );
+         break;
+       }
     }
     // ... single installation directory for prerequisites, if this option was selected
     if ( oneProdDirBtn->isChecked() ) {
@@ -2113,8 +2130,10 @@ void SALOME_InstallWizard::launchScript()
       else {
        MapProducts::Iterator mapIter;
        for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter )
-         if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "prerequisite" )
+         if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "prerequisite" ) {
            shellProcess->addArgument( oneProdDirName );
+           break;
+         }
       }
     }
     
@@ -2432,7 +2451,8 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle)
   if ( aPage == typePage ) {
     // installation type page
     if ( buttonGrp->id( buttonGrp->selected() ) == -1 )
-      binBtn->animateClick(); // set default installation type
+      // set default installation type
+      forceSrc ? srcCompileBtn->animateClick() : binBtn->animateClick();
   }
   else if ( aPage == platformsPage ) {
     // installation platforms page
@@ -2658,6 +2678,7 @@ void SALOME_InstallWizard::onStart()
   if ( nextButton()->text() == tr( "&Stop" ) ) {
     statusLab->setText( tr( "Aborting installation..." ) );
     shellProcess->kill();
+    modifyLaProc->kill();
     while( shellProcess->isRunning() );
     statusLab->setText( tr( "Installation has been aborted by user" ) );
     return;
@@ -2918,6 +2939,8 @@ void SALOME_InstallWizard::tryTerminate()
 void SALOME_InstallWizard::onCancel()
 {
   shellProcess->kill();
+  modifyLaProc->kill();
+  checkFLibProc->kill();
   reject();
 }
 // ================================================================
@@ -2996,11 +3019,12 @@ void SALOME_InstallWizard::wroteToStdin( )
 void SALOME_InstallWizard::readFromStdout( )
 {
   ___MESSAGE___( "Something was sent to stdout" );
-  while ( shellProcess->canReadLineStdout() ) {
-    installInfo->append( QString( shellProcess->readLineStdout() ) );
+  QProcess* theProcess = ( QProcess* )sender();
+  while ( theProcess->canReadLineStdout() ) {
+    installInfo->append( QString( theProcess->readLineStdout() ) );
     installInfo->scrollToBottom();
   }
-  QString str( shellProcess->readStdout() );
+  QString str( theProcess->readStdout() );
   if ( !str.isEmpty() ) {
     installInfo->append( str );
     installInfo->scrollToBottom();
@@ -3018,12 +3042,13 @@ void SALOME_InstallWizard::readFromStdout( )
 void SALOME_InstallWizard::readFromStderr( )
 {
   ___MESSAGE___( "Something was sent to stderr" );
-  while ( shellProcess->canReadLineStderr() ) {
-    installInfo->append( OUTLINE_TEXT( QString( shellProcess->readLineStderr() ) ) );
+  QProcess* theProcess = ( QProcess* )sender();
+  while ( theProcess->canReadLineStderr() ) {
+    installInfo->append( OUTLINE_TEXT( QString( theProcess->readLineStderr() ) ) );
     installInfo->scrollToBottom();
     hasErrors = true;
   }
-  QString str( shellProcess->readStderr() );
+  QString str( theProcess->readStderr() );
   if ( !str.isEmpty() ) {
     installInfo->append( OUTLINE_TEXT( str ) );
     installInfo->scrollToBottom();