Vidalia  0.2.21
Public Slots | Public Member Functions | Protected Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
HelpBrowser Class Reference

#include <HelpBrowser.h>

Inheritance diagram for HelpBrowser:
VidaliaWindow

Public Slots

void showWindow (QString topic=QString())
 
- Public Slots inherited from VidaliaWindow
virtual void setVisible (bool visible)
 
virtual void showWindow ()
 

Public Member Functions

 HelpBrowser (QWidget *parent=0)
 
- Public Member Functions inherited from VidaliaWindow
 VidaliaWindow (const QString &name, QWidget *parent=0, Qt::WFlags flags=0)
 
 ~VidaliaWindow ()
 
void setShortcut (const QString &shortcut, const char *slot)
 
void saveWindowState ()
 
void restoreWindowState ()
 
QVariant getSetting (QString name, QVariant defaultValue)
 
void saveSetting (QString name, QVariant value)
 

Protected Member Functions

virtual void retranslateUi ()
 
- Protected Member Functions inherited from VidaliaWindow
virtual void changeEvent (QEvent *e)
 

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
 

Additional Inherited Members

- Signals inherited from VidaliaWindow
void helpRequested (const QString &topic)
 

Detailed Description

Definition at line 32 of file HelpBrowser.h.

Constructor & Destructor Documentation

HelpBrowser::HelpBrowser ( QWidget *  parent = 0)

Default constructor

Constuctor. This will probably do more later

Definition at line 40 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.

Member Function Documentation

void HelpBrowser::contentsItemChanged ( QTreeWidgetItem *  current,
QTreeWidgetItem *  prev 
)
privateslot

Called when the user selects a different item in the contents tree

Called when the user selects a different item in the content topic tree

Definition at line 224 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.

Creates a new element to be inserted into the topic tree.

Definition at line 208 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 258 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

Searches the current page for the phrase in the Find box. Highlights the first instance found in the document

Parameters
forwardtrue search forward if true, backward if false

Definition at line 341 of file HelpBrowser.cpp.

References _foundBefore, _lastFind, and ui.

Referenced by findNext(), and findPrev().

void HelpBrowser::findNext ( )
privateslot

Called when the user clicks "Find Next"

Called when the user clicks "Find Next".

Definition at line 324 of file HelpBrowser.cpp.

References find().

Referenced by HelpBrowser().

void HelpBrowser::findPrev ( )
privateslot

Called when the user clicks "Find Previous"

Called when the user clicks "Find Previous".

Definition at line 331 of file HelpBrowser.cpp.

References find().

Referenced by HelpBrowser().

QTreeWidgetItem * HelpBrowser::findTopicItem ( QTreeWidgetItem *  startItem,
QString  topic 
)
private

Finds a topic in the topic tree.

Searches for a topic in the topic tree. Returns a pointer to that topics item in the topic tree if it is found, 0 otherwise.

Definition at line 271 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.

Builds a resource path to an html file associated with the given help topic. If the help topic needs an achor, the anchor will be formatted and appended.

Definition at line 197 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 186 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 109 of file HelpBrowser.cpp.

References Vidalia::language().

Referenced by getResourcePath(), HelpBrowser(), and retranslateUi().

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 139 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 119 of file HelpBrowser.cpp.

References loadContents(), and ui.

Referenced by HelpBrowser(), and retranslateUi().

void HelpBrowser::parseHelpTopic ( const QDomElement &  topicElement,
QTreeWidgetItem *  parent 
)
private

Parse a Topic element and handle all its children.

Parse a Topic element and handle all its children recursively.

Definition at line 164 of file HelpBrowser.cpp.

References _elementList, createTopicTreeItem(), ELEMENT_TOPIC, and isValidTopicElement().

Referenced by loadContents().

void HelpBrowser::retranslateUi ( )
protectedvirtual

Called when the user changes the UI translation.

Reimplemented from VidaliaWindow.

Definition at line 96 of file HelpBrowser.cpp.

References language(), loadContentsFromXml(), and ui.

void HelpBrowser::search ( )
privateslot

Called when the user starts a search

Searches all help pages for the phrase the Search box. Fills treeSearch with documents containing matches and sets the status bar text appropriately.

Definition at line 410 of file HelpBrowser.cpp.

References _elementList, _lastSearch, createTopicTreeItem(), getResourcePath(), i(), HelpTextBrowser::setSource(), and ui.

Referenced by HelpBrowser().

void HelpBrowser::searchItemChanged ( QTreeWidgetItem *  current,
QTreeWidgetItem *  prev 
)
privateslot

Called when the user selects a different item in the search tree

Called when the user selects a different item in the content topic tree

Definition at line 236 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.

Shows the help browser. If a sepcified topic was given, then search for that topic's ID (e.g., "log.basic") and display the appropriate page.

Definition at line 301 of file HelpBrowser.cpp.

References currentItemChanged(), findTopicItem(), and ui.

Referenced by showWindow().

void HelpBrowser::showWindow ( QString  topic = QString())
slot

Overrides the default QWidget::show()

Overrides the default show method

Definition at line 447 of file HelpBrowser.cpp.

References showTopic(), and VidaliaWindow::showWindow().

Referenced by MainWindow::showHelpDialog().

Member Data Documentation

QList<QDomElement> HelpBrowser::_elementList
private

List of DOM elements representing topics.

Definition at line 87 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 93 of file HelpBrowser.h.

Referenced by currentItemChanged(), and find().

QString HelpBrowser::_lastFind
private

Last phrase used for 'Find'

Definition at line 89 of file HelpBrowser.h.

Referenced by find().

QString HelpBrowser::_lastSearch
private

Last phrase searched on

Definition at line 91 of file HelpBrowser.h.

Referenced by search(), and searchItemChanged().

Ui::HelpBrowser HelpBrowser::ui
private

The documentation for this class was generated from the following files: