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
58 return ( sources ? sizeSourcesTotal : sizeBinaryTotal );
60 // gets temporary disk space required
61 long getTempSize() const { return sizeTemp; }
62 // gets product's description
63 QString getDescription() const { return description; }
64 // gets product's context
65 QString getContext() const { return context; }
66 // returns true if product supports given context
67 bool hasContext( const QString& ctx ) const
69 QStringList cl = QStringList::split(",",context);
70 return cl.find( ctx ) != cl.end();
73 QString getDefault() const { return defaultMode; }
74 // returns true if this product needs to pick-up environment
75 bool pickUpEnvironment() { return pickupEnv; }
78 QString smbName; // symbolic name
79 QStringList dependsOn; // prerequisites list
80 long sizeSourcesTotal; // disk space required
81 long sizeBinaryTotal; // disk space required
82 long sizeTemp; // disk space for temporary files required
83 QString defaultMode; // default installation mode
84 QString description; // product's description
85 QString context; // product's context (salome sources, binaries or prerequisite)
86 bool pickupEnv; // "Pick-up environment" flag
100 class QProcessThread;
105 typedef QMap<QCheckListItem*, Dependancies> MapProducts;
108 Class SALOME_InstallWizard : Installation Wizard's main window
110 class SALOME_InstallWizard: public InstallWizard
116 SALOME_InstallWizard(QString aXmlFileName);
118 virtual ~SALOME_InstallWizard( );
121 bool eventFilter( QObject* object, QEvent* event );
124 void setDependancies( QCheckListItem* item, Dependancies dep);
126 // process validation event (<val> is validation code)
127 void processValidateEvent( const int val, void* data );
130 // polishing of the widget
134 void setVersion( const QString& version ) { myVersion = version; }
136 void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); }
138 void setCopyright( const QString& copyright ) { myCopyright = copyright; }
140 void setLicense( const QString& license ) { myLicense = license; }
142 void setOS( const QString& OS ) { myOS = OS; }
145 QString getVersion() { return myVersion; }
147 QString getCaption() { return myCaption; }
149 QString getCopyright() { return myCopyright; }
151 QString getLicense() { return myLicense; }
153 QString getOS() { return myOS; }
154 // get InstallWizard's name
155 QString getIWName() { return myIWName; }
158 // updates caption according to the current page number
159 void updateCaption();
160 // close event handler
161 void closeEvent( QCloseEvent* ce );
162 // creates introduction page
163 void setupIntroPage();
164 // creates products page
165 void setupProductsPage();
166 // creates directories page
168 // creates prestart page
169 void setupCheckPage();
170 // creates progress page
171 void setupProgressPage();
172 // creates readme page
173 void setupReadmePage();
174 // displays choice info
175 void showChoiceInfo();
176 // validates page when <Next> button is clicked
177 bool acceptData( const QString& );
178 // calculates disk space required for the installation, returns true if any product selected to be installed (src, bin or native)
179 bool checkSize( long* totSize = 0, long* tempSize = 0 );
180 // checks products page validity (directories and products selection)
181 void checkProductPage();
182 // sets the product and all products this one depends on to be checked ( recursively )
183 void setPrerequisites( QCheckListItem* item );
184 // runs installation script
186 // searches product listview item with given symbolic name
187 QCheckListItem* findItem( const QString& sName );
188 // sets progress state to Aborted
190 // clears and (optionally) removes temporary directory
191 void clean(bool rmDir = false);
200 // called when user moves from page to page
201 void pageChanged( const QString & mytitle);
202 // invokes Help window
204 // invokes directory selection dialog box
205 void browseDirectory();
206 // called when directory path (target or temp) is changed
207 void directoryChanged( const QString& text );
208 // <Start> button's slot - runs installation
210 // called when users tries to pass parameters for the script
211 void onReturnPressed();
212 // callback function - as response for the script finishing
213 void productInstalled();
214 // called when <Cancel> button is clicked during installation script running
216 // kills installation process and quits application
218 // called when selection is changed in the products list view
219 void onSelectionChanged();
220 // called when user checks/unchecks any product item
221 void onItemToggled( QCheckListItem* );
222 // <SALOME sources>, <SALOME binaries>, <Unselect All> buttons slot
224 // <More...> button slot
226 // <Launch Salome> button slot
227 void onLaunchSalome();
230 // -->something was written to stdin
232 // -->something was written to stout
233 void readFromStdout();
234 // -->something was written to stderr
235 void readFromStderr();
238 QString myIWName; // Installation Wizard's name
239 QString myVersion; // version info
240 QString myCaption; // application name
241 QString myCopyright; // copyright info
242 QString myLicense; // license info
243 QString myOS; // operation system
245 HelpWindow* helpWindow; // help window
246 QProcess* shellProcess; // shell process (install script)
247 MapProducts productsMap; // products info (name, dependancies, disk space )
248 QStringList toInstall; // list of products being installed
249 QString xmlFileName; // xml file
250 bool moreMode; // advanced mode flag
251 QWidget* previousPage; // previous page
252 QString tmpCreated; // created temporary directory
253 bool exitConfirmed; // flag: "Exit confirmed"
255 // --> introduction page
256 QWidget* introPage; // page itself
257 QLabel* logoLab; // logo pixmap
258 QLabel* versionLab; // vesrsion info
259 QLabel* copyrightLab; // copyright info
260 QLabel* licenseLab; // license info
261 QLabel* info; // program info
263 QWidget* productsPage; // page itself
264 QLineEdit* targetFolder; // target directory for installing of products
265 QPushButton* targetBtn; // browse target directory button
266 QLineEdit* tempFolder; // directory for the temporary files: /tmp by default
267 QPushButton* tempBtn; // browse temp directory button
268 QLabel* requiredSize; // <Total disk space required> label
269 QLabel* requiredTemp; // <Space required for temporary files> label
270 QPushButton* moreBtn; // <More...> button
271 QWidget* moreBox; // container for the <More...> mode widgets
272 ProductsView* productsView; // products list view
273 QTextBrowser* productsInfo; // products info box
274 QCheckBox* prerequisites; // <Auto check prerequisites products> checkbox
275 QMyCheckBox* selectSrcBtn; // <SALOME sources> check box
276 QMyCheckBox* selectBinBtn; // <SALOME binaries> check box
277 QPushButton* unselectBtn; // <Unselect All> button
279 QWidget* prestartPage; // page itself
280 QTextEdit* choices; // choice text view
282 QWidget* progressPage; // page itself
283 QSplitter* splitter; // splitter window
284 QTextEdit* installInfo; // information about running installation scripts
285 QLabel* parametersLab; // answer field's label
286 QLineEdit* passedParams; // user can pass data to running script
287 QTextEdit* installProgress;// contains information about progress of installing selected products
288 ProgressView* progressView; // displays information about progress of installing selected products
290 QWidget* readmePage; // page itself
291 QTextEdit* readme; // Readme information window
292 QPushButton* runSalomeBtn; // <Launch Salome> buttnon
294 QProcessThread* myThread; // validation thread