From 50123887ba0f33cf47520bee7c419d68742af2d1 Mon Sep 17 00:00:00 2001 From: Qt by Nokia Date: Wed, 27 Apr 2011 12:05:43 +0200 Subject: Initial import from the monolithic Qt. This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12 --- examples/help/README | 38 ++ .../contextsensitivehelp/contextsensitivehelp.pro | 20 + examples/help/contextsensitivehelp/doc/amount.html | 11 + examples/help/contextsensitivehelp/doc/filter.html | 12 + examples/help/contextsensitivehelp/doc/plants.html | 44 ++ examples/help/contextsensitivehelp/doc/rain.html | 11 + examples/help/contextsensitivehelp/doc/source.html | 33 ++ .../help/contextsensitivehelp/doc/temperature.html | 13 + examples/help/contextsensitivehelp/doc/time.html | 11 + .../contextsensitivehelp/doc/wateringmachine.qch | Bin 0 -> 25600 bytes .../contextsensitivehelp/doc/wateringmachine.qhc | Bin 0 -> 8192 bytes .../contextsensitivehelp/doc/wateringmachine.qhcp | 14 + .../contextsensitivehelp/doc/wateringmachine.qhp | 25 ++ examples/help/contextsensitivehelp/helpbrowser.cpp | 80 ++++ examples/help/contextsensitivehelp/helpbrowser.h | 64 +++ examples/help/contextsensitivehelp/main.cpp | 50 +++ .../contextsensitivehelp/wateringconfigdialog.cpp | 68 ++++ .../contextsensitivehelp/wateringconfigdialog.h | 61 +++ .../contextsensitivehelp/wateringconfigdialog.ui | 446 +++++++++++++++++++++ examples/help/help.pro | 13 + examples/help/remotecontrol/enter.png | Bin 0 -> 315 bytes examples/help/remotecontrol/main.cpp | 53 +++ examples/help/remotecontrol/remotecontrol.cpp | 174 ++++++++ examples/help/remotecontrol/remotecontrol.h | 78 ++++ examples/help/remotecontrol/remotecontrol.pro | 15 + examples/help/remotecontrol/remotecontrol.qrc | 5 + examples/help/remotecontrol/remotecontrol.ui | 228 +++++++++++ examples/help/simpletextviewer/assistant.cpp | 109 +++++ examples/help/simpletextviewer/assistant.h | 62 +++ .../help/simpletextviewer/documentation/about.txt | 9 + .../simpletextviewer/documentation/browse.html | 34 ++ .../simpletextviewer/documentation/filedialog.html | 48 +++ .../simpletextviewer/documentation/findfile.html | 32 ++ .../documentation/images/browse.png | Bin 0 -> 21553 bytes .../documentation/images/fadedfilemenu.png | Bin 0 -> 9589 bytes .../documentation/images/filedialog.png | Bin 0 -> 12318 bytes .../documentation/images/handbook.png | Bin 0 -> 1060 bytes .../simpletextviewer/documentation/images/icon.png | Bin 0 -> 5513 bytes .../documentation/images/mainwindow.png | Bin 0 -> 12769 bytes .../simpletextviewer/documentation/images/open.png | Bin 0 -> 11697 bytes .../documentation/images/wildcard.png | Bin 0 -> 11266 bytes .../help/simpletextviewer/documentation/index.html | 41 ++ .../help/simpletextviewer/documentation/intro.html | 28 ++ .../simpletextviewer/documentation/openfile.html | 36 ++ .../documentation/simpletextviewer.qch | Bin 0 -> 108544 bytes .../documentation/simpletextviewer.qhc | Bin 0 -> 18432 bytes .../documentation/simpletextviewer.qhcp | 30 ++ .../documentation/simpletextviewer.qhp | 49 +++ .../documentation/wildcardmatching.html | 57 +++ examples/help/simpletextviewer/findfiledialog.cpp | 221 ++++++++++ examples/help/simpletextviewer/findfiledialog.h | 98 +++++ examples/help/simpletextviewer/main.cpp | 51 +++ examples/help/simpletextviewer/mainwindow.cpp | 146 +++++++ examples/help/simpletextviewer/mainwindow.h | 83 ++++ .../help/simpletextviewer/simpletextviewer.pro | 18 + examples/help/simpletextviewer/textedit.cpp | 74 ++++ examples/help/simpletextviewer/textedit.h | 60 +++ 57 files changed, 2853 insertions(+) create mode 100644 examples/help/README create mode 100644 examples/help/contextsensitivehelp/contextsensitivehelp.pro create mode 100644 examples/help/contextsensitivehelp/doc/amount.html create mode 100644 examples/help/contextsensitivehelp/doc/filter.html create mode 100644 examples/help/contextsensitivehelp/doc/plants.html create mode 100644 examples/help/contextsensitivehelp/doc/rain.html create mode 100644 examples/help/contextsensitivehelp/doc/source.html create mode 100644 examples/help/contextsensitivehelp/doc/temperature.html create mode 100644 examples/help/contextsensitivehelp/doc/time.html create mode 100644 examples/help/contextsensitivehelp/doc/wateringmachine.qch create mode 100644 examples/help/contextsensitivehelp/doc/wateringmachine.qhc create mode 100644 examples/help/contextsensitivehelp/doc/wateringmachine.qhcp create mode 100644 examples/help/contextsensitivehelp/doc/wateringmachine.qhp create mode 100644 examples/help/contextsensitivehelp/helpbrowser.cpp create mode 100644 examples/help/contextsensitivehelp/helpbrowser.h create mode 100644 examples/help/contextsensitivehelp/main.cpp create mode 100644 examples/help/contextsensitivehelp/wateringconfigdialog.cpp create mode 100644 examples/help/contextsensitivehelp/wateringconfigdialog.h create mode 100644 examples/help/contextsensitivehelp/wateringconfigdialog.ui create mode 100644 examples/help/help.pro create mode 100644 examples/help/remotecontrol/enter.png create mode 100644 examples/help/remotecontrol/main.cpp create mode 100644 examples/help/remotecontrol/remotecontrol.cpp create mode 100644 examples/help/remotecontrol/remotecontrol.h create mode 100644 examples/help/remotecontrol/remotecontrol.pro create mode 100644 examples/help/remotecontrol/remotecontrol.qrc create mode 100644 examples/help/remotecontrol/remotecontrol.ui create mode 100644 examples/help/simpletextviewer/assistant.cpp create mode 100644 examples/help/simpletextviewer/assistant.h create mode 100644 examples/help/simpletextviewer/documentation/about.txt create mode 100644 examples/help/simpletextviewer/documentation/browse.html create mode 100644 examples/help/simpletextviewer/documentation/filedialog.html create mode 100644 examples/help/simpletextviewer/documentation/findfile.html create mode 100644 examples/help/simpletextviewer/documentation/images/browse.png create mode 100644 examples/help/simpletextviewer/documentation/images/fadedfilemenu.png create mode 100644 examples/help/simpletextviewer/documentation/images/filedialog.png create mode 100644 examples/help/simpletextviewer/documentation/images/handbook.png create mode 100644 examples/help/simpletextviewer/documentation/images/icon.png create mode 100644 examples/help/simpletextviewer/documentation/images/mainwindow.png create mode 100644 examples/help/simpletextviewer/documentation/images/open.png create mode 100644 examples/help/simpletextviewer/documentation/images/wildcard.png create mode 100644 examples/help/simpletextviewer/documentation/index.html create mode 100644 examples/help/simpletextviewer/documentation/intro.html create mode 100644 examples/help/simpletextviewer/documentation/openfile.html create mode 100644 examples/help/simpletextviewer/documentation/simpletextviewer.qch create mode 100644 examples/help/simpletextviewer/documentation/simpletextviewer.qhc create mode 100644 examples/help/simpletextviewer/documentation/simpletextviewer.qhcp create mode 100644 examples/help/simpletextviewer/documentation/simpletextviewer.qhp create mode 100644 examples/help/simpletextviewer/documentation/wildcardmatching.html create mode 100644 examples/help/simpletextviewer/findfiledialog.cpp create mode 100644 examples/help/simpletextviewer/findfiledialog.h create mode 100644 examples/help/simpletextviewer/main.cpp create mode 100644 examples/help/simpletextviewer/mainwindow.cpp create mode 100644 examples/help/simpletextviewer/mainwindow.h create mode 100644 examples/help/simpletextviewer/simpletextviewer.pro create mode 100644 examples/help/simpletextviewer/textedit.cpp create mode 100644 examples/help/simpletextviewer/textedit.h (limited to 'examples/help') diff --git a/examples/help/README b/examples/help/README new file mode 100644 index 000000000..85f5a4373 --- /dev/null +++ b/examples/help/README @@ -0,0 +1,38 @@ +Support for interactive help is provided by the Qt Assistant application. +Developers can take advantages of the facilities it offers to display +specially-prepared documentation to users of their applications. + + +The example launcher provided with Qt can be used to explore each of the +examples in this directory. + +Documentation for these examples can be found via the Tutorial and Examples +link in the main Qt documentation. + + +Finding the Qt Examples and Demos launcher +========================================== + +On Windows: + +The launcher can be accessed via the Windows Start menu. Select the menu +entry entitled "Qt Examples and Demos" entry in the submenu containing +the Qt tools. + +On Mac OS X: + +For the binary distribution, the qtdemo executable is installed in the +/Developer/Applications/Qt directory. For the source distribution, it is +installed alongside the other Qt tools on the path specified when Qt is +configured. + +On Unix/Linux: + +The qtdemo executable is installed alongside the other Qt tools on the path +specified when Qt is configured. + +On all platforms: + +The source code for the launcher can be found in the demos/qtdemo directory +in the Qt package. This example is built at the same time as the Qt libraries, +tools, examples, and demonstrations. diff --git a/examples/help/contextsensitivehelp/contextsensitivehelp.pro b/examples/help/contextsensitivehelp/contextsensitivehelp.pro new file mode 100644 index 000000000..ef85c840d --- /dev/null +++ b/examples/help/contextsensitivehelp/contextsensitivehelp.pro @@ -0,0 +1,20 @@ +TEMPLATE = app + +CONFIG += help + +SOURCES += main.cpp \ + wateringconfigdialog.cpp \ + helpbrowser.cpp + +HEADERS += wateringconfigdialog.h \ + helpbrowser.h + +FORMS += wateringconfigdialog.ui + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qttools/help/contextsensitivehelp +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.png *.doc doc +sources.path = $$[QT_INSTALL_EXAMPLES]/qttools/help/contextsensitivehelp +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/help/contextsensitivehelp/doc/amount.html b/examples/help/contextsensitivehelp/doc/amount.html new file mode 100644 index 000000000..7a02a6fd5 --- /dev/null +++ b/examples/help/contextsensitivehelp/doc/amount.html @@ -0,0 +1,11 @@ + + + + Water amount + + + Depending on the plant, temperature and rain fall the amount needs to be larger + or smaller. On a really hot day without rain, the suggested amount + can be increased by about 10%. + + diff --git a/examples/help/contextsensitivehelp/doc/filter.html b/examples/help/contextsensitivehelp/doc/filter.html new file mode 100644 index 000000000..64861126d --- /dev/null +++ b/examples/help/contextsensitivehelp/doc/filter.html @@ -0,0 +1,12 @@ + + + +Filter + + +Depending on the source of water, it needs to be filtered or not. Filtering +is strongly recommened for the river and lake. + + + + diff --git a/examples/help/contextsensitivehelp/doc/plants.html b/examples/help/contextsensitivehelp/doc/plants.html new file mode 100644 index 000000000..2d2bb6788 --- /dev/null +++ b/examples/help/contextsensitivehelp/doc/plants.html @@ -0,0 +1,44 @@ + + + + Plants + + + Different kind of plants need different amounts of water. Here's a short + overview over the most common grown plants and their avarage need of water: +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
KindAmount
Squash2000
Bean1500
Carrot1200
Strawberry1300
Raspberry1000
Blueberry1100
+

+ Warning: Watering them too much or too little will + cause irreversible damage! + + diff --git a/examples/help/contextsensitivehelp/doc/rain.html b/examples/help/contextsensitivehelp/doc/rain.html new file mode 100644 index 000000000..1ffe45240 --- /dev/null +++ b/examples/help/contextsensitivehelp/doc/rain.html @@ -0,0 +1,11 @@ + + + + Rain + + + Depending on the rain fall, the automated watering system should not be + switched on at all. Also, the temperature should be + considered. + + diff --git a/examples/help/contextsensitivehelp/doc/source.html b/examples/help/contextsensitivehelp/doc/source.html new file mode 100644 index 000000000..68b2f8c71 --- /dev/null +++ b/examples/help/contextsensitivehelp/doc/source.html @@ -0,0 +1,33 @@ + + + + Water Source + + + The current pipe system connects to four different sources. Be aware + that only a limited amount of water can be taken from some sources. +
+ + + + + + + + + + + + + + + + + + + + + +
SourceAmount
Fountain4000
River6000
Lake10000
Public Water Systemunlimited
+ + diff --git a/examples/help/contextsensitivehelp/doc/temperature.html b/examples/help/contextsensitivehelp/doc/temperature.html new file mode 100644 index 000000000..4145ed725 --- /dev/null +++ b/examples/help/contextsensitivehelp/doc/temperature.html @@ -0,0 +1,13 @@ + + + + Temperature + + + Depending on the temperature, the plants need more or less water. The higher + the temperature the higher the need for water. If the temperature does not + reach a certain level, maybe no automatic watering should be done at all.
+ Before setting this parameter for good, you should also take the amount of + rain into account. + + diff --git a/examples/help/contextsensitivehelp/doc/time.html b/examples/help/contextsensitivehelp/doc/time.html new file mode 100644 index 000000000..0cc81f4d0 --- /dev/null +++ b/examples/help/contextsensitivehelp/doc/time.html @@ -0,0 +1,11 @@ + + + +Starting time + + +Starting the watering too early may be ineffective since most water +will evaporate. + + + diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qch b/examples/help/contextsensitivehelp/doc/wateringmachine.qch new file mode 100644 index 000000000..35d29be22 Binary files /dev/null and b/examples/help/contextsensitivehelp/doc/wateringmachine.qch differ diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhc b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc new file mode 100644 index 000000000..b5653c3ff Binary files /dev/null and b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc differ diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhcp b/examples/help/contextsensitivehelp/doc/wateringmachine.qhcp new file mode 100644 index 000000000..eebf6520e --- /dev/null +++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhcp @@ -0,0 +1,14 @@ + + + + + + wateringmachine.qhp + wateringmachine.qch + + + + wateringmachine.qch + + + \ No newline at end of file diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhp b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp new file mode 100644 index 000000000..6dd08e7ae --- /dev/null +++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp @@ -0,0 +1,25 @@ + + + wateringmachine + wateringcompany.com.1-0-0.premium + + + + + + + + + + + + plants.html + temperature.html + rain.html + time.html + amount.html + source.html + filter.html + + + diff --git a/examples/help/contextsensitivehelp/helpbrowser.cpp b/examples/help/contextsensitivehelp/helpbrowser.cpp new file mode 100644 index 000000000..d37a72f3b --- /dev/null +++ b/examples/help/contextsensitivehelp/helpbrowser.cpp @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#include "helpbrowser.h" + +HelpBrowser::HelpBrowser(QWidget *parent) + : QTextBrowser(parent) +{ + QString collectionFile = QLibraryInfo::location(QLibraryInfo::ExamplesPath) + + QLatin1String("/help/contextsensitivehelp/doc/wateringmachine.qhc"); + + m_helpEngine = new QHelpEngineCore(collectionFile, this); + if (!m_helpEngine->setupData()) { + delete m_helpEngine; + m_helpEngine = 0; + } +} + +void HelpBrowser::showHelpForKeyword(const QString &id) +{ + if (m_helpEngine) { + QMap links = m_helpEngine->linksForIdentifier(id); + if (links.count()) + setSource(links.constBegin().value()); + } +} + +QVariant HelpBrowser::loadResource(int type, const QUrl &name) +{ + QByteArray ba; + if (type < 4 && m_helpEngine) { + QUrl url(name); + if (name.isRelative()) + url = source().resolved(url); + ba = m_helpEngine->fileData(url); + } + return ba; +} + diff --git a/examples/help/contextsensitivehelp/helpbrowser.h b/examples/help/contextsensitivehelp/helpbrowser.h new file mode 100644 index 000000000..684ed6827 --- /dev/null +++ b/examples/help/contextsensitivehelp/helpbrowser.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef HELPBROWSER_H +#define HELPBROWSER_H + +#include + +QT_BEGIN_NAMESPACE +class QHelpEngineCore; +QT_END_NAMESPACE; + +class HelpBrowser : public QTextBrowser +{ + Q_OBJECT + +public: + HelpBrowser(QWidget *parent); + void showHelpForKeyword(const QString &id); + +private: + QVariant loadResource(int type, const QUrl &name); + + QHelpEngineCore *m_helpEngine; +}; + +#endif diff --git a/examples/help/contextsensitivehelp/main.cpp b/examples/help/contextsensitivehelp/main.cpp new file mode 100644 index 000000000..ca15d9fb6 --- /dev/null +++ b/examples/help/contextsensitivehelp/main.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "wateringconfigdialog.h" + +int main(int argc, char *argv[]) +{ + QApplication a(argc, argv); + WateringConfigDialog dia; + return dia.exec(); +} diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.cpp b/examples/help/contextsensitivehelp/wateringconfigdialog.cpp new file mode 100644 index 000000000..0529bfcfc --- /dev/null +++ b/examples/help/contextsensitivehelp/wateringconfigdialog.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "wateringconfigdialog.h" + +WateringConfigDialog::WateringConfigDialog() +{ + m_ui.setupUi(this); + m_widgetInfo.insert(m_ui.plantComboBox, tr("plants")); + m_widgetInfo.insert(m_ui.temperatureCheckBox, tr("temperature")); + m_widgetInfo.insert(m_ui.temperatureSpinBox, tr("temperature")); + m_widgetInfo.insert(m_ui.rainCheckBox, tr("rain")); + m_widgetInfo.insert(m_ui.rainSpinBox, tr("rain")); + m_widgetInfo.insert(m_ui.startTimeEdit, tr("starting time")); + m_widgetInfo.insert(m_ui.amountSpinBox, tr("water amount")); + m_widgetInfo.insert(m_ui.sourceComboBox, tr("water source")); + m_widgetInfo.insert(m_ui.filterCheckBox, tr("water filtering")); + + connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)), + this, SLOT(focusChanged(QWidget*,QWidget*))); +} + +void WateringConfigDialog::focusChanged(QWidget *, QWidget *now) +{ + if (m_widgetInfo.contains(now)) { + m_ui.helpLabel->setText(tr("Information about %1:").arg(m_widgetInfo.value(now))); + QStringList lst = m_widgetInfo.value(now).split(QLatin1Char(' ')); + m_ui.helpBrowser->showHelpForKeyword(lst.last()); + } +} + diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.h b/examples/help/contextsensitivehelp/wateringconfigdialog.h new file mode 100644 index 000000000..d1fd98643 --- /dev/null +++ b/examples/help/contextsensitivehelp/wateringconfigdialog.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef WATERINGCONFIGDIALOG_H +#define WATERINGCONFIGDIALOG_H + +#include +#include "ui_wateringconfigdialog.h" + +class WateringConfigDialog : public QDialog +{ + Q_OBJECT +public: + WateringConfigDialog(); + +private slots: + void focusChanged(QWidget *old, QWidget *now); + +private: + Ui::WateringConfigDialog m_ui; + QMap m_widgetInfo; +}; + +#endif diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.ui b/examples/help/contextsensitivehelp/wateringconfigdialog.ui new file mode 100644 index 000000000..d7a473a3c --- /dev/null +++ b/examples/help/contextsensitivehelp/wateringconfigdialog.ui @@ -0,0 +1,446 @@ + + WateringConfigDialog + + + + 0 + 0 + 334 + 550 + + + + Watering Configuration + + + + + + + + Plant: + + + + + + + + 0 + 0 + + + + + Squash + + + + + Bean + + + + + Carrot + + + + + Strawberry + + + + + Raspberry + + + + + Blueberry + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 67 + 16 + + + + + + + + Water when: + + + + + + + Temperature is higher than: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 16 + 20 + + + + + + + + false + + + + + + C + + + 10 + + + 60 + + + 20 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Rain less than: + + + + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 16 + 20 + + + + + + + + false + + + + + + mm + + + 1 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 20 + + + + + + + + Starting Time: + + + + + + + + + + Amount: + + + + + + + l + + + 100 + + + 10000 + + + 100 + + + 1000 + + + + + + + Source: + + + + + + + + Fountain + + + + + River + + + + + Lake + + + + + Public Water System + + + + + + + + Filter: + + + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 10 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + <a href="test">Show Details</a> + + + + + + + + + Qt::Horizontal + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + HelpBrowser + QTextBrowser +
helpbrowser.h
+
+
+ + + + buttonBox + accepted() + WateringConfigDialog + accept() + + + 227 + 372 + + + 157 + 274 + + + + + buttonBox + rejected() + WateringConfigDialog + reject() + + + 286 + 378 + + + 286 + 274 + + + + + temperatureCheckBox + toggled(bool) + temperatureSpinBox + setEnabled(bool) + + + 132 + 101 + + + 132 + 125 + + + + + rainCheckBox + toggled(bool) + rainSpinBox + setEnabled(bool) + + + 110 + 154 + + + 113 + 169 + + + + +
diff --git a/examples/help/help.pro b/examples/help/help.pro new file mode 100644 index 000000000..f03ec01f4 --- /dev/null +++ b/examples/help/help.pro @@ -0,0 +1,13 @@ +TEMPLATE = subdirs +CONFIG += ordered + +SUBDIRS += contextsensitivehelp \ + remotecontrol \ + simpletextviewer + +# install +sources.files = README *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/qttools/help +INSTALLS += sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/help/remotecontrol/enter.png b/examples/help/remotecontrol/enter.png new file mode 100644 index 000000000..f397f4b9c Binary files /dev/null and b/examples/help/remotecontrol/enter.png differ diff --git a/examples/help/remotecontrol/main.cpp b/examples/help/remotecontrol/main.cpp new file mode 100644 index 000000000..ad561ce4f --- /dev/null +++ b/examples/help/remotecontrol/main.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "remotecontrol.h" + +int main(int argc, char *argv[]) +{ + Q_INIT_RESOURCE(remotecontrol); + + QApplication a(argc, argv); + RemoteControl w; + w.show(); + a.connect(&a, SIGNAL(lastWindowClosed()), &a, SLOT(quit())); + return a.exec(); +} diff --git a/examples/help/remotecontrol/remotecontrol.cpp b/examples/help/remotecontrol/remotecontrol.cpp new file mode 100644 index 000000000..45d3fde82 --- /dev/null +++ b/examples/help/remotecontrol/remotecontrol.cpp @@ -0,0 +1,174 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#include + +#include "remotecontrol.h" + +RemoteControl::RemoteControl(QWidget *parent, Qt::WFlags flags) + : QMainWindow(parent, flags) +{ + ui.setupUi(this); + connect(ui.indexLineEdit, SIGNAL(returnPressed()), + this, SLOT(on_indexButton_clicked())); + connect(ui.identifierLineEdit, SIGNAL(returnPressed()), + this, SLOT(on_identifierButton_clicked())); + connect(ui.urlLineEdit, SIGNAL(returnPressed()), + this, SLOT(on_urlButton_clicked())); + + QString rc; + QTextStream(&rc) << QLatin1String("qthelp://com.trolltech.qt.") + << (QT_VERSION >> 16) << ((QT_VERSION >> 8) & 0xFF) + << (QT_VERSION & 0xFF) + << QLatin1String("/qdoc/index.html"); + + ui.startUrlLineEdit->setText(rc); + + process = new QProcess(this); + connect(process, SIGNAL(finished(int,QProcess::ExitStatus)), + this, SLOT(helpViewerClosed())); +} + +RemoteControl::~RemoteControl() +{ + if (process->state() == QProcess::Running) { + process->terminate(); + process->waitForFinished(3000); + } +} + +void RemoteControl::on_actionQuit_triggered() +{ + close(); +} + +void RemoteControl::on_launchButton_clicked() +{ + if (process->state() == QProcess::Running) + return; + + QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator(); +#if !defined(Q_OS_MAC) + app += QLatin1String("assistant"); +#else + app += QLatin1String("Assistant.app/Contents/MacOS/Assistant"); +#endif + + ui.contentsCheckBox->setChecked(true); + ui.indexCheckBox->setChecked(true); + ui.bookmarksCheckBox->setChecked(true); + + QStringList args; + args << QLatin1String("-enableRemoteControl"); + process->start(app, args); + if (!process->waitForStarted()) { + QMessageBox::critical(this, tr("Remote Control"), + tr("Could not start Qt Assistant from %1.").arg(app)); + return; + } + + if (!ui.startUrlLineEdit->text().isEmpty()) + sendCommand(QLatin1String("SetSource ") + + ui.startUrlLineEdit->text()); + + ui.launchButton->setEnabled(false); + ui.startUrlLineEdit->setEnabled(false); + ui.actionGroupBox->setEnabled(true); +} + +void RemoteControl::sendCommand(const QString &cmd) +{ + if (process->state() != QProcess::Running) + return; + process->write(cmd.toLocal8Bit() + '\n'); +} + +void RemoteControl::on_indexButton_clicked() +{ + sendCommand(QLatin1String("ActivateKeyword ") + + ui.indexLineEdit->text()); +} + +void RemoteControl::on_identifierButton_clicked() +{ + sendCommand(QLatin1String("ActivateIdentifier ") + + ui.identifierLineEdit->text()); +} + +void RemoteControl::on_urlButton_clicked() +{ + sendCommand(QLatin1String("SetSource ") + + ui.urlLineEdit->text()); +} + +void RemoteControl::on_syncContentsButton_clicked() +{ + sendCommand(QLatin1String("SyncContents")); +} + +void RemoteControl::on_contentsCheckBox_toggled(bool checked) +{ + sendCommand(checked ? + QLatin1String("Show Contents") : QLatin1String("Hide Contents")); +} + +void RemoteControl::on_indexCheckBox_toggled(bool checked) +{ + sendCommand(checked ? + QLatin1String("Show Index") : QLatin1String("Hide Index")); +} + +void RemoteControl::on_bookmarksCheckBox_toggled(bool checked) +{ + sendCommand(checked ? + QLatin1String("Show Bookmarks") : QLatin1String("Hide Bookmarks")); +} + +void RemoteControl::helpViewerClosed() +{ + ui.launchButton->setEnabled(true); + ui.startUrlLineEdit->setEnabled(true); + ui.actionGroupBox->setEnabled(false); +} diff --git a/examples/help/remotecontrol/remotecontrol.h b/examples/help/remotecontrol/remotecontrol.h new file mode 100644 index 000000000..e440add3f --- /dev/null +++ b/examples/help/remotecontrol/remotecontrol.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef REMOTECONTROL_H +#define REMOTECONTROL_H + +#include +#include "ui_remotecontrol.h" + +QT_BEGIN_NAMESPACE +class QProcess; +QT_END_NAMESPACE; + +class RemoteControl : public QMainWindow +{ + Q_OBJECT + +public: + RemoteControl(QWidget *parent = 0, Qt::WFlags flags = 0); + ~RemoteControl(); + +private: + Ui::RemoteControlClass ui; + QProcess *process; + +private slots: + void on_launchButton_clicked(); + void on_actionQuit_triggered(); + void on_indexButton_clicked(); + void on_identifierButton_clicked(); + void on_urlButton_clicked(); + void on_syncContentsButton_clicked(); + void on_contentsCheckBox_toggled(bool checked); + void on_indexCheckBox_toggled(bool checked); + void on_bookmarksCheckBox_toggled(bool checked); + void helpViewerClosed(); + + void sendCommand(const QString &cmd); +}; + +#endif // REMOTECONTROL_H diff --git a/examples/help/remotecontrol/remotecontrol.pro b/examples/help/remotecontrol/remotecontrol.pro new file mode 100644 index 000000000..f080b3c0b --- /dev/null +++ b/examples/help/remotecontrol/remotecontrol.pro @@ -0,0 +1,15 @@ +TEMPLATE = app + +HEADERS += remotecontrol.h +SOURCES += main.cpp \ + remotecontrol.cpp +FORMS += remotecontrol.ui +RESOURCES += remotecontrol.qrc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qttools/help/remotecontrol +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS *.pro *.png *.doc doc +sources.path = $$[QT_INSTALL_EXAMPLES]/qttools/help/remotecontrol +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/help/remotecontrol/remotecontrol.qrc b/examples/help/remotecontrol/remotecontrol.qrc new file mode 100644 index 000000000..9b4299d21 --- /dev/null +++ b/examples/help/remotecontrol/remotecontrol.qrc @@ -0,0 +1,5 @@ + + + enter.png + + diff --git a/examples/help/remotecontrol/remotecontrol.ui b/examples/help/remotecontrol/remotecontrol.ui new file mode 100644 index 000000000..1cfc7f540 --- /dev/null +++ b/examples/help/remotecontrol/remotecontrol.ui @@ -0,0 +1,228 @@ + + RemoteControlClass + + + + 0 + 0 + 344 + 364 + + + + RemoteControl + + + + + + + Start URL: + + + + + + + + + + Launch Qt HelpViewer + + + + + + + Qt::Horizontal + + + + 101 + 20 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 113 + 16 + + + + + + + + false + + + Actions + + + + + + Search in Index: + + + + + + + 0 + + + + + + + + + + + :/remotecontrol/enter.png + + + + + + + + + Identifier: + + + + + + + 0 + + + + + + + + + + + :/remotecontrol/enter.png + + + + + + + + + Show URL: + + + + + + + 0 + + + + + + + + + + + :/remotecontrol/enter.png + + + + + + + + + Sync Contents + + + + + + + Qt::Horizontal + + + + 81 + 20 + + + + + + + + Show Contents + + + + + + + Show Index + + + + + + + Show Bookmarks + + + + + + + + + + + + 0 + 0 + 344 + 21 + + + + + File + + + + + + + + + Quit + + + + + + + + + diff --git a/examples/help/simpletextviewer/assistant.cpp b/examples/help/simpletextviewer/assistant.cpp new file mode 100644 index 000000000..2223b4bbf --- /dev/null +++ b/examples/help/simpletextviewer/assistant.cpp @@ -0,0 +1,109 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +#include + +#include "assistant.h" + +Assistant::Assistant() + : proc(0) +{ +} + +//! [0] +Assistant::~Assistant() +{ + if (proc && proc->state() == QProcess::Running) { + proc->terminate(); + proc->waitForFinished(3000); + } + delete proc; +} +//! [0] + +//! [1] +void Assistant::showDocumentation(const QString &page) +{ + if (!startAssistant()) + return; + + QByteArray ba("SetSource "); + ba.append("qthelp://com.trolltech.examples.simpletextviewer/doc/"); + + proc->write(ba + page.toLocal8Bit() + '\n'); +} +//! [1] + +//! [2] +bool Assistant::startAssistant() +{ + if (!proc) + proc = new QProcess(); + + if (proc->state() != QProcess::Running) { + QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator(); +#if !defined(Q_OS_MAC) + app += QLatin1String("assistant"); +#else + app += QLatin1String("Assistant.app/Contents/MacOS/Assistant"); +#endif + + QStringList args; + args << QLatin1String("-collectionFile") + << QLibraryInfo::location(QLibraryInfo::ExamplesPath) + + QLatin1String("/help/simpletextviewer/documentation/simpletextviewer.qhc") + << QLatin1String("-enableRemoteControl"); + + proc->start(app, args); + + if (!proc->waitForStarted()) { + QMessageBox::critical(0, QObject::tr("Simple Text Viewer"), + QObject::tr("Unable to launch Qt Assistant (%1)").arg(app)); + return false; + } + } + return true; +} +//! [2] diff --git a/examples/help/simpletextviewer/assistant.h b/examples/help/simpletextviewer/assistant.h new file mode 100644 index 000000000..3f508dd82 --- /dev/null +++ b/examples/help/simpletextviewer/assistant.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ASSISTANT_H +#define ASSISTANT_H + +#include + +QT_BEGIN_NAMESPACE +class QProcess; +QT_END_NAMESPACE + +class Assistant +{ +public: + Assistant(); + ~Assistant(); + void showDocumentation(const QString &file); + +private: + bool startAssistant(); + QProcess *proc; +}; + +#endif diff --git a/examples/help/simpletextviewer/documentation/about.txt b/examples/help/simpletextviewer/documentation/about.txt new file mode 100644 index 000000000..eeab35f4a --- /dev/null +++ b/examples/help/simpletextviewer/documentation/about.txt @@ -0,0 +1,9 @@ +The Simple Text Viewer enables the user to select and view existing +files. + +HTML files is displayed using rich text, while other files are +presented as plain text. The application provides a file dialog +allowing the user to search for files using wildcard matching. The +search is performed within in the specified directory, and the user is +given an option to browse the existing file system to find the +relevant directory. diff --git a/examples/help/simpletextviewer/documentation/browse.html b/examples/help/simpletextviewer/documentation/browse.html new file mode 100644 index 000000000..987abf31f --- /dev/null +++ b/examples/help/simpletextviewer/documentation/browse.html @@ -0,0 +1,34 @@ + + + + Browse + + + +

Browse

+ +

+ The file dialog let you browse the current file system to + specify the directory in which the file you want to open + resides. + Note that only the specified directory will be searched, any + subdirectories will simply be ignored. +

+ +
+
+ + + + +
+ +
+
+

+ See also: File Dialog, Wildcard Matching, + Find File +

+ + + diff --git a/examples/help/simpletextviewer/documentation/filedialog.html b/examples/help/simpletextviewer/documentation/filedialog.html new file mode 100644 index 000000000..afa65ed57 --- /dev/null +++ b/examples/help/simpletextviewer/documentation/filedialog.html @@ -0,0 +1,48 @@ + + + + File Dialog + + + +

File Dialog

+ +

+ In the file dialog you can name a particular file name, or + search for files using wildcard matching, i.e. specify a + file name containing wildcards. In addition you must specify + the directory in which the file you search for resides. +

+ +
+
+ + + + +
+ +
+
+

+ By default the dialog will search for all files (*) in the + current directory (the directory the application is run from). +

+ +

+ When editing the file name and directory parameters, an + overview of the matching files are displayed in the + dialog. The overview is updated whenever the parameters + change. +

+ +
+
+

+ See also: Browse, Wildcard Matching, + Find File +

+ + + + diff --git a/examples/help/simpletextviewer/documentation/findfile.html b/examples/help/simpletextviewer/documentation/findfile.html new file mode 100644 index 000000000..32e014718 --- /dev/null +++ b/examples/help/simpletextviewer/documentation/findfile.html @@ -0,0 +1,32 @@ + + + + Find File + + + +

Find File

+ +

+ To open and view a file in the Simple Text Viewer, select the + 'Open...' option in the 'File' menu. The application will then + provide you with a file dialog that you can use to search for + any existing file. +

+ +
+
+ + + + +
+ +
+
+

+ See also: Open File, File Dialog +

+ + + diff --git a/examples/help/simpletextviewer/documentation/images/browse.png b/examples/help/simpletextviewer/documentation/images/browse.png new file mode 100644 index 000000000..86db6b19e Binary files /dev/null and b/examples/help/simpletextviewer/documentation/images/browse.png differ diff --git a/examples/help/simpletextviewer/documentation/images/fadedfilemenu.png b/examples/help/simpletextviewer/documentation/images/fadedfilemenu.png new file mode 100644 index 000000000..fde0e43f6 Binary files /dev/null and b/examples/help/simpletextviewer/documentation/images/fadedfilemenu.png differ diff --git a/examples/help/simpletextviewer/documentation/images/filedialog.png b/examples/help/simpletextviewer/documentation/images/filedialog.png new file mode 100644 index 000000000..883a33a26 Binary files /dev/null and b/examples/help/simpletextviewer/documentation/images/filedialog.png differ diff --git a/examples/help/simpletextviewer/documentation/images/handbook.png b/examples/help/simpletextviewer/documentation/images/handbook.png new file mode 100644 index 000000000..3bd2b928b Binary files /dev/null and b/examples/help/simpletextviewer/documentation/images/handbook.png differ diff --git a/examples/help/simpletextviewer/documentation/images/icon.png b/examples/help/simpletextviewer/documentation/images/icon.png new file mode 100644 index 000000000..6daec0ade Binary files /dev/null and b/examples/help/simpletextviewer/documentation/images/icon.png differ diff --git a/examples/help/simpletextviewer/documentation/images/mainwindow.png b/examples/help/simpletextviewer/documentation/images/mainwindow.png new file mode 100644 index 000000000..c28d5e9ff Binary files /dev/null and b/examples/help/simpletextviewer/documentation/images/mainwindow.png differ diff --git a/examples/help/simpletextviewer/documentation/images/open.png b/examples/help/simpletextviewer/documentation/images/open.png new file mode 100644 index 000000000..1e5bba3c8 Binary files /dev/null and b/examples/help/simpletextviewer/documentation/images/open.png differ diff --git a/examples/help/simpletextviewer/documentation/images/wildcard.png b/examples/help/simpletextviewer/documentation/images/wildcard.png new file mode 100644 index 000000000..6e83a56cc Binary files /dev/null and b/examples/help/simpletextviewer/documentation/images/wildcard.png differ diff --git a/examples/help/simpletextviewer/documentation/index.html b/examples/help/simpletextviewer/documentation/index.html new file mode 100644 index 000000000..5a7b1d5fa --- /dev/null +++ b/examples/help/simpletextviewer/documentation/index.html @@ -0,0 +1,41 @@ + + + + Manual + + + +

Simple Text Viewer

+ +

+ The Simple Text Viewer enables the user to select and view + existing files. +

+ +

+ +

+ +

+ HTML files is displayed using rich text, while + other files are presented as plain text. The application + provides a file dialog allowing the user to search for files + using wildcard matching. The search is performed within in the + specified directory, and the user is given an option to browse + the existing file system to find the relevant directory. +

+ + + + + + + diff --git a/examples/help/simpletextviewer/documentation/intro.html b/examples/help/simpletextviewer/documentation/intro.html new file mode 100644 index 000000000..2e2aa40de --- /dev/null +++ b/examples/help/simpletextviewer/documentation/intro.html @@ -0,0 +1,28 @@ + + + + Manual + + + +

Simple Text Viewer

+ +

+ The Simple Text Viewer enables the user to select and view + existing files. +

+ +

+ +

+ +

+ The application provides its own custom documentation that is + available through the Help menu in the main window's menubar + and through the Help button in the application's find file + dialog. +

+ + + + diff --git a/examples/help/simpletextviewer/documentation/openfile.html b/examples/help/simpletextviewer/documentation/openfile.html new file mode 100644 index 000000000..e172de95e --- /dev/null +++ b/examples/help/simpletextviewer/documentation/openfile.html @@ -0,0 +1,36 @@ + + + + Open File + + + +

Open File

+ +

+ Once the file you want to view appears in the dialog's + display, you can open it in two different ways. +

+ +

+ By pressing the 'Open' button the currently selected file will + be opened. By default, the first file in the list of matching + files is selected. Another way of opening a file is to simply + double click the displayed file name. +

+ +
+
+ + + + +
+ +
+
+

+ See also: Find File +

+ + diff --git a/examples/help/simpletextviewer/documentation/simpletextviewer.qch b/examples/help/simpletextviewer/documentation/simpletextviewer.qch new file mode 100644 index 000000000..c40132803 Binary files /dev/null and b/examples/help/simpletextviewer/documentation/simpletextviewer.qch differ diff --git a/examples/help/simpletextviewer/documentation/simpletextviewer.qhc b/examples/help/simpletextviewer/documentation/simpletextviewer.qhc new file mode 100644 index 000000000..db380cabf Binary files /dev/null and b/examples/help/simpletextviewer/documentation/simpletextviewer.qhc differ diff --git a/examples/help/simpletextviewer/documentation/simpletextviewer.qhcp b/examples/help/simpletextviewer/documentation/simpletextviewer.qhcp new file mode 100644 index 000000000..e7c23210b --- /dev/null +++ b/examples/help/simpletextviewer/documentation/simpletextviewer.qhcp @@ -0,0 +1,30 @@ + + + + Simple Text Viewer + images/handbook.png + Trolltech/SimpleTextViewer + qthelp://com.trolltech.examples.simpletextviewer/doc/index.html + + About Simple Text Viewer + + + about.txt + images/icon.png + + false + false + false + + + + + simpletextviewer.qhp + simpletextviewer.qch + + + + simpletextviewer.qch + + + diff --git a/examples/help/simpletextviewer/documentation/simpletextviewer.qhp b/examples/help/simpletextviewer/documentation/simpletextviewer.qhp new file mode 100644 index 000000000..4cb83a5f3 --- /dev/null +++ b/examples/help/simpletextviewer/documentation/simpletextviewer.qhp @@ -0,0 +1,49 @@ + + + com.trolltech.examples.simpletextviewer + doc + + +
+
+
+
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + browse.html + filedialog.html + findfile.html + index.html + intro.html + openfile.html + wildcardmatching.html + images/browse.png + images/fadedfilemenu.png + images/filedialog.png + images/handbook.png + images/mainwindow.png + images/open.png + images/wildcard.png + +
+
diff --git a/examples/help/simpletextviewer/documentation/wildcardmatching.html b/examples/help/simpletextviewer/documentation/wildcardmatching.html new file mode 100644 index 000000000..eb1839a06 --- /dev/null +++ b/examples/help/simpletextviewer/documentation/wildcardmatching.html @@ -0,0 +1,57 @@ + + + + Wildcard Matching + + + +

Wildcard Matching

+ +

+ Most command shells such as bash or cmd.exe support "file + globbing", the ability to identify a group of files by using + wildcards. + +
+
+ + + + +
+ +
+
+

+ Wildcard matching provides four features: +

+ +
    +
  • Any character represents itself apart from those + mentioned below. Thus 'c' matches the character 'c'. +
  • +
  • The '?' character matches any single character.
  • +
  • The '*' matches zero or more of any characters.
  • +
  • Sets of characters can be represented in square brackets. + Within the character class, like outside, backslash + has no special meaning. +
  • +
+ +

+ For example we could identify HTML files with + *.html. This will match zero or more characters + followed by a dot followed by 'h', 't', 'm' and 'l'. +

+ +
+
+

+ See also: Browse, File Dialog, + Find File +

+ + + + + diff --git a/examples/help/simpletextviewer/findfiledialog.cpp b/examples/help/simpletextviewer/findfiledialog.cpp new file mode 100644 index 000000000..086be965d --- /dev/null +++ b/examples/help/simpletextviewer/findfiledialog.cpp @@ -0,0 +1,221 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "findfiledialog.h" +#include "assistant.h" +#include "textedit.h" + +//! [0] +FindFileDialog::FindFileDialog(TextEdit *editor, Assistant *assistant) + : QDialog(editor) +{ + currentAssistant = assistant; + currentEditor = editor; +//! [0] + + createButtons(); + createComboBoxes(); + createFilesTree(); + createLabels(); + createLayout(); + + directoryComboBox->addItem(QDir::toNativeSeparators(QDir::currentPath())); + fileNameComboBox->addItem("*"); + findFiles(); + + setWindowTitle(tr("Find File")); +//! [1] +} +//! [1] + +void FindFileDialog::browse() +{ + QString currentDirectory = directoryComboBox->currentText(); + QString newDirectory = QFileDialog::getExistingDirectory(this, + tr("Select Directory"), currentDirectory); + if (!newDirectory.isEmpty()) { + directoryComboBox->addItem(QDir::toNativeSeparators(newDirectory)); + directoryComboBox->setCurrentIndex(directoryComboBox->count() - 1); + update(); + } +} + +//! [2] +void FindFileDialog::help() +{ + currentAssistant->showDocumentation("filedialog.html"); +} +//! [2] + +void FindFileDialog::openFile(QTreeWidgetItem *item) +{ + if (!item) { + item = foundFilesTree->currentItem(); + if (!item) + return; + } + + QString fileName = item->text(0); + QString path = directoryComboBox->currentText() + QDir::separator(); + + currentEditor->setContents(path + fileName); + close(); +} + +void FindFileDialog::update() +{ + findFiles(); + buttonBox->button(QDialogButtonBox::Open)->setEnabled( + foundFilesTree->topLevelItemCount() > 0); +} + +void FindFileDialog::findFiles() +{ + QRegExp filePattern(fileNameComboBox->currentText() + "*"); + filePattern.setPatternSyntax(QRegExp::Wildcard); + + QDir directory(directoryComboBox->currentText()); + + QStringList allFiles = directory.entryList(QDir::Files | QDir::NoSymLinks); + QStringList matchingFiles; + + foreach (QString file, allFiles) { + if (filePattern.exactMatch(file)) + matchingFiles << file; + } + showFiles(matchingFiles); +} + +void FindFileDialog::showFiles(const QStringList &files) +{ + foundFilesTree->clear(); + + for (int i = 0; i < files.count(); ++i) { + QTreeWidgetItem *item = new QTreeWidgetItem(foundFilesTree); + item->setText(0, files[i]); + } + + if (files.count() > 0) + foundFilesTree->setCurrentItem(foundFilesTree->topLevelItem(0)); +} + +void FindFileDialog::createButtons() +{ + browseButton = new QToolButton; + browseButton->setText(tr("...")); + connect(browseButton, SIGNAL(clicked()), this, SLOT(browse())); + + buttonBox = new QDialogButtonBox(QDialogButtonBox::Open + | QDialogButtonBox::Cancel + | QDialogButtonBox::Help); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(openFile())); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); + connect(buttonBox, SIGNAL(helpRequested()), this, SLOT(help())); +} + +void FindFileDialog::createComboBoxes() +{ + directoryComboBox = new QComboBox; + fileNameComboBox = new QComboBox; + + fileNameComboBox->setEditable(true); + fileNameComboBox->setSizePolicy(QSizePolicy::Expanding, + QSizePolicy::Preferred); + + directoryComboBox->setMinimumContentsLength(30); + directoryComboBox->setSizeAdjustPolicy( + QComboBox::AdjustToMinimumContentsLength); + directoryComboBox->setSizePolicy(QSizePolicy::Expanding, + QSizePolicy::Preferred); + + connect(fileNameComboBox, SIGNAL(editTextChanged(QString)), + this, SLOT(update())); + connect(directoryComboBox, SIGNAL(currentIndexChanged(QString)), + this, SLOT(update())); +} + +void FindFileDialog::createFilesTree() +{ + foundFilesTree = new QTreeWidget; + foundFilesTree->setColumnCount(1); + foundFilesTree->setHeaderLabels(QStringList(tr("Matching Files"))); + foundFilesTree->setRootIsDecorated(false); + foundFilesTree->setSelectionMode(QAbstractItemView::SingleSelection); + + connect(foundFilesTree, SIGNAL(itemActivated(QTreeWidgetItem*,int)), + this, SLOT(openFile(QTreeWidgetItem*))); +} + +void FindFileDialog::createLabels() +{ + directoryLabel = new QLabel(tr("Search in:")); + fileNameLabel = new QLabel(tr("File name (including wildcards):")); +} + +void FindFileDialog::createLayout() +{ + QHBoxLayout *fileLayout = new QHBoxLayout; + fileLayout->addWidget(fileNameLabel); + fileLayout->addWidget(fileNameComboBox); + + QHBoxLayout *directoryLayout = new QHBoxLayout; + directoryLayout->addWidget(directoryLabel); + directoryLayout->addWidget(directoryComboBox); + directoryLayout->addWidget(browseButton); + + QVBoxLayout *mainLayout = new QVBoxLayout; + mainLayout->addLayout(fileLayout); + mainLayout->addLayout(directoryLayout); + mainLayout->addWidget(foundFilesTree); + mainLayout->addStretch(); + mainLayout->addWidget(buttonBox); + setLayout(mainLayout); +} diff --git a/examples/help/simpletextviewer/findfiledialog.h b/examples/help/simpletextviewer/findfiledialog.h new file mode 100644 index 000000000..71abd4aac --- /dev/null +++ b/examples/help/simpletextviewer/findfiledialog.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef FINDFILEDIALOG_H +#define FINDFILEDIALOG_H + +#include + +QT_BEGIN_NAMESPACE +class QComboBox; +class QDialogButtonBox; +class QLabel; +class QToolButton; +class QTreeWidget; +class QTreeWidgetItem; +QT_END_NAMESPACE + +class Assistant; +class TextEdit; + +//! [0] +class FindFileDialog : public QDialog +{ + Q_OBJECT + +public: + FindFileDialog(TextEdit *editor, Assistant *assistant); + +private slots: + void browse(); + void help(); + void openFile(QTreeWidgetItem *item = 0); + void update(); + +private: + void findFiles(); + void showFiles(const QStringList &files); + + void createButtons(); + void createComboBoxes(); + void createFilesTree(); + void createLabels(); + void createLayout(); + + Assistant *currentAssistant; + TextEdit *currentEditor; + QTreeWidget *foundFilesTree; + + QComboBox *directoryComboBox; + QComboBox *fileNameComboBox; + + QLabel *directoryLabel; + QLabel *fileNameLabel; + + QDialogButtonBox *buttonBox; + + QToolButton *browseButton; +}; +//! [0] + +#endif diff --git a/examples/help/simpletextviewer/main.cpp b/examples/help/simpletextviewer/main.cpp new file mode 100644 index 000000000..4c8aab9c8 --- /dev/null +++ b/examples/help/simpletextviewer/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + MainWindow window; + window.show(); + return app.exec(); +} diff --git a/examples/help/simpletextviewer/mainwindow.cpp b/examples/help/simpletextviewer/mainwindow.cpp new file mode 100644 index 000000000..61fbdf3cb --- /dev/null +++ b/examples/help/simpletextviewer/mainwindow.cpp @@ -0,0 +1,146 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "mainwindow.h" +#include "findfiledialog.h" +#include "assistant.h" +#include "textedit.h" + +// ![0] +MainWindow::MainWindow() +{ + assistant = new Assistant; +// ![0] + textViewer = new TextEdit; + textViewer->setContents(QLibraryInfo::location(QLibraryInfo::ExamplesPath) + + QLatin1String("/help/simpletextviewer/documentation/intro.html")); + setCentralWidget(textViewer); + + createActions(); + createMenus(); + + setWindowTitle(tr("Simple Text Viewer")); + resize(750, 400); +// ![1] +} +//! [1] + +//! [2] +void MainWindow::closeEvent(QCloseEvent *) +{ + delete assistant; +} +//! [2] + +void MainWindow::about() +{ + QMessageBox::about(this, tr("About Simple Text Viewer"), + tr("This example demonstrates how to use\n" + "Qt Assistant as help system for your\n" + "own application.")); +} + +//! [3] +void MainWindow::showDocumentation() +{ + assistant->showDocumentation("index.html"); +} +//! [3] + +void MainWindow::open() +{ + FindFileDialog dialog(textViewer, assistant); + dialog.exec(); +} + +//! [4] +void MainWindow::createActions() +{ + assistantAct = new QAction(tr("Help Contents"), this); + assistantAct->setShortcut(QKeySequence::HelpContents); + connect(assistantAct, SIGNAL(triggered()), this, SLOT(showDocumentation())); +//! [4] + + openAct = new QAction(tr("&Open..."), this); + openAct->setShortcut(QKeySequence::Open); + connect(openAct, SIGNAL(triggered()), this, SLOT(open())); + + clearAct = new QAction(tr("&Clear"), this); + clearAct->setShortcut(tr("Ctrl+C")); + connect(clearAct, SIGNAL(triggered()), textViewer, SLOT(clear())); + + exitAct = new QAction(tr("E&xit"), this); + exitAct->setShortcuts(QKeySequence::Quit); + connect(exitAct, SIGNAL(triggered()), this, SLOT(close())); + + aboutAct = new QAction(tr("&About"), this); + connect(aboutAct, SIGNAL(triggered()), this, SLOT(about())); + + aboutQtAct = new QAction(tr("About &Qt"), this); + connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt())); +//! [5] +} +//! [5] + +void MainWindow::createMenus() +{ + fileMenu = new QMenu(tr("&File"), this); + fileMenu->addAction(openAct); + fileMenu->addAction(clearAct); + fileMenu->addSeparator(); + fileMenu->addAction(exitAct); + + helpMenu = new QMenu(tr("&Help"), this); + helpMenu->addAction(assistantAct); + helpMenu->addSeparator(); + helpMenu->addAction(aboutAct); + helpMenu->addAction(aboutQtAct); + + + menuBar()->addMenu(fileMenu); + menuBar()->addMenu(helpMenu); +} diff --git a/examples/help/simpletextviewer/mainwindow.h b/examples/help/simpletextviewer/mainwindow.h new file mode 100644 index 000000000..4fab382f2 --- /dev/null +++ b/examples/help/simpletextviewer/mainwindow.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +class Assistant; +class TextEdit; + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + void showDocumentation(const QString &file); + +private slots: + void about(); + void showDocumentation(); + void open(); + +protected: + void closeEvent(QCloseEvent *event); + +private: + void createActions(); + void createMenus(); + + Assistant *assistant; + TextEdit *textViewer; + + QMenu *fileMenu; + QMenu *helpMenu; + + QAction *assistantAct; + QAction *clearAct; + QAction *openAct; + QAction *exitAct; + QAction *aboutAct; + QAction *aboutQtAct; +}; + +#endif diff --git a/examples/help/simpletextviewer/simpletextviewer.pro b/examples/help/simpletextviewer/simpletextviewer.pro new file mode 100644 index 000000000..46bda4cef --- /dev/null +++ b/examples/help/simpletextviewer/simpletextviewer.pro @@ -0,0 +1,18 @@ +HEADERS = mainwindow.h \ + findfiledialog.h \ + assistant.h \ + textedit.h +SOURCES = main.cpp \ + mainwindow.cpp \ + findfiledialog.cpp \ + assistant.cpp \ + textedit.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qttools/help/simpletextviewer +sources.files = $$SOURCES $$HEADERS $$RESOURCES documentation *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/qttools/help/simpletextviewer +INSTALLS += target sources + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + diff --git a/examples/help/simpletextviewer/textedit.cpp b/examples/help/simpletextviewer/textedit.cpp new file mode 100644 index 000000000..52d85b380 --- /dev/null +++ b/examples/help/simpletextviewer/textedit.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include + +#include "textedit.h" + +TextEdit::TextEdit(QWidget *parent) + : QTextEdit(parent) +{ + setReadOnly(true); +} + +void TextEdit::setContents(const QString &fileName) +{ + QFileInfo fi(fileName); + srcUrl = QUrl::fromLocalFile(fi.absoluteFilePath()); + QFile file(fileName); + if (file.open(QIODevice::ReadOnly)) { + QString data(file.readAll()); + if (fileName.endsWith(".html")) + setHtml(data); + else + setPlainText(data); + } +} + +QVariant TextEdit::loadResource(int type, const QUrl &name) +{ + if (type == QTextDocument::ImageResource) { + QFile file(srcUrl.resolved(name).toLocalFile()); + if (file.open(QIODevice::ReadOnly)) + return file.readAll(); + } + return QTextEdit::loadResource(type, name); +} diff --git a/examples/help/simpletextviewer/textedit.h b/examples/help/simpletextviewer/textedit.h new file mode 100644 index 000000000..b9ecabd1d --- /dev/null +++ b/examples/help/simpletextviewer/textedit.h @@ -0,0 +1,60 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef TEXTEDIT_H +#define TEXTEDIT_H + +#include +#include + +class TextEdit : public QTextEdit +{ + Q_OBJECT + +public: + TextEdit(QWidget *parent = 0); + void setContents(const QString &fileName); + +private: + QVariant loadResource(int type, const QUrl &name); + QUrl srcUrl; +}; + +#endif -- cgit v1.2.3