diff --git a/retroshare-gui/src/RetroShare.pro b/retroshare-gui/src/RetroShare.pro index 27864b2a9..f61d95832 100644 --- a/retroshare-gui/src/RetroShare.pro +++ b/retroshare-gui/src/RetroShare.pro @@ -30,6 +30,7 @@ DEPENDPATH += . \ gui\common\ gui\Settings \ gui\toaster \ + gui\help\browser \ gui\authdlg \ gui\elastic @@ -130,7 +131,10 @@ HEADERS += rshare.h \ gui/toaster/RetroStyleLabelProxy.h \ gui/common/vmessagebox.h \ gui/common/rwindow.h \ + gui/common/html.h \ gui/MessagesDialog.h \ + gui/help/browser/helpbrowser.h \ + gui/help/browser/helptextbrowser.h \ gui/Settings/gsettingswin.h \ gui/Settings/GeneralPage.h \ gui/Settings/DirectoriesPage.h \ @@ -197,6 +201,7 @@ FORMS += gui/ChatDialog.ui \ gui/SharedFilesDialog.ui \ gui/StatisticDialog.ui \ gui/MessagesDialog.ui \ + gui/help/browser/helpbrowser.ui \ gui/HelpDialog.ui \ gui/bwgraph/bwgraph.ui \ gui/profile/ProfileView.ui \ @@ -286,6 +291,8 @@ SOURCES += main.cpp \ gui/SharedFilesDialog.cpp \ gui/StatisticDialog.cpp \ gui/MessagesDialog.cpp \ + gui/help/browser/helpbrowser.cpp \ + gui/help/browser/helptextbrowser.cpp \ gui/HelpDialog.cpp \ gui/LogoBar.cpp \ gui/xprogressbar.cpp \ @@ -326,7 +333,8 @@ SOURCES += main.cpp \ gui/Preferences/ServerDialog.cpp \ gui/Preferences/ConfirmQuitDialog.cpp \ gui/common/vmessagebox.cpp \ - gui/common/rwindow.cpp \ + gui/common/rwindow.cpp \ + gui/common/html.cpp \ gui/Settings/gsettingswin.cpp \ gui/Settings/GeneralPage.cpp \ gui/Settings/DirectoriesPage.cpp \ @@ -371,7 +379,7 @@ SOURCES += main.cpp \ gui/feeds/SubFileItem.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 += \ lang/retroshare_en.ts \ lang/retroshare_de.ts \ diff --git a/retroshare-gui/src/gui/HelpDialog.ui b/retroshare-gui/src/gui/HelpDialog.ui index 9db7454a6..cc86bea8f 100644 --- a/retroshare-gui/src/gui/HelpDialog.ui +++ b/retroshare-gui/src/gui/HelpDialog.ui @@ -499,22 +499,10 @@ Qt::NoContextMenu - + 0 - - 0 - - - 0 - - - 0 - - - 0 - - + 0 @@ -523,26 +511,22 @@ 0 + + + 0 + 0 + 714 + 451 + + About - + 9 - - 9 - - - 9 - - - 9 - - - 6 - - + 6 @@ -550,7 +534,7 @@ Qt::Horizontal - + 81 20 @@ -561,7 +545,8 @@ - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="http://retroshare.wiki.sourceforge.net/help_tab"><span style=" text-decoration: underline; color:#0000ff;">This Page in the retroshare Wiki</span></a><br /><br />The About/Help Tab is regularly updated from the Wiki page.<br /><br />External Links to more information:<br /></p> @@ -588,17 +573,26 @@ p, li { white-space: pre-wrap; } - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:xx-large; font-weight:600; color:#0000ff;">About RetroShare.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /><span style=" font-weight:600;">Retroshare is a private and secure decentralised commmunication platform.<br />You can use it chat, send messages and share files with your friends.</span><br /><br />This is just a placeholder page for the moment. You can<br />improve retroshare's in-built help (this text) by<br />updating the retroshare wiki: </p></body></html> +</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> +<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;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Retroshare is a private and secure decentralised commmunication platform.<br />You can use it chat, send messages and share files with your friends.</span><br /><br /></p></body></html> + + + 0 + 0 + 714 + 451 + + Authors @@ -606,16 +600,7 @@ p, li { white-space: pre-wrap; } 6 - - 9 - - - 9 - - - 9 - - + 9 @@ -630,7 +615,8 @@ p, li { white-space: pre-wrap; } true - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /><span style=" font-size:19pt; font-weight:600; color:#0000ff;">The RetroShare Team:</span><br /> <br /><span style=" font-size:9pt; color:#0000ff;">defnax</span>: Lead GUI developer <br /><span style=" font-size:9pt; color:#0000ff;">drbob7</span>: Lead Core developer. <br /> <br /><span style=" font-size:9pt; color:#0000ff;">bmeck</span> : Our new web-developer. Joined retroshare a couple <br />of weeks ago, and already starting on an exciting new <br />design for the web-page. <br /> <br /><span style=" font-size:9pt; color:#0000ff;">noragen</span> : Developer from the SIM-IM project. Working on a retroshare plugin to SIM-IM. <br /></p> @@ -656,6 +642,14 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + 714 + 451 + + Thanks to @@ -663,16 +657,7 @@ p, li { white-space: pre-wrap; } 6 - - 9 - - - 9 - - - 9 - - + 9 @@ -687,22 +672,11 @@ p, li { white-space: pre-wrap; } true - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:10pt; font-weight:600;">xEsk</span></p> -<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.</p> -<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; Technology 2008)</p> -<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</p> -<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;"></p> -<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;"><span style=" font-weight:600;">Everaldo Coelho</span></p> -<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;"> <a href="http://www.everaldo.com/"><span style=" text-decoration: underline; color:#0000ff;">http://www.everaldo.com/</span></a></p> -<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;"><a href="http://www.everaldo.com/"><span style=" text-decoration:none; color:#000000;"> Crystal Project icons author </span></a></p> -<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;"> <a href="http://www.kde-look.org/content/show.php/Crystal+Project?content=60475"><span style=" text-decoration: underline; color:#0000ff;">Crystal Project link</span></a></p> -<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;"></p> -<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;"><span style=" font-weight:600; text-decoration:none; color:#000000;">KDE Crystal Diamond Icons</span></p> -<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;"><a href="http://www.kde-look.org/content/show.php/Crystal+Project?content=60475"><span style=" text-decoration:none;"> </span></a><a href="http://www.kde-look.org/content/show.php/Crystal+Project?content=60475">http://www.paolocampitelli.com/kde-icons/</a></p> -<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;"></p></body></html> +<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;"></p></body></html> false @@ -715,6 +689,14 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + 714 + 451 + + Translation @@ -722,16 +704,7 @@ p, li { white-space: pre-wrap; } 6 - - 9 - - - 9 - - - 9 - - + 9 @@ -743,7 +716,8 @@ p, li { white-space: pre-wrap; } true - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Translators:</span></p> @@ -764,6 +738,14 @@ p, li { white-space: pre-wrap; } + + + 0 + 0 + 714 + 451 + + License Agreement @@ -771,16 +753,7 @@ p, li { white-space: pre-wrap; } 6 - - 9 - - - 9 - - - 9 - - + 9 @@ -805,22 +778,10 @@ p, li { white-space: pre-wrap; } - + 0 - - 0 - - - 0 - - - 0 - - - 0 - - + 0 @@ -828,7 +789,7 @@ p, li { white-space: pre-wrap; } Qt::Horizontal - + 40 20 @@ -838,22 +799,10 @@ p, li { white-space: pre-wrap; } - + 0 - - 0 - - - 0 - - - 0 - - - 6 - - + 6 @@ -869,10 +818,11 @@ p, li { white-space: pre-wrap; } - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal; text-decoration:none;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; font-weight:600;">About/Help</span></p></body></html> +</style></head><body style=" font-family:'Arial'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:9pt; font-weight:600;">About RetroShare</span></p></body></html> @@ -887,7 +837,6 @@ p, li { white-space: pre-wrap; } authors license tabWidget - thanks textBrowser diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 990106c48..9a41ec2c8 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -89,7 +89,7 @@ #define IMAGE_UNFINISHED ":/images/underconstruction.png" #define IMAGE_MINIMIZE ":/images/window_nofullscreen.png" #define IMAGE_MAXIMIZE ":/images/window_fullscreen.png" - +#define IMG_HELP ":/images/help.png" /* Keys for UI Preferences */ #define UI_PREF_PROMPT_ON_QUIT "UIOptions/ConfirmOnQuit" @@ -297,6 +297,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags) #endif menu->addAction(_prefsAct); menu->addAction(_smplayerAct); + menu->addAction(_helpAct); menu->addSeparator(); menu->addAction(QIcon(IMAGE_MINIMIZE), tr("Minimize"), this, SLOT(showMinimized())); menu->addAction(QIcon(IMAGE_MAXIMIZE), tr("Maximize"), this, SLOT(showMaximized())); @@ -519,6 +520,9 @@ void MainWindow::createActions() _smplayerAct = new QAction(QIcon(IMAGE_SMPLAYER), tr("SMPlayer"), this); 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))); @@ -711,6 +715,23 @@ void MainWindow::showabout() 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 topic. */ +void MainWindow::showHelpDialog(const QString &topic) +{ + static HelpBrowser *helpBrowser = 0; + if (!helpBrowser) + helpBrowser = new HelpBrowser(this); + helpBrowser->showWindow(topic); +} + void MainWindow::setStyle() { QString standardSheet = "{background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,stop:0 , stop:1 );}"; diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index cb4958da1..eaf7106bb 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -42,6 +42,7 @@ #include "Preferences/PreferencesWindow.h" #include "Settings/gsettingswin.h" #include "bwgraph/bwgraph.h" +#include "help/browser/helpbrowser.h" #include "games/qbackgammon/bgwindow.h" #include "toplevel.h" @@ -132,6 +133,12 @@ private slots: void showApplWindow(); void showsmplayer(); 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 topic. */ + void showHelpDialog(const QString &topic); void showSettings(); @@ -169,6 +176,7 @@ private: QAction* _bandwidthAct; QAction* _messengerwindowAct; QAction* _smplayerAct; + QAction* _helpAct; /** A BandwidthGraph object which handles monitoring RetroShare bandwidth usage */ BandwidthGraph* _bandwidthGraph; diff --git a/retroshare-gui/src/gui/common/html.cpp b/retroshare-gui/src/gui/common/html.cpp new file mode 100644 index 000000000..4f1772e15 --- /dev/null +++ b/retroshare-gui/src/gui/common/html.cpp @@ -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 "

" tags, converts "\n" to "
" and converts "\n\n" + * to a new paragraph. */ +QString +p(QString str) +{ + str = "

" + str + "

"; + str.replace("\n\n", "

"); + str.replace("\n", "
"); + return str; +} + +/** Wraps a string in "" tags. */ +QString +i(QString str) +{ + return QString("%1").arg(str); +} + +/** Wraps a string in "" tags. */ +QString +b(QString str) +{ + return QString("%1").arg(str); +} + +/** Wraps a string in "" tags. */ +QString +trow(QString str) +{ + return QString("%1").arg(str); +} + +/** Wraps a string in "" tags. */ +QString +tcol(QString str) +{ + return QString("%1").arg(str); +} + +/** Wraps a string in "" tags. */ +QString +thead(QString str) +{ + return QString("%1").arg(str); +} + +/** Escapes "<" and ">" characters in the given string. */ +QString +escape(QString str) +{ + str.replace("<", "<"); + str.replace(">", ">"); + return str; +} + diff --git a/retroshare-gui/src/gui/common/html.h b/retroshare-gui/src/gui/common/html.h new file mode 100644 index 000000000..9eb4ca9bc --- /dev/null +++ b/retroshare-gui/src/gui/common/html.h @@ -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 + + +/** Wraps a string in "

" tags, converts "\n" to "
" and converts "\n\n" + * to a new paragraph. */ +QString p(QString str); + +/** Wraps a string in "" tags. */ +QString i(QString str); + +/** Wraps a string in "" tags. */ +QString b(QString str); + +/** Wraps a string in "" tags. */ +QString trow(QString str); + +/** Wraps a string in "" tags. */ +QString tcol(QString str); + +/** Wraps a string in "" tags. */ +QString thead(QString str); + +/** Escapes "<" and ">" characters in a string, for html. */ +QString escape(QString str); + +#endif + diff --git a/retroshare-gui/src/gui/common/vmessagebox.cpp b/retroshare-gui/src/gui/common/vmessagebox.cpp index aa2314c66..933310acd 100644 --- a/retroshare-gui/src/gui/common/vmessagebox.cpp +++ b/retroshare-gui/src/gui/common/vmessagebox.cpp @@ -1,8 +1,8 @@ /**************************************************************** * This file is distributed under the following license: * - * Copyright (c) 2006-2007, crypton - * Copyright (c) 2006, Matt Edman, Justin Hipple + * 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 @@ -20,11 +20,13 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ -/** - * \file vmessagebox.cpp - * \version $Id: vmessagebox.cpp 990 2006-06-08 03:31:27Z edmanm $ - */ +/* +** \file vmessagebox.cpp +** \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" @@ -70,11 +72,11 @@ int VMessageBox::selected(int ret, int button0, int button1, int button2) { if (ret == 0) { - return button0; + return (button0 & QMessageBox::ButtonMask); } 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. */ @@ -92,6 +94,9 @@ VMessageBox::buttonText(int btn) case Retry: text = tr("Retry"); break; case ShowLog: text = tr("Show Log"); 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; } return text; @@ -105,7 +110,7 @@ int VMessageBox::critical(QWidget *parent, QString caption, QString text, 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(button1), VMessageBox::buttonText(button2), @@ -122,7 +127,7 @@ int VMessageBox::question(QWidget *parent, QString caption, QString text, 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(button1), VMessageBox::buttonText(button2), @@ -139,7 +144,7 @@ int VMessageBox::information(QWidget *parent, QString caption, QString text, 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(button1), VMessageBox::buttonText(button2), @@ -156,7 +161,7 @@ int VMessageBox::warning(QWidget *parent, QString caption, QString text, 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(button1), VMessageBox::buttonText(button2), diff --git a/retroshare-gui/src/gui/common/vmessagebox.h b/retroshare-gui/src/gui/common/vmessagebox.h index aaf706914..4a5b307ec 100644 --- a/retroshare-gui/src/gui/common/vmessagebox.h +++ b/retroshare-gui/src/gui/common/vmessagebox.h @@ -1,8 +1,8 @@ /**************************************************************** * This file is distributed under the following license: * - * Copyright (c) 2006-2007, crypton - * Copyright (c) 2006, Matt Edman, Justin Hipple + * 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 @@ -20,10 +20,11 @@ * Boston, MA 02110-1301, USA. ****************************************************************/ -/** - * \file vmessagebox.h - * \version $Id: vmessagebox.h 990 2006-06-08 03:31:27Z edmanm $ - */ +/* +** \file vmessagebox.h +** \version $Id: vmessagebox.h 2362 2008-02-29 04:30:11Z edmanm $ +** \brief Provides a custom Vidalia mesage box +*/ #ifndef _VMESSAGEBOX_H #define _VMESSAGEBOX_H @@ -46,7 +47,10 @@ public: Help, Retry, ShowLog, - ShowSettings + ShowSettings, + Continue, + Quit, + Browse }; /** Default constructor. */ diff --git a/retroshare-gui/src/gui/help/browser/helpbrowser.cpp b/retroshare-gui/src/gui/help/browser/helpbrowser.cpp new file mode 100644 index 000000000..934b0ba7a --- /dev/null +++ b/retroshare-gui/src/gui/help/browser/helpbrowser.cpp @@ -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 +#include +#include +#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 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 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 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); + } +} + diff --git a/retroshare-gui/src/gui/help/browser/helpbrowser.h b/retroshare-gui/src/gui/help/browser/helpbrowser.h new file mode 100644 index 000000000..97ccc0c08 --- /dev/null +++ b/retroshare-gui/src/gui/help/browser/helpbrowser.h @@ -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 +#include +#include +#include +#include +#include +#include +#include +#include + +#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 _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 + diff --git a/retroshare-gui/src/gui/help/browser/helpbrowser.ui b/retroshare-gui/src/gui/help/browser/helpbrowser.ui new file mode 100644 index 000000000..6706907d8 --- /dev/null +++ b/retroshare-gui/src/gui/help/browser/helpbrowser.ui @@ -0,0 +1,720 @@ + + HelpBrowser + + + + 0 + 0 + 703 + 583 + + + + + 0 + 0 + + + + + 0 + 0 + + + + Qt::NoContextMenu + + + RetroShare Help + + + + :/images/help.png:/images/help.png + + + + + + true + + + Qt::ToolButtonTextUnderIcon + + + + + 0 + 52 + 703 + 510 + + + + + 6 + + + 9 + + + + + + 0 + 0 + + + + + 450 + 79 + + + + + 16777215 + 79 + + + + Qt::NoContextMenu + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 9 + + + 6 + + + + + 6 + + + 0 + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 24 + 24 + + + + Qt::NoContextMenu + + + + + + + :/images/button_cancel.png:/images/button_cancel.png + + + + 22 + 22 + + + + Qt::ToolButtonIconOnly + + + true + + + + + + + Qt::NoContextMenu + + + Find: + + + lineFind + + + + + + + Qt::NoContextMenu + + + + + + + + + Qt::NoContextMenu + + + Find Previous + + + + :/images/22x22/go-up-search.png:/images/22x22/go-up-search.png + + + + + + + Qt::NoContextMenu + + + Find Next + + + + :/images/22x22/go-down-search.png:/images/22x22/go-down-search.png + + + + + + + 6 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::NoContextMenu + + + Case sensitive + + + + + + + Qt::NoContextMenu + + + Whole words only + + + + + + + + + + + + Qt::NoContextMenu + + + Qt::Horizontal + + + + Qt::NoContextMenu + + + QTabWidget::North + + + QTabWidget::Rounded + + + 0 + + + + + 0 + 0 + 268 + 380 + + + + RetroShare Help + + + + :/images/help.png:/images/help.png + + + Contents + + + + 6 + + + 6 + + + + + + 1 + 0 + + + + + 200 + 0 + + + + + 16777215 + 16777215 + + + + Qt::WheelFocus + + + Qt::NoContextMenu + + + QAbstractItemView::SelectItems + + + true + + + + Help Topics + + + + + + + + + + 4 + 23 + 268 + 380 + + + + Search + + + + 6 + + + 6 + + + + + 6 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::NoContextMenu + + + Search + + + + + + + + + Qt::NoContextMenu + + + Searching for: + + + lineSearch + + + + + + + + 1 + 0 + + + + + 200 + 0 + + + + + 16777215 + 16777215 + + + + Qt::WheelFocus + + + Qt::NoContextMenu + + + QAbstractItemView::SelectItems + + + true + + + + Found Documents + + + + + + + + Qt::NoContextMenu + + + + + + + + + + 100 + 0 + + + + Qt::NoContextMenu + + + true + + + + + + + + + + 0 + 562 + 703 + 21 + + + + + + + 0 + 0 + 703 + 52 + + + + + 0 + 0 + + + + Qt::NoContextMenu + + + false + + + Qt::Horizontal + + + Qt::ToolButtonTextUnderIcon + + + TopToolBarArea + + + false + + + + + + + + + + + + :/images/back.png:/images/back.png + + + Back + + + Move to previous page (Backspace) + + + Backspace + + + + + + :/images/forward.png:/images/forward.png + + + Forward + + + Move to next page (Shift+Backspace) + + + Shift+Backspace + + + + + + :/images/gohome.png:/images/gohome.png + + + Home + + + Move to the Home page (Ctrl+H) + + + Ctrl+H + + + + + true + + + + :/images/find.png:/images/find.png + + + Find + + + Find + + + Find + + + Search for a word or phrase on current page (Ctrl+F) + + + Ctrl+F + + + + + + :/images/exit_24x24.png:/images/exit_24x24.png + + + Close + + + Close Vidalia Help + + + Esc + + + + + + HelpTextBrowser + QTextBrowser +

gui/help/browser/helptextbrowser.h
+ + + + tabsMenu + btnCloseFind + lineFind + btnFindNext + btnFindPrev + chkbxMatchCase + chkbxWholePhrase + treeContents + txtBrowser + lineSearch + btnSearch + treeSearch + + + + + + + actionFind + triggered() + lineFind + setFocus() + + + -1 + -1 + + + 200 + 108 + + + + + btnCloseFind + clicked() + actionFind + toggle() + + + 34 + 107 + + + -1 + -1 + + + + + actionFind + toggled(bool) + frmFind + setVisible(bool) + + + -1 + -1 + + + 243 + 108 + + + + + actionClose + triggered() + HelpBrowser + close() + + + -1 + -1 + + + 317 + 248 + + + + + lineFind + returnPressed() + btnFindNext + click() + + + 293 + 108 + + + 539 + 108 + + + + + lineSearch + returnPressed() + btnSearch + click() + + + 153 + 245 + + + 244 + 277 + + + + + diff --git a/retroshare-gui/src/gui/help/browser/helptextbrowser.cpp b/retroshare-gui/src/gui/help/browser/helptextbrowser.cpp new file mode 100644 index 000000000..acca126a4 --- /dev/null +++ b/retroshare-gui/src/gui/help/browser/helptextbrowser.cpp @@ -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 +#include +#include +#include "gui/common/vmessagebox.h" +#include "gui/common/html.h" +#include + +#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 url 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); + } +} + diff --git a/retroshare-gui/src/gui/help/browser/helptextbrowser.h b/retroshare-gui/src/gui/help/browser/helptextbrowser.h new file mode 100644 index 000000000..320297ba9 --- /dev/null +++ b/retroshare-gui/src/gui/help/browser/helptextbrowser.h @@ -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 +#include + + +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 url 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 + diff --git a/retroshare-gui/src/gui/help/content/content.qrc b/retroshare-gui/src/gui/help/content/content.qrc new file mode 100644 index 000000000..33d4e9b01 --- /dev/null +++ b/retroshare-gui/src/gui/help/content/content.qrc @@ -0,0 +1,13 @@ + + + + en/contents.xml + en/index.html + en/links.html + + de/contents.xml + de/index.html + de/links.html + + + diff --git a/retroshare-gui/src/gui/help/content/contents.dtd b/retroshare-gui/src/gui/help/content/contents.dtd new file mode 100644 index 000000000..5da21e94e --- /dev/null +++ b/retroshare-gui/src/gui/help/content/contents.dtd @@ -0,0 +1,52 @@ + + + + + + + + + + diff --git a/retroshare-gui/src/gui/help/content/de/contents.xml b/retroshare-gui/src/gui/help/content/de/contents.xml new file mode 100644 index 000000000..9b666cc82 --- /dev/null +++ b/retroshare-gui/src/gui/help/content/de/contents.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/retroshare-gui/src/gui/help/content/de/index.html b/retroshare-gui/src/gui/help/content/de/index.html new file mode 100644 index 000000000..d250b07b1 --- /dev/null +++ b/retroshare-gui/src/gui/help/content/de/index.html @@ -0,0 +1,53 @@ + + + + + +

RetroShare Hilfe

+
+ +

+Wählen Sie ein Hilfe-Thema aus der Liste von der linken Seite +oder klicken Sie auf Suche über der Liste um eine Suche durch +alle verfügbaren Hilfe-Themen durchzuführen. +

+ +

+Sie können oben die Schaltfläche Suchen benutzen, +um innerhalb eines bestimmten Hilfe-Themas zu suchen. +

+ +

+Die Schaltfläche Startseite wird Sie zu dieser Seite +zurück führen. +

+ +

+Auf der Seite Nützliche Links finden Sie +weiterführende Hilfe und Informationen zu Vidalia und Tor. +

+ + + + diff --git a/retroshare-gui/src/gui/help/content/de/links.html b/retroshare-gui/src/gui/help/content/de/links.html new file mode 100644 index 000000000..b08280db7 --- /dev/null +++ b/retroshare-gui/src/gui/help/content/de/links.html @@ -0,0 +1,71 @@ + + + + + +

Nützliche Links

+
+ +

RetroShare

+ + + + + + + + + + + + + + + + + + + + + + +
   Homepage + + http://retroshare.sourceforge.net +
   Wiki + + http://retroshare.wiki.sourceforge.net/ +
   Project Page + + http://sourceforge.net/projects/retroshare/ +
   Fehlerdatenbank + + http://sourceforge.net/tracker/?group_id=178712&atid=886239 +
+ + + + + + diff --git a/retroshare-gui/src/gui/help/content/en/contents.xml b/retroshare-gui/src/gui/help/content/en/contents.xml new file mode 100644 index 000000000..3e2946151 --- /dev/null +++ b/retroshare-gui/src/gui/help/content/en/contents.xml @@ -0,0 +1,17 @@ + + + + + + + diff --git a/retroshare-gui/src/gui/help/content/en/index.html b/retroshare-gui/src/gui/help/content/en/index.html new file mode 100644 index 000000000..54edca521 --- /dev/null +++ b/retroshare-gui/src/gui/help/content/en/index.html @@ -0,0 +1,51 @@ + + + + + +

RetroShare Help

+
+ +

+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. +

+ +

+You can use the Find button on the toolbar above to search within a +particular help topic. +

+ +

+The Home button above will bring you back to this home page. +

+ +

+See the Helpful Links topic for some places you +can visit to find additional help and information about Vidalia and Tor. +

+ + + + diff --git a/retroshare-gui/src/gui/help/content/en/links.html b/retroshare-gui/src/gui/help/content/en/links.html new file mode 100644 index 000000000..c6f65aee1 --- /dev/null +++ b/retroshare-gui/src/gui/help/content/en/links.html @@ -0,0 +1,70 @@ + + + + + +

Helpful Links

+
+ +

RetroShare

+ + + + + + + + + + + + + + + + + + + + + +
   Homepage + + http://retroshare.sourceforge.net +
   Wiki + + http://retroshare.wiki.sourceforge.net/ +
   Project Page + + http://sourceforge.net/projects/retroshare/ +
   Bugtracker + + http://sourceforge.net/tracker/?group_id=178712&atid=886239 +
+ + + + + + diff --git a/retroshare-gui/src/gui/images.qrc b/retroshare-gui/src/gui/images.qrc index 248ef5d9c..c2331b6b6 100644 --- a/retroshare-gui/src/gui/images.qrc +++ b/retroshare-gui/src/gui/images.qrc @@ -5,6 +5,7 @@ help/thanks.html images/browse-looking.gif images/addfriendlabel.png + images/back.png images/backgroundl.png images/blockdevice.png images/blockdevice2.png @@ -31,6 +32,7 @@ images/attachment.png images/avatar_background.png images/backgroundimage.png + images/button_cancel.png images/calendar.png images/chat.png images/chat/bar_end.png @@ -127,11 +129,14 @@ images/folder_doments.png images/folder_green.png images/folder_green16.png + images/forward.png images/friendsfolder24.png images/kgames.png images/graph-area.png images/graph-line.png images/groupchat.png + images/gohome.png + images/help.png images/hide_toolbox_frame.png images/highlight.png images/hi16-app-ktorrent.png diff --git a/retroshare-gui/src/gui/images/back.png b/retroshare-gui/src/gui/images/back.png new file mode 100644 index 000000000..78dcc7011 Binary files /dev/null and b/retroshare-gui/src/gui/images/back.png differ diff --git a/retroshare-gui/src/gui/images/button_cancel.png b/retroshare-gui/src/gui/images/button_cancel.png new file mode 100644 index 000000000..3f0c98b7d Binary files /dev/null and b/retroshare-gui/src/gui/images/button_cancel.png differ diff --git a/retroshare-gui/src/gui/images/forward.png b/retroshare-gui/src/gui/images/forward.png new file mode 100644 index 000000000..a7d90d558 Binary files /dev/null and b/retroshare-gui/src/gui/images/forward.png differ diff --git a/retroshare-gui/src/gui/images/friendsfolder24.png b/retroshare-gui/src/gui/images/friendsfolder24.png new file mode 100644 index 000000000..107e8e70b Binary files /dev/null and b/retroshare-gui/src/gui/images/friendsfolder24.png differ diff --git a/retroshare-gui/src/gui/images/gohome.png b/retroshare-gui/src/gui/images/gohome.png new file mode 100644 index 000000000..6c45397e4 Binary files /dev/null and b/retroshare-gui/src/gui/images/gohome.png differ diff --git a/retroshare-gui/src/gui/images/help.png b/retroshare-gui/src/gui/images/help.png new file mode 100644 index 000000000..9f0c92f23 Binary files /dev/null and b/retroshare-gui/src/gui/images/help.png differ