added a Help Dialog to can make translated html Help/Faq/ pages for RetroShare for each language a own html page.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@662 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-08-05 18:36:07 +00:00
parent 4c840b5c7e
commit e92080789a
28 changed files with 2080 additions and 146 deletions

View File

@ -30,6 +30,7 @@ DEPENDPATH += . \
gui\common\ gui\common\
gui\Settings \ gui\Settings \
gui\toaster \ gui\toaster \
gui\help\browser \
gui\authdlg \ gui\authdlg \
gui\elastic gui\elastic
@ -130,7 +131,10 @@ HEADERS += rshare.h \
gui/toaster/RetroStyleLabelProxy.h \ gui/toaster/RetroStyleLabelProxy.h \
gui/common/vmessagebox.h \ gui/common/vmessagebox.h \
gui/common/rwindow.h \ gui/common/rwindow.h \
gui/common/html.h \
gui/MessagesDialog.h \ gui/MessagesDialog.h \
gui/help/browser/helpbrowser.h \
gui/help/browser/helptextbrowser.h \
gui/Settings/gsettingswin.h \ gui/Settings/gsettingswin.h \
gui/Settings/GeneralPage.h \ gui/Settings/GeneralPage.h \
gui/Settings/DirectoriesPage.h \ gui/Settings/DirectoriesPage.h \
@ -197,6 +201,7 @@ FORMS += gui/ChatDialog.ui \
gui/SharedFilesDialog.ui \ gui/SharedFilesDialog.ui \
gui/StatisticDialog.ui \ gui/StatisticDialog.ui \
gui/MessagesDialog.ui \ gui/MessagesDialog.ui \
gui/help/browser/helpbrowser.ui \
gui/HelpDialog.ui \ gui/HelpDialog.ui \
gui/bwgraph/bwgraph.ui \ gui/bwgraph/bwgraph.ui \
gui/profile/ProfileView.ui \ gui/profile/ProfileView.ui \
@ -286,6 +291,8 @@ SOURCES += main.cpp \
gui/SharedFilesDialog.cpp \ gui/SharedFilesDialog.cpp \
gui/StatisticDialog.cpp \ gui/StatisticDialog.cpp \
gui/MessagesDialog.cpp \ gui/MessagesDialog.cpp \
gui/help/browser/helpbrowser.cpp \
gui/help/browser/helptextbrowser.cpp \
gui/HelpDialog.cpp \ gui/HelpDialog.cpp \
gui/LogoBar.cpp \ gui/LogoBar.cpp \
gui/xprogressbar.cpp \ gui/xprogressbar.cpp \
@ -327,6 +334,7 @@ SOURCES += main.cpp \
gui/Preferences/ConfirmQuitDialog.cpp \ gui/Preferences/ConfirmQuitDialog.cpp \
gui/common/vmessagebox.cpp \ gui/common/vmessagebox.cpp \
gui/common/rwindow.cpp \ gui/common/rwindow.cpp \
gui/common/html.cpp \
gui/Settings/gsettingswin.cpp \ gui/Settings/gsettingswin.cpp \
gui/Settings/GeneralPage.cpp \ gui/Settings/GeneralPage.cpp \
gui/Settings/DirectoriesPage.cpp \ gui/Settings/DirectoriesPage.cpp \
@ -371,7 +379,7 @@ SOURCES += main.cpp \
gui/feeds/SubFileItem.cpp \ gui/feeds/SubFileItem.cpp \
gui/feeds/SubDestItem.cpp \ gui/feeds/SubDestItem.cpp \
RESOURCES += gui/images.qrc lang/lang.qrc games/qcheckers/qcheckers.qrc apps/smplayer/icons.qrc RESOURCES += gui/images.qrc lang/lang.qrc gui/help/content/content.qrc games/qcheckers/qcheckers.qrc apps/smplayer/icons.qrc
TRANSLATIONS += \ TRANSLATIONS += \
lang/retroshare_en.ts \ lang/retroshare_en.ts \
lang/retroshare_de.ts \ lang/retroshare_de.ts \

View File

@ -499,22 +499,10 @@
<enum>Qt::NoContextMenu</enum> <enum>Qt::NoContextMenu</enum>
</property> </property>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="leftMargin" > <property name="margin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="topMargin" > <property name="spacing" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number> <number>0</number>
</property> </property>
<item row="1" column="0" > <item row="1" column="0" >
@ -523,26 +511,22 @@
<number>0</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="tab" > <widget class="QWidget" name="tab" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>714</width>
<height>451</height>
</rect>
</property>
<attribute name="title" > <attribute name="title" >
<string>About</string> <string>About</string>
</attribute> </attribute>
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="leftMargin" > <property name="margin" >
<number>9</number> <number>9</number>
</property> </property>
<property name="topMargin" > <property name="spacing" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="2" > <item row="0" column="2" >
@ -550,7 +534,7 @@
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0" >
<size> <size>
<width>81</width> <width>81</width>
<height>20</height> <height>20</height>
@ -561,7 +545,8 @@
<item row="1" column="0" colspan="3" > <item row="1" column="0" colspan="3" >
<widget class="QTextBrowser" name="textBrowser" > <widget class="QTextBrowser" name="textBrowser" >
<property name="html" > <property name="html" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;a href="http://retroshare.wiki.sourceforge.net/help_tab">&lt;span style=" text-decoration: underline; color:#0000ff;">This Page in the retroshare Wiki&lt;/span>&lt;/a>&lt;br />&lt;br />The About/Help Tab is regularly updated from the Wiki page.&lt;br />&lt;br />External Links to more information:&lt;br />&lt;/p> &lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;a href="http://retroshare.wiki.sourceforge.net/help_tab">&lt;span style=" text-decoration: underline; color:#0000ff;">This Page in the retroshare Wiki&lt;/span>&lt;/a>&lt;br />&lt;br />The About/Help Tab is regularly updated from the Wiki page.&lt;br />&lt;br />External Links to more information:&lt;br />&lt;/p>
@ -588,17 +573,26 @@ p, li { white-space: pre-wrap; }
<item row="0" column="0" > <item row="0" column="0" >
<widget class="QLabel" name="label_4" > <widget class="QLabel" name="label_4" >
<property name="text" > <property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:xx-large; font-weight:600; color:#0000ff;">About RetroShare.&lt;/span>&lt;/p> &lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;br />&lt;span style=" font-weight:600;">Retroshare is a private and secure decentralised commmunication platform.&lt;br />You can use it chat, send messages and share files with your friends.&lt;/span>&lt;br />&lt;br />This is just a placeholder page for the moment. You can&lt;br />improve retroshare's in-built help (this text) by&lt;br />updating the retroshare wiki: &lt;/p>&lt;/body>&lt;/html></string> &lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Retroshare is a private and secure decentralised commmunication platform.&lt;br />You can use it chat, send messages and share files with your friends.&lt;/span>&lt;br />&lt;br />&lt;/p>&lt;/body>&lt;/html></string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_2" > <widget class="QWidget" name="tab_2" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>714</width>
<height>451</height>
</rect>
</property>
<attribute name="title" > <attribute name="title" >
<string>Authors</string> <string>Authors</string>
</attribute> </attribute>
@ -606,16 +600,7 @@ p, li { white-space: pre-wrap; }
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" > <property name="margin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number> <number>9</number>
</property> </property>
<item> <item>
@ -630,7 +615,8 @@ p, li { white-space: pre-wrap; }
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="html" > <property name="html" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;br />&lt;span style=" font-size:19pt; font-weight:600; color:#0000ff;">The RetroShare Team:&lt;/span>&lt;br /> &lt;br />&lt;span style=" font-size:9pt; color:#0000ff;">defnax&lt;/span>: Lead GUI developer &lt;br />&lt;span style=" font-size:9pt; color:#0000ff;">drbob7&lt;/span>: Lead Core developer. &lt;br /> &lt;br />&lt;span style=" font-size:9pt; color:#0000ff;">bmeck&lt;/span> : Our new web-developer. Joined retroshare a couple &lt;br />of weeks ago, and already starting on an exciting new &lt;br />design for the web-page. &lt;br /> &lt;br />&lt;span style=" font-size:9pt; color:#0000ff;">noragen&lt;/span> : Developer from the SIM-IM project. Working on a retroshare plugin to SIM-IM. &lt;br />&lt;/p> &lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;br />&lt;span style=" font-size:19pt; font-weight:600; color:#0000ff;">The RetroShare Team:&lt;/span>&lt;br /> &lt;br />&lt;span style=" font-size:9pt; color:#0000ff;">defnax&lt;/span>: Lead GUI developer &lt;br />&lt;span style=" font-size:9pt; color:#0000ff;">drbob7&lt;/span>: Lead Core developer. &lt;br /> &lt;br />&lt;span style=" font-size:9pt; color:#0000ff;">bmeck&lt;/span> : Our new web-developer. Joined retroshare a couple &lt;br />of weeks ago, and already starting on an exciting new &lt;br />design for the web-page. &lt;br /> &lt;br />&lt;span style=" font-size:9pt; color:#0000ff;">noragen&lt;/span> : Developer from the SIM-IM project. Working on a retroshare plugin to SIM-IM. &lt;br />&lt;/p>
@ -656,6 +642,14 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_3" > <widget class="QWidget" name="tab_3" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>714</width>
<height>451</height>
</rect>
</property>
<attribute name="title" > <attribute name="title" >
<string>Thanks to</string> <string>Thanks to</string>
</attribute> </attribute>
@ -663,16 +657,7 @@ p, li { white-space: pre-wrap; }
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" > <property name="margin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number> <number>9</number>
</property> </property>
<item> <item>
@ -687,22 +672,11 @@ p, li { white-space: pre-wrap; }
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="html" > <property name="html" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-family:'Sans Serif'; font-size:10pt; font-weight:600;">xEsk&lt;/span>&lt;/p> &lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;/p>&lt;/body>&lt;/html></string>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"> xProgressBar: A custom progress bar for Qt 4.&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"> xEsk (Xesc &amp;amp; Technology 2008)&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;"> ProgressBar&lt;/p>
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">&lt;span style=" font-weight:600;">Everaldo Coelho&lt;/span>&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Verdana'; font-size:9pt;"> &lt;a href="http://www.everaldo.com/">&lt;span style=" text-decoration: underline; color:#0000ff;">http://www.everaldo.com/&lt;/span>&lt;/a>&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Verdana'; font-size:9pt; text-decoration: underline; color:#0000ff;">&lt;a href="http://www.everaldo.com/">&lt;span style=" text-decoration:none; color:#000000;"> Crystal Project icons author &lt;/span>&lt;/a>&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Verdana'; font-size:9pt; color:#000000;"> &lt;a href="http://www.kde-look.org/content/show.php/Crystal+Project?content=60475">&lt;span style=" text-decoration: underline; color:#0000ff;">Crystal Project link&lt;/span>&lt;/a>&lt;/p>
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Verdana'; font-size:9pt; text-decoration: underline; color:#0000ff;">&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Verdana'; font-size:9pt; text-decoration: underline; color:#0000ff;">&lt;span style=" font-weight:600; text-decoration:none; color:#000000;">KDE Crystal Diamond Icons&lt;/span>&lt;/p>
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Verdana'; font-size:9pt; text-decoration: underline; color:#0000ff;">&lt;a href="http://www.kde-look.org/content/show.php/Crystal+Project?content=60475">&lt;span style=" text-decoration:none;"> &lt;/span>&lt;/a>&lt;a href="http://www.kde-look.org/content/show.php/Crystal+Project?content=60475">http://www.paolocampitelli.com/kde-icons/&lt;/a>&lt;/p>
&lt;p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Verdana'; font-size:9pt; text-decoration: underline; color:#0000ff;">&lt;/p>&lt;/body>&lt;/html></string>
</property> </property>
<property name="acceptRichText" > <property name="acceptRichText" >
<bool>false</bool> <bool>false</bool>
@ -715,6 +689,14 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_4" > <widget class="QWidget" name="tab_4" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>714</width>
<height>451</height>
</rect>
</property>
<attribute name="title" > <attribute name="title" >
<string>Translation</string> <string>Translation</string>
</attribute> </attribute>
@ -722,16 +704,7 @@ p, li { white-space: pre-wrap; }
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" > <property name="margin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number> <number>9</number>
</property> </property>
<item> <item>
@ -743,7 +716,8 @@ p, li { white-space: pre-wrap; }
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="html" > <property name="html" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Translators:&lt;/span>&lt;/p> &lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-weight:600;">Translators:&lt;/span>&lt;/p>
@ -764,6 +738,14 @@ p, li { white-space: pre-wrap; }
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tab_5" > <widget class="QWidget" name="tab_5" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>714</width>
<height>451</height>
</rect>
</property>
<attribute name="title" > <attribute name="title" >
<string>License Agreement</string> <string>License Agreement</string>
</attribute> </attribute>
@ -771,16 +753,7 @@ p, li { white-space: pre-wrap; }
<property name="spacing" > <property name="spacing" >
<number>6</number> <number>6</number>
</property> </property>
<property name="leftMargin" > <property name="margin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number> <number>9</number>
</property> </property>
<item> <item>
@ -805,22 +778,10 @@ p, li { white-space: pre-wrap; }
</item> </item>
<item row="0" column="0" > <item row="0" column="0" >
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="leftMargin" > <property name="margin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="topMargin" > <property name="spacing" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>0</number>
</property>
<property name="verticalSpacing" >
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="1" > <item row="0" column="1" >
@ -828,7 +789,7 @@ p, li { white-space: pre-wrap; }
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" > <property name="sizeHint" stdset="0" >
<size> <size>
<width>40</width> <width>40</width>
<height>20</height> <height>20</height>
@ -838,22 +799,10 @@ p, li { white-space: pre-wrap; }
</item> </item>
<item row="0" column="0" > <item row="0" column="0" >
<layout class="QGridLayout" > <layout class="QGridLayout" >
<property name="leftMargin" > <property name="margin" >
<number>0</number> <number>0</number>
</property> </property>
<property name="topMargin" > <property name="spacing" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number> <number>6</number>
</property> </property>
<item row="0" column="0" > <item row="0" column="0" >
@ -869,10 +818,11 @@ p, li { white-space: pre-wrap; }
<item row="0" column="1" > <item row="0" column="1" >
<widget class="QLabel" name="label_2" > <widget class="QLabel" name="label_2" >
<property name="text" > <property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css"> <string>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> &lt;/style>&lt;/head>&lt;body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:9pt; font-weight:600;">About/Help&lt;/span>&lt;/p>&lt;/body>&lt;/html></string> &lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:9pt; font-weight:600;">About RetroShare&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property> </property>
</widget> </widget>
</item> </item>
@ -887,7 +837,6 @@ p, li { white-space: pre-wrap; }
<tabstop>authors</tabstop> <tabstop>authors</tabstop>
<tabstop>license</tabstop> <tabstop>license</tabstop>
<tabstop>tabWidget</tabstop> <tabstop>tabWidget</tabstop>
<tabstop>thanks</tabstop>
<tabstop>textBrowser</tabstop> <tabstop>textBrowser</tabstop>
</tabstops> </tabstops>
<resources> <resources>

View File

@ -89,7 +89,7 @@
#define IMAGE_UNFINISHED ":/images/underconstruction.png" #define IMAGE_UNFINISHED ":/images/underconstruction.png"
#define IMAGE_MINIMIZE ":/images/window_nofullscreen.png" #define IMAGE_MINIMIZE ":/images/window_nofullscreen.png"
#define IMAGE_MAXIMIZE ":/images/window_fullscreen.png" #define IMAGE_MAXIMIZE ":/images/window_fullscreen.png"
#define IMG_HELP ":/images/help.png"
/* Keys for UI Preferences */ /* Keys for UI Preferences */
#define UI_PREF_PROMPT_ON_QUIT "UIOptions/ConfirmOnQuit" #define UI_PREF_PROMPT_ON_QUIT "UIOptions/ConfirmOnQuit"
@ -297,6 +297,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
#endif #endif
menu->addAction(_prefsAct); menu->addAction(_prefsAct);
menu->addAction(_smplayerAct); menu->addAction(_smplayerAct);
menu->addAction(_helpAct);
menu->addSeparator(); menu->addSeparator();
menu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized())); menu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized()));
menu->addAction(QIcon(IMAGE_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized())); menu->addAction(QIcon(IMAGE_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized()));
@ -520,6 +521,9 @@ void MainWindow::createActions()
_smplayerAct = new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), this); _smplayerAct = new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), this);
connect(_smplayerAct, SIGNAL(triggered()),this, SLOT(showsmplayer())); connect(_smplayerAct, SIGNAL(triggered()),this, SLOT(showsmplayer()));
_helpAct = new QAction(QIcon(IMG_HELP), tr("Help"), this);
connect(_helpAct, SIGNAL(triggered()), this, SLOT(showHelpDialog()));
//connect(ui.btntoggletoolbox, SIGNAL(toggled(bool)), this, SLOT(showToolboxFrame(bool))); //connect(ui.btntoggletoolbox, SIGNAL(toggled(bool)), this, SLOT(showToolboxFrame(bool)));
@ -711,6 +715,23 @@ void MainWindow::showabout()
helpdlg->show(); helpdlg->show();
} }
/** Displays the help browser and displays the most recently viewed help
* topic. */
void MainWindow::showHelpDialog()
{
showHelpDialog(QString());
}
/**< Shows the help browser and displays the given help <b>topic</b>. */
void MainWindow::showHelpDialog(const QString &topic)
{
static HelpBrowser *helpBrowser = 0;
if (!helpBrowser)
helpBrowser = new HelpBrowser(this);
helpBrowser->showWindow(topic);
}
void MainWindow::setStyle() void MainWindow::setStyle()
{ {
QString standardSheet = "{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 <color1>, stop:1 <color2>);}"; QString standardSheet = "{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 <color1>, stop:1 <color2>);}";

View File

@ -42,6 +42,7 @@
#include "Preferences/PreferencesWindow.h" #include "Preferences/PreferencesWindow.h"
#include "Settings/gsettingswin.h" #include "Settings/gsettingswin.h"
#include "bwgraph/bwgraph.h" #include "bwgraph/bwgraph.h"
#include "help/browser/helpbrowser.h"
#include "games/qbackgammon/bgwindow.h" #include "games/qbackgammon/bgwindow.h"
#include "toplevel.h" #include "toplevel.h"
@ -133,6 +134,12 @@ private slots:
void showsmplayer(); void showsmplayer();
void showabout(); void showabout();
/** Displays the help browser and displays the most recently viewed help
* topic. */
void showHelpDialog();
/** Called when a child window requests the given help <b>topic</b>. */
void showHelpDialog(const QString &topic);
void showSettings(); void showSettings();
void setStyle(); void setStyle();
@ -169,6 +176,7 @@ private:
QAction* _bandwidthAct; QAction* _bandwidthAct;
QAction* _messengerwindowAct; QAction* _messengerwindowAct;
QAction* _smplayerAct; QAction* _smplayerAct;
QAction* _helpAct;
/** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */ /** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */
BandwidthGraph* _bandwidthGraph; BandwidthGraph* _bandwidthGraph;

View File

@ -0,0 +1,86 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
/*
** \file html.cpp
** \version $Id: html.cpp 2362 2008-02-29 04:30:11Z edmanm $
** \brief HTML formatting functions
*/
#include "html.h"
/** Wraps a string in "<p>" tags, converts "\n" to "<br/>" and converts "\n\n"
* to a new paragraph. */
QString
p(QString str)
{
str = "<p>" + str + "</p>";
str.replace("\n\n", "</p><p>");
str.replace("\n", "<br/>");
return str;
}
/** Wraps a string in "<i>" tags. */
QString
i(QString str)
{
return QString("<i>%1</i>").arg(str);
}
/** Wraps a string in "<b>" tags. */
QString
b(QString str)
{
return QString("<b>%1</b>").arg(str);
}
/** Wraps a string in "<tr>" tags. */
QString
trow(QString str)
{
return QString("<tr>%1</tr>").arg(str);
}
/** Wraps a string in "<td>" tags. */
QString
tcol(QString str)
{
return QString("<td>%1</td>").arg(str);
}
/** Wraps a string in "<th>" tags. */
QString
thead(QString str)
{
return QString("<th>%1</th>").arg(str);
}
/** Escapes "<" and ">" characters in the given string. */
QString
escape(QString str)
{
str.replace("<", "&lt;");
str.replace(">", "&gt;");
return str;
}

View File

@ -0,0 +1,58 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
/*
** \file html.h
** \version $Id: html.h 2362 2008-02-29 04:30:11Z edmanm $
** \brief HTML formatting functions
*/
#ifndef _HTML_H
#define _HTML_H
#include <QString>
/** Wraps a string in "<p>" tags, converts "\n" to "<br/>" and converts "\n\n"
* to a new paragraph. */
QString p(QString str);
/** Wraps a string in "<i>" tags. */
QString i(QString str);
/** Wraps a string in "<b>" tags. */
QString b(QString str);
/** Wraps a string in "<tr>" tags. */
QString trow(QString str);
/** Wraps a string in "<td>" tags. */
QString tcol(QString str);
/** Wraps a string in "<th>" tags. */
QString thead(QString str);
/** Escapes "<" and ">" characters in a string, for html. */
QString escape(QString str);
#endif

View File

@ -1,8 +1,8 @@
/**************************************************************** /****************************************************************
* This file is distributed under the following license: * This file is distributed under the following license:
* *
* Copyright (c) 2006-2007, crypton * Copyright (c) 2008, defnax
* Copyright (c) 2006, Matt Edman, Justin Hipple * Copyright (c) 2008, Matt Edman, Justin Hipple
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -20,11 +20,13 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
/** /*
* \file vmessagebox.cpp ** \file vmessagebox.cpp
* \version $Id: vmessagebox.cpp 990 2006-06-08 03:31:27Z edmanm $ ** \version $Id: vmessagebox.cpp 2362 2008-02-29 04:30:11Z edmanm $
*/ ** \brief Provides a custom Vidalia mesage box
*/
#include "html.h"
#include "vmessagebox.h" #include "vmessagebox.h"
@ -70,11 +72,11 @@ int
VMessageBox::selected(int ret, int button0, int button1, int button2) VMessageBox::selected(int ret, int button0, int button1, int button2)
{ {
if (ret == 0) { if (ret == 0) {
return button0; return (button0 & QMessageBox::ButtonMask);
} else if (ret == 1) { } else if (ret == 1) {
return button1; return (button1 & QMessageBox::ButtonMask);
} }
return button2; return (button2 & QMessageBox::ButtonMask);
} }
/** Converts a Button enum value to a translated string. */ /** Converts a Button enum value to a translated string. */
@ -92,6 +94,9 @@ VMessageBox::buttonText(int btn)
case Retry: text = tr("Retry"); break; case Retry: text = tr("Retry"); break;
case ShowLog: text = tr("Show Log"); break; case ShowLog: text = tr("Show Log"); break;
case ShowSettings: text = tr("Show Settings"); break; case ShowSettings: text = tr("Show Settings"); break;
case Continue: text = tr("Continue"); break;
case Quit: text = tr("Quit"); break;
case Browse: text = tr("Browse"); break;
default: break; default: break;
} }
return text; return text;
@ -105,7 +110,7 @@ int
VMessageBox::critical(QWidget *parent, QString caption, QString text, VMessageBox::critical(QWidget *parent, QString caption, QString text,
int button0, int button1, int button2) int button0, int button1, int button2)
{ {
int ret = QMessageBox::critical(parent, caption, text, int ret = QMessageBox::critical(parent, caption, p(text),
VMessageBox::buttonText(button0), VMessageBox::buttonText(button0),
VMessageBox::buttonText(button1), VMessageBox::buttonText(button1),
VMessageBox::buttonText(button2), VMessageBox::buttonText(button2),
@ -122,7 +127,7 @@ int
VMessageBox::question(QWidget *parent, QString caption, QString text, VMessageBox::question(QWidget *parent, QString caption, QString text,
int button0, int button1, int button2) int button0, int button1, int button2)
{ {
int ret = QMessageBox::question(parent, caption, text, int ret = QMessageBox::question(parent, caption, p(text),
VMessageBox::buttonText(button0), VMessageBox::buttonText(button0),
VMessageBox::buttonText(button1), VMessageBox::buttonText(button1),
VMessageBox::buttonText(button2), VMessageBox::buttonText(button2),
@ -139,7 +144,7 @@ int
VMessageBox::information(QWidget *parent, QString caption, QString text, VMessageBox::information(QWidget *parent, QString caption, QString text,
int button0, int button1, int button2) int button0, int button1, int button2)
{ {
int ret = QMessageBox::information(parent, caption, text, int ret = QMessageBox::information(parent, caption, p(text),
VMessageBox::buttonText(button0), VMessageBox::buttonText(button0),
VMessageBox::buttonText(button1), VMessageBox::buttonText(button1),
VMessageBox::buttonText(button2), VMessageBox::buttonText(button2),
@ -156,7 +161,7 @@ int
VMessageBox::warning(QWidget *parent, QString caption, QString text, VMessageBox::warning(QWidget *parent, QString caption, QString text,
int button0, int button1, int button2) int button0, int button1, int button2)
{ {
int ret = QMessageBox::warning(parent, caption, text, int ret = QMessageBox::warning(parent, caption, p(text),
VMessageBox::buttonText(button0), VMessageBox::buttonText(button0),
VMessageBox::buttonText(button1), VMessageBox::buttonText(button1),
VMessageBox::buttonText(button2), VMessageBox::buttonText(button2),

View File

@ -1,8 +1,8 @@
/**************************************************************** /****************************************************************
* This file is distributed under the following license: * This file is distributed under the following license:
* *
* Copyright (c) 2006-2007, crypton * Copyright (c) 2008, defnax
* Copyright (c) 2006, Matt Edman, Justin Hipple * Copyright (c) 2008, Matt Edman, Justin Hipple
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -20,10 +20,11 @@
* Boston, MA 02110-1301, USA. * Boston, MA 02110-1301, USA.
****************************************************************/ ****************************************************************/
/** /*
* \file vmessagebox.h ** \file vmessagebox.h
* \version $Id: vmessagebox.h 990 2006-06-08 03:31:27Z edmanm $ ** \version $Id: vmessagebox.h 2362 2008-02-29 04:30:11Z edmanm $
*/ ** \brief Provides a custom Vidalia mesage box
*/
#ifndef _VMESSAGEBOX_H #ifndef _VMESSAGEBOX_H
#define _VMESSAGEBOX_H #define _VMESSAGEBOX_H
@ -46,7 +47,10 @@ public:
Help, Help,
Retry, Retry,
ShowLog, ShowLog,
ShowSettings ShowSettings,
Continue,
Quit,
Browse
}; };
/** Default constructor. */ /** Default constructor. */

View File

@ -0,0 +1,454 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
/*
** \file helpbrowser.cpp
** \version $Id: helpbrowser.cpp 2362 2008-02-29 04:30:11Z edmanm $
** \brief Displays a list of help topics and content
*/
#include <QDomDocument>
#include <QDir>
#include <rshare.h>
#include "gui/MainWindow.h"
#include "helpbrowser.h"
#define LEFT_PANE_INDEX 0
#define NO_STRETCH 0
#define MINIMUM_PANE_SIZE 1
/* Names of elements and attributes in the XML file */
#define ELEMENT_CONTENTS "Contents"
#define ELEMENT_TOPIC "Topic"
#define ATTRIBUTE_TOPIC_ID "id"
#define ATTRIBUTE_TOPIC_HTML "html"
#define ATTRIBUTE_TOPIC_NAME "name"
#define ATTRIBUTE_TOPIC_SECTION "section"
/* Define two roles used to store data associated with a topic item */
#define ROLE_TOPIC_ID Qt::UserRole
#define ROLE_TOPIC_QRC_PATH (Qt::UserRole+1)
/** Constuctor. This will probably do more later */
HelpBrowser::HelpBrowser(QWidget *parent)
: RWindow("HelpBrowser", parent)
{
RshareSettings _settings;
/* Invoke Qt Designer generated QObject setup routine */
ui.setupUi(this);
#if defined(Q_WS_MAC)
ui.actionHome->setShortcut(QString("Shift+Ctrl+H"));
#endif
#if !defined(Q_WS_WIN)
ui.actionClose->setShortcut(QString("Ctrl+W"));
#endif
/* Hide Search frame */
ui.frmFind->setHidden(true);
/* Set the splitter pane sizes so that only the txtBrowser pane expands
* and set to arbitrary sizes (the minimum sizes will take effect */
QList<int> sizes;
sizes.append(MINIMUM_PANE_SIZE);
sizes.append(MINIMUM_PANE_SIZE);
ui.splitter->setSizes(sizes);
ui.splitter->setStretchFactor(LEFT_PANE_INDEX, NO_STRETCH);
connect(ui.treeContents,
SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
this, SLOT(contentsItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
connect(ui.treeSearch,
SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)),
this, SLOT(searchItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)));
/* Connect the navigation actions to their slots */
connect(ui.actionHome, SIGNAL(triggered()), ui.txtBrowser, SLOT(home()));
connect(ui.actionBack, SIGNAL(triggered()), ui.txtBrowser, SLOT(backward()));
connect(ui.actionForward, SIGNAL(triggered()), ui.txtBrowser, SLOT(forward()));
connect(ui.txtBrowser, SIGNAL(backwardAvailable(bool)),
ui.actionBack, SLOT(setEnabled(bool)));
connect(ui.txtBrowser, SIGNAL(forwardAvailable(bool)),
ui.actionForward, SLOT(setEnabled(bool)));
connect(ui.btnFindNext, SIGNAL(clicked()), this, SLOT(findNext()));
connect(ui.btnFindPrev, SIGNAL(clicked()), this, SLOT(findPrev()));
connect(ui.btnSearch, SIGNAL(clicked()), this, SLOT(search()));
/* Load the help topics from XML */
loadContentsFromXml(":/help/" + language() + "/contents.xml");
/* Show the first help topic in the tree */
ui.treeContents->setCurrentItem(ui.treeContents->topLevelItem(0));
ui.treeContents->setItemExpanded(ui.treeContents->topLevelItem(0), true);
}
/** Returns the language in which help topics should appear, or English
* ("en") if no translated help files exist for the current GUI language. */
QString
HelpBrowser::language()
{
QString lang = Rshare::language();
if (!QDir(":/help/" + lang).exists())
lang = "en";
return lang;
}
/** Load the contents of the help topics tree from the specified XML file. */
void
HelpBrowser::loadContentsFromXml(QString xmlFile)
{
QString errorString;
QFile file(xmlFile);
QDomDocument document;
/* Load the XML contents into the DOM document */
if (!document.setContent(&file, true, &errorString)) {
ui.txtBrowser->setPlainText(tr("Error Loading Help Contents: ")+errorString);
return;
}
/* Load the DOM document contents into the tree view */
if (!loadContents(&document, errorString)) {
ui.txtBrowser->setPlainText(tr("Error Loading Help Contents: ")+errorString);
return;
}
}
/** Load the contents of the help topics tree from the given DOM document. */
bool
HelpBrowser::loadContents(const QDomDocument *document, QString &errorString)
{
/* Grab the root document element and make sure it's the right one */
QDomElement root = document->documentElement();
if (root.tagName() != ELEMENT_CONTENTS) {
errorString = tr("Supplied XML file is not a valid Contents document.");
return false;
}
_elementList << root;
/* Create the home item */
QTreeWidgetItem *home = createTopicTreeItem(root, 0);
ui.treeContents->addTopLevelItem(home);
/* Process all top-level help topics */
QDomElement child = root.firstChildElement(ELEMENT_TOPIC);
while (!child.isNull()) {
parseHelpTopic(child, home);
child = child.nextSiblingElement(ELEMENT_TOPIC);
}
return true;
}
/** Parse a Topic element and handle all its children recursively. */
void
HelpBrowser::parseHelpTopic(const QDomElement &topicElement,
QTreeWidgetItem *parent)
{
/* Check that we have a valid help topic */
if (isValidTopicElement(topicElement)) {
/* Save this element for later (used for searching) */
_elementList << topicElement;
/* Create and populate the new topic item in the tree */
QTreeWidgetItem *topic = createTopicTreeItem(topicElement, parent);
/* Process all its child elements */
QDomElement child = topicElement.firstChildElement(ELEMENT_TOPIC);
while (!child.isNull()) {
parseHelpTopic(child, topic);
child = child.nextSiblingElement(ELEMENT_TOPIC);
}
}
}
/** Returns true if the given Topic element has the necessary attributes. */
bool
HelpBrowser::isValidTopicElement(const QDomElement &topicElement)
{
return (topicElement.hasAttribute(ATTRIBUTE_TOPIC_ID) &&
topicElement.hasAttribute(ATTRIBUTE_TOPIC_NAME) &&
topicElement.hasAttribute(ATTRIBUTE_TOPIC_HTML));
}
/** 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. */
QString
HelpBrowser::getResourcePath(const QDomElement &topicElement)
{
QString link = language() + "/" + topicElement.attribute(ATTRIBUTE_TOPIC_HTML);
if (topicElement.hasAttribute(ATTRIBUTE_TOPIC_SECTION)) {
link += "#" + topicElement.attribute(ATTRIBUTE_TOPIC_SECTION);
}
return link;
}
/** Creates a new element to be inserted into the topic tree. */
QTreeWidgetItem*
HelpBrowser::createTopicTreeItem(const QDomElement &topicElement,
QTreeWidgetItem *parent)
{
QTreeWidgetItem *topic = new QTreeWidgetItem(parent);
topic->setText(0, topicElement.attribute(ATTRIBUTE_TOPIC_NAME));
topic->setData(0, ROLE_TOPIC_ID, topicElement.attribute(ATTRIBUTE_TOPIC_ID));
topic->setData(0, ROLE_TOPIC_QRC_PATH, getResourcePath(topicElement));
return topic;
}
/** Called when the user selects a different item in the content topic tree */
void
HelpBrowser::contentsItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev)
{
QList<QTreeWidgetItem *> selected = ui.treeSearch->selectedItems();
/* Deselect the selection in the search tree */
if (!selected.isEmpty()) {
ui.treeSearch->setItemSelected(selected[0], false);
}
currentItemChanged(current, prev);
}
/** Called when the user selects a different item in the content topic tree */
void
HelpBrowser::searchItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev)
{
QList<QTreeWidgetItem *> selected = ui.treeContents->selectedItems();
/* Deselect the selection in the contents tree */
if (!selected.isEmpty()) {
ui.treeContents->setItemSelected(selected[0], false);
}
/* Change to selected page */
currentItemChanged(current, prev);
/* Highlight search phrase */
QTextCursor found;
QTextDocument::FindFlags flags = QTextDocument::FindWholeWords;
found = ui.txtBrowser->document()->find(_lastSearch, 0, flags);
if (!found.isNull()) {
ui.txtBrowser->setTextCursor(found);
}
}
/** Called when the user selects a different item in the tree. */
void
HelpBrowser::currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev)
{
Q_UNUSED(prev);
if (current) {
ui.txtBrowser->setSource(QUrl(current->data(0,
ROLE_TOPIC_QRC_PATH).toString()));
}
_foundBefore = false;
}
/** 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. */
QTreeWidgetItem*
HelpBrowser::findTopicItem(QTreeWidgetItem *startItem, QString topic)
{
/* If startItem is null, then we don't know where to start searching. */
if (!startItem)
return 0;
/* Parse the first subtopic in the topic id. */
QString subtopic = topic.mid(0, topic.indexOf(".")).toLower();
/* Search through all children of startItem and look for a subtopic match */
for (int i = 0; i < startItem->childCount(); i++) {
QTreeWidgetItem *item = startItem->child(i);
if (subtopic == item->data(0, ROLE_TOPIC_ID).toString().toLower()) {
/* Found a subtopic match, so expand this item */
ui.treeContents->setItemExpanded(item, true);
if (!topic.contains(".")) {
/* Found the exact topic */
return item;
}
/* Search recursively for the next subtopic */
return findTopicItem(item, topic.mid(topic.indexOf(".")+1));
}
}
return 0;
}
/** Shows the help browser. If a sepcified topic was given, the search for
* that topic's ID (e.g., "log.basic") and display the appropriate page. */
void
HelpBrowser::showTopic(QString topic)
{
/* Search for the topic in the contents tree */
QTreeWidgetItem *item =
findTopicItem(ui.treeContents->topLevelItem(0), topic);
if (item) {
/* Item was found, so show its location in the hierarchy and select its
* tree item. */
QTreeWidgetItem* selected = ui.treeContents->selectedItems()[0];
if (selected) {
ui.treeContents->setItemSelected(selected, false);
}
ui.treeContents->setItemExpanded(ui.treeContents->topLevelItem(0), true);
ui.treeContents->setItemSelected(item, true);
currentItemChanged(item, selected);
}
}
/** Called when the user clicks "Find Next". */
void
HelpBrowser::findNext()
{
find(true);
}
/** Called when the user clicks "Find Previous". */
void
HelpBrowser::findPrev()
{
find(false);
}
/** Searches the current page for the phrase in the Find box.
* Highlights the first instance found in the document
* \param forward true search forward if true, backward if false
**/
void
HelpBrowser::find(bool forward)
{
/* Don't bother searching if there is no search phrase */
if (ui.lineFind->text().isEmpty()) {
return;
}
QTextDocument::FindFlags flags = 0;
QTextCursor cursor = ui.txtBrowser->textCursor();
QString searchPhrase = ui.lineFind->text();
/* Clear status bar */
this->statusBar()->clearMessage();
/* Set search direction and other flags */
if (!forward) {
flags |= QTextDocument::FindBackward;
}
if (ui.chkbxMatchCase->isChecked()) {
flags |= QTextDocument::FindCaseSensitively;
}
if (ui.chkbxWholePhrase->isChecked()) {
flags |= QTextDocument::FindWholeWords;
}
/* Check if search phrase is the same as the previous */
if (searchPhrase != _lastFind) {
_foundBefore = false;
}
_lastFind = searchPhrase;
/* Set the cursor to the appropriate start location if necessary */
if (!cursor.hasSelection()) {
if (forward) {
cursor.movePosition(QTextCursor::Start);
} else {
cursor.movePosition(QTextCursor::End);
}
ui.txtBrowser->setTextCursor(cursor);
}
/* Search the page */
QTextCursor found;
found = ui.txtBrowser->document()->find(searchPhrase, cursor, flags);
/* If found, move the cursor to the location */
if (!found.isNull()) {
ui.txtBrowser->setTextCursor(found);
/* If not found, display appropriate error message */
} else {
if (_foundBefore) {
if (forward)
this->statusBar()->showMessage(tr("Search reached end of document"));
else
this->statusBar()->showMessage(tr("Search reached start of document"));
} else {
this->statusBar()->showMessage(tr("Text not found in document"));
}
}
/* Even if not found this time, may have been found previously */
_foundBefore |= !found.isNull();
}
/** Searches all help pages for the phrase the Search box.
* Fills treeSearch with documents containing matches and sets the
* status bar text appropriately.
*/
void
HelpBrowser::search()
{
/* Clear the list */
ui.treeSearch->clear();
/* Don't search if invalid document or blank search phrase */
if (ui.lineSearch->text().isEmpty()) {
return;
}
HelpTextBrowser browser;
QTextCursor found;
QTextDocument::FindFlags flags = QTextDocument::FindWholeWords;
_lastSearch = ui.lineSearch->text();
/* Search through all the pages looking for the phrase */
for (int i=0; i < _elementList.size(); ++i) {
/* Load page data into browser */
browser.setSource(QUrl(getResourcePath(_elementList[i])));
/* Search current document */
found = browser.document()->find(ui.lineSearch->text(), 0, flags);
/* If found, add page to tree */
if (!found.isNull()) {
ui.treeSearch->addTopLevelItem(createTopicTreeItem(_elementList[i], 0));
}
}
/* Set the status bar text */
this->statusBar()->showMessage(tr("Found %1 results")
.arg(ui.treeSearch->topLevelItemCount()));
}
/** Overrides the default show method */
void
HelpBrowser::showWindow(QString topic)
{
/* Bring the window to the top */
RWindow::showWindow();
/* If a topic was specified, then go ahead and display it. */
if (!topic.isEmpty()) {
showTopic(topic);
}
}

View File

@ -0,0 +1,108 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
/*
** \file helpbrowser.h
** \version $Id: helpbrowser.h 2362 2008-02-29 04:30:11Z edmanm $
** \brief Displays a list of help topics and content
*/
#ifndef _HELPBROWSER_H
#define _HELPBROWSER_H
#include <QMainWindow>
#include <QCloseEvent>
#include <QDomDocument>
#include <QDomElement>
#include <QDomNodeList>
#include <QTreeWidgetItem>
#include <QTextBrowser>
#include <QTextCursor>
#include <gui/common/rwindow.h>
#include "ui_helpbrowser.h"
class HelpBrowser : public RWindow
{
Q_OBJECT
public:
/** Default constructor **/
HelpBrowser(QWidget *parent = 0);
public slots:
/** Overrides the default QWidget::show() */
void showWindow(QString topic = QString());
private slots:
/** Called when the user clicks "Find Next" */
void findNext();
/** Called when the user clicks "Find Previous" */
void findPrev();
/** Called when the user starts a search */
void search();
/** Called when the user selects a different item in the contents tree */
void contentsItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
/** Called when the user selects a different item in the search tree */
void searchItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
private:
/** Returns the language in which help topics should appear, or English
* ("en") if no translated help files exist for the current GUI language. */
QString language();
/** Load the contents of the help topics tree from the specified XML file. */
void loadContentsFromXml(QString xmlFile);
/** Load the contents of the help topics tree from the given DOM document. */
bool loadContents(const QDomDocument *document, QString &errorString);
/** Parse a Topic element and handle all its children. */
void parseHelpTopic(const QDomElement &element, QTreeWidgetItem *parent);
/** Returns true if the given Topic element has the necessary attributes. */
bool isValidTopicElement(const QDomElement &topicElement);
/** Builds a resource path to an html file associated with a help topic. */
QString getResourcePath(const QDomElement &topicElement);
/** Searches the current page for the phrase in the Find box */
void find(bool forward);
/** Creates a new item to be placed in the topic tree. */
QTreeWidgetItem* createTopicTreeItem(const QDomElement &topicElement,
QTreeWidgetItem *parent);
/** Called when the user selects a different item in the tree. */
void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *prev);
/** Finds a topic in the topic tree. */
QTreeWidgetItem* findTopicItem(QTreeWidgetItem *startItem, QString topic);
/** Shows the help browser and finds a specific a topic in the browser. */
void showTopic(QString topic);
/** List of DOM elements representing topics. */
QList<QDomElement> _elementList;
/** Last phrase used for 'Find' */
QString _lastFind;
/** Last phrase searched on */
QString _lastSearch;
/** Indicates if phrase was previously found on current page */
bool _foundBefore;
/** Qt Designer generated QObject */
Ui::HelpBrowser ui;
};
#endif

View File

@ -0,0 +1,720 @@
<ui version="4.0" >
<class>HelpBrowser</class>
<widget class="QMainWindow" name="HelpBrowser" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>703</width>
<height>583</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="windowTitle" >
<string>RetroShare Help</string>
</property>
<property name="windowIcon" >
<iconset resource="../../images.qrc" >
<normaloff>:/images/help.png</normaloff>:/images/help.png</iconset>
</property>
<property name="statusTip" >
<string/>
</property>
<property name="autoFillBackground" >
<bool>true</bool>
</property>
<property name="toolButtonStyle" >
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<widget class="QWidget" name="centralwidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>52</y>
<width>703</width>
<height>510</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>9</number>
</property>
<item>
<widget class="QFrame" name="frmFind" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>450</width>
<height>79</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>79</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>0</number>
</property>
<item>
<widget class="QToolButton" name="btnCloseFind" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text" >
<string/>
</property>
<property name="icon" >
<iconset resource="../../images.qrc" >
<normaloff>:/images/button_cancel.png</normaloff>:/images/button_cancel.png</iconset>
</property>
<property name="iconSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="toolButtonStyle" >
<enum>Qt::ToolButtonIconOnly</enum>
</property>
<property name="autoRaise" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text" >
<string>Find:</string>
</property>
<property name="buddy" >
<cstring>lineFind</cstring>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineFind" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="btnFindPrev" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text" >
<string>Find Previous</string>
</property>
<property name="icon" >
<iconset>
<normaloff>:/images/22x22/go-up-search.png</normaloff>:/images/22x22/go-up-search.png</iconset>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QPushButton" name="btnFindNext" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text" >
<string>Find Next</string>
</property>
<property name="icon" >
<iconset>
<normaloff>:/images/22x22/go-down-search.png</normaloff>:/images/22x22/go-down-search.png</iconset>
</property>
</widget>
</item>
<item row="1" column="0" colspan="3" >
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="chkbxMatchCase" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text" >
<string>Case sensitive</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkbxWholePhrase" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text" >
<string>Whole words only</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QSplitter" name="splitter" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<widget class="QTabWidget" name="tabsMenu" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="tabPosition" >
<enum>QTabWidget::North</enum>
</property>
<property name="tabShape" >
<enum>QTabWidget::Rounded</enum>
</property>
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="tabTOC" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>268</width>
<height>380</height>
</rect>
</property>
<property name="windowTitle" >
<string>RetroShare Help</string>
</property>
<property name="windowIcon" >
<iconset resource="../../images.qrc" >
<normaloff>:/images/help.png</normaloff>:/images/help.png</iconset>
</property>
<attribute name="title" >
<string>Contents</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>6</number>
</property>
<item>
<widget class="QTreeWidget" name="treeContents" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy" >
<enum>Qt::WheelFocus</enum>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="selectionBehavior" >
<enum>QAbstractItemView::SelectItems</enum>
</property>
<property name="uniformRowHeights" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>Help Topics</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabSearch" >
<property name="geometry" >
<rect>
<x>4</x>
<y>23</y>
<width>268</width>
<height>380</height>
</rect>
</property>
<attribute name="title" >
<string>Search</string>
</attribute>
<layout class="QGridLayout" >
<property name="margin" >
<number>6</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="1" >
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnSearch" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text" >
<string>Search</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="label_2" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="text" >
<string>Searching for:</string>
</property>
<property name="buddy" >
<cstring>lineSearch</cstring>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2" >
<widget class="QTreeWidget" name="treeSearch" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>200</width>
<height>0</height>
</size>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="focusPolicy" >
<enum>Qt::WheelFocus</enum>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="selectionBehavior" >
<enum>QAbstractItemView::SelectItems</enum>
</property>
<property name="uniformRowHeights" >
<bool>true</bool>
</property>
<column>
<property name="text" >
<string>Found Documents</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<widget class="QLineEdit" name="lineSearch" >
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
<widget class="HelpTextBrowser" name="txtBrowser" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>100</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="readOnly" >
<bool>true</bool>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>562</y>
<width>703</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="toolBar" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>703</width>
<height>52</height>
</rect>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
<property name="movable" >
<bool>false</bool>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="toolButtonStyle" >
<enum>Qt::ToolButtonTextUnderIcon</enum>
</property>
<attribute name="toolBarArea" >
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak" >
<bool>false</bool>
</attribute>
<addaction name="actionBack" />
<addaction name="actionForward" />
<addaction name="actionHome" />
<addaction name="actionFind" />
<addaction name="separator" />
<addaction name="actionClose" />
</widget>
<action name="actionBack" >
<property name="icon" >
<iconset resource="../../images.qrc" >
<normaloff>:/images/back.png</normaloff>:/images/back.png</iconset>
</property>
<property name="text" >
<string>Back</string>
</property>
<property name="statusTip" >
<string>Move to previous page (Backspace)</string>
</property>
<property name="shortcut" >
<string>Backspace</string>
</property>
</action>
<action name="actionForward" >
<property name="icon" >
<iconset resource="../../images.qrc" >
<normaloff>:/images/forward.png</normaloff>:/images/forward.png</iconset>
</property>
<property name="text" >
<string>Forward</string>
</property>
<property name="statusTip" >
<string>Move to next page (Shift+Backspace)</string>
</property>
<property name="shortcut" >
<string>Shift+Backspace</string>
</property>
</action>
<action name="actionHome" >
<property name="icon" >
<iconset resource="../../images.qrc" >
<normaloff>:/images/gohome.png</normaloff>:/images/gohome.png</iconset>
</property>
<property name="text" >
<string>Home</string>
</property>
<property name="statusTip" >
<string>Move to the Home page (Ctrl+H)</string>
</property>
<property name="shortcut" >
<string>Ctrl+H</string>
</property>
</action>
<action name="actionFind" >
<property name="checkable" >
<bool>true</bool>
</property>
<property name="icon" >
<iconset resource="../../images.qrc" >
<normaloff>:/images/find.png</normaloff>:/images/find.png</iconset>
</property>
<property name="text" >
<string>Find</string>
</property>
<property name="iconText" >
<string>Find</string>
</property>
<property name="toolTip" >
<string>Find</string>
</property>
<property name="statusTip" >
<string>Search for a word or phrase on current page (Ctrl+F)</string>
</property>
<property name="shortcut" >
<string>Ctrl+F</string>
</property>
</action>
<action name="actionClose" >
<property name="icon" >
<iconset resource="../../images.qrc" >
<normaloff>:/images/exit_24x24.png</normaloff>:/images/exit_24x24.png</iconset>
</property>
<property name="text" >
<string>Close</string>
</property>
<property name="statusTip" >
<string>Close Vidalia Help</string>
</property>
<property name="shortcut" >
<string>Esc</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
<class>HelpTextBrowser</class>
<extends>QTextBrowser</extends>
<header>gui/help/browser/helptextbrowser.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabsMenu</tabstop>
<tabstop>btnCloseFind</tabstop>
<tabstop>lineFind</tabstop>
<tabstop>btnFindNext</tabstop>
<tabstop>btnFindPrev</tabstop>
<tabstop>chkbxMatchCase</tabstop>
<tabstop>chkbxWholePhrase</tabstop>
<tabstop>treeContents</tabstop>
<tabstop>txtBrowser</tabstop>
<tabstop>lineSearch</tabstop>
<tabstop>btnSearch</tabstop>
<tabstop>treeSearch</tabstop>
</tabstops>
<resources>
<include location="../../images.qrc" />
</resources>
<connections>
<connection>
<sender>actionFind</sender>
<signal>triggered()</signal>
<receiver>lineFind</receiver>
<slot>setFocus()</slot>
<hints>
<hint type="sourcelabel" >
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel" >
<x>200</x>
<y>108</y>
</hint>
</hints>
</connection>
<connection>
<sender>btnCloseFind</sender>
<signal>clicked()</signal>
<receiver>actionFind</receiver>
<slot>toggle()</slot>
<hints>
<hint type="sourcelabel" >
<x>34</x>
<y>107</y>
</hint>
<hint type="destinationlabel" >
<x>-1</x>
<y>-1</y>
</hint>
</hints>
</connection>
<connection>
<sender>actionFind</sender>
<signal>toggled(bool)</signal>
<receiver>frmFind</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel" >
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel" >
<x>243</x>
<y>108</y>
</hint>
</hints>
</connection>
<connection>
<sender>actionClose</sender>
<signal>triggered()</signal>
<receiver>HelpBrowser</receiver>
<slot>close()</slot>
<hints>
<hint type="sourcelabel" >
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel" >
<x>317</x>
<y>248</y>
</hint>
</hints>
</connection>
<connection>
<sender>lineFind</sender>
<signal>returnPressed()</signal>
<receiver>btnFindNext</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel" >
<x>293</x>
<y>108</y>
</hint>
<hint type="destinationlabel" >
<x>539</x>
<y>108</y>
</hint>
</hints>
</connection>
<connection>
<sender>lineSearch</sender>
<signal>returnPressed()</signal>
<receiver>btnSearch</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel" >
<x>153</x>
<y>245</y>
</hint>
<hint type="destinationlabel" >
<x>244</x>
<y>277</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,110 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
/*
** \file helptextbrowser.cpp
** \version $Id: helptextbrowser.cpp 2679 2008-06-10 03:07:10Z edmanm $
** \brief Displays an HTML-based help document
*/
#include <QDir>
#include <QFile>
#include <QDesktopServices>
#include "gui/common/vmessagebox.h"
#include "gui/common/html.h"
#include <rshare.h>
#include "helptextbrowser.h"
/** Default constructor. */
HelpTextBrowser::HelpTextBrowser(QWidget *parent)
: QTextBrowser(parent)
{
setOpenExternalLinks(false);
}
/** Loads a resource into the browser. If it is an HTML resource, we'll load
* it as UTF-8, so the special characters in our translations appear properly. */
QVariant
HelpTextBrowser::loadResource(int type, const QUrl &name)
{
/* If it's an HTML file, we'll handle it ourselves */
if (type == QTextDocument::HtmlResource) {
QString helpPath = ":/help/";
/* Fall back to English if there is no translation of the specified help
* page in the current language. */
if (!name.path().contains("/")) {
QString language = Rshare::language();
if (!QDir(":/help/" + language).exists())
language = "en";
helpPath += language + "/";
}
QFile file(helpPath + name.path());
if (!file.open(QIODevice::ReadOnly)) {
return tr("Error opening help file: ") + name.path();
}
return QString::fromUtf8(file.readAll());
}
/* Everything else, just let QTextBrowser take care of it. */
return QTextBrowser::loadResource(type, name);
}
/** Called when the displayed document is changed. If <b>url</b> specifies
* an external link, then the user will be prompted for whether they want to
* open the link in their default browser or not. */
void
HelpTextBrowser::setSource(const QUrl &url)
{
if (url.scheme() != "qrc" && !url.isRelative()) {
/* External link. Prompt the user for a response. */
int ret = VMessageBox::question(this,
tr("Opening External Link"),
p(tr("Vidalia can open the link you selected in your default "
"Web browser. If your browser is not currently "
"configured to use Tor then the request will not be "
"anonymous.")) +
p(tr("Do you want Vidalia to open the link in your Web "
"browser?")),
VMessageBox::Yes|VMessageBox::Default,
VMessageBox::Cancel|VMessageBox::Cancel);
if (ret == VMessageBox::Cancel)
return;
bool ok = QDesktopServices::openUrl(url);
if (!ok) {
VMessageBox::information(this,
tr("Unable to Open Link"),
tr("Vidalia was unable to open the selected link in your Web browser. "
"You can still copy the URL and paste it into your browser."),
VMessageBox::Ok);
}
} else {
/* Internal link. Just load it like normal. */
QTextBrowser::setSource(url);
}
}

View File

@ -0,0 +1,54 @@
/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, Matt Edman, Justin Hipple
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************/
/*
** \file helptextbrowser.h
** \version $Id: helptextbrowser.h 2679 2008-06-10 03:07:10Z edmanm $
** \brief Displays an HTML-based help document
*/
#ifndef _HELPTEXTBROWSER_H
#define _HELPTEXTBROWSER_H
#include <QTextBrowser>
#include <QVariant>
class HelpTextBrowser : public QTextBrowser
{
Q_OBJECT
public:
/** Default constructor. */
HelpTextBrowser(QWidget *parent = 0);
/** Loads a resource into the browser. */
QVariant loadResource(int type, const QUrl &name);
public slots:
/** Called when the displayed document is changed. If <b>url</b> specifies
* an external link, then the user will be prompted for whether they want to
* open the link in their default browser or not. */
virtual void setSource(const QUrl &url);
};
#endif

View File

@ -0,0 +1,13 @@
<RCC>
<qresource prefix="/help">
<!-- English -->
<file>en/contents.xml</file>
<file>en/index.html</file>
<file>en/links.html</file>
<!-- German -->
<file>de/contents.xml</file>
<file>de/index.html</file>
<file>de/links.html</file>
</qresource>
</RCC>

View File

@ -0,0 +1,52 @@
<!--
This file is distributed under the following license:
Copyright (c) 2008, defnax
Copyright (c) 2008, Matt Edman, Justin Hipple
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
-->
<!--
The Contents element is the root element in the XML file listing the
available help topics. Available attributes:
id (optional) Short id for the home topic. Defaults to "home"
name The display value shown in the topic listing
html An html file containing the root help page
-->
<!ELEMENT Contents (Topic*)>
<!ATTLIST Contents
id CDATA "home"
name CDATA #REQUIRED
html CDATA #REQUIRED
>
<!--
Every available help topic will have a Topic element. Its attributes are:
id The short id for this help topic
name The display value shown in the topic listing
html An html file containing help information for this topic
section (optional) A section in the html file for this topic, specified
using anchors
-->
<!ELEMENT Topic (Topic*)>
<!ATTLIST Topic
id CDATA #REQUIRED
name CDATA #REQUIRED
html CDATA #REQUIRED
section CDATA #IMPLIED
>

View File

@ -0,0 +1,17 @@
<!--
** $Id: contents.xml 2366 2008-03-01 17:58:23Z edmanm $
**
** This file is part of Vidalia, and is subject to the license terms in the
** LICENSE file, found in the top level directory of this distribution. If
** you did not receive the LICENSE file with this file, you may obtain it
** from the Vidalia source package distributed by the Vidalia Project at
** http://www.vidalia-project.net/. No part of Vidalia, including this file,
** may be copied, modified, propagated, or distributed except according to
** the terms described in the LICENSE file.
-->
<Contents name="RetroShare Hilfe" html="index.html">
<Topic id="links" name="N&#252;tzliche Links" html="links.html"/>
</Contents>

View File

@ -0,0 +1,53 @@
<!--/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, edmanm
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************
-->
<html>
<body>
<h1>RetroShare Hilfe</h1>
<hr />
<p>
W&auml;hlen Sie ein Hilfe-Thema aus der Liste von der linken Seite
oder klicken Sie auf Suche &uuml;ber der Liste um eine Suche durch
alle verf&uuml;gbaren Hilfe-Themen durchzuf&uuml;hren.
</p>
<p>
Sie k&ouml;nnen oben die Schaltfl&auml;che <i>Suchen</i> benutzen,
um innerhalb eines bestimmten Hilfe-Themas zu suchen.
</p>
<p>
Die Schaltfl&auml;che <i>Startseite</i> wird Sie zu dieser Seite
zur&uuml;ck f&uuml;hren.
</p>
<p>
Auf der Seite <a href="links.html">N&uuml;tzliche Links</a> finden Sie
weiterf&uuml;hrende Hilfe und Informationen zu Vidalia und Tor.
</p>
</body>
</html>

View File

@ -0,0 +1,71 @@
<!--/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, djhasis
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************
-->
<html>
<body>
<h1>N&uuml;tzliche Links</h1>
<hr />
<h3>RetroShare</h3>
<table>
<tr>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Homepage</td>
<td>
<a href="http://www.vidalia-project.net/">
http://retroshare.sourceforge.net</a>
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Wiki</td>
<td>
<a href="http://trac.vidalia-project.net/wiki">
http://retroshare.wiki.sourceforge.net/</a>
</td>
</tr>
<tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Project Page</td>
<td>
<a href="http://trac.vidalia-project.net/wiki">
http://sourceforge.net/projects/retroshare/</a>
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Fehlerdatenbank</td>
<td>
<a href="http://trac.vidalia-project.net/report">
http://sourceforge.net/tracker/?group_id=178712&atid=886239</a>
</td>
</tr>
</table>
</body>
</html>

View File

@ -0,0 +1,17 @@
<!--
** $Id: contents.xml 2682 2008-06-10 04:32:48Z edmanm $
**
** This file is part of Vidalia, and is subject to the license terms in the
** LICENSE file, found in the top level directory of this distribution. If
** you did not receive the LICENSE file with this file, you may obtain it
** from the Vidalia source package distributed by the Vidalia Project at
** http://www.vidalia-project.net/. No part of Vidalia, including this file,
** may be copied, modified, propagated, or distributed except according to
** the terms described in the LICENSE file.
-->
<Contents name="RetroShare Help" html="index.html">
<Topic id="links" name="Helpful Links" html="links.html"/>
</Contents>

View File

@ -0,0 +1,51 @@
<!--/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, edmanm
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************
-->
<html>
<body>
<h1>RetroShare Help</h1>
<hr />
<p>
Select a help topic from the tree on the left or click on the Search button
above the list of topics to search through all available help topics.
</p>
<p>
You can use the <i>Find</i> button on the toolbar above to search within a
particular help topic.
</p>
<p>
The <i>Home</i> button above will bring you back to this home page.
</p>
<p>
See the <a href="links.html">Helpful Links</a> topic for some places you
can visit to find additional help and information about Vidalia and Tor.
</p>
</body>
</html>

View File

@ -0,0 +1,70 @@
<!--/****************************************************************
* This file is distributed under the following license:
*
* Copyright (c) 2008, defnax
* Copyright (c) 2008, edmanm
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
****************************************************************
-->
<html>
<body>
<h1>Helpful Links</h1>
<hr />
<h3>RetroShare</h3>
<table>
<tr>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Homepage</td>
<td>
<a href="http://www.vidalia-project.net/">
http://retroshare.sourceforge.net</a>
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Wiki</td>
<td>
<a href="http://trac.vidalia-project.net/wiki">
http://retroshare.wiki.sourceforge.net/</a>
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Project Page</td>
<td>
<a href="http://trac.vidalia-project.net/wiki">
http://sourceforge.net/projects/retroshare/</a>
</td>
</tr>
<tr>
<td>&nbsp;&nbsp;&nbsp;</td>
<td>Bugtracker</td>
<td>
<a href="http://trac.vidalia-project.net/report">
http://sourceforge.net/tracker/?group_id=178712&atid=886239</a>
</td>
</tr>
</table>
</body>
</html>

View File

@ -5,6 +5,7 @@
<file>help/thanks.html</file> <file>help/thanks.html</file>
<file>images/browse-looking.gif</file> <file>images/browse-looking.gif</file>
<file>images/addfriendlabel.png</file> <file>images/addfriendlabel.png</file>
<file>images/back.png</file>
<file>images/backgroundl.png</file> <file>images/backgroundl.png</file>
<file>images/blockdevice.png</file> <file>images/blockdevice.png</file>
<file>images/blockdevice2.png</file> <file>images/blockdevice2.png</file>
@ -31,6 +32,7 @@
<file>images/attachment.png</file> <file>images/attachment.png</file>
<file>images/avatar_background.png</file> <file>images/avatar_background.png</file>
<file>images/backgroundimage.png</file> <file>images/backgroundimage.png</file>
<file>images/button_cancel.png</file>
<file>images/calendar.png</file> <file>images/calendar.png</file>
<file>images/chat.png</file> <file>images/chat.png</file>
<file>images/chat/bar_end.png</file> <file>images/chat/bar_end.png</file>
@ -127,11 +129,14 @@
<file>images/folder_doments.png</file> <file>images/folder_doments.png</file>
<file>images/folder_green.png</file> <file>images/folder_green.png</file>
<file>images/folder_green16.png</file> <file>images/folder_green16.png</file>
<file>images/forward.png</file>
<file>images/friendsfolder24.png</file> <file>images/friendsfolder24.png</file>
<file>images/kgames.png</file> <file>images/kgames.png</file>
<file>images/graph-area.png</file> <file>images/graph-area.png</file>
<file>images/graph-line.png</file> <file>images/graph-line.png</file>
<file>images/groupchat.png</file> <file>images/groupchat.png</file>
<file>images/gohome.png</file>
<file>images/help.png</file>
<file>images/hide_toolbox_frame.png</file> <file>images/hide_toolbox_frame.png</file>
<file>images/highlight.png</file> <file>images/highlight.png</file>
<file>images/hi16-app-ktorrent.png</file> <file>images/hi16-app-ktorrent.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB