From: vsr Date: Wed, 17 Mar 2004 15:13:58 +0000 (+0000) Subject: - Fix bugs X-Git-Tag: PAL_1_4_1~37 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e248ae8e6480f161e70bd6d50c2351cf1d64c4e1;p=tools%2Finstall.git - Fix bugs - Update sources for PAL/SALOME v1.4.1 --- diff --git a/bin/SALOME_InstallWizard b/bin/SALOME_InstallWizard new file mode 100755 index 0000000..68c6a6c Binary files /dev/null and b/bin/SALOME_InstallWizard differ diff --git a/config.xml b/config.xml index a777fd7..8173cab 100644 --- a/config.xml +++ b/config.xml @@ -1,7 +1,7 @@ - + + - - + - + + + + + + + + + + + + + script="netgenplugin_bin_1.0.sh"/> diff --git a/config_RedHat8_0.xml b/config_RedHat8_0.xml index 2514bba..8173cab 100644 --- a/config_RedHat8_0.xml +++ b/config_RedHat8_0.xml @@ -1,7 +1,7 @@ - - + + + + + + + + + + - + + + + script="netgenplugin_bin_1.0.sh"/> diff --git a/runInstall b/runInstall index c854b82..c6e5bdf 100755 --- a/runInstall +++ b/runInstall @@ -7,7 +7,7 @@ import sys, os, string, re # get_help_info #============================================================== def get_help_info() : - str = "\nSALOME Professional Installation Wizard\n\n" + str = "\nPAL/SALOME Installation Wizard\n\n" str = str + "\tUsage : \n\tInstall [-g|b] [-f ] [-t ] [-tmp ]\n" str = str + "\n" str = str + " -g Runs the Installation Wizard in the GUI mode.\n" @@ -465,7 +465,7 @@ if __name__ == "__main__": env["LD_LIBRARY_PATH"] = ".:" + env["LD_LIBRARY_PATH"] env["PATH"] = ".:"+ env["PATH"] - sys.exit(os.system("cd " + cur_dir + "; ./bin/SALOMEPRO_InstallWizard " + xml_file +"&")) + sys.exit(os.system("cd " + cur_dir + "; ./bin/SALOME_InstallWizard " + xml_file +"&")) diff --git a/src/InstallWizard.cpp b/src/InstallWizard.cpp index be056b1..c99cc8a 100644 --- a/src/InstallWizard.cpp +++ b/src/InstallWizard.cpp @@ -1,9 +1,9 @@ // File : InstallWizard.cpp // Created : Thu Mar 27 12:01:00 2003 // Author : Vadim SANDLER -// Project : SALOME Professional +// Project : PAL/SALOME // Module : InstallWizard -// Copyright : 2003 CEA/DEN, EDF R&D +// Copyright : 2004 CEA // $Header$ #include "InstallWizard.h" diff --git a/src/InstallWizard.h b/src/InstallWizard.h index 1a1a6b8..bc4f750 100644 --- a/src/InstallWizard.h +++ b/src/InstallWizard.h @@ -1,9 +1,9 @@ // File : InstallWizard.h // Created : Thu Mar 27 12:01:00 2003 // Author : Vadim SANDLER -// Project : SALOME Professional +// Project : PAL/SALOME // Module : InstallWizard -// Copyright : 2003 CEA/DEN, EDF R&D +// Copyright : 2004 CEA // $Header$ #ifndef InstallWizard_h diff --git a/src/Makefile b/src/Makefile index 10c0ead..b4dc32c 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,9 +1,9 @@ ############################################################################# -# Makefile for building: ../bin/SALOMEPRO_InstallWizard -# Generated by qmake (1.03a) on: Fri Jul 25 09:43:22 2003 -# Project: SALOMEPRO_INSTALL.pro +# Makefile for building: ../bin/SALOME_InstallWizard +# Generated by qmake (1.03a) on: Wed Mar 17 17:34:01 2004 +# Project: SALOME_INSTALL.pro # Template: app -# Command: $(QMAKE) SALOMEPRO_INSTALL.pro +# Command: $(QMAKE) SALOME_INSTALL.pro ############################################################################# ####### Compiler, tools and options @@ -12,14 +12,14 @@ CC = gcc CXX = g++ LEX = flex YACC = yacc -CFLAGS = -pipe -Wall -W -O2 -DQT_NO_DEBUG -CXXFLAGS = -pipe -Wall -W -O2 -DQT_NO_DEBUG +CFLAGS = -pipe -Wall -W -I/usr/include/fontconfig -I/usr/include/Xft2 -O2 -march=i386 -mcpu=i686 -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG +CXXFLAGS = -pipe -Wall -W -I/usr/include/fontconfig -I/usr/include/Xft2 -O2 -march=i386 -mcpu=i686 -fno-use-cxa-atexit -fno-exceptions -DQT_NO_DEBUG LEXFLAGS = YACCFLAGS= -d INCPATH = -I$(QTDIR)/include -I$(QTDIR)/mkspecs/default LINK = g++ LFLAGS = -LIBS = $(SUBLIBS) -Wl,-rpath,$(QTDIR)/lib -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt -ldl -lXinerama -lXft -lSM -lqt -lXext -lX11 -lm +LIBS = $(SUBLIBS) -L$(QTDIR)/lib -L/usr/X11R6/lib -lqt -ldl -lXinerama -lSM -lqt-mt -lXext -lX11 -lm AR = ar cqs RANLIB = MOC = $(QTDIR)/bin/moc @@ -42,28 +42,41 @@ OBJECTS_DIR = ./ ####### Files HEADERS = SALOME_InstallWizard.hxx \ - helpwindow.h \ + SALOME_ProductsView.hxx \ + SALOME_ProgressView.hxx \ + SALOME_XmlHandler.hxx \ + SALOME_HelpWindow.hxx \ icons.h \ InstallWizard.h -SOURCES = SALOME_InstallWizard.cxx \ - helpwindow.cpp \ +SOURCES = main.cxx \ + SALOME_InstallWizard.cxx \ + SALOME_ProductsView.cxx \ + SALOME_ProgressView.cxx \ + SALOME_XmlHandler.cxx \ + SALOME_HelpWindow.cxx \ InstallWizard.cpp -OBJECTS = SALOME_InstallWizard.o \ - helpwindow.o \ +OBJECTS = main.o \ + SALOME_InstallWizard.o \ + SALOME_ProductsView.o \ + SALOME_ProgressView.o \ + SALOME_XmlHandler.o \ + SALOME_HelpWindow.o \ InstallWizard.o FORMS = UICDECLS = UICIMPLS = SRCMOC = moc_SALOME_InstallWizard.cpp \ - moc_helpwindow.cpp \ + moc_SALOME_ProductsView.cpp \ + moc_SALOME_HelpWindow.cpp \ moc_InstallWizard.cpp OBJMOC = moc_SALOME_InstallWizard.o \ - moc_helpwindow.o \ + moc_SALOME_ProductsView.o \ + moc_SALOME_HelpWindow.o \ moc_InstallWizard.o -DIST = SALOMEPRO_INSTALL.pro -QMAKE_TARGET = ../bin/SALOMEPRO_InstallWizard +DIST = SALOME_INSTALL.pro +QMAKE_TARGET = ../bin/SALOME_InstallWizard DESTDIR = -TARGET = ../bin/SALOMEPRO_InstallWizard +TARGET = ../bin/SALOME_InstallWizard first: all ####### Implicit rules @@ -97,13 +110,13 @@ mocables: $(SRCMOC) $(MOC): ( cd $(QTDIR)/src/moc ; $(MAKE) ) -Makefile: SALOMEPRO_INSTALL.pro $(QTDIR)/mkspecs/default/qmake.conf - $(QMAKE) SALOMEPRO_INSTALL.pro +Makefile: SALOME_INSTALL.pro $(QTDIR)/mkspecs/default/qmake.conf + $(QMAKE) SALOME_INSTALL.pro qmake: - @$(QMAKE) SALOMEPRO_INSTALL.pro + @$(QMAKE) SALOME_INSTALL.pro dist: - @mkdir -p bin/SALOMEPRO_InstallWizard && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) bin/SALOMEPRO_InstallWizard/ && ( cd `dirname bin/SALOMEPRO_InstallWizard` && $(TAR) ../bin/SALOMEPRO_InstallWizard.tar ../bin/SALOMEPRO_InstallWizard && $(GZIP) ../bin/SALOMEPRO_InstallWizard.tar ) && $(MOVE) `dirname bin/SALOMEPRO_InstallWizard`/../bin/SALOMEPRO_InstallWizard.tar.gz . && $(DEL_DIR) bin/SALOMEPRO_InstallWizard + @mkdir -p bin/SALOME_InstallWizard && $(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) bin/SALOME_InstallWizard/ && ( cd `dirname bin/SALOME_InstallWizard` && $(TAR) ../bin/SALOME_InstallWizard.tar ../bin/SALOME_InstallWizard && $(GZIP) ../bin/SALOME_InstallWizard.tar ) && $(MOVE) `dirname bin/SALOME_InstallWizard`/../bin/SALOME_InstallWizard.tar.gz . && $(DEL_DIR) bin/SALOME_InstallWizard mocclean: -$(DEL_FILE) $(OBJMOC) @@ -126,28 +139,49 @@ FORCE: ####### Compile +main.o: main.cxx SALOME_InstallWizard.hxx \ + InstallWizard.h + SALOME_InstallWizard.o: SALOME_InstallWizard.cxx SALOME_InstallWizard.hxx \ + SALOME_ProductsView.hxx \ + SALOME_ProgressView.hxx \ + SALOME_XmlHandler.hxx \ + SALOME_HelpWindow.hxx \ icons.h \ - InstallWizard.h \ - helpwindow.h + InstallWizard.h -helpwindow.o: helpwindow.cpp helpwindow.h \ - icons.h +SALOME_ProductsView.o: SALOME_ProductsView.cxx SALOME_ProductsView.hxx + +SALOME_ProgressView.o: SALOME_ProgressView.cxx SALOME_ProgressView.hxx + +SALOME_XmlHandler.o: SALOME_XmlHandler.cxx SALOME_XmlHandler.hxx \ + SALOME_ProductsView.hxx \ + SALOME_InstallWizard.hxx \ + InstallWizard.h + +SALOME_HelpWindow.o: SALOME_HelpWindow.cxx SALOME_HelpWindow.hxx \ + SALOME_InstallWizard.hxx \ + icons.h \ + InstallWizard.h InstallWizard.o: InstallWizard.cpp InstallWizard.h -moc_SALOME_InstallWizard.o: moc_SALOME_InstallWizard.cpp SALOME_InstallWizard.hxx InstallWizard.h \ - helpwindow.h +moc_SALOME_InstallWizard.o: moc_SALOME_InstallWizard.cpp SALOME_InstallWizard.hxx InstallWizard.h -moc_helpwindow.o: moc_helpwindow.cpp helpwindow.h +moc_SALOME_ProductsView.o: moc_SALOME_ProductsView.cpp SALOME_ProductsView.hxx + +moc_SALOME_HelpWindow.o: moc_SALOME_HelpWindow.cpp SALOME_HelpWindow.hxx moc_InstallWizard.o: moc_InstallWizard.cpp InstallWizard.h moc_SALOME_InstallWizard.cpp: $(MOC) SALOME_InstallWizard.hxx $(MOC) SALOME_InstallWizard.hxx -o moc_SALOME_InstallWizard.cpp -moc_helpwindow.cpp: $(MOC) helpwindow.h - $(MOC) helpwindow.h -o moc_helpwindow.cpp +moc_SALOME_ProductsView.cpp: $(MOC) SALOME_ProductsView.hxx + $(MOC) SALOME_ProductsView.hxx -o moc_SALOME_ProductsView.cpp + +moc_SALOME_HelpWindow.cpp: $(MOC) SALOME_HelpWindow.hxx + $(MOC) SALOME_HelpWindow.hxx -o moc_SALOME_HelpWindow.cpp moc_InstallWizard.cpp: $(MOC) InstallWizard.h $(MOC) InstallWizard.h -o moc_InstallWizard.cpp diff --git a/src/README.txt b/src/README.txt index 78b3e49..b5a5d2b 100644 --- a/src/README.txt +++ b/src/README.txt @@ -1,4 +1,5 @@ -Notes on building SALOME Professional v1.1 InstallWizard. +--------------------------------------------------------- +Notes on building SALOME Installation Wizard. --------------------------------------------------------- You must have precompiled gcc and qt static libraries. diff --git a/src/SALOMEPRO_INSTALL.pro b/src/SALOMEPRO_INSTALL.pro deleted file mode 100644 index cd6c8a8..0000000 --- a/src/SALOMEPRO_INSTALL.pro +++ /dev/null @@ -1,11 +0,0 @@ -TEMPLATE = app -CONFIG += qt warn_on release -HEADERS = SALOME_InstallWizard.hxx -HEADERS += helpwindow.h -HEADERS += icons.h -HEADERS += InstallWizard.h -SOURCES = SALOME_InstallWizard.cxx -SOURCES += helpwindow.cpp -SOURCES += InstallWizard.cpp -TARGET = ../bin/SALOMEPRO_InstallWizard -unix:LIBS += -lqt -ldl -lXinerama -lXft -lSM diff --git a/src/SALOME_HelpWindow.cxx b/src/SALOME_HelpWindow.cxx new file mode 100644 index 0000000..8fe4970 --- /dev/null +++ b/src/SALOME_HelpWindow.cxx @@ -0,0 +1,125 @@ +// File : SALOME_HelpWindow.cxx +// Created : Thu Dec 18 12:01:00 2002 +// Author : Vadim SANDLER +// Project : PAL/SALOME +// Module : InstallWizard +// Copyright : 2004 CEA +// $Header$ + +#include "SALOME_HelpWindow.hxx" +#include "SALOME_InstallWizard.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "icons.h" + +#define DEFAULT_WIDTH 800 +#define DEFAULT_HEIGHT 700 + +// ================================================================ +/*! + * HelpWindow::HelpWindow + * Constructor + */ +// ================================================================ +HelpWindow::HelpWindow( SALOME_InstallWizard* wizard ) : QMainWindow( 0, "SalomeProHelpWindow", WDestructiveClose ) +{ + QString hlpFile = QDir::currentDirPath() + "/doc/readme.html"; + QString hlpDir = "."; + // caption + setCaption( wizard->getCaption() + " " + wizard->getIWName() + " " + tr( "Help" ) ); + // icon + setIcon( QPixmap( (const char**)image0_data ) ); + // create browser + browser = new QTextBrowser( this ); + browser->mimeSourceFactory()->setFilePath( hlpDir ); + browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); + setCentralWidget( browser ); + // set source directory + if ( !hlpFile.isEmpty() ) + browser->setSource( hlpFile ); + // toolbar + QToolBar* toolbar = new QToolBar( this ); + addToolBar( toolbar, "Toolbar" ); + QToolButton* button; + // --> back + button = new QToolButton( QIconSet( (const char**)back ), + tr( "Backward" ), + "", + browser, + SLOT( backward() ), + toolbar ); + button->setEnabled( FALSE ); + connect( browser, SIGNAL( backwardAvailable( bool ) ), button, SLOT( setEnabled( bool ) ) ); + // --> forward + button = new QToolButton( QIconSet( (const char**)forward ), + tr( "Forward" ), + "", + browser, + SLOT( forward() ), + toolbar ); + button->setEnabled( FALSE ); + connect( browser, SIGNAL( forwardAvailable( bool ) ), button, SLOT( setEnabled( bool ) ) ); + // --> home + button = new QToolButton( QIconSet( (const char**)home ), + tr( "Home" ), + "", + browser, + SLOT( home() ), + toolbar ); + toolbar->addSeparator(); + // --> logo + QLabel* logo = new QLabel( toolbar, "logo" ); + logo->setPixmap( QPixmap( (const char**)image1_data ) ); + logo->setAlignment( AlignRight | AlignVCenter ); + logo->setScaledContents( false ); + toolbar->setStretchableWidget( logo ); + setRightJustification( TRUE ); + // disable docking of toolbar + setDockEnabled( Qt::DockLeft, FALSE ); + setDockEnabled( Qt::DockRight, FALSE ); + setDockEnabled( Qt::DockBottom, FALSE ); + setDockEnabled( Qt::DockTornOff, FALSE ); + // disable dock menu + setDockMenuEnabled ( FALSE ) ; + // connect signals + connect( browser, SIGNAL( highlighted( const QString&) ), statusBar(), SLOT( message( const QString&)) ); + // set focus + browser->setFocus(); + // initial size + QSize sz = qApp->desktop()->size(); + int x = ( sz.width() - DEFAULT_WIDTH ) / 2; + int y = ( sz.height() - DEFAULT_HEIGHT ) / 2; + setGeometry( x, y, DEFAULT_WIDTH, DEFAULT_HEIGHT ); +} +// ================================================================ +/*! + * HelpWindow::~HelpWindow + * Destructor + */ +// ================================================================ +HelpWindow::~HelpWindow() +{ +} +// ================================================================ +/*! + * HelpWindow::openHelp [ static ] + * Creates Help window ane return pointer to it if help file exists, + * otherwise returns 0 + */ +// ================================================================ +HelpWindow* HelpWindow::openHelp( SALOME_InstallWizard* wizard ) +{ + if ( QFile::exists( QDir::currentDirPath() + "/doc/readme.html" ) ) + return new HelpWindow( wizard ); + else + return 0; +} diff --git a/src/SALOME_HelpWindow.hxx b/src/SALOME_HelpWindow.hxx new file mode 100644 index 0000000..fec2a1d --- /dev/null +++ b/src/SALOME_HelpWindow.hxx @@ -0,0 +1,37 @@ +// File : SALOME_HelpWindow.hxx +// Created : Thu Dec 18 12:01:00 2002 +// Author : Vadin SANDLER +// Project : PAL/SALOME +// Module : InstallWizard +// Copyright : 2004 CEA +// $Header$ + +#ifndef __SALOME_HelpWindow +#define __SALOME_HelpWindow + +#include + +/*! + Install Wizard's help window class +*/ +class QTextBrowser; +class SALOME_InstallWizard; +class HelpWindow : public QMainWindow +{ + Q_OBJECT + +public: + // constructor + HelpWindow( SALOME_InstallWizard* wizard ); + // destructor + ~HelpWindow(); + + // opens/raises Help window + static HelpWindow* openHelp( SALOME_InstallWizard* wizard ); + +private: + QTextBrowser* browser; // help window browser +}; + +#endif + diff --git a/src/SALOME_INSTALL.pro b/src/SALOME_INSTALL.pro new file mode 100644 index 0000000..409cebe --- /dev/null +++ b/src/SALOME_INSTALL.pro @@ -0,0 +1,26 @@ +# File : SALOME_INSTALL.pro +# Created : Thu Dec 18 12:01:00 2002 +# Author : Vadim SANDLER +# Project : PAL/SALOME +# Module : InstallWizard +# Copyright : 2004 CEA +# $Header$ + +TEMPLATE = app +CONFIG += qt warn_on release +HEADERS = SALOME_InstallWizard.hxx +HEADERS += SALOME_ProductsView.hxx +HEADERS += SALOME_ProgressView.hxx +HEADERS += SALOME_XmlHandler.hxx +HEADERS += SALOME_HelpWindow.hxx +HEADERS += icons.h +HEADERS += InstallWizard.h +SOURCES = main.cxx +SOURCES += SALOME_InstallWizard.cxx +SOURCES += SALOME_ProductsView.cxx +SOURCES += SALOME_ProgressView.cxx +SOURCES += SALOME_XmlHandler.cxx +SOURCES += SALOME_HelpWindow.cxx +SOURCES += InstallWizard.cpp +TARGET = ../bin/SALOME_InstallWizard +unix:LIBS += -lqt -ldl -lXinerama -lXft -lSM diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index 599b682..53a07e7 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -1,30 +1,38 @@ // File : SALOME_InstallWizard.cxx // Created : Thu Dec 18 12:01:00 2002 // Author : Vadim SANDLER -// Project : SALOME Professional +// Project : PAL/SALOME // Module : InstallWizard -// Copyright : 2003 CEA/DEN, EDF R&D +// Copyright : 2004 CEA // $Header$ #include "SALOME_InstallWizard.hxx" +#include "SALOME_ProductsView.hxx" +#include "SALOME_ProgressView.hxx" +#include "SALOME_XmlHandler.hxx" +#include "SALOME_HelpWindow.hxx" + #include "icons.h" -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include -#include -#include #include #include #include -#include -#include #include #include #include #include -#include #ifdef WNT #include @@ -38,18 +46,14 @@ #define max( x, y ) ( x ) > ( y ) ? ( x ) : ( y ) #endif -// ######################################## Globals ############################################## - -QString myVersion = "1.2"; -QString myCaption = QString("SALOME Professional %1 Installation Wizard").arg(myVersion); -QString myCopyright = "Copyright (C) 2003 CEA/DEN, EDF R&D"; -QString myLicense = "All right reserved"; -QString myOS = ""; - #define TEMPDIRNAME ( "/INSTALLWORK" + QString::number( getpid() ) ) + +// ================================================================ /*! - Defines list of dependancies as string separated by space symbols -*/ + * DefineDependeces [ static ] + * Defines list of dependancies as string separated by space symbols + */ +// ================================================================ static QString DefineDependeces(MapProducts& theProductsMap) { QStringList aProducts; for ( MapProducts::Iterator mapIter = theProductsMap.begin(); mapIter != theProductsMap.end(); ++mapIter ) { @@ -83,9 +87,12 @@ static QString DefineDependeces(MapProducts& theProductsMap, QCheckListItem* pro } =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */ +// ================================================================ /*! - Makes directory recursively, returns false if not succedes [ static ] -*/ + * makeDir [ static ] + * Makes directory recursively, returns false if not succedes + */ +// ================================================================ static bool makeDir( const QString& theDir, QString& theCreated ) { theCreated = QString::null; @@ -123,9 +130,12 @@ static bool makeDir( const QString& theDir, QString& theCreated ) } return true; } +// ================================================================ /*! - Reads the file, returns false if can't open it -*/ + * readFile [ static ] + * Reads the file, returns false if can't open it + */ +// ================================================================ static bool readFile( const QString& fileName, QString& text ) { if ( QFile::exists( fileName ) ) { @@ -143,163 +153,52 @@ static bool readFile( const QString& fileName, QString& text ) } return false; } -// ###################################### Progress View ########################################### - -/*! - Constructor of progress view's item - - parent progress view - - full name of the product - - alias for he product used by the script - - initial status of the product, default is 'Waiting' -*/ -ProgressViewItem::ProgressViewItem( ProgressView* parent, QString productName, const QString installType, const QString scriptName, Status status ) - : QListViewItem( parent, productName, installType ), myScript( scriptName ) -{ - setStatus( status ); -} -/*! - Sets new status for the item -*/ -void ProgressViewItem::setStatus( Status status ) -{ - myStatus = status; - switch ( myStatus ) { - case Waiting: - setText( 2, "Waiting" ); break; - case Processing: - setText( 2, "Processing" ); break; - case Completed: - setText( 2, "Completed" ); break; - case Aborted: - setText( 2, "Aborted" ); break; - default: - break; - } - repaint(); -} -/*! - Paints the cell of the list view item -*/ -void ProgressViewItem::paintCell( QPainter* painter, const QColorGroup& cg, int column, int width, int align ) -{ - QColorGroup acg( cg ); - if ( column == 2 ) { - switch ( myStatus ) { - case Waiting: - acg.setColor( QColorGroup::Text, ( ( ProgressView* )listView() )->getWaitingColor() ); break; - case Processing: - acg.setColor( QColorGroup::Text, ( ( ProgressView* )listView() )->getProcessingColor() ); break; - case Completed: - acg.setColor( QColorGroup::Text, ( ( ProgressView* )listView() )->getCompletedColor() ); break; - case Aborted: - acg.setColor( QColorGroup::Text, ( ( ProgressView* )listView() )->getWaitingColor() ); break; - default: - break; - } - } - QListViewItem::paintCell( painter, acg, column, width, align ); -} +// ================================================================ /*! - Progress view's constructor -*/ -ProgressView::ProgressView( QWidget* parent ) : QListView( parent ) + * hasSpace [ static ] + * Checks if string contains spaces; used to check directory paths + */ +// ================================================================ +static bool hasSpace( const QString& dir ) { - addColumn( tr( "Product" ) ); addColumn( tr( "Type" ) ); addColumn( tr( "Status" ) ); - header()->hide(); - setSelectionMode( QListView::NoSelection ); - setSorting( -1 ); - setResizeMode( QListView::AllColumns ); - setFocusPolicy( QWidget::NoFocus ); - setColors( QColor( "red" ), QColor( "orange" ), QColor( "green" ) ); -} -/*! - Sets status colors -*/ -void ProgressView::setColors( QColor wColor, QColor pColor, QColor cColor ) { - myWaitingColor = wColor; - myProcessingColor = pColor; - myCompletedColor = cColor; - repaint(); -} -/*! - Adds product item -*/ -void ProgressView::addProduct( const QString product, const QString type, const QString script ) { - QListViewItem* lastItem = this->lastItem(); - ProgressViewItem* newItem = new ProgressViewItem( this, product, type, script ); - if ( lastItem ) - newItem->moveItem( lastItem ); -} -/*! - Finds the first item with given status -*/ -QString ProgressView::findStatus( Status status ) { - ProgressViewItem* item = ( ProgressViewItem* )firstChild(); - while( item ) { - if ( item->getStatus() == status ) - return item->getProduct(); - item = ( ProgressViewItem* )( item->nextSibling() ); - } - return QString::null; -} -/*! - Sets new status for the product item -*/ -void ProgressView::setStatus( const QString product, Status status ) { - ProgressViewItem* item = findItem( product ); - if ( item ) { - item->setStatus( status ); - repaint(); - } -} -/*! - Scrolls the view to make item visible if necessary -*/ -void ProgressView::ensureVisible( const QString product ) { - ProgressViewItem* item = findItem( product ); - if ( item ) { - ensureItemVisible( item ); - } -} -/*! - Finds the item by the product name -*/ -ProgressViewItem* ProgressView::findItem( const QString product ) { - ProgressViewItem* item = ( ProgressViewItem* )firstChild(); - while( item ) { - if ( item->getProduct() == product ) - return item; - item = ( ProgressViewItem* )( item->nextSibling() ); - } - return 0; -} -/*! - Gets the product script -*/ -QString ProgressView::getScript( const QString product ) { - ProgressViewItem* item = ( ProgressViewItem* )firstChild(); - while( item ) { - if ( item->getProduct() == product ) - return item->getScript(); - item = ( ProgressViewItem* )( item->nextSibling() ); + for ( int i = 0; i < (int)dir.length(); i++ ) { + if ( dir[ i ].isSpace() ) + return true; } - return QString::null; + return false; } -// ###################################### Install Wizard ########################################### - +// ================================================================ /*! - Constructor -*/ + * 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 ) + : InstallWizard( qApp->desktop(), "SALOME_InstallWizard", false, 0 ), + helpWindow( NULL ), + moreMode( false ), + previousPage( 0 ), + exitConfirmed( false ) { + myIWName = tr( "Installation Wizard" ); tmpCreated = QString::null; - // set xml file xmlFileName = aXmlFileName; QFont fnt = font(); fnt.setPointSize( 14 ); fnt.setBold( true ); setTitleFont( fnt ); + // set icon + setIcon( QPixmap( ( const char** ) image0_data ) ); + // enable sizegrip + setSizeGripEnabled( true ); + + // 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 @@ -310,19 +209,13 @@ SALOME_InstallWizard::SALOME_InstallWizard(QString aXmlFileName) QXmlInputSource source( &xmlfile ); QXmlSimpleReader reader; - StructureParser * handler = new StructureParser(); + StructureParser* handler = new StructureParser( this ); reader.setContentHandler( handler ); reader.parse( source ); } - // set caption - setCaption( myCaption ); - // set icon - setIcon( QPixmap( ( const char** ) image0_data ) ); - // enable sizegrip - setSizeGripEnabled( true ); // create instance of class for starting shell install script - shellProcess = new QProcess(this,"shellProcess"); + shellProcess = new QProcess( this,"shellProcess" ); // create introduction page setupIntroPage(); @@ -357,9 +250,12 @@ SALOME_InstallWizard::SALOME_InstallWizard(QString aXmlFileName) connect(shellProcess, SIGNAL( processExited() ), this, SLOT( productInstalled() ) ); connect(shellProcess, SIGNAL( wroteToStdin() ), this, SLOT( wroteToStdin() ) ); } +// ================================================================ /*! - Destructor -*/ + * SALOME_InstallWizard::~SALOME_InstallWizard + * Destructor + */ +// ================================================================ SALOME_InstallWizard::~SALOME_InstallWizard() { shellProcess->kill(); // kill it for sure @@ -375,24 +271,30 @@ SALOME_InstallWizard::~SALOME_InstallWizard() } } } +// ================================================================ /*! - Event filter, spies for Help window closing -*/ + * SALOME_InstallWizard::eventFilter + * Event filter, spies for Help window closing + */ +// ================================================================ bool SALOME_InstallWizard::eventFilter( QObject* object, QEvent* event ) { if ( object && object == helpWindow && event->type() == QEvent::Close ) helpWindow = NULL; return InstallWizard::eventFilter( object, event ); } -/*! - Close event handler -*/ +// ================================================================ +/*! + * SALOME_InstallWizard::closeEvent + * Close event handler + */ +// ================================================================ void SALOME_InstallWizard::closeEvent( QCloseEvent* ce ) { if ( !exitConfirmed ) { if ( QMessageBox::information( this, tr( "Exit" ), - tr( "Do you want to quit Installation Wizard?" ), + tr( "Do you want to quit %1?" ).arg( getIWName() ), tr( "Yes" ), tr( "No" ), QString::null, @@ -407,9 +309,12 @@ void SALOME_InstallWizard::closeEvent( QCloseEvent* ce ) } } } +// ================================================================ /*! - Creates introduction page -*/ + * SALOME_InstallWizard::setupIntroPage + * Creates introduction page + */ +// ================================================================ void SALOME_InstallWizard::setupIntroPage() { // create page @@ -425,9 +330,9 @@ void SALOME_InstallWizard::setupIntroPage() logoLab->setAlignment( AlignCenter ); // create version box QVBox* versionBox = new QVBox( introPage ); versionBox->setSpacing( 6 ); - versionBox->setFrameStyle( QGroupBox::Panel | QGroupBox::Sunken ); + versionBox->setFrameStyle( QVBox::Panel | QVBox::Sunken ); QWidget* stretch1 = new QWidget( versionBox ); versionBox->setStretchFactor( stretch1, 5 ); - versionLab = new QLabel( QString("Version %1").arg(myVersion), versionBox ); + versionLab = new QLabel( QString("%1 %2").arg( tr( "Version" ) ).arg(myVersion), versionBox ); versionLab->setAlignment( AlignCenter ); copyrightLab = new QLabel( myCopyright, versionBox ); copyrightLab->setAlignment( AlignCenter ); @@ -436,16 +341,16 @@ void SALOME_InstallWizard::setupIntroPage() QWidget* stretch2 = new QWidget( versionBox ); versionBox->setStretchFactor( stretch2, 5 ); // create info box info = new QLabel( introPage ); - info->setText( tr( "This program will install SALOME Professional Version %1." + info->setText( tr( "This program will install %1." "

The wizard will also help you to install all products " - "which are necessary for SALOME PRO platform and setup " + "which are necessary for %2 and setup " "your environment.

Click Cancel button to abort " "installation and quit. Click Next button to continue with the " - "installation program.").arg(myVersion) ); - info->setFrameStyle( QGroupBox::WinPanel | QGroupBox::Sunken ); + "installation program.").arg(myCaption).arg(myCaption) ); + info->setFrameStyle( QLabel::WinPanel | QLabel::Sunken ); info->setMargin( 6 ); info->setAlignment( WordBreak ); - info->setMinimumSize( 250, 250 ); + info->setMinimumWidth( 250 ); QPalette pal = info->palette(); pal.setColor( QColorGroup::Background, QApplication::palette().active().base() ); info->setPalette( pal ); @@ -459,9 +364,12 @@ void SALOME_InstallWizard::setupIntroPage() // adding page addPage( introPage, tr( "Introduction" ) ); } +// ================================================================ /*! - Creates products page -*/ + * SALOME_InstallWizard::setupProductsPage + * Creates products page + */ +// ================================================================ void SALOME_InstallWizard::setupProductsPage() { // create page @@ -491,7 +399,7 @@ void SALOME_InstallWizard::setupProductsPage() 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 MyListView( moreBox ); + productsView = new ProductsView( moreBox ); productsView->setMinimumSize( 200, 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" ) ); @@ -562,9 +470,8 @@ void SALOME_InstallWizard::setupProductsPage() QXmlInputSource source( &xmlfile ); QXmlSimpleReader reader; - StructureParser * handler = new StructureParser(); - handler->setWizard( this ); - handler->setListView(productsView); + StructureParser* handler = new StructureParser( this ); + handler->setProductsList(productsView); handler->setTargetDir(targetFolder); handler->setTempDir(tempFolder); reader.setContentHandler( handler ); @@ -594,9 +501,12 @@ void SALOME_InstallWizard::setupProductsPage() // start on default - non-advanced - mode moreBox->hide(); } +// ================================================================ /*! - Creates prestart page -*/ + * SALOME_InstallWizard::setupCheckPage + * Creates prestart page + */ +// ================================================================ void SALOME_InstallWizard::setupCheckPage() { // create page @@ -620,9 +530,12 @@ void SALOME_InstallWizard::setupCheckPage() // adding page addPage( prestartPage, tr( "Check your choice" ) ); } +// ================================================================ /*! - Creates progress page -*/ + * SALOME_InstallWizard::setupProgressPage + * Creates progress page + */ +// ================================================================ void SALOME_InstallWizard::setupProgressPage() { // create page @@ -677,13 +590,16 @@ void SALOME_InstallWizard::setupProgressPage() // connect signals connect( passedParams, SIGNAL( returnPressed() ), this, SLOT( onReturnPressed() ) ) ; } +// ================================================================ /*! - Creates readme page -*/ + * SALOME_InstallWizard::setupReadmePage + * Creates readme page + */ +// ================================================================ void SALOME_InstallWizard::setupReadmePage() { // create page - readmePage = new QWidget( this, "RedamePage" ); + readmePage = new QWidget( this, "ReadmePage" ); QVBoxLayout* pageLayout = new QVBoxLayout( readmePage ); pageLayout->setMargin( 0 ); pageLayout->setSpacing( 6 ); // README info text box @@ -715,13 +631,16 @@ void SALOME_InstallWizard::setupReadmePage() if ( readFile( readmeFile, text ) ) readme->setText( text ); else - readme->setText( "README file has not been found" ); + readme->setText( tr( "README file has not been found" ) ); // adding page addPage( readmePage, tr( "Finish installation" ) ); } +// ================================================================ /*! - Displays choice info -*/ + * SALOME_InstallWizard::showChoiceInfo + * Displays choice info + */ +// ================================================================ void SALOME_InstallWizard::showChoiceInfo() { choices->clear(); @@ -795,20 +714,12 @@ void SALOME_InstallWizard::showChoiceInfo() text += "
"; choices->setText( text ); } +// ================================================================ /*! - Checks if string contains spaces; used to check directory paths [ static ] -*/ -static bool hasSpace( const QString& dir ) -{ - for ( int i = 0; i < (int)dir.length(); i++ ) { - if ( dir[ i ].isSpace() ) - return true; - } - return false; -} -/*! - Validates page when button is clicked -*/ + * SALOME_InstallWizard::acceptData + * Validates page when button is clicked + */ +// ================================================================ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) { QString tmpstr; @@ -984,7 +895,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) if ( item->text(2).isEmpty() || item->text(2).isNull() ) { QMessageBox::warning( this, tr( "Warning" ), - tr( QString("You don't have a defined script for %1").arg(item->text(0))), + tr( "You don't have a defined script for %1").arg(item->text(0)), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); @@ -995,7 +906,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) if ( !fi.exists() ) { QMessageBox::warning( this, tr( "Warning" ), - tr( QString("%1 required for %2 doesn't exist.").arg("./config_files/" + item->text(2)).arg(item->text(0))), + tr( "%1 required for %2 doesn't exist.").arg("./config_files/" + item->text(2)).arg(item->text(0)), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); @@ -1020,8 +931,8 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) else { QMessageBox::warning( this, tr( "Warning" ), - tr( QString("%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))), + 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 ); @@ -1048,7 +959,7 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) if ( system( script ) ) { QMessageBox::warning( this, tr( "Warning" ), - tr( QString("You don't have native %1 %2 installed").arg(item->text(0)).arg(item->text(1)) ), + tr( "You don't have native %1 %2 installed").arg(item->text(0)).arg(item->text(1)), QMessageBox::Ok, QMessageBox::NoButton, QMessageBox::NoButton ); @@ -1059,8 +970,8 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) else { QMessageBox::warning( this, tr( "Warning" ), - tr( QString("%The product %1 %2 required for installation.\n" - "Please, add this product in config.xml file.").arg(item->text(0)).arg(item->text(1)) ), + 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 ); @@ -1070,9 +981,12 @@ bool SALOME_InstallWizard::acceptData( const QString& pageTitle ) } return InstallWizard::acceptData( pageTitle ); } +// ================================================================ /*! - Calculates disk space required for the installation -*/ + * SALOME_InstallWizard::checkSize + * Calculates disk space required for the installation + */ +// ================================================================ void SALOME_InstallWizard::checkSize( long* totSize, long* tempSize ) { long tots = 0, temps = 0; @@ -1102,9 +1016,12 @@ void SALOME_InstallWizard::checkSize( long* totSize, long* tempSize ) *tempSize = temps; setNextEnabled( productsPage, (tots > 0) || (nativeProd > 0)); } +// ================================================================ /*! - Enabled/disables "Next" button for the directory page -*/ + * SALOME_InstallWizard::checkDirs + * Enabled/disables "Next" button for the directory page + */ +// ================================================================ void SALOME_InstallWizard::checkDirs() { // VSR: Temporary folder is used always now and it is not necessary to disable it --> @@ -1120,9 +1037,12 @@ void SALOME_InstallWizard::checkDirs() // enable/disable "Next" button setNextEnabled( productsPage, !targetDir.isEmpty() ); } +// ================================================================ /*! - Sets the product and all products this one depends on to be checked ( recursively ) -*/ + * SALOME_InstallWizard::setProductOn + * Sets the product and all products this one depends on to be checked ( recursively ) + */ +// ================================================================ void SALOME_InstallWizard::setProductOn( QCheckListItem* item, int install ) { if ( !productsMap.contains( item ) ) @@ -1145,9 +1065,12 @@ void SALOME_InstallWizard::setProductOn( QCheckListItem* item, int install ) } } } +// ================================================================ /*! - Runs installation script -*/ + * SALOME_InstallWizard::launchScript + * Runs installation script + */ +// ================================================================ void SALOME_InstallWizard::launchScript() { // try to find product being processed now @@ -1257,9 +1180,12 @@ void SALOME_InstallWizard::launchScript() showNormal(); raise(); } +// ================================================================ /*! - button slot -*/ + * SALOME_InstallWizard::onMoreBtn + * button slot + */ +// ================================================================ void SALOME_InstallWizard::onMoreBtn() { if ( moreMode ) { @@ -1280,9 +1206,12 @@ void SALOME_InstallWizard::onMoreBtn() qApp->processEvents(); } } +// ================================================================ /*! - button slot -*/ + * SALOME_InstallWizard::onLaunchSalome + * button slot + */ +// ================================================================ void SALOME_InstallWizard::onLaunchSalome() { QCheckListItem* item = 0; @@ -1317,9 +1246,12 @@ void SALOME_InstallWizard::onLaunchSalome() QMessageBox::NoButton, QMessageBox::NoButton ); } +// ================================================================ /*! - Searches product listview item with given symbolic name -*/ + * SALOME_InstallWizard::findItem + * Searches product listview item with given symbolic name + */ +// ================================================================ QCheckListItem* SALOME_InstallWizard::findItem( const QString& sName ) { MapProducts::Iterator mapIter; @@ -1329,9 +1261,12 @@ QCheckListItem* SALOME_InstallWizard::findItem( const QString& sName ) } return 0; } +// ================================================================ /*! - Sets progress state to Aborted -*/ + * SALOME_InstallWizard::abort + * Sets progress state to Aborted + */ +// ================================================================ void SALOME_InstallWizard::abort() { QString prod = progressView->findStatus( Processing ); @@ -1345,9 +1280,12 @@ void SALOME_InstallWizard::abort() prod = progressView->findStatus( Waiting ); } } +// ================================================================ /*! - Reject slot, clears temporary directory and closes application -*/ + * SALOME_InstallWizard::reject + * Reject slot, clears temporary directory and closes application + */ +// ================================================================ void SALOME_InstallWizard::reject() { #ifdef DEBUG @@ -1356,7 +1294,7 @@ void SALOME_InstallWizard::reject() if ( !exitConfirmed ) { if ( QMessageBox::information( this, tr( "Exit" ), - tr( "Do you want to quit Installation Wizard?" ), + tr( "Do you want to quit %1?" ).arg( getIWName() ), tr( "Yes" ), tr( "No" ), QString::null, @@ -1369,9 +1307,12 @@ void SALOME_InstallWizard::reject() clean(); InstallWizard::reject(); } +// ================================================================ /*! - Accept slot, clears temporary directory and closes application -*/ + * SALOME_InstallWizard::accept + * Accept slot, clears temporary directory and closes application + */ +// ================================================================ void SALOME_InstallWizard::accept() { #ifdef DEBUG @@ -1380,9 +1321,12 @@ void SALOME_InstallWizard::accept() clean(); InstallWizard::accept(); } +// ================================================================ /*! - Clears and removes temporary directory -*/ + * SALOME_InstallWizard::clean + * Clears and removes temporary directory + */ +// ================================================================ void SALOME_InstallWizard::clean() { // VSR: first remove temporary files @@ -1408,9 +1352,12 @@ void SALOME_InstallWizard::clean() #endif } } +// ================================================================ /*! - Called when user moves from page to page -*/ + * SALOME_InstallWizard::pageChanged + * Called when user moves from page to page + */ +// ================================================================ void SALOME_InstallWizard::pageChanged( const QString & mytitle) { nextButton()->setText( tr( "&Next >" ) ); @@ -1424,10 +1371,7 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) QWidget* aPage = InstallWizard::page( mytitle ); if ( !aPage ) return; - setCaption( tr( myCaption ) + tr( " - Step ") + - QString::number( this->indexOf( aPage )+1 ) + - " of " + - QString::number( this->pageCount() ) ); + updateCaption(); if ( aPage == productsPage ) { // products page checkSize(); @@ -1468,13 +1412,16 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) cout << "previousPage = " << previousPage << endl; #endif } +// ================================================================ /*! - Shows help window -*/ + * SALOME_InstallWizard::helpClicked + * Shows help window + */ +// ================================================================ void SALOME_InstallWizard::helpClicked() { if ( helpWindow == NULL ) { - helpWindow = HelpWindow::openHelp(); + helpWindow = HelpWindow::openHelp( this ); if ( helpWindow ) { helpWindow->show(); helpWindow->installEventFilter( this ); @@ -1490,9 +1437,12 @@ void SALOME_InstallWizard::helpClicked() helpWindow->setActiveWindow(); } } +// ================================================================ /*! - Shows directory selection dialog -*/ + * SALOME_InstallWizard::browseDirectory + * Shows directory selection dialog + */ +// ================================================================ void SALOME_InstallWizard::browseDirectory() { const QObject* theSender = sender(); @@ -1510,16 +1460,22 @@ void SALOME_InstallWizard::browseDirectory() } checkDirs(); } +// ================================================================ /*! - Called when directory path (target or temp) is changed -*/ + * SALOME_InstallWizard::directoryChanged + * Called when directory path (target or temp) is changed + */ +// ================================================================ void SALOME_InstallWizard::directoryChanged( const QString& /*text*/ ) { checkDirs(); } +// ================================================================ /*! - button's slot - runs installation -*/ + * SALOME_InstallWizard::onStart + * button's slot - runs installation + */ +// ================================================================ void SALOME_InstallWizard::onStart() { // clear list of products to install ... @@ -1560,9 +1516,12 @@ void SALOME_InstallWizard::onStart() launchScript(); } } +// ================================================================ /*! - Called when users tries to pass parameters for the script -*/ + * SALOME_InstallWizard::onReturnPressed + * Called when users tries to pass parameters for the script + */ +// ================================================================ void SALOME_InstallWizard::onReturnPressed() { QString txt = passedParams->text(); @@ -1610,15 +1569,18 @@ void SALOME_InstallWizard::productInstalled( ) backButton()->setEnabled( true ); } } +// ================================================================ /*! - Slot, called when button is clicked during installation script running -*/ + * SALOME_InstallWizard::tryTerminate + * Slot, called when button is clicked during installation script running + */ +// ================================================================ void SALOME_InstallWizard::tryTerminate() { if ( shellProcess->isRunning() ) { if ( QMessageBox::information( this, tr( "Exit" ), - tr( "Do you want to quit Installation Wizard?" ), + tr( "Do you want to quit %1?" ).arg( getIWName() ), tr( "Yes" ), tr( "No" ), QString::null, @@ -1638,17 +1600,23 @@ void SALOME_InstallWizard::tryTerminate() reject(); } } +// ================================================================ /*! - Kills installation process and quits application -*/ + * SALOME_InstallWizard::onCancel + * Kills installation process and quits application + */ +// ================================================================ void SALOME_InstallWizard::onCancel() { shellProcess->kill(); reject(); } +// ================================================================ /*! - Called when selection is changed in the products list view -*/ + * SALOME_InstallWizard::onSelectionChanged + * Called when selection is changed in the products list view + */ +// ================================================================ void SALOME_InstallWizard::onSelectionChanged( QListViewItem* item ) { productsInfo->clear(); @@ -1680,10 +1648,13 @@ void SALOME_InstallWizard::onSelectionChanged( QListViewItem* item ) text += "Prerequisites: " + req; productsInfo->setText( text ); } +// ================================================================ /*! - Called when user checks/unchecks any product item - Recursively sets all prerequisites and updates "Next" button state -*/ + * SALOME_InstallWizard::onItemToggled + * Called when user checks/unchecks any product item + * Recursively sets all prerequisites and updates "Next" button state + */ +// ================================================================ void SALOME_InstallWizard::onItemToggled( QCheckListItem* item ) { if ( prerequisites->isChecked() ) { @@ -1702,10 +1673,13 @@ void SALOME_InstallWizard::onItemToggled( QCheckListItem* item ) } checkSize(); } +// ================================================================ /*! - This slot is called when user clicks one of , buttons ( products page ) -*/ + * SALOME_InstallWizard::onProdBtn + * This slot is called when user clicks one of , buttons ( products page ) + */ +// ================================================================ void SALOME_InstallWizard::onProdBtn() { const QObject* snd = sender(); @@ -1720,18 +1694,24 @@ void SALOME_InstallWizard::onProdBtn() productsView->blockSignals( false ); checkSize(); } +// ================================================================ /*! - QProcess slot: -->something was written to stdin -*/ + * SALOME_InstallWizard::wroteToStdin + * QProcess slot: -->something was written to stdin + */ +// ================================================================ void SALOME_InstallWizard::wroteToStdin( ) { #ifdef DEBUG cout << "Something was sent to stdin" << endl; #endif } +// ================================================================ /*! - QProcess slot: -->something was written to stdout -*/ + * SALOME_InstallWizard::readFromStdout + * QProcess slot: -->something was written to stdout + */ +// ================================================================ void SALOME_InstallWizard::readFromStdout( ) { #ifdef DEBUG @@ -1747,9 +1727,12 @@ void SALOME_InstallWizard::readFromStdout( ) installInfo->scrollToBottom(); } } +// ================================================================ /*! - QProcess slot: -->something was written to stderr -*/ + * SALOME_InstallWizard::readFromStderr + * QProcess slot: -->something was written to stderr + */ +// ================================================================ void SALOME_InstallWizard::readFromStderr( ) { #ifdef DEBUG @@ -1768,177 +1751,39 @@ void SALOME_InstallWizard::readFromStderr( ) passedParams->setFocus(); QFont f = parametersLab->font(); f.setBold( true ); parametersLab->setFont( f ); } +// ================================================================ /*! - Sets dependancies for the product item -*/ + * SALOME_InstallWizard::setDependancies + * Sets dependancies for the product item + */ +// ================================================================ void SALOME_InstallWizard::setDependancies( QCheckListItem* item, Dependancies dep) { productsMap[item] = dep; } +// ================================================================ /*! - Polishing of the widget - to set right initial size -*/ + * SALOME_InstallWizard::polish + * Polishing of the widget - to set right initial size + */ +// ================================================================ void SALOME_InstallWizard::polish() { resize( 0, 0 ); InstallWizard::polish(); } - -// ###################################### Structure Parser ########################################### - -/*! - Constructor -*/ -StructureParser::StructureParser() - : QXmlDefaultHandler() -{ - wizard = NULL; - tree = NULL; -} -/*! - Sets install wizard's main window -*/ -void StructureParser::setWizard( SALOME_InstallWizard* awizard ) -{ - wizard = awizard; -} +// ================================================================ /*! - Sets products list view -*/ -void StructureParser::setListView( MyListView * t ) -{ - tree = t; -} -/*! - Sets temp directory widget -*/ -void StructureParser::setTempDir( QLineEdit * dir ) -{ - tempdir = dir; -} -/*! - Sets target directory widget -*/ -void StructureParser::setTargetDir( QLineEdit * dir ) -{ - targetdir = dir; -} -/*! - Begins parsing of the xml dom-element -*/ -bool StructureParser::startElement( const QString& , - const QString& , - const QString& qName, - const QXmlAttributes& attributes) -{ -#ifdef DEBUG - cout << qName << endl; - cout << attributes.length() << endl; -#endif - QCheckListItem * element; - if (( qName == "config" ) && ( attributes.length() > 0 ) ) { - if ( attributes.value( "version" ) ) - myVersion = attributes.value( "version" ).stripWhiteSpace(); - if ( attributes.value( "caption" ) && !myCaption.isEmpty() ) - myCaption = QString(attributes.value( "caption" )).arg(myVersion).stripWhiteSpace(); - if ( attributes.value( "copyright" ) ) - myCopyright = attributes.value( "copyright" ).stripWhiteSpace(); - if ( attributes.value( "license" ) ) - myLicense = attributes.value( "license" ).stripWhiteSpace(); - if ( attributes.value( "os" ) ) - myOS = attributes.value( "os" ).stripWhiteSpace(); - -#ifdef DEBUG - cout << myCaption << endl; - cout << myVersion << endl; - cout << myCopyright << endl; - cout << myLicense << endl; -#endif - } else if (( qName == "product" ) && ( attributes.length() > 0 ) && tree && wizard ) { - if (attributes.value("disable") == "true" ) - return true; - - QString install = attributes.value( "install" ); - QStringList supported = QStringList::split(",", attributes.value("supported") ); - QString script = attributes.value( "script" ); - element = tree->addItem( attributes.value("name"), attributes.value("version"), install, supported, script ); - if ( attributes.value("dependancies") == "" ) { - QStringList diskspace = QStringList::split(",",attributes.value("installdiskspace")); - if (diskspace.count() == 2) - wizard->setDependancies( element, - Dependancies( attributes.value("name"), QStringList(), - diskspace[0].toInt(), - diskspace[1].toInt(), - attributes.value("temporarydiskspace").toInt()) ); - else - wizard->setDependancies( element, - Dependancies( attributes.value("name"), QStringList(), - diskspace[0].toInt(), - diskspace[0].toInt(), - attributes.value("temporarydiskspace").toInt()) ); - - } else { - QStringList diskspace = QStringList::split(",",attributes.value("installdiskspace")); - if (diskspace.count() == 2) - wizard->setDependancies( element, - Dependancies( attributes.value("name"), - QStringList::split(",", attributes.value("dependancies") ), - diskspace[0].toInt(), - diskspace[1].toInt(), - attributes.value("temporarydiskspace").toInt()) ); - else - wizard->setDependancies( element, - Dependancies( attributes.value("name"), - QStringList::split(",", attributes.value("dependancies") ), - diskspace[0].toInt(), - diskspace[0].toInt(), - attributes.value("temporarydiskspace").toInt()) ); - } - } else if (( qName == "path" ) && ( attributes.length() > 0 ) && wizard ) { - targetdir->setText( attributes.value("targetdir") ); - - if ( attributes.value("tempdir") == "" ) - tempdir->setText( "/tmp" ); - else - tempdir->setText( attributes.value("tempdir") ); - } - return true; -} -/*! - Finishes parsing of the xml dom-element -*/ -bool StructureParser::endElement( const QString&, const QString&, - const QString& ) + * SALOME_InstallWizard::updateCaption + * Updates caption according to the current page number + */ +// ================================================================ +void SALOME_InstallWizard::updateCaption() { - return true; -} - -// ###################################### Main ########################################### - -/*! - Program starts here -*/ -int main( int argc, char **argv ) -{ - QApplication a( argc, argv ); - QString xmlFileName( argc == 2 ? argv[1] : "config.xml" ); - - int result = -1; - QFile xmlfile(xmlFileName); - if ( xmlfile.exists() ) { - SALOME_InstallWizard wizard(xmlFileName); - a.setMainWidget( &wizard ); - wizard.show(); - result = a.exec(); - } - else { - QMessageBox::critical( 0, - QObject::tr( "Error" ), - QObject::tr( "Can't open config file:\n%1\n\nQuitting...").arg( xmlFileName ), - QMessageBox::Ok, - QMessageBox::NoButton, - QMessageBox::NoButton ); - } - return result; + QWidget* aPage = InstallWizard::currentPage(); + 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() ) ) ); } - diff --git a/src/SALOME_InstallWizard.hxx b/src/SALOME_InstallWizard.hxx index fb4f295..d4c8605 100644 --- a/src/SALOME_InstallWizard.hxx +++ b/src/SALOME_InstallWizard.hxx @@ -1,30 +1,18 @@ -// File : SALOME_InstallWizard.h +// File : SALOME_InstallWizard.hxx // Created : Thu Dec 18 12:01:00 2002 // Author : Vadim SANDLER -// Project : SALOME Professional +// Project : PAL/SALOME // Module : InstallWizard -// Copyright : 2003 CEA/DEN, EDF R&D +// Copyright : 2004 CEA // $Header$ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#ifndef __SALOME_InstallWizard +#define __SALOME_InstallWizard + +#include "InstallWizard.h" #include #include -#include - -#include "InstallWizard.h" -#include "helpwindow.h" /*! Class Dependancies : Products info @@ -66,10 +54,24 @@ class Dependancies long sizeBinaryTotal; // disk space required long sizeTemp; // disk space for temporary files required }; -typedef QMap MapProducts; -class MyListView; +class QLineEdit; +class QPushButton; +class QListViewItem; +class QCheckListItem; +class QLabel; +class QTextEdit; +class QTextBrowser; +class QProcess; +class QCheckBox; +class QSplitter; + +class ProductsView; class ProgressView; +class HelpWindow; + +typedef QMap MapProducts; + /*! Class SALOME_InstallWizard : Installation Wizard's main window */ @@ -92,8 +94,34 @@ class SALOME_InstallWizard: public InstallWizard public slots: // polishing of the widget void polish(); + + // set version + void setVersion( const QString& version ) { myVersion = version; } + // set caption + void setCaption( const QString& caption ) { myCaption = caption; updateCaption(); } + // set copyright + void setCopyright( const QString& copyright ) { myCopyright = copyright; } + // set license + void setLicense( const QString& license ) { myLicense = license; } + // set OS + void setOS( const QString& OS ) { myOS = OS; } + + // get version + QString getVersion() { return myVersion; } + // get caption + QString getCaption() { return myCaption; } + // get copyright + QString getCopyright() { return myCopyright; } + // get license + QString getLicense() { return myLicense; } + // get OS + QString getOS() { return myOS; } + // get InstallWizard's name + QString getIWName() { return myIWName; } protected: + // updates caption according to the current page number + void updateCaption(); // close event handler void closeEvent( QCloseEvent* ce ); // creates introduction page @@ -172,6 +200,13 @@ class SALOME_InstallWizard: public InstallWizard void readFromStderr(); private: + QString myIWName; // Installation Wizard's name + QString myVersion; // version info + QString myCaption; // application name + QString myCopyright; // copyright info + QString myLicense; // license info + QString myOS; // operation system + HelpWindow* helpWindow; // help window QProcess* shellProcess; // shell process (install script) MapProducts productsMap; // products info (name, dependancies, disk space ) @@ -184,7 +219,7 @@ class SALOME_InstallWizard: public InstallWizard // Widgets // --> introduction page QWidget* introPage; // page itself - QLabel* logoLab; // SALOME PRO logo + QLabel* logoLab; // logo pixmap QLabel* versionLab; // vesrsion info QLabel* copyrightLab; // copyright info QLabel* licenseLab; // license info @@ -199,7 +234,7 @@ class SALOME_InstallWizard: public InstallWizard QLabel* requiredTemp; // label QPushButton* moreBtn; // button QWidget* moreBox; // container for the mode widgets - MyListView* productsView; // products list view + ProductsView* productsView; // products list view QTextBrowser* productsInfo; // products info box QCheckBox* prerequisites; // checkbox QPushButton* selectSrcBtn; //