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
106 typedef QMap<QCheckListItem*, Dependancies> MapProducts;
109 Class SALOME_InstallWizard : Installation Wizard's main window
111 class SALOME_InstallWizard: public InstallWizard
117 SALOME_InstallWizard(const QString& aXmlFileName,
118 const QString& aTargetDir = QString::null,
119 const QString& aTmpDir = QString::null);
121 virtual ~SALOME_InstallWizard( );
124 bool eventFilter( QObject* object, QEvent* event );
127 void setDependancies( QCheckListItem* item, Dependancies dep);
129 // process validation event (<val> is validation code)
130 void processValidateEvent( const int val, void* data );
133 // polishing of the widget
137 void setVersion( const QString& version ) { myVersion = version; }
139 void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); }
141 void setCopyright( const QString& copyright ) { myCopyright = copyright; }
143 void setLicense( const QString& license ) { myLicense = license; }
145 void setOS( const QString& OS ) { myOS = OS; }
148 QString getVersion() { return myVersion; }
150 QString getCaption() { return myCaption; }
152 QString getCopyright() { return myCopyright; }
154 QString getLicense() { return myLicense; }
156 QString getOS() { return myOS; }
157 // get InstallWizard's name
158 QString getIWName() { return myIWName; }
160 // save install log to file
164 // updates caption according to the current page number
165 void updateCaption();
166 // close event handler
167 void closeEvent( QCloseEvent* ce );
168 // creates introduction page
169 void setupIntroPage();
170 // creates products page
171 void setupProductsPage();
172 // creates directories page
174 // creates prestart page
175 void setupCheckPage();
176 // creates progress page
177 void setupProgressPage();
178 // creates readme page
179 void setupReadmePage();
180 // displays choice info
181 void showChoiceInfo();
182 // validates page when <Next> button is clicked
183 bool acceptData( const QString& );
184 // calculates disk space required for the installation, returns true if any product selected to be installed (src, bin or native)
185 bool checkSize( long* totSize = 0, long* tempSize = 0 );
186 // checks products page validity (directories and products selection)
187 void checkProductPage();
188 // sets the product and all products this one depends on to be checked ( recursively )
189 void setPrerequisites( QCheckListItem* item );
190 // runs installation script
192 // searches product listview item with given symbolic name
193 QCheckListItem* findItem( const QString& sName );
194 // sets progress state to Aborted
196 // clears and (optionally) removes temporary directory
197 void clean(bool rmDir = false);
206 // called when user moves from page to page
207 void pageChanged( const QString & mytitle);
208 // invokes Help window
210 // invokes directory selection dialog box
211 void browseDirectory();
212 // called when directory path (target or temp) is changed
213 void directoryChanged( const QString& text );
214 // <Start> button's slot - runs installation
216 // called when users tries to pass parameters for the script
217 void onReturnPressed();
218 // callback function - as response for the script finishing
219 void productInstalled();
220 // called when <Cancel> button is clicked during installation script running
222 // kills installation process and quits application
224 // called when selection is changed in the products list view
225 void onSelectionChanged();
226 // called when user checks/unchecks any product item
227 void onItemToggled( QCheckListItem* );
228 // <SALOME sources>, <SALOME binaries>, <Unselect All> buttons slot
230 // <More...> button slot
232 // <Launch Salome> button slot
233 void onLaunchSalome();
234 // <About> button slot
238 // -->something was written to stdin
240 // -->something was written to stout
241 void readFromStdout();
242 // -->something was written to stderr
243 void readFromStderr();
246 QString myIWName; // Installation Wizard's name
247 QString myVersion; // version info
248 QString myCaption; // application name
249 QString myCopyright; // copyright info
250 QString myLicense; // license info
251 QString myOS; // operation system
253 HelpWindow* helpWindow; // help window
254 QProcess* shellProcess; // shell process (install script)
255 MapProducts productsMap; // products info (name, dependancies, disk space )
256 QStringList toInstall; // list of products being installed
257 QString xmlFileName; // xml file
258 QString targetDirPath; // target directory
259 QString tmpDirPath; // temporary directory
260 bool moreMode; // advanced mode flag
261 QWidget* previousPage; // previous page
262 QString tmpCreated; // created temporary directory
263 bool exitConfirmed; // flag: "Exit confirmed"
265 // --> introduction page
266 QWidget* introPage; // page itself
267 QLabel* logoLab; // logo pixmap
268 QLabel* versionLab; // vesrsion info
269 QLabel* copyrightLab; // copyright info
270 QLabel* licenseLab; // license info
271 QLabel* info; // program info
273 QWidget* productsPage; // page itself
274 QLineEdit* targetFolder; // target directory for installing of products
275 QPushButton* targetBtn; // browse target directory button
276 QLineEdit* tempFolder; // directory for the temporary files: /tmp by default
277 QPushButton* tempBtn; // browse temp directory button
278 QLabel* requiredSize; // <Total disk space required> label
279 QLabel* requiredTemp; // <Space required for temporary files> label
280 QPushButton* moreBtn; // <More...> button
281 QWidget* moreBox; // container for the <More...> mode widgets
282 ProductsView* productsView; // products list view
283 QTextBrowser* productsInfo; // products info box
284 QCheckBox* prerequisites; // <Auto check prerequisites products> checkbox
285 QMyCheckBox* selectSrcBtn; // <SALOME sources> check box
286 QMyCheckBox* selectBinBtn; // <SALOME binaries> check box
287 QPushButton* unselectBtn; // <Unselect All> button
289 QWidget* prestartPage; // page itself
290 QTextEdit* choices; // choice text view
292 QWidget* progressPage; // page itself
293 QSplitter* splitter; // splitter window
294 InstallInfo* installInfo; // information about running installation scripts
295 QLabel* parametersLab; // answer field's label
296 QLineEdit* passedParams; // user can pass data to running script
297 QTextEdit* installProgress;// contains information about progress of installing selected products
298 ProgressView* progressView; // displays information about progress of installing selected products
300 QWidget* readmePage; // page itself
301 QTextEdit* readme; // Readme information window
302 QPushButton* runSalomeBtn; // <Launch Salome> buttnon
304 ProcessThread* myThread; // validation thread