--- /dev/null
+// 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 <qstatusbar.h>
+#include <qtoolbar.h>
+#include <qtoolbutton.h>
+#include <qiconset.h>
+#include <qlabel.h>
+#include <qtextbrowser.h>
+#include <qapplication.h>
+#include <qdir.h>
+#include <qfile.h>
+
+#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;
+}