#include <qstringlist.h>
#include <qpopupmenu.h>
#include <qregexp.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qregexp.h>
#ifdef WNT
#include <iostream.h>
Dependancies dep = mapIter.data();
QStringList deps = dep.getDependancies();
for (int i = 0; i<(int)deps.count(); i++ ) {
- if ( !aProducts.contains( deps[i] ) )
+ if ( !aProducts.contains( deps[i] ) ) {
aProducts.append( deps[i] );
+ aProducts.append( deps[i] + "_src" );
+ }
}
- if ( !aProducts.contains( item->text(0) ) )
+ if ( !aProducts.contains( item->text(0) ) ) {
aProducts.append( item->text(0) );
+ aProducts.append( item->text(0) + "_src" );
+ }
}
return aProducts.join(" ");
}
// ================================================================
SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
const QString& aTargetDir,
- const QString& aTmpDir,
- const bool aForceSrc)
+ const QString& aTmpDir)
: InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ),
helpWindow( NULL ),
moreMode( false ),
exitConfirmed( false ),
hasErrors( false )
{
- myIWName = tr( "Installation Wizard" );
- tmpCreated = QString::null;
- xmlFileName = aXmlFileName;
- targetDirPath = aTargetDir;
- tmpDirPath = aTmpDir;
+ myIWName = tr( "Installation Wizard" );
+ tmpCreated = QString::null;
+ xmlFileName = aXmlFileName;
+ myTargetPath = aTargetDir;
+ myTmpPath = aTmpDir;
+ stateChanged = true;
+ binPath = QDir::currentDirPath() + "/Products/BINARIES";
+ srcPath = QDir::currentDirPath() + "/Products/SOURCES";
+
+ //
+ // get XML filename and current platform
+ //
+ // ... get current platform
+ curPlatform = currentPlatform();
+// cout << "curOS = " << curPlatform << endl;
+// curPlatform = "";
+ // ... check XML and platform definition
+ getXmlAndPlatform();
// set application font
QFont fnt = font();
addLogo( pixmap( pxLogo ) );
// set defaults
- setVersion( "1.2" );
- setCaption( tr( "PAL/SALOME %1" ).arg( myVersion ) );
- setCopyright( tr( "Copyright (C) 2004 CEA" ) );
+ setVersion( "3.2.6" );
+ setCaption( tr( "SALOME %1" ).arg( myVersion ) );
+ setCopyright( tr( "Copyright (C) 2007 CEA" ) );
setLicense( tr( "All right reserved" ) );
- setOS( "" );
___MESSAGE___( "Configuration file : " << xmlFileName.latin1() );
- ___MESSAGE___( "Target directory : " << targetDirPath.latin1() );
- ___MESSAGE___( "Temporary directory: " << tmpDirPath.latin1() );
+ ___MESSAGE___( "Target directory : " << myTargetPath.latin1() );
+ ___MESSAGE___( "Temporary directory: " << myTmpPath.latin1() );
+ //
// xml reader
- QFile xmlfile(xmlFileName);
- if ( xmlfile.exists() ) {
- QXmlInputSource source( &xmlfile );
- QXmlSimpleReader reader;
+ //
+ StructureParser* parser = new StructureParser( this );
+ parser->readXmlFile(xmlFileName);
- StructureParser* handler = new StructureParser( this );
- reader.setContentHandler( handler );
- reader.parse( source );
- }
+ // create instance of class for starting shell script to get available disk space
+ diskSpaceProc = new QProcess( this, "procDiskSpace" );
+ connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) );
// create instance of class for starting shell install script
shellProcess = new QProcess( this, "shellProcess" );
// create introduction page
setupIntroPage();
+ // create page to select installation type
+ setupTypePage();
+ // create page to select the reference installation platform (if necessary)
+ setupPlatformPage();
+ // create directories page
+ setupDirPage();
// create products page
- setupProductsPage(aForceSrc);
+ setupProductsPage();
// create prestart page
setupCheckPage();
// create progress page
// common signals connections
connect( this, SIGNAL( selected( const QString& ) ),
- this, SLOT( pageChanged( const QString& ) ) );
+ this, SLOT( pageChanged( const QString& ) ) );
connect( this, SIGNAL( helpClicked() ), this, SLOT( helpClicked() ) );
connect( this, SIGNAL( aboutClicked() ), this, SLOT( onAbout() ) );
delete myThread;
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::currentPlatform
+ * Tries to determine the current user's operating system
+ */
+// ================================================================
+QString SALOME_InstallWizard::currentPlatform()
+{
+ // file parsing
+ QString curOS = "";
+ QString osFileName = "/etc/issue";
+ if ( QFile::exists( osFileName ) ) {
+ QFile file( osFileName );
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream stream( &file );
+ QString str = stream.readLine();
+ file.close();
+ // line parsing
+ QString pltName = "", platVersion = "", platBit = "";
+ QRegExp rx( "(.*)[L|l]inux.*release\\s+([\\d.]*)" );
+// str = "Debian GNU/Linux 3.1 \n \l";
+// str = "Red Hat Enterprise Linux WS release 4 (Nahant)";
+// str = "Mandriva Linux release 2006.0 (Official) for x86_64";
+ int pos = rx.search( str );
+ if ( pos == -1 ) {// Debian case
+ rx = QRegExp( "(.*)GNU/Linux\\s+([\\d.]*)" );
+ pos = rx.search( str );
+ }
+ if ( pos > -1 ) {
+ pltName = rx.cap( 1 );
+ platVersion = rx.cap( 2 );
+ rx = QRegExp( "x86_64" );
+ pos = rx.search( str );
+ if ( pos > -1 )
+ platBit = "_64";
+ curOS = pltName + platVersion + platBit;
+ }
+ }
+ }
+ // return curOS.remove( " " );
+ QString str( " " );
+ int index = 0;
+ while ( (index = curOS.find( str, index, true)) != -1 )
+ curOS.remove( index, str.length() );
+ return curOS;
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::getXmlMap
+ * Creates a map of the supported operating systems and
+ * corresponding XML files.
+ */
+// ================================================================
+MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& xmlFileName )
+{
+ MapXmlFiles xmlMap;
+ QStringList xmlList;
+ if ( xmlFileName )
+ xmlList.append( xmlFileName );
+ else {
+ QDir dir( QDir::currentDirPath() );
+ xmlList = dir.entryList( "*.xml", QDir::Files | QDir::Readable );
+ }
+// cout << xmlList.join(",") << endl;
+ // XML files parsing
+ QFile file;
+ QDomDocument doc( "xml_doc" );
+ QDomElement docElem;
+ QDomNodeList nodeList;
+ QDomNode node;
+ QDomElement elem;
+ QString platforms = "";
+ QStringList platList;
+ for ( uint i = 0; i < xmlList.count(); i++ ) {
+ file.setName( xmlList[i] );
+ if ( !doc.setContent( &file ) ) {
+ file.close();
+ continue;
+ }
+ file.close();
+
+ docElem = doc.documentElement();
+ nodeList = docElem.elementsByTagName( "config" );
+ if ( nodeList.count() == 0 )
+ continue;
+ node = nodeList.item( 0 );
+ if ( node.isElement() ) {
+ elem = node.toElement();
+ if ( elem.attribute( "platforms" ) ) {
+ platforms = elem.attribute( "platforms" ).stripWhiteSpace();
+ QStringList platList = QStringList::split( ",", platforms );
+ for ( uint j = 0; j < platList.count(); j++ ) {
+ if ( !platList[j].isEmpty() && xmlMap.find( platList[j] ) == xmlMap.end() )
+ xmlMap[ platList[j] ] = xmlList[i];
+ }
+// if ( !curPlatform.isEmpty() && xmlMap.find( curPlatform ) != xmlMap.end() )
+// return xmlMap;
+ }
+ }
+ }
+ return xmlMap;
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::checkXmlAndPlatform
+ * Check XML file and current platform definition
+ */
+// ================================================================
+void SALOME_InstallWizard::getXmlAndPlatform()
+{
+ MapXmlFiles xmlMap;
+ if ( xmlFileName.isNull() ) {
+ xmlMap = getXmlMap();
+ if ( !curPlatform.isEmpty() ) {
+ // try to get XML file for current platform
+ if ( xmlMap.find( curPlatform ) != xmlMap.end() )
+ xmlFileName = xmlMap[ curPlatform ];
+ else {
+ platformsMap = xmlMap;
+ warnMsg = tr( "Your Linux platform is not supported by this SALOME package" );
+ }
+ }
+ else {
+ // get all supported platforms
+ platformsMap = xmlMap;
+ warnMsg = tr( "Install Wizard can't define your Linux platform" );
+ }
+ }
+ else {
+ xmlMap = getXmlMap( xmlFileName );
+ if ( !curPlatform.isEmpty() ) {
+ // check that the user's XML file supports current platform
+ if ( xmlMap.find( curPlatform ) == xmlMap.end() ) {
+ platformsMap = getXmlMap();
+ MapXmlFiles::Iterator it;
+ for ( it = xmlMap.begin(); it != xmlMap.end(); ++it )
+ platformsMap.insert( it.key(), it.data(), true );
+ warnMsg = tr( "The given configuration file doesn't support your Linux platform" );
+ }
+ }
+ else {
+ // get all supported platforms
+ platformsMap = getXmlMap();
+ MapXmlFiles::Iterator it;
+ for ( it = xmlMap.begin(); it != xmlMap.end(); ++it )
+ platformsMap.insert( it.key(), it.data(), true );
+ warnMsg = tr( "Install Wizard can't define your Linux platform" );
+ }
+ }
+}
+// ================================================================
/*!
* SALOME_InstallWizard::eventFilter
* Event filter, spies for Help window closing
addPage( introPage, tr( "Introduction" ) );
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::setupTypePage
+ * Creates installation types page
+ */
+// ================================================================
+void SALOME_InstallWizard::setupTypePage()
+{
+ // create page
+ typePage = new QWidget( this, "TypePage" );
+ QGridLayout* pageLayout = new QGridLayout( typePage );
+ pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
+ // create installation type button group
+ buttonGrp = new QButtonGroup( typePage );
+ buttonGrp->setFrameShape(QButtonGroup::NoFrame);
+ QGridLayout* buttonGrpLayout = new QGridLayout( buttonGrp );
+ buttonGrpLayout->setMargin( 0 ); buttonGrpLayout->setSpacing( 6 );
+ QSpacerItem* spacer1 = new QSpacerItem( 16, 50, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ QSpacerItem* spacer2 = new QSpacerItem( 16, 50, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ QLabel* selectLab = new QLabel( tr( "Select a type of the installation:" ), buttonGrp );
+ QSpacerItem* spacer3 = new QSpacerItem( 20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ // ... 'install binaries' layout
+ QGridLayout* binLayout = new QGridLayout( 2, 2, 0 );
+ binBtn = new QRadioButton( tr( "Install binaries" ), buttonGrp );
+ QFont rbFont = binBtn->font();
+ rbFont.setBold( true );
+ binBtn->setFont( rbFont );
+ QSpacerItem* spacer4 = new QSpacerItem( 16, 16, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ QLabel* binLab = new QLabel( tr( "- all the binaries and sources of the chosen SALOME modules will be installed.\n"
+ "- all the binaries of the chosen prerequisites will be installed." ),
+ buttonGrp );
+ binLayout->addMultiCellWidget( binBtn, 0, 0, 0, 1 );
+ binLayout->addItem ( spacer4, 1, 0 );
+ binLayout->addWidget ( binLab, 1, 1 );
+ // ... 'install sources' layout
+ QGridLayout* srcLayout = new QGridLayout( 2, 2, 0 );
+ srcBtn = new QRadioButton( tr( "Install sources" ), buttonGrp );
+ srcBtn->setFont( rbFont );
+ QSpacerItem* spacer5 = new QSpacerItem( 16, 16, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ QLabel* srcLab = new QLabel( tr( "- all the sources of the chosen modules and prerequisites will be installed without\ncompilation." ),
+ buttonGrp );
+ srcLayout->addMultiCellWidget( srcBtn, 0, 0, 0, 1 );
+ srcLayout->addItem ( spacer5, 1, 0 );
+ srcLayout->addWidget ( srcLab, 1, 1 );
+ // ... 'install sources and make compilation' layout
+ QGridLayout* srcCompileLayout = new QGridLayout( 3, 3, 0 );
+ srcCompileBtn = new QRadioButton( tr( "Install sources and make a compilation" ), buttonGrp );
+ srcCompileBtn->setFont( rbFont );
+ QSpacerItem* spacer6 = new QSpacerItem( 16, 16, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ QLabel* srcCompileLab1 = new QLabel( tr( "- all the sources of the chosen modules and prerequisites will be installed and\ncompiled." ),
+ buttonGrp );
+ QLabel* srcCompileLab2 = new QLabel( tr( "Note:" ),
+ buttonGrp );
+ QFont noteFont = srcCompileLab2->font();
+ noteFont.setUnderline( true );
+ srcCompileLab2->setFont( noteFont );
+ srcCompileLab2->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
+ srcCompileLab2->setAlignment( Qt::AlignHCenter | Qt::AlignTop );
+ QLabel* srcCompileLab3 = new QLabel( " " +
+ tr( "it is a long time operation and it can take more than 24 hours depending\n on the computer." ),
+ buttonGrp );
+ removeSrcBtn = new QMyCheckBox( tr( "Remove sources and temporary files after compilation" ), typePage );
+ setAboutInfo( removeSrcBtn, tr( "Check this option if you want to remove sources of the products\nwith all the temporary files after build finishing" ) );
+ removeSrcBtn->setState( QButton::Off );
+ removeSrcBtn->setEnabled( false );
+
+ srcCompileLayout->addMultiCellWidget( srcCompileBtn, 0, 0, 0, 2 );
+ srcCompileLayout->addMultiCell ( spacer6, 1, 2, 0, 0 );
+ srcCompileLayout->addMultiCellWidget( srcCompileLab1, 1, 1, 1, 2 );
+ srcCompileLayout->addWidget ( srcCompileLab2, 2, 1 );
+ srcCompileLayout->addWidget ( srcCompileLab3, 2, 2 );
+ srcCompileLayout->addMultiCellWidget( removeSrcBtn, 3, 3, 1, 2 );
+ // layout widgets in the button group
+ buttonGrpLayout->addItem ( spacer1, 0, 1 );
+ buttonGrpLayout->addMultiCellWidget( selectLab, 1, 1, 0, 1 );
+ buttonGrpLayout->addMultiCell ( spacer3, 2, 4, 0, 0 );
+ buttonGrpLayout->addLayout ( binLayout, 2, 1 );
+ buttonGrpLayout->addLayout ( srcLayout, 3, 1 );
+ buttonGrpLayout->addLayout ( srcCompileLayout, 4, 1 );
+ buttonGrpLayout->addItem ( spacer2, 5, 1 );
+ // layout button group at the page
+ pageLayout->addWidget( buttonGrp, 0, 0 );
+ // connecting signals
+ connect( buttonGrp, SIGNAL( clicked(int) ), this, SLOT ( onButtonGroup(int) ) );
+ connect( removeSrcBtn, SIGNAL( toggled( bool ) ), this, SLOT( onRemoveSrcBtn() ) );
+ // adding page
+ addPage( typePage, tr( "Installation type" ) );
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::setupPlatformPage
+ * Creates platforms page, if necessary
+ */
+// ================================================================
+void SALOME_InstallWizard::setupPlatformPage()
+{
+ // create page or not?
+ if ( platformsMap.isEmpty() )
+ return;
+
+ // create page
+ platformsPage = new QWidget( this, "PlatformsPage" );
+ QGridLayout* pageLayout = new QGridLayout( platformsPage );
+ pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
+ // create warning labels
+ QLabel* warnLab2 = new QLabel( tr( "WARNING!" ), platformsPage );
+ warnLab2->setAlignment( Qt::AlignHCenter );
+ QFont fnt = warnLab2->font();
+ fnt.setBold( true );
+ warnLab2->setFont( fnt );
+ if ( installType == Compile && platformsMap.find( curPlatform ) == platformsMap.end() )
+ warnMsg += tr( " and compilation is not tested on this one." );
+ else
+ warnMsg += ".";
+ warnLab = new QLabel( warnMsg, platformsPage );
+ warnLab->setAlignment( Qt::AlignHCenter | Qt::WordBreak );
+ QLabel* warnLab3 = new QLabel( tr( "If you want to proceed anyway, please select platform from the following list:" ),
+ platformsPage );
+ warnLab3->setAlignment( Qt::AlignHCenter | Qt::WordBreak );
+ // create button group
+ platBtnGrp = new QButtonGroup( platformsPage );
+ platBtnGrp->setFrameShape(QButtonGroup::LineEditPanel);
+ platBtnGrp->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
+ QVBoxLayout* platBtnGrpLayout = new QVBoxLayout( platBtnGrp );
+ platBtnGrpLayout->setMargin( 11 ); platBtnGrpLayout->setSpacing( 6 );
+ // create platforms radio-buttons
+ QString plat;
+ MapXmlFiles::Iterator it;
+ for ( it = platformsMap.begin(); it != platformsMap.end(); ++it ) {
+ plat = it.key();
+ QRadioButton* rb = new QRadioButton( plat, platBtnGrp, plat );
+ platBtnGrpLayout->addWidget( rb );
+ }
+ // create spacers
+ QSpacerItem* spacer1 = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ QSpacerItem* spacer2 = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+
+ // layout widgets on page
+ pageLayout->addItem ( spacer1, 0, 0 );
+ pageLayout->addWidget ( warnLab2, 1, 0 );
+ pageLayout->addWidget ( warnLab, 2, 0 );
+ pageLayout->addWidget ( warnLab3, 3, 0 );
+ pageLayout->addItem ( spacer2, 4, 0 );
+ pageLayout->addMultiCellWidget( platBtnGrp, 0, 4, 1, 1 );
+
+ // connecting signals
+ connect( platBtnGrp, SIGNAL( clicked(int) ), this, SLOT ( onButtonGroup(int) ) );
+
+ // adding page
+ addPage( platformsPage, tr( "Installation platform" ) );
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::setupDirPage
+ * Creates directories page
+ */
+// ================================================================
+void SALOME_InstallWizard::setupDirPage()
+{
+ // create page
+ dirPage = new QWidget( this, "DirPage" );
+ QGridLayout* pageLayout = new QGridLayout( dirPage );
+ pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
+ QSpacerItem* spacer1 = new QSpacerItem( 16, 50, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ QSpacerItem* spacer2 = new QSpacerItem( 16, 50, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ // target directory
+ QGridLayout* targetLayout = new QGridLayout( 2, 2, 0 );
+ QLabel* targetLab = new QLabel( tr( "Set a target directory to install SALOME platform:" ), dirPage );
+ targetFolder = new QLineEdit( dirPage );
+ targetBtn = new QPushButton( tr( "Browse..." ), dirPage );
+ setAboutInfo( targetBtn, tr( "Click this button to browse\nthe installation directory" ) );
+ targetLayout->addMultiCellWidget( targetLab, 0, 0, 0, 1 );
+ targetLayout->addWidget ( targetFolder, 1, 0 );
+ targetLayout->addWidget ( targetBtn, 1, 1 );
+ // temporary directory
+ QGridLayout* tempLayout = new QGridLayout( 2, 2, 0 );
+ QLabel* tempLab = new QLabel( tr( "Set a directory that should be used for temporary SALOME files:" ), dirPage );
+ tempFolder = new QLineEdit( dirPage );
+ tempBtn = new QPushButton( tr( "Browse..." ), dirPage );
+ setAboutInfo( tempBtn, tr( "Click this button to browse\nthe temporary directory" ) );
+ tempLayout->addMultiCellWidget( tempLab, 0, 0, 0, 1 );
+ tempLayout->addWidget ( tempFolder, 1, 0 );
+ tempLayout->addWidget ( tempBtn, 1, 1 );
+ // layout widgets
+ pageLayout->addItem ( spacer1, 0, 0 );
+ pageLayout->addLayout( targetLayout, 1, 0 );
+ pageLayout->addLayout( tempLayout, 2, 0 );
+ pageLayout->addItem ( spacer2, 3, 0 );
+ // connecting signals
+ connect( targetFolder, SIGNAL( textChanged( const QString& ) ),
+ this, SLOT( directoryChanged( const QString& ) ) );
+ connect( targetBtn, SIGNAL( clicked() ),
+ this, SLOT( browseDirectory() ) );
+ connect( tempFolder, SIGNAL( textChanged( const QString& ) ),
+ this, SLOT( directoryChanged( const QString& ) ) );
+ connect( tempBtn, SIGNAL( clicked() ), this, SLOT( browseDirectory() ) );
+
+ // adding page
+ addPage( dirPage, tr( "Installation directories" ) );
+}
+// ================================================================
/*!
* SALOME_InstallWizard::setupProductsPage
* Creates products page
*/
// ================================================================
-void SALOME_InstallWizard::setupProductsPage(const bool forceSrc)
+void SALOME_InstallWizard::setupProductsPage()
{
- //
// create page
- //
productsPage = new QWidget( this, "ProductsPage" );
QGridLayout* pageLayout = new QGridLayout( productsPage );
pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
//
- // create common widgets
+ // create left column widgets
//
- // ... target directory
- QLabel* targetLab = new QLabel( tr( "Installation directory:" ), productsPage );
- targetFolder = new QLineEdit( productsPage );
- setAboutInfo( targetFolder, tr( "Enter the target directory where the products\nshould be installed to" ) );
- targetBtn = new QPushButton( tr( "Browse..." ), productsPage );
- setAboutInfo( targetBtn, tr( "Click this button to browse\nthe installation directory" ) );
- // ... temporary directory
- QLabel* tempLab = new QLabel( tr( "Temporary directory:" ), productsPage );
- tempFolder = new QLineEdit( productsPage );
- setAboutInfo( tempFolder, tr( "The directory which should be used\nfor temporary files" ) );
- tempBtn = new QPushButton( tr( "Browse..." ), productsPage );
- setAboutInfo( tempBtn, tr( "Click this button to browse\nthe temporary directory" ) );
+ QVBoxLayout* leftBoxLayout = new QVBoxLayout;
+ leftBoxLayout->setMargin( 0 ); leftBoxLayout->setSpacing( 6 );
+ // ... modules list
+ modulesView = new ProductsView( productsPage, "modulesView" );
+ setAboutInfo( modulesView, tr( "The modules available for the installation" ) );
+ modulesView->setColumnAlignment( 1, Qt::AlignRight );
+ leftBoxLayout->addWidget( modulesView );
+ // ... 'Installation with GUI' checkbox
+ installGuiBtn = new QMyCheckBox( tr( "Installation with GUI" ), productsPage );
+ setAboutInfo( installGuiBtn, tr( "Check this option if you want\nto install SALOME with GUI" ) );
+ leftBoxLayout->addWidget( installGuiBtn );
+ // ... prerequisites list
+ prereqsView = new ProductsView( productsPage, "prereqsView" );
+ prereqsView->renameColumn( 0, "Prerequisite" );
+ setAboutInfo( prereqsView, tr( "The prerequisites that can be installed" ) );
+ prereqsView->setColumnAlignment( 1, Qt::AlignRight );
+ leftBoxLayout->addWidget( prereqsView );
+ // ... 'Show/Hide prerequisites' button
+ moreBtn = new QPushButton( tr( "Show prerequisites..." ), productsPage );
+ setAboutInfo( moreBtn, tr( "Click to show list of prerequisites" ) );
+ leftBoxLayout->addWidget( moreBtn );
+ //
+ // create right column widgets
+ //
+ // ... info box
+ productInfo = new QTextBrowser( productsPage );
+ productInfo->setFrameShape( QFrame::LineEditPanel );
+ productInfo->setPaletteBackgroundColor( productsPage->paletteBackgroundColor() );
+ setAboutInfo( productInfo, tr( "Short information about the product being selected" ) );
// ... disk space labels
QLabel* reqLab1 = new QLabel( tr( "Disk space required:" ), productsPage );
setAboutInfo( reqLab1, tr( "Total disk space required for the installation\nof the selected products" ) );
requiredSize = new QLabel( productsPage );
- requiredSize->setMinimumWidth( 100 );
setAboutInfo( requiredSize, tr( "Total disk space required for the installation\nof the selected products" ) );
+ requiredSize->setAlignment( Qt::AlignRight );
QLabel* reqLab2 = new QLabel( tr( "Space for temporary files:" ), productsPage );
setAboutInfo( reqLab2, tr( "Disk space required for the temporary files" ) );
requiredTemp = new QLabel( productsPage );
- requiredTemp->setMinimumWidth( 100 );
setAboutInfo( requiredTemp, tr( "Disk space required for the temporary files" ) );
- QFont fnt = reqLab1->font();
- fnt.setBold( true );
- reqLab1->setFont( fnt );
- requiredSize->setFont( fnt );
- reqLab2->setFont( fnt );
- requiredTemp->setFont( fnt );
+ requiredTemp->setAlignment( Qt::AlignRight );
+ QLabel* reqLab3 = new QLabel( tr( "Available disk space:" ), productsPage );
+ setAboutInfo( reqLab3, tr( "Disk space available on the selected device" ) );
+ availableSize = new QLabel( productsPage );
+ setAboutInfo( availableSize, tr( "Disk space available on the selected device" ) );
+ availableSize->setAlignment( Qt::AlignRight );
+ // layout size widgets
QGridLayout* sizeLayout = new QGridLayout; sizeLayout->setMargin( 0 ); sizeLayout->setSpacing( 6 );
- sizeLayout->addWidget( reqLab1, 0, 0 );
- sizeLayout->addWidget( requiredSize, 0, 1 );
- sizeLayout->addWidget( reqLab2, 1, 0 );
- sizeLayout->addWidget( requiredTemp, 1, 1 );
- //
- // create <More...> mode widgets container
- //
- moreBox = new QWidget( productsPage );
- QGridLayout* moreBoxLayout = new QGridLayout( moreBox );
- moreBoxLayout->setMargin( 0 ); moreBoxLayout->setSpacing( 6 );
- //
- // create <More...> mode widgets
- //
- // ... products list
- productsView = new ProductsView( moreBox );
- productsView->setMinimumSize( 250, 180 );
- setAboutInfo( productsView, tr( "The products available for the installation" ) );
- // ... products info box
- productsInfo = new QTextBrowser( moreBox );
- productsInfo->setMinimumSize( 270, 135 );
- setAboutInfo( productsInfo, tr( "Short information about the product being selected" ) );
- // ... prerequisites checkbox
- prerequisites = new QCheckBox( tr( "Automatic dependencies" ), moreBox );
- prerequisites->setChecked( true );
- setAboutInfo( prerequisites, tr( "Check this box if you want the prerequisite products\nto be selected automatically" ) );
- // ... <Unselect All> button
- unselectBtn = new QPushButton( tr( "&Unselect All" ), moreBox );
- setAboutInfo( unselectBtn, tr( "Click this button to deselect all the products" ) );
- // ... <SALOME sources> and <SALOME binaries> tri-state checkboxes
- selectBinBtn = new QMyCheckBox( tr( "SALOME binaries" ), moreBox );
- selectBinBtn->setTristate( true );
- setAboutInfo( selectBinBtn, tr( "Click this button to select/deselect SALOME binaries" ) );
- selectSrcBtn = new QMyCheckBox( tr( "SALOME sources" ), moreBox );
- selectSrcBtn->setTristate( true );
- setAboutInfo( selectSrcBtn, tr( "Click this button to select/deselect SALOME sources" ) );
- buildSrcBtn = new QMyCheckBox( tr( "Build SALOME sources" ), moreBox );
- setAboutInfo( buildSrcBtn, tr( "Check this box if you want to build selected\nSALOME modules from sources" ) );
- QGridLayout* btnLayout = new QGridLayout; btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 );
- btnLayout->addMultiCellWidget( unselectBtn, 0, 0, 0, 1 );
- btnLayout->addMultiCellWidget( selectBinBtn, 1, 1, 0, 1 );
- btnLayout->addMultiCellWidget( selectSrcBtn, 2, 2, 0, 1 );
- btnLayout->addWidget( buildSrcBtn, 3, 1 );
- btnLayout->addColSpacing( 0, 20 );
- btnLayout->setColStretch( 1, 10 );
- //
- // layout <More...> mode widgets
- //
- moreBoxLayout->addMultiCellWidget( productsView, 0, 3, 0, 0 );
- moreBoxLayout->addWidget( productsInfo, 0, 1 );
- moreBoxLayout->addWidget( prerequisites,1, 1 );
- moreBoxLayout->addLayout( btnLayout, 2, 1 );
- //
- // create <Less...> mode widgets container
- //
- lessBox = new QWidget( productsPage );
- QGridLayout* lessBoxLayout = new QGridLayout( lessBox );
- lessBoxLayout->setMargin( 0 ); lessBoxLayout->setSpacing( 6 );
- //
- // create <Less...> mode widgets
- //
- // ... <Install all products from sources> check box
- allFromSrcBtn = new QMyCheckBox( tr( "Install all products from sources" ), lessBox );
- allFromSrcBtn->setChecked( forceSrc );
- setAboutInfo( allFromSrcBtn, tr( "Check this box if you want to build\nall the products from sources.\n\nWarning: this is long-time operation!" ) );
- lessBoxLayout->addWidget( allFromSrcBtn, 0, 0 );
- lessBoxLayout->setRowStretch( 1, 10 );
- //
- // create <More...>/<Less...> button
- //
- moreBtn = new QPushButton( tr( "More..." ), productsPage );
- setAboutInfo( moreBtn, tr( "Switch to the advanced mode" ) );
- //
- // layout all widgets
- //
- QFrame* line = new QFrame( productsPage, "line" );
- line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- pageLayout->addMultiCellWidget( targetLab, 0, 0, 0, 1 );
- pageLayout->addWidget ( targetFolder, 1, 0 );
- pageLayout->addWidget ( targetBtn, 1, 1 );
- pageLayout->addMultiCellWidget( tempLab, 2, 2, 0, 1 );
- pageLayout->addWidget ( tempFolder, 3, 0 );
- pageLayout->addWidget ( tempBtn, 3, 1 );
- pageLayout->addMultiCellWidget( moreBox, 4, 4, 0, 1 );
- pageLayout->addMultiCellWidget( lessBox, 5, 5, 0, 1 );
- pageLayout->addMultiCellWidget( line, 6, 6, 0, 1 );
- pageLayout->addLayout ( sizeLayout, 7, 0 );
- pageLayout->addWidget ( moreBtn, 7, 1 );
- pageLayout->setRowStretch( 4, 5 );
- pageLayout->setRowStretch( 5, 5 );
- //
- // xml reader
- //
- QFile xmlfile(xmlFileName);
- if ( xmlfile.exists() ) {
- QXmlInputSource source( &xmlfile );
- QXmlSimpleReader reader;
-
- StructureParser* handler = new StructureParser( this );
- handler->setProductsList(productsView);
- handler->setTargetDir(targetFolder);
- handler->setTempDir(tempFolder);
- reader.setContentHandler( handler );
- reader.parse( source );
- }
- //
- // take into account command line parameters
- //
- if ( !targetDirPath.isEmpty() )
- targetFolder->setText( targetDirPath );
- if ( !tmpDirPath.isEmpty() )
- tempFolder->setText( tmpDirPath );
-
- // set first item to be selected
- if ( productsView->childCount() > 0 ) {
- productsView->setSelected( productsView->firstChild(), true );
- onSelectionChanged();
- }
+ sizeLayout->addWidget( reqLab1, 0, 0 );
+ sizeLayout->addWidget( requiredSize, 0, 1 );
+ sizeLayout->addWidget( reqLab2, 1, 0 );
+ sizeLayout->addWidget( requiredTemp, 1, 1 );
+ sizeLayout->addWidget( reqLab3, 2, 0 );
+ sizeLayout->addWidget( availableSize, 2, 1 );
+
+ // layout common widgets
+ pageLayout->addMultiCellLayout( leftBoxLayout, 0, 1, 0, 0 );
+ pageLayout->addWidget ( productInfo, 0, 1 );
+ pageLayout->addLayout ( sizeLayout, 1, 1 );
+
// adding page
- addPage( productsPage, tr( "Installation settings" ) );
- // connecting signals
- connect( productsView, SIGNAL( selectionChanged() ),
- this, SLOT( onSelectionChanged() ) );
- connect( productsView, SIGNAL( itemToggled( QCheckListItem* ) ),
- this, SLOT( onItemToggled( QCheckListItem* ) ) );
- connect( unselectBtn, SIGNAL( clicked() ),
- this, SLOT( onProdBtn() ) );
- connect( selectSrcBtn, SIGNAL( stateChanged(int) ),
- this, SLOT( onProdBtn() ) );
- connect( selectBinBtn, SIGNAL( stateChanged(int) ),
- this, SLOT( onProdBtn() ) );
- connect( buildSrcBtn, SIGNAL( stateChanged(int) ),
- this, SLOT( onProdBtn() ) );
- connect( allFromSrcBtn, SIGNAL( stateChanged(int) ),
- this, SLOT( onBuildAll() ) );
+ addPage( productsPage, tr( "Choice of the products to be installed" ) );
+
// connecting signals
- connect( targetFolder, SIGNAL( textChanged( const QString& ) ),
- this, SLOT( directoryChanged( const QString& ) ) );
- connect( targetBtn, SIGNAL( clicked() ),
- this, SLOT( browseDirectory() ) );
- connect( tempFolder, SIGNAL( textChanged( const QString& ) ),
- this, SLOT( directoryChanged( const QString& ) ) );
- connect( tempBtn, SIGNAL( clicked() ), this, SLOT( browseDirectory() ) );
- connect( moreBtn, SIGNAL( clicked() ), this, SLOT( onMoreBtn() ) );
- // start on default - non-advanced - mode
- moreBox->hide();
- onBuildAll();
+ connect( modulesView, SIGNAL( selectionChanged() ),
+ this, SLOT( onSelectionChanged() ) );
+ connect( prereqsView, SIGNAL( selectionChanged() ),
+ this, SLOT( onSelectionChanged() ) );
+ connect( modulesView, SIGNAL( clicked ( QListViewItem * item ) ),
+ this, SLOT( onSelectionChanged() ) );
+ connect( prereqsView, SIGNAL( clicked ( QListViewItem * item ) ),
+ this, SLOT( onSelectionChanged() ) );
+ connect( modulesView, SIGNAL( itemToggled( QCheckListItem* ) ),
+ this, SLOT( onItemToggled( QCheckListItem* ) ) );
+ connect( prereqsView, SIGNAL( itemToggled( QCheckListItem* ) ),
+ this, SLOT( onItemToggled( QCheckListItem* ) ) );
+ connect( installGuiBtn, SIGNAL( toggled( bool ) ),
+ this, SLOT( onInstallGuiBtn() ) );
+ connect( moreBtn, SIGNAL( clicked() ), this, SLOT( onMoreBtn() ) );
+ // start on default - non-advanced mode
+ prereqsView->hide();
}
// ================================================================
/*!
choices->setTextFormat( RichText );
choices->setUndoRedoEnabled ( false );
setAboutInfo( choices, tr( "Information about the installation choice you have made" ) );
- QPalette pal = choices->palette();
- pal.setColor( QColorGroup::Base, QApplication::palette().active().background() );
- choices->setPalette( pal );
+ choices->setPaletteBackgroundColor( prestartPage->paletteBackgroundColor() );
choices->setMinimumHeight( 10 );
// layouting
pageLayout->addWidget( choices );
progressView = new ProgressView( widget );
progressView->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
progressView->setMinimumSize( 100, 10 );
+ statusLab = new QLabel( widget );
+ statusLab->setFrameShape( QButtonGroup::LineEditPanel );
setAboutInfo( progressView, tr( "Installation status on the selected products" ) );
// layouting
layout->addRowSpacing( 0, 6 );
layout->addWidget( resultLab, 1, 0 );
layout->addWidget( progressView, 2, 0 );
+ layout->addWidget( statusLab, 3, 0 );
// layouting
- pageLayout->addWidget( splitter, 0, 0 );
+ pageLayout->addWidget( splitter, 0, 0 );
// adding page
addPage( progressPage, tr( "Installation progress" ) );
// connect signals
void SALOME_InstallWizard::setupReadmePage()
{
// create page
- readmePage = new QWidget( this, "ReadmePage" );
+ readmePage = new QWidget( this, "readmePage" );
QVBoxLayout* pageLayout = new QVBoxLayout( readmePage );
pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
// README info text box
readme->setFont( QFont( "Fixed", 12 ) );
readme->setUndoRedoEnabled ( false );
setAboutInfo( readme, tr( "README information" ) );
- QPalette pal = readme->palette();
- pal.setColor( QColorGroup::Base, QApplication::palette().active().background() );
- readme->setPalette( pal );
+ readme->setPaletteBackgroundColor( readmePage->paletteBackgroundColor() );
readme->setMinimumHeight( 10 );
pageLayout->addWidget( readme );
pageLayout->setStretchFactor( readme, 5 );
// Operation buttons
- if ( buttons.count() > 0 ) {
- QHBoxLayout* hLayout = new QHBoxLayout;
- hLayout->setMargin( 0 ); hLayout->setSpacing( 6 );
- ButtonList::Iterator it;
- for ( it = buttons.begin(); it != buttons.end(); ++it ) {
- QButton* b = new QPushButton( tr( (*it).label() ), readmePage );
- if ( !(*it).tootip().isEmpty() ) {
- setAboutInfo( b, tr( (*it).tootip() ) );
- }
- hLayout->addWidget( b );
- (*it).setButton( b );
- connect( b, SIGNAL( clicked() ), this, SLOT( onFinishButton() ) );
- }
- hLayout->addStretch();
- pageLayout->addLayout( hLayout );
- }
+ QHBoxLayout* hLayout = new QHBoxLayout( -1, "finishButtons" );
+ hLayout->setMargin( 0 ); hLayout->setSpacing( 6 );
+ hLayout->addStretch();
+ pageLayout->addLayout( hLayout );
// loading README file
QString readmeFile = QDir::currentDirPath() + "/README";
int nbProd = 0;
QString text;
- if ( !xmlFileName.isEmpty() ) {
- text += tr( "Configuration file" )+ ": <b>" + xmlFileName + "</b><br>";
- text += "<br>";
- }
- if ( !myOS.isEmpty() ) {
- text += tr( "Reference Linux platform" ) + ": <b>" + myOS + "</b><br>";
- text += "<br>";
- }
- text += tr( "Native products to be used" ) + ":<ul>";
- QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
+ text += tr( "Current Linux platform" )+ ": <b>" + (!curPlatform.isEmpty() ? curPlatform : QString( "Unknown" )) + "</b><br>";
+ if ( !refPlatform.isEmpty() )
+ text += tr( "Reference Linux platform" ) + ": <b>" + refPlatform + "</b><br>";
+ text += "<br>";
+
+ text += tr( "Target directory:" ) + " <b>" + QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) + "</b><br>";
+ text += tr( "Temporary directory:" ) + " <b>" + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + "</b><br>";
+ text += "<br>";
+
+ text += tr( "SALOME modules to be installed" ) + ":<ul>";
+ QCheckListItem* item = (QCheckListItem*)( modulesView->firstChild() );
while( item ) {
if ( productsMap.contains( item ) ) {
- if ( item->childCount() > 0 ) {
- if ( productsView->isNative( item ) ) {
- text += "<li><b>" + item->text() + "</b><br>";
- nbProd++;
- }
+ if ( item->isOn() ) {
+ text += "<li><b>" + item->text() + "</b><br>";
+ nbProd++;
}
}
item = (QCheckListItem*)( item->nextSibling() );
}
text += "</ul>";
nbProd = 0;
- text += tr( "Products to be installed" ) + ":<ul>";
- item = (QCheckListItem*)( productsView->firstChild() );
+ text += tr( "Prerequisites to be installed" ) + ":<ul>";
+ item = (QCheckListItem*)( prereqsView->firstChild() );
while( item ) {
if ( productsMap.contains( item ) ) {
- if ( productsMap[ item ].hasContext( "salome sources" ) ||
- productsMap[ item ].hasContext( "salome binaries" ) ) {
+ if ( productsMap[ item ].hasType( "salome sources" ) ||
+ productsMap[ item ].hasType( "salome binaries" ) ) {
item = (QCheckListItem*)( item->nextSibling() );
continue; // skip SALOME sources and binaries
}
- if ( item->childCount() > 0 ) {
- if ( productsView->isBinaries( item ) ) {
- text += "<li><b>" + item->text() + " " + item->text(1) + "</b> " + tr( "as binaries" ) + "<br>";
- nbProd++;
- }
- else if ( productsView->isSources( item ) ) {
- text+= "<li><b>" + item->text() + " " + item->text(1) + "</b> " + tr( "as sources" ) + "<br>";
- nbProd++;
- }
- }
- else if ( item->isOn() ) {
- text+= "<li><b>" + item->text() + "</b><br>";
- nbProd++;
+ if ( item->isOn() ) {
+ text += "<li><b>" + item->text() + " " + productsMap[ item ].getVersion() + "</b><br>";
+ nbProd++;
}
}
item = (QCheckListItem*)( item->nextSibling() );
text += "<li><b>" + tr( "none" ) + "</b><br>";
}
text += "</ul>";
- // SALOME binaries, sources, samples
- QString textBin = "";
- QString textSrc = "";
- QString textBoth = "";
- item = (QCheckListItem*)( productsView->firstChild() );
- while( item ) {
- if ( productsMap.contains( item ) ) {
- if ( !productsMap[ item ].hasContext( "salome sources" ) &&
- productsMap[ item ].hasContext( "salome binaries" ) ) {
- if ( ( item->childCount() > 0 && productsView->isBinaries( item ) || item->isOn() ) && item->isEnabled() ) {
- textBin += "<li><b>" + item->text().replace( QRegExp( "(-)?bin", false ), "" ) + "</b><br>";
- }
- }
- if ( productsMap[ item ].hasContext( "salome sources" ) &&
- !productsMap[ item ].hasContext( "salome binaries" ) ) {
- if ( item->childCount() > 0 && productsView->isSources( item ) || item->isOn() ) {
- textSrc += "<li><b>" + item->text().replace( QRegExp( "(-)?src", false ), "" ) + "</b><br>";
- }
- }
- if ( productsMap[ item ].hasContext( "salome sources" ) &&
- productsMap[ item ].hasContext( "salome binaries" ) ) {
- if ( item->childCount() > 0 && productsView->isSources( item ) || item->isOn() ) {
- textBoth += "<li><b>" + item->text() + "</b><br>";
- }
- }
- }
- item = (QCheckListItem*)( item->nextSibling() );
- }
- if ( !textBin.isEmpty() )
- text += tr( "SALOME binaries to be installed" ) + ":<ul>" + textBin + "</ul>";
- if ( !textSrc.isEmpty() )
- text += tr( "SALOME sources to be installed" ) + ( buildSrcBtn->isChecked() ? tr( " and built" ) : QString( "" ) ) + ":<ul>" + textSrc + "</ul>";
- if ( !textBoth.isEmpty() )
- text += tr( "Other SALOME modules to be installed" ) + ":<ul>" + textBoth + "</ul>";
- text += tr( "Total disk space required:" ) + " <b>" + QString::number( totSize ) + " Kb</b><br>" ;
- text += tr( "Space for temporary files required:" ) + " <b>" + QString::number( tempSize ) + " Kb</b><br>" ;
- text += "<br>";
- text += tr( "Target directory:" ) + " <b>" + QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) + "</b><br>";
- // VSR: Temporary folder is used always now and it is not necessary to disable it -->
- // if ( tempSize > 0 )
- // VSR: <----------------------------------------------------------------------------
- text += tr( "Temporary directory:" ) + " <b>" + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + "</b><br>";
- text += "<br>";
+ text += tr( "Total disk space required:" ) + " <b>" + QString::number( totSize ) + " KB</b><br>" ;
+ text += tr( "Space for temporary files required:" ) + " <b>" + QString::number( tempSize ) + " KB</b><br>" ;
choices->setText( text );
}
// ================================================================
{
QString tmpstr;
QWidget* aPage = InstallWizard::page( pageTitle );
- if ( aPage == productsPage ) {
- // ########## check if any products are selected to be installed
- long totSize, tempSize;
- bool anySelected = checkSize( &totSize, &tempSize );
- if ( !anySelected ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "Select one or more products to install" ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- return false;
+ if ( aPage == typePage ) {
+ // installation type page
+ if ( installType == Binaries ) { // 'Binary' installation type
+ // check binaries directory
+ QFileInfo fib( QDir::cleanDirPath( getBinPath() ) );
+ if ( !fib.exists() ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't exist.\n"
+ "This directory must contain sources archives.\n").arg( fib.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
+ }
+ // check sources directory
+ QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) );
+ if ( !fis.exists() )
+ if ( QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't exist.\n"
+ "This directory must contain sources archives.\n"
+ "Continue?" ).arg( fis.absFilePath() ),
+ tr( "&Yes" ),
+ tr( "&No" ),
+ QString::null, 1, 1 ) == 1 )
+ return false;
+ }
+ else { // 'Source' or 'Compile' installation type
+ // check sources directory
+ QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) );
+ if ( !fis.exists() ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't exist.\n"
+ "This directory must contain sources archives.\n" ).arg( fis.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
+ }
}
+ }
+
+ else if ( aPage == dirPage ) {
+ // installation platform page
// ########## check target and temp directories (existence and available disk space)
// get dirs
QString targetDir = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() );
QString tempDir = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() );
- // directories should differ
-// if (!targetDir.isEmpty() && tempDir == targetDir) {
-// QMessageBox::warning( this,
-// tr( "Warning" ),
-// tr( "Target and temporary directories must be different"),
-// QMessageBox::Ok,
-// QMessageBox::NoButton,
-// QMessageBox::NoButton );
-// return false;
-// }
// check target directory
if ( targetDir.isEmpty() ) {
QMessageBox::warning( this,
QMessageBox::NoButton ) == QMessageBox::No ) {
return false;
}
- // check sources/binaries archives directories existance
- int nbSources = 0, nbBinaries = 0;
- QCheckListItem* nitem = (QCheckListItem*)( productsView->firstChild() );
- while( nitem ) {
- if ( productsMap.contains( nitem ) ) {
- if ( nitem->childCount() > 0 ) {
- if ( productsView->isBinaries( nitem ) )
- nbBinaries++;
- else if ( productsView->isSources( nitem ) )
- nbSources++;
- }
- else if ( nitem->isOn() ) {
- nbBinaries++;
- nbSources++;
- }
- }
- nitem = (QCheckListItem*)( nitem->nextSibling() );
+ // check temp directory
+ if ( tempDir.isEmpty() ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "Please, enter valid temporary directory path" ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
}
-
- if ( nbBinaries > 0 ) {
- QString binDir = "./Products/BINARIES";
- if ( !myOS.isEmpty() )
- binDir += "/" + myOS;
- QFileInfo fib( QDir::cleanDirPath( binDir ) );
- if ( !fib.exists() ) {
- if ( QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "The directory %1 doesn't exist.\n"
- "This directory must contain binaries archives.\n"
- "Continue?" ).arg( fib.absFilePath() ),
- QMessageBox::Yes,
- QMessageBox::No,
- QMessageBox::NoButton ) == QMessageBox::No )
- return false;
- }
+ QFileInfo fit( QDir::cleanDirPath( tempDir ) );
+ if ( !makeDir( fit.absFilePath() + TEMPDIRNAME, tmpCreated ) ) {
+ QMessageBox::critical( this,
+ tr( "Error" ),
+ tr( "Can't use temporary directory.\nCheck permissions for the %1 directory.").arg( fit.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
}
- if ( nbSources > 0 ) {
- QString srcDir = "./Products/SOURCES";
- QFileInfo fis( QDir::cleanDirPath( srcDir ) );
- if ( !fis.exists() ) {
- if ( QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "The directory %1 doesn't exist.\n"
- "This directory must contain sources archives.\n"
- "Continue?" ).arg( fis.absFilePath() ),
- QMessageBox::Yes,
- QMessageBox::No,
- QMessageBox::NoButton ) == QMessageBox::No )
- return false;
- }
+ }
+
+ else if ( aPage == productsPage ) {
+ // products page
+ // ########## check if any products are selected to be installed
+ long totSize, tempSize;
+ bool anySelected = checkSize( &totSize, &tempSize );
+ if ( !anySelected ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "Select one or more products to install" ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
}
// run script that checks available disk space for installing of products // returns 1 in case of error
+ QFileInfo fi( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) );
QString script = "./config_files/checkSize.sh '";
script += fi.absFilePath();
script += "' ";
QMessageBox::NoButton );
return false;
}
- // check temp directory
- if ( tempDir.isEmpty() ) {
- if ( moreMode ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "Please, enter valid temporary directory path" ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- return false;
- }
- else {
- tempDir = "/tmp";
- tempFolder->setText( tempDir );
- }
- }
- QFileInfo fit( QDir::cleanDirPath( tempDir ) );
- if ( !makeDir( fit.absFilePath() + TEMPDIRNAME, tmpCreated ) ) {
- QMessageBox::critical( this,
- tr( "Error" ),
- tr( "Can't use temporary directory.\nCheck permissions for the %1 directory.").arg( fit.absFilePath() ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- return false;
- }
// run script that check available disk space for temporary files
// returns 1 in case of error
+ QFileInfo fit( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) );
QString tscript = "./config_files/checkSize.sh '";
tscript += fit.absFilePath();
tscript += "' ";
QMessageBox::NoButton );
return false;
}
-// VSR: <------------------------------------------------------------------------------
- // ########## check native products
- QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
- QStringList natives;
- while( item ) {
- if ( productsMap.contains( item ) ) {
- if ( item->childCount() > 0 ) {
- // VSR : 29/01/05 : Check installation script even if product is not being installed
- // if ( !productsView->isNone( item ) ) {
- if ( item->text(2).isEmpty() || item->text(2).isNull() ) {
+ // ########## check installation scripts
+ QCheckListItem* item;
+ ProductsView* prodsView = modulesView;
+ for ( int i = 0; i < 2; i++ ) {
+ item = (QCheckListItem*)( prodsView->firstChild() );
+ while( item ) {
+ if ( productsMap.contains( item ) && item->isOn() ) {
+ // check installation script definition
+ if ( item->text(2).isEmpty() || item->text(2).isNull() ) {
+ QMessageBox::warning( this,
+ tr( "Error" ),
+ tr( "The installation script for %1 is not defined.").arg(item->text(0)),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ if ( !moreMode ) onMoreBtn();
+ QListView* listView = item->listView();
+ listView->setCurrentItem( item );
+ listView->setSelected( item, true );
+ listView->ensureItemVisible( item );
+ return false;
+ }
+ // check installation script existence
+ else {
+ QFileInfo fi( QString("./config_files/") + item->text(2) );
+ if ( !fi.exists() || !fi.isExecutable() ) {
QMessageBox::warning( this,
tr( "Error" ),
- tr( "The installation script for %1 is not defined.").arg(item->text(0)),
+ tr( "The script %1 required for %2 doesn't exist or doesn't have execute permissions.").arg("./config_files/" + item->text(2)).arg(item->text(0)),
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton );
- if ( !moreMode )
- onMoreBtn();
- productsView->setCurrentItem( item );
- productsView->setSelected( item, true );
- productsView->ensureItemVisible( item );
- //productsView->setNone( item );
+ if ( !moreMode ) onMoreBtn();
+ QListView* listView = item->listView();
+ listView->setCurrentItem( item );
+ listView->setSelected( item, true );
+ listView->ensureItemVisible( item );
return false;
- } else {
- QFileInfo fi( QString("./config_files/") + item->text(2) );
- if ( !fi.exists() || !fi.isExecutable() ) {
- QMessageBox::warning( this,
- tr( "Error" ),
- tr( "The script %1 required for %2 doesn't exist or doesn't have execute permissions.").arg("./config_files/" + item->text(2)).arg(item->text(0)),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- if ( !moreMode )
- onMoreBtn();
- productsView->setCurrentItem( item );
- productsView->setSelected( item, true );
- productsView->ensureItemVisible( item );
- //productsView->setNone( item );
- return false;
- }
}
- // }
- // collect native products
- if ( productsView->isNative( item ) ) {
- if ( natives.find( item->text(0) ) == natives.end() )
- natives.append( item->text(0) );
}
- else if ( productsView->isBinaries( item ) || productsView->isSources( item ) ) {
- QStringList dependOn = productsMap[ item ].getDependancies();
- for ( int i = 0; i < (int)dependOn.count(); i++ ) {
- QCheckListItem* depitem = findItem( dependOn[ i ] );
- if ( depitem ) {
- if ( productsView->isNative( depitem ) && natives.find( depitem->text(0) ) == natives.end() )
- natives.append( depitem->text(0) );
- }
- else {
- QMessageBox::warning( this,
- tr( "Error" ),
- tr( "%1 is required for %2 %3 installation.\n"
- "This product is missing in the configuration file %4.").arg(dependOn[ i ]).arg(item->text(0)).arg(item->text(1)).arg(xmlFileName),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- return false;
- }
+ // check installation scripts dependencies
+ QStringList dependOn = productsMap[ item ].getDependancies();
+ QString version = productsMap[ item ].getVersion();
+ for ( int i = 0; i < (int)dependOn.count(); i++ ) {
+ QCheckListItem* depitem = findItem( dependOn[ i ] );
+ if ( !depitem ) {
+ QMessageBox::warning( this,
+ tr( "Error" ),
+ tr( "%1 is required for %2 %3 installation.\n"
+ "This product is missing in the configuration file %4.").arg(dependOn[ i ]).arg(item->text(0)).arg(version).arg(xmlFileName),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
}
}
}
+ item = (QCheckListItem*)( item->nextSibling() );
}
- item = (QCheckListItem*)( item->nextSibling() );
- }
- QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
- QString tgtFolder = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() );
- myThread->clearCommands();
- if ( natives.count() > 0 ) {
- for ( unsigned i = 0; i < natives.count(); i++ ) {
- item = findItem( natives[ i ] );
- if ( item ) {
- QString dependOn = productsMap[ item ].getDependancies().join(" ");
- QString script = "cd ./config_files/;" + item->text(2) + " try_native " +
- QFileInfo( tmpFolder ).absFilePath() + " " + QDir::currentDirPath() + "/Products " + QFileInfo( tgtFolder ).absFilePath() + " " +
- QUOTE(dependOn) + " " + item->text(0);
-
- myThread->addCommand( item, script );
- }
- else {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "%The product %1 %2 required for installation.\n"
- "This product is missing in the configuration file %4.").arg(item->text(0)).arg(item->text(1)).arg(xmlFileName),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- return false;
- }
- }
- WarnDialog::showWarnDlg( this, true );
- myThread->start();
- return true; // return in order to avoid default postValidateEvent() action
+ prodsView = prereqsView;
}
+// return true; // return in order to avoid default postValidateEvent() action
}
return InstallWizard::acceptData( pageTitle );
}
bool SALOME_InstallWizard::checkSize( long* totSize, long* tempSize )
{
long tots = 0, temps = 0;
+ long maxSrcTmp = 0;
int nbSelected = 0;
MapProducts::Iterator mapIter;
for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
QCheckListItem* item = mapIter.key();
Dependancies dep = mapIter.data();
- if ( productsView->isBinaries( item ) ) {
- tots += dep.getSize();
- }
- else if ( productsView->isSources( item ) ) {
- tots += dep.getSize( !buildSrcBtn->isChecked() );
- temps = max( temps, dep.getTempSize() );
- }
- if ( !productsView->isNone( item ) )
- nbSelected++;
+ if ( !item->isOn() )
+ continue;
+ if ( installType == Compile && removeSrcBtn->state() == QButton::On )
+ tots += dep.getSize( Binaries );
+ else
+ tots += dep.getSize( installType );
+ maxSrcTmp = max( maxSrcTmp, dep.getSize( Compile ) - dep.getSize( Binaries ) );
+ temps += dep.getTempSize( installType );
+ nbSelected++;
}
if ( totSize )
+ if ( installType == Compile && removeSrcBtn->state() == QButton::On )
+ tots += maxSrcTmp;
*totSize = tots;
if ( tempSize )
*tempSize = temps;
return ( nbSelected > 0 );
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::updateAvailableSpace
+ * Slot to update 'Available disk space' field
+ */
+// ================================================================
+void SALOME_InstallWizard::updateAvailableSpace()
+{
+ if ( diskSpaceProc->normalExit() )
+ availableSize->setText( diskSpaceProc->readLineStdout() + " KB");
+}
+// ================================================================
/*!
* SALOME_InstallWizard::checkProductPage
* Checks products page validity (directories and products selection) and
// ================================================================
void SALOME_InstallWizard::checkProductPage()
{
- // update <SALOME sources>, <SALOME binaries> check boxes state
-
- selectSrcBtn->blockSignals( true );
- selectBinBtn->blockSignals( true );
-
- int totSrc = 0, selSrc = 0;
- MapProducts::Iterator itProd;
- for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
- bool srcctx = itProd.data().hasContext( "salome sources" );
- bool binctx = itProd.data().hasContext( "salome binaries" );
- if ( srcctx && !binctx ) {
- totSrc++;
- if ( productsView->isSources( itProd.key() ) )
- selSrc++;
- }
- }
- selectSrcBtn->setState( selSrc == 0 ? QButton::Off : ( selSrc == totSrc ? QButton::On : QButton::NoChange ) );
-
- buildSrcBtn->setEnabled( selSrc > 0 );
- selectBinBtn->setEnabled( !buildSrcBtn->isEnabled() || !buildSrcBtn->isChecked() );
- for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
- if ( itProd.data().hasContext( "salome sources" ) && !itProd.data().hasContext( "salome binaries" ) ) {
- productsView->setItemEnabled( productsView->findBinItem( itProd.data().getName() ) ,
- !productsView->isSources( itProd.key() ) || !buildSrcBtn->isChecked() );
- }
- }
-
- int totBin = 0, selBin = 0;
- for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
- bool srcctx = itProd.data().hasContext( "salome sources" );
- bool binctx = itProd.data().hasContext( "salome binaries" );
- if ( binctx && !srcctx ) {
- totBin++;
- if ( productsView->isBinaries( itProd.key() ) )
- selBin++;
- }
- }
- selectBinBtn->setState( selBin == 0 ? QButton::Off : ( selBin == totBin ? QButton::On : QButton::NoChange ) );
-
- selectSrcBtn->blockSignals( false );
- selectBinBtn->blockSignals( false );
-
+ if ( this->currentPage() != productsPage )
+ return;
long tots = 0, temps = 0;
-
// check if any product is selected;
bool isAnyProductSelected = checkSize( &tots, &temps );
- // check if target directory is valid
- bool isTargetDirValid = !targetFolder->text().stripWhiteSpace().isEmpty();
- // check if temp directory is valid
- bool isTempDirValid = !moreMode || !tempFolder->text().stripWhiteSpace().isEmpty();
// update required size information
- requiredSize->setText( QString::number( tots ) + " Kb");
- requiredTemp->setText( QString::number( temps ) + " Kb");
+ requiredSize->setText( QString::number( tots ) + " KB");
+ requiredTemp->setText( QString::number( temps ) + " KB");
+
+ // update available size information
+ QFileInfo fi( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) );
+ if ( fi.exists() ) {
+ diskSpaceProc->clearArguments();
+ QString script = "./config_files/diskSpace.sh";
+ diskSpaceProc->addArgument( script );
+ diskSpaceProc->addArgument( fi.absFilePath() );
+ // run script
+ diskSpaceProc->start();
+ }
// enable/disable "Next" button
- setNextEnabled( productsPage, isAnyProductSelected && isTargetDirValid && isTempDirValid );
+ setNextEnabled( productsPage, isAnyProductSelected );
}
// ================================================================
/*!
{
if ( !productsMap.contains( item ) )
return;
- if ( productsView->isNone( item ) )
+ if ( !item->isOn() )
return;
// get all prerequisites
QStringList dependOn = productsMap[ item ].getDependancies();
+ // install MED without GUI case
+ if ( installGuiBtn->state() != QButton::On && item->text(0) == "MED" ) {
+ dependOn.remove( "GUI" );
+ }
+ // setting prerequisites
for ( int i = 0; i < (int)dependOn.count(); i++ ) {
MapProducts::Iterator itProd;
for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
if ( itProd.data().getName() == dependOn[ i ] ) {
- if ( productsView->isNone( itProd.key() ) ) {
- QString defMode = itProd.data().getDefault();
- if ( defMode.isEmpty() )
- defMode = tr( "install binaries" );
- if ( defMode == tr( "install binaries" ) )
- productsView->setBinaries( itProd.key() );
- else if ( defMode == tr( "install sources" ) )
- productsView->setSources( itProd.key() );
- else if ( defMode == tr( "use native" ) )
- productsView->setNative( itProd.key() );
- setPrerequisites( itProd.key() );
+ if ( itProd.data().getType() == "component" && !itProd.key()->isOn() )
+ itProd.key()->setOn( true );
+ else if ( itProd.data().getType() == "prerequisite" ) {
+ itProd.key()->setOn( true );
+ itProd.key()->setEnabled( false );
+ }
+ }
+ }
+ }
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::unsetPrerequisites
+ * Unsets all modules which depend of the unchecked product ( recursively )
+ */
+// ================================================================
+void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item )
+{
+ if ( !productsMap.contains( item ) )
+ return;
+ if ( item->isOn() )
+ return;
+
+// uncheck dependent products
+ QString itemName = productsMap[ item ].getName();
+ MapProducts::Iterator itProd;
+ for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
+ if ( itProd.data().getType() == productsMap[ item ].getType() ) {
+ QStringList dependOn = itProd.data().getDependancies();
+ // install MED without GUI case
+ if ( installGuiBtn->state() != QButton::On && itemName == "GUI" ) {
+ dependOn.remove( "MED" );
+ }
+ for ( int i = 0; i < (int)dependOn.count(); i++ ) {
+ if ( dependOn[ i ] == itemName ) {
+ if ( itProd.key()->isOn() ) {
+ itProd.key()->setOn( false );
+ }
+ }
+ }
+ }
+ }
+
+// uncheck prerequisites
+ int nbDependents;
+// cout << "item name = " << productsMap[ item ].getName() << endl;
+ QStringList dependOnList = productsMap[ item ].getDependancies();
+ for ( int j = 0; j < (int)dependOnList.count(); j++ ) {
+ nbDependents = 0;
+ MapProducts::Iterator itProd1;
+ for ( itProd1 = productsMap.begin(); itProd1 != productsMap.end(); ++itProd1 ) {
+ if ( itProd1.data().getName() == dependOnList[ j ] ) {
+ if ( itProd1.data().getType() == "prerequisite" ) {
+ MapProducts::Iterator itProd2;
+ for ( itProd2 = productsMap.begin(); itProd2 != productsMap.end(); ++itProd2 ) {
+ // if ( itProd2.data().getType() == "component" ) {
+ if ( itProd2.key()->isOn() ) {
+ QStringList prereqsList = productsMap[ itProd2.key() ].getDependancies();
+ for ( int k = 0; k < (int)prereqsList.count(); k++ ) {
+ if ( prereqsList[ k ] == itProd1.data().getName() ) {
+ nbDependents++;
+ }
+ }
+ }
+ }
+ if ( nbDependents == 0 ) {
+ itProd1.key()->setEnabled( true );
+ itProd1.key()->setOn( false );
+ }
}
}
}
// if found - set status to "completed"
progressView->setStatus( prodProc, Completed );
+ // ... clear status label
+ statusLab->clear();
// ... and call this method again
launchScript();
return;
// if found - set status to "processed" and run script
progressView->setStatus( prodProc, Processing );
progressView->ensureVisible( prodProc );
-
- QCheckListItem* item = findItem( prodProc );
+
+ QCheckListItem* item;
+ if ( prodProc != "gcc" )
+ item = findItem( prodProc );
// fill in script parameters
shellProcess->clearArguments();
// ... script name
shellProcess->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) );
- shellProcess->addArgument( item->text(2) );
+ if ( prodProc != "gcc" )
+ shellProcess->addArgument( item->text(2) );
+ else
+ shellProcess->addArgument( "gcc-common.sh" );
// ... temp folder
QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
//if( !tempFolder->isEnabled() )
- //tmpFolder = "/tmp";
+ // tmpFolder = "/tmp";
+ // ... not install : try to find preinstalled
+ if ( !progressView->isVisible( prodProc ) ) {
+ shellProcess->addArgument( "try_preinstalled" );
+ shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
+ shellProcess->addArgument( QDir::currentDirPath() + "/Products" );
+ statusLab->setText( tr( "Collecting environment for '" ) + prodProc + "'..." );
+ }
// ... binaries ?
- if ( productsView->isBinaries( item ) ) {
+ else if ( installType == Binaries ) {
shellProcess->addArgument( "install_binary" );
shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
- QString binDir = QDir::currentDirPath() + "/Products/BINARIES";
- if ( !myOS.isEmpty() )
- binDir += "/" + myOS;
+ QString binDir = QDir::cleanDirPath( getBinPath() );
+ QString OS = getPlatform();
+ if ( !OS.isEmpty() )
+ binDir += "/" + OS;
shellProcess->addArgument( binDir );
+ statusLab->setText( tr( "Installing '" ) + prodProc + "'..." );
}
- // ... sources ?
- else if ( productsView->isSources( item ) ) {
- shellProcess->addArgument( productsMap[ item ].hasContext( "salome sources" ) &&
- //!productsMap[ item ].hasContext( "salome binaries" ) &&
- buildSrcBtn->isChecked() ?
- "install_source_and_build" :
- "install_source" );
- shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
- shellProcess->addArgument( QDir::currentDirPath() + "/Products/SOURCES" );
- }
- // ... native ?
- else if ( productsView->isNative( item ) ) {
- shellProcess->addArgument( "try_native" );
- shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
- shellProcess->addArgument( QDir::currentDirPath() + "/Products" );
- }
- // ... not install : try to find preinstalled
+ // ... sources or sources_and_compilation ?
else {
- shellProcess->addArgument( "try_preinstalled" );
+ shellProcess->addArgument( installType == Sources ? "install_source" :
+ "install_source_and_build" );
shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
- shellProcess->addArgument( QDir::currentDirPath() + "/Products" );
+ shellProcess->addArgument( QDir::cleanDirPath( getSrcPath() ) );
+ statusLab->setText( tr( "Installing '" ) + prodProc + "'..." );
}
// ... target folder
QString tgtFolder = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() );
shellProcess->addArgument( QFileInfo( tgtFolder ).absFilePath() );
-
-
+ // ... list of all products
QString depproducts = DefineDependeces(productsMap);
+ depproducts.prepend( "gcc " );
___MESSAGE___( "Dependancies"<< depproducts.latin1() );
-
shellProcess->addArgument( depproducts );
- // ... product name - currently instaled product
- shellProcess->addArgument( item->text(0) );
-
+ // ... product name - currently installed product
+ if ( prodProc != "gcc" )
+ shellProcess->addArgument( item->text(0) );
+ else
+ shellProcess->addArgument( "gcc" );
+ // ... list of products being installed
+ shellProcess->addArgument( prodSequence.join( " " ) );
+ // ... sources directory
+ shellProcess->addArgument( QDir::cleanDirPath( getSrcPath() ) );
+ // ... remove sources and tmp files or not?
+ if ( installType == Compile && removeSrcBtn->state() == QButton::On )
+ shellProcess->addArgument( "TRUE" );
+ else
+ shellProcess->addArgument( "FALSE" );
+ // ... install MED with GUI or not?
+ if ( installGuiBtn->state() != QButton::On && prodProc == "MED" &&
+ (installType == Binaries || installType == Compile) )
+ shellProcess->addArgument( "FALSE" );
// run script
if ( !shellProcess->start() ) {
// error handling can be here
}
___MESSAGE___( "All products have been installed successfully" );
// all products are installed successfully
- QString workDir = QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() );
MapProducts::Iterator mapIter;
___MESSAGE___( "starting pick-up environment" );
+ QString depproducts = QUOTE( DefineDependeces(productsMap).prepend( "gcc " ) );
for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
QCheckListItem* item = mapIter.key();
Dependancies dep = mapIter.data();
- QString depproducts = QUOTE( DefineDependeces(productsMap) );
- if ( !productsView->isNone( item ) && dep.pickUpEnvironment() ) {
+ if ( item->isOn() && dep.pickUpEnvironment() ) {
+ statusLab->setText( tr( "Pick-up products environment for " ) + dep.getName().latin1() + "..." );
___MESSAGE___( "... for " << dep.getName().latin1() );
QString script;
script += "cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; ";
script += QUOTE( QFileInfo( QDir::cleanDirPath( QDir::currentDirPath() + "/Products" ) ).absFilePath() ) + " ";
script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " ";
script += depproducts + " ";
- script += item->text(0);
+ script += item->text(0) + " ";
+ script += QUOTE( prodSequence.join( " " ) );
___MESSAGE___( "... --> " << script.latin1() );
if ( system( script.latin1() ) ) {
___MESSAGE___( "ERROR" );
}
}
}
+ // update status label
+ statusLab->setText( tr( "Installation completed" ) );
// <Next> button
setNextEnabled( true );
nextButton()->setText( tr( "&Next >" ) );
showNormal();
raise();
if ( hasErrors ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "There were some errors and/or warnings during the installation.\n"
- "Please check the installation log." ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
+ if ( QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "There were some errors and/or warnings during the installation.\n"
+ "Do you want to save the installation log?" ),
+ tr( "&Save" ),
+ tr( "&Cancel" ),
+ QString::null,
+ 0,
+ 1 ) == 0 )
+ saveLog();
}
hasErrors = false;
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::onInstallGuiBtn
+ * <Installation with GUI> check-box slot
+ */
+// ================================================================
+void SALOME_InstallWizard::onInstallGuiBtn()
+{
+ MapProducts::Iterator itProd;
+ for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
+ if ( itProd.data().getType() == "component" ) {
+ if ( installGuiBtn->state() == QButton::On ) {
+ itProd.key()->setEnabled( true );
+ itProd.key()->setOn( true );
+ }
+ else {
+ QString itemName = itProd.data().getName();
+ if ( itemName != "KERNEL" && itemName != "MED" && itemName != "SAMPLES" ) {
+ itProd.key()->setOn( false );
+ itProd.key()->setEnabled( false );
+ }
+ else
+ itProd.key()->setOn( true );
+ }
+ }
+ }
+}
+// ================================================================
/*!
* SALOME_InstallWizard::onMoreBtn
* <More...> button slot
void SALOME_InstallWizard::onMoreBtn()
{
if ( moreMode ) {
- moreBox->hide();
- lessBox->show();
- moreBtn->setText( tr( "More..." ) );
- setAboutInfo( moreBtn, tr( "Switch to the advanced mode" ) );
+ prereqsView->hide();
+ moreBtn->setText( tr( "Show prerequisites..." ) );
+ setAboutInfo( moreBtn, tr( "Show list of prerequisites" ) );
}
else {
- moreBox->show();
- lessBox->hide();
- moreBtn->setText( tr( "Less..." ) );
- setAboutInfo( moreBtn, tr( "Switch to the basic mode" ) );
+ prereqsView->show();
+ moreBtn->setText( tr( "Hide prerequisites" ) );
+ setAboutInfo( moreBtn, tr( "Hide list of prerequisites" ) );
}
qApp->processEvents();
moreMode = !moreMode;
InstallWizard::layOut();
qApp->processEvents();
if ( !isMaximized() ) {
- //setGeometry( geometry().x(), geometry().y(), geometry().width(), 0 );
- resize( geometry().width(), 0 );
qApp->processEvents();
}
checkProductPage();
myThread->clearCommands();
myWC.wakeAll();
while ( myThread->running() );
- // VSR: first remove temporary files
+ // first remove temporary files
QString script = "cd ./config_files/; remove_tmp.sh '";
script += tempFolder->text().stripWhiteSpace() + TEMPDIRNAME;
script += "' ";
___MESSAGE___( "script = " << script.latin1() );
if ( system( script.latin1() ) ) {
}
- // VSR: then try to remove created temporary directory
+ // then try to remove created temporary directory
//script = "rm -rf " + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
if ( rmDir && !tmpCreated.isNull() ) {
script = "rm -rf " + tmpCreated;
if ( !aPage )
return;
updateCaption();
- if ( aPage == productsPage ) {
+
+ if ( aPage == typePage ) {
+ // installation type page
+ if ( buttonGrp->id( buttonGrp->selected() ) == -1 )
+ binBtn->animateClick(); // set default installation type
+ }
+ if ( aPage == platformsPage ) {
+ // installation platforms page
+ MapXmlFiles::Iterator it;
+ if ( previousPage == typePage ) {
+ for ( it = platformsMap.begin(); it != platformsMap.end(); ++it ) {
+ QString plat = it.key();
+ QRadioButton* rb = ( (QRadioButton*) platBtnGrp->child( plat ) );
+ if ( installType == Binaries ) {
+ QFileInfo fib( QDir::cleanDirPath( getBinPath() + "/" + plat ) );
+ rb->setEnabled( fib.exists() );
+ }
+ else {
+ QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) );
+ rb->setEnabled( fis.exists() );
+ }
+ rb->setChecked( rb->isChecked() && rb->isEnabled() );
+ }
+ setNextEnabled( platformsPage, platBtnGrp->id( platBtnGrp->selected() ) != -1 );
+ }
+ }
+ else if ( aPage == dirPage ) {
+ // installation and temporary directories page
+ if ( ( indexOf( platformsPage ) != -1 ?
+ previousPage == platformsPage : previousPage == typePage )
+ && stateChanged ) {
+ // clear global variables before reading XML file
+ modulesView->clear();
+ prereqsView->clear();
+ productsMap.clear();
+ // read XML file
+ StructureParser* parser = new StructureParser( this );
+ parser->setProductsLists( modulesView, prereqsView );
+ if ( targetFolder->text().isEmpty() )
+ parser->setTargetDir( targetFolder );
+ if ( tempFolder->text().isEmpty() )
+ parser->setTempDir( tempFolder );
+ parser->readXmlFile( xmlFileName );
+ // take into account command line parameters
+ if ( !myTargetPath.isEmpty() )
+ targetFolder->setText( myTargetPath );
+ if ( !myTmpPath.isEmpty() )
+ tempFolder->setText( myTmpPath );
+ // set all modules to be checked and first module to be selected
+ installGuiBtn->setState( QButton::Off );
+ installGuiBtn->setState( QButton::On );
+ if ( modulesView->childCount() > 0 && !modulesView->selectedItem() )
+ modulesView->setSelected( modulesView->firstChild(), true );
+ stateChanged = false;
+ }
+ }
+ else if ( aPage == productsPage ) {
// products page
onSelectionChanged();
checkProductPage();
else if ( aPage == progressPage ) {
if ( previousPage == prestartPage ) {
// progress page
+ statusLab->clear();
progressView->clear();
installInfo->clear();
installInfo->setFinished( false );
___MESSAGE___( "previousPage = " << previousPage );
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::onButtonGroup
+ * Called when user selected either installation type or installation platform
+ */
+// ================================================================
+void SALOME_InstallWizard::onButtonGroup( int rbIndex )
+{
+ int prevType = installType;
+ QString prevPlat = getPlatform();
+ QWidget* aPage = InstallWizard::currentPage();
+ if ( aPage == typePage ) {
+ installType = InstallationType( rbIndex );
+ // management of the <Remove source and tmp files> check-box
+ removeSrcBtn->setEnabled( installType == Compile );
+ }
+ else if ( aPage == platformsPage ) {
+ refPlatform = platBtnGrp->find( rbIndex )->name();
+ xmlFileName = platformsMap[ refPlatform ];
+ cout << xmlFileName << endl;
+ setNextEnabled( platformsPage, true );
+ }
+ if ( prevType != installType ||
+ ( indexOf( platformsPage ) != -1 ? prevPlat != getPlatform() : false ) ) {
+ stateChanged = true;
+ }
+}
+// ================================================================
/*!
* SALOME_InstallWizard::helpClicked
* Shows help window
theFolder->setText( typedDir );
theFolder->end( false );
}
- checkProductPage();
}
// ================================================================
/*!
// ================================================================
void SALOME_InstallWizard::onStart()
{
+ cout << "" << endl;
if ( nextButton()->text() == tr( "&Stop" ) ) {
+ statusLab->setText( tr( "Aborting installation..." ) );
shellProcess->kill();
while( shellProcess->isRunning() );
+ statusLab->setText( tr( "Installation has been aborted by user" ) );
return;
}
hasErrors = false;
passedParams->clear();
passedParams->setEnabled( false );
QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f );
- // clear list of products to install ...
+ // update status label
+ statusLab->setText( tr( "Preparing for installation..." ) );
+ // clear lists of products
toInstall.clear();
+ notInstall.clear();
// ... and fill it for new process
- QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
+ toInstall.append( "gcc" );
+ QCheckListItem* item = (QCheckListItem*)( prereqsView->firstChild() );
+ while( item ) {
+ if ( productsMap.contains( item ) ) {
+ if ( item->isOn() )
+ toInstall.append( productsMap[item].getName() );
+ else
+ notInstall.append( productsMap[item].getName() );
+ }
+ item = (QCheckListItem*)( item->nextSibling() );
+ }
+ item = (QCheckListItem*)( modulesView->firstChild() );
while( item ) {
-// if ( productsView->isBinaries( item ) || productsView->isSources( item ) || productsView->isNative( item ) ) {
- if ( productsMap.contains( item ) )
- toInstall.append( productsMap[item].getName() );
-// }
+ if ( productsMap.contains( item ) ) {
+ if ( item->isOn() )
+ toInstall.append( productsMap[item].getName() );
+ else
+ notInstall.append( productsMap[item].getName() );
+ }
item = (QCheckListItem*)( item->nextSibling() );
}
// if something at all is selected
- if ( !toInstall.isEmpty() ) {
+ if ( (int)toInstall.count() > 1 ) {
clean(false); // VSR 07/02/05 - bug fix: first we should clear temporary directory
// disable <Next> button
//setNextEnabled( false );
// enable script parameters line edit
// VSR commented: 18/09/03: passedParams->setEnabled( true );
// VSR commented: 18/09/03: passedParams->setFocus();
- // set status for all products
+ ProgressViewItem* progressItem;
+ // set status for installed products
for ( int i = 0; i < (int)toInstall.count(); i++ ) {
- item = findItem( toInstall[ i ] );
- QString type = "";
- if ( productsView->isBinaries( item ) )
- type = tr( "binaries" );
- else if ( productsView->isSources( item ) )
- type = tr( "sources" );
- else if ( productsView->isNative( item ) )
- type = tr( "native" );
- else
- type = tr( "not install" );
- progressView->addProduct( item->text(0), type, item->text(2) );
+ if ( toInstall[i] != "gcc" ) {
+ item = findItem( toInstall[i] );
+ progressView->addProduct( item->text(0), item->text(2) );
+ continue;
+ }
+ progressItem = progressView->addProduct( "gcc", "gcc-common.sh" );
+ progressItem->setVisible( false );
+ }
+ // set status for not installed products
+ for ( int i = 0; i < (int)notInstall.count(); i++ ) {
+ item = findItem( notInstall[i] );
+ progressItem = progressView->addProduct( item->text(0), item->text(2) );
+ progressItem->setVisible( false );
+ }
+ // get specified list of products being installed
+ prodSequence.clear();
+ for (int i = 0; i<(int)toInstall.count(); i++ ) {
+ if ( toInstall[i] == "gcc" ) {
+ prodSequence.append( toInstall[i] );
+ continue;
+ }
+ if ( installType == Binaries ) {
+ prodSequence.append( toInstall[i] );
+ QString prodType;
+ MapProducts::Iterator mapIter;
+ for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
+ if ( mapIter.data().getName() == toInstall[i] && mapIter.data().getType() == "component" ) {
+ prodSequence.append( toInstall[i] + "_src" );
+ break;
+ }
+ }
+ }
+ else if ( installType == Sources )
+ prodSequence.append( toInstall[i] + "_src" );
+ else {
+ prodSequence.append( toInstall[i] );
+ prodSequence.append( toInstall[i] + "_src" );
+ }
+ }
+
+ // create a backup of 'env_build.csh', 'env_build.sh', 'env_products.csh', 'env_products.sh'
+ // ( backup of 'salome.csh' and 'salome.sh' is made if pick-up environment is called )
+ QString script = "./config_files/backupEnv.sh ";
+ script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() );
+ ___MESSAGE___( "script = " << script.latin1() );
+ if ( system( script ) ) {
+ if ( QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "Backup environment files have not been created.\n"
+ "Do you want to continue an installation process?" ),
+ tr( "&Yes" ),
+ tr( "&No" ),
+ QString::null, 0, 1 ) == 1 ) {
+ // installation aborted
+ abort();
+ statusLab->setText( tr( "Installation has been aborted by user" ) );
+ // enable <Next> button
+ setNextEnabled( true );
+ nextButton()->setText( tr( "&Start" ) );
+ setAboutInfo( nextButton(), tr( "Start installation process" ) );
+ // reconnect Next button - to use it as Start button
+ disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) );
+ disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+ connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+ // enable <Back> button
+ setBackEnabled( true );
+ return;
+ }
}
+
// launch install script
launchScript();
}
/*!
Callback function - as response for the script finishing
*/
-void SALOME_InstallWizard::productInstalled( )
+void SALOME_InstallWizard::productInstalled()
{
___MESSAGE___( "process exited" );
if ( shellProcess->normalExit() ) {
}
else {
___MESSAGE___( "...abnormal exit" );
+ statusLab->setText( tr( "Script is not completed and installation has been aborted" ) );
// installation aborted
abort();
// clear script passed parameters lineedit
// ================================================================
void SALOME_InstallWizard::onSelectionChanged()
{
- productsInfo->clear();
- QListViewItem* item = productsView->selectedItem();
+ const QObject* snd = sender();
+ productInfo->clear();
+ QListViewItem* item = modulesView->selectedItem();
+ if ( snd == prereqsView )
+ item = prereqsView->selectedItem();
if ( !item )
return;
- if ( item->parent() )
- item = item->parent();
- QCheckListItem* aItem = (QCheckListItem*)item;
- if ( !productsMap.contains( aItem ) )
+ QCheckListItem* anItem = (QCheckListItem*)item;
+ if ( !productsMap.contains( anItem ) )
return;
- Dependancies dep = productsMap[ aItem ];
- QString text = "<b>" + aItem->text(0) + "</b>" + "<br>";
- if ( !aItem->text(1).stripWhiteSpace().isEmpty() )
- text += tr( "Version" ) + ": " + aItem->text(1) + "<br>";
+ Dependancies dep = productsMap[ anItem ];
+ QString text = "<b>" + anItem->text(0) + "</b>" + "<br>";
+ if ( !dep.getVersion().isEmpty() )
+ text += tr( "Version" ) + ": " + dep.getVersion() + "<br>";
text += "<br>";
if ( !dep.getDescription().isEmpty() ) {
text += "<i>" + dep.getDescription() + "</i><br><br>";
}
- text += tr( "User choice" ) + ": ";
long totSize = 0, tempSize = 0;
- if ( productsView->isBinaries( aItem ) ) {
- text += "<b>" + tr( "install binaries" ) + "</b>" + "<br>";
- totSize = dep.getSize();
- }
- else if ( productsView->isSources( aItem ) ) {
- text += "<b>" + tr( "install sources" ) + "</b>" + "<br>";
- totSize = dep.getSize( !buildSrcBtn->isChecked() );
- tempSize = dep.getTempSize();
- }
- else if ( productsView->isNative( aItem ) ) {
- text += "<b>" + tr( "use native" ) + "</b>" + "<br>";
- }
- else {
- text += "<b>" + tr( "not install" ) + "</b>" + "<br>";
- }
-
- text += tr( "Disk space required" ) + ": " + QString::number( totSize ) + " Kb<br>";
- text += tr( "Disk space for tmp files required" ) + ": " + QString::number( tempSize ) + " Kb<br>";
+ if ( installType == Compile && removeSrcBtn->state() == QButton::On )
+ totSize = dep.getSize( Binaries );
+ else
+ totSize = dep.getSize( installType );
+ tempSize = dep.getTempSize( installType );
+ text += tr( "Disk space required" ) + ": " + QString::number( totSize ) + " KB<br>";
+ text += tr( "Disk space for tmp files required" ) + ": " + QString::number( tempSize ) + " KB<br>";
text += "<br>";
QString req = ( dep.getDependancies().count() > 0 ? dep.getDependancies().join(", ") : tr( "none" ) );
text += tr( "Prerequisites" ) + ": " + req;
- productsInfo->setText( text );
+ productInfo->setText( text );
}
// ================================================================
/*!
// ================================================================
void SALOME_InstallWizard::onItemToggled( QCheckListItem* item )
{
- if ( prerequisites->isChecked() ) {
- if ( item->parent() )
- item = (QCheckListItem*)( item->parent() );
- if ( productsMap.contains( item ) ) {
- productsView->blockSignals( true );
+ if ( productsMap.contains( item ) ) {
+ if ( item->isOn() )
setPrerequisites( item );
- productsView->blockSignals( false );
- }
- }
- onSelectionChanged();
- checkProductPage();
-}
-// ================================================================
-/*!
- * SALOME_InstallWizard::onProdBtn
- * This slot is called when user clicks one of <Select Sources>,
- * <Select Binaries>, <Unselect All> buttons ( products page )
- */
-// ================================================================
-void SALOME_InstallWizard::onProdBtn()
-{
- const QObject* snd = sender();
- productsView->blockSignals( true );
- selectSrcBtn->blockSignals( true );
- selectBinBtn->blockSignals( true );
- if ( snd == unselectBtn ) {
- QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
- while( item ) {
- productsView->setNone( item );
- item = (QCheckListItem*)( item->nextSibling() );
- }
- }
- else if ( snd == selectSrcBtn ) {
- QMyCheckBox* checkBox = ( QMyCheckBox* )snd;
- if ( checkBox->state() == QButton::NoChange )
- checkBox->setState( QButton::On );
- MapProducts::Iterator itProd;
- for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
- if ( itProd.data().hasContext( "salome sources" ) ) {
- if ( checkBox->state() == QButton::Off ) {
- int selBin = 0;
- MapProducts::Iterator itProd1;
- for ( itProd1 = productsMap.begin(); itProd1 != productsMap.end(); ++itProd1 ) {
- if ( itProd1.data().hasContext( "salome binaries" ) &&
- !itProd1.data().hasContext( "salome sources" ) &&
- productsView->isBinaries( itProd1.key() ) )
- selBin++;
- }
- if ( !itProd.data().hasContext( "salome binaries" ) || !selBin )
- productsView->setNone( itProd.key() );
- }
- else {
- productsView->setSources( itProd.key() );
- if ( prerequisites->isChecked() )
- setPrerequisites( itProd.key() );
- }
- }
- }
- }
- else if ( snd == selectBinBtn ) {
- QMyCheckBox* checkBox = ( QMyCheckBox* )snd;
- if ( checkBox->state() == QButton::NoChange )
- checkBox->setState( QButton::On );
- MapProducts::Iterator itProd;
- for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
- if ( itProd.data().hasContext( "salome binaries" ) ) {
- if ( checkBox->state() == QButton::Off ) {
- int selSrc = 0;
- MapProducts::Iterator itProd1;
- for ( itProd1 = productsMap.begin(); itProd1 != productsMap.end(); ++itProd1 ) {
- if ( itProd1.data().hasContext( "salome sources" ) &&
- !itProd1.data().hasContext( "salome binaries" ) &&
- productsView->isSources( itProd1.key() ) )
- selSrc++;
- }
- if ( !itProd.data().hasContext( "salome sources" ) || !selSrc )
- productsView->setNone( itProd.key() );
- }
- else {
- productsView->setBinaries( itProd.key() );
- if ( prerequisites->isChecked() )
- setPrerequisites( itProd.key() );
- }
- }
- }
+ else
+ unsetPrerequisites( item );
}
- selectSrcBtn->blockSignals( false );
- selectBinBtn->blockSignals( false );
- productsView->blockSignals( false );
onSelectionChanged();
checkProductPage();
}
// ================================================================
/*!
* SALOME_InstallWizard::addFinishButton
- * Add button for the <Finish> page
+ * Add button for the <Finish> page.
+ * Clear list of buttons if <toClear> flag is true.
*/
// ================================================================
void SALOME_InstallWizard::addFinishButton( const QString& label,
const QString& tooltip,
- const QString& script)
+ const QString& script,
+ bool toClear )
{
- if ( !label.isEmpty() )
- buttons.append( Button( label, tooltip, script ) );
+ ButtonList btns;
+ if ( toClear ) {
+ btns = buttons;
+ buttons.clear();
+ }
+ buttons.append( Button( label, tooltip, script ) );
+ // create finish buttons
+ QButton* b = new QPushButton( tr( buttons.last().label() ), readmePage );
+ if ( !buttons.last().tootip().isEmpty() )
+ setAboutInfo( b, tr( buttons.last().tootip() ) );
+ QHBoxLayout* hLayout = (QHBoxLayout*)readmePage->layout()->child("finishButtons");
+ if ( toClear ) {
+ // remove previous buttons
+ ButtonList::Iterator it;
+ for ( it = btns.begin(); it != btns.end(); ++it ) {
+ hLayout->removeChild( (*it).button() );
+ delete (*it).button();
+ }
+ }
+ // add buttons to finish page
+ hLayout->insertWidget( buttons.count()-1, b );
+ buttons.last().setButton( b );
+ connect( b, SIGNAL( clicked() ), this, SLOT( onFinishButton() ) );
}
// ================================================================
/*!
}
myMutex.lock();
myMutex.unlock();
- QCheckListItem* item = (QCheckListItem*)data;
if ( val > 0 ) {
- if ( val == 2 ) {
- WarnDialog::showWarnDlg( 0, false );
- // when try_native returns 2 it means that native product version is higher than that is prerequisited
- if ( QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "You have newer version of %1 installed on your computer than that is required (%2).\nContinue?").arg(item->text(0)).arg(item->text(1)),
- QMessageBox::Yes,
- QMessageBox::No,
- QMessageBox::NoButton ) == QMessageBox::No ) {
- myThread->clearCommands();
- myWC.wakeAll();
- setNextEnabled( true );
- setBackEnabled( true );
- return;
- }
- WarnDialog::showWarnDlg( this, true );
- }
- else {
- WarnDialog::showWarnDlg( 0, false );
- bool binMode = productsView->hasBinaries( item );
- bool srcMode = productsView->hasSources( item );
- QStringList buttons;
- buttons.append( binMode ? tr( "Install binaries" ) : ( srcMode ? tr( "Install sources" ) :
- tr( "Select manually" ) ) );
- buttons.append( binMode ? ( srcMode ? tr( "Install sources" ) : tr( "Select manually" ) ) :
- ( srcMode ? tr( "Select manually" ) : QString::null ) );
- buttons.append( binMode && srcMode ? tr( "Select manually" ) : QString::null );
- int answer = QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "You don't have native %1 %2 on your computer.\nPlease, change your installation settings.").arg(item->text(0)).arg(item->text(1)),
- buttons[0],
- buttons[1],
- buttons[2] );
- if ( buttons[ answer ] == tr( "Install binaries" ) )
- productsView->setBinaries( item );
- else if ( buttons[ answer ] == tr( "Install sources" ) )
- productsView->setSources( item );
- else {
- if ( !moreMode )
- onMoreBtn();
- productsView->setCurrentItem( item );
- productsView->setSelected( item, true );
- productsView->ensureItemVisible( item );
- myThread->clearCommands();
- myWC.wakeAll();
- setNextEnabled( true );
- setBackEnabled( true );
- return;
- }
- WarnDialog::showWarnDlg( this, true );
- }
}
if ( myThread->hasCommands() )
myWC.wakeAll();
InstallWizard::processValidateEvent( val, data );
}
}
-
-// ================================================================
-/*!
- * SALOME_InstallWizard::resetToDefaultState
- * Reset to default state
- */
-// ================================================================
-void SALOME_InstallWizard::resetToDefaultState()
-{
- productsView->blockSignals( true );
- buildSrcBtn->setChecked( false );
- MapProducts::Iterator itProd;
- for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
- QString defMode = itProd.data().getDefault();
- if ( defMode.isEmpty() )
- defMode = tr( "install binaries" );
- if ( defMode == tr( "install binaries" ) )
- productsView->setBinaries( itProd.key() );
- else if ( defMode == tr( "install sources" ) )
- productsView->setSources( itProd.key() );
- else if ( defMode == tr( "use native" ) )
- productsView->setNative( itProd.key() );
- else
- productsView->setNone( itProd.key() );
- }
- productsView->blockSignals( false );
-}
-
-// ================================================================
-/*!
- * SALOME_InstallWizard::onBuildAll
- * Build all products from the sources check box slot
- */
-// ================================================================
-void SALOME_InstallWizard::onBuildAll()
-{
- const QObject* snd = sender();
- if ( allFromSrcBtn->isChecked() ) {
- productsView->blockSignals( true );
- buildSrcBtn->setChecked( false );
- MapProducts::Iterator mapIter;
- for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter )
- productsView->setSources( mapIter.key() );
- buildSrcBtn->setChecked( true );
- productsView->blockSignals( false );
- checkProductPage();
- static bool firstTimeClicked = true;
- if ( snd == allFromSrcBtn && firstTimeClicked ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "The building of all products from sources can take a lot of time\n"
- "(more than 24 hours) depending on your computer performance!" ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- }
- firstTimeClicked = false;
- }
- else {
- resetToDefaultState();
- checkProductPage();
- }
- moreBtn->setEnabled( !allFromSrcBtn->isChecked() );
-}