1 // File : SALOME_HelpWindow.cxx
2 // Created : Thu Dec 18 12:01:00 2002
3 // Author : Vadim SANDLER
4 // Project : PAL/SALOME
5 // Module : InstallWizard
6 // Copyright : 2004 CEA
9 #include "SALOME_HelpWindow.hxx"
10 #include "SALOME_InstallWizard.hxx"
12 #include <qstatusbar.h>
14 #include <qtoolbutton.h>
17 #include <qtextbrowser.h>
18 #include <qapplication.h>
24 #define DEFAULT_WIDTH 800
25 #define DEFAULT_HEIGHT 700
27 // ================================================================
29 * HelpWindow::HelpWindow
32 // ================================================================
33 HelpWindow::HelpWindow( SALOME_InstallWizard* wizard ) : QMainWindow( 0, "SalomeProHelpWindow", WDestructiveClose )
35 QString hlpFile = QDir::currentDirPath() + "/doc/readme.html";
38 setCaption( wizard->getCaption() + " " + wizard->getIWName() + " " + tr( "Help" ) );
40 setIcon( QPixmap( (const char**)image0_data ) );
42 browser = new QTextBrowser( this );
43 browser->mimeSourceFactory()->setFilePath( hlpDir );
44 browser->setFrameStyle( QFrame::Panel | QFrame::Sunken );
45 setCentralWidget( browser );
46 // set source directory
47 if ( !hlpFile.isEmpty() )
48 browser->setSource( hlpFile );
50 QToolBar* toolbar = new QToolBar( this );
51 addToolBar( toolbar, "Toolbar" );
54 button = new QToolButton( QIconSet( (const char**)back ),
60 button->setEnabled( FALSE );
61 connect( browser, SIGNAL( backwardAvailable( bool ) ), button, SLOT( setEnabled( bool ) ) );
63 button = new QToolButton( QIconSet( (const char**)forward ),
69 button->setEnabled( FALSE );
70 connect( browser, SIGNAL( forwardAvailable( bool ) ), button, SLOT( setEnabled( bool ) ) );
72 button = new QToolButton( QIconSet( (const char**)home ),
78 toolbar->addSeparator();
80 QLabel* logo = new QLabel( toolbar, "logo" );
81 logo->setPixmap( QPixmap( (const char**)image1_data ) );
82 logo->setAlignment( AlignRight | AlignVCenter );
83 logo->setScaledContents( false );
84 toolbar->setStretchableWidget( logo );
85 setRightJustification( TRUE );
86 // disable docking of toolbar
87 setDockEnabled( Qt::DockLeft, FALSE );
88 setDockEnabled( Qt::DockRight, FALSE );
89 setDockEnabled( Qt::DockBottom, FALSE );
90 setDockEnabled( Qt::DockTornOff, FALSE );
92 setDockMenuEnabled ( FALSE ) ;
94 connect( browser, SIGNAL( highlighted( const QString&) ), statusBar(), SLOT( message( const QString&)) );
98 QSize sz = qApp->desktop()->size();
99 int x = ( sz.width() - DEFAULT_WIDTH ) / 2;
100 int y = ( sz.height() - DEFAULT_HEIGHT ) / 2;
101 setGeometry( x, y, DEFAULT_WIDTH, DEFAULT_HEIGHT );
103 // ================================================================
105 * HelpWindow::~HelpWindow
108 // ================================================================
109 HelpWindow::~HelpWindow()
112 // ================================================================
114 * HelpWindow::openHelp [ static ]
115 * Creates Help window ane return pointer to it if help file exists,
116 * otherwise returns 0
118 // ================================================================
119 HelpWindow* HelpWindow::openHelp( SALOME_InstallWizard* wizard )
121 if ( QFile::exists( QDir::currentDirPath() + "/doc/readme.html" ) )
122 return new HelpWindow( wizard );