Salome HOME
Update fro new products
[tools/install.git] / src / SALOME_InstallWizard.hxx
index 901b46b4376fc5cc032bc49731580a3d2ff6c674..94a6c9345aefd25b90363d255211b61fe9d92eed 100644 (file)
@@ -3,7 +3,7 @@
 //  Author    : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
 //  Project   : SALOME
 //  Module    : Installation Wizard
-//  Copyright : 2002-2007 CEA
+//  Copyright : 2002-2009 CEA
 
 #ifndef __SALOME_InstallWizard
 #define __SALOME_InstallWizard
@@ -36,6 +36,8 @@ class QButtonGroup;
 
 // This enum describes the possible types of the SALOME installation
 enum InstallationType { Binaries, Sources, Compile };
+// This enum describes the possible states of a tristate parameter
+enum BoolTristate { False, True, NotDefined };
 
 /*! 
   Class Dependancies : Products info
@@ -56,7 +58,8 @@ class Dependancies
                 const QString&     vers = QString::null,
                 const QString&     descr = QString::null,
                 const QString&     tp = QString::null,
-                bool               pickup = false )
+                bool               pickup = false,
+               BoolTristate       woGui = NotDefined )
     : smbName( name ), 
       dependsOn( depend ), 
       sizeBinaryTotal( Binsize ), 
@@ -66,7 +69,8 @@ class Dependancies
       version( vers ),
       description( descr ),
       type( tp ),
-      pickupEnv( pickup ) {}
+      pickupEnv( pickup ),
+      woGuiMode( woGui ) {}
 
   // gets symbolic name
   QString     getName() const         { return smbName;   }
@@ -75,8 +79,9 @@ class Dependancies
   // gets disk space required
   long        getSize( InstallationType instType ) const 
   { 
-    return ( instType == Binaries ? ( type == "component" ? sizeBinaryTotal + sizeSourcesTotal : sizeBinaryTotal ) :
-            ( instType == Sources ? sizeSourcesTotal : sizeSrcBuildTotal ) );
+    return instType == Binaries ? sizeBinaryTotal : 
+      instType == Sources ? sizeSourcesTotal : 
+      sizeSrcBuildTotal;
   }
   // gets temporary disk space required
   long        getTempSize( InstallationType instType ) const     
@@ -89,16 +94,10 @@ class Dependancies
   QString     getDescription() const  { return description; }
   // gets product's type
   QString     getType() const         { return type; }
-  // returns true if product supports given type
-  bool        hasType( const QString& tp ) const
-  {
-    QStringList tl = QStringList::split(",",type);
-    return tl.find( tp ) != tl.end();
-  }
-  // gets default mode
-  QString     getDefault() const      { return ""; }
   // returns true if this product needs to pick-up environment
   bool        pickUpEnvironment()     { return pickupEnv; }
+  // returns true if this product supports installation without GUI mode
+  BoolTristate supportWoGuiMode()     { return woGuiMode; }
 
  private:
   QString     smbName;           // symbolic name
@@ -111,6 +110,7 @@ class Dependancies
   QString     description;       // product's description
   QString     type;              // product's type (salome sources, binaries or prerequisite)
   bool        pickupEnv;        // "Pick-up environment" flag
+  BoolTristate woGuiMode;        // support of installation without GUI flag
 };
 
 /*! 
@@ -149,6 +149,7 @@ class Button
 typedef QMap<QCheckListItem*, Dependancies> MapProducts;
 typedef QValueList<Button>                  ButtonList;
 typedef QMap<QString, QString>              MapXmlFiles;
+typedef QMap<QString, BoolTristate>         MapAttrStates;
 
 /*!
   Class SALOME_InstallWizard : Installation Wizard's main window
@@ -161,17 +162,25 @@ class SALOME_InstallWizard: public InstallWizard
   // constructor
   SALOME_InstallWizard( const QString& aXmlFileName = QString::null,
                        const QString& aTargetDir   = QString::null,
-                       const QString& aTmpDir      = QString::null );
+                       const QString& aTmpDir      = QString::null,
+                       const bool     aForceSrc    = false,
+                       const bool     aSingleDir   = false );
   // destructor
   virtual ~SALOME_InstallWizard( );
 
+  // get base platform to install binaries package
+  QString getBasePlatform();
   // get current platform
-  QString currentPlatform();
+  static QStringList currentPlatform();
+  // get application root dir
+  static QString     rootDirPath();
 
   // get binaries path
-  QString getBinPath() { return binPath; }
+  QString getBinPath() const { return binPath; }
   // get sources path
-  QString getSrcPath() { return srcPath; }
+  QString getSrcPath() const { return srcPath; }
+  // get platform binaries path
+  QString getPlatformBinPath( const QString& ) const;
 
   // get map of supported platforms and corresponding XML files
   MapXmlFiles getXmlMap( const QString& aXmlFileName = QString::null );
@@ -184,6 +193,10 @@ class SALOME_InstallWizard: public InstallWizard
   // set dependancies
   void setDependancies( QCheckListItem* item, Dependancies dep);
 
+  // executes some actions after finish of installation process (successful or not)
+  void doPostActions( const QString& btnText,
+                     const QString& btnAboutInfo );
+
   // add button for the <Finish> page
   void addFinishButton( const QString& label, 
                        const QString& tooltip, 
@@ -198,6 +211,8 @@ class SALOME_InstallWizard: public InstallWizard
   void setCopyright( const QString& copyright ) { myCopyright = copyright; }
   // set license
   void setLicense( const QString& license ) { myLicense = license; }
+  // set list of optional libraries
+  void setOptionalLibs( const QString& optlibs ) { myOptLibs = QStringList::split( ",", optlibs ); }
 
   // get version
   QString getVersion() { return myVersion; }
@@ -207,8 +222,16 @@ class SALOME_InstallWizard: public InstallWizard
   QString getCopyright() { return myCopyright; }
   // get license
   QString getLicense() { return myLicense; }
+  // get list of optional libraries
+  QStringList getOptionalLibs() { return myOptLibs; }
   // 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; }
 
@@ -267,6 +290,10 @@ class SALOME_InstallWizard: public InstallWizard
   void clean(bool rmDir = false);
   // Update GUI and check installation errors
   void completeInstallation();
+  // Run the modification of SALOME *.la files
+  void runModifyLaFiles();
+  // Run the Fortran libraries checking
+  void runCheckFLib();
 
  protected slots:
   // reject slot
@@ -305,8 +332,12 @@ class SALOME_InstallWizard: public InstallWizard
   void onMoreBtn();
   // Slot to update 'Available disk space' field
   void updateAvailableSpace();
+  // Slot to take result of modification SALOME *.la files
+  void checkModifyLaResult();
   // Slot to take result of Fortran libraries checking
   void checkFLibResult();
+  // Slot to update 'Size' column for modules and prerequisites
+  void updateSizeColumn();
 
   // <Finish> page buttons slot
   void onFinishButton();
@@ -321,6 +352,8 @@ class SALOME_InstallWizard: public InstallWizard
   void readFromStdout();
   // -->something was written to stderr
   void readFromStderr();
+  // -->stop installation process if there is an error in stderr
+  void manageInstProc();
 
  private:
   QString          myIWName;       // Installation Wizard's name
@@ -330,15 +363,19 @@ class SALOME_InstallWizard: public InstallWizard
   QString          myLicense;      // license info
   QString          myTargetPath;   // target directory path
   QString          myTmpPath;      // temporary directory path
+  QStringList      myOptLibs;      // list of optional libraries
   
   HelpWindow*      helpWindow;     // help window
   QProcess*        shellProcess;   // shell process (install script)
   QProcess*        diskSpaceProc;  // shell process (to get available disk space script)
-  QProcess*        checkFLibProc;  // shell process (to get available disk space script)
+  QProcess*        modifyLaProc;   // shell process (to modify SALOME *.la files script)
+  QProcess*        checkFLibProc;  // shell process (to check Fortran libraries script)
   MapProducts      productsMap;    // products info (name, dependancies, disk space )
+  MapXmlFiles      extraProducts;  // additional products to be installed
   QStringList      toInstall;      // list of products being installed
   QStringList      notInstall;     // list of products being not installed
   QStringList      prodSequence;   // specified list of products being installed
+  MapAttrStates    woGuiModules;   // map of SALOME modules names, that can 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, 
@@ -347,11 +384,14 @@ class SALOME_InstallWizard: public InstallWizard
   QString          xmlFileName;    // xml file
   QString          binPath;        // binaries path
   QString          srcPath;        // sources path
+  QString          oneProdDirName; // name of the single directory for binaries of prerequisites
+  QString          commonPlatform; // platform with universal binaries
   bool             moreMode;       // advanced mode flag
   QWidget*         previousPage;   // previous page
   QString          tmpCreated;     // created temporary directory
   bool             stateChanged;   // flag: whether installation type or platform was changed
   bool             exitConfirmed;  // flag: "Exit confirmed"
+  bool             rmSrcPrevState; // flag: status of "Remove SRC & TMP files" is changed ?
   // Widgets
   // --> introduction page
   QWidget*         introPage;      // page itself
@@ -366,12 +406,14 @@ class SALOME_InstallWizard: public InstallWizard
   QRadioButton*    binBtn;         // install binaries button
   QRadioButton*    srcBtn;         // install sources button
   QRadioButton*    srcCompileBtn;  // install sources and compile button
-  QMyCheckBox*     removeSrcBtn;   // <Remove sources & tmp files> checkbox
+  QCheckBox*       removeSrcBtn;   // <Remove sources & tmp files> checkbox
+  bool             forceSrc;       // Force all products to be compiled from sources
   // --> installation platform page
   QWidget*         platformsPage;  // page itself
   QButtonGroup*    platBtnGrp;     // group of platforms for selection
   QString          warnMsg;        // warning message
   QLabel*          warnLab;        // warning label
+  QLabel*          warnLab3;       // additional warning label
   // --> installation directories page
   QWidget*         dirPage;        // page itself
   QLineEdit*       targetFolder;   // target directory for installing of products
@@ -383,11 +425,14 @@ class SALOME_InstallWizard: public InstallWizard
   ProductsView*    modulesView;    // modules list view
   QMyCheckBox*     installGuiBtn;  // <Installation with GUI> checkbox
   ProductsView*    prereqsView;    // prerequisites list view
-  QPushButton*     moreBtn;        // <More...> button
+  QMyCheckBox*     oneModDirBtn;   // <Install SALOME modules to a single directory> checkbox
+  QMyCheckBox*     oneProdDirBtn;  // <Install prerequisites to a single directory> checkbox
+  QPushButton*     moreBtn;        // <Show/Hide prerequisites> button
   QTextBrowser*    productInfo;    // products info box
   QLabel*          requiredSize;   // <Total disk space required> label
   QLabel*          requiredTemp;   // <Space required for temporary files> label
   QLabel*          availableSize;  // <Available disk space> label
+  bool             singleDir;      // Force all SALOME modules to be installed into single directory
   // --> prestart page
   QWidget*         prestartPage;   // page itself
   QTextEdit*       choices;        // choice text view
@@ -399,6 +444,7 @@ class SALOME_InstallWizard: public InstallWizard
   QLineEdit*       passedParams;   // user can pass data to running script
   QTextEdit*       installProgress;// contains information about progress of installing selected products
   ProgressView*    progressView;   // displays information about progress of installing selected products
+  QCheckBox*       ignoreErrCBox;  // checkbox to ignore installation errors
   QLabel*          statusLab;      // displays currently performed action
   // --> finish page
   QWidget*         readmePage;     // page itself