helpbrowser.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef _HELPBROWSER_H
00018 #define _HELPBROWSER_H
00019
00020 #include <QMainWindow>
00021 #include <QCloseEvent>
00022 #include <QDomDocument>
00023 #include <QDomElement>
00024 #include <QDomNodeList>
00025 #include <QTreeWidgetItem>
00026 #include <QTextBrowser>
00027 #include <QTextCursor>
00028 #include <vidaliawindow.h>
00029
00030 #include "ui_helpbrowser.h"
00031
00032 class HelpBrowser : public VidaliaWindow
00033 {
00034 Q_OBJECT
00035
00036 public:
00037
00038 HelpBrowser(QWidget *parent = 0);
00039
00040 public slots:
00041
00042 void showWindow(QString topic = QString());
00043
00044 private slots:
00045
00046 void findNext();
00047
00048 void findPrev();
00049
00050 void search();
00051
00052 void contentsItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
00053
00054 void searchItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
00055
00056 private:
00057
00058
00059 QString language();
00060
00061 void loadContentsFromXml(QString xmlFile);
00062
00063 bool loadContents(const QDomDocument *document, QString &errorString);
00064
00065 void parseHelpTopic(const QDomElement &element, QTreeWidgetItem *parent);
00066
00067 bool isValidTopicElement(const QDomElement &topicElement);
00068
00069 QString getResourcePath(const QDomElement &topicElement);
00070
00071 void find(bool forward);
00072
00073 QTreeWidgetItem* createTopicTreeItem(const QDomElement &topicElement,
00074 QTreeWidgetItem *parent);
00075
00076 void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
00077
00078 QTreeWidgetItem* findTopicItem(QTreeWidgetItem *startItem, QString topic);
00079
00080 void showTopic(QString topic);
00081
00082
00083 QList<QDomElement> _elementList;
00084
00085 QString _lastFind;
00086
00087 QString _lastSearch;
00088
00089 bool _foundBefore;
00090
00091
00092 Ui::HelpBrowser ui;
00093 };
00094
00095 #endif
00096