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, const QStringList& depend, const long Binsize, const long Sourcessize, const long tempsize )
34 : smbName( name ), dependsOn( depend ), sizeSourcesTotal( Sourcessize ), sizeBinaryTotal( Binsize ), sizeTemp( tempsize ) {}
37 QString getName() const { return smbName; }
39 QStringList getDependancies() const { return dependsOn; }
40 // gets disk space required
41 long getSize(bool sources = false) const {
43 return sizeSourcesTotal;
45 return sizeBinaryTotal;
47 // gets temporary disk space required
48 long getTempSize() const { return sizeTemp; }
51 QString smbName; // symbolic name
52 QStringList dependsOn; // prerequisites list
53 long sizeSourcesTotal; // disk space required
54 long sizeBinaryTotal; // disk space required
55 long sizeTemp; // disk space for temporary files required
73 typedef QMap<QCheckListItem*, Dependancies> MapProducts;
76 Class SALOME_InstallWizard : Installation Wizard's main window
78 class SALOME_InstallWizard: public InstallWizard
84 SALOME_InstallWizard(QString aXmlFileName);
86 virtual ~SALOME_InstallWizard( );
89 bool eventFilter( QObject* object, QEvent* event );
92 void setDependancies( QCheckListItem* item, Dependancies dep);
95 // polishing of the widget
99 void setVersion( const QString& version ) { myVersion = version; }
101 void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); }
103 void setCopyright( const QString& copyright ) { myCopyright = copyright; }
105 void setLicense( const QString& license ) { myLicense = license; }
107 void setOS( const QString& OS ) { myOS = OS; }
110 QString getVersion() { return myVersion; }
112 QString getCaption() { return myCaption; }
114 QString getCopyright() { return myCopyright; }
116 QString getLicense() { return myLicense; }
118 QString getOS() { return myOS; }
119 // get InstallWizard's name
120 QString getIWName() { return myIWName; }
123 // updates caption according to the current page number
124 void updateCaption();
125 // close event handler
126 void closeEvent( QCloseEvent* ce );
127 // creates introduction page
128 void setupIntroPage();
129 // creates products page
130 void setupProductsPage();
131 // creates directories page
133 // creates prestart page
134 void setupCheckPage();
135 // creates progress page
136 void setupProgressPage();
137 // creates readme page
138 void setupReadmePage();
139 // displays choice info
140 void showChoiceInfo();
141 // validates page when <Next> button is clicked
142 bool acceptData( const QString& );
143 // calculates disk space required for the installation, returns true if any product selected to be installed (src, bin or native)
144 bool checkSize( long* totSize = 0, long* tempSize = 0 );
145 // checks products page validity (directories and products selection)
146 void checkProductPage();
147 // sets the product and all products this one depends on to be checked ( recursively )
148 void setProductOn( QCheckListItem* item, int install = 1 );
149 // runs installation script
151 // searches product listview item with given symbolic name
152 QCheckListItem* findItem( const QString& sName );
153 // sets progress state to Aborted
155 // clears and removes temporary directory
165 // called when user moves from page to page
166 void pageChanged( const QString & mytitle);
167 // invokes Help window
169 // invokes directory selection dialog box
170 void browseDirectory();
171 // called when directory path (target or temp) is changed
172 void directoryChanged( const QString& text );
173 // <Start> button's slot - runs installation
175 // called when users tries to pass parameters for the script
176 void onReturnPressed();
177 // callback function - as response for the script finishing
178 void productInstalled();
179 // called when <Cancel> button is clicked during installation script running
181 // kills installation process and quits application
183 // called when selection is changed in the products list view
184 void onSelectionChanged();
185 // called when user checks/unchecks any product item
186 void onItemToggled( QCheckListItem* );
187 // <Select Sources>, <Select Binaries>, <Unselect All> buttons slot
189 // <More...> button slot
191 // <Launch Salome> button slot
192 void onLaunchSalome();
195 // -->something was written to stdin
197 // -->something was written to stout
198 void readFromStdout();
199 // -->something was written to stderr
200 void readFromStderr();
203 QString myIWName; // Installation Wizard's name
204 QString myVersion; // version info
205 QString myCaption; // application name
206 QString myCopyright; // copyright info
207 QString myLicense; // license info
208 QString myOS; // operation system
210 HelpWindow* helpWindow; // help window
211 QProcess* shellProcess; // shell process (install script)
212 MapProducts productsMap; // products info (name, dependancies, disk space )
213 QStringList toInstall; // list of products being installed
214 QString xmlFileName; // xml file
215 bool moreMode; // advanced mode flag
216 QWidget* previousPage; // previous page
217 QString tmpCreated; // created temporary directory
218 bool exitConfirmed; // flag: "Exit confirmed"
220 // --> introduction page
221 QWidget* introPage; // page itself
222 QLabel* logoLab; // logo pixmap
223 QLabel* versionLab; // vesrsion info
224 QLabel* copyrightLab; // copyright info
225 QLabel* licenseLab; // license info
226 QLabel* info; // program info
228 QWidget* productsPage; // page itself
229 QLineEdit* targetFolder; // target directory for installing of products
230 QPushButton* targetBtn; // browse target directory button
231 QLineEdit* tempFolder; // directory for the temporary files: /tmp by default
232 QPushButton* tempBtn; // browse temp directory button
233 QLabel* requiredSize; // <Total disk space required> label
234 QLabel* requiredTemp; // <Space required for temporary files> label
235 QPushButton* moreBtn; // <More...> button
236 QWidget* moreBox; // container for the <More...> mode widgets
237 ProductsView* productsView; // products list view
238 QTextBrowser* productsInfo; // products info box
239 QCheckBox* prerequisites; // <Auto check prerequisites products> checkbox
240 QPushButton* selectSrcBtn; // <Select Sources> button - NOT USED CURRENTLY
241 QPushButton* selectBinBtn; // <Select Binaries> button - NOT USED CURRENTLY
242 QPushButton* unselectBtn; // <Unselect All> button
244 QWidget* prestartPage; // page itself
245 QTextEdit* choices; // choice text view
247 QWidget* progressPage; // page itself
248 QSplitter* splitter; // splitter window
249 QTextEdit* installInfo; // information about running installation scripts
250 QLabel* parametersLab; // answer field's label
251 QLineEdit* passedParams; // user can pass data to running script
252 QTextEdit* installProgress;// contains information about progress of installing selected products
253 ProgressView* progressView; // displays information about progress of installing selected products
255 QWidget* readmePage; // page itself
256 QTextEdit* readme; // Readme information window
257 QPushButton* runSalomeBtn; // <Launch Salome> buttnon