goldendict-ng/helpwindow.hh

80 lines
1.5 KiB
C++
Raw Normal View History

2014-06-23 15:11:15 +00:00
#ifndef __HELPWINDOW_HH_INCLUDED__
#define __HELPWINDOW_HH_INCLUDED__
#include <QDialog>
#include <QToolBar>
#include <QtHelp/QHelpEngine>
#include <QString>
#include <QTextBrowser>
#include <QTableWidget>
#include <QAction>
#include <QSplitter>
#include <exception>
#include "config.hh"
namespace Help {
class HelpBrowser : public QTextBrowser
{
Q_OBJECT
public:
HelpBrowser( QHelpEngineCore * engine, QWidget *parent );
void showHelpForKeyword( QString const & id );
private:
QVariant loadResource( int type, QUrl const & name );
QHelpEngineCore * helpEngine;
private slots:
void linkClicked( QUrl const & url );
};
class HelpWindow : public QDialog
{
Q_OBJECT
Config::Class & cfg;
QToolBar * navToolBar;
QHelpEngine * helpEngine;
QTabWidget * tabWidget;
HelpBrowser * helpBrowser;
QAction * navForward, * navBack, * navHome;
QAction * zoomInAction, * zoomOutAction, * zoomBaseAction;
QSplitter * splitter;
QString helpFile, helpCollectionFile;
int fontSize;
void applyZoomFactor();
public:
HelpWindow( QWidget * parent, Config::Class & cfg_ );
~HelpWindow();
QHelpEngine const * getHelpEngine()
{ return helpEngine; }
2014-06-24 13:55:06 +00:00
void showHelpFor( QString const & keyword );
2014-06-23 15:11:15 +00:00
public slots:
virtual void reject();
virtual void accept();
void forwardEnabled( bool enabled );
void backwardEnabled( bool enabled );
void contentsItemClicked( QModelIndex const & index );
void zoomIn();
void zoomOut();
void zoomBase();
signals:
void needClose();
};
} // namespace Help
#endif // __HELPWINDOW_HH_INCLUDED__