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

@ -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:
*
* 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),

View file

@ -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. */