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,
39 const QString& ctx = QString::null,
43 sizeSourcesTotal( Sourcessize ),
44 sizeBinaryTotal( Binsize ),
49 pickupEnv( pickup ) {}
52 QString getName() const { return smbName; }
54 QStringList getDependancies() const { return dependsOn; }
55 // gets disk space required
56 long getSize(bool sources = false) const { return ( sources ? sizeSourcesTotal : sizeBinaryTotal ); }
57 // gets temporary disk space required
58 long getTempSize() const { return sizeTemp; }
59 // gets product's description
60 QString getDescription() const { return description; }
61 // gets product's context
62 QString getContext() const { return context; }
64 QString getDefault() const { return defaultMode; }
65 // returns true if this product needs to pick-up environment
66 bool pickUpEnvironment() { return pickupEnv; }
69 QString smbName; // symbolic name
70 QStringList dependsOn; // prerequisites list
71 long sizeSourcesTotal; // disk space required
72 long sizeBinaryTotal; // disk space required
73 long sizeTemp; // disk space for temporary files required
74 QString defaultMode; // default installation mode
75 QString description; // product's description
76 QString context; // product's context (salome sources, binaries or prerequisite)
77 bool pickupEnv; // "Pick-up environment" flag
96 typedef QMap<QCheckListItem*, Dependancies> MapProducts;
99 Class SALOME_InstallWizard : Installation Wizard's main window
101 class SALOME_InstallWizard: public InstallWizard
107 SALOME_InstallWizard(QString aXmlFileName);
109 virtual ~SALOME_InstallWizard( );
112 bool eventFilter( QObject* object, QEvent* event );
115 void setDependancies( QCheckListItem* item, Dependancies dep);
117 // process validation event (<val> is validation code)
118 void processValidateEvent( const int val, void* data );
121 // polishing of the widget
125 void setVersion( const QString& version ) { myVersion = version; }
127 void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); }
129 void setCopyright( const QString& copyright ) { myCopyright = copyright; }
131 void setLicense( const QString& license ) { myLicense = license; }
133 void setOS( const QString& OS ) { myOS = OS; }
136 QString getVersion() { return myVersion; }
138 QString getCaption() { return myCaption; }
140 QString getCopyright() { return myCopyright; }
142 QString getLicense() { return myLicense; }
144 QString getOS() { return myOS; }
145 // get InstallWizard's name
146 QString getIWName() { return myIWName; }
149 // updates caption according to the current page number
150 void updateCaption();
151 // close event handler
152 void closeEvent( QCloseEvent* ce );
153 // creates introduction page
154 void setupIntroPage();
155 // creates products page
156 void setupProductsPage();
157 // creates directories page
159 // creates prestart page
160 void setupCheckPage();
161 // creates progress page
162 void setupProgressPage();
163 // creates readme page
164 void setupReadmePage();
165 // displays choice info
166 void showChoiceInfo();
167 // validates page when <Next> button is clicked
168 bool acceptData( const QString& );
169 // calculates disk space required for the installation, returns true if any product selected to be installed (src, bin or native)
170 bool checkSize( long* totSize = 0, long* tempSize = 0 );
171 // checks products page validity (directories and products selection)
172 void checkProductPage();
173 // sets the product and all products this one depends on to be checked ( recursively )
174 void setPrerequisites( QCheckListItem* item );
175 // runs installation script
177 // searches product listview item with given symbolic name
178 QCheckListItem* findItem( const QString& sName );
179 // sets progress state to Aborted
181 // clears and (optionally) removes temporary directory
182 void clean(bool rmDir = false);
191 // called when user moves from page to page
192 void pageChanged( const QString & mytitle);
193 // invokes Help window
195 // invokes directory selection dialog box
196 void browseDirectory();
197 // called when directory path (target or temp) is changed
198 void directoryChanged( const QString& text );
199 // <Start> button's slot - runs installation
201 // called when users tries to pass parameters for the script
202 void onReturnPressed();
203 // callback function - as response for the script finishing
204 void productInstalled();
205 // called when <Cancel> button is clicked during installation script running
207 // kills installation process and quits application
209 // called when selection is changed in the products list view
210 void onSelectionChanged();
211 // called when user checks/unchecks any product item
212 void onItemToggled( QCheckListItem* );
213 // <SALOME sources>, <SALOME binaries>, <Unselect All> buttons slot
215 // <More...> button slot
217 // <Launch Salome> button slot
218 void onLaunchSalome();
221 // -->something was written to stdin
223 // -->something was written to stout
224 void readFromStdout();
225 // -->something was written to stderr
226 void readFromStderr();
229 QString myIWName; // Installation Wizard's name
230 QString myVersion; // version info
231 QString myCaption; // application name
232 QString myCopyright; // copyright info
233 QString myLicense; // license info
234 QString myOS; // operation system
236 HelpWindow* helpWindow; // help window
237 QProcess* shellProcess; // shell process (install script)
238 MapProducts productsMap; // products info (name, dependancies, disk space )
239 QStringList toInstall; // list of products being installed
240 QString xmlFileName; // xml file
241 bool moreMode; // advanced mode flag
242 QWidget* previousPage; // previous page
243 QString tmpCreated; // created temporary directory
244 bool exitConfirmed; // flag: "Exit confirmed"
246 // --> introduction page
247 QWidget* introPage; // page itself
248 QLabel* logoLab; // logo pixmap
249 QLabel* versionLab; // vesrsion info
250 QLabel* copyrightLab; // copyright info
251 QLabel* licenseLab; // license info
252 QLabel* info; // program info
254 QWidget* productsPage; // page itself
255 QLineEdit* targetFolder; // target directory for installing of products
256 QPushButton* targetBtn; // browse target directory button
257 QLineEdit* tempFolder; // directory for the temporary files: /tmp by default
258 QPushButton* tempBtn; // browse temp directory button
259 QLabel* requiredSize; // <Total disk space required> label
260 QLabel* requiredTemp; // <Space required for temporary files> label
261 QPushButton* moreBtn; // <More...> button
262 QWidget* moreBox; // container for the <More...> mode widgets
263 ProductsView* productsView; // products list view
264 QTextBrowser* productsInfo; // products info box
265 QCheckBox* prerequisites; // <Auto check prerequisites products> checkbox
266 QMyCheckBox* selectSrcBtn; // <SALOME sources> check box
267 QMyCheckBox* selectBinBtn; // <SALOME binaries> check box
268 QPushButton* unselectBtn; // <Unselect All> button
270 QWidget* prestartPage; // page itself
271 QTextEdit* choices; // choice text view
273 QWidget* progressPage; // page itself
274 QSplitter* splitter; // splitter window
275 QTextEdit* installInfo; // information about running installation scripts
276 QLabel* parametersLab; // answer field's label
277 QLineEdit* passedParams; // user can pass data to running script
278 QTextEdit* installProgress;// contains information about progress of installing selected products
279 ProgressView* progressView; // displays information about progress of installing selected products
281 QWidget* readmePage; // page itself
282 QTextEdit* readme; // Readme information window
283 QPushButton* runSalomeBtn; // <Launch Salome> buttnon
285 QProcessThread* myThread; // validation thread