-// File : SALOME_InstallWizard.h
+// File : SALOME_InstallWizard.hxx
// Created : Thu Dec 18 12:01:00 2002
-// Author : Vadim SANDLER
-// Project : SALOME Professional
-// Module : InstallWizard
-// Copyright : 2003 CEA/DEN, EDF R&D
-// $Header$
-
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qwidget.h>
-#include <qlistview.h>
-#include <qlabel.h>
-#include <qtextedit.h>
-#include <qprocess.h>
-#include <qlineedit.h>
-#include <qcheckbox.h>
-#include <qheader.h>
-#include <qsplitter.h>
+// Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
+// Project : SALOME
+// Module : Installation Wizard
+// Copyright : 2002-2009 CEA
+
+#ifndef __SALOME_InstallWizard
+#define __SALOME_InstallWizard
+
+#include "InstallWizard.h"
#include <qmap.h>
+#include <qvaluelist.h>
#include <qstringlist.h>
-#include <qxml.h>
-#include "InstallWizard.h"
-#include "helpwindow.h"
+class QLineEdit;
+class QPushButton;
+class QListViewItem;
+class QCheckListItem;
+class QLabel;
+class QTextEdit;
+class QTextBrowser;
+class QProcess;
+class QCheckBox;
+class QSplitter;
+class QMyCheckBox;
+class ProcessThread;
+class ProductsView;
+class ProgressView;
+class HelpWindow;
+class InstallInfo;
+class QButton;
+class QRadioButton;
+class QButtonGroup;
+
+// This enum describes the possible types of the SALOME installation
+enum InstallationType { Binaries, Sources, Compile };
+// This enum describes the possible states of a tristate parameter
+enum BoolTristate { False, True, NotDefined };
/*!
Class Dependancies : Products info
This class stores all product dependancies for correct work of installation procedure
- smbName - parameter for launching install shell script (e.g. cas for CASCADE4.0).
- dependsOn - list of products needed for correct installation of product
- (e.g tcl is checked during installation of CASCADE 4).
- sizeTotal - amount of disk space in Kbytes required for installation
- of this product
- sizeTemp - amount of disk space in Kbytes required for the temporary files
*/
class Dependancies
{
// default constructor, necessary for map
Dependancies() {}
// constructor
- Dependancies( const QString& name, const QStringList& depend, const long Binsize, const long Sourcessize, const long tempsize )
- : smbName( name ), dependsOn( depend ), sizeSourcesTotal( Sourcessize ), sizeBinaryTotal( Binsize ), sizeTemp( tempsize ) {}
+ Dependancies( const QString& name,
+ const QStringList& depend,
+ const long Binsize,
+ const long Sourcessize,
+ const long SrcBuildsize,
+ const long tempsize,
+ const QString& vers = QString::null,
+ const QString& descr = QString::null,
+ const QString& tp = QString::null,
+ bool pickup = false,
+ BoolTristate woGui = NotDefined )
+ : smbName( name ),
+ dependsOn( depend ),
+ sizeBinaryTotal( Binsize ),
+ sizeSourcesTotal( Sourcessize ),
+ sizeSrcBuildTotal( SrcBuildsize ),
+ sizeTemp( tempsize ),
+ version( vers ),
+ description( descr ),
+ type( tp ),
+ pickupEnv( pickup ),
+ woGuiMode( woGui ) {}
// gets symbolic name
QString getName() const { return smbName; }
// gets dependancies
QStringList getDependancies() const { return dependsOn; }
// gets disk space required
- long getSize(bool sources = false) const {
- if (sources)
- return sizeSourcesTotal;
- else
- return sizeBinaryTotal;
+ long getSize( InstallationType instType ) const
+ {
+ return instType == Binaries ? sizeBinaryTotal :
+ instType == Sources ? sizeSourcesTotal :
+ sizeSrcBuildTotal;
}
// gets temporary disk space required
- long getTempSize() const { return sizeTemp; }
+ long getTempSize( InstallationType instType ) const
+ {
+ return ( instType == Binaries ? 0 : instType == Sources ? 0 : sizeTemp );
+ }
+ // gets product's version
+ QString getVersion() const { return version; }
+ // gets product's description
+ QString getDescription() const { return description; }
+ // gets product's type
+ QString getType() const { return type; }
+ // returns true if this product needs to pick-up environment
+ bool pickUpEnvironment() { return pickupEnv; }
+ // returns true if this product supports installation without GUI mode
+ BoolTristate supportWoGuiMode() { return woGuiMode; }
private:
- QString smbName; // symbolic name
- QStringList dependsOn; // prerequisites list
- long sizeSourcesTotal; // disk space required
- long sizeBinaryTotal; // disk space required
- long sizeTemp; // disk space for temporary files required
+ QString smbName; // symbolic name
+ QStringList dependsOn; // prerequisites list
+ long sizeBinaryTotal; // disk space for binaries required
+ long sizeSourcesTotal; // disk space for sources required
+ long sizeSrcBuildTotal; // disk space for compiled sources required
+ long sizeTemp; // disk space for temporary files required
+ QString version; // product's version
+ QString description; // product's description
+ QString type; // product's type (salome sources, binaries or prerequisite)
+ bool pickupEnv; // "Pick-up environment" flag
+ BoolTristate woGuiMode; // support of installation without GUI flag
};
+
+/*!
+ Class Button : Operation button info
+ This class stores information about the custom operation buttons which appear on
+ the <Finish> page of the Install Wizard.
+*/
+class Button
+{
+ public:
+ // default constructor, required for list
+ Button() : myButton( 0 ) {}
+ // constructor
+ Button( const QString& label, const QString& tooltip, const QString& script )
+ : myLabel( label ), myTootip( tooltip ), myScript( script ), myButton( 0 ) {}
+
+ // set operation button
+ void setButton( QButton* btn ) { myButton = btn; }
+
+ // get label
+ QString label() const { return myLabel; }
+ // get tooltip
+ QString tootip() const { return myTootip; }
+ // get script name
+ QString script() const { return myScript; }
+ // get operation button
+ QButton* button() const { return myButton; }
+
+ private:
+ QString myLabel; // button label
+ QString myTootip; // button tooltip
+ QString myScript; // operation script
+ QButton* myButton; // operation button
+};
+
typedef QMap<QCheckListItem*, Dependancies> MapProducts;
+typedef QValueList<Button> ButtonList;
+typedef QMap<QString, QString> MapXmlFiles;
+typedef QMap<QString, BoolTristate> MapAttrStates;
-class MyListView;
-class ProgressView;
/*!
Class SALOME_InstallWizard : Installation Wizard's main window
*/
public:
// constructor
- SALOME_InstallWizard(QString aXmlFileName);
+ SALOME_InstallWizard( const QString& aXmlFileName = QString::null,
+ const QString& aTargetDir = QString::null,
+ const QString& aTmpDir = QString::null,
+ const bool aForceSrc = false,
+ const bool aSingleDir = false );
// destructor
virtual ~SALOME_InstallWizard( );
+ // get base platform to install binaries package
+ QString getBasePlatform();
+ // get current platform
+ static QStringList currentPlatform();
+ // get application root dir
+ static QString rootDirPath();
+
+ // get binaries path
+ QString getBinPath() const { return binPath; }
+ // get sources path
+ QString getSrcPath() const { return srcPath; }
+ // get platform binaries path
+ QString getPlatformBinPath( const QString& ) const;
+
+ // get map of supported platforms and corresponding XML files
+ MapXmlFiles getXmlMap( const QString& aXmlFileName = QString::null );
+ // check/get XML file and current platform
+ void getXmlAndPlatform();
+
// event filter
bool eventFilter( QObject* object, QEvent* event );
// set dependancies
void setDependancies( QCheckListItem* item, Dependancies dep);
+ // executes some actions after finish of installation process (successful or not)
+ void doPostActions( const QString& btnText,
+ const QString& btnAboutInfo );
+
+ // add button for the <Finish> page
+ void addFinishButton( const QString& label,
+ const QString& tooltip,
+ const QString& script,
+ bool toClear = false );
+
+ // set version
+ void setVersion( const QString& version ) { myVersion = version; }
+ // set caption
+ void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); }
+ // set copyright
+ void setCopyright( const QString& copyright ) { myCopyright = copyright; }
+ // set license
+ void setLicense( const QString& license ) { myLicense = license; }
+ // set list of optional libraries
+ void setOptionalLibs( const QString& optlibs ) { myOptLibs = QStringList::split( ",", optlibs ); }
+
+ // get version
+ QString getVersion() { return myVersion; }
+ // get caption
+ QString getCaption() { return myCaption; }
+ // get copyright
+ QString getCopyright() { return myCopyright; }
+ // get license
+ QString getLicense() { return myLicense; }
+ // get list of optional libraries
+ QStringList getOptionalLibs() { return myOptLibs; }
+ // get platform
+ QString getPlatform() { return !refPlatform.isEmpty() ? refPlatform : curPlatform; }
+ // get corresponding XML file
+ QString getXmlFile( const QString& platform ) {
+ return (platformsMap.find( platform ) != platformsMap.end() ) ?
+ platformsMap[ platform ] :
+ QString("");
+ }
+ // get InstallWizard's name
+ QString getIWName() { return myIWName; }
+
+ // process validation event (<val> is validation code)
+ void processValidateEvent( const int val, void* data );
+ // get private installation type
+ InstallationType getInstType() { return installType; };
+
public slots:
// polishing of the widget
void polish();
+
+ // save install log to file
+ void saveLog();
protected:
+ // updates caption according to the current page number
+ void updateCaption();
// close event handler
void closeEvent( QCloseEvent* ce );
// creates introduction page
void setupIntroPage();
+ // create installation types page
+ void setupTypePage();
+ // create platforms page
+ void setupPlatformPage();
+ // create directories page
+ void setupDirPage();
// creates products page
void setupProductsPage();
- // creates directories page
- void setupDirPage();
// creates prestart page
void setupCheckPage();
// creates progress page
// displays choice info
void showChoiceInfo();
// validates page when <Next> button is clicked
- bool acceptData( const QString& );
- // calculates disk space required for the installation
- void checkSize( long* totSize = 0, long* tempSize = 0 );
- // checks directories validity
- void checkDirs();
- // sets the product and all products this one depends on to be checked ( recursively )
- void setProductOn( QCheckListItem* item, int install = 1 );
+ bool acceptData( const QString& );
+ // calculates disk space required for the installation, returns true if any product selected to be installed (src, bin or native)
+ bool checkSize( long* totSize = 0, long* tempSize = 0 );
+ // checks products page validity (directories and products selection)
+ void checkProductPage();
+ // sets the product and all products this one depends on to be checked
+ void setPrerequisites( QCheckListItem* item );
+ // unsets all products which depend of unchecked product ( recursively )
+ void unsetPrerequisites( QCheckListItem* item );
// runs installation script
void launchScript();
// searches product listview item with given symbolic name
QCheckListItem* findItem( const QString& sName );
// sets progress state to Aborted
void abort();
- // clears and removes temporary directory
- void clean();
+ // clears and (optionally) removes temporary directory
+ void clean(bool rmDir = false);
+ // Update GUI and check installation errors
+ void completeInstallation();
+ // Run the modification of SALOME *.la files
+ void runModifyLaFiles();
+ // Run the Fortran libraries checking
+ void runCheckFLib();
protected slots:
// reject slot
private slots:
// called when user moves from page to page
void pageChanged( const QString & mytitle);
+ // called when user selected either installation type or installation platform
+ void onButtonGroup( int index );
// invokes Help window
void helpClicked();
// invokes directory selection dialog box
// kills installation process and quits application
void onCancel();
// called when selection is changed in the products list view
- void onSelectionChanged( QListViewItem* );
+ void onSelectionChanged();
// called when user checks/unchecks any product item
void onItemToggled( QCheckListItem* );
- // <Select Sources>, <Select Binaries>, <Unselect All> buttons slot
- void onProdBtn();
+ // <Installation with GUI> check-box slot
+ void onInstallGuiBtn();
// <More...> button slot
void onMoreBtn();
- // <Launch Salome> button slot
- void onLaunchSalome();
+ // Slot to update 'Available disk space' field
+ void updateAvailableSpace();
+ // Slot to take result of modification SALOME *.la files
+ void checkModifyLaResult();
+ // Slot to take result of Fortran libraries checking
+ void checkFLibResult();
+ // Slot to update 'Size' column for modules and prerequisites
+ void updateSizeColumn();
+
+ // <Finish> page buttons slot
+ void onFinishButton();
+
+ // <About> button slot
+ void onAbout();
// QProcess slots:
// -->something was written to stdin
void readFromStdout();
// -->something was written to stderr
void readFromStderr();
+ // -->stop installation process if there is an error in stderr
+ void manageInstProc();
private:
- HelpWindow* helpWindow; // help window
- QProcess* shellProcess; // shell process (install script)
- MapProducts productsMap; // products info (name, dependancies, disk space )
- QStringList toInstall; // list of products being installed
- QString xmlFileName; // xml file
- bool moreMode; // advanced mode flag
- QWidget* previousPage; // previous page
- QString tmpCreated; // created temporary directory
- bool exitConfirmed; // flag: "Exit confirmed"
+ QString myIWName; // Installation Wizard's name
+ QString myVersion; // version info
+ QString myCaption; // application name
+ QString myCopyright; // copyright info
+ QString myLicense; // license info
+ QString myTargetPath; // target directory path
+ QString myTmpPath; // temporary directory path
+ QStringList myOptLibs; // list of optional libraries
+
+ HelpWindow* helpWindow; // help window
+ QProcess* shellProcess; // shell process (install script)
+ QProcess* diskSpaceProc; // shell process (to get available disk space script)
+ QProcess* modifyLaProc; // shell process (to modify SALOME *.la files script)
+ QProcess* checkFLibProc; // shell process (to check Fortran libraries script)
+ MapProducts productsMap; // products info (name, dependancies, disk space )
+ MapXmlFiles extraProducts; // additional products to be installed
+ QStringList toInstall; // list of products being installed
+ QStringList notInstall; // list of products being not installed
+ QStringList prodSequence; // specified list of products being installed
+ MapAttrStates woGuiModules; // map of SALOME modules names, that can support installation without GUI mode
+ InstallationType installType; // type of the installation
+ QString curPlatform; // current operating system
+ QString refPlatform; // referenced operating system (selected by user). It is defined,
+ // if current OS is not determined or not supported only
+ MapXmlFiles platformsMap; // supported operating systems and corresponding XML files
+ QString xmlFileName; // xml file
+ QString binPath; // binaries path
+ QString srcPath; // sources path
+ QString oneProdDirName; // name of the single directory for binaries of prerequisites
+ QString commonPlatform; // platform with universal binaries
+ bool moreMode; // advanced mode flag
+ QWidget* previousPage; // previous page
+ QString tmpCreated; // created temporary directory
+ bool stateChanged; // flag: whether installation type or platform was changed
+ bool exitConfirmed; // flag: "Exit confirmed"
+ bool rmSrcPrevState; // flag: status of "Remove SRC & TMP files" is changed ?
// Widgets
// --> introduction page
- QWidget* introPage; // page itself
- QLabel* logoLab; // SALOME PRO logo
- QLabel* versionLab; // vesrsion info
- QLabel* copyrightLab; // copyright info
- QLabel* licenseLab; // license info
- QLabel* info; // program info
+ QWidget* introPage; // page itself
+ QLabel* logoLab; // logo pixmap
+ QLabel* versionLab; // version info
+ QLabel* copyrightLab; // copyright info
+ QLabel* licenseLab; // license info
+ QLabel* info; // program info
+ // --> installation types page
+ QWidget* typePage; // page itself
+ QButtonGroup* buttonGrp; // group of the available installation types radio-buttons
+ QRadioButton* binBtn; // install binaries button
+ QRadioButton* srcBtn; // install sources button
+ QRadioButton* srcCompileBtn; // install sources and compile button
+ QCheckBox* removeSrcBtn; // <Remove sources & tmp files> checkbox
+ bool forceSrc; // Force all products to be compiled from sources
+ // --> installation platform page
+ QWidget* platformsPage; // page itself
+ QButtonGroup* platBtnGrp; // group of platforms for selection
+ QString warnMsg; // warning message
+ QLabel* warnLab; // warning label
+ QLabel* warnLab3; // additional warning label
+ // --> installation directories page
+ QWidget* dirPage; // page itself
+ QLineEdit* targetFolder; // target directory for installing of products
+ QPushButton* targetBtn; // browse target directory button
+ QLineEdit* tempFolder; // directory for the temporary files: /tmp by default
+ QPushButton* tempBtn; // browse temp directory button
// --> products page
- QWidget* productsPage; // page itself
- QLineEdit* targetFolder; // target directory for installing of products
- QPushButton* targetBtn; // browse target directory button
- QLineEdit* tempFolder; // directory for the temporary files: /tmp by default
- QPushButton* tempBtn; // browse temp directory button
- QLabel* requiredSize; // <Total disk space required> label
- QLabel* requiredTemp; // <Space required for temporary files> label
- QPushButton* moreBtn; // <More...> button
- QWidget* moreBox; // container for the <More...> mode widgets
- MyListView* productsView; // products list view
- QTextBrowser* productsInfo; // products info box
- QCheckBox* prerequisites; // <Auto check prerequisites products> checkbox
- QPushButton* selectSrcBtn; // <Select Sources> button - NOT USED CURRENTLY
- QPushButton* selectBinBtn; // <Select Binaries> button - NOT USED CURRENTLY
- QPushButton* unselectBtn; // <Unselect All> button
+ QWidget* productsPage; // page itself
+ ProductsView* modulesView; // modules list view
+ QMyCheckBox* installGuiBtn; // <Installation with GUI> checkbox
+ ProductsView* prereqsView; // prerequisites list view
+ QMyCheckBox* oneModDirBtn; // <Install SALOME modules to a single directory> checkbox
+ QMyCheckBox* oneProdDirBtn; // <Install prerequisites to a single directory> checkbox
+ QPushButton* moreBtn; // <Show/Hide prerequisites> button
+ QTextBrowser* productInfo; // products info box
+ QLabel* requiredSize; // <Total disk space required> label
+ QLabel* requiredTemp; // <Space required for temporary files> label
+ QLabel* availableSize; // <Available disk space> label
+ bool singleDir; // Force all SALOME modules to be installed into single directory
// --> prestart page
- QWidget* prestartPage; // page itself
- QTextEdit* choices; // choice text view
+ QWidget* prestartPage; // page itself
+ QTextEdit* choices; // choice text view
// --> progress page
- QWidget* progressPage; // page itself
- QSplitter* splitter; // splitter window
- QTextEdit* installInfo; // information about running installation scripts
- QLabel* parametersLab; // answer field's label
- QLineEdit* passedParams; // user can pass data to running script
- QTextEdit* installProgress;// contains information about progress of installing selected products
- ProgressView* progressView; // displays information about progress of installing selected products
- // --> readme page
- QWidget* readmePage; // page itself
- QTextEdit* readme; // Readme information window
- QPushButton* runSalomeBtn; // <Launch Salome> buttnon
-};
+ QWidget* progressPage; // page itself
+ QSplitter* splitter; // splitter window
+ InstallInfo* installInfo; // information about running installation scripts
+ QLabel* parametersLab; // answer field's label
+ QLineEdit* passedParams; // user can pass data to running script
+ QTextEdit* installProgress;// contains information about progress of installing selected products
+ ProgressView* progressView; // displays information about progress of installing selected products
+ QCheckBox* ignoreErrCBox; // checkbox to ignore installation errors
+ QLabel* statusLab; // displays currently performed action
+ // --> finish page
+ QWidget* readmePage; // page itself
+ QTextEdit* readme; // Readme information window
+ ButtonList buttons; // operation buttons
-/*!
- Class MyListView : Products list view
-*/
-class MyListView : public QListView
-{
- Q_OBJECT
-
- // Class MyListViewItem: to define custom products list view item
- class MyListViewItem : public QCheckListItem
- {
- public:
- // constructor
- MyListViewItem( MyListView* parent, const QString& text, Type tt ) : QCheckListItem( parent, text, tt ) {}
- // other constructor
- MyListViewItem( QCheckListItem* parent, const QString& text, Type tt ) : QCheckListItem( parent, text, tt ) {}
- protected:
- // called when users switches item on/off
- void stateChange( bool on ) {
- QCheckListItem::stateChange( on );
- ((MyListView*)listView())->itemActivated( (QCheckListItem*)this );
- }
- };
-
-public:
- // constructor
- MyListView( QWidget* parent ) : QListView( parent )
- {
- setRootIsDecorated( false );
- addColumn( "Products" );
- addColumn( "Version" );
- setResizeMode( LastColumn );
- setSorting( -1, false );
- }
- // adds product item(s) into the list
- QCheckListItem* addItem( const QString& name,
- const QString& version,
- const QString& install,
- const QStringList& supported,
- const QString& script )
- {
- QCheckListItem* item = 0;
- QListViewItem* lItem = this->firstChild();
- while( lItem && lItem->nextSibling() )
- lItem = lItem->nextSibling();
-
- if ( install.isNull() || install.isEmpty() ) {
- item = new MyListViewItem( this, name, QCheckListItem::CheckBox );
- item->setText( 1, version );
- item->setText( 2, script );
- item->moveItem( lItem );
- } else {
- item = new MyListViewItem( this, name, QCheckListItem::Controller );
- item->setText( 1, version );
- item->setText( 2, script );
-
- QCheckListItem* subitem = 0;
- subitem = new MyListViewItem( item, tr( "not install" ), QCheckListItem::RadioButton );
- subitem->setOn( true );
- QCheckListItem* previtem = subitem;
- subitem->moveItem( previtem );
- for ( int i = 0; i < (int)supported.count(); i++ ) {
- subitem = new MyListViewItem( item, supported[ i ], QCheckListItem::RadioButton );
- if ( supported[i] == install )
- subitem->setOn( true );
- subitem->moveItem( previtem );
- previtem = subitem;
- }
- item->moveItem( lItem );
- item->setOpen( true );
- }
- return item;
- }
- // event filter - prevents collapsing/expanding of items
- bool eventFilter( QObject* o, QEvent* e )
- {
- if ( o == viewport() && e->type() == QEvent::MouseButtonDblClick )
- return true;
- return QListView::eventFilter(o, e);
- }
- // emits signal when checkbox or radiobutton is switched
- void itemActivated( QCheckListItem* item ) {
- emit itemToggled( item );
- }
- // returns true if "install binaries" is on for the item
- bool isBinaries( QCheckListItem* item )
- {
- if ( item->childCount() > 0 ) {
- // not SALOME sources, binaries or docs
- QCheckListItem* subItem = (QCheckListItem*)(item->firstChild());
- while( subItem ) {
- if ( subItem->isOn() )
- return subItem->text() == tr( "install binaries" );
- subItem = (QCheckListItem*)(subItem->nextSibling());
- }
- }
- // for SALOME sources, binaries and docs return false
- return false;
- }
- // returns true if "install sources" is on for the item
- bool isSources( QCheckListItem* item )
- {
- if ( item->childCount() > 0 ) {
- // not SALOME sources, binaries or docs item
- QCheckListItem* subItem = (QCheckListItem*)(item->firstChild());
- while( subItem ) {
- if ( subItem->isOn() )
- return subItem->text() == tr( "install sources" );
- subItem = (QCheckListItem*)(subItem->nextSibling());
- }
- }
- else {
- // for SALOME sources, binaries or docs item return true if checked
- return item->isOn();
- }
- return false;
- }
- // returns true if "use native" is on for the item
- bool isNative( QCheckListItem* item )
- {
- if ( item->childCount() > 0 ) {
- // not SALOME sources, binaries or docs item
- QCheckListItem* subItem = (QCheckListItem*)(item->firstChild());
- while( subItem ) {
- if ( subItem->isOn() )
- return subItem->text() == tr( "use native" );
- subItem = (QCheckListItem*)(subItem->nextSibling());
- }
- }
- return false;
- }
- // returns true if "not install" is on for the item
- bool isNone( QCheckListItem* item )
- {
- return !isBinaries( item ) && !isSources( item ) && !isNative( item );
- }
- // sets "install binaries" on for the item; if "binaries" item is absent, set "install sources" on if it is present
- void setBinaries( QCheckListItem* item ) {
- if ( item->childCount() > 0 ) {
- // not SALOME sources, binaries or docs item
- QCheckListItem* subItem = (QCheckListItem*)(item->firstChild());
- QCheckListItem* srcItem = 0;
- QCheckListItem* nativeItem = 0;
- while( subItem ) {
- if ( subItem->text() == tr( "install sources" ) )
- srcItem = subItem;
- if ( subItem->text() == tr( "use native" ) )
- nativeItem = subItem;
- if ( subItem->text() == tr( "install binaries" ) ) {
- subItem->setOn( true );
- return;
- }
- subItem = (QCheckListItem*)(subItem->nextSibling());
- }
- if ( srcItem )
- srcItem->setOn( true );
- if ( nativeItem )
- nativeItem->setOn( true );
- }
- else {
- // for SALOME sources, binaries and docs items set true
- item->setOn( true );
- }
- }
- // sets "install sources" on for the item; if "sources" item is absent, set "install binaries" on if it is present
- void setSources( QCheckListItem* item ) {
- if ( item->childCount() > 0 ) {
- // not SALOME sources, binaries or docs item
- QCheckListItem* subItem = (QCheckListItem*)(item->firstChild());
- QCheckListItem* binItem = 0;
- while( subItem ) {
- if ( subItem->text() == tr( "install binaries" ) )
- binItem = binItem;
- if ( subItem->text() == tr( "install sources" ) ) {
- subItem->setOn( true );
- return;
- }
- subItem = (QCheckListItem*)(subItem->nextSibling());
- }
- if ( binItem )
- binItem->setOn( true );
- }
- else {
- // for SALOME sources, binaries and docs items set true
- item->setOn( true );
- }
- }
- // sets "use native" on for the item; if "sources" item is absent, set "install binaries" on if it is present
- void setNative( QCheckListItem* item ) {
- if ( item->childCount() > 0 ) {
- // not SALOME sources, binaries or docs item
- QCheckListItem* subItem = (QCheckListItem*)(item->firstChild());
- QCheckListItem* binItem = 0;
- while( subItem ) {
- if ( subItem->text() == tr( "install binaries" ) )
- binItem = binItem;
- if ( subItem->text() == tr( "use native" ) ) {
- subItem->setOn( true );
- return;
- }
- subItem = (QCheckListItem*)(subItem->nextSibling());
- }
- if ( binItem )
- binItem->setOn( true );
- }
- else {
- // for SALOME sources, binaries and docs items set true
- item->setOn( true );
- }
- }
- // sets "not install" on for the item
- void setNone( QCheckListItem* item ) {
- if ( item->childCount() > 0 ) {
- // not SALOME sources, binaries or docs item
- QCheckListItem* subItem = (QCheckListItem*)(item->firstChild());
- while( subItem ) {
- if ( subItem->text() == tr( "not install" ) ) {
- subItem->setOn( true );
- return;
- }
- subItem = (QCheckListItem*)(subItem->nextSibling());
- }
- }
- else {
- // for SALOME sources, binaries and docs items set false
- item->setOn( false );
- }
- }
-signals:
- // emitted when checkbox or radiobutton is switched
- void itemToggled( QCheckListItem* item );
-};
-
-/*!
- Class ProgressViewItem: Progress list view item
-*/
-enum Status { Waiting, Processing, Completed, Aborted };
-class ProgressView;
-class ProgressViewItem : public QListViewItem
-{
-public:
- // constructor
- ProgressViewItem( ProgressView* parent,
- QString productName,
- const QString installType,
- const QString scriptName,
- Status status = Waiting );
-
- // sets product status
- void setStatus( Status status );
- // gets product status
- Status getStatus() const { return myStatus; }
- // gets product name
- QString getProduct() const { return text( 0 ); }
- // gets product script
- QString getScript() const { return myScript; }
- // gets type of the installation: 'binaries', 'source', 'native' or 'not install'
- QString getInstallType() const { return text( 1 ); }
-
-protected:
- // paints cell of the item
- void paintCell( QPainter* painter, const QColorGroup& cg, int column, int width, int align );
-
-private:
- Status myStatus; // status
- QString myScript; // alias
-};
-
-/*!
- Class ProgressView: Progress list view
-*/
-class ProgressView : public QListView
-{
-public:
- // constructor
- ProgressView( QWidget* parent );
-
- // sets/gets status colors
- void setColors( QColor wColor, QColor pColor, QColor cColor );
- QColor getWaitingColor() { return myWaitingColor; }
- QColor getProcessingColor() { return myProcessingColor; }
- QColor getCompletedColor() { return myCompletedColor; }
-
- // adds product item
- void addProduct( const QString smbName, const QString type, const QString product );
- // finds the first item with given status
- QString findStatus( Status status );
- // sets new status for the product item
- void setStatus( const QString product, Status status );
- // scrolls the view to make item visible if necessary
- void ensureVisible( const QString product );
- // gets the product script
- QString getScript( const QString product );
-
-protected:
- // finds the item by the product name
- ProgressViewItem* findItem( const QString product );
-
-private:
- QColor myWaitingColor; // 'Waiting' color
- QColor myProcessingColor; // 'Processing' color
- QColor myCompletedColor; // 'Completed' color
+ ProcessThread* myThread; // validation thread
+ bool hasErrors; // flag: if there were any errors or warnings during the installation
};
-/*!
- Class StructureParser: parses xml-description file and populates the list of the products
-*/
-class StructureParser: public QXmlDefaultHandler
-{
-public:
- // constructor
- StructureParser();
- // begins parsing of the xml dom-element
- bool startElement( const QString&, const QString&, const QString& ,
- const QXmlAttributes& );
- // finishes parsing of the xml dom-element of the xml dom-element
- bool endElement( const QString&, const QString&, const QString& );
- // set control widgets
- void setListView ( MyListView* view );
- void setWizard ( SALOME_InstallWizard* wiz );
- void setTargetDir( QLineEdit* dir );
- void setTempDir ( QLineEdit* dir );
-
-private:
- MyListView* tree; // products list view
- SALOME_InstallWizard* wizard; // Salome Pro installation wizard's main window
- QLineEdit* targetdir; // target directory widget
- QLineEdit* tempdir; // temp directory widget
-};
+#endif