X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSALOME_ProductsView.cxx;h=96c3734d7943868fa234c3e3407268af8041fc66;hb=3fc3493387b534f9e0c536de985ac0af3413ae7a;hp=5d38dff1ba5851114a0f9ba3617b4ad8dc9d557d;hpb=972b20151fc9d1119aeef80cf80dfd5abb90a272;p=tools%2Finstall.git diff --git a/src/SALOME_ProductsView.cxx b/src/SALOME_ProductsView.cxx index 5d38dff..96c3734 100644 --- a/src/SALOME_ProductsView.cxx +++ b/src/SALOME_ProductsView.cxx @@ -1,10 +1,9 @@ // File : SALOME_ProductsView.cxx // Created : Thu Dec 18 12:01:00 2002 // Author : Vadim SANDLER -// Project : PAL/SALOME -// Module : InstallWizard -// Copyright : 2004 CEA -// $Header$ +// Project : SALOME +// Module : Installation Wizard +// Copyright : 2004-2005 CEA #include "SALOME_ProductsView.hxx" #include @@ -127,7 +126,7 @@ void ProductsView::itemActivated( QCheckListItem* item ) { * Returns true if "install binaries" is on for the item */ // ================================================================ -bool ProductsView::isBinaries( QCheckListItem* item ) +bool ProductsView::isBinaries( QCheckListItem* item ) const { if ( item->childCount() > 0 ) { QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() ); @@ -145,7 +144,7 @@ bool ProductsView::isBinaries( QCheckListItem* item ) * Returns true if "install sources" is on for the item */ // ================================================================ -bool ProductsView::isSources( QCheckListItem* item ) +bool ProductsView::isSources( QCheckListItem* item ) const { if ( item->childCount() > 0 ) { QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() ); @@ -166,7 +165,7 @@ bool ProductsView::isSources( QCheckListItem* item ) * Returns true if "use native" is on for the item */ // ================================================================ -bool ProductsView::isNative( QCheckListItem* item ) +bool ProductsView::isNative( QCheckListItem* item ) const { if ( item->childCount() > 0 ) { QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() ); @@ -184,7 +183,7 @@ bool ProductsView::isNative( QCheckListItem* item ) * Returns true if "not install" is on for the item */ // ================================================================ -bool ProductsView::isNone( QCheckListItem* item ) +bool ProductsView::isNone( QCheckListItem* item ) const { return !isBinaries( item ) && !isSources( item ) && !isNative( item ); } @@ -211,10 +210,10 @@ void ProductsView::setBinaries( QCheckListItem* item ) { } subItem = (QCheckListItem*)( subItem->nextSibling() ); } - if ( srcItem ) - srcItem->setOn( true ); - if ( nativeItem ) + if ( nativeItem ) // prefer native item nativeItem->setOn( true ); + else if ( srcItem ) + srcItem->setOn( true ); } else { item->setOn( true ); @@ -231,16 +230,21 @@ void ProductsView::setSources( QCheckListItem* item ) { if ( item->childCount() > 0 ) { QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() ); QCheckListItem* binItem = 0; + QCheckListItem* nativeItem = 0; while( subItem ) { if ( subItem->text() == tr( "install binaries" ) ) binItem = binItem; + if ( subItem->text() == tr( "use native" ) ) + nativeItem = subItem; if ( subItem->text() == tr( "install sources" ) ) { subItem->setOn( true ); return; } subItem = (QCheckListItem*)( subItem->nextSibling() ); } - if ( binItem ) + if ( nativeItem ) // prefer native item + nativeItem->setOn( true ); + else if ( binItem ) binItem->setOn( true ); } else { @@ -258,17 +262,22 @@ void ProductsView::setNative( QCheckListItem* item ) { if ( item->childCount() > 0 ) { QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() ); QCheckListItem* binItem = 0; + QCheckListItem* srcItem = 0; while( subItem ) { if ( subItem->text() == tr( "install binaries" ) ) binItem = binItem; + if ( subItem->text() == tr( "install sources" ) ) + srcItem = subItem; if ( subItem->text() == tr( "use native" ) ) { subItem->setOn( true ); return; } subItem = (QCheckListItem*)( subItem->nextSibling() ); } - if ( binItem ) + if ( binItem ) // prefer binaries binItem->setOn( true ); + else if ( srcItem ) + srcItem->setOn( true ); } else { item->setOn( true ); @@ -295,3 +304,60 @@ void ProductsView::setNone( QCheckListItem* item ) { item->setOn( false ); } } + +// ================================================================ +/*! + * ProductsView::hasBinaries + * Returns true if product supports "binaries" installation mode + */ +// ================================================================ +bool ProductsView::hasBinaries( QCheckListItem* item ) const +{ + if ( item->childCount() > 0 ) { + QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() ); + while( subItem ) { + if ( subItem->text() == tr( "install binaries" ) ) + return true; + subItem = (QCheckListItem*)( subItem->nextSibling() ); + } + } + return false; +} + +// ================================================================ +/*! + * ProductsView::hasSources + * Returns true if product supports "sources" installation mode + */ +// ================================================================ +bool ProductsView::hasSources( QCheckListItem* item ) const +{ + if ( item->childCount() > 0 ) { + QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() ); + while( subItem ) { + if ( subItem->text() == tr( "install sources" ) ) + return true; + subItem = (QCheckListItem*)( subItem->nextSibling() ); + } + } + return false; +} + +// ================================================================ +/*! + * ProductsView::hasNative + * Returns true if product supports "native" installation mode + */ +// ================================================================ +bool ProductsView::hasNative( QCheckListItem* item ) const +{ + if ( item->childCount() > 0 ) { + QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() ); + while( subItem ) { + if ( subItem->text() == tr( "use native" ) ) + return true; + subItem = (QCheckListItem*)( subItem->nextSibling() ); + } + } + return false; +}