#include <helpbrowser.h>
Inheritance diagram for HelpBrowser:
Public Slots | |
void | showWindow (QString topic=QString()) |
Public Member Functions | |
HelpBrowser (QWidget *parent=0) | |
Private Slots | |
void | findNext () |
void | findPrev () |
void | search () |
void | contentsItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev) |
void | searchItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev) |
Private Member Functions | |
QString | language () |
void | loadContentsFromXml (QString xmlFile) |
bool | loadContents (const QDomDocument *document, QString &errorString) |
void | parseHelpTopic (const QDomElement &element, QTreeWidgetItem *parent) |
bool | isValidTopicElement (const QDomElement &topicElement) |
QString | getResourcePath (const QDomElement &topicElement) |
void | find (bool forward) |
QTreeWidgetItem * | createTopicTreeItem (const QDomElement &topicElement, QTreeWidgetItem *parent) |
void | currentItemChanged (QTreeWidgetItem *current, QTreeWidgetItem *prev) |
QTreeWidgetItem * | findTopicItem (QTreeWidgetItem *startItem, QString topic) |
void | showTopic (QString topic) |
Private Attributes | |
QList< QDomElement > | _elementList |
QString | _lastFind |
QString | _lastSearch |
bool | _foundBefore |
Ui::HelpBrowser | ui |
Definition at line 32 of file helpbrowser.h.
HelpBrowser::HelpBrowser | ( | QWidget * | parent = 0 |
) |
Default constructor
Definition at line 42 of file helpbrowser.cpp.
References contentsItemChanged(), Vidalia::createShortcut(), currentItemChanged(), findNext(), findPrev(), language(), LEFT_PANE_INDEX, loadContentsFromXml(), MINIMUM_PANE_SIZE, NO_STRETCH, search(), searchItemChanged(), and ui.
void HelpBrowser::contentsItemChanged | ( | QTreeWidgetItem * | current, | |
QTreeWidgetItem * | prev | |||
) | [private, slot] |
Called when the user selects a different item in the contents tree
Definition at line 210 of file helpbrowser.cpp.
References currentItemChanged(), and ui.
Referenced by HelpBrowser().
QTreeWidgetItem * HelpBrowser::createTopicTreeItem | ( | const QDomElement & | topicElement, | |
QTreeWidgetItem * | parent | |||
) | [private] |
Creates a new item to be placed in the topic tree.
Definition at line 198 of file helpbrowser.cpp.
References ATTRIBUTE_TOPIC_ID, ATTRIBUTE_TOPIC_NAME, getResourcePath(), ROLE_TOPIC_ID, and ROLE_TOPIC_QRC_PATH.
Referenced by loadContents(), parseHelpTopic(), and search().
void HelpBrowser::currentItemChanged | ( | QTreeWidgetItem * | current, | |
QTreeWidgetItem * | prev | |||
) | [private] |
Called when the user selects a different item in the tree.
Definition at line 244 of file helpbrowser.cpp.
References _foundBefore, ROLE_TOPIC_QRC_PATH, and ui.
Referenced by contentsItemChanged(), HelpBrowser(), searchItemChanged(), and showTopic().
void HelpBrowser::find | ( | bool | forward | ) | [private] |
Searches the current page for the phrase in the Find box
Definition at line 325 of file helpbrowser.cpp.
References _foundBefore, _lastFind, and ui.
Referenced by findNext(), and findPrev().
void HelpBrowser::findNext | ( | ) | [private, slot] |
Called when the user clicks "Find Next"
Definition at line 308 of file helpbrowser.cpp.
References find().
Referenced by HelpBrowser().
void HelpBrowser::findPrev | ( | ) | [private, slot] |
Called when the user clicks "Find Previous"
Definition at line 315 of file helpbrowser.cpp.
References find().
Referenced by HelpBrowser().
QTreeWidgetItem * HelpBrowser::findTopicItem | ( | QTreeWidgetItem * | startItem, | |
QString | topic | |||
) | [private] |
Finds a topic in the topic tree.
Definition at line 257 of file helpbrowser.cpp.
References i(), ROLE_TOPIC_ID, and ui.
Referenced by showTopic().
QString HelpBrowser::getResourcePath | ( | const QDomElement & | topicElement | ) | [private] |
Builds a resource path to an html file associated with a help topic.
Definition at line 187 of file helpbrowser.cpp.
References ATTRIBUTE_TOPIC_HTML, ATTRIBUTE_TOPIC_SECTION, and language().
Referenced by createTopicTreeItem(), and search().
bool HelpBrowser::isValidTopicElement | ( | const QDomElement & | topicElement | ) | [private] |
Returns true if the given Topic element has the necessary attributes.
Definition at line 176 of file helpbrowser.cpp.
References ATTRIBUTE_TOPIC_HTML, ATTRIBUTE_TOPIC_ID, and ATTRIBUTE_TOPIC_NAME.
Referenced by parseHelpTopic().
QString HelpBrowser::language | ( | ) | [private] |
Returns the language in which help topics should appear, or English ("en") if no translated help files exist for the current GUI language.
Definition at line 99 of file helpbrowser.cpp.
References Vidalia::language().
Referenced by getResourcePath(), and HelpBrowser().
bool HelpBrowser::loadContents | ( | const QDomDocument * | document, | |
QString & | errorString | |||
) | [private] |
Load the contents of the help topics tree from the given DOM document.
Definition at line 129 of file helpbrowser.cpp.
References _elementList, createTopicTreeItem(), ELEMENT_CONTENTS, ELEMENT_TOPIC, parseHelpTopic(), and ui.
Referenced by loadContentsFromXml().
void HelpBrowser::loadContentsFromXml | ( | QString | xmlFile | ) | [private] |
Load the contents of the help topics tree from the specified XML file.
Definition at line 109 of file helpbrowser.cpp.
References loadContents(), and ui.
Referenced by HelpBrowser().
void HelpBrowser::parseHelpTopic | ( | const QDomElement & | element, | |
QTreeWidgetItem * | parent | |||
) | [private] |
Parse a Topic element and handle all its children.
Definition at line 154 of file helpbrowser.cpp.
References _elementList, createTopicTreeItem(), ELEMENT_TOPIC, and isValidTopicElement().
Referenced by loadContents().
void HelpBrowser::search | ( | ) | [private, slot] |
Called when the user starts a search
Definition at line 394 of file helpbrowser.cpp.
References _elementList, _lastSearch, createTopicTreeItem(), getResourcePath(), i(), HelpTextBrowser::setSource(), and ui.
Referenced by HelpBrowser().
void HelpBrowser::searchItemChanged | ( | QTreeWidgetItem * | current, | |
QTreeWidgetItem * | prev | |||
) | [private, slot] |
Called when the user selects a different item in the search tree
Definition at line 222 of file helpbrowser.cpp.
References _lastSearch, currentItemChanged(), and ui.
Referenced by HelpBrowser().
void HelpBrowser::showTopic | ( | QString | topic | ) | [private] |
Shows the help browser and finds a specific a topic in the browser.
Definition at line 287 of file helpbrowser.cpp.
References currentItemChanged(), findTopicItem(), and ui.
Referenced by showWindow().
void HelpBrowser::showWindow | ( | QString | topic = QString() |
) | [slot] |
Overrides the default QWidget::show()
Definition at line 431 of file helpbrowser.cpp.
References showTopic(), and VidaliaWindow::showWindow().
Referenced by MainWindow::showHelpDialog().
QList<QDomElement> HelpBrowser::_elementList [private] |
List of DOM elements representing topics.
Definition at line 83 of file helpbrowser.h.
Referenced by loadContents(), parseHelpTopic(), and search().
bool HelpBrowser::_foundBefore [private] |
Indicates if phrase was previously found on current page
Definition at line 89 of file helpbrowser.h.
Referenced by currentItemChanged(), and find().
QString HelpBrowser::_lastFind [private] |
QString HelpBrowser::_lastSearch [private] |
Last phrase searched on
Definition at line 87 of file helpbrowser.h.
Referenced by search(), and searchItemChanged().
Ui::HelpBrowser HelpBrowser::ui [private] |
Qt Designer generated QObject
Definition at line 92 of file helpbrowser.h.
Referenced by contentsItemChanged(), currentItemChanged(), find(), findTopicItem(), HelpBrowser(), loadContents(), loadContentsFromXml(), search(), searchItemChanged(), and showTopic().