added Help Button to Preferences Window

added basic config.html(Configuring RetroShare) page to Help Dialog, needs more Input.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@682 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-08-14 10:38:27 +00:00
parent f0737c315e
commit 4789209ab5
8 changed files with 183 additions and 30 deletions

View File

@ -38,7 +38,7 @@
#define IMAGE_LOG ":/images/log_24x24.png" #define IMAGE_LOG ":/images/log_24x24.png"
#define IMAGE_ABOUT ":/images/informations_24x24.png" #define IMAGE_ABOUT ":/images/informations_24x24.png"
#define IMAGE_SAVE ":/images/media-floppy.png" #define IMAGE_SAVE ":/images/media-floppy.png"
#define IMAGE_HELP ":/images/help24.png"
/** Constructor */ /** Constructor */
PreferencesWindow::PreferencesWindow(QWidget *parent, Qt::WFlags flags) PreferencesWindow::PreferencesWindow(QWidget *parent, Qt::WFlags flags)
@ -56,23 +56,16 @@ PreferencesWindow::PreferencesWindow(QWidget *parent, Qt::WFlags flags)
createPageAction(QIcon(IMAGE_SERVER), tr("Server"), grp)); createPageAction(QIcon(IMAGE_SERVER), tr("Server"), grp));
ui.stackPages->add(new DirectoriesDialog(ui.stackPages), ui.stackPages->add(new DirectoriesDialog(ui.stackPages),
createPageAction(QIcon(IMAGE_DIRECTORIES), tr("Directories"), grp)); createPageAction(QIcon(IMAGE_DIRECTORIES), tr("Directories"), grp));
//ui.stackPages->add(new CryptographyDialog(ui.stackPages),
// createPageAction(QIcon(IMAGE_CRYPTOGRAPHY), tr("Cryptography"), grp));
//ui.stackPages->add(new LogDialog(ui.stackPages),
// createPageAction(QIcon(IMAGE_ABOUT), tr("About"), grp));
/* Create the toolbar */ /* Create the toolbar */
ui.toolBar->addActions(grp->actions()); ui.toolBar->addActions(grp->actions());
ui.toolBar->addSeparator(); ui.toolBar->addSeparator();
connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *))); connect(grp, SIGNAL(triggered(QAction *)), ui.stackPages, SLOT(showPage(QAction *)));
/* Create and bind the Save button */ /* Create and bind the Help button */
//addAction(new QAction(QIcon(IMAGE_SAVE), tr("Save"), ui.toolBar), QAction *helpAct = new QAction(QIcon(IMAGE_HELP), tr("Help"), ui.toolBar);
// SLOT(saveChanges())); addAction(helpAct, SLOT(showHelp()));
/* Select the first action */ /* Select the first action */
grp->actions()[0]->setChecked(true); grp->actions()[0]->setChecked(true);
@ -80,6 +73,12 @@ PreferencesWindow::PreferencesWindow(QWidget *parent, Qt::WFlags flags)
connect(ui.okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) ); connect(ui.okButton, SIGNAL(clicked( bool )), this, SLOT( saveChanges()) );
connect(ui.cancelprefButton, SIGNAL(clicked( bool )), this, SLOT( cancelpreferences()) ); connect(ui.cancelprefButton, SIGNAL(clicked( bool )), this, SLOT( cancelpreferences()) );
#if defined(Q_WS_WIN)
helpAct->setShortcut(QString("F1"));
#else
helpAct->setShortcut(QString("Ctrl+?"));
#endif
} }
@ -178,13 +177,59 @@ PreferencesWindow::cancelpreferences()
QMainWindow::close(); QMainWindow::close();
} }
void PreferencesWindow::closeEvent (QCloseEvent * event) void
PreferencesWindow::closeEvent (QCloseEvent * event)
{ {
hide(); hide();
event->ignore(); event->ignore();
} }
/** Displays the help browser and displays the most recently viewed help
* topic. */
void
PreferencesWindow::showHelp()
{
showHelp(QString());
}
/**< Shows the help browser and displays the given help <b>topic</b>. */
void
PreferencesWindow::showHelp(const QString &topic)
{
static HelpBrowser *helpBrowser = 0;
if (!helpBrowser)
helpBrowser = new HelpBrowser(this);
helpBrowser->showWindow(topic);
}
/** Shows help information for whichever settings page the user is currently
* viewing. */
/*void
PreferencesWindow::help()
{
Page currentPage = static_cast<Page>(ui.stackPages->currentIndex());
switch (currentPage) {
case General:
help("config.general"); break;
case Server:
help("server"); break;
case Directories:
help("config.server"); break;
default:
help("config.general"); break;
}
}*/
/** Called when a ConfigPage in the dialog requests help on a specific
* <b>topic</b>. */
/*void
PreferencesWindow::help(const QString &topic)
{
emit helpRequested(topic);
}*/

View File

@ -25,12 +25,12 @@
#include <QMainWindow> #include <QMainWindow>
#include <QFileDialog> #include <QFileDialog>
#include "GeneralDialog.h" #include "GeneralDialog.h"
#include "DirectoriesDialog.h" #include "DirectoriesDialog.h"
#include "ServerDialog.h" #include "ServerDialog.h"
#include "CryptographyDialog.h" #include "CryptographyDialog.h"
#include "LogDialog.h" #include "LogDialog.h"
#include "gui/help/browser/helpbrowser.h"
@ -57,29 +57,42 @@ public:
//~PreferencesWindow(); //~PreferencesWindow();
protected: protected:
void closeEvent (QCloseEvent * event); void closeEvent (QCloseEvent * event);
public slots: public slots:
/** Called when this dialog is to be displayed */ /** Called when this dialog is to be displayed */
void show(); void show();
/** Shows the config dialog with focus set to the given page. */ /** Shows the config dialog with focus set to the given page. */
void show(Page page); void show(Page page);
private slots: private slots:
/** Called when user clicks "Save Settings" */ /** Called when user clicks "Save Settings" */
void saveChanges(); void saveChanges();
/**void preferences();*/ /**void preferences();*/
void cancelpreferences(); void cancelpreferences();
/** Called when a ConfigPage in the dialog requests help on a specific
* <b>topic</b>. */
//void help(const QString &topic);
/** Shows general help information for whichever settings page the user is
* currently viewing. */
//void help();
/** Displays the help browser and displays the most recently viewed help
* topic. */
void showHelp();
/** Called when a child window requests the given help <b>topic</b>. */
void showHelp(const QString &topic);
private: private:
/** Loads the current configuration settings */ /** Loads the current configuration settings */
void loadSettings(); void loadSettings();
/** Creates a new action for a config page. */ /** Creates a new action for a config page. */
QAction* createPageAction(QIcon img, QString text, QActionGroup *group); QAction* createPageAction(QIcon img, QString text, QActionGroup *group);
/** Adds a new action to the toolbar. */ /** Adds a new action to the toolbar. */
void addAction(QAction *action, const char *slot = 0); void addAction(QAction *action, const char *slot = 0);
/** Qt Designer generated object */ /** Qt Designer generated object */
Ui::PreferencesWindow ui; Ui::PreferencesWindow ui;

View File

@ -60,6 +60,11 @@ public slots:
/** Show this window. This method really just exists for subclasses to /** Show this window. This method really just exists for subclasses to
* override, since QMainWindow::show() is non-virtual. */ * override, since QMainWindow::show() is non-virtual. */
virtual void showWindow() { QMainWindow::show(); } virtual void showWindow() { QMainWindow::show(); }
signals:
/** Emitted when a RWindow requests help information on the specified
* <b>topic</b>. */
void helpRequested(const QString &topic);
private: private:
QString _name; /**< Name associated with this window. */ QString _name; /**< Name associated with this window. */

View File

@ -3,6 +3,7 @@
<!-- English --> <!-- English -->
<file>en/contents.xml</file> <file>en/contents.xml</file>
<file>en/index.html</file> <file>en/index.html</file>
<file>en/config.html</file>
<file>en/links.html</file> <file>en/links.html</file>
<!-- German --> <!-- German -->
<file>de/contents.xml</file> <file>de/contents.xml</file>

View File

@ -0,0 +1,84 @@
<!--/****************************************************************
* 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>Configuring RetroShare</h1>
<hr />
<p>
RetroShare allows you to configure some of the most commonly modified aspects of
RetroShare.
</p>
<a name="general"/>
<h3>General Settings</h3>
<p>
The settings on the <i>General</i> page allow you to customize the
look and feel of Vidalia.
</p>
<ul>
<li><b>Language</b>:
RetroShare's interface has been translated into many languages by helpful
volunteers. When RetroShare is first run, it will try to guess which language
your computer is currently using. If RetroShare guesses incorrectly, or if
you prefer a different language, you can choose another language from the
dropdown box. You will need to restart RetroShare after changing the
displayed language for the changes to take effect.
</li>
<li><b>Style</b>:
In most cases, RetroShare will default to using your platform's default
interface style. If you dislike the default, you can choose whichever
interface style you prefer from the dropdown box.
</li>
<li><b>Style Sheet</b>:
RetroShare will default to using default style sheet.
If you dislike the default, you can choose whichever
style sheet you prefer from the dropdown box.
</li>
</ul>
<a name="server"/>
<h3>Server Settings</h3>
<p>
The <i>Server</i> settings page lets you change how RetroShare connects to the RetroShare
network.
</p>
<ul>
</ul>
<a name="directories"/>
<h3>Directories Settings</h3>
<p>
<i>
The <i>Directories</i> settings page lets you add and remove Shared Directories and can set a Incoming Directorie.
</i>
</p>
</body>
</html>

View File

@ -11,7 +11,11 @@
--> -->
<Contents name="RetroShare Help" html="index.html"> <Contents name="RetroShare Help" html="index.html">
<Topic id="config" name="Configuring RetroShare" html="config.html">
<Topic id="general" name="General Settings" html="config.html" section="general"/>
<Topic id="server" name="Server Settings" html="config.html" section="server"/>
<Topic id="directories" name="Directories Settings" html="config.html" section="directories"/>
</Topic>
<Topic id="links" name="Helpful Links" html="links.html"/> <Topic id="links" name="Helpful Links" html="links.html"/>
</Contents> </Contents>

View File

@ -150,6 +150,7 @@
<file>images/groupchat.png</file> <file>images/groupchat.png</file>
<file>images/gohome.png</file> <file>images/gohome.png</file>
<file>images/help.png</file> <file>images/help.png</file>
<file>images/help24.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.5 KiB