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 "ui_HelpBrowser.h"
00021 #include "VidaliaWindow.h"
00022
00023 #include <QMainWindow>
00024 #include <QCloseEvent>
00025 #include <QDomDocument>
00026 #include <QDomElement>
00027 #include <QDomNodeList>
00028 #include <QTreeWidgetItem>
00029 #include <QTextBrowser>
00030 #include <QTextCursor>
00031
00032
00033 class HelpBrowser : public VidaliaWindow
00034 {
00035 Q_OBJECT
00036
00037 public:
00038
00039 HelpBrowser(QWidget *parent = 0);
00040
00041 public slots:
00042
00043 void showWindow(QString topic = QString());
00044
00045 protected:
00046
00047 virtual void retranslateUi();
00048
00049 private slots:
00050
00051 void findNext();
00052
00053 void findPrev();
00054
00055 void search();
00056
00057 void contentsItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
00058
00059 void searchItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
00060
00061 private:
00062
00063
00064 QString language();
00065
00066 void loadContentsFromXml(QString xmlFile);
00067
00068 bool loadContents(const QDomDocument *document, QString &errorString);
00069
00070 void parseHelpTopic(const QDomElement &element, QTreeWidgetItem *parent);
00071
00072 bool isValidTopicElement(const QDomElement &topicElement);
00073
00074 QString getResourcePath(const QDomElement &topicElement);
00075
00076 void find(bool forward);
00077
00078 QTreeWidgetItem* createTopicTreeItem(const QDomElement &topicElement,
00079 QTreeWidgetItem *parent);
00080
00081 void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
00082
00083 QTreeWidgetItem* findTopicItem(QTreeWidgetItem *startItem, QString topic);
00084
00085 void showTopic(QString topic);
00086
00087
00088 QList<QDomElement> _elementList;
00089
00090 QString _lastFind;
00091
00092 QString _lastSearch;
00093
00094 bool _foundBefore;
00095
00096
00097 Ui::HelpBrowser ui;
00098 };
00099
00100 #endif
00101