Salome HOME
Update for version 2.2.3
[tools/install.git] / src / SALOME_ProductsView.cxx
index 15aa5e0b4d4f9ddcfd81f256b80dee6b2cd23e9f..adace540898fc2230493ae32191269de03b0e801 100644 (file)
@@ -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 <qstringlist.h>
@@ -130,7 +129,6 @@ void ProductsView::itemActivated( QCheckListItem* item ) {
 bool ProductsView::isBinaries( QCheckListItem* item )
 {
   if ( item->childCount() > 0 ) {
-    // not SALOME sources, binaries or docs
     QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() );
     while( subItem ) {
       if ( subItem->isOn() )
@@ -138,7 +136,6 @@ bool ProductsView::isBinaries( QCheckListItem* item )
       subItem = (QCheckListItem*)( subItem->nextSibling() );
     }
   }
-  // for SALOME sources, binaries and docs return false
   return false;
 }
 // ================================================================
@@ -150,7 +147,6 @@ bool ProductsView::isBinaries( QCheckListItem* item )
 bool ProductsView::isSources( QCheckListItem* item )
 {
   if ( item->childCount() > 0 ) {
-    // not SALOME sources, binaries or docs item
     QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() );
     while( subItem ) {
       if ( subItem->isOn() )
@@ -159,7 +155,6 @@ bool ProductsView::isSources( QCheckListItem* item )
     }
   }
   else {
-    // for SALOME sources, binaries or docs item return true if checked
     return item->isOn();
   }
   return false;
@@ -173,7 +168,6 @@ bool ProductsView::isSources( QCheckListItem* item )
 bool ProductsView::isNative( QCheckListItem* item )
 {
   if ( item->childCount() > 0 ) {
-    // not SALOME sources, binaries or docs item
     QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() );
     while( subItem ) {
       if ( subItem->isOn() )
@@ -202,7 +196,6 @@ bool ProductsView::isNone(  QCheckListItem* item )
 // ================================================================
 void ProductsView::setBinaries( QCheckListItem* item ) {
   if ( item->childCount() > 0 ) {
-    // not SALOME sources, binaries or docs item
     QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() );
     QCheckListItem* srcItem = 0;
     QCheckListItem* nativeItem = 0;
@@ -217,13 +210,12 @@ 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 {
-    // for SALOME sources, binaries and docs items set true
     item->setOn( true );
   }
 }
@@ -236,23 +228,26 @@ void ProductsView::setBinaries( QCheckListItem* item ) {
 // ================================================================
 void ProductsView::setSources( QCheckListItem* item )  {
   if ( item->childCount() > 0 ) {
-    // not SALOME sources, binaries or docs item
     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 {
-    // for SALOME sources, binaries and docs items set true
     item->setOn( true );
   }
 }
@@ -265,23 +260,26 @@ void ProductsView::setSources( QCheckListItem* item )  {
 // ================================================================
 void ProductsView::setNative( QCheckListItem* item )  {
   if ( item->childCount() > 0 ) {
-    // not SALOME sources, binaries or docs item
     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 {
-    // for SALOME sources, binaries and docs items set true
     item->setOn( true );
   }
 }
@@ -293,7 +291,6 @@ void ProductsView::setNative( QCheckListItem* item )  {
 // ================================================================
 void ProductsView::setNone( QCheckListItem* item )  {
   if ( item->childCount() > 0 ) {
-    // not SALOME sources, binaries or docs item
     QCheckListItem* subItem = (QCheckListItem*)( item->firstChild() );
     while( subItem ) {
       if ( subItem->text() == tr( "not install" ) ) {
@@ -304,7 +301,6 @@ void ProductsView::setNone( QCheckListItem* item )  {
     }
   }
   else {
-    // for SALOME sources, binaries and docs items set false
     item->setOn( false );
   }
 }