Salome HOME
Implementation of building from source files
[tools/install.git] / src / SALOME_InstallWizard.cxx
index 1314744aa750dc8e67707d5fd0f2b288468b38f1..63941368fdcc842a733692b5d9d0cd8c9322b503 100644 (file)
@@ -427,7 +427,8 @@ public:
                      .arg( __IW_VERSION_MINOR__ ) \
                      .arg( __IW_VERSION_PATCH__ ) );
     QLabel* copyright = new QLabel( this, "copyright" );
-    copyright->setText( "<b>Copyright</b> &copy; 2002-2008 CEA" );
+    copyright->setText( "<b>Copyright</b> &copy; 2007-2008 CEA/DEN, EDF R&amp;D, OPEN CASCADE<br><br>"
+                       "<b>Copyright</b> &copy; 2003-2007 OPEN CASCADE,<br>EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&amp;D,<br>LEG, PRINCIPIA R&amp;D, BUREAU VERITAS");
     QFont font = title->font();
     font.setPointSize( (int)( font.pointSize() * 1.8 ) );
     title->setFont( font );
@@ -454,7 +455,7 @@ public:
     QFontMetrics fm( title->font() );
     int width = (int)( fm.width( tlt ) * 1.5 );
     title->setMinimumWidth( width );
-    setMaximumSize( minimumSize() );
+//     setMaximumSize( minimumSize() );
   }
   void mousePressEvent( QMouseEvent* )
   {
@@ -492,20 +493,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 +502,7 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   curPlatform = currentPlatform().join(" ");
 //   cout << "curOS = " << curPlatform << endl;
 //   curPlatform = "";
+  refPlatform = "";
   // ... check XML and platform definition
   getXmlAndPlatform();
 
@@ -533,10 +521,11 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
   addLogo( pixmap( pxLogo ) );
 
   // set defaults
-  setVersion( "4.1.3" );
+  setVersion( "5.1.0" );
   setCaption( tr( "SALOME %1" ).arg( myVersion ) );
-  setCopyright( tr( "Copyright (C) 2008 CEA" ) );
-  setLicense( tr( "All rights reserved." ) );
+  setCopyright( tr( "<h5>Copyright &copy; 2007-2008 CEA/DEN, EDF R&amp;D, OPEN CASCADE<br></h5>"
+               "<h5>Copyright &copy; 2003-2007 OPEN CASCADE,<br>EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&amp;D,<br>LEG, PRINCIPIA R&amp;D, BUREAU VERITAS</h5>" ));
+  setLicense( tr( "<h5>GNU LGPL</h5>" ) );
 
   ___MESSAGE___( "Configuration file : " << xmlFileName.latin1() );
   ___MESSAGE___( "Target directory   : " << myTargetPath.latin1() );
@@ -637,7 +626,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 +763,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 +1414,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 +1434,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 +1443,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 +1457,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 +1467,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 +1497,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 +1539,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 +2087,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 +2485,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 +2497,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 );
     }
@@ -2607,16 +2622,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 <Remove source and tmp files> 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 ||