-// File : SALOME_InstallWizard.cxx
+// File : SALOME_InstallWizard.cxx
// Created : Thu Dec 18 12:01:00 2002
-// Author : Vadim SANDLER
-// Project : PAL/SALOME
-// Module : InstallWizard
-// Copyright : 2004 CEA
-// $Header$
+// Author : Vadim SANDLER, Open CASCADE SAS (vadim.sandler@opencascade.com)
+// Project : SALOME
+// Module : Installation Wizard
+// Copyright : 2002-2009 CEA
+
+#include "globals.h"
#include "SALOME_InstallWizard.hxx"
#include "SALOME_ProductsView.hxx"
#include <qcheckbox.h>
#include <qsplitter.h>
#include <qlayout.h>
-#include <qfiledialog.h>
+#include <qfiledialog.h>
#include <qapplication.h>
-#include <qfileinfo.h>
-#include <qmessagebox.h>
-#include <qtimer.h>
+#include <qfileinfo.h>
+#include <qmessagebox.h>
+#include <qtimer.h>
#include <qvbox.h>
-#include <qwhatsthis.h>
+#include <qwhatsthis.h>
#include <qtooltip.h>
#include <qfile.h>
+#include <qthread.h>
+#include <qwaitcondition.h>
+#include <qmutex.h>
+#include <qstringlist.h>
+#include <qpopupmenu.h>
+#include <qregexp.h>
+#include <qradiobutton.h>
+#include <qbuttongroup.h>
+#include <qregexp.h>
+#include <qdir.h>
#ifdef WNT
#include <iostream.h>
#else
#include <unistd.h>
#include <algo.h>
+#include <sys/utsname.h>
#endif
#ifdef WNT
// ================================================================
/*!
- * DefineDependeces [ static ]
- * Defines list of dependancies as string separated by space symbols
+ * Script
+ * Helper class to generate shell command
*/
// ================================================================
-static QString DefineDependeces(MapProducts& theProductsMap) {
- QStringList aProducts;
+class Script
+{
+public:
+ Script( const QString& cmd = QString::null, const QString& sep = " " ) : mySeparator( sep )
+ {
+ append( cmd );
+ }
+ void append( const QString& cmd )
+ {
+ if ( !cmd.isEmpty() ) myList.append( cmd );
+ }
+ Script& operator<<( const QString& cmd )
+ {
+ append( cmd );
+ return *this;
+ }
+ QString script() const
+ {
+ return myList.join( mySeparator );
+ }
+ void clear()
+ {
+ myList.clear();
+ }
+private:
+ QStringList myList;
+ QString mySeparator;
+};
+
+// ================================================================
+/*!
+ * ProcessThread
+ * Class for executing system commands
+ */
+// ================================================================
+static QMutex myMutex(false);
+static QWaitCondition myWC;
+class ProcessThread: public QThread
+{
+ typedef QPtrList<QCheckListItem> ItemList;
+public:
+ ProcessThread( SALOME_InstallWizard* iw ) : QThread(), myWizard( iw ) { myItems.setAutoDelete( false ); }
+
+ void addCommand( QCheckListItem* item, const QString& cmd ) {
+ myItems.append( item );
+ myCommands.push_back( cmd );
+ }
+
+ bool hasCommands() const { return myCommands.count() > 0; }
+ void clearCommands() { myCommands.clear(); myItems.clear(); }
+
+ virtual void run() {
+ while ( hasCommands() ) {
+ ___MESSAGE___( "ProcessThread::run - Processing command : " << myCommands[ 0 ].latin1() );
+ int result = system( myCommands[ 0 ] ) / 256; // return code is <errno> * 256
+ ___MESSAGE___( "ProcessThread::run - Result : " << result );
+ QCheckListItem* item = myItems.first();
+ myCommands.pop_front();
+ myItems.removeFirst();
+ myMutex.lock();
+ SALOME_InstallWizard::postValidateEvent( myWizard, result, (void*)item );
+ if ( hasCommands() )
+ myWC.wait(&myMutex);
+ myMutex.unlock();
+ };
+ }
+
+private:
+ QStringList myCommands;
+ ItemList myItems;
+ SALOME_InstallWizard* myWizard;
+};
+
+// ================================================================
+/*!
+ * WarnDialog
+ * Warning dialog box
+ */
+// ================================================================
+class WarnDialog: public QDialog
+{
+ static WarnDialog* myDlg;
+ bool myCloseFlag;
+
+ WarnDialog( QWidget* parent )
+ : QDialog( parent, "WarnDialog", true, WDestructiveClose ) {
+ setCaption( tr( "Information" ) );
+ myCloseFlag = false;
+ QLabel* lab = new QLabel( tr( "Please, wait while checking native products configuration ..." ), this );
+ lab->setAlignment( AlignCenter );
+ lab->setFrameStyle( QFrame::Box | QFrame::Plain );
+ QVBoxLayout* l = new QVBoxLayout( this );
+ l->setMargin( 0 );
+ l->add( lab );
+ this->setFixedSize( lab->sizeHint().width() + 50,
+ lab->sizeHint().height() * 5 );
+ }
+ void accept() { return; }
+ void reject() { return; }
+ void closeEvent( QCloseEvent* e )
+ { if ( !myCloseFlag ) return;
+ e->accept();
+ QDialog::closeEvent( e );
+ }
+ ~WarnDialog() { myDlg = 0; }
+public:
+ static void showWarnDlg( QWidget* parent, bool show ) {
+ if ( show ) {
+ if ( !myDlg ) {
+ myDlg = new WarnDialog( parent );
+ QSize sh = myDlg->size();
+ myDlg->move( parent->x() + (parent->width()-sh.width())/2,
+ parent->y() + (parent->height()-sh.height())/2 );
+ myDlg->show();
+ }
+ myDlg->raise();
+ myDlg->setFocus();
+ }
+ else {
+ if ( myDlg ) {
+ myDlg->myCloseFlag = true;
+ myDlg->close();
+ }
+ }
+ }
+ static bool isWarnDlgShown() { return myDlg != 0; }
+};
+WarnDialog* WarnDialog::myDlg = 0;
+
+// ================================================================
+/*!
+ * InstallInfo
+ * Installation progress info window class
+ */
+// ================================================================
+class InstallInfo : public QTextEdit
+{
+public:
+ InstallInfo( QWidget* parent ) : QTextEdit( parent ), finished( false ) {}
+ void setFinished( const bool f ) { finished = f; }
+protected:
+ QPopupMenu* createPopupMenu( const QPoint& )
+ {
+ int para1, col1, para2, col2;
+ getSelection(¶1, &col1, ¶2, &col2);
+ bool allSelected = hasSelectedText() &&
+ para1 == 0 && para2 == paragraphs()-1 && col1 == 0 && col2 == paragraphLength(para2);
+ QPopupMenu* popup = new QPopupMenu( this );
+ int id = popup->insertItem( tr( "&Copy" ) );
+ popup->setItemEnabled( id, hasSelectedText() );
+ popup->connectItem ( id, this, SLOT( copy() ) );
+ id = popup->insertItem( tr( "Select &All" ) );
+ popup->setItemEnabled( id, (bool)text().length() && !allSelected );
+ popup->connectItem ( id, this, SLOT( selectAll() ) );
+ if ( finished ) {
+ QWidget* p = parentWidget();
+ while ( p && !p->inherits( "SALOME_InstallWizard" ) )
+ p = p->parentWidget();
+ if ( p && p->inherits( "SALOME_InstallWizard" ) ) {
+ popup->insertSeparator();
+ id = popup->insertItem( tr( "&Save Log" ) );
+ popup->setItemEnabled( id, (bool)text().length() );
+ popup->connectItem ( id, (SALOME_InstallWizard*)p, SLOT( saveLog() ) );
+ }
+ }
+ return popup;
+ }
+private:
+ bool finished;
+};
+
+// ================================================================
+/*!
+ * getAllProducts [ static ]
+ * Defines list of all products as a string separated by space symbols
+ */
+// ================================================================
+static QString getAllProducts(MapProducts& theProductsMap)
+{
+ QStringList aModules, aPrereqs;
for ( MapProducts::Iterator mapIter = theProductsMap.begin(); mapIter != theProductsMap.end(); ++mapIter ) {
QCheckListItem* item = mapIter.key();
Dependancies dep = mapIter.data();
- QStringList deps = dep.getDependancies();
- for (int i = 0; i<(int)deps.count(); i++ ) {
- if ( !aProducts.contains( deps[i] ) )
- aProducts.append( deps[i] );
+ QString curModule = item->text(0);
+ if ( !aModules.contains( curModule ) && !aPrereqs.contains( curModule ) ) {
+ if ( dep.getType() == "component" ) {
+ aModules.append( curModule );
+ aModules.append( curModule + "_src" );
+ }
+ else {
+ aPrereqs.append( curModule );
+ aPrereqs.append( curModule + "_src" );
+ }
}
- if ( !aProducts.contains( item->text(0) ) )
- aProducts.append( item->text(0) );
}
- return aProducts.join(" ");
+ return QStringList(aPrereqs+aModules).join(" ");
+}
+
+// ================================================================
+/*!
+ * setAboutInfo [ static ]
+ * Sets 'what's this' and 'tooltip' information for the widget
+ */
+// ================================================================
+static void setAboutInfo( QWidget* widget, const QString& tip )
+{
+ QWhatsThis::add( widget, tip );
+ QToolTip::add ( widget, tip );
}
#define QUOTE(arg) QString("'") + QString(arg) + QString("'")
/* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- T H E O L D I M P L E M E N T A T I O N
+ T H E O L D I M P L E M E N T A T I O N
static QString DefineDependeces(MapProducts& theProductsMap, QCheckListItem* product ){
QStringList aProducts;
if ( theProductsMap.contains( product ) ) {
QFileInfo fi( aDir.left( start ) );
if ( !fi.exists() ) {
// VSR: Create directory and set permissions to allow other users to remove it
- QString script = "mkdir " + fi.absFilePath();
- script += "; chmod 777 " + fi.absFilePath();
- script += " > /dev/null";
- if ( system( script.latin1() ) )
+ Script script;
+ script << "mkdir" << QUOTE( fi.absFilePath() ) << ">& /dev/null" << "&&";
+ script << "chmod 777" << QUOTE( fi.absFilePath() ) << ">& /dev/null";
+ ___MESSAGE___( "script = " << script.script().latin1() );
+ if ( system( script.script().latin1() ) )
return false;
// VSR: Remember the top of the created directory (to remove it in the end of the installation)
if ( theCreated.isNull() )
}
if ( !QFileInfo( aDir ).exists() ) {
// VSR: Create directory, other users should NOT have possibility to remove it!!!
- QString script = "mkdir " + aDir;
- script += " > /dev/null";
- if ( system( script.latin1() ) )
+ Script script;
+ script << "mkdir" << QUOTE( aDir ) << ">& /dev/null";
+ ___MESSAGE___( "script = " << script.script().latin1() );
+ if ( system( script.script().latin1() ) )
return false;
// VSR: Remember the top of the created directory (to remove it in the end of the installation)
if ( theCreated.isNull() )
return false;
}
+// ================================================================
+/*!
+ * makeTitle
+ * Creates HTML-wrapped title text
+ */
+// ================================================================
+static QString makeTitle( const QString& text, const QString& separator = " ", bool fl = true )
+{
+ QStringList words = QStringList::split( separator, text );
+ if ( fl ) {
+ for ( uint i = 0; i < words.count(); i++ )
+ words[i] = QString( "<font color=red>%1</font>" ).arg( words[i].left(1) ) + words[i].mid(1);
+ }
+ else {
+ if ( words.count() > 0 )
+ words[0] = QString( "<font color=red>%1</font>" ).arg( words[0] );
+ if ( words.count() > 1 )
+ words[words.count()-1] = QString( "<font color=red>%1</font>" ).arg( words[words.count()-1] );
+ }
+ QString res = words.join( separator );
+ if ( !res.isEmpty() )
+ res = QString( "<b>%1</b>" ).arg( res );
+ return res;
+}
+
+// ================================================================
+/*!
+ * QMyCheckBox class : custom check box
+ * The only goal is to give access to the protected setState() method
+ */
+// ================================================================
+class QMyCheckBox: public QCheckBox
+{
+public:
+ QMyCheckBox( const QString& text, QWidget* parent, const char* name = 0 ) : QCheckBox ( text, parent, name ) {}
+ void setState ( ToggleState s ) { QCheckBox::setState( s ); }
+};
+
+// ================================================================
+/*!
+ * AboutDlg
+ * "About dialog box.
+ */
+// ================================================================
+class AboutDlg: public QDialog
+{
+public:
+ AboutDlg( SALOME_InstallWizard* parent ) : QDialog( parent, "About dialog box", true )
+ {
+ // caption
+ setCaption( QString( "About %1" ).arg( parent->getIWName() ) );
+ // palette
+ QPalette pal = palette();
+ QColorGroup cg = pal.active();
+ cg.setColor( QColorGroup::Foreground, Qt::darkBlue );
+ cg.setColor( QColorGroup::Background, Qt::white );
+ pal.setActive( cg ); pal.setInactive( cg ); pal.setDisabled( cg );
+ setPalette( pal );
+ // layout
+ QGridLayout* main = new QGridLayout( this, 1, 1, 11, 6 );
+ // image
+ QLabel* logo = new QLabel( this, "logo" );
+ logo->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
+ logo->setMinimumSize( 32, 32 ); logo->setMaximumSize( 32, 32 );
+ logo->setPaletteBackgroundColor( QColor( 234, 250, 234 ) );
+ logo->setFrameStyle( QLabel::NoFrame | QLabel::Plain );
+ logo->setPixmap( pixmap( pxAbout ) );
+ logo->setScaledContents( false );
+ logo->setAlignment( QLabel::AlignCenter );
+ // decoration
+ QLabel* decorLeft = new QLabel( this, "decorLeft" );
+ decorLeft->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding ) );
+ decorLeft->setMinimumWidth( 32 ); decorLeft->setMaximumWidth( 32 );
+ decorLeft->setPaletteBackgroundColor( QColor( 234, 250, 234 ) );
+ decorLeft->setScaledContents( false );
+ QLabel* decorTop = new QLabel( this, "decorTop" );
+ decorTop->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ decorTop->setMinimumHeight( 32 ); decorTop->setMaximumHeight( 32 );
+ decorTop->setPaletteBackgroundColor( QColor( 234, 250, 234 ) );
+ decorTop->setScaledContents( false );
+ // contents
+ QLabel* title = new QLabel( this, "title" );
+ QString tlt = parent->getIWName();
+ title->setText( makeTitle( tlt ) );
+ QLabel* version = new QLabel( this, "version" );
+ version->setText( QString( "<b>Version</b>: %1.%1.%1" ).arg( __IW_VERSION_MAJOR__ ) \
+ .arg( __IW_VERSION_MINOR__ ) \
+ .arg( __IW_VERSION_PATCH__ ) );
+ QLabel* copyright = new QLabel( this, "copyright" );
+ copyright->setText( "<b>Copyright</b> © 2007-2009 CEA/DEN" );
+ QFont font = title->font();
+ font.setPointSize( (int)( font.pointSize() * 1.8 ) );
+ title->setFont( font );
+ QFrame* line = new QFrame( this, "line" );
+ line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ QLabel* url = new QLabel( this, "url" );
+ url->setText( makeTitle( "www.salome-platform.org", ".", false ) );
+ url->setAlignment( AlignRight );
+ font = version->font();
+ font.setPointSize( (int)( font.pointSize() / 1.2 ) );
+ version->setFont( font );
+ copyright->setFont( font );
+ url->setFont( font );
+ // layout
+ main->addWidget( logo, 0, 0 );
+ main->addMultiCellWidget( decorLeft, 1, 5, 0, 0 );
+ main->addWidget( decorTop, 0, 1 );
+ main->addWidget( title, 1, 1 );
+ main->addWidget( version, 2, 1 );
+ main->addWidget( copyright, 3, 1 );
+ main->addWidget( line, 4, 1 );
+ main->addWidget( url, 5, 1 );
+ // resize
+ QFontMetrics fm( title->font() );
+ int width = (int)( fm.width( tlt ) * 1.5 );
+ title->setMinimumWidth( width );
+// setMaximumSize( minimumSize() );
+ }
+ void mousePressEvent( QMouseEvent* )
+ {
+ accept();
+ }
+};
+
// ================================================================
/*!
* SALOME_InstallWizard::SALOME_InstallWizard
* Constructor
*/
// ================================================================
-SALOME_InstallWizard::SALOME_InstallWizard(QString aXmlFileName)
- : InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ),
- helpWindow( NULL ),
- moreMode( false ),
- previousPage( 0 ),
- exitConfirmed( false )
+SALOME_InstallWizard::SALOME_InstallWizard(const QString& aXmlFileName,
+ const QString& aTargetDir,
+ const QString& aTmpDir,
+ const bool aForceSrc,
+ const bool aSingleDir)
+ : InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ),
+ helpWindow( NULL ),
+ moreMode( false ),
+ previousPage( 0 ),
+ exitConfirmed( false ),
+ hasErrors( false )
{
- myIWName = tr( "Installation Wizard" );
- tmpCreated = QString::null;
- xmlFileName = aXmlFileName;
- QFont fnt = font(); fnt.setPointSize( 14 ); fnt.setBold( true );
+ myIWName = tr( "Installation Wizard" );
+ tmpCreated = QString::null;
+ xmlFileName = aXmlFileName;
+ myTargetPath = aTargetDir;
+ myTmpPath = aTmpDir;
+ forceSrc = aForceSrc;
+ singleDir = aSingleDir;
+ stateChanged = true;
+
+ QDir rootDir( rootDirPath() );
+ binPath = rootDir.filePath( "Products/BINARIES" );
+ srcPath = rootDir.filePath( "Products/SOURCES" );
+ oneProdDirName = "PRODUCTS";
+
+ commonPlatform = "Debian 3.1";
+
+ //
+ // get XML filename and current platform
+ //
+ // ... get current platform
+ curPlatform = currentPlatform().join(" ");
+ //cout << "curOS = " << curPlatform << endl;
+ refPlatform = "";
+ // ... check XML and platform definition
+ getXmlAndPlatform();
+
+ // set application font
+ QFont fnt = font();
+ fnt.setPointSize( 14 );
+ fnt.setBold( true );
setTitleFont( fnt );
// set icon
- setIcon( QPixmap( ( const char** ) image0_data ) );
+ setIcon( pixmap( pxIcon ) );
// enable sizegrip
setSizeGripEnabled( true );
-
+
// add logo
- addLogo( QPixmap( (const char**)image1_data ) );
-
+ addLogo( pixmap( pxLogo ) );
+
// set defaults
- setVersion( "1.2" );
- setCaption( tr( "PAL/SALOME %1" ).arg( myVersion ) );
- setCopyright( tr( "Copyright (C) 2004 CEA" ) );
- setLicense( tr( "All right reserved" ) );
- setOS( "" );
-
-#ifdef DEBUG
- cout << "Config. file : " << xmlFileName << endl;
-#endif
+ setVersion( "5.1.3" );
+ setCaption( tr( "SALOME %1" ).arg( myVersion ) );
+ setCopyright( tr( "<h5>Copyright © 2007-2009 CEA/DEN, EDF R&D, OPEN CASCADE<br></h5>"
+ "<h5>Copyright © 2003-2007 OPEN CASCADE,<br>EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D,<br>LEG, PRINCIPIA R&D, BUREAU VERITAS</h5>" ));
+ setLicense( tr( "<h5>GNU LGPL</h5>" ) );
- // xml reader
- QFile xmlfile(xmlFileName);
- if ( xmlfile.exists() ) {
- QXmlInputSource source( &xmlfile );
- QXmlSimpleReader reader;
+ ___MESSAGE___( "Configuration file : " << xmlFileName.latin1() );
+ ___MESSAGE___( "Target directory : " << myTargetPath.latin1() );
+ ___MESSAGE___( "Temporary directory: " << myTmpPath.latin1() );
- StructureParser* handler = new StructureParser( this );
- reader.setContentHandler( handler );
- reader.parse( source );
- }
+ //
+ // xml reader
+ //
+ StructureParser* parser = new StructureParser( this );
+ parser->readXmlFile(xmlFileName);
+ // create instance of class for starting shell script to get available disk space
+ diskSpaceProc = new QProcess( this, "procDiskSpace" );
// create instance of class for starting shell install script
shellProcess = new QProcess( this, "shellProcess" );
+ // create instance of class for starting shell script to modify SALOME *.la files
+ modifyLaProc = new QProcess( this, "modifyLaProc" );
+ // create instance of class for starting shell script to check Fortran libraries
+ checkFLibProc = new QProcess( this, "checkFLibProc" );
// create introduction page
setupIntroPage();
+ // create page to select installation type
+ setupTypePage();
+ // create page to select the reference installation platform (if necessary)
+ setupPlatformPage();
+ // create directories page
+ setupDirPage();
// create products page
setupProductsPage();
// create prestart page
setupProgressPage();
// create readme page
setupReadmePage();
-
+
// common buttons
- QWhatsThis::add( backButton(), tr( "Returns to the previous step of the installation procedure" ) );
- QToolTip::add ( backButton(), tr( "Returns to the previous step of the installation procedure" ) );
- QWhatsThis::add( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
- QToolTip::add ( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
- QWhatsThis::add( finishButton(), tr( "Finishes installation and quits program" ) );
- QToolTip::add ( finishButton(), tr( "Finishes installation and quits program" ) );
- QWhatsThis::add( cancelButton(), tr( "Cancels installation and quits program" ) );
- QToolTip::add ( cancelButton(), tr( "Cancels installation and quits program" ) );
- QWhatsThis::add( helpButton(), tr( "Displays help information window" ) );
- QToolTip::add ( helpButton(), tr( "Displays help information window" ) );
-
+ setAboutInfo( backButton(), tr( "Return to the previous step\nof the installation procedure" ) );
+ setAboutInfo( nextButton(), tr( "Move to the next step\nof the installation procedure" ) );
+ setAboutInfo( finishButton(), tr( "Finish the installation and quit the program" ) );
+ setAboutInfo( cancelButton(), tr( "Cancel the installation and quit the program" ) );
+ setAboutInfo( helpButton(), tr( "Show the help information" ) );
+
// common signals connections
connect( this, SIGNAL( selected( const QString& ) ),
- this, SLOT( pageChanged( const QString& ) ) );
- connect( this, SIGNAL( helpClicked() ), this, SLOT( helpClicked() ) );
- // catch signals from launched script
+ this, SLOT( pageChanged( const QString& ) ) );
+ connect( this, SIGNAL( helpClicked() ), this, SLOT( helpClicked() ) );
+ connect( this, SIGNAL( aboutClicked() ), this, SLOT( onAbout() ) );
+
+ // catch signals from launched diskSpaceProc
+ connect( diskSpaceProc, SIGNAL( processExited() ), this, SLOT( updateAvailableSpace() ) );
+ // catch signals from launched shellProcess
connect(shellProcess, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) );
connect(shellProcess, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) );
connect(shellProcess, SIGNAL( processExited() ), this, SLOT( productInstalled() ) );
connect(shellProcess, SIGNAL( wroteToStdin() ), this, SLOT( wroteToStdin() ) );
+ // catch signals from launched modifyLaProc
+ connect(modifyLaProc, SIGNAL( readyReadStdout() ), this, SLOT( readFromStdout() ) );
+ connect(modifyLaProc, SIGNAL( readyReadStderr() ), this, SLOT( readFromStderr() ) );
+ connect(modifyLaProc, SIGNAL( processExited() ), this, SLOT( checkModifyLaResult() ) );
+ // catch signals from launched checkFLibProc
+ connect(checkFLibProc, SIGNAL( processExited() ), this, SLOT( checkFLibResult() ) );
+
+ // create validation thread
+ myThread = new ProcessThread( this );
+
+ // show about button
+ setAboutIcon( pixmap( pxAbout ) );
+ showAboutBtn( true );
}
// ================================================================
/*!
SALOME_InstallWizard::~SALOME_InstallWizard()
{
shellProcess->kill(); // kill it for sure
- QString script = "kill -9 ";
int PID = (int)shellProcess->processIdentifier();
if ( PID > 0 ) {
- script += QString::number( PID );
- script += " > /dev/null";
-#ifdef DEBUG
- cout << "script: "<< script.latin1() << endl;
-#endif
- if ( system( script.latin1() ) ) {
+ Script script;
+ script << "kill -9" << QString::number( PID ) << ">& /dev/null";
+ ___MESSAGE___( "script: " << script.script().latin1() );
+ if ( system( script.script().latin1() ) ) {
+ // error
+ }
+ }
+ delete myThread;
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::getBasePlatform
+ * Determine the base platform for binaries installation
+ */
+// ================================================================
+QString SALOME_InstallWizard::getBasePlatform()
+{
+ QString aBasePlt = "";
+ if ( platformsMap.find( curPlatform ) != platformsMap.end() )
+ aBasePlt = curPlatform;
+ else
+ aBasePlt = commonPlatform;
+ return aBasePlt;
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::currentPlatform
+ * Tries to determine the current user's operating system
+ */
+// ================================================================
+QStringList SALOME_InstallWizard::currentPlatform()
+{
+ // file parsing
+ QString platName, platVersion, platArch;
+ QString osFileName = "/etc/issue";
+ if ( QFile::exists( osFileName ) ) {
+ QFile file( osFileName );
+ if ( file.open( IO_ReadOnly ) ) {
+ QTextStream stream( &file );
+ QStringList lines = QStringList::split( "\n", stream.read() );
+ file.close();
+ for ( uint i = 0; i < lines.count(); i++ ) {
+ QString str = lines[i];
+ if ( str.isEmpty() ) continue;
+ // parse line
+ QRegExp regvar = QRegExp( "(.*)\\s+[^\\s]*[R|r]elease[^\\s]*\\s+([\\d.]*)" );
+ int pos = regvar.search( str );
+ if ( pos == -1 ) {
+ regvar = QRegExp( "(.*)\\s+[^\\s]*[L|l][I|i][N|n][U|u][X|x][^\\s]*(.*)\\s+([\\d.]*)\\s+" );
+ pos = regvar.search( str );
+ }
+ if ( pos >= 0 ) {
+ QStringList name;
+ for ( int i = 1; i < regvar.numCaptures(); i++ )
+ name.append( regvar.cap( i ) );
+
+ // retrieve platform name
+ platName = QStringList::split( " ", name.join( " " ) ).join( " " );
+ platName = platName.replace( "Linux", "" ).replace( "linux", "" ).replace( "LINUX", "" ).stripWhiteSpace();
+ platName = platName.replace( "Welcome to", "" ).stripWhiteSpace();
+ platName = QStringList::split( " ", platName ).join( " " );
+ // retrieve platform version number
+ platVersion = regvar.cap( regvar.numCaptures() );
+ // retrieve platform
+ utsname uname_data;
+ uname( &uname_data );
+ if ( QString( uname_data.machine ) == "x86_64" )
+ platArch = "64bit";
+ break;
+ }
+ }
+ }
+ }
+ QStringList vals;
+ if ( !platName.isEmpty() ) vals.append( platName );
+ if ( !platVersion.isEmpty() ) vals.append( platVersion );
+ if ( !platArch.isEmpty() ) vals.append( platArch );
+ return vals;
+}
+
+// ================================================================
+/*!
+ * SALOME_InstallWizard::rootDirPath
+ * Get application root dir
+ */
+// ================================================================
+QString SALOME_InstallWizard::rootDirPath()
+{
+ static QString rootDir;
+ if ( rootDir.isEmpty() ) {
+ QDir appDir( qApp->applicationDirPath() );
+ appDir.cdUp();
+ rootDir = appDir.absPath();
+ }
+ return rootDir;
+}
+
+// ================================================================
+/*!
+ * SALOME_InstallWizard::getPlatformBinPath
+ * Get platform binaries path
+ */
+// ================================================================
+QString SALOME_InstallWizard::getPlatformBinPath( const QString& plt ) const
+{
+ return QDir::cleanDirPath( getBinPath() + "/" + QStringList::split( " ", plt ).join( "_" ) );
+}
+
+// ================================================================
+/*!
+ * SALOME_InstallWizard::getXmlMap
+ * Creates a map of the supported operating systems and
+ * corresponding XML files.
+ */
+// ================================================================
+MapXmlFiles SALOME_InstallWizard::getXmlMap( const QString& aXmlFileName )
+{
+ MapXmlFiles xmlMap;
+ QStringList xmlList;
+ if ( !aXmlFileName.isEmpty() )
+ xmlList.append( QFileInfo( aXmlFileName ).absFilePath() );
+ else {
+ QDir dir( rootDirPath() );
+ QStringList entries = dir.entryList( "*.xml", QDir::Files | QDir::Readable );
+ if ( entries.remove( "config.xml" ) )
+ entries.append( "config.xml" );
+ for ( uint i = 0; i < entries.count(); i++ )
+ xmlList.append( QDir( rootDirPath() ).filePath( entries[i] ) );
+ }
+ // XML files parsing
+ QFile file;
+ QDomDocument doc( "xml_doc" );
+ QDomElement docElem;
+ QDomNodeList nodeList;
+ QDomNode node;
+ QDomElement elem;
+ QString platforms = "";
+ QStringList platList;
+ for ( uint i = 0; i < xmlList.count(); i++ ) {
+ file.setName( xmlList[i] );
+ if ( !doc.setContent( &file ) ) {
+ file.close();
+ continue;
+ }
+ file.close();
+
+ docElem = doc.documentElement();
+ nodeList = docElem.elementsByTagName( "config" );
+ if ( nodeList.count() == 0 )
+ continue;
+ node = nodeList.item( 0 );
+ if ( node.isElement() ) {
+ elem = node.toElement();
+ if ( elem.attribute( "platforms" ) ) {
+ platforms = elem.attribute( "platforms" ).stripWhiteSpace();
+ QStringList platList = QStringList::split( ",", platforms );
+ for ( uint j = 0; j < platList.count(); j++ ) {
+ QString platform = platList[j].stripWhiteSpace();
+ if ( !platform.isEmpty() && xmlMap.find( platform ) == xmlMap.end() )
+ xmlMap[ platList[j] ] = xmlList[i];
+ }
+ }
+ }
+ }
+ return xmlMap;
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::checkXmlAndPlatform
+ * Check XML file and current platform definition
+ */
+// ================================================================
+void SALOME_InstallWizard::getXmlAndPlatform()
+{
+ MapXmlFiles xmlMap;
+ if ( xmlFileName.isEmpty() ) {
+ xmlMap = getXmlMap();
+ if ( !curPlatform.isEmpty() ) {
+ // try to get XML file for current platform
+ if ( xmlMap.find( curPlatform ) != xmlMap.end() ) {
+ xmlFileName = xmlMap[ curPlatform ];
+ QFileInfo fibp( getPlatformBinPath( curPlatform ) );
+ if ( !fibp.isDir() ) {
+ warnMsg = tr( "Binaries are absent for current platform" );
+ }
+ platformsMap = xmlMap;
+ }
+ else {
+ platformsMap = xmlMap;
+ warnMsg = tr( "Your Linux platform is not supported by this SALOME package" );
+ }
+ }
+ else {
+ // get all supported platforms
+ platformsMap = xmlMap;
+ warnMsg = tr( "Installation Wizard can't identify target Linux platform" );
+ }
+ }
+ else {
+ xmlMap = getXmlMap( xmlFileName );
+ if ( !curPlatform.isEmpty() ) {
+ // check that the user's XML file supports current platform
+ if ( xmlMap.find( curPlatform ) == xmlMap.end() ) {
+ platformsMap = getXmlMap();
+ MapXmlFiles::Iterator it;
+ for ( it = xmlMap.begin(); it != xmlMap.end(); ++it )
+ platformsMap.insert( it.key(), it.data(), true );
+ warnMsg = tr( "The given configuration file doesn't support your Linux platform" );
+ }
+ else {
+ platformsMap = xmlMap;
+ }
+ }
+ else {
+ // get all supported platforms
+ platformsMap = getXmlMap();
+ MapXmlFiles::Iterator it;
+ for ( it = xmlMap.begin(); it != xmlMap.end(); ++it )
+ platformsMap.insert( it.key(), it.data(), true );
+ warnMsg = tr( "Installation Wizard can't define your Linux platform" );
}
}
}
// ================================================================
void SALOME_InstallWizard::closeEvent( QCloseEvent* ce )
{
+ if ( WarnDialog::isWarnDlgShown() ) {
+ ce->ignore();
+ return;
+ }
if ( !exitConfirmed ) {
- if ( QMessageBox::information( this,
- tr( "Exit" ),
- tr( "Do you want to quit %1?" ).arg( getIWName() ),
- tr( "&Yes" ),
+ if ( QMessageBox::information( this,
+ tr( "Exit" ),
+ tr( "Do you want to quit %1?" ).arg( getIWName() ),
+ tr( "&Yes" ),
tr( "&No" ),
QString::null,
0,
{
// create page
introPage = new QWidget( this, "IntroPage" );
- QGridLayout* pageLayout = new QGridLayout( introPage );
+ QGridLayout* pageLayout = new QGridLayout( introPage );
pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
// create logo picture
- QPixmap logo( (const char**)SALOME_Logo_xpm );
logoLab = new QLabel( introPage );
- logoLab->setPixmap( logo );
+ logoLab->setPixmap( pixmap( pxBigLogo ) );
logoLab->setScaledContents( false );
- logoLab->setFrameStyle( QLabel::Plain | QLabel::Box );
+ logoLab->setFrameStyle( QLabel::Plain | QLabel::NoFrame );
logoLab->setAlignment( AlignCenter );
// create version box
QVBox* versionBox = new QVBox( introPage ); versionBox->setSpacing( 6 );
addPage( introPage, tr( "Introduction" ) );
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::setupTypePage
+ * Creates installation types page
+ */
+// ================================================================
+void SALOME_InstallWizard::setupTypePage()
+{
+ // create page
+ typePage = new QWidget( this, "TypePage" );
+ QGridLayout* pageLayout = new QGridLayout( typePage );
+ pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
+ // create installation type button group
+ buttonGrp = new QButtonGroup( typePage );
+ buttonGrp->setFrameShape(QButtonGroup::NoFrame);
+ QGridLayout* buttonGrpLayout = new QGridLayout( buttonGrp );
+ buttonGrpLayout->setMargin( 0 ); buttonGrpLayout->setSpacing( 6 );
+ QSpacerItem* spacer1 = new QSpacerItem( 16, 50, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ QSpacerItem* spacer2 = new QSpacerItem( 16, 50, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ QLabel* selectLab = new QLabel( tr( "Select a type of the installation:" ), buttonGrp );
+ QSpacerItem* spacer3 = new QSpacerItem( 20, 20, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ // ... 'install binaries' layout
+ QGridLayout* binLayout = new QGridLayout( 2, 2, 0 );
+ binBtn = new QRadioButton( tr( "Install binaries" ), buttonGrp );
+ QFont rbFont = binBtn->font();
+ rbFont.setBold( true );
+ binBtn->setFont( rbFont );
+ QSpacerItem* spacer4 = new QSpacerItem( 16, 16, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ QLabel* binLab = new QLabel( tr( "- all the binaries and sources of the chosen SALOME modules will be installed.\n"
+ "- all the binaries of the chosen prerequisites will be installed." ),
+ buttonGrp );
+ binLayout->addMultiCellWidget( binBtn, 0, 0, 0, 1 );
+ binLayout->addItem ( spacer4, 1, 0 );
+ binLayout->addWidget ( binLab, 1, 1 );
+ // ... 'install sources' layout
+ QGridLayout* srcLayout = new QGridLayout( 2, 2, 0 );
+ srcBtn = new QRadioButton( tr( "Install sources" ), buttonGrp );
+ srcBtn->setFont( rbFont );
+ QSpacerItem* spacer5 = new QSpacerItem( 16, 16, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ QLabel* srcLab = new QLabel( tr( "- all the sources of the chosen modules and prerequisites will be installed without\ncompilation." ),
+ buttonGrp );
+ srcLayout->addMultiCellWidget( srcBtn, 0, 0, 0, 1 );
+ srcLayout->addItem ( spacer5, 1, 0 );
+ srcLayout->addWidget ( srcLab, 1, 1 );
+ // ... 'install sources and make compilation' layout
+ QGridLayout* srcCompileLayout = new QGridLayout( 3, 3, 0 );
+ srcCompileBtn = new QRadioButton( tr( "Install sources and make a compilation" ), buttonGrp );
+ srcCompileBtn->setFont( rbFont );
+ QSpacerItem* spacer6 = new QSpacerItem( 16, 16, QSizePolicy::Fixed, QSizePolicy::Minimum );
+ QLabel* srcCompileLab1 = new QLabel( tr( "- all the sources of the chosen modules and prerequisites will be installed and\ncompiled." ),
+ buttonGrp );
+ QLabel* srcCompileLab2 = new QLabel( tr( "Note:" ),
+ buttonGrp );
+ QFont noteFont = srcCompileLab2->font();
+ noteFont.setUnderline( true );
+ srcCompileLab2->setFont( noteFont );
+ srcCompileLab2->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
+ srcCompileLab2->setAlignment( Qt::AlignHCenter | Qt::AlignTop );
+ QLabel* srcCompileLab3 = new QLabel( " " +
+ tr( "it is a long time operation and it can take more than 24 hours depending\n on the computer." ),
+ buttonGrp );
+ removeSrcBtn = new QCheckBox( tr( "Remove sources and temporary files after compilation" ), typePage );
+ setAboutInfo( removeSrcBtn, tr( "Check this option if you want to remove sources of the products\nwith all the temporary files after build finishing" ) );
+ removeSrcBtn->setChecked( false );
+ removeSrcBtn->setEnabled( false );
+ rmSrcPrevState = removeSrcBtn->isChecked();
+
+ srcCompileLayout->addMultiCellWidget( srcCompileBtn, 0, 0, 0, 2 );
+ srcCompileLayout->addMultiCell ( spacer6, 1, 2, 0, 0 );
+ srcCompileLayout->addMultiCellWidget( srcCompileLab1, 1, 1, 1, 2 );
+ srcCompileLayout->addWidget ( srcCompileLab2, 2, 1 );
+ srcCompileLayout->addWidget ( srcCompileLab3, 2, 2 );
+ srcCompileLayout->addMultiCellWidget( removeSrcBtn, 3, 3, 1, 2 );
+ // layout widgets in the button group
+ buttonGrpLayout->addItem ( spacer1, 0, 1 );
+ buttonGrpLayout->addMultiCellWidget( selectLab, 1, 1, 0, 1 );
+ buttonGrpLayout->addMultiCell ( spacer3, 2, 4, 0, 0 );
+ buttonGrpLayout->addLayout ( binLayout, 2, 1 );
+ buttonGrpLayout->addLayout ( srcLayout, 3, 1 );
+ buttonGrpLayout->addLayout ( srcCompileLayout, 4, 1 );
+ buttonGrpLayout->addItem ( spacer2, 5, 1 );
+ // layout button group at the page
+ pageLayout->addWidget( buttonGrp, 0, 0 );
+ // connecting signals
+ connect( buttonGrp, SIGNAL( clicked(int) ), this, SLOT ( onButtonGroup(int) ) );
+ // adding page
+ addPage( typePage, tr( "Installation type" ) );
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::setupPlatformPage
+ * Creates platforms page, if necessary
+ */
+// ================================================================
+void SALOME_InstallWizard::setupPlatformPage()
+{
+ // create page
+ platformsPage = new QWidget( this, "PlatformsPage" );
+ QGridLayout* pageLayout = new QGridLayout( platformsPage );
+ pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
+ // create warning labels
+ QLabel* warnLab2 = new QLabel( tr( "WARNING!" ), platformsPage );
+ warnLab2->setAlignment( Qt::AlignHCenter );
+ QFont fnt = warnLab2->font();
+ fnt.setBold( true );
+ warnLab2->setFont( fnt );
+ warnLab = new QLabel( warnMsg, platformsPage );
+ warnLab->setAlignment( Qt::AlignHCenter | Qt::WordBreak );
+ warnLab3 = new QLabel( tr( "If you want to proceed anyway, please select platform from the following list:" ),
+ platformsPage );
+ warnLab3->setAlignment( Qt::AlignHCenter | Qt::WordBreak );
+ // create button group
+ platBtnGrp = new QButtonGroup( platformsPage );
+ platBtnGrp->setFrameShape(QButtonGroup::LineEditPanel);
+ platBtnGrp->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred ) );
+ QVBoxLayout* platBtnGrpLayout = new QVBoxLayout( platBtnGrp );
+ platBtnGrpLayout->setMargin( 11 ); platBtnGrpLayout->setSpacing( 6 );
+ // create platforms radio-buttons
+ QString plat;
+ MapXmlFiles::Iterator it;
+ for ( it = platformsMap.begin(); it != platformsMap.end(); ++it ) {
+ plat = it.key();
+ QRadioButton* rb = new QRadioButton( plat, platBtnGrp, plat );
+ platBtnGrpLayout->addWidget( rb );
+ }
+ // create spacers
+ QSpacerItem* spacer1 = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ QSpacerItem* spacer2 = new QSpacerItem( 16, 20, QSizePolicy::Minimum, QSizePolicy::Expanding );
+
+ // layout widgets on page
+ pageLayout->addItem ( spacer1, 0, 0 );
+ pageLayout->addWidget ( warnLab2, 1, 0 );
+ pageLayout->addWidget ( warnLab, 2, 0 );
+ pageLayout->addWidget ( warnLab3, 3, 0 );
+ pageLayout->addItem ( spacer2, 4, 0 );
+ pageLayout->addMultiCellWidget( platBtnGrp, 0, 4, 1, 1 );
+
+ // connecting signals
+ connect( platBtnGrp, SIGNAL( clicked(int) ), this, SLOT ( onButtonGroup(int) ) );
+
+ // adding page
+ addPage( platformsPage, tr( "Installation platform" ) );
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::setupDirPage
+ * Creates directories page
+ */
+// ================================================================
+void SALOME_InstallWizard::setupDirPage()
+{
+ // create page
+ dirPage = new QWidget( this, "DirPage" );
+ QGridLayout* pageLayout = new QGridLayout( dirPage );
+ pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
+ QSpacerItem* spacer1 = new QSpacerItem( 16, 50, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ QSpacerItem* spacer2 = new QSpacerItem( 16, 50, QSizePolicy::Minimum, QSizePolicy::Expanding );
+ // target directory
+ QGridLayout* targetLayout = new QGridLayout( 2, 2, 0 );
+ QLabel* targetLab = new QLabel( tr( "Set a target directory to install SALOME platform:" ), dirPage );
+ targetFolder = new QLineEdit( dirPage );
+ targetBtn = new QPushButton( tr( "Browse..." ), dirPage );
+ setAboutInfo( targetBtn, tr( "Click this button to browse\nthe installation directory" ) );
+ targetLayout->addMultiCellWidget( targetLab, 0, 0, 0, 1 );
+ targetLayout->addWidget ( targetFolder, 1, 0 );
+ targetLayout->addWidget ( targetBtn, 1, 1 );
+ // temporary directory
+ QGridLayout* tempLayout = new QGridLayout( 2, 2, 0 );
+ QLabel* tempLab = new QLabel( tr( "Set a directory that should be used for temporary SALOME files:" ), dirPage );
+ tempFolder = new QLineEdit( dirPage );
+ tempBtn = new QPushButton( tr( "Browse..." ), dirPage );
+ setAboutInfo( tempBtn, tr( "Click this button to browse\nthe temporary directory" ) );
+ tempLayout->addMultiCellWidget( tempLab, 0, 0, 0, 1 );
+ tempLayout->addWidget ( tempFolder, 1, 0 );
+ tempLayout->addWidget ( tempBtn, 1, 1 );
+ // AKL: 13/08/07 - disable temporary directory setting in GUI ==>
+ tempLab->hide();
+ tempFolder->hide();
+ tempBtn->hide();
+ // AKL: 13/08/07 - disable temporary directory setting in GUI <==
+ // layout widgets
+ pageLayout->addItem ( spacer1, 0, 0 );
+ pageLayout->addLayout( targetLayout, 1, 0 );
+ pageLayout->addLayout( tempLayout, 2, 0 );
+ pageLayout->addItem ( spacer2, 3, 0 );
+ // connecting signals
+ connect( targetFolder, SIGNAL( textChanged( const QString& ) ),
+ this, SLOT( directoryChanged( const QString& ) ) );
+ connect( targetBtn, SIGNAL( clicked() ),
+ this, SLOT( browseDirectory() ) );
+ connect( tempFolder, SIGNAL( textChanged( const QString& ) ),
+ this, SLOT( directoryChanged( const QString& ) ) );
+ connect( tempBtn, SIGNAL( clicked() ), this, SLOT( browseDirectory() ) );
+
+ // adding page
+ addPage( dirPage, tr( "Installation directory" ) );
+}
+// ================================================================
/*!
* SALOME_InstallWizard::setupProductsPage
* Creates products page
{
// create page
productsPage = new QWidget( this, "ProductsPage" );
- QGridLayout* pageLayout = new QGridLayout( productsPage );
+ QGridLayout* pageLayout = new QGridLayout( productsPage );
pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
- // target directory
- QLabel* targetLab = new QLabel( tr( "Type the target directory:" ), productsPage );
- targetFolder = new QLineEdit( productsPage );
- QWhatsThis::add( targetFolder, tr( "Enter target root directory where products will be installed" ) );
- QToolTip::add ( targetFolder, tr( "Enter target root directory where products will be installed" ) );
- targetBtn = new QPushButton( tr( "Browse..." ), productsPage );
- QWhatsThis::add( targetBtn, tr( "Click this to browse target directory" ) );
- QToolTip::add ( targetBtn, tr( "Click this to browse target directory" ) );
- // create advanced mode widgets container
- moreBox = new QWidget( productsPage );
- QGridLayout* moreBoxLayout = new QGridLayout( moreBox );
- moreBoxLayout->setMargin( 0 ); moreBoxLayout->setSpacing( 6 );
- // temp directory
- QLabel* tempLab = new QLabel( tr( "Type the directory for the temporary files:" ), moreBox );
- tempFolder = new QLineEdit( moreBox );
- // tempFolder->setText( "/tmp" ); // default is /tmp directory
- QWhatsThis::add( tempFolder, tr( "Enter directory where to put temporary files" ) );
- QToolTip::add ( tempFolder, tr( "Enter directory where to put temporary files" ) );
- tempBtn = new QPushButton( tr( "Browse..." ), moreBox );
- tempBtn->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
- QWhatsThis::add( tempBtn, tr( "Click this to browse temporary directory" ) );
- QToolTip::add ( tempBtn, tr( "Click this to browse temporary directory" ) );
- // create products list
- productsView = new ProductsView( moreBox );
- 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
- productsInfo = new QTextBrowser( moreBox );
- productsInfo->setMinimumSize( 270, 135 );
- QWhatsThis::add( productsInfo, tr( "Shows info about the product: required disk space and prerequisites" ) );
- QToolTip::add ( productsInfo, tr( "Shows info about the product: required disk space and prerequisites" ) );
- // disk space labels
- QLabel* reqLab1 = new QLabel( tr( "Total disk space required:" ), moreBox );
- QWhatsThis::add( reqLab1, tr( "Shows total disk space required for installing selected products" ) );
- QToolTip::add ( reqLab1, tr( "Shows total disk space required for installing selected products" ) );
- requiredSize = new QLabel( moreBox );
- requiredSize->setMinimumWidth( 100 );
- QWhatsThis::add( requiredSize, tr( "Shows total disk space required for installing selected products" ) );
- QToolTip::add ( requiredSize, tr( "Shows total disk space required for installing selected products" ) );
- QLabel* reqLab2 = new QLabel( tr( "Space for temporary files:" ), moreBox );
- QWhatsThis::add( reqLab2, tr( "Shows additional disk space which is required for temporary files" ) );
- QToolTip::add ( reqLab2, tr( "Shows additional disk space which is required for temporary files" ) );
- requiredTemp = new QLabel( moreBox );
- requiredTemp->setMinimumWidth( 100 );
- QWhatsThis::add( requiredTemp, tr( "Shows additional disk space which is required for temporary files" ) );
- QToolTip::add ( requiredTemp, tr( "Shows additional disk space which is required for temporary files" ) );
- QFont fnt = reqLab1->font();
- fnt.setBold( true );
- reqLab1->setFont( fnt );
- requiredSize->setFont( fnt );
- reqLab2->setFont( fnt );
- requiredTemp->setFont( fnt );
+ //
+ // create left column widgets
+ //
+ QVBoxLayout* leftBoxLayout = new QVBoxLayout;
+ leftBoxLayout->setMargin( 0 ); leftBoxLayout->setSpacing( 6 );
+ // ... modules list
+ modulesView = new ProductsView( productsPage, "modulesView" );
+ setAboutInfo( modulesView, tr( "The modules available for the installation" ) );
+ modulesView->setColumnAlignment( 1, Qt::AlignRight );
+ leftBoxLayout->addWidget( modulesView );
+ // ... 'Installation with GUI' checkbox
+ installGuiBtn = new QMyCheckBox( tr( "Installation with GUI" ), productsPage );
+ setAboutInfo( installGuiBtn, tr( "Check this option if you want\nto install SALOME with GUI" ) );
+ leftBoxLayout->addWidget( installGuiBtn );
+ // ... prerequisites list
+ prereqsView = new ProductsView( productsPage, "prereqsView" );
+ prereqsView->renameColumn( 0, "Prerequisite" );
+ setAboutInfo( prereqsView, tr( "The prerequisites that can be installed" ) );
+ prereqsView->setColumnAlignment( 1, Qt::AlignRight );
+ leftBoxLayout->addWidget( prereqsView );
+ // ... 'Show/Hide prerequisites' button
+ moreBtn = new QPushButton( tr( "Show prerequisites..." ), productsPage );
+ setAboutInfo( moreBtn, tr( "Click to show list of prerequisites" ) );
+ leftBoxLayout->addWidget( moreBtn );
+ //
+ // create right column widgets
+ //
+ // ... info box
+ productInfo = new QTextBrowser( productsPage );
+ productInfo->setFrameShape( QFrame::LineEditPanel );
+ productInfo->setPaletteBackgroundColor( productsPage->paletteBackgroundColor() );
+ setAboutInfo( productInfo, tr( "Short information about the product being selected" ) );
+ // ... disk space labels
+ QLabel* reqLab1 = new QLabel( tr( "Disk space required:" ), productsPage );
+ setAboutInfo( reqLab1, tr( "Total disk space required for the installation\nof the selected products" ) );
+ requiredSize = new QLabel( productsPage );
+ setAboutInfo( requiredSize, tr( "Total disk space required for the installation\nof the selected products" ) );
+ requiredSize->setAlignment( Qt::AlignRight );
+ QLabel* reqLab2 = new QLabel( tr( "Space for temporary files:" ), productsPage );
+ setAboutInfo( reqLab2, tr( "Disk space required for the temporary files" ) );
+ requiredTemp = new QLabel( productsPage );
+ setAboutInfo( requiredTemp, tr( "Disk space required for the temporary files" ) );
+ requiredTemp->setAlignment( Qt::AlignRight );
+ QLabel* reqLab3 = new QLabel( tr( "Available disk space:" ), productsPage );
+ setAboutInfo( reqLab3, tr( "Disk space available on the selected device" ) );
+ availableSize = new QLabel( productsPage );
+ setAboutInfo( availableSize, tr( "Disk space available on the selected device" ) );
+ availableSize->setAlignment( Qt::AlignRight );
+ // layout size widgets
QGridLayout* sizeLayout = new QGridLayout; sizeLayout->setMargin( 0 ); sizeLayout->setSpacing( 6 );
- sizeLayout->addWidget( reqLab1, 0, 0 );
- sizeLayout->addWidget( requiredSize, 0, 1 );
- sizeLayout->addWidget( reqLab2, 1, 0 );
- sizeLayout->addWidget( requiredTemp, 1, 1 );
- // prerequisites checkbox
- prerequisites = new QCheckBox( tr( "Auto set prerequisites products" ), moreBox );
- prerequisites->setChecked( true );
- QWhatsThis::add( prerequisites, tr( "Check this if you want prerequisites products to be set on automatically" ) );
- QToolTip::add ( prerequisites, tr( "Check this if you want prerequisites products to be set on automatically" ) );
- // <Unselect All> buttons
- unselectBtn = new QPushButton( tr( "&Unselect All" ), moreBox );
- QWhatsThis::add( unselectBtn, tr( "Unselects all products" ) );
- QToolTip::add ( unselectBtn, tr( "Unselects all products" ) );
- QVBoxLayout* btnLayout = new QVBoxLayout; btnLayout->setMargin( 0 ); btnLayout->setSpacing( 6 );
- btnLayout->addWidget( unselectBtn );
- // layouting advancet mode widgets
- moreBoxLayout->addMultiCellWidget( tempLab, 0, 0, 0, 2 );
- moreBoxLayout->addMultiCellWidget( tempFolder, 1, 1, 0, 1 );
- moreBoxLayout->addWidget ( tempBtn, 1, 2 );
- moreBoxLayout->addMultiCellWidget( productsView, 2, 5, 0, 0 );
- moreBoxLayout->addMultiCellWidget( productsInfo, 2, 2, 1, 2 );
- moreBoxLayout->addMultiCellWidget( prerequisites,3, 3, 1, 2 );
- moreBoxLayout->addMultiCellLayout( btnLayout, 4, 4, 1, 2 );
- moreBoxLayout->addMultiCellLayout( sizeLayout, 5, 5, 1, 2 );
- // <More...> button
- moreBtn = new QPushButton( tr( "More..." ), productsPage );
- // layouting
- pageLayout->addMultiCellWidget( targetLab, 0, 0, 0, 1 );
- pageLayout->addWidget ( targetFolder, 1, 0 );
- pageLayout->addWidget ( targetBtn, 1, 1 );
- pageLayout->addMultiCellWidget( moreBox, 2, 2, 0, 1 );
- pageLayout->addWidget ( moreBtn, 3, 1 );
- pageLayout->setRowStretch( 2, 5 );
- //pageLayout->addRowSpacing( 6, 10 );
- // xml reader
- QFile xmlfile(xmlFileName);
- if ( xmlfile.exists() ) {
- QXmlInputSource source( &xmlfile );
- QXmlSimpleReader reader;
-
- StructureParser* handler = new StructureParser( this );
- handler->setProductsList(productsView);
- handler->setTargetDir(targetFolder);
- handler->setTempDir(tempFolder);
- reader.setContentHandler( handler );
- reader.parse( source );
- }
- // set first item to be selected
- if ( productsView->childCount() > 0 ) {
- productsView->setSelected( productsView->firstChild(), true );
- onSelectionChanged();
- }
+ sizeLayout->addWidget( reqLab1, 0, 0 );
+ sizeLayout->addWidget( requiredSize, 0, 1 );
+ sizeLayout->addWidget( reqLab2, 1, 0 );
+ sizeLayout->addWidget( requiredTemp, 1, 1 );
+ sizeLayout->addWidget( reqLab3, 2, 0 );
+ sizeLayout->addWidget( availableSize, 2, 1 );
+ // ... 'single installation directory' check-boxes
+ oneModDirBtn = new QMyCheckBox( tr( "Install modules to a single directory" ), productsPage );
+ setAboutInfo( oneModDirBtn, tr( "Check this box if you want to install binaries of\nthe selected SALOME modules into a single directory" ) );
+ oneProdDirBtn = new QMyCheckBox( tr( "Install prerequisites to a single directory" ), productsPage );
+ setAboutInfo( oneProdDirBtn, tr( "Check this box if you want to install binaries of\nthe selected prerequisites into a single directory" ) );
+ oneProdDirBtn->hide(); // temporarily! waiting for correct prerequisites availability
+ QFrame* split_line = new QFrame( productsPage, "split_line" );
+ split_line->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+
+ // layout common widgets
+ pageLayout->addMultiCellLayout( leftBoxLayout, 0, 4, 0, 0 );
+ pageLayout->addWidget ( productInfo, 0, 1 );
+ pageLayout->addLayout ( sizeLayout, 1, 1 );
+ pageLayout->addWidget ( split_line, 2, 1 );
+ pageLayout->addWidget ( oneModDirBtn, 3, 1 );
+ pageLayout->addWidget ( oneProdDirBtn, 4, 1 );
+
// adding page
- addPage( productsPage, tr( "Installation settings" ) );
- // connecting signals
- connect( productsView, SIGNAL( selectionChanged() ),
- this, SLOT( onSelectionChanged() ) );
- connect( productsView, SIGNAL( itemToggled( QCheckListItem* ) ),
- this, SLOT( onItemToggled( QCheckListItem* ) ) );
- connect( unselectBtn, SIGNAL( clicked() ), this, SLOT( onProdBtn() ) );
+ addPage( productsPage, tr( "Choice of the products to be installed" ) );
+
// connecting signals
- connect( targetFolder, SIGNAL( textChanged( const QString& ) ),
- this, SLOT( directoryChanged( const QString& ) ) );
- connect( targetBtn, SIGNAL( clicked() ), this, SLOT( browseDirectory() ) );
- connect( tempFolder, SIGNAL( textChanged( const QString& ) ),
- this, SLOT( directoryChanged( const QString& ) ) );
- connect( tempBtn, SIGNAL( clicked() ), this, SLOT( browseDirectory() ) );
- connect( moreBtn, SIGNAL( clicked() ), this, SLOT( onMoreBtn() ) );
- // start on default - non-advanced - mode
- moreBox->hide();
+ connect( modulesView, SIGNAL( selectionChanged() ),
+ this, SLOT( onSelectionChanged() ) );
+ connect( prereqsView, SIGNAL( selectionChanged() ),
+ this, SLOT( onSelectionChanged() ) );
+ connect( modulesView, SIGNAL( clicked ( QListViewItem * item ) ),
+ this, SLOT( onSelectionChanged() ) );
+ connect( prereqsView, SIGNAL( clicked ( QListViewItem * item ) ),
+ this, SLOT( onSelectionChanged() ) );
+ connect( modulesView, SIGNAL( itemToggled( QCheckListItem* ) ),
+ this, SLOT( onItemToggled( QCheckListItem* ) ) );
+ connect( prereqsView, SIGNAL( itemToggled( QCheckListItem* ) ),
+ this, SLOT( onItemToggled( QCheckListItem* ) ) );
+ connect( installGuiBtn, SIGNAL( toggled( bool ) ),
+ this, SLOT( onInstallGuiBtn() ) );
+ connect( moreBtn, SIGNAL( clicked() ), this, SLOT( onMoreBtn() ) );
+ // start on default - non-advanced mode
+ prereqsView->hide();
}
// ================================================================
/*!
{
// create page
prestartPage = new QWidget( this, "PrestartPage" );
- QVBoxLayout* pageLayout = new QVBoxLayout( prestartPage );
+ QVBoxLayout* pageLayout = new QVBoxLayout( prestartPage );
pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
// choice text view
choices = new QTextEdit( prestartPage );
choices->setReadOnly( true );
choices->setTextFormat( RichText );
choices->setUndoRedoEnabled ( false );
- QWhatsThis::add( choices, tr( "Displays information about installation settings you made" ) );
- QToolTip::add ( choices, tr( "Displays information about installation settings you made" ) );
- QPalette pal = choices->palette();
- pal.setColor( QColorGroup::Base, QApplication::palette().active().background() );
- choices->setPalette( pal );
+ setAboutInfo( choices, tr( "Information about the installation choice you have made" ) );
+ choices->setPaletteBackgroundColor( prestartPage->paletteBackgroundColor() );
choices->setMinimumHeight( 10 );
// layouting
pageLayout->addWidget( choices );
{
// create page
progressPage = new QWidget( this, "progressPage" );
- QGridLayout* pageLayout = new QGridLayout( progressPage );
+ QGridLayout* pageLayout = new QGridLayout( progressPage );
pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
// top splitter
splitter = new QSplitter( Vertical, progressPage );
splitter->setOpaqueResize( true );
// the parent for the widgets
QWidget* widget = new QWidget( splitter );
- QGridLayout* layout = new QGridLayout( widget );
+ QGridLayout* layout = new QGridLayout( widget );
layout->setMargin( 0 ); layout->setSpacing( 6 );
// installation progress view box
- installInfo = new QTextEdit( widget );
+ installInfo = new InstallInfo( widget );
installInfo->setReadOnly( true );
installInfo->setTextFormat( RichText );
installInfo->setUndoRedoEnabled ( false );
installInfo->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
installInfo->setMinimumSize( 100, 10 );
- QWhatsThis::add( installInfo, tr( "Displays installation process" ) );
- QToolTip::add ( installInfo, tr( "Displays installation process" ) );
+ setAboutInfo( installInfo, tr( "Installation process output" ) );
// parameters for the script
parametersLab = new QLabel( tr( "Enter your answer here:" ), widget );
passedParams = new QLineEdit ( widget );
- QWhatsThis::add( passedParams, tr( "Use this field to enter answer for the running script when it is necessary") );
- QToolTip::add ( passedParams, tr( "Use this field to enter answer for the running script when it is necessary") );
+ setAboutInfo( passedParams, tr( "Use this field to enter the answer\nfor the running script when it is necessary") );
+ // VSR: 10/11/05 - disable answer mode ==>
+ parametersLab->hide();
+ passedParams->hide();
+ // VSR: 10/11/05 - disable answer mode <==
// layouting
layout->addWidget( installInfo, 0, 0 );
layout->addWidget( parametersLab, 1, 0 );
layout->addRowSpacing( 3, 6 );
// the parent for the widgets
widget = new QWidget( splitter );
- layout = new QGridLayout( widget );
+ layout = new QGridLayout( widget );
layout->setMargin( 0 ); layout->setSpacing( 6 );
// installation results view box
QLabel* resultLab = new QLabel( tr( "Installation Status:" ), widget );
progressView = new ProgressView( widget );
progressView->setSizePolicy( QSizePolicy( QSizePolicy::Minimum, QSizePolicy::Expanding ) );
progressView->setMinimumSize( 100, 10 );
- QWhatsThis::add( progressView, tr( "Displays installation status" ) );
- QToolTip::add ( progressView, tr( "Displays installation status" ) );
+ // possibility to ignore all errors
+ ignoreErrCBox = new QCheckBox( tr( "Ignore errors" ), widget );
+ setAboutInfo( ignoreErrCBox, tr( "Check this option if you want to proceed installation \nprocess even there will be some errors" ) );
+ ignoreErrCBox->setChecked( false );
+ // product installation status bar
+ statusLab = new QLabel( widget );
+ statusLab->setFrameShape( QButtonGroup::LineEditPanel );
+ setAboutInfo( progressView, tr( "Installation status on the selected products" ) );
// layouting
layout->addRowSpacing( 0, 6 );
- layout->addWidget( resultLab, 1, 0 );
- layout->addWidget( progressView, 2, 0 );
+ layout->addWidget( resultLab, 1, 0 );
+ layout->addWidget( progressView, 2, 0 );
+ layout->addWidget( ignoreErrCBox, 3, 0 );
+ layout->addWidget( statusLab, 4, 0 );
// layouting
- pageLayout->addWidget( splitter, 0, 0 );
+ pageLayout->addWidget( splitter, 0, 0 );
// adding page
addPage( progressPage, tr( "Installation progress" ) );
// connect signals
void SALOME_InstallWizard::setupReadmePage()
{
// create page
- readmePage = new QWidget( this, "ReadmePage" );
- QVBoxLayout* pageLayout = new QVBoxLayout( readmePage );
+ readmePage = new QWidget( this, "readmePage" );
+ QVBoxLayout* pageLayout = new QVBoxLayout( readmePage );
pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 );
// README info text box
readme = new QTextEdit( readmePage );
readme->setReadOnly( true );
readme->setTextFormat( PlainText );
+ readme->setFont( QFont( "Fixed", 12 ) );
readme->setUndoRedoEnabled ( false );
- QWhatsThis::add( readme, tr( "Displays README information" ) );
- QToolTip::add ( readme, tr( "Displays README information" ) );
- QPalette pal = readme->palette();
- pal.setColor( QColorGroup::Base, QApplication::palette().active().background() );
- readme->setPalette( pal );
+ setAboutInfo( readme, tr( "README information" ) );
+ readme->setPaletteBackgroundColor( readmePage->paletteBackgroundColor() );
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 );
+
+ // Operation buttons
+ QHBoxLayout* hLayout = new QHBoxLayout( -1, "finishButtons" );
+ hLayout->setMargin( 0 ); hLayout->setSpacing( 6 );
+ hLayout->addStretch();
pageLayout->addLayout( hLayout );
- // connecting signals
- connect( runSalomeBtn, SIGNAL( clicked() ), this, SLOT( onLaunchSalome() ) );
+
// loading README file
- QString readmeFile = QDir::currentDirPath() + "/README";
+ QString readmeFile = QDir( rootDirPath() ).filePath( "README" );
QString text;
if ( readFile( readmeFile, text ) )
readme->setText( text );
else
readme->setText( tr( "README file has not been found" ) );
+
// adding page
addPage( readmePage, tr( "Finish installation" ) );
}
int nbProd = 0;
QString text;
- if ( !xmlFileName.isEmpty() ) {
- text += tr( "Configuration file" )+ ": <b>" + xmlFileName + "</b><br>";
- text += "<br>";
- }
- if ( !myOS.isEmpty() ) {
- text += tr( "Target platform" ) + ": <b>" + myOS + "</b><br>";
- text += "<br>";
- }
- text += tr( "Products to be used" ) + ":<ul>";
- QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
+ text += tr( "Current Linux platform" )+ ": <b>" + (!curPlatform.isEmpty() ? curPlatform : QString( "Unknown" )) + "</b><br>";
+ if ( !refPlatform.isEmpty() )
+ text += tr( "Reference Linux platform" ) + ": <b>" + refPlatform + "</b><br>";
+ text += "<br>";
+
+ text += tr( "Target directory:" ) + " <b>" + QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) + "</b><br>";
+ text += tr( "Temporary directory:" ) + " <b>" + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + "</b><br>";
+ text += "<br>";
+
+ text += tr( "SALOME modules to be installed" ) + ":<ul>";
+ QCheckListItem* item = (QCheckListItem*)( modulesView->firstChild() );
while( item ) {
if ( productsMap.contains( item ) ) {
- if ( item->childCount() > 0 ) {
- if ( productsView->isNative( item ) ) {
- text += "<li><b>" + item->text() + "</b> " + tr( "as native" ) + "<br>";
- nbProd++;
- }
+ if ( item->isOn() ) {
+ text += "<li><b>" + item->text() + "</b><br>";
+ nbProd++;
}
}
item = (QCheckListItem*)( item->nextSibling() );
}
text += "</ul>";
nbProd = 0;
- text += tr( "Products to be installed" ) + ":<ul>";
- item = (QCheckListItem*)( productsView->firstChild() );
+ text += tr( "Prerequisites to be installed" ) + ":<ul>";
+ item = (QCheckListItem*)( prereqsView->firstChild() );
while( item ) {
if ( productsMap.contains( item ) ) {
- if ( item->childCount() > 0 ) {
- if ( productsView->isBinaries( item ) ) {
- text += "<li><b>" + item->text() + "</b> " + tr( "as binaries" ) + "<br>";
- nbProd++;
- }
- else if ( productsView->isSources( item ) ) {
- text+= "<li><b>" + item->text() + "</b> " + tr( "as sources" ) + "<br>";
- nbProd++;
- }
- }
- else if ( item->isOn() ) {
- text+= "<li><b>" + item->text() + "</b><br>";
- nbProd++;
+ if ( item->isOn() ) {
+ text += "<li><b>" + item->text() + " " + productsMap[ item ].getVersion() + "</b><br>";
+ nbProd++;
}
}
item = (QCheckListItem*)( item->nextSibling() );
text += "<li><b>" + tr( "none" ) + "</b><br>";
}
text += "</ul>";
- 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 += 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 += tr( "Temp directory:" ) + " <b>" + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + "</b><br>";
- text += "<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>" ;
choices->setText( text );
}
// ================================================================
{
QString tmpstr;
QWidget* aPage = InstallWizard::page( pageTitle );
- if ( aPage == productsPage ) {
- // ########## check if any products are selected to be installed
- long totSize, tempSize;
- bool anySelected = checkSize( &totSize, &tempSize );
- if ( !anySelected ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "Select one or more products to install" ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
+ if ( aPage == typePage ) {
+ // installation type page
+ warnLab3->show();
+ this->setAppropriate( platformsPage, false );
+ if ( installType == Binaries ) { // 'Binary' installation type
+ // check binaries directory
+ QFileInfo fib( QDir::cleanDirPath( getBinPath() ) );
+ if ( !fib.isDir() ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't exist.\n"
+ "This directory must contains another one directory with binary archives for current platform.").arg( fib.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
+ }
+ if ( platformsMap.find( curPlatform ) == platformsMap.end() ) {
+ // Unknown platform case
+ QString aMsg = warnMsg + tr( ".\nBy default the universal binary package will be installed." );
+ aMsg += tr( "\nIf you want to select another one, please use the following list:" );
+ warnLab->setText( aMsg );
+ warnLab3->hide();
+ this->setAppropriate( platformsPage, true );
+ }
+ else {
+ // Supported platform case
+ QFileInfo fibp( getPlatformBinPath( curPlatform ) );
+ if ( !fibp.isDir() ) {
+ warnLab->setText( tr( "Binaries are absent for current platform." ) );
+ this->setAppropriate( platformsPage, true );
+ }
+ }
+
+ // check sources directory
+ QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) );
+ if ( !fis.isDir() )
+ if ( QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't exist.\n"
+ "This directory must contains sources archives.\n"
+ "Continue?" ).arg( fis.absFilePath() ),
+ tr( "&Yes" ),
+ tr( "&No" ),
+ QString::null, 1, 1 ) == 1 )
+ return false;
+ }
+ else { // 'Source' or 'Compile' installation type
+ // check sources directory
+ QFileInfo fis( QDir::cleanDirPath( getSrcPath() ) );
+ if ( !fis.isDir() ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't exist.\n"
+ "This directory must contains sources archives.\n" ).arg( fis.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
+ }
+ else if ( !QDir( fis.filePath(), "*.tar.gz" ).count() ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't contain source archives.\n" ).arg( fis.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
+ }
+ if ( platformsMap.find( curPlatform ) == platformsMap.end() ) {
+ QString aMsg = warnMsg + ".";
+ if ( installType == Compile )
+ aMsg = warnMsg + tr( " and compilation is not tested on this one." );
+ warnLab->setText( aMsg );
+ this->setAppropriate( platformsPage, true );
+ }
+ }
+ }
+
+ else if ( aPage == platformsPage ) {
+ // installation platform page
+ if ( platBtnGrp->id( platBtnGrp->selected() ) == -1 ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "Select installation platform before" ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
return false;
}
+ else if ( installType == Binaries ) {
+ QString aPlatform = platBtnGrp->selected()->name();
+ QFileInfo fib( getPlatformBinPath( aPlatform ) );
+ if ( !fib.isDir() ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't exist.\n"
+ "This directory must contains binary archives.\n" ).arg( fib.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
+ }
+ else if ( QDir( fib.filePath(), "*.tar.gz" ).count() == 0 ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 doesn't contain binary archives.\n" ).arg( fib.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
+ }
+ }
+ }
+
+ else if ( aPage == dirPage ) {
+ // installation directory page
// ########## check target and temp directories (existence and available disk space)
// get dirs
QString targetDir = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() );
QString tempDir = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() );
- // directories should differ
-// if (!targetDir.isEmpty() && tempDir == targetDir) {
-// QMessageBox::warning( this,
-// tr( "Warning" ),
-// tr( "Target and temporary directories must be different"),
-// QMessageBox::Ok,
-// QMessageBox::NoButton,
-// QMessageBox::NoButton );
-// return false;
-// }
// check target directory
if ( targetDir.isEmpty() ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "Please, enter valid target directory path" ),
- QMessageBox::Ok,
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "Please, enter valid target directory path" ),
+ QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton );
return false;
}
QFileInfo fi( QDir::cleanDirPath( targetDir ) );
- if ( !fi.exists() ) {
- bool toCreate =
- QMessageBox::warning( this,
- tr( "Warning" ),
+ if ( !fi.isDir() ) {
+ bool toCreate =
+ QMessageBox::warning( this,
+ tr( "Warning" ),
tr( "The directory %1 doesn't exist.\n"
- "Do you want to create directory?" ).arg( fi.absFilePath() ),
- QMessageBox::Yes,
+ "Create directory?" ).arg( fi.absFilePath() ),
+ QMessageBox::Yes,
QMessageBox::No,
QMessageBox::NoButton ) == QMessageBox::Yes;
- if ( !toCreate)
+ if ( !toCreate)
return false;
if ( !makeDir( fi.absFilePath(), tmpstr ) ) {
- QMessageBox::critical( this,
- tr( "Error" ),
- tr( "Can't create the directory\n%1").arg( fi.absFilePath() ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
+ QMessageBox::critical( this,
+ tr( "Error" ),
+ tr( "Can't create the directory\n%1").arg( fi.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
QMessageBox::NoButton );
return false;
}
}
if ( !fi.isDir() ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "The directory %1 is not a directory.\n"
- "Please, enter valid target directory path" ).arg( fi.absFilePath() ),
- QMessageBox::Ok,
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "%1 is not a directory.\n"
+ "Please, enter valid target directory path" ).arg( fi.absFilePath() ),
+ QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton );
return false;
}
if ( !fi.isWritable() ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "The directory %1 is not writeable.\n"
- "Please, enter valid target directory path or change permissions" ).arg( fi.absFilePath() ),
- QMessageBox::Ok,
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "The directory %1 is not writable.\n"
+ "Please, enter valid target directory path or change permissions" ).arg( fi.absFilePath() ),
+ QMessageBox::Ok,
QMessageBox::NoButton,
QMessageBox::NoButton );
return false;
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() ));
- }
- // run script that checks available disk space for installing of products // returns 1 in case of error
- QString script = "./config_files/checkSize.sh '";
- script += fi.absFilePath();
- script += "' ";
- script += QString( "%1" ).arg( totSize );
-#ifdef DEBUG
- cout << "script = " << script << endl;
-#endif
- if ( system( script ) ) {
- QMessageBox::critical( this,
- tr( "Out of space" ),
- tr( "There is not available disk space for installing of selected products" ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- return false;
- }
// check temp directory
if ( tempDir.isEmpty() ) {
- if ( moreMode ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "Please, enter valid temp directory path" ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- return false;
- }
- else {
- tempDir = "/tmp";
- tempFolder->setText( tempDir );
- }
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "Please, enter valid temporary directory path" ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
}
QFileInfo fit( QDir::cleanDirPath( tempDir ) );
if ( !makeDir( fit.absFilePath() + TEMPDIRNAME, tmpCreated ) ) {
- QMessageBox::critical( this,
- tr( "Error" ),
- tr( "Can't use temporary directory.\nCheck permissions for the %1 directory.").arg( fit.absFilePath() ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
+ QMessageBox::critical( this,
+ tr( "Error" ),
+ tr( "Can't use temporary directory.\nCheck permissions for the %1 directory.").arg( fit.absFilePath() ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
QMessageBox::NoButton );
return false;
}
+ }
+
+ else if ( aPage == productsPage ) {
+ // products page
+ // ########## check if any products are selected to be installed
+ long totSize, tempSize;
+ bool anySelected = checkSize( &totSize, &tempSize );
+ if ( installType == Compile && removeSrcBtn->isOn() ) {
+ totSize += tempSize;
+ }
+ if ( !anySelected ) {
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "Select one or more products to install" ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
+ }
+ // run script that checks available disk space for installing of products // returns 1 in case of error
+ QDir rd( rootDirPath() );
+ QFileInfo fi( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) );
+ Script script;
+ script << QUOTE( rd.filePath( "config_files/checkSize.sh" ) );
+ script << QUOTE( fi.absFilePath() ) << QString::number( totSize );
+ ___MESSAGE___( "script = " << script.script().latin1() );
+ if ( system( script.script().latin1() ) ) {
+ QMessageBox::critical( this,
+ tr( "Out of space" ),
+ tr( "There is no available disk space for installing of selected products" ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
+ }
+ // AKL: 13/08/07 - skip tmp disk space checking (all files are unpacked into installation directory) ==>
+ /*
// run script that check available disk space for temporary files
// returns 1 in case of error
- QString tscript = "./config_files/checkSize.sh '";
- tscript += fit.absFilePath();
- tscript += "' ";
- tscript += QString( "%1" ).arg( tempSize );
-#ifdef DEBUG
- cout << "script = " << tscript << endl;
-#endif
- if ( system( tscript ) ) {
- QMessageBox::critical( this,
- tr( "Out of space" ),
- tr( "There is not available disk space for the temporary files" ),
- QMessageBox::Ok,
- QMessageBox::NoButton,
+ QFileInfo fit( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) );
+ Script tscript;
+ tscript << QUOTE( rd.filePath( "config_files/checkSize.sh" ) );
+ tscript << QUOTE( fit.absFilePath() ) << QString::number( tempSize );
+ ___MESSAGE___( "script = " << tscript.script().latin1() );
+ if ( system( tscript.script().latin1() ) ) {
+ QMessageBox::critical( this,
+ tr( "Out of space" ),
+ tr( "There is no available disk space for the temporary files" ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
QMessageBox::NoButton );
return false;
- }
-// VSR: <------------------------------------------------------------------------------
- // ########## check native products
- QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
- QStringList natives;
- while( item ) {
- if ( productsMap.contains( item ) ) {
- if ( item->childCount() > 0 ) {
- if ( !productsView->isNone( item ) ) {
- if ( item->text(2).isEmpty() || item->text(2).isNull() ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "You don't have a defined script for %1").arg(item->text(0)),
- QMessageBox::Ok,
- QMessageBox::NoButton,
+ }
+ */
+ // AKL: 13/08/07 - skip tmp disk space checking (all files are unpacked into installation directory) <==
+
+ // ########## check installation scripts
+ QCheckListItem* item;
+ ProductsView* prodsView = modulesView;
+ for ( int i = 0; i < 2; i++ ) {
+ item = (QCheckListItem*)( prodsView->firstChild() );
+ while( item ) {
+ if ( productsMap.contains( item ) && item->isOn() ) {
+ // check installation script definition
+ if ( item->text(2).isEmpty() || item->text(2).isNull() ) {
+ QMessageBox::warning( this,
+ tr( "Error" ),
+ tr( "The installation script for %1 is not defined.").arg(item->text(0)),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ if ( !moreMode ) onMoreBtn();
+ QListView* listView = item->listView();
+ listView->setCurrentItem( item );
+ listView->setSelected( item, true );
+ listView->ensureItemVisible( item );
+ return false;
+ }
+ // check installation script existence
+ else {
+ QDir rd( rootDirPath() );
+ QFileInfo fi( rd.filePath( QString( "config_files/%1" ).arg( item->text(2) ) ) );
+ if ( !fi.exists() || !fi.isExecutable() ) {
+ QMessageBox::warning( this,
+ tr( "Error" ),
+ tr( "The script %1 required for %2 doesn't exist or doesn't have execute permissions.").arg(fi.filePath()).arg(item->text(0)),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
QMessageBox::NoButton );
- productsView->setNone( item );
+ if ( !moreMode ) onMoreBtn();
+ QListView* listView = item->listView();
+ listView->setCurrentItem( item );
+ listView->setSelected( item, true );
+ listView->ensureItemVisible( item );
return false;
- } else {
- QFileInfo fi( QString("./config_files/") + item->text(2) );
- if ( !fi.exists() ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "%1 required for %2 doesn't exist.").arg("./config_files/" + item->text(2)).arg(item->text(0)),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- productsView->setNone( item );
- return false;
- }
}
}
- // collect native products
- if ( productsView->isNative( item ) ) {
- if ( natives.find( item->text(0) ) == natives.end() )
- natives.append( item->text(0) );
- }
- else if ( productsView->isBinaries( item ) || productsView->isSources( item ) ) {
- QStringList dependOn = productsMap[ item ].getDependancies();
- for ( int i = 0; i < (int)dependOn.count(); i++ ) {
- QCheckListItem* depitem = findItem( dependOn[ i ] );
- if ( depitem ) {
- if ( productsView->isNative( depitem ) && natives.find( depitem->text(0) ) == natives.end() )
- natives.append( depitem->text(0) );
- }
- else {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "%1 is required for %2 %3 installation.\n"
- "Please, add this product in config.xml file.").arg(dependOn[ i ]).arg(item->text(0)).arg(item->text(1)),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- return false;
- }
+ // check installation scripts dependencies
+ QStringList dependOn = productsMap[ item ].getDependancies();
+ QString version = productsMap[ item ].getVersion();
+ for ( int i = 0; i < (int)dependOn.count(); i++ ) {
+ QCheckListItem* depitem = findItem( dependOn[ i ] );
+ if ( !depitem ) {
+ QMessageBox::warning( this,
+ tr( "Error" ),
+ tr( "%1 is required for %2 %3 installation.\n"
+ "This product is missing in the configuration file %4.").arg(dependOn[ i ]).arg(item->text(0)).arg(version).arg(xmlFileName),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ return false;
}
}
}
+ item = (QCheckListItem*)( item->nextSibling() );
}
- item = (QCheckListItem*)( item->nextSibling() );
- }
- QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
- QString tgtFolder = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() );
- for ( unsigned i = 0; i < natives.count(); i++ ) {
- item = findItem( natives[ i ] );
- if ( item ) {
- QString script = "cd ./config_files/;" + item->text(2) + " try_native " +
- QFileInfo( tmpFolder ).absFilePath() + " " + QDir::currentDirPath() + "/Products " + QFileInfo( tgtFolder ).absFilePath() + " " +
- QUOTE(DefineDependeces(productsMap)) + " " + item->text(0);
-
-#ifdef DEBUG
- cout << "1. Script : " << script << endl;
-#endif
- if ( system( script ) ) {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "You don't have native %1 %2 installed").arg(item->text(0)).arg(item->text(1)),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- productsView->setNone( item );
- return false;
- }
- }
- else {
- QMessageBox::warning( this,
- tr( "Warning" ),
- tr( "%The product %1 %2 required for installation.\n"
- "Please, add this product in config.xml file.").arg(item->text(0)).arg(item->text(1)),
- QMessageBox::Ok,
- QMessageBox::NoButton,
- QMessageBox::NoButton );
- return false;
- }
+ prodsView = prereqsView;
}
+// return true; // return in order to avoid default postValidateEvent() action
}
return InstallWizard::acceptData( pageTitle );
}
bool SALOME_InstallWizard::checkSize( long* totSize, long* tempSize )
{
long tots = 0, temps = 0;
+ long maxSrcTmp = 0;
int nbSelected = 0;
MapProducts::Iterator mapIter;
for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
QCheckListItem* item = mapIter.key();
Dependancies dep = mapIter.data();
- if ( productsView->isBinaries( item ) ) {
- tots += dep.getSize();
- }
- else if ( productsView->isSources( item ) ) {
- tots += dep.getSize(true);
- temps = max( temps, dep.getTempSize() );
- }
- if ( !productsView->isNone( item ) )
- nbSelected++;
+ if ( !item->isOn() )
+ continue;
+ tots += ( QStringList::split( " ", item->text(1) )[0] ).toLong();
+ maxSrcTmp = max( maxSrcTmp, dep.getSize( Compile ) - dep.getSize( Binaries ) );
+ temps += dep.getTempSize( installType );
+ nbSelected++;
}
-
+
if ( totSize )
+ if ( installType == Compile && removeSrcBtn->isOn() )
+ temps += maxSrcTmp;
*totSize = tots;
if ( tempSize )
*tempSize = temps;
return ( nbSelected > 0 );
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::updateAvailableSpace
+ * Slot to update 'Available disk space' field
+ */
+// ================================================================
+void SALOME_InstallWizard::updateAvailableSpace()
+{
+ if ( diskSpaceProc->normalExit() )
+ availableSize->setText( diskSpaceProc->readLineStdout() + " KB");
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::runModifyLaFiles
+ * Run the modification of SALOME *.la files
+ */
+// ================================================================
+void SALOME_InstallWizard::runModifyLaFiles()
+{
+ modifyLaProc->clearArguments();
+ // ... update status label
+ statusLab->setText( tr( "Modification of *.la files of SALOME modules..." ) );
+ // set process arguments
+ modifyLaProc->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) );
+ modifyLaProc->addArgument( "modifyLaFiles.sh" );
+ modifyLaProc->addArgument( "modify_la_files" );
+ modifyLaProc->addArgument( QDir::cleanDirPath( QFileInfo( targetFolder->text().stripWhiteSpace() ).absFilePath() ) );
+ // ... run script
+ if ( !modifyLaProc->start() )
+ ___MESSAGE___( "Error: process could not start!" );
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::checkModifyLaResult
+ * Slot to take result of modification SALOME *.la files
+ */
+// ================================================================
+void SALOME_InstallWizard::checkModifyLaResult()
+{
+ if ( modifyLaProc->normalExit() && modifyLaProc->exitStatus() == 1 )
+ runCheckFLib();
+ else {
+ // abort of the current installation
+ abort();
+ statusLab->setText( tr( "Installation has been aborted" ) );
+ QMessageBox::critical( this,
+ tr( "Error" ),
+ tr( "Modification of *.la SALOME files has not been completed."),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ // enable <Next> button
+ setNextEnabled( true );
+ doPostActions( tr( "&Start" ), tr( "Start installation process" ) );
+ connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+ // enable <Back> button
+ setBackEnabled( true );
+ }
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::runCheckFLib
+ * Run the Fortran and other required libraries checking
+ */
+// ================================================================
+void SALOME_InstallWizard::runCheckFLib()
+{
+ // Check Fortran libraries
+ checkFLibProc->clearArguments();
+ // ... update status label
+ statusLab->setText( tr( "Check Fortran and other required libraries..." ) );
+ // ... search "not found" libraries
+ checkFLibProc->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) );
+ checkFLibProc->addArgument( "checkFortran.sh" );
+ checkFLibProc->addArgument( "find_libraries" );
+ checkFLibProc->addArgument( QDir::cleanDirPath( QFileInfo( targetFolder->text().stripWhiteSpace() ).absFilePath() ) );
+ // ... run script
+ if ( !checkFLibProc->start() )
+ ___MESSAGE___( "Error: process could not start!" );
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::checkFLibResult
+ * Slot to take result of Fortran and other required libraries checking
+ */
+// ================================================================
+void SALOME_InstallWizard::checkFLibResult()
+{
+ if ( checkFLibProc->normalExit() && checkFLibProc->exitStatus() == 1 ) {
+ QStringList notFoundLibsList, notFoundOptLibsList;
+ QString record = "";
+ QStringList prefOptLibs = getOptionalLibs();
+ // create list of strings with all 'not found' libraries
+ while ( checkFLibProc->canReadLineStdout() ) {
+ record = checkFLibProc->readLineStdout().stripWhiteSpace();
+ if ( !record.isEmpty() ) {
+ record = QStringList::split( " ", record )[0];
+ if ( !notFoundLibsList.contains( record ) &&
+ !notFoundOptLibsList.contains( record ) ) {
+ bool isOptional = false;
+ QStringList::Iterator it_opt;
+ for ( it_opt = prefOptLibs.begin(); it_opt != prefOptLibs.end(); ++it_opt )
+ if ( record.startsWith( (*it_opt).stripWhiteSpace(), false ) ) {
+ isOptional = true;
+ break;
+ }
+ isOptional ? notFoundOptLibsList.append( record ) \
+ : notFoundLibsList.append( record );
+ }
+ }
+ }
+ QString msg = tr( "Some libraries are absent!<br><br>" );
+ if ( !notFoundLibsList.isEmpty() ) {
+ msg += tr( "One or several <b>mandatory</b> libraries listed below are not found. SALOME <u>may not work</u> properly.<br>" );
+ msg += notFoundLibsList.join( "<br>" );
+ msg += "<br><br>";
+ }
+ if ( !notFoundOptLibsList.isEmpty() ) {
+ msg += tr( "One or several <b>optional</b> libraries listed below are not found. This <u>does not affect</u> on the correct work of SALOME platform.<br>" );
+ msg += notFoundOptLibsList.join( "<br>" );
+ }
+ if ( !notFoundLibsList.isEmpty() )
+ QMessageBox::warning( this,
+ tr( "Warning" ),
+ msg,
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ else if ( !notFoundOptLibsList.isEmpty() )
+ QMessageBox::information( this,
+ tr( "Information" ),
+ msg,
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ }
+ // Update GUI and check installation errors
+ completeInstallation();
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::updateSizeColumn
+ * Sets required size for each product according to
+ * installation type and 'Remove SRC & TMP' checkbox state
+ */
+// ================================================================
+void SALOME_InstallWizard::updateSizeColumn()
+{
+ long prodSize = 0;
+ bool removeSrc = removeSrcBtn->isChecked();
+ MapProducts::Iterator mapIter;
+ for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
+ QCheckListItem* item = mapIter.key();
+ Dependancies dep = mapIter.data();
+ // get required size for current product
+ long binSize = dep.getSize( Binaries );
+ long srcSize = dep.getSize( Sources );
+ long bldSize = dep.getSize( Compile );
+ InstallationType instType = getInstType();
+ if ( instType == Binaries ) {
+ if ( dep.getType() == "component" )
+ prodSize = binSize + srcSize;
+ else
+ prodSize = ( binSize != 0 ? binSize : srcSize );
+ }
+ else if ( instType == Sources )
+ prodSize = srcSize;
+ else
+ if ( removeSrc )
+ prodSize = ( binSize != 0 ? binSize : srcSize );
+ else {
+ prodSize = ( bldSize != 0 ? bldSize : srcSize );
+ }
+ // fill in 'Size' field
+ item->setText( 1, QString::number( prodSize )+" KB" );
+ }
+}
+// ================================================================
/*!
* SALOME_InstallWizard::checkProductPage
* Checks products page validity (directories and products selection) and
// ================================================================
void SALOME_InstallWizard::checkProductPage()
{
+ if ( this->currentPage() != productsPage )
+ return;
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");
+ requiredSize->setText( QString::number( tots ) + " KB");
+ requiredTemp->setText( QString::number( temps ) + " KB");
+
+ // update available size information
+ QFileInfo fi( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) );
+ if ( fi.exists() ) {
+ diskSpaceProc->clearArguments();
+ diskSpaceProc->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) );
+ diskSpaceProc->addArgument( "diskSpace.sh" );
+ diskSpaceProc->addArgument( fi.absFilePath() );
+ // run script
+ diskSpaceProc->start();
+ }
// enable/disable "Next" button
- setNextEnabled( productsPage, isAnyProductSelected && isTargetDirValid && isTempDirValid );
+ setNextEnabled( productsPage, isAnyProductSelected );
}
// ================================================================
/*!
{
if ( !productsMap.contains( item ) )
return;
- if ( productsView->isNone( item ) )
+ if ( !item->isOn() )
return;
// get all prerequisites
QStringList dependOn = productsMap[ item ].getDependancies();
+ // install SALOME without GUI case
+ if ( installGuiBtn->state() != QButton::On &&
+ woGuiModules.find( item->text(0) ) != woGuiModules.end() &&
+ woGuiModules[item->text(0)] == True ) {
+ dependOn.remove( "GUI" );
+ }
+ // setting prerequisites
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 ] ) {
- 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 ( itProd.data().getType() == "component" && !itProd.key()->isOn() )
+ itProd.key()->setOn( true );
+ else if ( itProd.data().getType() == "prerequisite" ) {
+ itProd.key()->setOn( true );
+ itProd.key()->setEnabled( false );
+ }
+ break;
+ }
+ }
+ }
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::unsetPrerequisites
+ * Unsets all modules which depend of the unchecked product ( recursively )
+ */
+// ================================================================
+void SALOME_InstallWizard::unsetPrerequisites( QCheckListItem* item )
+{
+ if ( !productsMap.contains( item ) )
+ return;
+ if ( item->isOn() )
+ return;
+
+// uncheck dependent products
+ QString itemName = productsMap[ item ].getName();
+ MapProducts::Iterator itProd;
+ for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
+ if ( itProd.data().getType() == productsMap[ item ].getType() ) {
+ QStringList dependOn = itProd.data().getDependancies();
+ for ( int i = 0; i < (int)dependOn.count(); i++ ) {
+ if ( dependOn[ i ] == itemName ) {
+ if ( itProd.key()->isOn() ) {
+ itProd.key()->setOn( false );
+ }
+ }
+ }
+ }
+ }
+
+// uncheck prerequisites
+ int nbDependents;
+// cout << "item name = " << productsMap[ item ].getName() << endl;
+ QStringList dependOnList = productsMap[ item ].getDependancies();
+ for ( int j = 0; j < (int)dependOnList.count(); j++ ) {
+ nbDependents = 0;
+ MapProducts::Iterator itProd1;
+ for ( itProd1 = productsMap.begin(); itProd1 != productsMap.end(); ++itProd1 ) {
+ if ( itProd1.data().getName() == dependOnList[ j ] ) {
+ if ( itProd1.data().getType() == "prerequisite" ) {
+ MapProducts::Iterator itProd2;
+ for ( itProd2 = productsMap.begin(); itProd2 != productsMap.end(); ++itProd2 ) {
+ if ( itProd2.key()->isOn() ) {
+ QStringList prereqsList = productsMap[ itProd2.key() ].getDependancies();
+ for ( int k = 0; k < (int)prereqsList.count(); k++ ) {
+ if ( prereqsList[ k ] == itProd1.data().getName() ) {
+ nbDependents++;
+ break;
+ }
+ }
+ }
+ }
+ if ( nbDependents == 0 ) {
+ itProd1.key()->setEnabled( true );
+ itProd1.key()->setOn( false );
+ }
}
+ break;
}
}
}
// try to find product being processed now
QString prodProc = progressView->findStatus( Processing );
if ( !prodProc.isNull() ) {
-#ifdef DEBUG
- cout << "Found <Processing>: " << prodProc.latin1() << endl;
-#endif
+ ___MESSAGE___( "Found <Processing>: " );
// if found - set status to "completed"
progressView->setStatus( prodProc, Completed );
+ // ... clear status label
+ statusLab->clear();
// ... and call this method again
launchScript();
return;
// else try to find next product which is not processed yet
prodProc = progressView->findStatus( Waiting );
if ( !prodProc.isNull() ) {
-#ifdef DEBUG
- cout << "Found <Waiting>: " << prodProc.latin1() << endl;
-#endif
+ ___MESSAGE___( "Found <Waiting>: " << prodProc.latin1() );
// if found - set status to "processed" and run script
progressView->setStatus( prodProc, Processing );
progressView->ensureVisible( prodProc );
-
- QCheckListItem* item = findItem( prodProc );
- Dependancies dep = productsMap[ item ];
+
+ QCheckListItem* item = 0;
// fill in script parameters
shellProcess->clearArguments();
// ... script name
- shellProcess->setWorkingDirectory( QDir::cleanDirPath( QFileInfo( "./config_files/" ).absFilePath() ) );
- shellProcess->addArgument( item->text(2) );
+ shellProcess->setWorkingDirectory( QDir( rootDirPath() ).filePath( "config_files" ) );
+ if ( !extraProducts.contains( prodProc ) ) {
+ item = findItem( prodProc );
+ shellProcess->addArgument( item->text(2) );
+ }
+ else
+ shellProcess->addArgument( extraProducts[ prodProc ] );
+ // ... get folder with binaries
+ QString OS = getPlatform();
+ if ( refPlatform.isEmpty() && platformsMap.find( curPlatform ) == platformsMap.end() )
+ OS = commonPlatform;
+ QString binDir = getPlatformBinPath( OS );
// ... temp folder
QString tmpFolder = QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
//if( !tempFolder->isEnabled() )
- //tmpFolder = "/tmp";
+ // tmpFolder = "/tmp";
+ // ... not install : try to find preinstalled
+ if ( notInstall.contains( prodProc ) || prodProc == "gcc" ) {
+ shellProcess->addArgument( "try_preinstalled" );
+ shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
+ shellProcess->addArgument( QDir( rootDirPath() ).filePath( "Products" ) );
+ statusLab->setText( tr( "Collecting environment for '" ) + prodProc + "'..." );
+ }
// ... binaries ?
- if ( productsView->isBinaries( item ) ) {
+ else if ( installType == Binaries ) {
shellProcess->addArgument( "install_binary" );
shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
- QString binDir = QDir::currentDirPath() + "/Products/BINARIES";
- if ( !myOS.isEmpty() )
- binDir += "/" + myOS;
shellProcess->addArgument( binDir );
+ statusLab->setText( tr( "Installing '" ) + prodProc + "'..." );
}
- // ... sources ?
- else if ( productsView->isSources( item ) ) {
- shellProcess->addArgument( "install_source" );
- shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
- shellProcess->addArgument( QDir::currentDirPath() + "/Products/SOURCES" );
- }
- // ... native ?
- else if ( productsView->isNative( item ) ) {
- shellProcess->addArgument( "try_native" );
- shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
- shellProcess->addArgument( QDir::currentDirPath() + "/Products" );
- }
- // ... not install : try to find preinstalled
+ // ... sources or sources_and_compilation ?
else {
- shellProcess->addArgument( "try_preinstalled" );
+ shellProcess->addArgument( installType == Sources ? "install_source" :
+ "install_source_and_build" );
shellProcess->addArgument( QFileInfo( tmpFolder ).absFilePath() );
- shellProcess->addArgument( QDir::currentDirPath() + "/Products" );
+ shellProcess->addArgument( QDir::cleanDirPath( getSrcPath() ) );
+ statusLab->setText( tr( "Installing '" ) + prodProc + "'..." );
}
// ... target folder
QString tgtFolder = QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() );
shellProcess->addArgument( QFileInfo( tgtFolder ).absFilePath() );
-
-
- QString depproducts = DefineDependeces(productsMap);
-#ifdef DEBUG
- cout << "Dependancies"<< depproducts.latin1() << endl;
-#endif
-
+ // ... list of all products
+ QString depproducts = getAllProducts(productsMap);
+ depproducts.prepend( QStringList( extraProducts.keys() ).join(" ") + " " );
+ ___MESSAGE___( "Dependancies"<< depproducts.latin1() );
shellProcess->addArgument( depproducts );
- // ... product name - currently instaled product
- shellProcess->addArgument( item->text(0) );
-
+ // ... product name - currently installed product
+ if ( !extraProducts.contains( prodProc ) )
+ shellProcess->addArgument( item->text(0) );
+ else
+ shellProcess->addArgument( prodProc );
+ // ... list of products being installed
+ shellProcess->addArgument( prodSequence.join( " " ) );
+ // ... sources directory
+ shellProcess->addArgument( QDir::cleanDirPath( getSrcPath() ) );
+ // ... remove sources and tmp files or not?
+ if ( installType == Compile && removeSrcBtn->isOn() )
+ shellProcess->addArgument( "TRUE" );
+ else
+ shellProcess->addArgument( "FALSE" );
+ // ... binaries directory
+ shellProcess->addArgument( binDir );
+ // ... install SALOME with GUI or not?
+ if ( woGuiModules.find( prodProc ) != woGuiModules.end() )
+ ( installGuiBtn->state() != QButton::On && woGuiModules[ prodProc ] == True ) ?
+ shellProcess->addArgument( "FALSE" ) :
+ shellProcess->addArgument( "TRUE" );
+ // ... single installation directory for SALOME modules, if this option was selected
+ if ( oneModDirBtn->isChecked() ) {
+ MapProducts::Iterator mapIter;
+ for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter )
+ if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "component" ) {
+ shellProcess->addArgument( "TRUE" );
+ break;
+ }
+ }
+ // ... single installation directory for prerequisites, if this option was selected
+ if ( oneProdDirBtn->isChecked() ) {
+ if ( prodProc == "DebianLibsForSalome" )
+ shellProcess->addArgument( oneProdDirName );
+ else {
+ MapProducts::Iterator mapIter;
+ for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter )
+ if ( mapIter.data().getName() == prodProc && mapIter.data().getType() == "prerequisite" ) {
+ shellProcess->addArgument( oneProdDirName );
+ break;
+ }
+ }
+ }
+
// run script
if ( !shellProcess->start() ) {
// error handling can be here
-#ifdef DEBUG
- cout << "error" << endl;
-#endif
+ ___MESSAGE___( "error" );
}
return;
}
-#ifdef DEBUG
- cout << "All products have been installed successfully" << endl;
-#endif
+
+ // else try to find aborted product
+ prodProc = progressView->findStatus( Aborted );
+ if ( !prodProc.isNull() )
+ return; // installation has been aborted
+
+ ___MESSAGE___( "All products have been 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
+ ___MESSAGE___( "starting pick-up environment" );
+ QString depproducts = QUOTE( getAllProducts(productsMap).prepend( QStringList( extraProducts.keys() ).join(" ") + " " ) );
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
+ if ( item->isOn() && dep.pickUpEnvironment() ) {
+ statusLab->setText( tr( "Pick-up products environment for " ) + dep.getName().latin1() + "..." );
+ ___MESSAGE___( "... for " << dep.getName().latin1() );
+ QDir rd( rootDirPath() );
+ Script script;
+ script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";";
+ script << item->text(2) << "pickup_env";
+ script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() );
+ script << QUOTE( QFileInfo( QDir::cleanDirPath( QDir( rootDirPath() ).filePath( "Products" ) ) ).absFilePath() );
+ script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() );
+ script << depproducts << item->text(0) << QUOTE( prodSequence.join( " " ) );
+ ___MESSAGE___( "... --> " << script.script().latin1() );
+ if ( system( script.script().latin1() ) ) {
+ ___MESSAGE___( "ERROR" );
}
}
}
+
+ if ( installType == Binaries ) {
+ if ( oneModDirBtn->isChecked() )
+ runModifyLaFiles();
+ else
+ runCheckFLib();
+ }
+ else {
+ // Update GUI and check installation errors
+ completeInstallation();
+ }
+
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::completeInstallation
+ * Update GUI and check installation errors
+ */
+// ================================================================
+void SALOME_InstallWizard::completeInstallation()
+{
+ // update status label
+ statusLab->setText( tr( "Installation completed" ) );
// <Next> button
- nextButton()->setEnabled( true );
- nextButton()->setText( tr( "&Next >" ) );
- QWhatsThis::add( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
- QToolTip::add ( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
- nextButton()->disconnect();
- connect( nextButton(), SIGNAL( clicked() ), this, SLOT( next() ) );
+ setNextEnabled( true );
+ doPostActions( tr( "&Next >" ), tr( "Move to the next step of the installation procedure" ) );
+ connect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) );
// <Back> button
- backButton()->setEnabled( true );
+ setBackEnabled( true );
// script parameters
passedParams->clear();
passedParams->setEnabled( false );
QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f );
+ installInfo->setFinished( true );
if ( isMinimized() )
showNormal();
raise();
+ if ( hasErrors ) {
+ if ( QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "There were some errors during the installation.\n"
+ "Do you want to save the installation log?" ),
+ tr( "&Save" ),
+ tr( "&Cancel" ),
+ QString::null,
+ 0,
+ 1 ) == 0 )
+ saveLog();
+ }
+ hasErrors = false;
+
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::onInstallGuiBtn
+ * <Installation with GUI> check-box slot
+ */
+// ================================================================
+void SALOME_InstallWizard::onInstallGuiBtn()
+{
+ MapProducts::Iterator itProd;
+ for ( itProd = productsMap.begin(); itProd != productsMap.end(); ++itProd ) {
+ if ( itProd.data().getType() == "component" ) {
+ if ( installGuiBtn->state() == QButton::On ) {
+ itProd.key()->setEnabled( true );
+ itProd.key()->setOn( true );
+ }
+ else {
+ QString itemName = itProd.data().getName();
+ if ( woGuiModules.find( itemName ) == woGuiModules.end() ||
+ woGuiModules[ itemName ] == False ) {
+ itProd.key()->setOn( false );
+ itProd.key()->setEnabled( false );
+ }
+ else
+ itProd.key()->setOn( true );
+ }
+ }
+ }
}
// ================================================================
/*!
void SALOME_InstallWizard::onMoreBtn()
{
if ( moreMode ) {
- moreBox->hide();
- moreBtn->setText( tr( "More..." ) );
+ prereqsView->hide();
+ moreBtn->setText( tr( "Show prerequisites..." ) );
+ setAboutInfo( moreBtn, tr( "Show list of prerequisites" ) );
}
else {
- moreBox->show();
- moreBtn->setText( tr( "Less..." ) );
+ prereqsView->show();
+ moreBtn->setText( tr( "Hide prerequisites" ) );
+ setAboutInfo( moreBtn, tr( "Hide list of prerequisites" ) );
}
qApp->processEvents();
moreMode = !moreMode;
InstallWizard::layOut();
qApp->processEvents();
if ( !isMaximized() ) {
- //setGeometry( geometry().x(), geometry().y(), geometry().width(), 0 );
- resize( geometry().width(), 0 );
qApp->processEvents();
}
checkProductPage();
}
// ================================================================
/*!
- * 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.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;
-#endif
- 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 ) {
+ QDir rd( rootDirPath() );
+ Script script;
+ script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";";
+ script << (*it).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.script().latin1() );
+ if ( (*it).script().isEmpty() || system( script.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
+ * <About> button slot: shows <About> dialog box
+ */
+// ================================================================
+void SALOME_InstallWizard::onAbout()
+{
+ AboutDlg d( this );
+ d.exec();
+}
+
// ================================================================
/*!
* SALOME_InstallWizard::findItem
- * Searches product listview item with given symbolic name
+ * Searches product listview item with given symbolic name
*/
// ================================================================
QCheckListItem* SALOME_InstallWizard::findItem( const QString& sName )
// ================================================================
void SALOME_InstallWizard::reject()
{
-#ifdef DEBUG
- cout << "REJECTED" << endl;
-#endif
+ ___MESSAGE___( "REJECTED" );
if ( !exitConfirmed ) {
- if ( QMessageBox::information( this,
- tr( "Exit" ),
- tr( "Do you want to quit %1?" ).arg( getIWName() ),
- tr( "&Yes" ),
+ if ( QMessageBox::information( this,
+ tr( "Exit" ),
+ tr( "Do you want to quit %1?" ).arg( getIWName() ),
+ tr( "&Yes" ),
tr( "&No" ),
QString::null,
0,
}
exitConfirmed = true;
}
- clean();
+ clean(true);
InstallWizard::reject();
}
// ================================================================
// ================================================================
void SALOME_InstallWizard::accept()
{
-#ifdef DEBUG
- cout << "ACCEPTED" << endl;
-#endif
- clean();
+ ___MESSAGE___( "ACCEPTED" );
+ clean(true);
InstallWizard::accept();
}
// ================================================================
/*!
* SALOME_InstallWizard::clean
- * Clears and removes temporary directory
+ * Clears and (optionally) removes temporary directory
*/
// ================================================================
-void SALOME_InstallWizard::clean()
+void SALOME_InstallWizard::clean(bool rmDir)
{
- // VSR: first remove temporary files
- QString script = "cd ./config_files/; remove_tmp.sh '";
- script += tempFolder->text().stripWhiteSpace() + TEMPDIRNAME;
- script += "' ";
- script += QUOTE(DefineDependeces(productsMap));
- script += " > /dev/null";
-#ifdef DEBUG
- cout << "script = " << script << endl;
-#endif
- if ( system( script.latin1() ) ) {
+ WarnDialog::showWarnDlg( 0, false );
+ myThread->clearCommands();
+ myWC.wakeAll();
+ while ( myThread->running() );
+ // first remove temporary files
+ QDir rd( rootDirPath() );
+ Script script;
+ script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";";
+ script << "remove_tmp.sh" << QUOTE( tempFolder->text().stripWhiteSpace() + TEMPDIRNAME );
+ script << QUOTE( getAllProducts( productsMap ) );
+ script << ">& /dev/null";
+ ___MESSAGE___( "script = " << script.script().latin1() );
+ if ( system( script.script().latin1() ) ) {
+ // error
}
- // VSR: then try to remove created temporary directory
+ // then try to remove created temporary directory
//script = "rm -rf " + QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME;
- if ( !tmpCreated.isNull() ) {
- script = "rm -rf " + tmpCreated;
- script += " > /dev/null";
- if ( system( script.latin1() ) ) {
+ if ( rmDir && !tmpCreated.isNull() ) {
+ script.clear();
+ script << "rm -rf" << QUOTE( tmpCreated );
+ script << ">& /dev/null";
+ if ( system( script.script().latin1() ) ) {
+ // error
}
-#ifdef DEBUG
- cout << "script = " << script << endl;
-#endif
+ ___MESSAGE___( "script = " << script.script().latin1() );
}
}
// ================================================================
// ================================================================
void SALOME_InstallWizard::pageChanged( const QString & mytitle)
{
- nextButton()->setText( tr( "&Next >" ) );
- QWhatsThis::add( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
- QToolTip::add ( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
- nextButton()->disconnect();
- connect( nextButton(), SIGNAL( clicked() ), this, SLOT( next() ) );
+ doPostActions( tr( "&Next >" ), tr( "Move to the next step of the installation procedure" ) );
+ connect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) );
cancelButton()->disconnect();
connect( cancelButton(), SIGNAL( clicked()), this, SLOT( reject() ) );
if ( !aPage )
return;
updateCaption();
- if ( aPage == productsPage ) {
+
+ if ( aPage == typePage ) {
+ // installation type page
+ if ( buttonGrp->id( buttonGrp->selected() ) == -1 )
+ // set default installation type
+ forceSrc ? srcCompileBtn->animateClick() : binBtn->animateClick();
+ else
+ buttonGrp->selected()->animateClick();
+ }
+ else if ( aPage == platformsPage ) {
+ // installation platforms page
+ MapXmlFiles::Iterator it;
+ if ( previousPage == typePage ) {
+ for ( it = platformsMap.begin(); it != platformsMap.end(); ++it ) {
+ QString plat = it.key();
+ QRadioButton* rb = ( (QRadioButton*) platBtnGrp->child( plat ) );
+ if ( installType == Binaries ) {
+ QFileInfo fib( getPlatformBinPath( plat ) );
+ rb->setEnabled( true/*fib.isDir()*/ );
+ if ( platBtnGrp->id( platBtnGrp->selected() ) == -1 && plat == getBasePlatform() )
+ rb->animateClick();
+ }
+// rb->setChecked( rb->isChecked() && rb->isEnabled() );
+ if ( rb->isChecked() && rb->isEnabled() )
+ rb->animateClick();
+ }
+ setNextEnabled( platformsPage, platBtnGrp->id( platBtnGrp->selected() ) != -1 );
+ }
+ }
+ else if ( aPage == dirPage ) {
+ // installation and temporary directories page
+ if ( ( ( this->indexOf( platformsPage ) != -1 && this->appropriate( platformsPage ) ) ?
+ previousPage == platformsPage : previousPage == typePage )
+ && stateChanged ) {
+ // clear global variables before reading XML file
+ modulesView->clear();
+ prereqsView->clear();
+ productsMap.clear();
+ // read XML file
+ StructureParser* parser = new StructureParser( this );
+ parser->setProductsLists( modulesView, prereqsView );
+ if ( targetFolder->text().isEmpty() )
+ parser->setTargetDir( targetFolder );
+ if ( tempFolder->text().isEmpty() )
+ parser->setTempDir( tempFolder );
+ parser->readXmlFile( xmlFileName );
+ // create a map of SALOME modules names, that can support installation without GUI mode
+ if ( woGuiModules.isEmpty() ) {
+ MapProducts::Iterator mapIter;
+ for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); mapIter++ ) {
+ Dependancies dep = mapIter.data();
+ if ( dep.getType() == "component" && dep.supportWoGuiMode() != NotDefined )
+ woGuiModules[ dep.getName() ] = dep.supportWoGuiMode();
+ }
+ }
+
+ // update required size for each product
+ updateSizeColumn();
+ // take into account command line parameters
+ if ( !myTargetPath.isEmpty() )
+ targetFolder->setText( myTargetPath );
+ if ( !myTmpPath.isEmpty() )
+ tempFolder->setText( myTmpPath );
+ // set all modules to be checked and first module to be selected
+ installGuiBtn->setState( QButton::Off );
+ installGuiBtn->setState( QButton::On );
+ if ( modulesView->childCount() > 0 && !modulesView->selectedItem() )
+ modulesView->setSelected( modulesView->firstChild(), true );
+ stateChanged = false;
+ }
+ else if ( rmSrcPrevState != removeSrcBtn->isChecked() ) {
+ // only update required size for each product
+ updateSizeColumn();
+ rmSrcPrevState = removeSrcBtn->isChecked();
+ }
+ // add extra products to install list
+ extraProducts.clear();
+ //extraProducts.insert( "gcc", "gcc-common.sh" );
+ if ( refPlatform == commonPlatform && installType == Binaries )
+ extraProducts.insert( "DebianLibsForSalome", "DEBIANFORSALOME-3.1.sh" );
+ }
+ else if ( aPage == productsPage ) {
// products page
onSelectionChanged();
checkProductPage();
else if ( aPage == progressPage ) {
if ( previousPage == prestartPage ) {
// progress page
+ statusLab->clear();
progressView->clear();
installInfo->clear();
+ installInfo->setFinished( false );
passedParams->clear();
passedParams->setEnabled( false );
QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f );
- 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
- nextButton()->disconnect();
- connect( nextButton(), SIGNAL( clicked() ), this, SLOT( onStart() ) );
- nextButton()->setEnabled( true );
+ doPostActions( tr( "&Start" ), tr( "Start installation process" ) );
+ connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+ setNextEnabled( true );
// reconnect Cancel button to terminate process
cancelButton()->disconnect();
connect( cancelButton(), SIGNAL( clicked() ), this, SLOT( tryTerminate() ) );
}
}
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() ) {
+ QDir rd( rootDirPath() );
+ Script script;
+ script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";";
+ script << (*it).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.script().latin1() );
+ (*it).button()->setEnabled( !(*it).script().isEmpty() && !system( script.script().latin1() ) );
+ }
+ }
finishButton()->setEnabled( true );
}
previousPage = aPage;
-#ifdef DEBUG
- cout << "previousPage = " << previousPage << endl;
-#endif
+ ___MESSAGE___( "previousPage = " << previousPage );
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::onButtonGroup
+ * Called when user selected either installation type or installation platform
+ */
+// ================================================================
+void SALOME_InstallWizard::onButtonGroup( int rbIndex )
+{
+ int prevType = installType;
+ QString prevPlat = getPlatform();
+ QWidget* aPage = InstallWizard::currentPage();
+ if ( aPage == typePage ) {
+ installType = InstallationType( rbIndex );
+ // management of the <Remove source and tmp files> check-box
+ removeSrcBtn->setEnabled( installType == Compile );
+ oneModDirBtn->setEnabled( installType == Binaries /*|| installType == Compile*/ );
+ oneProdDirBtn->setEnabled( installType == Binaries || installType == Compile );
+ refPlatform = "";
+ xmlFileName = getXmlFile( curPlatform );
+ }
+ else if ( aPage == platformsPage ) {
+ refPlatform = platBtnGrp->find( rbIndex )->name();
+ xmlFileName = getXmlFile( refPlatform );
+ setNextEnabled( platformsPage, true );
+ }
+ if ( prevType != installType ||
+ ( indexOf( platformsPage ) != -1 ? prevPlat != getPlatform() : false ) ) {
+ stateChanged = true;
+ oneModDirBtn->setChecked( installType == Binaries && singleDir );
+ oneProdDirBtn->setChecked( false );
+ }
}
// ================================================================
/*!
helpWindow->installEventFilter( this );
}
else {
- QMessageBox::warning( this,
- tr( "Help file not found" ),
+ QMessageBox::warning( this,
+ tr( "Help file not found" ),
tr( "Sorry, help is unavailable" ) );
}
}
theFolder->setText( typedDir );
theFolder->end( false );
}
- checkProductPage();
}
// ================================================================
/*!
// ================================================================
void SALOME_InstallWizard::onStart()
{
- // clear list of products to install ...
+ if ( nextButton()->text() == tr( "&Stop" ) ) {
+ statusLab->setText( tr( "Aborting installation..." ) );
+ shellProcess->kill();
+ modifyLaProc->kill();
+ while( shellProcess->isRunning() );
+ statusLab->setText( tr( "Installation has been aborted by user" ) );
+ return;
+ }
+
+ hasErrors = false;
+ progressView->clear();
+ installInfo->clear();
+ installInfo->setFinished( false );
+ passedParams->clear();
+ passedParams->setEnabled( false );
+ // disable 'Ignore errors' checkbox during installation process
+ ignoreErrCBox->setEnabled( false );
+ QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f );
+
+ // update status label
+ statusLab->setText( tr( "Preparing for installation..." ) );
+ // clear lists of products
toInstall.clear();
+ notInstall.clear();
+ toInstall += extraProducts.keys();
// ... and fill it for new process
- QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
+ QCheckListItem* item = (QCheckListItem*)( prereqsView->firstChild() );
+ while( item ) {
+ if ( productsMap.contains( item ) ) {
+ if ( item->isOn() )
+ toInstall.append( productsMap[item].getName() );
+ else
+ notInstall.append( productsMap[item].getName() );
+ }
+ item = (QCheckListItem*)( item->nextSibling() );
+ }
+ item = (QCheckListItem*)( modulesView->firstChild() );
while( item ) {
-// if ( productsView->isBinaries( item ) || productsView->isSources( item ) || productsView->isNative( item ) ) {
- if ( productsMap.contains( item ) )
- toInstall.append( productsMap[item].getName() );
-// }
+ if ( productsMap.contains( item ) ) {
+ if ( item->isOn() )
+ toInstall.append( productsMap[item].getName() );
+ else
+ notInstall.append( productsMap[item].getName() );
+ }
item = (QCheckListItem*)( item->nextSibling() );
}
// if something at all is selected
- if ( !toInstall.isEmpty() ) {
+ if ( (int)toInstall.count() > 0 ) {
+
+ if ( installType == Compile ) {
+ // update status label
+ statusLab->setText( tr( "Check Fortran compiler..." ) );
+ // check Fortran compiler.
+ QDir rd( rootDirPath() );
+ Script script;
+ script << QUOTE( rd.filePath( "config_files/checkFortran.sh" ) ) << "find_compilers";
+ script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() );
+ ___MESSAGE___( "script = " << script.script().latin1() );
+ if ( system( script.script().latin1() ) ) {
+ QMessageBox::critical( this,
+ tr( "Error" ),
+ tr( "Fortran compiler was not found at current system!\n"
+ "Installation can not be continued!"),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ // installation aborted
+ abort();
+ statusLab->setText( tr( "Installation has been aborted" ) );
+ // enable <Next> button
+ setNextEnabled( true );
+ doPostActions( tr( "&Start" ), tr( "Start installation process" ) );
+ connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+ // enable <Back> button
+ setBackEnabled( true );
+ return;
+ }
+ }
+
+ // update status label
+ statusLab->setText( tr( "Preparing for installation..." ) );
+
+ clean(false); // VSR 07/02/05 - bug fix: first we should clear temporary directory
// disable <Next> button
- nextButton()->setEnabled( false );
+ //setNextEnabled( false );
+ nextButton()->setText( tr( "&Stop" ) );
+ setAboutInfo( nextButton(), tr( "Abort installation process" ) );
// disable <Back> button
- backButton()->setEnabled ( false );
+ setBackEnabled( false );
// enable script parameters line edit
// VSR commented: 18/09/03: passedParams->setEnabled( true );
// VSR commented: 18/09/03: passedParams->setFocus();
- // set status for all products
+ ProgressViewItem* progressItem;
+ // set status for installed products
for ( int i = 0; i < (int)toInstall.count(); i++ ) {
- item = findItem( toInstall[ i ] );
- QString type = "";
- if ( productsView->isBinaries( item ) )
- type = tr( "binaries" );
- else if ( productsView->isSources( item ) )
- type = tr( "sources" );
- else if ( productsView->isNative( item ) )
- type = tr( "native" );
- else
- type = tr( "not install" );
- progressView->addProduct( item->text(0), type, item->text(2) );
+ if ( !extraProducts.contains( toInstall[i] ) ) {
+ item = findItem( toInstall[i] );
+ progressView->addProduct( item->text(0), item->text(2) );
+ continue;
+ }
+ progressItem = progressView->addProduct( toInstall[i], extraProducts[toInstall[i]] );
+ progressItem->setVisible( false );
+ }
+ // set status for not installed products
+ for ( int i = 0; i < (int)notInstall.count(); i++ ) {
+ item = findItem( notInstall[i] );
+ progressItem = progressView->addProduct( item->text(0), item->text(2) );
+ progressItem->setVisible( false );
+ }
+ // get specified list of products being installed
+ prodSequence.clear();
+ for (int i = 0; i<(int)toInstall.count(); i++ ) {
+ if ( extraProducts.contains( toInstall[i] ) ) {
+ prodSequence.append( toInstall[i] );
+ continue;
+ }
+ if ( installType == Binaries ) {
+ prodSequence.append( toInstall[i] );
+ QString prodType;
+ MapProducts::Iterator mapIter;
+ for ( mapIter = productsMap.begin(); mapIter != productsMap.end(); ++mapIter ) {
+ if ( mapIter.data().getName() == toInstall[i] && mapIter.data().getType() == "component" ) {
+ prodSequence.append( toInstall[i] + "_src" );
+ break;
+ }
+ }
+ }
+ else if ( installType == Sources )
+ prodSequence.append( toInstall[i] + "_src" );
+ else {
+ prodSequence.append( toInstall[i] );
+ prodSequence.append( toInstall[i] + "_src" );
+ }
+ }
+
+ // create a backup of 'env_build.csh', 'env_build.sh', 'env_products.csh', 'env_products.sh'
+ // ( backup of 'salome.csh' and 'salome.sh' is made if pick-up environment is called )
+ QDir rd( rootDirPath() );
+ Script script;
+ script << QUOTE( rd.filePath( "config_files/backupEnv.sh" ) );
+ script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() );
+ ___MESSAGE___( "script = " << script.script().latin1() );
+ if ( system( script.script().latin1() ) ) {
+ if ( QMessageBox::warning( this,
+ tr( "Warning" ),
+ tr( "Backup environment files have not been created.\n"
+ "Do you want to continue an installation process?" ),
+ tr( "&Yes" ),
+ tr( "&No" ),
+ QString::null, 0, 1 ) == 1 ) {
+ // installation aborted
+ abort();
+ statusLab->setText( tr( "Installation has been aborted by user" ) );
+ // update <Next> button
+ setNextEnabled( true );
+ doPostActions( tr( "&Start" ), tr( "Start installation process" ) );
+ connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+ // enable <Back> button
+ setBackEnabled( true );
+ return;
+ }
}
+
// launch install script
launchScript();
}
/*!
Callback function - as response for the script finishing
*/
-void SALOME_InstallWizard::productInstalled( )
+void SALOME_InstallWizard::productInstalled()
{
-#ifdef DEBUG
- cout << "process exited" << endl;
-#endif
+ ___MESSAGE___( "process exited" );
if ( shellProcess->normalExit() ) {
-#ifdef DEBUG
- cout << "...normal exit" << endl;
-#endif
+ ___MESSAGE___( "...normal exit" );
// normal exit - try to proceed installation further
launchScript();
}
else {
-#ifdef DEBUG
- cout << "...abnormal exit" << endl;
-#endif
+ ___MESSAGE___( "...abnormal exit" );
+ statusLab->setText( tr( "Installation has been aborted" ) );
// installation aborted
abort();
// clear script passed parameters lineedit
passedParams->clear();
passedParams->setEnabled( false );
QFont f = parametersLab->font(); f.setBold( false ); parametersLab->setFont( f );
+ installInfo->setFinished( true );
// enable <Next> button
- nextButton()->setEnabled( true );
- nextButton()->setText( tr( "&Next >" ) );
- QWhatsThis::add( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
- QToolTip::add ( nextButton(), tr( "Moves to the next step of the installation procedure" ) );
- nextButton()->disconnect();
- connect( nextButton(), SIGNAL( clicked() ), this, SLOT( next() ) );
+ setNextEnabled( true );
+ doPostActions( tr( "&Start" ), tr( "Start installation process" ) );
+ connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+ //doPostActions( tr( "&Next >" ), tr( "Move to the next step of the installation procedure" ) );
+ //connect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) );
// enable <Back> button
- backButton()->setEnabled( true );
+ setBackEnabled( true );
}
}
// ================================================================
void SALOME_InstallWizard::tryTerminate()
{
if ( shellProcess->isRunning() ) {
- if ( QMessageBox::information( this,
- tr( "Exit" ),
- tr( "Do you want to quit %1?" ).arg( getIWName() ),
- tr( "&Yes" ),
+ if ( QMessageBox::information( this,
+ tr( "Exit" ),
+ tr( "Do you want to quit %1?" ).arg( getIWName() ),
+ tr( "&Yes" ),
tr( "&No" ),
QString::null,
0,
void SALOME_InstallWizard::onCancel()
{
shellProcess->kill();
+ modifyLaProc->kill();
+ checkFLibProc->kill();
reject();
}
// ================================================================
/*!
* SALOME_InstallWizard::onSelectionChanged
* Called when selection is changed in the products list view
+ * to fill in the 'Information about product' text box
*/
// ================================================================
void SALOME_InstallWizard::onSelectionChanged()
{
- productsInfo->clear();
- QListViewItem* item = productsView->selectedItem();
+ const QObject* snd = sender();
+ QListViewItem* item = modulesView->selectedItem();
+ if ( snd == prereqsView )
+ item = prereqsView->selectedItem();
if ( !item )
return;
- if ( item->parent() )
- item = item->parent();
- QCheckListItem* aItem = (QCheckListItem*)item;
- if ( !productsMap.contains( aItem ) )
+ productInfo->clear();
+ QCheckListItem* anItem = (QCheckListItem*)item;
+ if ( !productsMap.contains( anItem ) )
return;
- Dependancies dep = productsMap[ aItem ];
- QString text = "<b>" + aItem->text(0) + "</b>" + "<br>";
- if ( !aItem->text(1).stripWhiteSpace().isEmpty() )
- text += tr( "Version" ) + ": " + aItem->text(1) + "<br>";
+ Dependancies dep = productsMap[ anItem ];
+ QString text = "<b>" + anItem->text(0) + "</b>" + "<br>";
+ if ( !dep.getVersion().isEmpty() )
+ text += tr( "Version" ) + ": " + dep.getVersion() + "<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 ) ) {
- 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>";
+ /* AKL: 07/08/28 - hide required disk space for tmp files for each product ==>
+ long tempSize = 0;
+ tempSize = dep.getTempSize( installType );
+ text += tr( "Disk space for tmp files required" ) + ": " + QString::number( tempSize ) + " KB<br>";
+ AKL: 07/08/28 - hide required disk space for tmp files for each product <==
+ */
+ text += tr( "Disk space required" ) + ": " + item->text(1) + "<br>";
text += "<br>";
QString req = ( dep.getDependancies().count() > 0 ? dep.getDependancies().join(", ") : tr( "none" ) );
text += tr( "Prerequisites" ) + ": " + req;
- productsInfo->setText( text );
+ productInfo->setText( text );
}
// ================================================================
/*!
// ================================================================
void SALOME_InstallWizard::onItemToggled( QCheckListItem* item )
{
- if ( prerequisites->isChecked() ) {
- if ( item->parent() )
- item = (QCheckListItem*)( item->parent() );
- if ( productsMap.contains( item ) ) {
- productsView->blockSignals( true );
+ if ( productsMap.contains( item ) ) {
+ if ( item->isOn() )
setPrerequisites( item );
- productsView->blockSignals( false );
- }
- }
- onSelectionChanged();
- checkProductPage();
-}
-// ================================================================
-/*!
- * SALOME_InstallWizard::onProdBtn
- * This slot is called when user clicks one of <Select Sources>,
- * <Select Binaries>, <Unselect All> buttons ( products page )
- */
-// ================================================================
-void SALOME_InstallWizard::onProdBtn()
-{
- const QObject* snd = sender();
- productsView->blockSignals( true );
- if ( snd == unselectBtn ) {
- QCheckListItem* item = (QCheckListItem*)( productsView->firstChild() );
- while( item ) {
- productsView->setNone( item );
- item = (QCheckListItem*)( item->nextSibling() );
- }
+ else
+ unsetPrerequisites( item );
}
- productsView->blockSignals( false );
onSelectionChanged();
checkProductPage();
}
// ================================================================
void SALOME_InstallWizard::wroteToStdin( )
{
-#ifdef DEBUG
- cout << "Something was sent to stdin" << endl;
-#endif
+ ___MESSAGE___( "Something was sent to stdin" );
}
// ================================================================
/*!
// ================================================================
void SALOME_InstallWizard::readFromStdout( )
{
-#ifdef DEBUG
- cout << "Something was sent to stdout" << endl;
-#endif
- while ( shellProcess->canReadLineStdout() ) {
- installInfo->append( QString( shellProcess->readLineStdout() ) );
+ ___MESSAGE___( "Something was sent to stdout" );
+ QProcess* theProcess = ( QProcess* )sender();
+ while ( theProcess->canReadLineStdout() ) {
+ installInfo->append( QString( theProcess->readLineStdout() ) );
installInfo->scrollToBottom();
}
- QString str( shellProcess->readStdout() );
+ QString str( theProcess->readStdout() );
if ( !str.isEmpty() ) {
installInfo->append( str );
installInfo->scrollToBottom();
}
}
+
+#define OUTLINE_TEXT(x) QString( "<font color=#FF0000><b>" ) + QString( x ) + QString( "</b></font>" )
+
// ================================================================
/*!
* SALOME_InstallWizard::readFromStderr
// ================================================================
void SALOME_InstallWizard::readFromStderr( )
{
-#ifdef DEBUG
- cout << "Something was sent to stderr" << endl;
-#endif
- while ( shellProcess->canReadLineStderr() ) {
- installInfo->append( QString( shellProcess->readLineStderr() ) );
+ ___MESSAGE___( "Something was sent to stderr" );
+ QProcess* theProcess = ( QProcess* )sender();
+ while ( theProcess->canReadLineStderr() ) {
+ installInfo->append( OUTLINE_TEXT( QString( theProcess->readLineStderr() ) ) );
installInfo->scrollToBottom();
+ hasErrors = true;
}
- QString str( shellProcess->readStderr() );
+ QString str( theProcess->readStderr() );
if ( !str.isEmpty() ) {
- installInfo->append( str );
+ installInfo->append( OUTLINE_TEXT( str ) );
installInfo->scrollToBottom();
+ hasErrors = true;
}
- passedParams->setEnabled( true );
- passedParams->setFocus();
- QFont f = parametersLab->font(); f.setBold( true ); parametersLab->setFont( f );
+
+ // stop or proceed installation process
+ manageInstProc();
+
+ // VSR: 10/11/05 - disable answer mode ==>
+ // passedParams->setEnabled( true );
+ // passedParams->setFocus();
+ // QFont f = parametersLab->font(); f.setBold( true ); parametersLab->setFont( f );
+ // VSR: 10/11/05 - disable answer mode <==
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::manageInstProc
+ * QProcess slot: -->stop installation if there is an error in stderr
+ */
+// ================================================================
+void SALOME_InstallWizard::manageInstProc()
+{
+ if ( !hasErrors || ignoreErrCBox->isChecked() )
+ return; //proceed installation process
+
+ // abort the current installation
+ statusLab->setText( tr( "Aborting installation..." ) );
+ abort();
+ statusLab->setText( tr( "Installation has been aborted because some errors" ) );
+ if ( QMessageBox::critical( this,
+ tr( "Error" ),
+ tr( "Installation process has been stopped, because an error occured \n"
+ "during an installation of the current product!\n"
+ "Please see the installation progress view for more details about the error.\n\n"
+ "Do you want to save the installation log?" ),
+ tr( "&Save" ),
+ tr( "&Cancel" ),
+ QString::null,
+ 0,
+ 1 ) == 0 )
+ saveLog();
+ // enable <Next> button
+ setNextEnabled( true );
+ doPostActions( tr( "&Start" ), tr( "Start installation process" ) );
+ connect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+ // enable <Back> button
+ setBackEnabled( true );
+ installInfo->setFinished( true );
}
// ================================================================
/*!
productsMap[item] = dep;
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::doPostActions
+ * Executes some actions after finish of installation process (successful or not)
+ */
+// ================================================================
+void SALOME_InstallWizard::doPostActions( const QString& btnText,
+ const QString& btnAboutInfo )
+{
+ // update <Next> button
+ nextButton()->setText( btnText );
+ setAboutInfo( nextButton(), btnAboutInfo );
+ // reconnect Next button - to use it as Start button
+ disconnect( this, SIGNAL( nextClicked() ), this, SLOT( next() ) );
+ disconnect( this, SIGNAL( nextClicked() ), this, SLOT( onStart() ) );
+ // enable 'Ignore errors' checkbox
+ ignoreErrCBox->setEnabled( true );
+}
+// ================================================================
+/*!
+ * SALOME_InstallWizard::addFinishButton
+ * Add button for the <Finish> page.
+ * Clear list of buttons if <toClear> flag is true.
+ */
+// ================================================================
+void SALOME_InstallWizard::addFinishButton( const QString& label,
+ const QString& tooltip,
+ const QString& script,
+ bool toClear )
+{
+ ButtonList btns;
+ if ( toClear ) {
+ btns = buttons;
+ buttons.clear();
+ }
+ buttons.append( Button( label, tooltip, script ) );
+ // create finish buttons
+ QButton* b = new QPushButton( tr( buttons.last().label() ), readmePage );
+ if ( !buttons.last().tootip().isEmpty() )
+ setAboutInfo( b, tr( buttons.last().tootip() ) );
+ QHBoxLayout* hLayout = (QHBoxLayout*)readmePage->layout()->child("finishButtons");
+ if ( toClear ) {
+ // remove previous buttons
+ ButtonList::Iterator it;
+ for ( it = btns.begin(); it != btns.end(); ++it ) {
+ hLayout->removeChild( (*it).button() );
+ delete (*it).button();
+ }
+ }
+ // add buttons to finish page
+ hLayout->insertWidget( buttons.count()-1, b );
+ buttons.last().setButton( b );
+ connect( b, SIGNAL( clicked() ), this, SLOT( onFinishButton() ) );
+}
+// ================================================================
/*!
* SALOME_InstallWizard::polish
* Polishing of the widget - to set right initial size
InstallWizard::polish();
}
// ================================================================
+/*!
+ * SALOME_InstallWizard::saveLog
+ * Save installation log to file
+ */
+// ================================================================
+void SALOME_InstallWizard::saveLog()
+{
+ QString txt = installInfo->text();
+ if ( txt.length() <= 0 )
+ return;
+ QDateTime dt = QDateTime::currentDateTime();
+ QString fileName = dt.toString("ddMMyy-hhmm");
+ fileName.prepend("install-"); fileName.append(".html");
+ fileName = QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ), fileName ).absFilePath();
+ fileName = QFileDialog::getSaveFileName( fileName,
+ QString( "HTML files (*.htm *.html)" ),
+ this, 0,
+ tr( "Save Log file" ) );
+ if ( !fileName.isEmpty() ) {
+ QFile f( fileName );
+ if ( f.open( IO_WriteOnly ) ) {
+ QTextStream stream( &f );
+ stream << txt;
+ f.close();
+ }
+ else {
+ QMessageBox::critical( this,
+ tr( "Error" ),
+ tr( "Can't save file %1.\nCheck path and permissions.").arg( fileName ),
+ QMessageBox::Ok,
+ QMessageBox::NoButton,
+ QMessageBox::NoButton );
+ }
+ }
+}
+// ================================================================
/*!
* SALOME_InstallWizard::updateCaption
* Updates caption according to the current page number
void SALOME_InstallWizard::updateCaption()
{
QWidget* aPage = InstallWizard::currentPage();
- if ( !aPage )
+ if ( !aPage )
return;
InstallWizard::setCaption( tr( myCaption ) + " " +
tr( getIWName() ) + " - " +
tr( "Step %1 of %2").arg( QString::number( this->indexOf( aPage )+1 ) ).arg( QString::number( this->pageCount() ) ) );
}
+
+// ================================================================
+/*!
+ * SALOME_InstallWizard::processValidateEvent
+ * Processes validation event (<val> is validation code)
+ */
+// ================================================================
+void SALOME_InstallWizard::processValidateEvent( const int val, void* data )
+{
+ QWidget* aPage = InstallWizard::currentPage();
+ if ( aPage != productsPage ) {
+ InstallWizard::processValidateEvent( val, data );
+ return;
+ }
+ myMutex.lock();
+ myMutex.unlock();
+ if ( val > 0 ) {
+ }
+ if ( myThread->hasCommands() )
+ myWC.wakeAll();
+ else {
+ WarnDialog::showWarnDlg( 0, false );
+ InstallWizard::processValidateEvent( val, data );
+ }
+}