From 249ffe7b9f8575b681deaa628363b94ed1462e49 Mon Sep 17 00:00:00 2001 From: akl Date: Tue, 28 Aug 2007 13:43:27 +0000 Subject: [PATCH] 1) updateSizeColumn() calculates required size for each product and fill in the 'Size' column fields now; 2) 'DOCUMENTATION' module is installed at 'Installation w/o GUI' mode by default now; 3) hide 'Disk space for tmp files required' field in the product info box; 4) fix minor bugs; 5) Small corrections. --- src/SALOME_InstallWizard.cxx | 100 +++++++++++++++++++++++------------ 1 file changed, 67 insertions(+), 33 deletions(-) diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index e4e97d0..bc84ab4 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -511,10 +511,10 @@ SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName, addLogo( pixmap( pxLogo ) ); // set defaults - setVersion( "3.2.6" ); + setVersion( "3.2.7" ); setCaption( tr( "SALOME %1" ).arg( myVersion ) ); setCopyright( tr( "Copyright (C) 2007 CEA" ) ); - setLicense( tr( "All right reserved" ) ); + setLicense( tr( "All rights reserved." ) ); ___MESSAGE___( "Configuration file : " << xmlFileName.latin1() ); ___MESSAGE___( "Target directory : " << myTargetPath.latin1() ); @@ -907,10 +907,11 @@ void SALOME_InstallWizard::setupTypePage() 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 ); + removeSrcBtn = new QCheckBox( 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->setChecked( false ); removeSrcBtn->setEnabled( false ); + rmSrcPrevState = removeSrcBtn->isChecked(); srcCompileLayout->addMultiCellWidget( srcCompileBtn, 0, 0, 0, 2 ); srcCompileLayout->addMultiCell ( spacer6, 1, 2, 0, 0 ); @@ -930,7 +931,6 @@ void SALOME_InstallWizard::setupTypePage() 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" ) ); } @@ -1323,11 +1323,6 @@ void SALOME_InstallWizard::showChoiceInfo() item = (QCheckListItem*)( prereqsView->firstChild() ); while( item ) { if ( productsMap.contains( item ) ) { - if ( productsMap[ item ].hasType( "salome sources" ) || - productsMap[ item ].hasType( "salome binaries" ) ) { - item = (QCheckListItem*)( item->nextSibling() ); - continue; // skip SALOME sources and binaries - } if ( item->isOn() ) { text += "
  • " + item->text() + " " + productsMap[ item ].getVersion() + "
    "; nbProd++; @@ -1493,7 +1488,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) // ########## check if any products are selected to be installed long totSize, tempSize; bool anySelected = checkSize( &totSize, &tempSize ); - if ( installType == Compile && removeSrcBtn->state() == QButton::On ) { + if ( installType == Compile && removeSrcBtn->isOn() ) { totSize += tempSize; } if ( !anySelected ) { @@ -1626,17 +1621,14 @@ bool SALOME_InstallWizard::checkSize( long* totSize, long* tempSize ) Dependancies dep = mapIter.data(); if ( !item->isOn() ) continue; - if ( installType == Compile && removeSrcBtn->state() == QButton::On ) - tots += dep.getSize( Binaries ); - else - tots += dep.getSize( installType ); + tots += ( QStringList::split( " ", item->text(1) )[0] ).toLong(); maxSrcTmp = max( maxSrcTmp, dep.getSize( Compile ) - dep.getSize( Binaries ) ); temps += dep.getTempSize( installType ); nbSelected++; } if ( totSize ) - if ( installType == Compile && removeSrcBtn->state() == QButton::On ) + if ( installType == Compile && removeSrcBtn->isOn() ) temps += maxSrcTmp; *totSize = tots; if ( tempSize ) @@ -1682,6 +1674,44 @@ void SALOME_InstallWizard::checkFLibResult() completeInstallation(); } // ================================================================ +/*! + * SALOME_InstallWizard::updateSizeColumn + * Sets required size for each product according to + * installation type and 'Remove SRC & TMP' checkbox state + */ +// ================================================================ +void SALOME_InstallWizard::updateSizeColumn() +{ + long prodSize = 0; + bool removeSrc = removeSrcBtn->isChecked(); + MapProducts::Iterator mapIter; + for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) { + QCheckListItem* item = mapIter.key(); + Dependancies dep = mapIter.data(); + // get required size for current product + long binSize = dep.getSize( Binaries ); + long srcSize = dep.getSize( Sources ); + long bldSize = dep.getSize( Compile ); + InstallationType instType = getInstType(); + if ( instType == Binaries ) { + if ( dep.getType() == "component" ) + prodSize = binSize + srcSize; + else + prodSize = ( binSize != 0 ? binSize : srcSize ); + } + else if ( instType == Sources ) + prodSize = srcSize; + else + if ( removeSrc ) + prodSize = ( binSize != 0 ? binSize : srcSize ); + else { + prodSize = ( bldSize != 0 ? bldSize : srcSize ); + } + // fill in 'Size' field + item->setText( 1, QString::number( prodSize )+" KB" ); + } +} +// ================================================================ /*! * SALOME_InstallWizard::checkProductPage * Checks products page validity (directories and products selection) and @@ -1792,7 +1822,6 @@ void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item ) 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++ ) { @@ -1901,7 +1930,7 @@ void SALOME_InstallWizard::launchScript() // ... sources directory shellProcess->addArgument( QDir::cleanDirPath( getSrcPath() ) ); // ... remove sources and tmp files or not? - if ( installType == Compile && removeSrcBtn->state() == QButton::On ) + if ( installType == Compile && removeSrcBtn->isOn() ) shellProcess->addArgument( "TRUE" ); else shellProcess->addArgument( "FALSE" ); @@ -2022,7 +2051,8 @@ void SALOME_InstallWizard::onInstallGuiBtn() } else { QString itemName = itProd.data().getName(); - if ( itemName != "KERNEL" && itemName != "MED" && itemName != "SAMPLES" ) { + if ( itemName != "KERNEL" && itemName != "MED" && + itemName != "SAMPLES" && itemName != "DOCUMENTATION" ) { itProd.key()->setOn( false ); itProd.key()->setEnabled( false ); } @@ -2231,7 +2261,7 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) if ( buttonGrp->id( buttonGrp->selected() ) == -1 ) binBtn->animateClick(); // set default installation type } - if ( aPage == platformsPage ) { + else if ( aPage == platformsPage ) { // installation platforms page MapXmlFiles::Iterator it; if ( previousPage == typePage ) { @@ -2268,6 +2298,8 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) if ( tempFolder->text().isEmpty() ) parser->setTempDir( tempFolder ); parser->readXmlFile( xmlFileName ); + // update required size for each product + updateSizeColumn(); // take into account command line parameters if ( !myTargetPath.isEmpty() ) targetFolder->setText( myTargetPath ); @@ -2279,6 +2311,11 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) if ( modulesView->childCount() > 0 && !modulesView->selectedItem() ) modulesView->setSelected( modulesView->firstChild(), true ); stateChanged = false; + } + else if ( rmSrcPrevState != removeSrcBtn->isChecked() ) { + // only update required size for each product + updateSizeColumn(); + rmSrcPrevState = removeSrcBtn->isChecked(); } } else if ( aPage == productsPage ) { @@ -2351,7 +2388,7 @@ void SALOME_InstallWizard::onButtonGroup( int rbIndex ) else if ( aPage == platformsPage ) { refPlatform = platBtnGrp->find( rbIndex )->name(); xmlFileName = platformsMap[ refPlatform ]; - cout << xmlFileName << endl; +// cout << xmlFileName << endl; setNextEnabled( platformsPage, true ); } if ( prevType != installType || @@ -2424,7 +2461,6 @@ void SALOME_InstallWizard::directoryChanged( const QString& /*text*/ ) // ================================================================ void SALOME_InstallWizard::onStart() { - cout << "" << endl; if ( nextButton()->text() == tr( "&Stop" ) ) { statusLab->setText( tr( "Aborting installation..." ) ); shellProcess->kill(); @@ -2694,6 +2730,7 @@ void SALOME_InstallWizard::onCancel() /*! * SALOME_InstallWizard::onSelectionChanged * Called when selection is changed in the products list view + * to fill in the 'Information about product' text box */ // ================================================================ void SALOME_InstallWizard::onSelectionChanged() @@ -2702,11 +2739,9 @@ void SALOME_InstallWizard::onSelectionChanged() QListViewItem* item = modulesView->selectedItem(); if ( snd == prereqsView ) item = prereqsView->selectedItem(); - else if ( snd != modulesView ) - return; - productInfo->clear(); if ( !item ) return; + productInfo->clear(); QCheckListItem* anItem = (QCheckListItem*)item; if ( !productsMap.contains( anItem ) ) return; @@ -2718,14 +2753,13 @@ void SALOME_InstallWizard::onSelectionChanged() if ( !dep.getDescription().isEmpty() ) { text += "" + dep.getDescription() + "

    "; } - long totSize = 0, tempSize = 0; - 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
    "; - text += tr( "Disk space for tmp files required" ) + ": " + QString::number( tempSize ) + " KB
    "; + /* AKL: 07/08/28 - hide required disk space for tmp files for each product ==> + long tempSize = 0; + tempSize = dep.getTempSize( installType ); + text += tr( "Disk space for tmp files required" ) + ": " + QString::number( tempSize ) + " KB
    "; + AKL: 07/08/28 - hide required disk space for tmp files for each product <== + */ + text += tr( "Disk space required" ) + ": " + item->text(1) + "
    "; text += "
    "; QString req = ( dep.getDependancies().count() > 0 ? dep.getDependancies().join(", ") : tr( "none" ) ); text += tr( "Prerequisites" ) + ": " + req; -- 2.39.2