/****************************************************************************
** Form implementation generated from reading ui file 'mainwindow.ui'
**
** Created by: The TQt user interface compiler (TQt 3.5.0)
**
** WARNING! All changes made in this file will be lost!
****************************************************************************/

#include "mainwindow.h"

#include <ntqvariant.h>
#include <ntqtoolbutton.h>
#include <ntqmessagebox.h>
#include <ntqfontdatabase.h>
#include <ntqaccel.h>
#include <ntqcombobox.h>
#include <ntqpaintdevicemetrics.h>
#include <ntqsimplerichtext.h>
#include <ntqfileinfo.h>
#include <ntqtextstream.h>
#include <ntqdockwindow.h>
#include <stdlib.h>
#include <ntqmime.h>
#include <ntqstylesheet.h>
#include <ntqapplication.h>
#include <ntqdir.h>
#include <ntqprinter.h>
#include <ntqpainter.h>
#include <ntqurl.h>
#include <ntqstatusbar.h>
#include <ntqlineedit.h>
#include <ntqsettings.h>
#include <ntqcheckbox.h>
#include <ntqlayout.h>
#include <ntqtooltip.h>
#include <ntqwhatsthis.h>
#include <ntqaction.h>
#include <ntqmenubar.h>
#include <ntqpopupmenu.h>
#include <ntqtoolbar.h>
#include <ntqimage.h>
#include <ntqpixmap.h>

#include "settingsdialogimpl.h"
#include "helpwindow.h"
#include "helpdialogimpl.h"
#include "tabbedbrowser.h"
#include "mainwindow.ui.h"
/*
 *  Constructs a MainWindow as a child of 'parent', with the
 *  name 'name' and widget flags set to 'f'.
 *
 */
MainWindow::MainWindow( TQWidget* parent, const char* name, WFlags fl )
    : TQMainWindow( parent, name, fl )
{
    (void)statusBar();
    if ( !name )
	setName( "MainWindow" );

    // actions
    actionFilePrint = new TQAction( this, "actionFilePrint" );
    actionFilePrint->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "print.png" ) ) );
    actionFileExit = new TQAction( this, "actionFileExit" );
    actionEditCopy = new TQAction( this, "actionEditCopy" );
    actionEditCopy->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "editcopy.png" ) ) );
    actionEditFind = new TQAction( this, "actionEditFind" );
    actionEditFind->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "find.png" ) ) );
    actionEditFindAgain = new TQAction( this, "actionEditFindAgain" );
    actionEditFindAgainPrev = new TQAction( this, "actionEditFindAgainPrev" );
    actionGoHome = new TQAction( this, "actionGoHome" );
    actionGoHome->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "home.png" ) ) );
    actionGoPrevious = new TQAction( this, "actionGoPrevious" );
    actionGoPrevious->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "previous.png" ) ) );
    actionGoNext = new TQAction( this, "actionGoNext" );
    actionGoNext->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "next.png" ) ) );
    helpAbout_TQt_AssistantAction = new TQAction( this, "helpAbout_TQt_AssistantAction" );
    actionAboutApplication = new TQAction( this, "actionAboutApplication" );
    actionZoomIn = new TQAction( this, "actionZoomIn" );
    actionZoomIn->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "zoomin.png" ) ) );
    actionZoomOut = new TQAction( this, "actionZoomOut" );
    actionZoomOut->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "zoomout.png" ) ) );
    actionSettings = new TQAction( this, "actionSettings" );
    actionNewWindow = new TQAction( this, "actionNewWindow" );
    actionClose = new TQAction( this, "actionClose" );
    actionAddBookmark = new TQAction( this, "actionAddBookmark" );
    actionHelpWhatsThis = new TQAction( this, "actionHelpWhatsThis" );
    actionHelpWhatsThis->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "whatsthis.xpm" ) ) );
    actionOpenPage = new TQAction( this, "actionOpenPage" );
    actionNextPage = new TQAction( this, "actionNextPage" );
    actionPrevPage = new TQAction( this, "actionPrevPage" );
    actionClosePage = new TQAction( this, "actionClosePage" );
    actionHelpAssistant = new TQAction( this, "actionHelpAssistant" );
    actionHelpAssistant->setIconSet( TQIconSet( TQPixmap::fromMimeSource( "assistant.png" ) ) );


    // toolbars
    Toolbar = new TQToolBar( TQString(""), this, DockTop ); 

    actionGoPrevious->addTo( Toolbar );
    actionGoNext->addTo( Toolbar );
    actionGoHome->addTo( Toolbar );
    Toolbar->addSeparator();
    actionEditCopy->addTo( Toolbar );
    actionEditFind->addTo( Toolbar );
    actionFilePrint->addTo( Toolbar );
    Toolbar->addSeparator();
    actionZoomIn->addTo( Toolbar );
    actionZoomOut->addTo( Toolbar );
    Toolbar->addSeparator();
    actionHelpWhatsThis->addTo( Toolbar );
    goActionToolbar = new TQToolBar( TQString(""), this, DockTop ); 



    // menubar
    menubar = new TQMenuBar( this, "menubar" );

    menubar->setGeometry( TQRect( 0, 0, 949, 29 ) );

    fileMenu = new TQPopupMenu( this );
    actionNewWindow->addTo( fileMenu );
    actionOpenPage->addTo( fileMenu );
    actionClosePage->addTo( fileMenu );
    fileMenu->insertSeparator();
    actionFilePrint->addTo( fileMenu );
    fileMenu->insertSeparator();
    actionClose->addTo( fileMenu );
    actionFileExit->addTo( fileMenu );
    menubar->insertItem( TQString(""), fileMenu, 2 );

    editMenu = new TQPopupMenu( this );
    actionEditCopy->addTo( editMenu );
    actionEditFind->addTo( editMenu );
    actionEditFindAgain->addTo( editMenu );
    actionEditFindAgainPrev->addTo( editMenu );
    editMenu->insertSeparator();
    actionSettings->addTo( editMenu );
    menubar->insertItem( TQString(""), editMenu, 3 );

    PopupMenu = new TQPopupMenu( this );
    actionZoomIn->addTo( PopupMenu );
    actionZoomOut->addTo( PopupMenu );
    PopupMenu->insertSeparator();
    menubar->insertItem( TQString(""), PopupMenu, 4 );

    goMenu = new TQPopupMenu( this );
    actionGoPrevious->addTo( goMenu );
    actionGoNext->addTo( goMenu );
    actionGoHome->addTo( goMenu );
    goMenu->insertSeparator();
    actionNextPage->addTo( goMenu );
    actionPrevPage->addTo( goMenu );
    menubar->insertItem( TQString(""), goMenu, 5 );

    bookmarkMenu = new TQPopupMenu( this );
    menubar->insertItem( TQString(""), bookmarkMenu, 6 );

    helpMenu = new TQPopupMenu( this );
    actionHelpAssistant->addTo( helpMenu );
    helpMenu->insertSeparator();
    helpAbout_TQt_AssistantAction->addTo( helpMenu );
    actionAboutApplication->addTo( helpMenu );
    helpMenu->insertSeparator();
    actionHelpWhatsThis->addTo( helpMenu );
    menubar->insertItem( TQString(""), helpMenu, 7 );

    languageChange();
    resize( TQSize(949, 670).expandedTo(minimumSizeHint()) );
    clearWState( WState_Polished );

    // signals and slots connections
    connect( actionGoHome, TQ_SIGNAL( activated() ), this, TQ_SLOT( goHome() ) );
    connect( helpAbout_TQt_AssistantAction, TQ_SIGNAL( activated() ), this, TQ_SLOT( about() ) );
    connect( actionEditFind, TQ_SIGNAL( activated() ), this, TQ_SLOT( find() ) );
    connect( actionEditFindAgain, TQ_SIGNAL( activated() ), this, TQ_SLOT( findAgain() ) );
    connect( actionEditFindAgainPrev, TQ_SIGNAL( activated() ), this, TQ_SLOT( findAgainPrev() ) );
    connect( actionFilePrint, TQ_SIGNAL( activated() ), this, TQ_SLOT( print() ) );
    connect( actionSettings, TQ_SIGNAL( activated() ), this, TQ_SLOT( showSettingsDialog() ) );
    connect( actionNewWindow, TQ_SIGNAL( activated() ), this, TQ_SLOT( newWindow() ) );
    connect( actionClose, TQ_SIGNAL( activated() ), this, TQ_SLOT( close() ) );
    connect( actionHelpWhatsThis, TQ_SIGNAL( activated() ), this, TQ_SLOT( whatsThis() ) );
    connect( actionHelpAssistant, TQ_SIGNAL( activated() ), this, TQ_SLOT( showAssistantHelp() ) );
    connect( actionAboutApplication, TQ_SIGNAL( activated() ), this, TQ_SLOT( aboutApplication() ) );
    init();
}

/*
 *  Destroys the object and frees any allocated resources
 */
MainWindow::~MainWindow()
{
    destroy();
    // no need to delete child widgets, TQt does it all for us
}

/*
 *  Sets the strings of the subwidgets using the current
 *  language.
 */
void MainWindow::languageChange()
{
    setCaption( tr( "TQt Assistant by Trolltech" ) );
    actionFilePrint->setText( tr( "Print" ) );
    actionFilePrint->setMenuText( tr( "&Print..." ) );
    actionFilePrint->setWhatsThis( tr( "Print the currently displayed page." ) );
    actionFilePrint->setAccel( tr( "Ctrl+P" ) );
    actionFileExit->setText( tr( "Exit" ) );
    actionFileExit->setMenuText( tr( "E&xit" ) );
    actionFileExit->setWhatsThis( tr( "Quit TQt Assistant." ) );
    actionFileExit->setAccel( tr( "Ctrl+Q" ) );
    actionEditCopy->setText( tr( "Copy" ) );
    actionEditCopy->setMenuText( tr( "&Copy" ) );
    actionEditCopy->setWhatsThis( tr( "Copy the selected text to the clipboard." ) );
    actionEditCopy->setAccel( tr( "Ctrl+C" ) );
    actionEditFind->setText( tr( "Find in Text" ) );
    actionEditFind->setMenuText( tr( "&Find in Text..." ) );
    actionEditFind->setWhatsThis( tr( "Open the Find dialog. TQt Assistant will search the currently displayed page for the text you enter." ) );
    actionEditFind->setAccel( tr( "Ctrl+F" ) );
    actionEditFindAgain->setMenuText( tr( "Find &Next" ) );
    actionEditFindAgain->setText( tr( "Find Next" ) );
    actionEditFindAgain->setAccel( tr( "F3" ) );
    actionEditFindAgainPrev->setMenuText( tr( "Find &Previous" ) );
    actionEditFindAgainPrev->setText( tr( "Find Previous" ) );
    actionEditFindAgainPrev->setAccel( tr( "Shift+F3" ) );
    actionGoHome->setText( tr( "Home" ) );
    actionGoHome->setMenuText( tr( "&Home" ) );
    actionGoHome->setWhatsThis( tr( "Go to the home page. TQt Assistant's home page is the TQt Reference Documentation." ) );
    actionGoHome->setAccel( tr( "Ctrl+Home" ) );
    actionGoPrevious->setText( tr( "Previous" ) );
    actionGoPrevious->setMenuText( tr( "&Previous" ) );
    actionGoPrevious->setWhatsThis( tr( "Go to the previous page." ) );
    actionGoPrevious->setAccel( tr( "Alt+Left" ) );
    actionGoNext->setText( tr( "Next" ) );
    actionGoNext->setMenuText( tr( "&Next" ) );
    actionGoNext->setWhatsThis( tr( "Go to the next page." ) );
    actionGoNext->setAccel( tr( "Alt+Right" ) );
    helpAbout_TQt_AssistantAction->setText( tr( "About TQt Assistant" ) );
    helpAbout_TQt_AssistantAction->setMenuText( tr( "About TQt Assistant" ) );
    helpAbout_TQt_AssistantAction->setWhatsThis( tr( "Display further information about TQt Assistant." ) );
    actionZoomIn->setText( tr( "Zoom in" ) );
    actionZoomIn->setMenuText( tr( "Zoom &in" ) );
    actionZoomIn->setWhatsThis( tr( "Zoom in on the document, i.e. increase the font size." ) );
    actionZoomIn->setAccel( tr( "Ctrl++" ) );
    actionZoomOut->setText( tr( "Zoom out" ) );
    actionZoomOut->setMenuText( tr( "Zoom &out" ) );
    actionZoomOut->setWhatsThis( tr( "Zoom out on the document, i.e. decrease the font size." ) );
    actionZoomOut->setAccel( tr( "Ctrl+-" ) );
    actionSettings->setText( tr( "Settings" ) );
    actionSettings->setMenuText( tr( "&Settings..." ) );
    actionSettings->setWhatsThis( tr( "Open the settings dialog." ) );
    actionNewWindow->setText( tr( "New Window" ) );
    actionNewWindow->setMenuText( tr( "New Window" ) );
    actionNewWindow->setWhatsThis( tr( "Open a new window." ) );
    actionNewWindow->setAccel( tr( "Ctrl+N" ) );
    actionClose->setText( tr( "Close" ) );
    actionClose->setMenuText( tr( "&Close" ) );
    actionClose->setWhatsThis( tr( "Close the current window." ) );
    actionAddBookmark->setText( tr( "Add Bookmark" ) );
    actionAddBookmark->setMenuText( tr( "&Add Bookmark" ) );
    actionAddBookmark->setWhatsThis( tr( "Add the currently displayed page as a new bookmark." ) );
    actionHelpWhatsThis->setText( tr( "What's This?" ) );
    actionHelpWhatsThis->setStatusTip( tr( "\"What's This?\" context sensitive help." ) );
    actionHelpWhatsThis->setWhatsThis( tr( "\"What's This?\" context sensitive help." ) );
    actionHelpWhatsThis->setAccel( tr( "Shift+F1" ) );
    actionHelpWhatsThis->setMenuText(tr( "What's This?" ));
    actionOpenPage->setText( tr( "Add Tab" ) );
    actionOpenPage->setAccel( tr( "Ctrl+Alt+N" ) );
    actionOpenPage->setMenuText(tr( "Add Tab" ));
    actionNextPage->setText( tr( "Next Tab" ) );
    actionNextPage->setAccel( tr( "Ctrl+Alt+Right" ) );
    actionNextPage->setMenuText(tr( "Next Tab" ));
    actionPrevPage->setText( tr( "Previous Tab" ) );
    actionPrevPage->setAccel( tr( "Ctrl+Alt+Left" ) );
    actionPrevPage->setMenuText(tr( "Previous Tab" ));
    actionClosePage->setText( tr( "Close Tab" ) );
    actionClosePage->setAccel( tr( "Ctrl+Alt+Q" ) );
    actionClosePage->setMenuText(tr( "Close Tab" ));
    actionHelpAssistant->setText( tr( "TQt Assistant Manual" ) );
    actionHelpAssistant->setAccel( tr( "F1" ) );
    actionHelpAssistant->setMenuText(tr( "TQt Assistant Manual" ));
    Toolbar->setLabel( tr( "Toolbar" ) );
    goActionToolbar->setLabel( tr( "Go" ) );
    if (menubar->findItem(2))
        menubar->findItem(2)->setText( tr( "&File" ) );
    if (menubar->findItem(3))
        menubar->findItem(3)->setText( tr( "&Edit" ) );
    if (menubar->findItem(4))
        menubar->findItem(4)->setText( tr( "&View" ) );
    if (menubar->findItem(5))
        menubar->findItem(5)->setText( tr( "&Go" ) );
    if (menubar->findItem(6))
        menubar->findItem(6)->setText( tr( "Boo&kmarks" ) );
    if (menubar->findItem(7))
        menubar->findItem(7)->setText( tr( "&Help" ) );
}

