From: vsr Date: Tue, 5 Apr 2005 12:54:43 +0000 (+0000) Subject: PAL8346 improvement: provide two tri-state check boxes on "Products" page of Installa... X-Git-Tag: V_2_2_3~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=923814e5bc057f3a5c5d40fbfb30a3a4b11dc8b3;p=tools%2Finstall.git PAL8346 improvement: provide two tri-state check boxes on "Products" page of Installation Wizard for quick switching on/off all SALOME sources and binaries. --- diff --git a/bin/SALOME_InstallWizard b/bin/SALOME_InstallWizard index ea655de..c1fa8b3 100755 Binary files a/bin/SALOME_InstallWizard and b/bin/SALOME_InstallWizard differ diff --git a/config.xml b/config.xml index 04ad608..33ebaf6 100644 --- a/config.xml +++ b/config.xml @@ -228,6 +228,7 @@ script="graphviz-1.9.sh"/> setChecked( true ); QWhatsThis::add( prerequisites, tr( "Check this if you want prerequisites products to be set on automatically" ) ); QToolTip::add ( prerequisites, tr( "Check this if you want prerequisites products to be set on automatically" ) ); - // buttons - unselectBtn = new QPushButton( tr( "&Unselect All" ), moreBox ); + // button + unselectBtn = new QPushButton( tr( "&Unselect All" ), moreBox ); QWhatsThis::add( unselectBtn, tr( "Unselects all products" ) ); QToolTip::add ( unselectBtn, tr( "Unselects all products" ) ); + // / tri-state checkboxes + selectSrcBtn = new QMyCheckBox( tr( "SALOME sources" ), moreBox ); + selectSrcBtn->setTristate( true ); + QWhatsThis::add( selectSrcBtn, tr( "Selects/unselects SALOME sources" ) ); + QToolTip::add ( selectSrcBtn, tr( "Selects/unselects SALOME sources" ) ); + selectBinBtn = new QMyCheckBox( tr( "SALOME binaries" ), moreBox ); + selectBinBtn->setTristate( true ); + QWhatsThis::add( selectBinBtn, tr( "Selects/unselects SALOME binaries" ) ); + QToolTip::add ( selectBinBtn, tr( "Selects/unselects SALOME binaries" ) ); QVBoxLayout* btnLayout = new QVBoxLayout; btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 ); btnLayout->addWidget( unselectBtn ); + btnLayout->addWidget( selectSrcBtn ); + btnLayout->addWidget( selectBinBtn ); // layouting advancet mode widgets moreBoxLayout->addMultiCellWidget( tempLab, 0, 0, 0, 2 ); moreBoxLayout->addMultiCellWidget( tempFolder, 1, 1, 0, 1 ); @@ -599,6 +623,10 @@ void SALOME_InstallWizard::setupProductsPage() 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() ) ); // connecting signals connect( targetFolder, SIGNAL( textChanged( const QString& ) ), this, SLOT( directoryChanged( const QString& ) ) ); @@ -1134,6 +1162,29 @@ void SALOME_InstallWizard::checkProductPage() // update required size information requiredSize->setText( QString::number( tots ) + " Kb"); requiredTemp->setText( QString::number( temps ) + " Kb"); + + // update , check boxes state + int totSrc = 0, selSrc = 0; + int totBin = 0, selBin = 0; + MapProducts::Iterator itProd; + for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) { + if ( itProd.data().getContext() == "salome sources" ) { + totSrc++; + if ( productsView->isSources( itProd.key() ) ) + selSrc++; + } + if ( itProd.data().getContext() == "salome binaries" ) { + totBin++; + if ( productsView->isBinaries( itProd.key() ) ) + selBin++; + } + } + selectSrcBtn->blockSignals( true ); + selectBinBtn->blockSignals( true ); + selectSrcBtn->setState( selSrc == 0 ? QButton::Off : ( selSrc == totSrc ? QButton::On : QButton::NoChange ) ); + selectBinBtn->setState( selBin == 0 ? QButton::Off : ( selBin == totBin ? QButton::On : QButton::NoChange ) ); + selectSrcBtn->blockSignals( false ); + selectBinBtn->blockSignals( false ); // enable/disable "Next" button setNextEnabled( productsPage, isAnyProductSelected && isTargetDirValid && isTempDirValid ); @@ -1805,6 +1856,8 @@ 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 ) { @@ -1812,6 +1865,36 @@ void SALOME_InstallWizard::onProdBtn() 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().getContext() == "salome sources" ) { + if ( checkBox->state() == QButton::Off ) + productsView->setNone( itProd.key() ); + else + productsView->setSources( 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().getContext() == "salome binaries" ) { + if ( checkBox->state() == QButton::Off ) + productsView->setNone( itProd.key() ); + else + productsView->setBinaries( itProd.key() ); + } + } + } + selectSrcBtn->blockSignals( false ); + selectBinBtn->blockSignals( false ); productsView->blockSignals( false ); onSelectionChanged(); checkProductPage(); diff --git a/src/SALOME_InstallWizard.hxx b/src/SALOME_InstallWizard.hxx index 5f38c9f..551e43c 100644 --- a/src/SALOME_InstallWizard.hxx +++ b/src/SALOME_InstallWizard.hxx @@ -36,6 +36,7 @@ class Dependancies const long tempsize, const QString& def = QString::null, const QString& descr = QString::null, + const QString& ctx = QString::null, bool pickup = false ) : smbName( name ), dependsOn( depend ), @@ -44,6 +45,7 @@ class Dependancies sizeTemp( tempsize ), defaultMode( def ), description( descr ), + context( ctx ), pickupEnv( pickup ) {} // gets symbolic name @@ -56,6 +58,8 @@ class Dependancies long getTempSize() const { return sizeTemp; } // gets product's description QString getDescription() const { return description; } + // gets product's context + QString getContext() const { return context; } // gets default mode QString getDefault() const { return defaultMode; } // returns true if this product needs to pick-up environment @@ -69,6 +73,7 @@ class Dependancies long sizeTemp; // disk space for temporary files required QString defaultMode; // default installation mode QString description; // product's description + QString context; // product's context (salome sources, binaries or prerequisite) bool pickupEnv; // "Pick-up environment" flag }; @@ -82,7 +87,7 @@ class QTextBrowser; class QProcess; class QCheckBox; class QSplitter; - +class QMyCheckBox; class QProcessThread; class ProductsView; class ProgressView; @@ -205,7 +210,7 @@ class SALOME_InstallWizard: public InstallWizard void onSelectionChanged(); // called when user checks/unchecks any product item void onItemToggled( QCheckListItem* ); - // , buttons slot + // , , buttons slot void onProdBtn(); // button slot void onMoreBtn(); @@ -258,8 +263,8 @@ class SALOME_InstallWizard: public InstallWizard ProductsView* productsView; // products list view QTextBrowser* productsInfo; // products info box QCheckBox* prerequisites; // checkbox - QPushButton* selectSrcBtn; // button - NOT USED CURRENTLY + QMyCheckBox* selectSrcBtn; // check box + QMyCheckBox* selectBinBtn; // check box QPushButton* unselectBtn; // button // --> prestart page QWidget* prestartPage; // page itself diff --git a/src/SALOME_XmlHandler.cxx b/src/SALOME_XmlHandler.cxx index 1372b7e..0be7084 100644 --- a/src/SALOME_XmlHandler.cxx +++ b/src/SALOME_XmlHandler.cxx @@ -118,6 +118,9 @@ bool StructureParser::startElement( const QString& /*namespaceURI*/, QString descr = QString::null; if ( attributes.value( "description" ) != "" ) descr = attributes.value( "description" ).stripWhiteSpace(); + QString ctx = QString::null; + if ( attributes.value( "context" ) != "" ) + ctx = attributes.value( "context" ).stripWhiteSpace().lower(); bool pickUp = isBoolAttributeSet( attributes.value( "pickupenv" ) ); myWizard->setDependancies( element, Dependancies( attributes.value( "name" ), @@ -127,6 +130,7 @@ bool StructureParser::startElement( const QString& /*namespaceURI*/, attributes.value( "temporarydiskspace" ).toInt(), install, descr, + ctx, pickUp ) ); } else if (( qName == "path" ) && ( attributes.length() > 0 ) && myWizard ) {