]> SALOME platform Git repositories - tools/install.git/blob - src/SALOME_InstallWizard.hxx
Salome HOME
- update images for PAL
[tools/install.git] / src / SALOME_InstallWizard.hxx
1 //  File      : SALOME_InstallWizard.hxx
2 //  Created   : Thu Dec 18 12:01:00 2002
3 //  Author    : Vadim SANDLER
4 //  Project   : PAL/SALOME
5 //  Module    : InstallWizard
6 //  Copyright : 2004 CEA
7 //  $Header$ 
8
9 #ifndef __SALOME_InstallWizard
10 #define __SALOME_InstallWizard
11
12 #include "InstallWizard.h"
13
14 #include <qmap.h>
15 #include <qstringlist.h> 
16
17 /*! 
18   Class Dependancies : Products info
19   This class stores all product dependancies for correct work of installation procedure
20      smbName   - parameter for launching install shell script (e.g. cas for CASCADE4.0).
21      dependsOn - list of products needed for correct installation of product
22                  (e.g tcl is checked during installation of CASCADE 4).
23      sizeTotal - amount of disk space in Kbytes required for installation 
24                  of this product
25      sizeTemp  - amount of disk space in Kbytes required for the temporary files
26 */
27 class Dependancies
28 {
29  public:
30   // default constructor, necessary for map
31   Dependancies() {}
32   // constructor
33   Dependancies( const QString& name, const QStringList& depend, const long Binsize,  const long Sourcessize, const long tempsize )
34     : smbName( name ), dependsOn( depend ), sizeSourcesTotal( Sourcessize ), sizeBinaryTotal( Binsize ), sizeTemp( tempsize ) {}
35
36   // gets symbolic name
37   QString     getName() const         { return smbName;   }
38   // gets dependancies
39   QStringList getDependancies() const { return dependsOn; }
40   // gets disk space required
41   long        getSize(bool sources = false) const         { 
42     if (sources) 
43       return sizeSourcesTotal;
44     else
45       return sizeBinaryTotal;
46   }
47   // gets temporary disk space required
48   long        getTempSize() const     { return sizeTemp;  }
49
50  private:
51   QString     smbName;          // symbolic name
52   QStringList dependsOn;        // prerequisites list
53   long        sizeSourcesTotal; // disk space required
54   long        sizeBinaryTotal;  // disk space required
55   long        sizeTemp;         // disk space for temporary files required
56 };
57
58 class QLineEdit;
59 class QPushButton;
60 class QListViewItem;
61 class QCheckListItem;
62 class QLabel;
63 class QTextEdit;
64 class QTextBrowser;
65 class QProcess;
66 class QCheckBox;
67 class QSplitter;
68
69 class ProductsView;
70 class ProgressView;
71 class HelpWindow;
72
73 typedef QMap<QCheckListItem*, Dependancies> MapProducts;
74
75 /*!
76   Class SALOME_InstallWizard : Installation Wizard's main window
77 */
78 class SALOME_InstallWizard: public InstallWizard
79 {
80   Q_OBJECT
81     
82  public:
83   // constructor
84   SALOME_InstallWizard(QString aXmlFileName);
85   // destructor
86   virtual ~SALOME_InstallWizard( );
87
88   // event filter
89   bool eventFilter( QObject* object, QEvent* event );
90
91   // set dependancies
92   void setDependancies( QCheckListItem* item, Dependancies dep);
93
94  public slots:
95   // polishing of the widget
96   void polish();
97   
98   // set version
99   void setVersion( const QString& version ) { myVersion = version; }
100   // set caption
101   void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); }
102   // set copyright
103   void setCopyright( const QString& copyright ) { myCopyright = copyright; }
104   // set license
105   void setLicense( const QString& license ) { myLicense = license; }
106   // set OS
107   void setOS( const QString& OS ) { myOS = OS; }
108
109   // get version
110   QString getVersion() { return myVersion; }
111   // get caption
112   QString getCaption() { return myCaption; }
113   // get copyright
114   QString getCopyright() { return myCopyright; }
115   // get license
116   QString getLicense() { return myLicense; }
117   // get OS
118   QString getOS() { return myOS; }
119   // get InstallWizard's name
120   QString getIWName() { return myIWName; }
121
122  protected:
123   // updates caption according to the current page number
124   void updateCaption();
125   // close event handler
126   void closeEvent( QCloseEvent* ce );
127   // creates introduction page
128   void setupIntroPage();   
129   // creates products page
130   void setupProductsPage();
131   // creates directories page
132   void setupDirPage();
133   // creates prestart page
134   void setupCheckPage();
135   // creates progress page
136   void setupProgressPage();
137   // creates readme page
138   void setupReadmePage();
139   // displays choice info
140   void showChoiceInfo();
141   // validates page when <Next> button is clicked
142   bool acceptData( const QString& ); 
143   // calculates disk space required for the installation, returns true if any product selected to be installed (src, bin or native)
144   bool checkSize( long* totSize = 0, long* tempSize = 0 );
145   // checks products page validity (directories and products selection)
146   void checkProductPage();
147   // sets the product and all products this one depends on to be checked ( recursively )
148   void setProductOn( QCheckListItem* item, int install = 1 );
149   // runs installation script
150   void launchScript(); 
151   // searches product listview item with given symbolic name 
152   QCheckListItem* findItem( const QString& sName );
153   // sets progress state to Aborted
154   void abort();
155   // clears and removes temporary directory
156   void clean();
157
158  protected slots:
159   // reject slot
160   void reject();
161   // accept slot
162   void accept();
163   
164  private slots:
165   // called when user moves from page to page
166   void pageChanged( const QString & mytitle);
167   // invokes Help window
168   void helpClicked();
169   // invokes directory selection dialog box
170   void browseDirectory();
171   // called when directory path (target or temp) is changed
172   void directoryChanged( const QString& text );
173   // <Start> button's slot - runs installation
174   void onStart();
175   // called when users tries to pass parameters for the script
176   void onReturnPressed();
177   // callback function - as response for the script finishing
178   void productInstalled();
179   // called when <Cancel> button is clicked during installation script running
180   void tryTerminate();
181   // kills installation process and quits application
182   void onCancel();
183   // called when selection is changed in the products list view
184   void onSelectionChanged();
185   // called when user checks/unchecks any product item
186   void onItemToggled( QCheckListItem* );
187   // <Select Sources>, <Select Binaries>, <Unselect All> buttons slot
188   void onProdBtn();
189   // <More...> button slot
190   void onMoreBtn();
191   // <Launch Salome> button slot
192   void onLaunchSalome();
193
194   // QProcess slots:
195   // -->something was written to stdin
196   void wroteToStdin();
197   // -->something was written to stout
198   void readFromStdout();
199   // -->something was written to stderr
200   void readFromStderr();
201
202  private:
203   QString       myIWName;       // Installation Wizard's name
204   QString       myVersion;      // version info
205   QString       myCaption;      // application name
206   QString       myCopyright;    // copyright info 
207   QString       myLicense;      // license info
208   QString       myOS;           // operation system
209   
210   HelpWindow*   helpWindow;     // help window
211   QProcess*     shellProcess;   // shell process (install script)
212   MapProducts   productsMap;    // products info (name, dependancies, disk space )
213   QStringList   toInstall;      // list of products being installed
214   QString       xmlFileName;    // xml file
215   bool          moreMode;       // advanced mode flag
216   QWidget*      previousPage;   // previous page
217   QString       tmpCreated;     // created temporary directory
218   bool          exitConfirmed;  // flag: "Exit confirmed"
219   // Widgets
220   // --> introduction page
221   QWidget*      introPage;      // page itself
222   QLabel*       logoLab;        // logo pixmap
223   QLabel*       versionLab;     // vesrsion info
224   QLabel*       copyrightLab;   // copyright info
225   QLabel*       licenseLab;     // license info
226   QLabel*       info;           // program info
227   // --> products page
228   QWidget*      productsPage;   // page itself
229   QLineEdit*    targetFolder;   // target directory for installing of products
230   QPushButton*  targetBtn;      // browse target directory button
231   QLineEdit*    tempFolder;     // directory for the temporary files: /tmp by default
232   QPushButton*  tempBtn;        // browse temp directory button
233   QLabel*       requiredSize;   // <Total disk space required> label
234   QLabel*       requiredTemp;   // <Space required for temporary files> label
235   QPushButton*  moreBtn;        // <More...> button
236   QWidget*      moreBox;        // container for the <More...> mode widgets
237   ProductsView* productsView;   // products list view
238   QTextBrowser* productsInfo;   // products info box
239   QCheckBox*    prerequisites;  // <Auto check prerequisites products> checkbox
240   QPushButton*  selectSrcBtn;   // <Select Sources> button - NOT USED CURRENTLY
241   QPushButton*  selectBinBtn;   // <Select Binaries> button - NOT USED CURRENTLY
242   QPushButton*  unselectBtn;    // <Unselect All> button
243   // --> prestart page
244   QWidget*      prestartPage;   // page itself
245   QTextEdit*    choices;        // choice text view
246   // --> progress page
247   QWidget*      progressPage;   // page itself
248   QSplitter*    splitter;       // splitter window
249   QTextEdit*    installInfo;    // information about running installation scripts
250   QLabel*       parametersLab;  // answer field's label
251   QLineEdit*    passedParams;   // user can pass data to running script
252   QTextEdit*    installProgress;// contains information about progress of installing selected products
253   ProgressView* progressView;   // displays information about progress of installing selected products
254   // --> readme page
255   QWidget*      readmePage;     // page itself
256   QTextEdit*    readme;         // Readme information window
257   QPushButton*  runSalomeBtn;   // <Launch Salome> buttnon
258 };
259
260 #endif