File: helpwindow.hh

package info (click to toggle)
goldendict-webengine 23.02.05-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 19,148 kB
  • sloc: cpp: 58,537; javascript: 9,942; ansic: 9,242; xml: 41; makefile: 15; sh: 9
file content (79 lines) | stat: -rw-r--r-- 1,571 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#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; }

  void showHelpFor( QString const & keyword );

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__