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