Salome HOME
Fixed problems:
authormaintenance team <salome-mnt@opencascade.com>
Mon, 24 Nov 2008 12:34:45 +0000 (12:34 +0000)
committermaintenance team <salome-mnt@opencascade.com>
Mon, 24 Nov 2008 12:34:45 +0000 (12:34 +0000)
1. installation on unknown platform
2. detecting absence of source files

src/SALOME_InstallWizard.cxx
src/SALOME_InstallWizard.hxx

index 1314744aa750dc8e67707d5fd0f2b288468b38f1..b5ec6711bab3c16f6b075b65f256bb2ac6e9662d 100644 (file)
@@ -492,20 +492,6 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   srcPath = QDir::currentDirPath() + "/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";
   
   //
@@ -515,6 +501,7 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   curPlatform = currentPlatform().join(" ");
 //   cout << "curOS = " << curPlatform << endl;
 //   curPlatform = "";
+  refPlatform = "";
   // ... check XML and platform definition
   getXmlAndPlatform();
 
@@ -637,7 +624,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;
@@ -774,8 +761,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" );
        }
@@ -1425,7 +1412,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 +1432,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 +1441,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 +1455,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 +1465,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 )
@@ -1524,7 +1514,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" ),
@@ -2072,7 +2062,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
@@ -2470,6 +2460,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
@@ -2488,7 +2480,9 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle)
          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 );
     }
@@ -2613,10 +2607,12 @@ void SALOME_InstallWizard::onButtonGroup( int rbIndex )
     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 || 
index 6165010d2f6e0b4f8713bce1fcfd8112e25504d4..3d18fac874912424587fe1e09d9e27b45fb1b5b8 100644 (file)
@@ -215,7 +215,13 @@ class SALOME_InstallWizard: public InstallWizard
   // get license
   QString getLicense() { return myLicense; }
   // get platform
-  QString getPlatform() { return refPlatform ? refPlatform : curPlatform; }
+  QString getPlatform() { return !refPlatform.isEmpty() ? refPlatform : curPlatform; }
+  // get corresponding XML file
+  QString getXmlFile( const QString& platform ) {
+    return (platformsMap.find( platform ) != platformsMap.end() ) ? 
+      platformsMap[ platform ] : 
+      QString("");
+  }
   // get InstallWizard's name
   QString getIWName() { return myIWName; }
 
@@ -367,7 +373,6 @@ class SALOME_InstallWizard: public InstallWizard
   QString          srcPath;        // sources path
   QString          oneProdDirName; // name of the single directory for binaries of prerequisites
   QString          commonPlatform; // platform with universal binaries
-  QStringList      singleBinPlts;  // list of platforms for that the special binary packages are exist
   bool             moreMode;       // advanced mode flag
   QWidget*         previousPage;   // previous page
   QString          tmpCreated;     // created temporary directory