My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
qucshelp.h
Go to the documentation of this file.
1 /***************************************************************************
2  qucshelp.h
3  ------------
4  begin : Sun Jan 11 2004
5  copyright : (C) 2004 by Michael Margraf
6  email : michael.margraf@alumni.tu-berlin.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef QUCSHELP_H
19 #define QUCSHELP_H
20 
21 #include <qmainwindow.h>
22 #include <qtextbrowser.h>
23 #include <qdir.h>
24 #include <qfont.h>
25 #include <qstringlist.h>
26 
27 struct tQucsSettings {
28  int x, y, dx, dy; // position and size of main window
29  QFont font;
30  QString BitmapDir;
31  QString LangDir;
32  QString DocDir;
33  QString Language;
34 };
35 
37 extern QDir QucsHelpDir;
38 class QAction;
39 class QListViewItem;
40 class QListView;
41 class HtmlDataFetcher;
42 class QDockWindow;
43 
44 class TextBrowser : public QTextBrowser
45 {
46  Q_OBJECT
47  public:
48  TextBrowser(QWidget *parent = 0) : QTextBrowser(parent)
49  {}
50  public slots:
51  void setSource(const QString& name)
52  {
53  // Dont do anything if the clicked link is web url
54  if(!name.startsWith("http://"))
55  QTextBrowser::setSource(name);
56  }
57 };
58 
59 class QucsHelp : public QMainWindow {
60  Q_OBJECT
61  public:
62  QucsHelp(const QString& page);
63  ~QucsHelp();
64 
65  private slots:
66  void slotSourceChanged(const QString& str);
67  void slotToggleSidebar(bool);
68  void slotToggleSidebarAction(bool);
69  void previousLink();
70  void nextLink();
71  void displaySelectedChapter();
72 
73  private:
74  void setupActions();
75  void createSidebar();
76 
77  TextBrowser *textBrowser;
78  uint currentIndex;
79  QStringList links;
80  QAction *previousAction;
81  QAction *nextAction;
82  QAction *viewBrowseDock;
83  QListView *chaptersView;
84  QDockWindow *dock;
85  HtmlDataFetcher *dataFetcher;
86  QString currentSource;
87  QString cachedSelectedText;
88 };
89 
90 #endif