// File : SALOME_InstallWizard.cxx
// Created : Thu Dec 18 12:01:00 2002
-// Author : Vadim SANDLER
+// Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
// Project : SALOME
// Module : Installation Wizard
-// Copyright : 2004-2005 CEA
+// Copyright : 2002-2006 CEA
#include "globals.h"
pal.setColor( QColorGroup::Base, QApplication::palette().active().background() );
readme->setPalette( pal );
readme->setMinimumHeight( 10 );
- // <Launch SALOME> button
- runSalomeBtn = new QPushButton( tr( "Launch SALOME" ), readmePage );
- QWhatsThis::add( runSalomeBtn, tr( "Click this button to run SALOME desktop" ) );
- QToolTip::add ( runSalomeBtn, tr( "Click this button to run SALOME desktop" ) );
- QHBoxLayout* hLayout = new QHBoxLayout;
- hLayout->addWidget( runSalomeBtn ); hLayout->addStretch();
- // layouting
+
pageLayout->addWidget( readme );
pageLayout->setStretchFactor( readme, 5 );
- pageLayout->addLayout( hLayout );
- // connecting signals
- connect( runSalomeBtn, SIGNAL( clicked() ), this, SLOT( onLaunchSalome() ) );
+
+ // Operation buttons
+ if ( buttons.count() > 0 ) {
+ QHBoxLayout* hLayout = new QHBoxLayout;
+ hLayout->setMargin( 0 ); hLayout->setSpacing( 6 );
+ ButtonList::Iterator it;
+ for ( it = buttons.begin(); it != buttons.end(); ++it ) {
+ QButton* b = new QPushButton( tr( (*it).label() ), readmePage );
+ if ( !(*it).tootip().isEmpty() ) {
+ QWhatsThis::add( b, tr( (*it).tootip() ) );
+ QToolTip::add ( b, tr( (*it).tootip() ) );
+ }
+ hLayout->addWidget( b );
+ (*it).setButton( b );
+ connect( b, SIGNAL( clicked() ), this, SLOT( onFinishButton() ) );
+ }
+ hLayout->addStretch();
+ pageLayout->addLayout( hLayout );
+ }
+
// loading README file
QString readmeFile = QDir::currentDirPath() + "/README";
QString text;
readme->setText( text );
else
readme->setText( tr( "README file has not been found" ) );
+
// adding page
addPage( readmePage, tr( "Finish installation" ) );
}
QMessageBox::NoButton ) == QMessageBox::No ) {
return false;
}
- QString binDir = "./Products/BINARIES";
- if ( !myOS.isEmpty() )
- binDir += "/" + myOS;
- QFileInfo fib( QDir::cleanDirPath( binDir ) );
- if ( !fib.exists() ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "The directory %1 doesn't exist.\n"
- "This directory must contain binaries archives." ).arg( fib.absFilePath() ));
+ // check sources/binaries archives directories existance
+ int nbSources = 0, nbBinaries = 0;
+ QCheckListItem* nitem = (QCheckListItem*)( productsView->firstChild() );
+ while( nitem ) {
+ if ( productsMap.contains( nitem ) ) {
+ if ( nitem->childCount() > 0 ) {
+ if ( productsView->isBinaries( nitem ) )
+ nbBinaries++;
+ else if ( productsView->isSources( nitem ) )
+ nbSources++;
+ }
+ else if ( nitem->isOn() ) {
+ nbBinaries++;
+ nbSources++;
+ }
+ }
+ nitem = (QCheckListItem*)( nitem->nextSibling() );
+ }
+
+ if ( nbBinaries > 0 ) {
+ QString binDir = "./Products/BINARIES";
+ if ( !myOS.isEmpty() )
+ binDir += "/" + myOS;
+ QFileInfo fib( QDir::cleanDirPath( binDir ) );
+ if ( !fib.exists() ) {
+ if ( QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't exist.\n"
+ "This directory must contain binaries archives.\n"
+ "Continue?" ).arg( fib.absFilePath() ),
+ QMessageBox::Yes,
+ QMessageBox::No,
+ QMessageBox::NoButton ) == QMessageBox::No )
+ return false;
+ }
+ }
+ if ( nbSources > 0 ) {
+ QString srcDir = "./Products/SOURCES";
+ QFileInfo fis( QDir::cleanDirPath( srcDir ) );
+ if ( !fis.exists() ) {
+ if ( QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't exist.\n"
+ "This directory must contain sources archives.\n"
+ "Continue?" ).arg( fis.absFilePath() ),
+ QMessageBox::Yes,
+ QMessageBox::No,
+ QMessageBox::NoButton ) == QMessageBox::No )
+ return false;
+ }
}
// run script that checks available disk space for installing of products // returns 1 in case of error
QString script = "./config_files/checkSize.sh '";
QCheckListItem* item = mapIter.key();
Dependancies dep = mapIter.data();
QString depproducts = QUOTE( DefineDependeces(productsMap) );
- if ( dep.pickUpEnvironment() ) {
+ if ( !productsView->isNone( item ) && dep.pickUpEnvironment() ) {
___MESSAGE___( "... for " << dep.getName() );
QString script;
script += "cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; ";
}
// ================================================================
/*!
- * SALOME_InstallWizard::onLaunchSalome
- * <Launch Salome> button slot
+ * SALOME_InstallWizard::onFinishButton
+ * Operation buttons slot
*/
// ================================================================
-void SALOME_InstallWizard::onLaunchSalome()
+void SALOME_InstallWizard::onFinishButton()
{
- 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.sh" );
- if ( fienv.exists() ) {
- if ( fi.exists() ) {
- QString script;
- script += "cd " + targetFolder->text() + "/KERNEL_" + item->text(1) + "; ";
- script += "source salome.sh; ";
- script += "cd bin/salome; ";
- script += "runSalome > /dev/null";
- script = "(bash -c '" + script + "')";
- ___MESSAGE___( "script: " << script.latin1() );
- if ( !system( script.latin1() ) )
- return;
- else
- msg = tr( "Can't launch SALOME." );
+ const QObject* btn = sender();
+ ButtonList::Iterator it;
+ for ( it = buttons.begin(); it != buttons.end(); ++it ) {
+ if ( (*it).button() && (*it).button() == btn ) {
+ QString script;
+ script += "( cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; ";
+ script += + (*it).script();
+ script += " execute ";
+ script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " ";
+ script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " ";
+ script += " > /dev/null )";
+ ___MESSAGE___( "script: " << script.latin1() );
+ if ( (*it).script().isEmpty() || system( script.latin1() ) ) {
+ QMessageBox::warning( this,
+ tr( "Error" ),
+ tr( "Can't perform action!"),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
}
- else
- msg = tr( "Can't launch SALOME." ) + "\n" + tr( "runSalome file can not be found." );
+ return;
}
- else
- msg = tr( "Can't launch SALOME." ) + "\n" + tr( "Can't find environment file." );
- }
- QMessageBox::warning( this,
- tr( "Error" ),
- msg,
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
+ }
}
-
// ================================================================
/*!
* SALOME_InstallWizard::onAbout
}
}
else if ( aPage == readmePage ) {
- 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() );
+ ButtonList::Iterator it;
+ for ( it = buttons.begin(); it != buttons.end(); ++it ) {
+ if ( (*it).button() ) {
+ QString script;
+ script += "( cd " + QUOTE( QFileInfo( QDir::cleanDirPath( "./config_files/" ) ).absFilePath() ) + "; ";
+ script += + (*it).script();
+ script += " check_enabled ";
+ script += QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ) + " ";
+ script += QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ) + " ";
+ script += " > /dev/null )";
+ ___MESSAGE___( "script: " << script.latin1() );
+ (*it).button()->setEnabled( !(*it).script().isEmpty() && !system( script.latin1() ) );
+ }
+ }
finishButton()->setEnabled( true );
}
previousPage = aPage;
productsMap[item] = dep;
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::addFinishButton
+ * Add button for the <Finish> page
+ */
+// ================================================================
+void SALOME_InstallWizard::addFinishButton( const QString& label,
+ const QString& tooltip,
+ const QString& script)
+{
+ if ( !label.isEmpty() )
+ buttons.append( Button( label, tooltip, script ) );
+}
+// ================================================================
/*!
* SALOME_InstallWizard::polish
* Polishing of the widget - to set right initial size