1 // File : SALOME_InstallWizard.hxx
2 // Created : Thu Dec 18 12:01:00 2002
3 // Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
5 // Module : Installation Wizard
6 // Copyright : 2002-2007 CEA
8 #ifndef __SALOME_InstallWizard
9 #define __SALOME_InstallWizard
11 #include "InstallWizard.h"
14 #include <qvaluelist.h>
15 #include <qstringlist.h>
37 // This enum describes the possible types of the SALOME installation
38 enum InstallationType { Binaries, Sources, Compile };
41 Class Dependancies : Products info
42 This class stores all product dependancies for correct work of installation procedure
47 // default constructor, necessary for map
50 Dependancies( const QString& name,
51 const QStringList& depend,
53 const long Sourcessize,
54 const long SrcBuildsize,
56 const QString& vers = QString::null,
57 const QString& descr = QString::null,
58 const QString& tp = QString::null,
62 sizeBinaryTotal( Binsize ),
63 sizeSourcesTotal( Sourcessize ),
64 sizeSrcBuildTotal( SrcBuildsize ),
69 pickupEnv( pickup ) {}
72 QString getName() const { return smbName; }
74 QStringList getDependancies() const { return dependsOn; }
75 // gets disk space required
76 long getSize( InstallationType instType ) const
78 return instType == Binaries ? sizeBinaryTotal :
79 instType == Sources ? sizeSourcesTotal :
82 // gets temporary disk space required
83 long getTempSize( InstallationType instType ) const
85 return ( instType == Binaries ? 0 : instType == Sources ? 0 : sizeTemp );
87 // gets product's version
88 QString getVersion() const { return version; }
89 // gets product's description
90 QString getDescription() const { return description; }
91 // gets product's type
92 QString getType() const { return type; }
93 // returns true if this product needs to pick-up environment
94 bool pickUpEnvironment() { return pickupEnv; }
97 QString smbName; // symbolic name
98 QStringList dependsOn; // prerequisites list
99 long sizeBinaryTotal; // disk space for binaries required
100 long sizeSourcesTotal; // disk space for sources required
101 long sizeSrcBuildTotal; // disk space for compiled sources required
102 long sizeTemp; // disk space for temporary files required
103 QString version; // product's version
104 QString description; // product's description
105 QString type; // product's type (salome sources, binaries or prerequisite)
106 bool pickupEnv; // "Pick-up environment" flag
110 Class Button : Operation button info
111 This class stores information about the custom operation buttons which appear on
112 the <Finish> page of the Install Wizard.
117 // default constructor, required for list
118 Button() : myButton( 0 ) {}
120 Button( const QString& label, const QString& tooltip, const QString& script )
121 : myLabel( label ), myTootip( tooltip ), myScript( script ), myButton( 0 ) {}
123 // set operation button
124 void setButton( QButton* btn ) { myButton = btn; }
127 QString label() const { return myLabel; }
129 QString tootip() const { return myTootip; }
131 QString script() const { return myScript; }
132 // get operation button
133 QButton* button() const { return myButton; }
136 QString myLabel; // button label
137 QString myTootip; // button tooltip
138 QString myScript; // operation script
139 QButton* myButton; // operation button
142 typedef QMap<QCheckListItem*, Dependancies> MapProducts;
143 typedef QValueList<Button> ButtonList;
144 typedef QMap<QString, QString> MapXmlFiles;
147 Class SALOME_InstallWizard : Installation Wizard's main window
149 class SALOME_InstallWizard: public InstallWizard
155 SALOME_InstallWizard( const QString& aXmlFileName = QString::null,
156 const QString& aTargetDir = QString::null,
157 const QString& aTmpDir = QString::null );
159 virtual ~SALOME_InstallWizard( );
161 // get base platform to install binaries package
162 QString getBasePlatform();
163 // get current platform
164 QString currentPlatform();
167 QString getBinPath() { return binPath; }
169 QString getSrcPath() { return srcPath; }
171 // get map of supported platforms and corresponding XML files
172 MapXmlFiles getXmlMap( const QString& aXmlFileName = QString::null );
173 // check/get XML file and current platform
174 void getXmlAndPlatform();
177 bool eventFilter( QObject* object, QEvent* event );
180 void setDependancies( QCheckListItem* item, Dependancies dep);
182 // add button for the <Finish> page
183 void addFinishButton( const QString& label,
184 const QString& tooltip,
185 const QString& script,
186 bool toClear = false );
189 void setVersion( const QString& version ) { myVersion = version; }
191 void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); }
193 void setCopyright( const QString& copyright ) { myCopyright = copyright; }
195 void setLicense( const QString& license ) { myLicense = license; }
198 QString getVersion() { return myVersion; }
200 QString getCaption() { return myCaption; }
202 QString getCopyright() { return myCopyright; }
204 QString getLicense() { return myLicense; }
206 QString getPlatform() { return refPlatform ? refPlatform : curPlatform; }
207 // get InstallWizard's name
208 QString getIWName() { return myIWName; }
210 // process validation event (<val> is validation code)
211 void processValidateEvent( const int val, void* data );
212 // get private installation type
213 InstallationType getInstType() { return installType; };
216 // polishing of the widget
219 // save install log to file
223 // updates caption according to the current page number
224 void updateCaption();
225 // close event handler
226 void closeEvent( QCloseEvent* ce );
227 // creates introduction page
228 void setupIntroPage();
229 // create installation types page
230 void setupTypePage();
231 // create platforms page
232 void setupPlatformPage();
233 // create directories page
235 // creates products page
236 void setupProductsPage();
237 // creates prestart page
238 void setupCheckPage();
239 // creates progress page
240 void setupProgressPage();
241 // creates readme page
242 void setupReadmePage();
243 // displays choice info
244 void showChoiceInfo();
245 // validates page when <Next> button is clicked
246 bool acceptData( const QString& );
247 // calculates disk space required for the installation, returns true if any product selected to be installed (src, bin or native)
248 bool checkSize( long* totSize = 0, long* tempSize = 0 );
249 // checks products page validity (directories and products selection)
250 void checkProductPage();
251 // sets the product and all products this one depends on to be checked
252 void setPrerequisites( QCheckListItem* item );
253 // unsets all products which depend of unchecked product ( recursively )
254 void unsetPrerequisites( QCheckListItem* item );
255 // runs installation script
257 // searches product listview item with given symbolic name
258 QCheckListItem* findItem( const QString& sName );
259 // sets progress state to Aborted
261 // clears and (optionally) removes temporary directory
262 void clean(bool rmDir = false);
263 // Update GUI and check installation errors
264 void completeInstallation();
273 // called when user moves from page to page
274 void pageChanged( const QString & mytitle);
275 // called when user selected either installation type or installation platform
276 void onButtonGroup( int index );
277 // invokes Help window
279 // invokes directory selection dialog box
280 void browseDirectory();
281 // called when directory path (target or temp) is changed
282 void directoryChanged( const QString& text );
283 // <Start> button's slot - runs installation
285 // called when users tries to pass parameters for the script
286 void onReturnPressed();
287 // callback function - as response for the script finishing
288 void productInstalled();
289 // called when <Cancel> button is clicked during installation script running
291 // kills installation process and quits application
293 // called when selection is changed in the products list view
294 void onSelectionChanged();
295 // called when user checks/unchecks any product item
296 void onItemToggled( QCheckListItem* );
297 // <Installation with GUI> check-box slot
298 void onInstallGuiBtn();
299 // <More...> button slot
301 // Slot to update 'Available disk space' field
302 void updateAvailableSpace();
303 // Slot to take result of Fortran libraries checking
304 void checkFLibResult();
305 // Slot to update 'Size' column for modules and prerequisites
306 void updateSizeColumn();
308 // <Finish> page buttons slot
309 void onFinishButton();
311 // <About> button slot
315 // -->something was written to stdin
317 // -->something was written to stout
318 void readFromStdout();
319 // -->something was written to stderr
320 void readFromStderr();
323 QString myIWName; // Installation Wizard's name
324 QString myVersion; // version info
325 QString myCaption; // application name
326 QString myCopyright; // copyright info
327 QString myLicense; // license info
328 QString myTargetPath; // target directory path
329 QString myTmpPath; // temporary directory path
331 HelpWindow* helpWindow; // help window
332 QProcess* shellProcess; // shell process (install script)
333 QProcess* diskSpaceProc; // shell process (to get available disk space script)
334 QProcess* checkFLibProc; // shell process (to get available disk space script)
335 MapProducts productsMap; // products info (name, dependancies, disk space )
336 MapXmlFiles extraProducts; // additional products to be installed
337 QStringList toInstall; // list of products being installed
338 QStringList notInstall; // list of products being not installed
339 QStringList prodSequence; // specified list of products being installed
340 InstallationType installType; // type of the installation
341 QString curPlatform; // current operating system
342 QString refPlatform; // referenced operating system (selected by user). It is defined,
343 // if current OS is not determined or not supported only
344 MapXmlFiles platformsMap; // supported operating systems and corresponding XML files
345 QString xmlFileName; // xml file
346 QString binPath; // binaries path
347 QString srcPath; // sources path
348 QString commonPlatform; // platform with universal binaries
349 QStringList singleBinPlts; // list of platforms for that the special binary packages are exist
350 bool moreMode; // advanced mode flag
351 QWidget* previousPage; // previous page
352 QString tmpCreated; // created temporary directory
353 bool stateChanged; // flag: whether installation type or platform was changed
354 bool exitConfirmed; // flag: "Exit confirmed"
355 bool rmSrcPrevState; // flag: status of "Remove SRC & TMP files" is changed ?
357 // --> introduction page
358 QWidget* introPage; // page itself
359 QLabel* logoLab; // logo pixmap
360 QLabel* versionLab; // version info
361 QLabel* copyrightLab; // copyright info
362 QLabel* licenseLab; // license info
363 QLabel* info; // program info
364 // --> installation types page
365 QWidget* typePage; // page itself
366 QButtonGroup* buttonGrp; // group of the available installation types radio-buttons
367 QRadioButton* binBtn; // install binaries button
368 QRadioButton* srcBtn; // install sources button
369 QRadioButton* srcCompileBtn; // install sources and compile button
370 QCheckBox* removeSrcBtn; // <Remove sources & tmp files> checkbox
371 // --> installation platform page
372 QWidget* platformsPage; // page itself
373 QButtonGroup* platBtnGrp; // group of platforms for selection
374 QString warnMsg; // warning message
375 QLabel* warnLab; // warning label
376 QLabel* warnLab3; // additional warning label
377 // --> installation directories page
378 QWidget* dirPage; // page itself
379 QLineEdit* targetFolder; // target directory for installing of products
380 QPushButton* targetBtn; // browse target directory button
381 QLineEdit* tempFolder; // directory for the temporary files: /tmp by default
382 QPushButton* tempBtn; // browse temp directory button
384 QWidget* productsPage; // page itself
385 ProductsView* modulesView; // modules list view
386 QMyCheckBox* installGuiBtn; // <Installation with GUI> checkbox
387 ProductsView* prereqsView; // prerequisites list view
388 QPushButton* moreBtn; // <More...> button
389 QTextBrowser* productInfo; // products info box
390 QLabel* requiredSize; // <Total disk space required> label
391 QLabel* requiredTemp; // <Space required for temporary files> label
392 QLabel* availableSize; // <Available disk space> label
394 QWidget* prestartPage; // page itself
395 QTextEdit* choices; // choice text view
397 QWidget* progressPage; // page itself
398 QSplitter* splitter; // splitter window
399 InstallInfo* installInfo; // information about running installation scripts
400 QLabel* parametersLab; // answer field's label
401 QLineEdit* passedParams; // user can pass data to running script
402 QTextEdit* installProgress;// contains information about progress of installing selected products
403 ProgressView* progressView; // displays information about progress of installing selected products
404 QLabel* statusLab; // displays currently performed action
406 QWidget* readmePage; // page itself
407 QTextEdit* readme; // Readme information window
408 ButtonList buttons; // operation buttons
410 ProcessThread* myThread; // validation thread
411 bool hasErrors; // flag: if there were any errors or warnings during the installation