1 // File : SALOME_InstallWizard.hxx
2 // Created : Thu Dec 18 12:01:00 2002
3 // Author : Vadim SANDLER
5 // Module : Installation Wizard
6 // Copyright : 2004-2005 CEA
8 #ifndef __SALOME_InstallWizard
9 #define __SALOME_InstallWizard
11 #include "InstallWizard.h"
14 #include <qstringlist.h>
17 Class Dependancies : Products info
18 This class stores all product dependancies for correct work of installation procedure
19 smbName - parameter for launching install shell script (e.g. cas for CASCADE4.0).
20 dependsOn - list of products needed for correct installation of product
21 (e.g tcl is checked during installation of CASCADE 4).
22 sizeTotal - amount of disk space in Kbytes required for installation
24 sizeTemp - amount of disk space in Kbytes required for the temporary files
29 // default constructor, necessary for map
32 Dependancies( const QString& name,
33 const QStringList& depend,
35 const long Sourcessize,
37 const QString& def = QString::null,
38 const QString& descr = QString::null,
42 sizeSourcesTotal( Sourcessize ),
43 sizeBinaryTotal( Binsize ),
47 pickupEnv( pickup ) {}
50 QString getName() const { return smbName; }
52 QStringList getDependancies() const { return dependsOn; }
53 // gets disk space required
54 long getSize(bool sources = false) const { return ( sources ? sizeSourcesTotal : sizeBinaryTotal ); }
55 // gets temporary disk space required
56 long getTempSize() const { return sizeTemp; }
57 // gets product's description
58 QString getDescription() const { return description; }
60 QString getDefault() const { return defaultMode; }
61 // returns true if this product needs to pick-up environment
62 bool pickUpEnvironment() { return pickupEnv; }
65 QString smbName; // symbolic name
66 QStringList dependsOn; // prerequisites list
67 long sizeSourcesTotal; // disk space required
68 long sizeBinaryTotal; // disk space required
69 long sizeTemp; // disk space for temporary files required
70 QString defaultMode; // default installation mode
71 QString description; // product's description
72 bool pickupEnv; // "Pick-up environment" flag
91 typedef QMap<QCheckListItem*, Dependancies> MapProducts;
94 Class SALOME_InstallWizard : Installation Wizard's main window
96 class SALOME_InstallWizard: public InstallWizard
102 SALOME_InstallWizard(QString aXmlFileName);
104 virtual ~SALOME_InstallWizard( );
107 bool eventFilter( QObject* object, QEvent* event );
110 void setDependancies( QCheckListItem* item, Dependancies dep);
112 // process validation event (<val> is validation code)
113 void processValidateEvent( const int val, void* data );
116 // polishing of the widget
120 void setVersion( const QString& version ) { myVersion = version; }
122 void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); }
124 void setCopyright( const QString& copyright ) { myCopyright = copyright; }
126 void setLicense( const QString& license ) { myLicense = license; }
128 void setOS( const QString& OS ) { myOS = OS; }
131 QString getVersion() { return myVersion; }
133 QString getCaption() { return myCaption; }
135 QString getCopyright() { return myCopyright; }
137 QString getLicense() { return myLicense; }
139 QString getOS() { return myOS; }
140 // get InstallWizard's name
141 QString getIWName() { return myIWName; }
144 // updates caption according to the current page number
145 void updateCaption();
146 // close event handler
147 void closeEvent( QCloseEvent* ce );
148 // creates introduction page
149 void setupIntroPage();
150 // creates products page
151 void setupProductsPage();
152 // creates directories page
154 // creates prestart page
155 void setupCheckPage();
156 // creates progress page
157 void setupProgressPage();
158 // creates readme page
159 void setupReadmePage();
160 // displays choice info
161 void showChoiceInfo();
162 // validates page when <Next> button is clicked
163 bool acceptData( const QString& );
164 // calculates disk space required for the installation, returns true if any product selected to be installed (src, bin or native)
165 bool checkSize( long* totSize = 0, long* tempSize = 0 );
166 // checks products page validity (directories and products selection)
167 void checkProductPage();
168 // sets the product and all products this one depends on to be checked ( recursively )
169 void setPrerequisites( QCheckListItem* item );
170 // runs installation script
172 // searches product listview item with given symbolic name
173 QCheckListItem* findItem( const QString& sName );
174 // sets progress state to Aborted
176 // clears and (optionally) removes temporary directory
177 void clean(bool rmDir = false);
186 // called when user moves from page to page
187 void pageChanged( const QString & mytitle);
188 // invokes Help window
190 // invokes directory selection dialog box
191 void browseDirectory();
192 // called when directory path (target or temp) is changed
193 void directoryChanged( const QString& text );
194 // <Start> button's slot - runs installation
196 // called when users tries to pass parameters for the script
197 void onReturnPressed();
198 // callback function - as response for the script finishing
199 void productInstalled();
200 // called when <Cancel> button is clicked during installation script running
202 // kills installation process and quits application
204 // called when selection is changed in the products list view
205 void onSelectionChanged();
206 // called when user checks/unchecks any product item
207 void onItemToggled( QCheckListItem* );
208 // <Select Sources>, <Select Binaries>, <Unselect All> buttons slot
210 // <More...> button slot
212 // <Launch Salome> button slot
213 void onLaunchSalome();
216 // -->something was written to stdin
218 // -->something was written to stout
219 void readFromStdout();
220 // -->something was written to stderr
221 void readFromStderr();
224 QString myIWName; // Installation Wizard's name
225 QString myVersion; // version info
226 QString myCaption; // application name
227 QString myCopyright; // copyright info
228 QString myLicense; // license info
229 QString myOS; // operation system
231 HelpWindow* helpWindow; // help window
232 QProcess* shellProcess; // shell process (install script)
233 MapProducts productsMap; // products info (name, dependancies, disk space )
234 QStringList toInstall; // list of products being installed
235 QString xmlFileName; // xml file
236 bool moreMode; // advanced mode flag
237 QWidget* previousPage; // previous page
238 QString tmpCreated; // created temporary directory
239 bool exitConfirmed; // flag: "Exit confirmed"
241 // --> introduction page
242 QWidget* introPage; // page itself
243 QLabel* logoLab; // logo pixmap
244 QLabel* versionLab; // vesrsion info
245 QLabel* copyrightLab; // copyright info
246 QLabel* licenseLab; // license info
247 QLabel* info; // program info
249 QWidget* productsPage; // page itself
250 QLineEdit* targetFolder; // target directory for installing of products
251 QPushButton* targetBtn; // browse target directory button
252 QLineEdit* tempFolder; // directory for the temporary files: /tmp by default
253 QPushButton* tempBtn; // browse temp directory button
254 QLabel* requiredSize; // <Total disk space required> label
255 QLabel* requiredTemp; // <Space required for temporary files> label
256 QPushButton* moreBtn; // <More...> button
257 QWidget* moreBox; // container for the <More...> mode widgets
258 ProductsView* productsView; // products list view
259 QTextBrowser* productsInfo; // products info box
260 QCheckBox* prerequisites; // <Auto check prerequisites products> checkbox
261 QPushButton* selectSrcBtn; // <Select Sources> button - NOT USED CURRENTLY
262 QPushButton* selectBinBtn; // <Select Binaries> button - NOT USED CURRENTLY
263 QPushButton* unselectBtn; // <Unselect All> button
265 QWidget* prestartPage; // page itself
266 QTextEdit* choices; // choice text view
268 QWidget* progressPage; // page itself
269 QSplitter* splitter; // splitter window
270 QTextEdit* installInfo; // information about running installation scripts
271 QLabel* parametersLab; // answer field's label
272 QLineEdit* passedParams; // user can pass data to running script
273 QTextEdit* installProgress;// contains information about progress of installing selected products
274 ProgressView* progressView; // displays information about progress of installing selected products
276 QWidget* readmePage; // page itself
277 QTextEdit* readme; // Readme information window
278 QPushButton* runSalomeBtn; // <Launch Salome> buttnon
280 QProcessThread* myThread; // validation thread