From 2a5551f3f65bbcc2cc329bb6678830f9f81403b9 Mon Sep 17 00:00:00 2001 From: Oliver Bock <oliver.bock@aei.mpg.de> Date: Fri, 6 Feb 2009 20:41:16 +0100 Subject: [PATCH] Added help dialog using per-language HTML file resources (for offline availability) --- pulsatingscience.pro | 13 ++++-- src/pulsatingscience.cpp | 6 +++ src/pulsatingscience.h | 3 ++ src/pulsatingsciencehelp.cpp | 35 ++++++++++++++ src/pulsatingsciencehelp.h | 40 ++++++++++++++++ src/pulsatingsciencehelp.qrc | 9 ++++ src/pulsatingsciencehelp.ui | 88 ++++++++++++++++++++++++++++++++++++ src/resources/help_de.html | 6 +++ src/resources/help_en.html | 6 +++ 9 files changed, 202 insertions(+), 4 deletions(-) create mode 100644 src/pulsatingsciencehelp.cpp create mode 100644 src/pulsatingsciencehelp.h create mode 100644 src/pulsatingsciencehelp.qrc create mode 100644 src/pulsatingsciencehelp.ui create mode 100644 src/resources/help_de.html create mode 100644 src/resources/help_en.html diff --git a/pulsatingscience.pro b/pulsatingscience.pro index cadfd70..dafb5c4 100644 --- a/pulsatingscience.pro +++ b/pulsatingscience.pro @@ -21,16 +21,21 @@ TEMPLATE = app TARGET = PulsatingScience QT += core \ gui \ - opengl + opengl \ + webkit HEADERS += src/pulsaranimationwidget.h \ src/pulsescopewidget.h \ - src/pulsatingscience.h + src/pulsatingscience.h \ + src/pulsatingsciencehelp.h SOURCES += src/pulsaranimationwidget.cpp \ src/pulsescopewidget.cpp \ src/pulsatingscience.cpp \ + src/pulsatingsciencehelp.cpp \ src/main.cpp -FORMS += src/pulsatingscience.ui -RESOURCES += src/pulsatingscience.qrc +FORMS += src/pulsatingscience.ui \ + src/pulsatingsciencehelp.ui +RESOURCES += src/pulsatingscience.qrc \ + src/pulsatingsciencehelp.qrc TS_DIR = src/resources TRANSLATIONS = src/resources/pulsatingscience_de.ts UI_DIR = src/.ui diff --git a/src/pulsatingscience.cpp b/src/pulsatingscience.cpp index 7a74405..030e4a1 100644 --- a/src/pulsatingscience.cpp +++ b/src/pulsatingscience.cpp @@ -388,6 +388,12 @@ void PulsatingScience::on_dockAnimControl_topLevelChanged(bool topLevel) { m_animControlFloating = topLevel; } +void PulsatingScience::on_actionHelp_activated() +{ + PulsatingScienceHelp help(this); + help.exec(); +} + void PulsatingScience::on_actionWebsite_activated() { QDesktopServices::openUrl(QUrl("http://www.aei.mpg.de")); diff --git a/src/pulsatingscience.h b/src/pulsatingscience.h index 9444006..fff74d9 100644 --- a/src/pulsatingscience.h +++ b/src/pulsatingscience.h @@ -27,6 +27,8 @@ #include <QDesktopServices> #include <QUrl> +#include "pulsatingsciencehelp.h" + #include "ui_pulsatingscience.h" @@ -66,6 +68,7 @@ public slots: void on_dockAnimControl_visibilityChanged(bool visible); void on_dockAnimControl_topLevelChanged(bool topLevel); + void on_actionHelp_activated(); void on_actionWebsite_activated(); void on_actionAbout_activated(); diff --git a/src/pulsatingsciencehelp.cpp b/src/pulsatingsciencehelp.cpp new file mode 100644 index 0000000..c38f3bb --- /dev/null +++ b/src/pulsatingsciencehelp.cpp @@ -0,0 +1,35 @@ +/****************************************************************************** + * Copyright (C) 2009 by Oliver Bock * + * oliver.bock[AT]aei.mpg.de * + * * + * This file is part of PulsatingScience. * + * * + * PulsatingScience 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, version 3 of the License. * + * * + * PulsatingScience 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 PulsatingScience. If not, see <http://www.gnu.org/licenses/>. * + * * + ******************************************************************************/ + +#include "pulsatingsciencehelp.h" + +PulsatingScienceHelp::PulsatingScienceHelp(QWidget *parent) : QDialog(parent), Ui::PulsatingScienceHelp() +{ + setupUi(this); + + if(QLocale::system().language() == QLocale::German) { + webView->setUrl(QUrl("qrc:/content/resources/help_de.html")); + } +} + +PulsatingScienceHelp::~PulsatingScienceHelp() +{ + +} diff --git a/src/pulsatingsciencehelp.h b/src/pulsatingsciencehelp.h new file mode 100644 index 0000000..5072d37 --- /dev/null +++ b/src/pulsatingsciencehelp.h @@ -0,0 +1,40 @@ +/****************************************************************************** + * Copyright (C) 2009 by Oliver Bock * + * oliver.bock[AT]aei.mpg.de * + * * + * This file is part of PulsatingScience. * + * * + * PulsatingScience 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, version 3 of the License. * + * * + * PulsatingScience 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 PulsatingScience. If not, see <http://www.gnu.org/licenses/>. * + * * + ******************************************************************************/ + +#ifndef PULSATINGSCIENCEHELP_H +#define PULSATINGSCIENCEHELP_H + +#include <QtGui/QDialog> +#include <QtCore/QLocale> +#include <QDebug> + +#include "ui_pulsatingsciencehelp.h" + + +class PulsatingScienceHelp : public QDialog, private Ui::PulsatingScienceHelp +{ + Q_OBJECT + +public: + PulsatingScienceHelp(QWidget *parent = 0); + virtual ~PulsatingScienceHelp(); +}; + +#endif /* PULSATINGSCIENCEHELP_H */ diff --git a/src/pulsatingsciencehelp.qrc b/src/pulsatingsciencehelp.qrc new file mode 100644 index 0000000..04c9705 --- /dev/null +++ b/src/pulsatingsciencehelp.qrc @@ -0,0 +1,9 @@ +<RCC> + <qresource prefix="content" > + <file>resources/help_en.html</file> + <file>resources/help_de.html</file> + </qresource> + <qresource prefix="icons" > + <file>resources/aei-icon48.png</file> + </qresource> +</RCC> diff --git a/src/pulsatingsciencehelp.ui b/src/pulsatingsciencehelp.ui new file mode 100644 index 0000000..48fb423 --- /dev/null +++ b/src/pulsatingsciencehelp.ui @@ -0,0 +1,88 @@ +<ui version="4.0" > + <class>PulsatingScienceHelp</class> + <widget class="QDialog" name="PulsatingScienceHelp" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle" > + <string>Pulsating Science - Help</string> + </property> + <property name="windowIcon" > + <iconset resource="pulsatingsciencehelp.qrc" > + <normaloff>:/icons/resources/aei-icon48.png</normaloff>:/icons/resources/aei-icon48.png</iconset> + </property> + <layout class="QGridLayout" name="gridLayout" > + <item row="1" column="0" > + <widget class="QDialogButtonBox" name="buttonBox" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Ok</set> + </property> + <property name="centerButtons" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="0" column="0" > + <widget class="QWebView" name="webView" > + <property name="url" > + <url> + <string>qrc:/content/resources/help_en.html</string> + </url> + </property> + </widget> + </item> + </layout> + </widget> + <customwidgets> + <customwidget> + <class>QWebView</class> + <extends>QWidget</extends> + <header>QtWebKit/QWebView</header> + </customwidget> + </customwidgets> + <resources> + <include location="pulsatingsciencehelp.qrc" /> + </resources> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>PulsatingScienceHelp</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel" > + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>PulsatingScienceHelp</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel" > + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/src/resources/help_de.html b/src/resources/help_de.html new file mode 100644 index 0000000..cc085f1 --- /dev/null +++ b/src/resources/help_de.html @@ -0,0 +1,6 @@ +<html> +<body> +<h2>Pulsierende Wissenschaft - Hilfe</h2> +Fortsetzung folgt... +</body> +</html> diff --git a/src/resources/help_en.html b/src/resources/help_en.html new file mode 100644 index 0000000..7353e5b --- /dev/null +++ b/src/resources/help_en.html @@ -0,0 +1,6 @@ +<html> +<body> +<h2>Pulsating Science - Help</h2> +To be continued... +</body> +</html> -- GitLab