}
// ================================================================
/*!
- * SALOME_InstallWizard::setProductOn
+ * SALOME_InstallWizard::setPrerequisites
* Sets the product and all products this one depends on to be checked ( recursively )
*/
// ================================================================
-void SALOME_InstallWizard::setProductOn( QCheckListItem* item, int install )
+void SALOME_InstallWizard::setPrerequisites( QCheckListItem* item )
{
if ( !productsMap.contains( item ) )
return;
- if ( productsView->isNone( item ) ) {
- if ( install == 1 )
- productsView->setBinaries( item );
- else if ( install == 0 )
- productsView->setSources( item );
- else if ( install == 2 )
- productsView->setNative( item );
- }
+ if ( productsView->isNone( item ) )
+ return;
// get all prerequisites
QStringList dependOn = productsMap[ item ].getDependancies();
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 ] )
- setProductOn( itProd.key(), 1 );
+ 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 ( !aItem->text(1).stripWhiteSpace().isEmpty() )
text += tr( "Version" ) + ": " + aItem->text(1) + "<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 ) ) {
item = (QCheckListItem*)( item->parent() );
if ( productsMap.contains( item ) ) {
productsView->blockSignals( true );
- if ( productsView->isNative( item ) )
- setProductOn( item, 2 );
- else if ( productsView->isBinaries( item ) )
- setProductOn( item, 1 );
- else if ( productsView->isSources( item ) )
- setProductOn( item, 0 );
+ setPrerequisites( item );
productsView->blockSignals( false );
}
}
// default constructor, necessary for map
Dependancies() {}
// constructor
- Dependancies( const QString& name, const QStringList& depend, const long Binsize, const long Sourcessize, const long tempsize )
- : smbName( name ), dependsOn( depend ), sizeSourcesTotal( Sourcessize ), sizeBinaryTotal( Binsize ), sizeTemp( tempsize ) {}
+ Dependancies( const QString& name,
+ const QStringList& depend,
+ const long Binsize,
+ const long Sourcessize,
+ const long tempsize,
+ const QString& def = QString::null,
+ const QString& descr = QString::null )
+ : smbName( name ),
+ dependsOn( depend ),
+ sizeSourcesTotal( Sourcessize ),
+ sizeBinaryTotal( Binsize ),
+ sizeTemp( tempsize ),
+ defaultMode( def ),
+ description( descr ) {}
// gets symbolic name
QString getName() const { return smbName; }
// gets dependancies
QStringList getDependancies() const { return dependsOn; }
// gets disk space required
- long getSize(bool sources = false) const {
- if (sources)
- return sizeSourcesTotal;
- else
- return sizeBinaryTotal;
- }
+ long getSize(bool sources = false) const { return ( sources ? sizeSourcesTotal : sizeBinaryTotal ); }
// gets temporary disk space required
- long getTempSize() const { return sizeTemp; }
+ long getTempSize() const { return sizeTemp; }
+ // gets product's description
+ QString getDescription() const { return description; }
+ // gets default mode
+ QString getDefault() const { return defaultMode; }
private:
QString smbName; // symbolic name
long sizeSourcesTotal; // disk space required
long sizeBinaryTotal; // disk space required
long sizeTemp; // disk space for temporary files required
+ QString defaultMode; // default installation mode
+ QString description; // product's description
};
class QLineEdit;
// checks products page validity (directories and products selection)
void checkProductPage();
// sets the product and all products this one depends on to be checked ( recursively )
- void setProductOn( QCheckListItem* item, int install = 1 );
+ void setPrerequisites( QCheckListItem* item );
// runs installation script
void launchScript();
// searches product listview item with given symbolic name
}
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 );
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 {
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 );
QString install = attributes.value( "install" );
QStringList supported = QStringList::split( ",", attributes.value( "supported" ) );
QString script = attributes.value( "script" );
+ QStringList deps = QStringList();
+ if ( attributes.value( "dependancies" ) != "" )
+ deps = QStringList::split( ",", attributes.value( "dependancies" ), false );
element = myTree->addItem( attributes.value( "name" ), attributes.value( "version" ), install, supported, script );
- if ( attributes.value( "dependancies" ) == "" ) {
- QStringList diskspace = QStringList::split( ",",attributes.value( "installdiskspace" ) );
- if (diskspace.count() == 2)
- myWizard->setDependancies( element,
- Dependancies( attributes.value( "name" ), QStringList(),
- diskspace[0].toInt(),
- diskspace[1].toInt(),
- attributes.value( "temporarydiskspace" ).toInt() ) );
- else
- myWizard->setDependancies( element,
- Dependancies( attributes.value( "name" ), QStringList(),
- diskspace[0].toInt(),
- diskspace[0].toInt(),
- attributes.value( "temporarydiskspace" ).toInt() ) );
-
- }
- else {
- QStringList diskspace = QStringList::split(",",attributes.value( "installdiskspace" ) );
- if (diskspace.count() == 2)
- myWizard->setDependancies( element,
- Dependancies( attributes.value( "name" ),
- QStringList::split( ",", attributes.value( "dependancies" ) ),
- diskspace[0].toInt(),
- diskspace[1].toInt(),
- attributes.value( "temporarydiskspace" ).toInt() ) );
- else
- myWizard->setDependancies( element,
- Dependancies( attributes.value( "name" ),
- QStringList::split( ",", attributes.value( "dependancies" ) ),
- diskspace[0].toInt(),
- diskspace[0].toInt(),
- attributes.value( "temporarydiskspace" ).toInt() ) );
- }
- }
+ QStringList diskspace = QStringList::split(",",attributes.value( "installdiskspace" ) );
+ QString descr = QString::null;
+ if ( attributes.value( "description" ) != "" )
+ descr = attributes.value( "description" ).stripWhiteSpace();
+ myWizard->setDependancies( element,
+ Dependancies( attributes.value( "name" ),
+ deps,
+ ( diskspace.count() > 0 ? diskspace[ 0 ].toInt() : 0 ),
+ ( diskspace.count() > 1 ? diskspace[1].toInt() : ( diskspace.count() > 0 ? diskspace[0].toInt() : 0 ) ),
+ attributes.value( "temporarydiskspace" ).toInt(),
+ install,
+ descr ) );
+ }
else if (( qName == "path" ) && ( attributes.length() > 0 ) && myWizard ) {
if ( myTargetDir )
myTargetDir->setText( attributes.value( "targetdir" ) );