#define max( x, y ) ( x ) > ( y ) ? ( x ) : ( y )
#endif
-#define TEMPDIRNAME ( "/INSTALLWORK" + QString::number( getpid() ) )
+QString tmpDirName() { return QString( "/INSTALLWORK" ) + QString::number( getpid() ); }
+#define TEMPDIRNAME tmpDirName()
// ================================================================
/*!
// ================================================================
static bool makeDir( const QString& theDir, QString& theCreated )
{
- theCreated = QString::null;
if ( theDir.isEmpty() )
return false;
QString aDir = QDir::cleanDirPath( QFileInfo( theDir ).absFilePath() );
setIcon( QPixmap( ( const char** ) image0_data ) );
// enable sizegrip
setSizeGripEnabled( true );
-
+
+ // add logo
+ addLogo( QPixmap( (const char**)image1_data ) );
+
// set defaults
setVersion( "1.2" );
- setCaption( tr("PAL/SALOME %1").arg( myVersion ) );
+ setCaption( tr( "PAL/SALOME %1" ).arg( myVersion ) );
setCopyright( tr( "Copyright (C) 2004 CEA" ) );
setLicense( tr( "All right reserved" ) );
setOS( "" );
}
// create instance of class for starting shell install script
- shellProcess = new QProcess( this,"shellProcess" );
+ shellProcess = new QProcess( this, "shellProcess" );
// create introduction page
setupIntroPage();
if ( QMessageBox::information( this,
tr( "Exit" ),
tr( "Do you want to quit %1?" ).arg( getIWName() ),
- tr( "Yes" ),
- tr( "No" ),
+ tr( "&Yes" ),
+ tr( "&No" ),
QString::null,
0,
1 ) == 1 ) {
QGridLayout* pageLayout = new QGridLayout( introPage );
pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
// create logo picture
- QPixmap logo( (const char**)SALOMEPRO_Logo_xpm );
+ QPixmap logo( (const char**)SALOME_Logo_xpm );
logoLab = new QLabel( introPage );
logoLab->setPixmap( logo );
logoLab->setScaledContents( false );
"which are necessary for <b>%2</b> and setup "
"your environment.<br><br>Click <code>Cancel</code> button to abort "
"installation and quit. Click <code>Next</code> button to continue with the "
- "installation program.").arg(myCaption).arg(myCaption) );
+ "installation program." ).arg( myCaption ).arg( myCaption ) );
info->setFrameStyle( QLabel::WinPanel | QLabel::Sunken );
info->setMargin( 6 );
info->setAlignment( WordBreak );
QToolTip::add ( tempBtn, tr( "Click this to browse temporary directory" ) );
// create products list
productsView = new ProductsView( moreBox );
- productsView->setMinimumSize( 200, 180 );
+ productsView->setMinimumSize( 250, 180 );
QWhatsThis::add( productsView, tr( "This view lists the products you wish to be installed" ) );
QToolTip::add ( productsView, tr( "This view lists the products you wish to be installed" ) );
// products info box
// set first item to be selected
if ( productsView->childCount() > 0 ) {
productsView->setSelected( productsView->firstChild(), true );
- onSelectionChanged( productsView->firstChild() );
+ onSelectionChanged();
}
// adding page
addPage( productsPage, tr( "Installation settings" ) );
// connecting signals
- connect( productsView, SIGNAL( selectionChanged( QListViewItem* ) ),
- this, SLOT( onSelectionChanged( QListViewItem* ) ) );
+ connect( productsView, SIGNAL( selectionChanged() ),
+ this, SLOT( onSelectionChanged() ) );
connect( productsView, SIGNAL( itemToggled( QCheckListItem* ) ),
this, SLOT( onItemToggled( QCheckListItem* ) ) );
connect( unselectBtn, SIGNAL( clicked() ), this, SLOT( onProdBtn() ) );
readme = new QTextEdit( readmePage );
readme->setReadOnly( true );
readme->setTextFormat( PlainText );
+ readme->setFont( QFont( "Fixed", 10 ) );
readme->setUndoRedoEnabled ( false );
QWhatsThis::add( readme, tr( "Displays README information" ) );
QToolTip::add ( readme, tr( "Displays README information" ) );
QString text;
if ( !xmlFileName.isEmpty() ) {
- text += tr( "Configuration file: <b>" ) + xmlFileName + "</b><br>";
+ text += tr( "Configuration file" )+ ": <b>" + xmlFileName + "</b><br>";
text += "<br>";
}
if ( !myOS.isEmpty() ) {
- text += tr( "Target platform: <b>" ) + myOS + "</b><br>";
+ text += tr( "Target platform" ) + ": <b>" + myOS + "</b><br>";
text += "<br>";
}
- text += tr( "Products to be used:<ul>" );
+ text += tr( "Products to be used" ) + ":<ul>";
QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
while( item ) {
if ( productsMap.contains( item ) ) {
if ( item->childCount() > 0 ) {
- // Neither "SALOME binaries", no "SALOME sources"
if ( productsView->isNative( item ) ) {
- text += "<li><b>" + item->text() + "</b> as native<br>";
+ text += "<li><b>" + item->text() + "</b> " + tr( "as native" ) + "<br>";
nbProd++;
}
}
item = (QCheckListItem*)( item->nextSibling() );
}
if ( nbProd == 0 ) {
- text += "<li><b>none</b><br>";
+ text += "<li><b>" + tr( "none" ) + "</b><br>";
}
text += "</ul>";
- text += tr( "Products to be installed:<ul>" );
+ nbProd = 0;
+ text += tr( "Products to be installed" ) + ":<ul>";
item = (QCheckListItem*)( productsView->firstChild() );
while( item ) {
if ( productsMap.contains( item ) ) {
if ( item->childCount() > 0 ) {
- // Neither "SALOME binaries", no "SALOME sources"
if ( productsView->isBinaries( item ) ) {
- text += "<li><b>" + item->text() + "</b> as binaries<br>";
+ text += "<li><b>" + item->text() + "</b> " + tr( "as binaries" ) + "<br>";
nbProd++;
}
else if ( productsView->isSources( item ) ) {
- text+= "<li><b>" + item->text() + "</b> as sources<br>";
+ text+= "<li><b>" + item->text() + "</b> " + tr( "as sources" ) + "<br>";
nbProd++;
}
}
else if ( item->isOn() ) {
- // "SALOME binaries" or "SALOME sources"
text+= "<li><b>" + item->text() + "</b><br>";
nbProd++;
}
item = (QCheckListItem*)( item->nextSibling() );
}
if ( nbProd == 0 ) {
- text += "<li><b>none</b><br>";
+ text += "<li><b>" + tr( "none" ) + "</b><br>";
}
text += "</ul>";
- text += "Total disk space required: <b>" + QString::number( totSize ) + " Kb</b><br>" ;
- text += "Space for temporary files required: <b>" + QString::number( tempSize ) + " Kb</b><br>" ;
+ text += tr( "Total disk space required:" ) + " <b>" + QString::number( totSize ) + " Kb</b><br>" ;
+ text += tr( "Space for temporary files required:" ) + " <b>" + QString::number( tempSize ) + " Kb</b><br>" ;
text += "<br>";
- text += "Target directory: <b>" + QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) + "</b><br>";
+ text += tr( "Target directory:" ) + " <b>" + QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) + "</b><br>";
// VSR: Temporary folder is used always now and it is not necessary to disable it -->
// if ( tempSize > 0 )
// VSR: <----------------------------------------------------------------------------
- text += "Temp directory: <b>" + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + "</b><br>";
+ text += tr( "Temp directory:" ) + " <b>" + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + "</b><br>";
text += "<br>";
choices->setText( text );
}
if ( aPage == productsPage ) {
// ########## check if any products are selected to be installed
long totSize, tempSize;
- checkSize( &totSize, &tempSize );
- if ( totSize <= 0 ) {
+ bool anySelected = checkSize( &totSize, &tempSize );
+ if ( !anySelected ) {
QMessageBox::warning( this,
tr( "Warning" ),
tr( "Select one or more products to install" ),
return false;
}
else {
- tempFolder->setText( "/tmp" );
+ tempDir = "/tmp";
+ tempFolder->setText( tempDir );
}
}
QFileInfo fit( QDir::cleanDirPath( tempDir ) );
* Calculates disk space required for the installation
*/
// ================================================================
-void SALOME_InstallWizard::checkSize( long* totSize, long* tempSize )
+bool SALOME_InstallWizard::checkSize( long* totSize, long* tempSize )
{
long tots = 0, temps = 0;
- int nativeProd = 0;
+ int nbSelected = 0;
MapProducts::Iterator mapIter;
for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
tots += dep.getSize(true);
temps = max( temps, dep.getTempSize() );
}
- else if ( productsView->isNative( item ) ) {
- nativeProd++;
- }
+ if ( !productsView->isNone( item ) )
+ nbSelected++;
}
- requiredSize->setText( QString::number( tots ) + " Kb");
- requiredTemp->setText( QString::number( temps ) + " Kb");
if ( totSize )
*totSize = tots;
if ( tempSize )
*tempSize = temps;
- setNextEnabled( productsPage, (tots > 0) || (nativeProd > 0));
+ return ( nbSelected > 0 );
}
// ================================================================
/*!
- * SALOME_InstallWizard::checkDirs
- * Enabled/disables "Next" button for the directory page
+ * SALOME_InstallWizard::checkProductPage
+ * Checks products page validity (directories and products selection) and
+ * enabled/disables "Next" button for the Products page
*/
// ================================================================
-void SALOME_InstallWizard::checkDirs()
+void SALOME_InstallWizard::checkProductPage()
{
- // VSR: Temporary folder is used always now and it is not necessary to disable it -->
- // get disk space required
- //long totSize, tempSize;
- //checkSize( &totSize, &tempSize );
- // enable/disable temp directory controls
- // tempFolder->setEnabled( tempSize > 0 );
- // tempBtn->setEnabled( tempSize > 0 );
- // VSR: <----------------------------------------------------------------------------
- // get dirs
- QString targetDir = targetFolder->text().stripWhiteSpace();
+ long tots = 0, temps = 0;
+
+ // check if any product is selected;
+ bool isAnyProductSelected = checkSize( &tots, &temps );
+ // check if target directory is valid
+ bool isTargetDirValid = !targetFolder->text().stripWhiteSpace().isEmpty();
+ // check if temp directory is valid
+ bool isTempDirValid = !moreMode || !tempFolder->text().stripWhiteSpace().isEmpty();
+
+ // update required size information
+ requiredSize->setText( QString::number( tots ) + " Kb");
+ requiredTemp->setText( QString::number( temps ) + " Kb");
+
// enable/disable "Next" button
- setNextEnabled( productsPage, !targetDir.isEmpty() );
+ setNextEnabled( productsPage, isAnyProductSelected && isTargetDirValid && isTempDirValid );
}
// ================================================================
/*!
- * 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() );
+ }
+ }
}
}
}
// ... temp folder
QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
- if( !tempFolder->isEnabled() )
- tmpFolder = "/tmp";
+ //if( !tempFolder->isEnabled() )
+ //tmpFolder = "/tmp";
// ... binaries ?
if ( productsView->isBinaries( item ) ) {
#ifdef DEBUG
cout << "All products have been installed successfully" << endl;
#endif
- // all products installed successfully
+ // all products are installed successfully
+ QString workDir = QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() );
+ MapProducts::Iterator mapIter;
+#ifdef DEBUG
+ cout << "starting pick-up environment" << endl;
+#endif
+ for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
+ QCheckListItem* item = mapIter.key();
+ Dependancies dep = mapIter.data();
+ QString depproducts = QUOTE( DefineDependeces(productsMap) );
+ if ( dep.pickUpEnvironment() ) {
+#ifdef DEBUG
+ cout << "... for " << dep.getName() << endl;
+#endif
+ QString script;
+ script += "cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; ";
+ script += item->text(2) + " ";
+ script += "pickup_env ";
+ script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " ";
+ script += QUOTE( QFileInfo( QDir::cleanDirPath( QDir::currentDirPath() + "/Products" ) ).absFilePath() ) + " ";
+ script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " ";
+ script += depproducts + " ";
+ script += item->text(0);
+#ifdef DEBUG
+ cout << "... --> " << script.latin1() << endl;
+#endif
+ if ( system( script.latin1() ) ) {
+#ifdef DEBUG
+ cout << "ERROR" << endl;
+#endif
+ }
+ }
+ }
// <Next> button
nextButton()->setEnabled( true );
nextButton()->setText( tr( "&Next >" ) );
resize( geometry().width(), 0 );
qApp->processEvents();
}
+ checkProductPage();
}
// ================================================================
/*!
// ================================================================
void SALOME_InstallWizard::onLaunchSalome()
{
- QCheckListItem* item = 0;
- if ( ( item = findItem("SalomePro-Bin" ) ) ) {
- QFileInfo fi( targetFolder->text() + "/SalomePro-" + item->text(1) + "/salome" );
- if ( fi.exists() ) {
- QString script;
- script += "cd " + targetFolder->text() + "/SalomePro-" + item->text(1) + "; ";
- script += "source salome.csh; ";
- //script += "cd bin; ";
- //script += "runSalome > /dev/null";
- script += "salome -g > /dev/null";
- script = "(csh -c '" + script + "')";
+ QString msg = tr( "You don't have SALOME binaries installed in the %1 directory!" ).arg( targetFolder->text() );
+
+ QCheckListItem* item = findItem( "KERNEL-Bin" );
+ if ( item ) {
+ QFileInfo fi( targetFolder->text() + "/KERNEL_" + item->text(1) + "/bin/salome/runSalome" );
+ QFileInfo fienv( targetFolder->text() + "/KERNEL_" + item->text(1) + "/salome.csh" );
+ if ( fienv.exists() ) {
+ if ( fi.exists() ) {
+ QString script;
+ script += "cd " + targetFolder->text() + "/KERNEL_" + item->text(1) + "; ";
+ script += "source salome.csh; ";
+ script += "cd bin/salome; ";
+ script += "runSalome > /dev/null";
+ script = "(csh -c '" + script + "')";
#ifdef DEBUG
- cout << script.latin1() << endl;
+ cout << script.latin1() << endl;
#endif
- if ( system( script.latin1() ) ){
- QMessageBox::warning( this,
- tr( "Error" ),
- tr( "Can't launch SALOME" ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
+ if ( !system( script.latin1() ) )
+ return;
+ else
+ msg = tr( "Can't launch SALOME." );
}
- return;
+ else
+ msg = tr( "Can't launch SALOME." ) + "\n" + tr( "runSalome file can not be found." );
}
+ else
+ msg = tr( "Can't launch SALOME." ) + "\n" + tr( "Can't find environment file." );
}
QMessageBox::warning( this,
tr( "Error" ),
- tr( "You don't have SALOME binaries installed in the %1 directory!" ).arg( targetFolder->text() ),
+ msg,
QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton );
if ( QMessageBox::information( this,
tr( "Exit" ),
tr( "Do you want to quit %1?" ).arg( getIWName() ),
- tr( "Yes" ),
- tr( "No" ),
+ tr( "&Yes" ),
+ tr( "&No" ),
QString::null,
0,
1 ) == 1 ) {
{
// VSR: first remove temporary files
QString script = "cd ./config_files/; remove_tmp.sh '";
- script += tempFolder->text().stripWhiteSpace();
+ script += tempFolder->text().stripWhiteSpace() + TEMPDIRNAME;
script += "' ";
script += QUOTE(DefineDependeces(productsMap));
script += " > /dev/null";
updateCaption();
if ( aPage == productsPage ) {
// products page
- checkSize();
- checkDirs();
+ onSelectionChanged();
+ checkProductPage();
}
else if ( aPage == prestartPage ) {
// prestart page
passedParams->clear();
passedParams->setEnabled( false );
QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f );
- nextButton()->setText( tr("&Start") );
+ nextButton()->setText( tr( "&Start" ) );
QWhatsThis::add( nextButton(), tr( "Starts installation process" ) );
QToolTip::add ( nextButton(), tr( "Starts installation process" ) );
// reconnect Next button - to use it as Start button
}
}
else if ( aPage == readmePage ) {
- QCheckListItem* item = 0;
- runSalomeBtn->setEnabled( ( item = findItem( "SalomePro-Bin" ) ) &&
- QFileInfo( targetFolder->text() + "/SalomePro-" + item->text(1) + "/salome" ).exists() );
+ QCheckListItem* item = findItem( "KERNEL-Bin" );
+ runSalomeBtn->setEnabled( item &&
+ QFileInfo( targetFolder->text() + "/KERNEL_" + item->text(1) + "/bin/salome/runSalome" ).exists() &&
+ QFileInfo( targetFolder->text() + "/KERNEL_" + item->text(1) + "/salome.csh" ).exists() );
finishButton()->setEnabled( true );
}
previousPage = aPage;
theFolder->setText( typedDir );
theFolder->end( false );
}
- checkDirs();
+ checkProductPage();
}
// ================================================================
/*!
// ================================================================
void SALOME_InstallWizard::directoryChanged( const QString& /*text*/ )
{
- checkDirs();
+ checkProductPage();
}
// ================================================================
/*!
item = findItem( toInstall[ i ] );
QString type = "";
if ( productsView->isBinaries( item ) )
- type = "binaries";
+ type = tr( "binaries" );
else if ( productsView->isSources( item ) )
- type = "sources";
+ type = tr( "sources" );
else if ( productsView->isNative( item ) )
- type = "native";
+ type = tr( "native" );
else
- type = "not install";
+ type = tr( "not install" );
progressView->addProduct( item->text(0), type, item->text(2) );
}
// launch install script
if ( QMessageBox::information( this,
tr( "Exit" ),
tr( "Do you want to quit %1?" ).arg( getIWName() ),
- tr( "Yes" ),
- tr( "No" ),
+ tr( "&Yes" ),
+ tr( "&No" ),
QString::null,
0,
1 ) == 1 ) {
* Called when selection is changed in the products list view
*/
// ================================================================
-void SALOME_InstallWizard::onSelectionChanged( QListViewItem* item )
+void SALOME_InstallWizard::onSelectionChanged()
{
productsInfo->clear();
+ QListViewItem* item = productsView->selectedItem();
+ if ( !item )
+ return;
if ( item->parent() )
item = item->parent();
QCheckListItem* aItem = (QCheckListItem*)item;
if ( !productsMap.contains( aItem ) )
return;
Dependancies dep = productsMap[ aItem ];
- QString text = "<b>" + aItem->text(0) + "</b>";
- text += "<br><br>";
+ QString text = "<b>" + aItem->text(0) + "</b>" + "<br>";
if ( !aItem->text(1).stripWhiteSpace().isEmpty() )
- text += "version: " + aItem->text(1) + "<br>";
- if ( productsView->isBinaries( aItem ) )
- text += "Disk space required: " + QString::number( dep.getSize() ) + " Kb";
- else
- text += "Disk space required: " + QString::number( dep.getSize(true) ) + " Kb";
-
+ text += tr( "Version" ) + ": " + aItem->text(1) + "<br>";
text += "<br>";
- text += "Disk space for tmp files required: " + QString::number( dep.getTempSize() ) + " Kb";
- text += "<br><br>";
- QString req =( dep.getDependancies().count() > 0 ? dep.getDependancies().join(", ") : QString( "none" ) );
-// if ( item->depth() == 0 && item->childCount() == 0 ) {
-// if ( dep.getName() == "salomedoc" )
-// req = "none"; // SALOME docs
-// else
-// req = "all products"; // SALOME sources and binaries
-// }
- text += "Prerequisites: " + req;
+ if ( !dep.getDescription().isEmpty() ) {
+ text += "<i>" + dep.getDescription() + "</i><br><br>";
+ }
+ text += tr( "User choice" ) + ": ";
+ long totSize = 0, tempSize = 0;
+ if ( productsView->isBinaries( aItem ) ) {
+ text += "<b>" + tr( "install binaries" ) + "</b>" + "<br>";
+ totSize = dep.getSize();
+ }
+ else if ( productsView->isSources( aItem ) ) {
+ text += "<b>" + tr( "install sources" ) + "</b>" + "<br>";
+ totSize = dep.getSize( true );
+ tempSize = dep.getTempSize();
+ }
+ else if ( productsView->isNative( aItem ) ) {
+ text += "<b>" + tr( "use native" ) + "</b>" + "<br>";
+ }
+ else {
+ text += "<b>" + tr( "not install" ) + "</b>" + "<br>";
+ }
+
+ text += tr( "Disk space required" ) + ": " + QString::number( totSize ) + " Kb<br>";
+ text += tr( "Disk space for tmp files required" ) + ": " + QString::number( tempSize ) + " Kb<br>";
+ text += "<br>";
+ QString req = ( dep.getDependancies().count() > 0 ? dep.getDependancies().join(", ") : tr( "none" ) );
+ text += tr( "Prerequisites" ) + ": " + req;
productsInfo->setText( text );
}
// ================================================================
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 );
}
}
- checkSize();
+ onSelectionChanged();
+ checkProductPage();
}
// ================================================================
/*!
}
}
productsView->blockSignals( false );
- checkSize();
+ onSelectionChanged();
+ checkProductPage();
}
// ================================================================
/*!