1 // File : SALOME_InstallWizard.hxx
2 // Created : Thu Dec 18 12:01:00 2002
3 // Author : Vadim SANDLER
4 // Project : PAL/SALOME
5 // Module : InstallWizard
6 // Copyright : 2004 CEA
9 #ifndef __SALOME_InstallWizard
10 #define __SALOME_InstallWizard
12 #include "InstallWizard.h"
15 #include <qstringlist.h>
18 Class Dependancies : Products info
19 This class stores all product dependancies for correct work of installation procedure
20 smbName - parameter for launching install shell script (e.g. cas for CASCADE4.0).
21 dependsOn - list of products needed for correct installation of product
22 (e.g tcl is checked during installation of CASCADE 4).
23 sizeTotal - amount of disk space in Kbytes required for installation
25 sizeTemp - amount of disk space in Kbytes required for the temporary files
30 // default constructor, necessary for map
33 Dependancies( const QString& name,
34 const QStringList& depend,
36 const long Sourcessize,
38 const QString& def = QString::null,
39 const QString& descr = QString::null,
43 sizeSourcesTotal( Sourcessize ),
44 sizeBinaryTotal( Binsize ),
48 pickupEnv( pickup ) {}
51 QString getName() const { return smbName; }
53 QStringList getDependancies() const { return dependsOn; }
54 // gets disk space required
55 long getSize(bool sources = false) const { return ( sources ? sizeSourcesTotal : sizeBinaryTotal ); }
56 // gets temporary disk space required
57 long getTempSize() const { return sizeTemp; }
58 // gets product's description
59 QString getDescription() const { return description; }
61 QString getDefault() const { return defaultMode; }
62 // returns true if this product needs to pick-up environment
63 bool pickUpEnvironment() { return pickupEnv; }
66 QString smbName; // symbolic name
67 QStringList dependsOn; // prerequisites list
68 long sizeSourcesTotal; // disk space required
69 long sizeBinaryTotal; // disk space required
70 long sizeTemp; // disk space for temporary files required
71 QString defaultMode; // default installation mode
72 QString description; // product's description
73 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);
113 // polishing of the widget
117 void setVersion( const QString& version ) { myVersion = version; }
119 void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); }
121 void setCopyright( const QString& copyright ) { myCopyright = copyright; }
123 void setLicense( const QString& license ) { myLicense = license; }
125 void setOS( const QString& OS ) { myOS = OS; }
128 QString getVersion() { return myVersion; }
130 QString getCaption() { return myCaption; }
132 QString getCopyright() { return myCopyright; }
134 QString getLicense() { return myLicense; }
136 QString getOS() { return myOS; }
137 // get InstallWizard's name
138 QString getIWName() { return myIWName; }
141 // updates caption according to the current page number
142 void updateCaption();
143 // close event handler
144 void closeEvent( QCloseEvent* ce );
145 // creates introduction page
146 void setupIntroPage();
147 // creates products page
148 void setupProductsPage();
149 // creates directories page
151 // creates prestart page
152 void setupCheckPage();
153 // creates progress page
154 void setupProgressPage();
155 // creates readme page
156 void setupReadmePage();
157 // displays choice info
158 void showChoiceInfo();
159 // validates page when <Next> button is clicked
160 bool acceptData( const QString& );
161 // calculates disk space required for the installation, returns true if any product selected to be installed (src, bin or native)
162 bool checkSize( long* totSize = 0, long* tempSize = 0 );
163 // checks products page validity (directories and products selection)
164 void checkProductPage();
165 // sets the product and all products this one depends on to be checked ( recursively )
166 void setPrerequisites( QCheckListItem* item );
167 // runs installation script
169 // searches product listview item with given symbolic name
170 QCheckListItem* findItem( const QString& sName );
171 // sets progress state to Aborted
173 // clears and removes temporary directory
183 // called when user moves from page to page
184 void pageChanged( const QString & mytitle);
185 // invokes Help window
187 // invokes directory selection dialog box
188 void browseDirectory();
189 // called when directory path (target or temp) is changed
190 void directoryChanged( const QString& text );
191 // <Start> button's slot - runs installation
193 // called when users tries to pass parameters for the script
194 void onReturnPressed();
195 // callback function - as response for the script finishing
196 void productInstalled();
197 // called when <Cancel> button is clicked during installation script running
199 // kills installation process and quits application
201 // called when selection is changed in the products list view
202 void onSelectionChanged();
203 // called when user checks/unchecks any product item
204 void onItemToggled( QCheckListItem* );
205 // <Select Sources>, <Select Binaries>, <Unselect All> buttons slot
207 // <More...> button slot
209 // <Launch Salome> button slot
210 void onLaunchSalome();
213 // -->something was written to stdin
215 // -->something was written to stout
216 void readFromStdout();
217 // -->something was written to stderr
218 void readFromStderr();
221 QString myIWName; // Installation Wizard's name
222 QString myVersion; // version info
223 QString myCaption; // application name
224 QString myCopyright; // copyright info
225 QString myLicense; // license info
226 QString myOS; // operation system
228 HelpWindow* helpWindow; // help window
229 QProcess* shellProcess; // shell process (install script)
230 MapProducts productsMap; // products info (name, dependancies, disk space )
231 QStringList toInstall; // list of products being installed
232 QString xmlFileName; // xml file
233 bool moreMode; // advanced mode flag
234 QWidget* previousPage; // previous page
235 QString tmpCreated; // created temporary directory
236 bool exitConfirmed; // flag: "Exit confirmed"
238 // --> introduction page
239 QWidget* introPage; // page itself
240 QLabel* logoLab; // logo pixmap
241 QLabel* versionLab; // vesrsion info
242 QLabel* copyrightLab; // copyright info
243 QLabel* licenseLab; // license info
244 QLabel* info; // program info
246 QWidget* productsPage; // page itself
247 QLineEdit* targetFolder; // target directory for installing of products
248 QPushButton* targetBtn; // browse target directory button
249 QLineEdit* tempFolder; // directory for the temporary files: /tmp by default
250 QPushButton* tempBtn; // browse temp directory button
251 QLabel* requiredSize; // <Total disk space required> label
252 QLabel* requiredTemp; // <Space required for temporary files> label
253 QPushButton* moreBtn; // <More...> button
254 QWidget* moreBox; // container for the <More...> mode widgets
255 ProductsView* productsView; // products list view
256 QTextBrowser* productsInfo; // products info box
257 QCheckBox* prerequisites; // <Auto check prerequisites products> checkbox
258 QPushButton* selectSrcBtn; // <Select Sources> button - NOT USED CURRENTLY
259 QPushButton* selectBinBtn; // <Select Binaries> button - NOT USED CURRENTLY
260 QPushButton* unselectBtn; // <Unselect All> button
262 QWidget* prestartPage; // page itself
263 QTextEdit* choices; // choice text view
265 QWidget* progressPage; // page itself
266 QSplitter* splitter; // splitter window
267 QTextEdit* installInfo; // information about running installation scripts
268 QLabel* parametersLab; // answer field's label
269 QLineEdit* passedParams; // user can pass data to running script
270 QTextEdit* installProgress;// contains information about progress of installing selected products
271 ProgressView* progressView; // displays information about progress of installing selected products
273 QWidget* readmePage; // page itself
274 QTextEdit* readme; // Readme information window
275 QPushButton* runSalomeBtn; // <Launch Salome> buttnon