summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-04-21 18:08:36 (GMT)
committerGitHub <noreply@github.com>2022-04-21 18:08:36 (GMT)
commitd44815cabc0a8d9932df2fa95cb374eadddb7c17 (patch)
tree12cd641cbd5b32d20983b5edb7ac650ea85a434a /Doc
parent5974827c71d884bb3cc58f07a9eaefafe0cbaa6e (diff)
downloadcpython-d44815cabc0a8d9932df2fa95cb374eadddb7c17.zip
cpython-d44815cabc0a8d9932df2fa95cb374eadddb7c17.tar.gz
cpython-d44815cabc0a8d9932df2fa95cb374eadddb7c17.tar.bz2
GH-88116: Document that PyCodeNew is dangerous, and make PyCode_NewEmpty less dangerous. (GH-91790)
Diffstat (limited to 'Doc')
-rw-r--r--Doc/c-api/code.rst21
-rw-r--r--Doc/whatsnew/3.11.rst6
2 files changed, 21 insertions, 6 deletions
diff --git a/Doc/c-api/code.rst b/Doc/c-api/code.rst
index 840b842..407d8b4 100644
--- a/Doc/c-api/code.rst
+++ b/Doc/c-api/code.rst
@@ -33,24 +33,33 @@ bound into a function.
Return the number of free variables in *co*.
-.. c:function:: PyCodeObject* PyCode_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)
+.. c:function:: PyCodeObject* PyCode_New(int argcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
Return a new code object. If you need a dummy code object to create a frame,
use :c:func:`PyCode_NewEmpty` instead. Calling :c:func:`PyCode_New` directly
- can bind you to a precise Python version since the definition of the bytecode
- changes often.
+ will bind you to a precise Python version since the definition of the bytecode
+ changes often. The many arguments of this function are inter-dependent in complex
+ ways, meaning that subtle changes to values are likely to result in incorrect
+ execution or VM crashes. Use this function only with extreme care.
-.. c:function:: PyCodeObject* PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *lnotab)
+ .. versionchanged:: 3.11
+ Added ``exceptiontable`` parameter.
+
+.. c:function:: PyCodeObject* PyCode_NewWithPosOnlyArgs(int argcount, int posonlyargcount, int kwonlyargcount, int nlocals, int stacksize, int flags, PyObject *code, PyObject *consts, PyObject *names, PyObject *varnames, PyObject *freevars, PyObject *cellvars, PyObject *filename, PyObject *name, int firstlineno, PyObject *linetable, PyObject *exceptiontable)
Similar to :c:func:`PyCode_New`, but with an extra "posonlyargcount" for positional-only arguments.
+ The same caveats that apply to ``PyCode_New`` also apply to this function.
.. versionadded:: 3.8
+ .. versionchanged:: 3.11
+ Added ``exceptiontable`` parameter.
+
.. c:function:: PyCodeObject* PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno)
Return a new empty code object with the specified filename,
- function name, and first line number. It is illegal to
- :func:`exec` or :func:`eval` the resulting code object.
+ function name, and first line number. The resulting code
+ object will raise an ``Exception`` if executed.
.. c:function:: int PyCode_Addr2Line(PyCodeObject *co, int byte_offset)
diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst
index 8d74c9b..c3a8a7e 100644
--- a/Doc/whatsnew/3.11.rst
+++ b/Doc/whatsnew/3.11.rst
@@ -1159,6 +1159,12 @@ C API Changes
as its second parameter, instead of ``PyFrameObject*``.
See :pep:`523` for more details of how to use this function pointer type.
+* :c:func:`PyCode_New` and :c:func:`PyCode_NewWithPosOnlyArgs` now take
+ an additional ``exception_table`` argument.
+ Using these functions should be avoided, if at all possible.
+ To get a custom code object: create a code object using the compiler,
+ then get a modified version with the ``replace`` method.
+
New Features
------------
return; + } + QTextStream in(&file); + textEdit->setText(in.readAll()); + file.close(); + } +} + +void Notepad::save() +{ + + QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "", + tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); + + if (fileName != "") { + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly)) { + // error message + } else { + QTextStream stream(&file); + stream << textEdit->toPlainText(); + stream.flush(); + file.close(); + } + } +} + +int main(int argv, char **args) +{ + QApplication app(argv, args); + + Notepad notepad; + notepad.show(); + + return app.exec(); +} + +#include "main.moc" + diff --git a/examples/tutorials/gettingStarted/gsQt/part6/part6.pro b/examples/tutorials/gettingStarted/gsQt/part6/part6.pro new file mode 100755 index 0000000..a7861f9 --- /dev/null +++ b/examples/tutorials/gettingStarted/gsQt/part6/part6.pro @@ -0,0 +1,9 @@ + +SOURCES = main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/gettingStarted/gsQt/part6 +sources.files = $$SOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/tutorial/gettingStarted/gsQt/part6 +INSTALLS += target sources + -- cgit v0.12 From 9be58993bc60cd874068010a920706f2f2868955 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Fri, 21 Jan 2011 08:45:25 +0100 Subject: Doc: Work on GettingStartedQt tutorial Task-number: QTBUG-16609 --- doc/src/getting-started/gettingstartedqt.qdoc | 224 +++++++++++---------- examples/tutorials/gettingStarted/gsQt/gsqt.pro | 3 +- .../tutorials/gettingStarted/gsQt/part1/main.cpp | 39 ++++ .../tutorials/gettingStarted/gsQt/part2/main.cpp | 39 ++++ .../tutorials/gettingStarted/gsQt/part3/main.cpp | 39 ++++ .../tutorials/gettingStarted/gsQt/part4/main.cpp | 39 ++++ .../tutorials/gettingStarted/gsQt/part5/main.cpp | 117 +++++++---- .../tutorials/gettingStarted/gsQt/part6/main.cpp | 95 --------- .../tutorials/gettingStarted/gsQt/part6/part6.pro | 9 - 9 files changed, 344 insertions(+), 260 deletions(-) delete mode 100755 examples/tutorials/gettingStarted/gsQt/part6/main.cpp delete mode 100755 examples/tutorials/gettingStarted/gsQt/part6/part6.pro diff --git a/doc/src/getting-started/gettingstartedqt.qdoc b/doc/src/getting-started/gettingstartedqt.qdoc index 2800be0..18f85f1 100644 --- a/doc/src/getting-started/gettingstartedqt.qdoc +++ b/doc/src/getting-started/gettingstartedqt.qdoc @@ -105,12 +105,13 @@ This will leave an executable in the \c part1 directory (note that on Windows, you may have to use \c nmake instead of \c make. Also, - the executable will be placed in part1/debug or part1/release). \c - qmake is Qt's build tool, which takes a configuration file. \c - qmake generates this for us when given the \c{-project} argument. - Given the configuration file (suffixed .pro), \c qmake produces a - \c make file that will build the program for you. We will look - into writing our own \c .pro files later. + the executable will be placed in part1\\debug or part1\\release + (these directories are created when you run \c make). \c qmake is + Qt's build tool, which takes a configuration file. \c qmake + generates this for us when given the \c{-project} argument. Given + the configuration file (suffixed .pro), \c qmake produces a \c + make file that will build the program for you. We will look into + writing our own \c .pro files later. \section2 Learn More @@ -245,28 +246,28 @@ parameter types and invoke it. Line 13 declares the slot \c quit(). This is easy using the \c - slots macro. The \c quit() slot can now be connected to signals - with a matching signature (any signal that takes no parameters). + slots macro. The \c quit() slot can now be connected to signals. + We will do that later. Instead of setting up the GUI and connecting the slot in the \c main() function, we now use \c{Notepad}'s constructor. \code - Notepad::Notepad() - { - textEdit = new QTextEdit; - quitButton = new QPushButton(tr("Quit")); - - connect(quitButton, SIGNAL(clicked()), this, SLOT(quit())); - - QVBoxLayout *layout = new QVBoxLayout; - layout->addWidget(textEdit); - layout->addWidget(quitButton); - - setLayout(layout); - - setWindowTitle(tr("Notepad")); - } +20 Notepad::Notepad() +21 { +22 textEdit = new QTextEdit; +23 quitButton = new QPushButton(tr("Quit")); +24 +25 connect(quitButton, SIGNAL(clicked()), this, SLOT(quit())); +26 +27 QVBoxLayout *layout = new QVBoxLayout; +28 layout->addWidget(textEdit); +29 layout->addWidget(quitButton); +30 +31 setLayout(layout); +32 +33 setWindowTitle(tr("Notepad")); +34 } \endcode As you saw in the class definition, we use pointers to our \l @@ -277,7 +278,9 @@ visible strings. This function is necessary when you want to provide your application in more than one language (e.g. English and Chinese). We will not go into details here, but you can follow - the \c {Qt Linguist} link from the learn more table. + the \c {Qt Linguist} link from the learn more table. We will not + look at the implementation of \c quit() slot and the \c main() + function, but you can check out the source code if you want to. \section2 Learn More @@ -305,9 +308,9 @@ using \c qmake's \c -project option. \code - HEADERS = notepad.h - SOURCES = notepad.cpp \ - main.cpp + 1 HEADERS = notepad.h + 2 SOURCES = notepad.cpp \ + 3 main.cpp \endcode The following shell commands build the example. @@ -330,29 +333,29 @@ Let us look at the new \c Notepad class definition. \code - #include - - class Notepad : public QMainWindow - { - Q_OBJECT - - public: - Notepad(); - - private slots: - void open(); - void save(); - void quit(); - - private: - QTextEdit *textEdit; - - QAction *openAction; - QAction *saveAction; - QAction *exitAction; - - QMenu *fileMenu; - }; + 2 #include + 3 + 4 class Notepad : public QMainWindow + 5 { + 6 Q_OBJECT + 7 + 8 public: + 9 Notepad(); +10 +11 private slots: +12 void open(); +13 void save(); +14 void quit(); +15 +16 private: +17 QTextEdit *textEdit; +18 +19 QAction *openAction; +20 QAction *saveAction; +21 QAction *exitAction; +22 +23 QMenu *fileMenu; +24 }; \endcode We include two more slots that can save and open a document. We @@ -369,27 +372,27 @@ GUI. \code - Notepad::Notepad() - { - saveAction = new QAction(tr("&Open"), this); - saveAction = new QAction(tr("&Save"), this); - exitAction = new QAction(tr("E&xit"), this); - - connect(openAction, SIGNAL(triggered()), this, SLOT(open())); - connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); - connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); - - fileMenu = menuBar()->addMenu(tr("&File")); - fileMenu->addAction(openAction); - fileMenu->addAction(saveAction); - fileMenu->addSeparator(); - fileMenu->addAction(exitAction); - - textEdit = new QTextEdit; - setCentralWidget(textEdit); - - setWindowTitle(tr("Notepad")); - } +25 Notepad::Notepad() +26 { +27 saveAction = new QAction(tr("&Open"), this); +28 saveAction = new QAction(tr("&Save"), this); +29 exitAction = new QAction(tr("E&xit"), this); +30 +31 connect(openAction, SIGNAL(triggered()), this, SLOT(open())); +32 connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); +33 connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); +34 +35 fileMenu = menuBar()->addMenu(tr("&File")); +36 fileMenu->addAction(openAction); +37 fileMenu->addAction(saveAction); +38 fileMenu->addSeparator(); +39 fileMenu->addAction(exitAction); +40 +41 textEdit = new QTextEdit; +42 setCentralWidget(textEdit); +43 +44 setWindowTitle(tr("Notepad")); +45 } \endcode \l{QAction}s are created with the text that should appear on the @@ -426,28 +429,29 @@ We will start with the \c open() slot: \code - QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "", - tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); - - if (fileName != "") { - QFile file(fileName); - if (!file.open(QIODevice::ReadOnly)) { - QMessageBox::critical(this, tr("Error"), - tr("Could not open file")); - return; - } - QString contents = file.readAll().constData(); - textEdit->setPlainText(contents); - file.close(); - } +48 void Notepad::open() +49 { +50 QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "", +51 tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); +52 +53 if (fileName != "") { +54 QFile file(fileName); +55 if (!file.open(QIODevice::ReadOnly)) { +56 QMessageBox::critical(this, tr("Error"), tr("Could not open file")); +57 return; +58 } +59 QTextStream in(&file); +60 textEdit->setText(in.readAll()); +61 file.close(); +62 } +63 } \endcode The first step is asking the user for the name of the file to open. Qt comes with QFileDialog, which is a dialog from which the user can select a file. The image above shows the dialog on Kubuntu. The static \l{QFileDialog::}{getOpenFileName()} function - displays a modal file dialog, and does not return until the user - has selected a file. It returns the file path of the file + displays a modal file dialog. It returns the file path of the file selected, or an empty string if the user canceled the dialog. If we have a file name, we try to open the file with @@ -458,38 +462,38 @@ message (see the QMessageBox class description for further details). - Actually reading in the data is trivial using the - \l{QIODevice::}{readAll()} function, which returns all data in the - file in a QByteArray. The \l{QByteArray::}{constData()} returns all - data in the array as a const char*, which QString has a - constructor for. The contents can then be displayed in the text + Actually reading in the data is trivial using the QTextStream + class, which wraps the QFile object. The + \l{QTextStream::}{readAll()} function returns the contents of the + file as a QString. The contents can then be displayed in the text edit. We then \l{QIODevice::}{close()} the file to return the file descriptor back to the operating system. Now, let us move on to the the \c save() slot. \code - QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "", - tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); - - if (fileName != "") { - QFile file(fileName); - if (!file.open(QIODevice::WriteOnly)) { - // error message - } else { - QTextStream stream(&file); - stream << textEdit->toPlainText(); - stream.flush(); - file.close(); - } - } +65 void Notepad::save() +66 { +67 QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "", +68 tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); +69 +70 if (fileName != "") { +71 QFile file(fileName); +72 if (!file.open(QIODevice::WriteOnly)) { +73 // error message +74 } else { +75 QTextStream stream(&file); +76 stream << textEdit->toPlainText(); +77 stream.flush(); +78 file.close(); +79 } +80 } +81 } \endcode When we write the contents of the text edit to the file, we use - the QTextStream class, which wraps the QFile object. The text - stream can write QStrings directly to the file; QFile only accepts - raw data (char*) with the \l{QIODevice::}{write()} functions of - QIODevice. + the QTextStream class again. QTextStream can also write + \l{QString}s to the file with the << operator. \section2 Learn More diff --git a/examples/tutorials/gettingStarted/gsQt/gsqt.pro b/examples/tutorials/gettingStarted/gsQt/gsqt.pro index 46c4f06..72f09c1 100755 --- a/examples/tutorials/gettingStarted/gsQt/gsqt.pro +++ b/examples/tutorials/gettingStarted/gsQt/gsqt.pro @@ -4,8 +4,7 @@ SUBDIRS = part1 \ part2 \ part3 \ part4 \ - part5 \ - part6 + part5 # install sources.files = *.pro diff --git a/examples/tutorials/gettingStarted/gsQt/part1/main.cpp b/examples/tutorials/gettingStarted/gsQt/part1/main.cpp index e1eabca..eaf0425 100755 --- a/examples/tutorials/gettingStarted/gsQt/part1/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part1/main.cpp @@ -1,3 +1,42 @@ +/**************************************************************************** +** +** 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 diff --git a/examples/tutorials/gettingStarted/gsQt/part2/main.cpp b/examples/tutorials/gettingStarted/gsQt/part2/main.cpp index 2910310..24b4d77 100755 --- a/examples/tutorials/gettingStarted/gsQt/part2/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part2/main.cpp @@ -1,3 +1,42 @@ +/**************************************************************************** +** +** 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 diff --git a/examples/tutorials/gettingStarted/gsQt/part3/main.cpp b/examples/tutorials/gettingStarted/gsQt/part3/main.cpp index 238fb94..59ff9c4 100755 --- a/examples/tutorials/gettingStarted/gsQt/part3/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part3/main.cpp @@ -1,3 +1,42 @@ +/**************************************************************************** +** +** 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 diff --git a/examples/tutorials/gettingStarted/gsQt/part4/main.cpp b/examples/tutorials/gettingStarted/gsQt/part4/main.cpp index 6bc9638..ba18afb 100755 --- a/examples/tutorials/gettingStarted/gsQt/part4/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part4/main.cpp @@ -1,3 +1,42 @@ +/**************************************************************************** +** +** 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 diff --git a/examples/tutorials/gettingStarted/gsQt/part5/main.cpp b/examples/tutorials/gettingStarted/gsQt/part5/main.cpp index a97bab8..4a6257d 100755 --- a/examples/tutorials/gettingStarted/gsQt/part5/main.cpp +++ b/examples/tutorials/gettingStarted/gsQt/part5/main.cpp @@ -1,3 +1,42 @@ +/**************************************************************************** +** +** 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 @@ -9,45 +48,32 @@ public: Notepad(); private slots: - void newDocument(); - void load(); + void open(); void save(); - void documentChanged(int index); - private: QTextEdit *textEdit; - QAction *newDocumentAction; - QAction *loadAction; + QAction *openAction; QAction *saveAction; QAction *exitAction; QMenu *fileMenu; - - QDockWidget *dockWidget; - QListWidget *listWidget; - - QStringList documents; - int documentCount; }; Notepad::Notepad() { - newDocumentAction = new QAction(tr("&New"), this); - loadAction = new QAction(tr("&Load"), this); + openAction = new QAction(tr("&Load"), this); saveAction = new QAction(tr("&Save"), this); exitAction = new QAction(tr("E&xit"), this); - connect(newDocumentAction, SIGNAL(triggered()), this, SLOT(newDocument())); - connect(loadAction, SIGNAL(triggered()), this, SLOT(load())); + connect(openAction, SIGNAL(triggered()), this, SLOT(open())); connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); fileMenu = menuBar()->addMenu(tr("&File")); - fileMenu->addAction(newDocumentAction); - fileMenu->addAction(loadAction); + fileMenu->addAction(openAction); fileMenu->addAction(saveAction); fileMenu->addSeparator(); fileMenu->addAction(exitAction); @@ -55,40 +81,43 @@ Notepad::Notepad() textEdit = new QTextEdit; setCentralWidget(textEdit); - listWidget = new QListWidget; - - connect(listWidget, SIGNAL(currentRowChanged(int)), this, SLOT(documentChanged(int))); - - dockWidget = new QDockWidget; - dockWidget->setWidget(listWidget); - - addDockWidget(Qt::LeftDockWidgetArea, dockWidget); - - documentCount = 0; - newDocument(); - setWindowTitle(tr("Notepad")); } -void Notepad::documentChanged(int index) -{ - -} - -void Notepad::newDocument() +void Notepad::open() { - listWidget->addItem(tr("Document %1").arg(documentCount++)); - documents.append(""); -} - -void Notepad::load() -{ - + QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "", + tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); + + if (fileName != "") { + QFile file(fileName); + if (!file.open(QIODevice::ReadOnly)) { + QMessageBox::critical(this, tr("Error"), tr("Could not open file")); + return; + } + QTextStream in(&file); + textEdit->setText(in.readAll()); + file.close(); + } } void Notepad::save() { + QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "", + tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); + + if (fileName != "") { + QFile file(fileName); + if (!file.open(QIODevice::WriteOnly)) { + // error message + } else { + QTextStream stream(&file); + stream << textEdit->toPlainText(); + stream.flush(); + file.close(); + } + } } int main(int argv, char **args) @@ -99,7 +128,7 @@ int main(int argv, char **args) notepad.show(); return app.exec(); -}; +} #include "main.moc" diff --git a/examples/tutorials/gettingStarted/gsQt/part6/main.cpp b/examples/tutorials/gettingStarted/gsQt/part6/main.cpp deleted file mode 100755 index ef1217b..0000000 --- a/examples/tutorials/gettingStarted/gsQt/part6/main.cpp +++ /dev/null @@ -1,95 +0,0 @@ - -#include - -class Notepad : public QMainWindow -{ - Q_OBJECT - -public: - Notepad(); - -private slots: - void open(); - void save(); - -private: - QTextEdit *textEdit; - - QAction *openAction; - QAction *saveAction; - QAction *exitAction; - - QMenu *fileMenu; -}; - -Notepad::Notepad() -{ - - openAction = new QAction(tr("&Load"), this); - saveAction = new QAction(tr("&Save"), this); - exitAction = new QAction(tr("E&xit"), this); - - connect(openAction, SIGNAL(triggered()), this, SLOT(open())); - connect(saveAction, SIGNAL(triggered()), this, SLOT(save())); - connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); - - fileMenu = menuBar()->addMenu(tr("&File")); - fileMenu->addAction(openAction); - fileMenu->addAction(saveAction); - fileMenu->addSeparator(); - fileMenu->addAction(exitAction); - - textEdit = new QTextEdit; - setCentralWidget(textEdit); - - setWindowTitle(tr("Notepad")); -} - -void Notepad::open() -{ - QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "", - tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); - - if (fileName != "") { - QFile file(fileName); - if (!file.open(QIODevice::ReadOnly)) { - QMessageBox::critical(this, tr("Error"), tr("Could not open file")); - return; - } - QTextStream in(&file); - textEdit->setText(in.readAll()); - file.close(); - } -} - -void Notepad::save() -{ - - QString fileName = QFileDialog::getSaveFileName(this, tr("Save File"), "", - tr("Text Files (*.txt);;C++ Files (*.cpp *.h)")); - - if (fileName != "") { - QFile file(fileName); - if (!file.open(QIODevice::WriteOnly)) { - // error message - } else { - QTextStream stream(&file); - stream << textEdit->toPlainText(); - stream.flush(); - file.close(); - } - } -} - -int main(int argv, char **args) -{ - QApplication app(argv, args); - - Notepad notepad; - notepad.show(); - - return app.exec(); -} - -#include "main.moc" - diff --git a/examples/tutorials/gettingStarted/gsQt/part6/part6.pro b/examples/tutorials/gettingStarted/gsQt/part6/part6.pro deleted file mode 100755 index a7861f9..0000000 --- a/examples/tutorials/gettingStarted/gsQt/part6/part6.pro +++ /dev/null @@ -1,9 +0,0 @@ - -SOURCES = main.cpp - -# install -target.path = $$[QT_INSTALL_EXAMPLES]/tutorials/gettingStarted/gsQt/part6 -sources.files = $$SOURCES *.pro -sources.path = $$[QT_INSTALL_EXAMPLES]/tutorial/gettingStarted/gsQt/part6 -INSTALLS += target sources - -- cgit v0.12 From 03bba9491f361548a42c5d0110ddd69693059a25 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Fri, 21 Jan 2011 09:11:19 +0100 Subject: Doc: Said that QTimer::start() stops running timer Task-number: QTBUG-16690 --- src/corelib/kernel/qtimer.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 3efeda2..b23da3a 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -205,6 +205,9 @@ QTimer::~QTimer() Starts or restarts the timer with the timeout specified in \l interval. + If the timer is already running, it will be + \l{QTimer::stop()}{stopped} and restarted. + If \l singleShot is true, the timer will be activated only once. */ void QTimer::start() @@ -218,6 +221,12 @@ void QTimer::start() /*! Starts or restarts the timer with a timeout interval of \a msec milliseconds. + + If the timer is already running, it will be + \l{QTimer::stop()}{stopped} and restarted. + + If \l singleShot is true, the timer will be activated only once. + */ void QTimer::start(int msec) { -- cgit v0.12 From e0217bf3117b5c75400ff9a55513e0da82d9f579 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Fri, 21 Jan 2011 09:25:58 +0100 Subject: Doc: authenticationRequired() cannot use QuedConnection Task-number: QTBUG-16052 --- src/network/access/qnetworkaccessmanager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 27b7945..c870483 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -296,6 +296,10 @@ static void ensureInitialized() again, without emitting the authenticationRequired() signal. If it rejects the credentials, this signal will be emitted again. + \note It is not possible to use a QueuedConnection to connect to + this signal, as the connection will fail if the authenticator has + not been filled in with new information when the signal returns. + \sa proxyAuthenticationRequired() */ -- cgit v0.12 From 06a29fdb81a9ccb992062acf8ecd36b7e97494a3 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Fri, 21 Jan 2011 10:10:26 +0100 Subject: Doc: Mentioned the QQ Parenthesis article in two examples Task-number: QTBUG-15668 --- doc/src/examples/codeeditor.qdoc | 4 +++- doc/src/examples/syntaxhighlighter.qdoc | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/doc/src/examples/codeeditor.qdoc b/doc/src/examples/codeeditor.qdoc index 23a2fd4..c4c72c0 100644 --- a/doc/src/examples/codeeditor.qdoc +++ b/doc/src/examples/codeeditor.qdoc @@ -190,6 +190,8 @@ used to implement parenthesis matching. In the \c highlightCurrentLine(), the data of the currentBlock() can be fetched with QTextBlock::userData(). Matching parentheses can be - highlighted with an extra selection. + highlighted with an extra selection. The "Matching Parentheses + with QSyntaxHighlighter" article in Qt Quarterly 31 implements + this. You find it here: \l{http://doc.qt.nokia.com/qq/}. */ diff --git a/doc/src/examples/syntaxhighlighter.qdoc b/doc/src/examples/syntaxhighlighter.qdoc index 4018be8..2511900 100644 --- a/doc/src/examples/syntaxhighlighter.qdoc +++ b/doc/src/examples/syntaxhighlighter.qdoc @@ -239,4 +239,14 @@ function. The QSyntaxHighlighter class also provides the \l {QSyntaxHighlighter::document()}{document()} function which returns the currently set document. + + \section1 Other Code Editor Features + + It is possible to implement parenthesis matching with + QSyntaxHighlighter. The "Matching Parentheses with + QSyntaxHighlighter" article in Qt Quarterly 31 + (\l{http://doc.qt.nokia.com/qq/}) implements this. We also have + the \l{Code Editor Example}, which shows how to implement line + numbers and how to highlight the current line. + */ -- cgit v0.12 From 0142d7fc89a5eecb542a5650c4864f7581f73d83 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 10 Mar 2011 19:14:58 +0100 Subject: Doc: Added QtWebKit examples from Qt Quarterly 26 and 32. --- demos/qtdemo/xml/examples.xml | 4 +- doc/src/diagrams/webkit-webplugin.png | Bin 0 -> 70787 bytes doc/src/examples/simplewebplugin.qdoc | 181 +++++++++++ doc/src/examples/webftpclient.qdoc | 336 +++++++++++++++++++++ doc/src/examples/webplugin.qdoc | 157 ++++++++++ doc/src/getting-started/examples.qdoc | 7 + doc/src/images/webkit-webftpclient.png | Bin 0 -> 105098 bytes doc/src/images/webkit-webplugin.png | Bin 0 -> 131192 bytes examples/webkit/simplewebplugin/csvfactory.cpp | 91 ++++++ examples/webkit/simplewebplugin/csvfactory.h | 67 ++++ examples/webkit/simplewebplugin/csvview.cpp | 176 +++++++++++ examples/webkit/simplewebplugin/csvview.h | 71 +++++ examples/webkit/simplewebplugin/main.cpp | 52 ++++ examples/webkit/simplewebplugin/mainwindow.cpp | 63 ++++ examples/webkit/simplewebplugin/mainwindow.h | 54 ++++ .../webkit/simplewebplugin/simplecsvplugin.qrc | 6 + .../webkit/simplewebplugin/simplewebplugin.pro | 23 ++ examples/webkit/webftpclient/downloader.cpp | 96 ++++++ examples/webkit/webftpclient/downloader.h | 75 +++++ examples/webkit/webftpclient/ftpreply.cpp | 237 +++++++++++++++ examples/webkit/webftpclient/ftpreply.h | 81 +++++ examples/webkit/webftpclient/ftpview.cpp | 68 +++++ examples/webkit/webftpclient/ftpview.h | 58 ++++ examples/webkit/webftpclient/main.cpp | 57 ++++ .../webkit/webftpclient/networkaccessmanager.cpp | 71 +++++ .../webkit/webftpclient/networkaccessmanager.h | 57 ++++ examples/webkit/webftpclient/webftpclient.pro | 22 ++ examples/webkit/webkit.pro | 5 +- examples/webkit/webplugin/csvfactory.cpp | 98 ++++++ examples/webkit/webplugin/csvfactory.h | 67 ++++ examples/webkit/webplugin/csvplugin.qrc | 6 + examples/webkit/webplugin/csvview.cpp | 190 ++++++++++++ examples/webkit/webplugin/csvview.h | 79 +++++ examples/webkit/webplugin/main.cpp | 50 +++ examples/webkit/webplugin/mainwindow.cpp | 59 ++++ examples/webkit/webplugin/mainwindow.h | 54 ++++ examples/webkit/webplugin/webplugin.pro | 23 ++ 37 files changed, 2739 insertions(+), 2 deletions(-) create mode 100644 doc/src/diagrams/webkit-webplugin.png create mode 100644 doc/src/examples/simplewebplugin.qdoc create mode 100644 doc/src/examples/webftpclient.qdoc create mode 100644 doc/src/examples/webplugin.qdoc create mode 100644 doc/src/images/webkit-webftpclient.png create mode 100644 doc/src/images/webkit-webplugin.png create mode 100644 examples/webkit/simplewebplugin/csvfactory.cpp create mode 100644 examples/webkit/simplewebplugin/csvfactory.h create mode 100644 examples/webkit/simplewebplugin/csvview.cpp create mode 100644 examples/webkit/simplewebplugin/csvview.h create mode 100644 examples/webkit/simplewebplugin/main.cpp create mode 100644 examples/webkit/simplewebplugin/mainwindow.cpp create mode 100644 examples/webkit/simplewebplugin/mainwindow.h create mode 100644 examples/webkit/simplewebplugin/simplecsvplugin.qrc create mode 100644 examples/webkit/simplewebplugin/simplewebplugin.pro create mode 100644 examples/webkit/webftpclient/downloader.cpp create mode 100644 examples/webkit/webftpclient/downloader.h create mode 100644 examples/webkit/webftpclient/ftpreply.cpp create mode 100644 examples/webkit/webftpclient/ftpreply.h create mode 100644 examples/webkit/webftpclient/ftpview.cpp create mode 100644 examples/webkit/webftpclient/ftpview.h create mode 100644 examples/webkit/webftpclient/main.cpp create mode 100644 examples/webkit/webftpclient/networkaccessmanager.cpp create mode 100644 examples/webkit/webftpclient/networkaccessmanager.h create mode 100644 examples/webkit/webftpclient/webftpclient.pro create mode 100644 examples/webkit/webplugin/csvfactory.cpp create mode 100644 examples/webkit/webplugin/csvfactory.h create mode 100644 examples/webkit/webplugin/csvplugin.qrc create mode 100644 examples/webkit/webplugin/csvview.cpp create mode 100644 examples/webkit/webplugin/csvview.h create mode 100644 examples/webkit/webplugin/main.cpp create mode 100644 examples/webkit/webplugin/mainwindow.cpp create mode 100644 examples/webkit/webplugin/mainwindow.h create mode 100644 examples/webkit/webplugin/webplugin.pro diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml index b94d2b8..2fde945 100644 --- a/demos/qtdemo/xml/examples.xml +++ b/demos/qtdemo/xml/examples.xml @@ -25,7 +25,6 @@ - @@ -265,6 +264,9 @@ + + + diff --git a/doc/src/diagrams/webkit-webplugin.png b/doc/src/diagrams/webkit-webplugin.png new file mode 100644 index 0000000..be17fae Binary files /dev/null and b/doc/src/diagrams/webkit-webplugin.png differ diff --git a/doc/src/examples/simplewebplugin.qdoc b/doc/src/examples/simplewebplugin.qdoc new file mode 100644 index 0000000..9093b9b --- /dev/null +++ b/doc/src/examples/simplewebplugin.qdoc @@ -0,0 +1,181 @@ +/**************************************************************************** +** +** 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 documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webkit/simplewebplugin + \title Simple Web Plugin Example + + The Simple Web Plugin example shows how to embed a regular Qt widget into a + Web page displayed using QWebView. + + \image webkit-simplewebplugin.png A table widget embedded in a Web page. + + In this example, we will show how to include Qt widgets in Web-centric user + interfaces. + + \section1 QtWebKit Basics + + QtWebKit provides integration between Qt and WebKit on two different levels. + On a low level, Qt provides widgets for Web pages to be rendered onto; on a + high level, a set of classes are provided that represent all the key + components of a Web browser. + + QWebView is a widget that is used to display Web pages, QWebPage represents + the content in a page, and QWebFrame represents an individual frame in a + Web page. The code to display a Web page is very simple: + + \snippet webkitsnippets/simple/main.cpp Using QWebView + + The widget provides fundamental Web browsing features, such as Cascading + Style Sheet and JavaScript support. Other technologies can be added to + provide a more comprehensive experience. + + \section1 Adding a Widget to a Page + + Since Qt is used to render pages, it is easy to add both standard and + custom widgets to pages. All we need is some markup to indicate where a + widget is expected in a page and a mechanism that lets us know when it + needs to be created. + + The markup used involves the \c element, described in the HTML 4 + specification, which is used to include generic objects in Web pages. When + describing an object to represent a widget, there are typically three + attributes this element can have: a \c data attribute that indicates where + any relevant data can be obtained; \c width and \c height attributes can + be used to set the size of the widget on the page. + + Here's how we might describe such an object: + + \snippet examples/webkit/simplewebplugin/pages/index.html embedded object + + The mechanism used by QtWebKit to insert widgets into pages is a plugin + factory that is registered with a given WebPage instance. Factories are + subclasses of QWebPluginFactory and can be equipped to supply more than one + type of widget. + + \section1 Creating a Widget to Embed + + To demonstrate how the factory is used, we create a simple widget that can + be used to display Comma-Separated Values (CSV) files. The widget class, + \c CSVView, is just a subclass of QTableView with extra functions to set + up an internal data model. Instances of the factory class, \c CSVFactory, + are responsible for creating \c CSVView widgets and requesting data on + their behalf. + + The \c CSVFactory class is defined in the following way: + + \snippet examples/webkit/simplewebplugin/csvfactory.h plugin factory + + The public functions give a good overview of how QtWebKit will use the + factory to create widgets. We begin by looking at the factory's constructor: + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp constructor + + The factory contains a network access manager which we will use to obtain + data for each of the plugin widgets created. + + The \c plugins() function is used to report information + about the kinds of widget plugins it can create; our implementation reports + the MIME type it expects and provides a description of the plugin: + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp plugins + + The \c create() function is where most of the action happens. It is + called with a MIME type that describes the kind of data to be displayed, + a URL that refers to the data, and information about any additional + arguments that were specified in the Web page. We begin by checking the + basic MIME type information passed in the \c mimeType parameter, and only + continue if we recognize it. + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp begin create + + We construct a view widget + using the fully-specified MIME type, which is guaranteed to be in the list of + arguments if a MIME type has been supplied. + + \snippet examples/webkit/simplewebplugin/csvfactory.cpp submit request + + Lastly, we use the network access manager to request the data specified by + the \c url parameter, connecting its \c finished() signal to the view's + \c updateModel() slot so that it can collect the data. The reply object is + intentionally created on the heap; the \c finished() signal is connected to + its \c deleteLater() slot, ensuring that Qt will dispose of it when it is no + longer needed. + + The \c CSVView class provides only minor extensions to the functionality of + QTableView, with a public slot to handle incoming data and a private + variable to record exact MIME type information: + + \snippet examples/webkit/simplewebplugin/csvview.h definition + + The constructor is simply used to record the MIME type of the data: + + \snippet examples/webkit/simplewebplugin/csvview.cpp constructor + + To save space, we will only look at parts of the \c updateModel() function, + which begins by obtaining the QNetworkReply object that caused the slot + to be invoked before checking for errors: + + \snippet examples/webkit/simplewebplugin/csvview.cpp update model begin + + Assuming that the data is correct, we need to determine whether the + CSV file includes a table header, and to find out which character encoding was + used to store the data. Both these pieces of information may be included in + the complete MIME type information, so we parse this before continuing---this + is shown in the online example code. + + \snippet examples/webkit/simplewebplugin/csvview.cpp read data begin + + Since QNetworkReply is a QIODevice subclass, the reply can be read + using a suitably configured text stream, and the data fed into a standard + model. The mechanics of this can be found in the + \l{webkit/simplewebplugin/csvview.cpp}{code listing}. Here, we skip to the + end of the function where we close the reply object and set the model on + the view: + + \snippet examples/webkit/simplewebplugin/csvview.cpp update model + + Once the reply has been read, and the model populated with data, very little + needs to be done by the plugin. Ownership of the view widget is handled + elsewhere, and we have ensured that the model will be destroyed when it is + no longer needed by making it a child object of the view. + + Let's look quickly at the \c MainWindow implementation: + + \snippet examples/webkit/simplewebplugin/mainwindow.cpp constructor + + Apart from creating and setting a factory on the QWebPage object, the + most important task is to enable Web plugins. If this global setting is not + enabled, plugins will not be used and our \c elements will simply + be ignored. + + \section1 Further Reading + + The \l{Web Plugin Example} extends this example by adding a signal-slot + connection between the embedded widget and a JavaScript function in the + page. +*/ diff --git a/doc/src/examples/webftpclient.qdoc b/doc/src/examples/webftpclient.qdoc new file mode 100644 index 0000000..156dedd --- /dev/null +++ b/doc/src/examples/webftpclient.qdoc @@ -0,0 +1,336 @@ +/**************************************************************************** +** +** 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 documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webkit/webftpclient + \title Web FTP Client Example + + The Web FTP Client example shows how to add support for a new protocol + to QtWebKit-based applications. + + \image webkit-webftpclient.png An FTP client displaying the contents of the ftp.qt.nokia.com site. + + \section1 Introduction + + The QtWebKit module presents many ways to integrate the worlds of native + desktop and mobile applications and the Web, making it possible for + developers to extend and combine features found in Qt and WebKit to create + new ones. In this article, we examine the use of Qt's network access API + with WebKit and show how to turn QWebView into a simple FTP client. + + In the \l{Web Plugin Example}, we extended Qt's WebKit integration by + showing how to add custom widgets to Web pages. In the article, we used + QNetworkRequest to ask for content for display in a widget, and we obtained + the data returned by the server by reading from the corresponding + QNetworkReply. + + Qt's network access API is a technology that aims to replace much, but not + all, of the functionality provided by the QHttp and QFtp classes. + Although the network access API is a Qt-specific technology, the QtWebKit + module integrates this Qt technology with WebKit to enable customization of + the browser engine by Qt application developers. It also means that we can + control how the browser engine obtains and renders content. + + Since QNetworkRequest and QNetworkReply are designed to provide a reusable + abstraction for network operations, it seems obvious to use these classes + to add FTP support to browsers written using QtWebKit. To do this, we first + need to examine the network access classes before we see how the QtWebKit + module uses them to manage network operations. + + \section1 Network Access + + The central class in Qt's network access API is QNetworkAccessManager. + This class performs the work of dispatching requests to remote servers and + handling incoming replies. Applications typically construct an instance of + this class and use it for all high level network communication. + + Applications create QNetworkRequest objects, each of them specifying a URL + where the request is to be sent and containing meta-data that will be + understood by the server. Each request is dispatched by passing it to a + function in the network manager \mdash there are different functions + corresponding to different kinds of operations, such as + \l{QNetworkAccessManager::}{get()}, \l{QNetworkAccessManager::}{put()} and + \l{QNetworkAccessManager::}{post()}. Each of these functions returns a + QNetworkReply object which is used to obtain the content sent in the reply, + as well as any meta-data that describes it. + + The QtWebKit module provides the QWebPage class which represents the + content displayed in a QWebView widget. Behind the scenes, this class uses + a default network access manager to handle network communication. This + default manager works perfectly well for fetching content over HTTP from + \tt{http://} URLs, but only supports fetching of files over FTP when using + \tt{ftp://} URLs. + + Fortunately, QWebPage provides the \l{QWebPage::}{setNetworkAccessManager()} + function that allows the default manager to be replaced with one with more + features. This lets us add improved support for FTP quite easily if we can + write a new manager that supports \tt{ftp://} URLs. + + The process of replacing the manager and using a new one with an existing + QWebPage object can be broken up into three steps: + + \list 1 + \o Creating a new QNetworkAccessManager subclass. + \o Creating a new QNetworkReply subclass to deal with the FTP protocol. + \o Setting the new manager on the QWebPage. + \endlist + + Additionally, to provide a reasonable user experience, we should also handle + content that the browser engine cannot display. To do this, we create a + custom \c{Downloader} object. We will briefly return to this topic later. + + \section1 Creating a New Network Manager + + Replacing an existing network manager for a QWebPage is conceptually simple: + we subclass QNetworkAccessManager and reimplement its + \l{QNetworkAccessManager::}{createRequest()} function to check for URLs + with the \tt{ftp} scheme. However, we want to ensure that the manager uses + any existing cache and proxy settings that may have been set up for the + existing manager used by the QWebPage. + + To keep the existing proxy and cache, we give our network manager a + constructor that accepts the old manager as an argument. In the constructor, + we reuse the settings from the old manager. + + \snippet examples/webkit/webftpclient/networkaccessmanager.cpp constructor + + The \c{createRequest()} function is used to create and dispatch requests to + remote servers for each of the different kinds of operation that the API + presents to the developer. Since we are only interested in performing simple + fetches of resources using the \tt{ftp} scheme, we filter out other schemes + and other kinds of operation, delegating the task of handling these to the + default implementation. + + \snippet examples/webkit/webftpclient/networkaccessmanager.cpp create request + + Here, we construct and return an instance of the \c FtpReply class. This + class performs most of the work of handling the FTP protocol. + + \section1 Creating a Custom Reply + + The network access API is designed to be simple to use: we set up a request, + dispatch it using the network manager, and obtain a QNetworkReply object. + If we are not interested in the reply's meta-data, we can simply read the + data using its \l{QNetworkReply::}{readAll()} function because QNetworkReply + is a QIODevice subclass. + + In order to keep the API so simple, however, we need to perform some work + behind the scenes. In this case, that means that we must perform a series of + communications with the FTP server. Fortunately, we can use the existing + implementation provided by QFtp to perform the low level work. + + In the \c FtpReply class, we need to reimplement four functions in the + QIODevice API to ensure that it will work correctly. These functions, + \l{QIODevice::}{abort()}, \l{QIODevice::}{bytesAvailable()}, + \l{QIODevice::}{isSequential()}, \l{QIODevice::}{readData()}, + rely on the rest of the implementation to fill a QByteArray with data and + use an integer offset to track how much has been read from the device by + the browser. + + \snippet examples/webkit/webftpclient/ftpreply.h class definition + + The \c{processCommand()}, \c{processListInfo} and \c{processData()} slots + handle interaction with the FTP server. The private \c{setContent()} and + \c{setListContent()} functions are used to add meta-data to the reply and + compose HTML for the browser to display. + + Two of the private variables hold information about the data obtained from + the FTP server: \c items is updated to contain information about each + file found at a given URL, and \c content contains the raw data obtained + from the server. The \c offset variable is used to track how much data has + been read by the browser from the reply. + + In the constructor, we construct a QFtp object and connect the signals and + slots that form the basis of the interaction with the FTP server. The high + level communication is reported by the \l{QFtp::}{commandFinished()} + signal. New data from the server is reported by the + \l{QFtp::}readyRead()} signal. + Individual items in an FTP directory listing are reported by the + \l{QFtp::}{listInfo()} signal. + + \snippet examples/webkit/webftpclient/ftpreply.cpp constructor + + We also initialize the \c offset into the data that represents the number + of bytes that the browser has read from the reply. Additionally, we define + a list of units for use with the \c setListContent() function. + The last two tasks performed in the constructor are to set the URL of the + reply so that the browser can tell where it came from, and to connect to + the FTP server. + + \section2 Fetching Data from the Server + + All communication with the server is handled by the \c processCommand() + slot, which acts on responses from the server and tells us when a command + we have issued has completed. + This slot performs the task of logging in to the server when connection has + occurred (the \l{QFtp::}{ConnectToHost} command has completed), asking for + a list of files when logged in (\l{QFtp::}{Login} has completed), + preparing a page with a listing when all file information has been received + (\l{QFtp::}{List} has completed), and setting the current content for the + reply when data has been fetched from the server + (\l{QFtp::}{Get} has completed). + + \snippet examples/webkit/webftpclient/ftpreply.cpp process command + + The result of the \l{QFtp::}{List} command is handled by looking at the + number of items obtained from the server. + The items themselves are recorded by the \c processListInfo() slot. When a + \l{QFtp::}{List} command is complete, we can count the number of items + received and determine whether or not we should create a file listing, or + try to fetch the file instead by invoking a \l{QFtp::}{Get} command. + + \snippet examples/webkit/webftpclient/ftpreply.cpp process list info + + Since the reply will only be used once, we can simply append items to a list + and never bother to clear it. + + The \c processData() slot simply appends data obtained from the FTP server + to the QByteArray containing the content to be supplied to the browser. + + \snippet examples/webkit/webftpclient/ftpreply.cpp process data + + Data is appended to the \c content array until the connection to the FTP + server is closed, either by the reply or by the server itself. One of the + ways in which this happens is when a \l{QFtp::}{Get} command completes. At + this point, the \c setContent() function is called from within the + \c processCommand() function. + + \snippet examples/webkit/webftpclient/ftpreply.cpp set content + + Here, we prepare the reply for use by the browser by opening it for + unbuffered reading and setting the header that reports the amount of data + held by the reply. We emit signals that indicate that the network operation + has finished and that it has data to be read. Since we are no longer + interested in the FTP server, we close the connection to it. + + \section2 Preparing Content for the Reader + + Another way in which the reply closes the connection to the server is when + the \c setListContent() function is called from the \c processCommand() + function. Most of the implementation of this function involves transforming + the information about the items held in the reply's private \c items + variable to HTML. + + \snippet examples/webkit/webftpclient/ftpreply.cpp set list content + + Once the HTML description of the files has been composed in a QString, we + convert it to a UTF-8 encoded set of bytes which we store in the reply's + private \c content variable. In this case, the QByteArray holds HTML + instead of file data. We set the reply's headers to indicate that it + contains UTF-8 encoded HTML with a certain length, and we emit the + \l{QNetworkReply::}{readyRead()} and \l{QNetworkReply::}{finished()} + signals to let the browser know that it can start reading the content. + + \section2 Supplying Data to the Browser + + We reimplement four QIODevice functions to provide basic read-only behavior, + simply supplying the data held in the \c content array. + + We do not support aborting of the reply, so our \c abort() implementation + is empty. + + \snippet examples/webkit/webftpclient/ftpreply.cpp abort + + Similarly, we do not support random access reading, so \c isSequential() + is reimplemented to always return true. + + \snippet examples/webkit/webftpclient/ftpreply.cpp is sequential + + The \c bytesAvailable() function returns the total number of bytes held by + the reply minus the value of \c offset, which is the number of bytes we + have already supplied to the reader. + + \snippet examples/webkit/webftpclient/ftpreply.cpp bytes available + + \snippet examples/webkit/webftpclient/ftpreply.cpp read data + + The \c readData() reimplementation tries to return as much data to the + reader as it will allow, copying bytes directly to the appropriate location + in memory. The \c offset variable is updated to keep track of how many + bytes have been read. + + \section1 Enabling the Protocol + + Now that we have an FTP-enabled network manager and a reply that can handle + communication with FTP servers, we can now enable the manager for a given + QWebPage. + We derive the \c FtpView class from QWebView and configure its behavior in + its constructor. + + As we mentioned earlier, we pass the original network manager to the + newly-created manager and pass the new manager to the QWebPage belonging to + the browser. This enables our network manager for the content it displays. + + \snippet examples/webkit/webftpclient/ftpview.cpp constructor + + We also go to some effort to handle content that WebKit does not natively + support, using a \c Downloader helper class to manage this and files that + the user downloads via the browser's \gui{Save Link...} context menu entry. + + In the example's \c main() function, we perform the usual steps to + initialize our Qt application. We choose an appropriate starting URL for + the \c FtpView widget to open before running the application's event loop. + + \snippet examples/webkit/webftpclient/main.cpp main + + \section1 Summary + + As we have seen, enabling support for another protocol and URL scheme in + QtWebKit is a fairly simple process involving the creation of a network + manager and custom reply object. The implementation challenges + are mostly related to how the protocol is handled by the custom + QNetworkReply subclass where, in our case, we need to issue the appropriate + commands in the correct order to obtain data from the FTP server. + + We also need to ensure that that the reply emits the appropriate signals to + inform the browser that it has content to be read. Our implementation is + intentionally simple, only notifying the browser with the + \l{QIODevice::}{readyRead()} signal when \e all the content is ready to + read and emitting the \l{QNetworkReply::}{finished()} signal to indicate + that communication is complete; a more sophisticated approach would + interleave the commands sent to the server with the emission of signals, + allowing the browser to read content as data is obtained from the FTP + server. + + The reply also needs to be open for reading. Forgetting to call the + \l{QIODevice::}{open()} function is a common error to make when dealing + with devices, but in this case it is the reply's responsibility to open + itself. + It must indicate how much content it has for the browser to read. As we + have seen, this is done by setting the reply's + \l{QNetworkRequest::}{ContentLengthHeader} header with the appropriate + value. With this information available, the browser can read from the reply + when the content becomes available, displaying a directory listing or + downloading content depending on the type of data supplied. + + We can use the approach described in this article to enable support for + other protocols by writing or extending a network manager to handle URL + schemes such as \tt mailto, \tt sip, \tt news, \tt file and \tt ldap. + Applications that integrate Web content with information from other sources + can also provide custom URL schemes as long as care is taken not to use an + existing public scheme. +*/ diff --git a/doc/src/examples/webplugin.qdoc b/doc/src/examples/webplugin.qdoc new file mode 100644 index 0000000..0410670 --- /dev/null +++ b/doc/src/examples/webplugin.qdoc @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** 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 documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Free Documentation License +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of this +** file. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \example webkit/webplugin + \title Web Plugin Example + + The Web Plugin example shows how to communicate between a Qt widget + embedded in a Web page and the page itself. + + \image webkit-webplugin.png A table widget embedded in a Web page. + + In this example, we will take the widget described in the + \l{Simple Web Plugin Example} and show how to set up communications between + the widget and the Web environment. + + \section1 Setting up Communications + + There are two ways of interacting with the content in a Web page. The first + way involves the use of QWebElement to read and modify the page + content and structure; this is useful for certain types of application, as + demonstrated by the \l{DOM Traversal Example} and the + \l{Simple Selector Example}. + + The second way is to add Qt objects to the page, connecting their signals + to JavaScript functions, and executing the object's slots directly from + JavaScript in the page. We explore this approach in this example. + + To perform this communication, we require an updated \c CSVView widget from + the \l{Simple Web Plugin Example} that can emit a signal whenever a row is + selected, a JavaScript function to modify elements on the page, and some + glue code to make the connection. + + On the page, the plugin is declared like this: + + \snippet examples/webkit/webplugin/pages/index.html embedded object + + As in the previous example, the \c definition includes information + about the data to be displayed, its location, and the dimensions of the + plugin in the page. + + Later in the document, we include a table that we will update with data + from the \c CSVView widget: + + \snippet examples/webkit/webplugin/pages/index.html table + + The \c CSVView widget is similar to the previous version. However, we + wish to obtain and export individual rows of data, so we define the + \c rowSelected() signal and \c exportRow() slot to perform this task. + + \snippet examples/webkit/webplugin/csvview.h definition + + Since we wish to obtain one row of data at a time, the constructor includes + code to restrict how the user can interact with the view: + + \snippet examples/webkit/simplewebplugin/csvview.cpp constructor + + The \c exportRow() slot provides a convenient mechanism for obtaining and + emitting the values found on the current row of the table: + + \snippet examples/webkit/webplugin/csvview.cpp export row + + This slot is connected to a signal belonging to the view's selection model: + \l{QItemSelectionModel::}{currentChanged()}. This can be seen by examining + the \c updateModel() function in the source code. + + \c exportRow() emits the \c rowSelected() signal, passing strings containing + the name, address and quantity in the current table row. To see how this + data is passed to the Web page, we need to look at the \c CSVFactory class. + + \section1 Connecting Components Together + + In the \c CSVFactory class, we reimplement the \l{QWebPluginFactory::}{create()} + function to create instances of the \c CSVView class, as in the previous + example. + + \snippet examples/webkit/webplugin/csvfactory.cpp begin create + + We also expose the view widget to the frame in the page that + contains the elements, and set up a connection between the view and a + JavaScript function defined in the page header: + + \snippet examples/webkit/webplugin/csvfactory.cpp create connection + + The view is added to the Web page as \c view, and the connection code we + evaluate performs a signal-slot connection from the view's \c rowSelected() + signal to a pure JavaScript function: + + \js + view.rowSelected.connect(fillInTable); + \endjs + + \c fillInTable is the name of the JavaScript function to modify the + form's input elements. This function expects three arguments: the name, + address and quantity values for a row of data. + + Whenever the current row changes in the \c view object, the \c exportRow() + slot is called, the data found in the selected row is extracted from the + model and emitted in the \c rowSelected() signal as three strings, and + the above connection ensures that \c fillInTable() will be called with the + current items of data. The appropriate type conversions occur behind the + scenes to ensure that each QString is converted to a JavaScript string + object. + + The rest of the function is the same as in the previous example: + + \snippet examples/webkit/webplugin/csvfactory.cpp submit request + + We now give the JavaScript \c fillInForm() function to show what it does + with the strings it is given. The function itself is defined in the HTML + page header: + + \snippet examples/webkit/webplugin/pages/index.html script + + We obtain the elements in the page that we wish to update by using the HTML + Document Object Model (DOM) API. The values of these elements are updated + with the \c name, \c address and \c quantity strings supplied. + + \section1 Linking Things Together + + Although we have used the widgets to demonstrate the use of signals and + slots for communication between Qt components and JavaScript in the browser, + we do not need to embed widgets in Web pages to be able to do this. By + inserting objects into pages and evaluating JavaScript, Qt applications can + be made to examine and process information found online. + + One additional improvement that can be made to this example is to create + a relation between the embedded widget and the table to be updated. We + could do this by including \c elements within the \c + element that refers to the table cells by their \c id attributes. This + would help us to avoid hard-coding the \c customers_name, + \c customers_address and \c customers_quantity identifiers in the script. +*/ diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index ad97836..654eb68 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -778,6 +778,13 @@ \row \o \l{webkit/simpleselector}{Simple Selector}\raisedaster \o A basic demonstration, showing how to use QWebElement to select elements in a Web page. + \row \o \l{webkit/simplewebplugin}{Simple Web Plugin}\raisedaster + \o Shows how to embed a widget into a Web page displayed using a QWebView + widget. + \row \o \l{webkit/webftpclient}{Web FTP Client}\raisedaster + \o Shows how to add support for a new protocol to QtWebKit-based applications. + \row \o \l{webkit/webplugin}{Web Plugin}\raisedaster + \o Shows how to communicate with a widget embedded into a Web page. \endtable Examples marked with an asterisk (*) are fully documented. diff --git a/doc/src/images/webkit-webftpclient.png b/doc/src/images/webkit-webftpclient.png new file mode 100644 index 0000000..8aa7a12 Binary files /dev/null and b/doc/src/images/webkit-webftpclient.png differ diff --git a/doc/src/images/webkit-webplugin.png b/doc/src/images/webkit-webplugin.png new file mode 100644 index 0000000..1594163 Binary files /dev/null and b/doc/src/images/webkit-webplugin.png differ diff --git a/examples/webkit/simplewebplugin/csvfactory.cpp b/examples/webkit/simplewebplugin/csvfactory.cpp new file mode 100644 index 0000000..56b4558 --- /dev/null +++ b/examples/webkit/simplewebplugin/csvfactory.cpp @@ -0,0 +1,91 @@ +/**************************************************************************** +** +** 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 "csvfactory.h" +#include "csvview.h" + +//! [constructor] +CSVFactory::CSVFactory(QObject *parent) + : QWebPluginFactory(parent) +{ + manager = new QNetworkAccessManager(this); +}; +//! [constructor] + +//! [begin create] +QObject *CSVFactory::create(const QString &mimeType, const QUrl &url, + const QStringList &argumentNames, + const QStringList &argumentValues) const +{ + if (mimeType != "text/csv") + return 0; + + CSVView *view = new CSVView(argumentValues[argumentNames.indexOf("type")]); +//! [begin create] + +//! [submit request] + QNetworkRequest request(url); + QNetworkReply *reply = manager->get(request); + connect(reply, SIGNAL(finished()), view, SLOT(updateModel())); + connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater())); + + return view; +} +//! [submit request] + +//! [plugins] +QList CSVFactory::plugins() const +{ + QWebPluginFactory::MimeType mimeType; + mimeType.name = "text/csv"; + mimeType.description = "Comma-separated values"; + mimeType.fileExtensions = QStringList() << "csv"; + + QWebPluginFactory::Plugin plugin; + plugin.name = "CSV file viewer"; + plugin.description = "A CSV file Web plugin."; + plugin.mimeTypes = QList() << mimeType; + + return QList() << plugin; +} +//! [plugins] diff --git a/examples/webkit/simplewebplugin/csvfactory.h b/examples/webkit/simplewebplugin/csvfactory.h new file mode 100644 index 0000000..0b046c5 --- /dev/null +++ b/examples/webkit/simplewebplugin/csvfactory.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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 CSVFACTORY_H +#define CSVFACTORY_H + +#include +#include + +class QNetworkAccessManager; +class QNetworkReply; + +//! [plugin factory] +class CSVFactory : public QWebPluginFactory +{ + Q_OBJECT + +public: + CSVFactory(QObject *parent = 0); + QObject *create(const QString &mimeType, const QUrl &url, + const QStringList &argumentNames, + const QStringList &argumentValues) const; + QList plugins() const; + +private: + QNetworkAccessManager *manager; +}; +//! [plugin factory] + +#endif diff --git a/examples/webkit/simplewebplugin/csvview.cpp b/examples/webkit/simplewebplugin/csvview.cpp new file mode 100644 index 0000000..0a3eff7 --- /dev/null +++ b/examples/webkit/simplewebplugin/csvview.cpp @@ -0,0 +1,176 @@ +/**************************************************************************** +** +** 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 "csvview.h" + +//! [constructor] +CSVView::CSVView(const QString &mimeType, QWidget *parent) + : QTableView(parent) +{ + this->mimeType = mimeType; +} +//! [constructor] + +//! [update model begin] +void CSVView::updateModel() +{ + QNetworkReply *reply = static_cast(sender()); + + if (reply->error() != QNetworkReply::NoError) + return; + + bool hasHeader = false; + QString charset = "latin1"; +//! [update model begin] + + foreach (QString piece, mimeType.split(";")) { + piece = piece.trimmed(); + if (piece.contains("=")) { + int index = piece.indexOf("="); + QString left = piece.left(index).trimmed(); + QString right = piece.mid(index + 1).trimmed(); + if (left == "header") + hasHeader = (right == "present"); + else if (left == "charset") + charset = right; + } + } + +//! [read data begin] + QTextStream stream(reply); + stream.setCodec(QTextCodec::codecForName(charset.toLatin1())); + + QStandardItemModel *model = new QStandardItemModel(this); +//! [read data begin] + QList items; + bool firstLine = hasHeader; + bool wasQuote = false; + bool wasCR = false; + bool quoted = false; + QString text; + + while (!stream.atEnd()) { + + QString ch = stream.read(1); + + if (wasQuote) { + if (ch == "\"") { + if (quoted) { + text += ch; // quoted "" are inserted as " + wasQuote = false; // no quotes are pending + } else { + quoted = true; // unquoted "" starts quoting + wasQuote = true; // with a pending quote + } + continue; // process the next character + + } else { + quoted = !quoted; // process the pending quote + wasQuote = false; // no quotes are pending + } // process the current character + + } else if (wasCR) { + wasCR = false; + + if (ch == "\n") { // CR LF represents the end of a row + if (!text.isEmpty()) + items.append(new QStandardItem(QString(text))); + + addRow(firstLine, model, items); + items.clear(); + text = ""; + firstLine = false; + continue; // process the next character + } else + text += "\r"; // CR on its own is inserted + } // process the current character + + // wasQuote is never true here. + // wasCR is never true here. + + if (ch == "\"") + wasQuote = true; // handle the pending quote later + + else if (ch == ",") { + if (quoted) + text += ch; + else { + items.append(new QStandardItem(QString(text))); + text = ""; + } + } + + else if (ch == "\r") { + if (!quoted) + wasCR = true; + else + text += ch; + } + + else if (ch == "\n") + text += ch; + else + text += ch; + + } + + if (items.count() > 0) + addRow(firstLine, model, items); + +//! [update model] + reply->close(); + + setModel(model); + resizeColumnsToContents(); + horizontalHeader()->setStretchLastSection(true); +} +//! [update model] + +void CSVView::addRow(bool firstLine, QStandardItemModel *model, + const QList &items) +{ + if (firstLine) { + for (int j = 0; j < items.count(); ++j) + model->setHorizontalHeaderItem(j, items[j]); + } else + model->appendRow(items); +} diff --git a/examples/webkit/simplewebplugin/csvview.h b/examples/webkit/simplewebplugin/csvview.h new file mode 100644 index 0000000..0a136f3 --- /dev/null +++ b/examples/webkit/simplewebplugin/csvview.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** 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 CSVVIEW_H +#define CSVVIEW_H + +#include +#include +#include +#include + +class QNetworkAccessManager; +class QNetworkReply; + +//! [definition] +class CSVView : public QTableView +{ + Q_OBJECT + +public: + CSVView(const QString &mimeType, QWidget *parent = 0); + +public slots: + void updateModel(); + +private: + void addRow(bool firstLine, QStandardItemModel *model, + const QList &items); + + QString mimeType; +}; +//! [definition] + +#endif diff --git a/examples/webkit/simplewebplugin/main.cpp b/examples/webkit/simplewebplugin/main.cpp new file mode 100644 index 0000000..8e823b1 --- /dev/null +++ b/examples/webkit/simplewebplugin/main.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** 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" + +//! [main] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + MainWindow window; + window.show(); + return app.exec(); +} +//! [main] diff --git a/examples/webkit/simplewebplugin/mainwindow.cpp b/examples/webkit/simplewebplugin/mainwindow.cpp new file mode 100644 index 0000000..60bdd8b --- /dev/null +++ b/examples/webkit/simplewebplugin/mainwindow.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** 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 "csvfactory.h" +#include "mainwindow.h" + +//! [constructor] +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + QWebSettings::globalSettings()->setAttribute( + QWebSettings::PluginsEnabled, true); + + QWebView *webView = new QWebView; + CSVFactory *factory = new CSVFactory(this); + webView->page()->setPluginFactory(factory); + QFile file(":/pages/index.html"); + file.open(QFile::ReadOnly); + webView->setHtml(file.readAll()); + + setCentralWidget(webView); + setWindowTitle(tr("Simple Web Plugin Example")); +} +//! [constructor] diff --git a/examples/webkit/simplewebplugin/mainwindow.h b/examples/webkit/simplewebplugin/mainwindow.h new file mode 100644 index 0000000..12c8306 --- /dev/null +++ b/examples/webkit/simplewebplugin/mainwindow.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** 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 MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); +}; + +#endif diff --git a/examples/webkit/simplewebplugin/simplecsvplugin.qrc b/examples/webkit/simplewebplugin/simplecsvplugin.qrc new file mode 100644 index 0000000..14f80e7 --- /dev/null +++ b/examples/webkit/simplewebplugin/simplecsvplugin.qrc @@ -0,0 +1,6 @@ + + + pages/index.html + data/accounts.csv + + diff --git a/examples/webkit/simplewebplugin/simplewebplugin.pro b/examples/webkit/simplewebplugin/simplewebplugin.pro new file mode 100644 index 0000000..c3f5a9b --- /dev/null +++ b/examples/webkit/simplewebplugin/simplewebplugin.pro @@ -0,0 +1,23 @@ +QT += webkit network + +HEADERS = csvfactory.h \ + csvview.h \ + mainwindow.h + +SOURCES = csvfactory.cpp \ + csvview.cpp \ + main.cpp \ + mainwindow.cpp + +RESOURCES = simplecsvplugin.qrc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/webkit/simplewebplugin +sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/simplewebplugin +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000EFFF + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/webkit/webftpclient/downloader.cpp b/examples/webkit/webftpclient/downloader.cpp new file mode 100644 index 0000000..7185852 --- /dev/null +++ b/examples/webkit/webftpclient/downloader.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** 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 "downloader.h" + +Downloader::Downloader(QWidget *parentWidget, QNetworkAccessManager *manager) + : QObject(parentWidget), manager(manager), parentWidget(parentWidget) +{ +} + +QString Downloader::chooseSaveFile(const QUrl &url) +{ + QString fileName = url.path().split("/").last(); + if (!path.isEmpty()) + fileName = QDir(path).filePath(fileName); + + return QFileDialog::getSaveFileName(parentWidget, tr("Save File"), fileName); +} + +void Downloader::startDownload(const QNetworkRequest &request) +{ + downloads[request.url().toString()] = chooseSaveFile(request.url()); + + QNetworkReply *reply = manager->get(request); + connect(reply, SIGNAL(finished()), this, SLOT(finishDownload())); +} + +void Downloader::saveFile(QNetworkReply *reply) +{ + QString newPath = downloads[reply->url().toString()]; + + if (newPath.isEmpty()) + newPath = chooseSaveFile(reply->url()); + + if (!newPath.isEmpty()) { + QFile file(newPath); + if (file.open(QIODevice::WriteOnly)) { + file.write(reply->readAll()); + file.close(); + path = QDir(newPath).dirName(); + QMessageBox::information(parentWidget, tr("Download Completed"), + tr("Saved '%1'.").arg(newPath)); + } else + QMessageBox::warning(parentWidget, tr("Download Failed"), + tr("Failed to save the file.")); + } +} + +void Downloader::finishDownload() +{ + QNetworkReply *reply = static_cast(sender()); + saveFile(reply); + downloads.remove(reply->url().toString()); + reply->deleteLater(); +} diff --git a/examples/webkit/webftpclient/downloader.h b/examples/webkit/webftpclient/downloader.h new file mode 100644 index 0000000..abbd231 --- /dev/null +++ b/examples/webkit/webftpclient/downloader.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** 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 DOWNLOADER_H +#define DOWNLOADER_H + +#include +#include +#include +#include + +class QNetworkAccessManager; +class QNetworkRequest; +class QNetworkReply; +class QWidget; + +class Downloader : public QObject +{ + Q_OBJECT + +public: + Downloader(QWidget *parentWidget, QNetworkAccessManager *manager); + +public slots: + QString chooseSaveFile(const QUrl &url); + void startDownload(const QNetworkRequest &request); + void saveFile(QNetworkReply *reply); + void finishDownload(); + +private: + QNetworkAccessManager *manager; + QNetworkReply *reply; + QHash downloads; + QString path; + QWidget *parentWidget; +}; + +#endif diff --git a/examples/webkit/webftpclient/ftpreply.cpp b/examples/webkit/webftpclient/ftpreply.cpp new file mode 100644 index 0000000..d3b7aa7 --- /dev/null +++ b/examples/webkit/webftpclient/ftpreply.cpp @@ -0,0 +1,237 @@ +/**************************************************************************** +** +** 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 "ftpreply.h" + +//! [constructor] +FtpReply::FtpReply(const QUrl &url) + : QNetworkReply() +{ + ftp = new QFtp(this); + connect(ftp, SIGNAL(listInfo(QUrlInfo)), this, SLOT(processListInfo(QUrlInfo))); + connect(ftp, SIGNAL(readyRead()), this, SLOT(processData())); + connect(ftp, SIGNAL(commandFinished(int, bool)), this, SLOT(processCommand(int, bool))); + + offset = 0; + units = QStringList() << tr("bytes") << tr("K") << tr("M") << tr("G") + << tr("Ti") << tr("Pi") << tr("Ei") << tr("Zi") + << tr("Yi"); + + setUrl(url); + ftp->connectToHost(url.host()); +} +//! [constructor] + +//! [process command] +void FtpReply::processCommand(int, bool err) +{ + if (err) { + setError(ContentNotFoundError, tr("Unknown command")); + emit error(ContentNotFoundError); + return; + } + + switch (ftp->currentCommand()) { + case QFtp::ConnectToHost: + ftp->login(); + break; + + case QFtp::Login: + ftp->list(url().path()); + break; + + case QFtp::List: + if (items.size() == 1) + ftp->get(url().path()); + else + setListContent(); + break; + + case QFtp::Get: + setContent(); + + default: + ; + } +} +//! [process command] + +//! [process list info] +void FtpReply::processListInfo(const QUrlInfo &urlInfo) +{ + items.append(urlInfo); +} +//! [process list info] + +//! [process data] +void FtpReply::processData() +{ + content += ftp->readAll(); +} +//! [process data] + +//! [set content] +void FtpReply::setContent() +{ + open(ReadOnly | Unbuffered); + setHeader(QNetworkRequest::ContentLengthHeader, QVariant(content.size())); + emit readyRead(); + emit finished(); + ftp->close(); +} +//! [set content] + +//! [set list content] +void FtpReply::setListContent() +{ + QUrl u = url(); + if (!u.path().endsWith("/")) + u.setPath(u.path() + "/"); + + QString base_url = url().toString(); + QString base_path = u.path(); + + open(ReadOnly | Unbuffered); + QString content( + "\n" + "\n" + " " + Qt::escape(base_url) + "\n" + " \n" + "\n\n" + "\n" + "

" + tr("Listing for %1").arg(base_path) + "

\n\n" + "\n" + "\n"); + + QUrl parent = u.resolved(QUrl("..")); + + if (parent.isParentOf(u)) + + content += QString("\n"); + + int i = 0; + foreach (const QUrlInfo &item, items) { + + QUrl child = u.resolved(QUrl(item.name())); + + if (i == 0) + content += QString(""); + else + content += QString(""); + + content += QString(""); + + qint64 size = item.size(); + int unit = 0; + while (size) { + qint64 new_size = size/1024; + if (new_size && unit < units.size()) { + size = new_size; + unit += 1; + } else + break; + } + + if (item.isFile()) + content += QString("\n"); + else + content += QString("\n"); + + i = 1 - i; + } + + content += QString("
NameSize
" + + tr("Parent directory") + "
" + + Qt::escape(item.name()) + "" + QString::number(size) + " " + + units[unit] + "
\n" + "\n" + "\n"); + + this->content = content.toUtf8(); + + setHeader(QNetworkRequest::ContentTypeHeader, QVariant("text/html; charset=UTF-8")); + setHeader(QNetworkRequest::ContentLengthHeader, QVariant(this->content.size())); + emit readyRead(); + emit finished(); + ftp->close(); +} +//! [set list content] + +// QIODevice methods + +//! [abort] +void FtpReply::abort() +{ +} +//! [abort] + +//! [bytes available] +qint64 FtpReply::bytesAvailable() const +{ + return content.size() - offset; +} +//! [bytes available] + +//! [is sequential] +bool FtpReply::isSequential() const +{ + return true; +} +//! [is sequential] + +//! [read data] +qint64 FtpReply::readData(char *data, qint64 maxSize) +{ + if (offset < content.size()) { + qint64 number = qMin(maxSize, content.size() - offset); + memcpy(data, content.constData() + offset, number); + offset += number; + return number; + } else + return -1; +} +//! [read data] diff --git a/examples/webkit/webftpclient/ftpreply.h b/examples/webkit/webftpclient/ftpreply.h new file mode 100644 index 0000000..6b73680 --- /dev/null +++ b/examples/webkit/webftpclient/ftpreply.h @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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 FTPREPLY_H +#define FTPREPLY_H + +#include +#include +#include + +class QFtp; + +//! [class definition] +class FtpReply : public QNetworkReply +{ + Q_OBJECT + +public: + FtpReply(const QUrl &url); + void abort(); + qint64 bytesAvailable() const; + bool isSequential() const; + +protected: + qint64 readData(char *data, qint64 maxSize); + +private slots: + void processCommand(int command, bool error); + void processListInfo(const QUrlInfo &urlInfo); + void processData(); + +private: + void setContent(); + void setListContent(); + + QFtp *ftp; + QList items; + QByteArray content; + qint64 offset; + QStringList units; +}; +//! [class definition] + +#endif diff --git a/examples/webkit/webftpclient/ftpview.cpp b/examples/webkit/webftpclient/ftpview.cpp new file mode 100644 index 0000000..dd3fc8a --- /dev/null +++ b/examples/webkit/webftpclient/ftpview.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 "downloader.h" +#include "ftpview.h" +#include "networkaccessmanager.h" + +//! [constructor] +FtpView::FtpView() +{ + QNetworkAccessManager *oldManager = page()->networkAccessManager(); + NetworkAccessManager *newManager = new NetworkAccessManager(oldManager, this); + page()->setNetworkAccessManager(newManager); + + page()->setForwardUnsupportedContent(true); + downloader = new Downloader(this, newManager); + + connect(page(), SIGNAL(unsupportedContent(QNetworkReply *)), + downloader, SLOT(saveFile(QNetworkReply *))); + connect(page(), SIGNAL(downloadRequested(const QNetworkRequest &)), + downloader, SLOT(startDownload(const QNetworkRequest &))); + + connect(this, SIGNAL(urlChanged(const QUrl &)), + this, SLOT(updateWindowTitle(const QUrl &))); +} +//! [constructor] + +void FtpView::updateWindowTitle(const QUrl &url) +{ + setWindowTitle(tr("FTP Client - %1").arg(url.toString())); +} diff --git a/examples/webkit/webftpclient/ftpview.h b/examples/webkit/webftpclient/ftpview.h new file mode 100644 index 0000000..2538812 --- /dev/null +++ b/examples/webkit/webftpclient/ftpview.h @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** 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 + +class Downloader; +class QNetworkAccessManager; + +class FtpView : public QWebView +{ + Q_OBJECT + +public: + FtpView(); + +private slots: + void updateWindowTitle(const QUrl &url); + +private: + Downloader *downloader; +}; diff --git a/examples/webkit/webftpclient/main.cpp b/examples/webkit/webftpclient/main.cpp new file mode 100644 index 0000000..ac42e36 --- /dev/null +++ b/examples/webkit/webftpclient/main.cpp @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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 "ftpview.h" + +//! [main] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + FtpView view; + view.setUrl(QUrl("ftp://ftp.qt.nokia.com")); + view.show(); + + return app.exec(); +} +//! [main] diff --git a/examples/webkit/webftpclient/networkaccessmanager.cpp b/examples/webkit/webftpclient/networkaccessmanager.cpp new file mode 100644 index 0000000..e52c7fe --- /dev/null +++ b/examples/webkit/webftpclient/networkaccessmanager.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** 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 "networkaccessmanager.h" +#include "ftpreply.h" + +//! [constructor] +NetworkAccessManager::NetworkAccessManager(QNetworkAccessManager *manager, QObject *parent) + : QNetworkAccessManager(parent) +{ + setCache(manager->cache()); + setCookieJar(manager->cookieJar()); + setProxy(manager->proxy()); + setProxyFactory(manager->proxyFactory()); +} +//! [constructor] + +//! [create request] +QNetworkReply *NetworkAccessManager::createRequest( + QNetworkAccessManager::Operation operation, const QNetworkRequest &request, + QIODevice *device) +{ + if (request.url().scheme() != "ftp") + return QNetworkAccessManager::createRequest(operation, request, device); + + if (operation == GetOperation) + // Handle ftp:// URLs separately by creating custom QNetworkReply + // objects. + return new FtpReply(request.url()); + else + return QNetworkAccessManager::createRequest(operation, request, device); +} +//! [create request] diff --git a/examples/webkit/webftpclient/networkaccessmanager.h b/examples/webkit/webftpclient/networkaccessmanager.h new file mode 100644 index 0000000..784bf01 --- /dev/null +++ b/examples/webkit/webftpclient/networkaccessmanager.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** 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 NETWORKACCESSMANAGER_H +#define NETWORKACCESSMANAGER_H + +#include + +class NetworkAccessManager : public QNetworkAccessManager +{ + Q_OBJECT + +public: + NetworkAccessManager(QNetworkAccessManager *oldManager, QObject *parent = 0); + +protected: + QNetworkReply *createRequest(Operation operation, const QNetworkRequest &request, QIODevice *device); +}; + +#endif diff --git a/examples/webkit/webftpclient/webftpclient.pro b/examples/webkit/webftpclient/webftpclient.pro new file mode 100644 index 0000000..6c17410 --- /dev/null +++ b/examples/webkit/webftpclient/webftpclient.pro @@ -0,0 +1,22 @@ +HEADERS = downloader.h \ + ftpreply.h \ + ftpview.h \ + networkaccessmanager.h +SOURCES = downloader.cpp \ + ftpreply.cpp \ + ftpview.cpp \ + main.cpp \ + networkaccessmanager.cpp + +QT += network webkit + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/webkit/webftpclient +sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/webftpclient +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000EFEF + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} diff --git a/examples/webkit/webkit.pro b/examples/webkit/webkit.pro index 6a1d8f8..c2d96f4 100644 --- a/examples/webkit/webkit.pro +++ b/examples/webkit/webkit.pro @@ -5,7 +5,10 @@ SUBDIRS += domtraversal \ fancybrowser \ simpleselector \ imageanalyzer \ - framecapture + framecapture \ + simplewebplugin \ + webplugin \ + webftpclient contains(QT_CONFIG, openssl):SUBDIRS += googlechat diff --git a/examples/webkit/webplugin/csvfactory.cpp b/examples/webkit/webplugin/csvfactory.cpp new file mode 100644 index 0000000..b605a76 --- /dev/null +++ b/examples/webkit/webplugin/csvfactory.cpp @@ -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$ +** +****************************************************************************/ + +#include +#include +#include +#include "csvfactory.h" +#include "csvview.h" + +CSVFactory::CSVFactory(QWebView *webView, QObject *parent) + : QWebPluginFactory(parent) +{ + manager = new QNetworkAccessManager(this); + this->webView = webView; +}; + +//! [begin create] +QObject *CSVFactory::create(const QString &mimeType, const QUrl &url, + const QStringList &argumentNames, + const QStringList &argumentValues) const +{ + if (mimeType != "text/csv") + return 0; + + QHash arguments; + for (int i = 0; i < argumentNames.count(); ++i) + arguments[argumentNames[i]] = argumentValues[i]; + + CSVView *view = new CSVView(arguments["type"]); +//! [begin create] + +//! [create connection] + QWebFrame *frame = webView->page()->mainFrame(); + frame->addToJavaScriptWindowObject("view", view); + frame->evaluateJavaScript("view.rowSelected.connect(fillInTable);\n"); +//! [create connection] + +//! [submit request] + QNetworkRequest request(url); + QNetworkReply *reply = manager->get(request); + connect(reply, SIGNAL(finished()), view, SLOT(updateModel())); + connect(reply, SIGNAL(finished()), reply, SLOT(deleteLater())); + + return view; +} +//! [submit request] + +QList CSVFactory::plugins() const +{ + QWebPluginFactory::MimeType mimeType; + mimeType.name = "text/csv"; + mimeType.description = "Comma-separated values"; + mimeType.fileExtensions = QStringList() << "csv"; + + QWebPluginFactory::Plugin plugin; + plugin.name = "CSV file viewer"; + plugin.description = "A CSV file Web plugin."; + plugin.mimeTypes = QList() << mimeType; + + return QList() << plugin; +} diff --git a/examples/webkit/webplugin/csvfactory.h b/examples/webkit/webplugin/csvfactory.h new file mode 100644 index 0000000..5a44c50 --- /dev/null +++ b/examples/webkit/webplugin/csvfactory.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** 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 CSVFACTORY_H +#define CSVFACTORY_H + +#include +#include + +class QNetworkAccessManager; +class QNetworkReply; +class QWebView; + +class CSVFactory : public QWebPluginFactory +{ + Q_OBJECT + +public: + CSVFactory(QWebView *webView, QObject *parent = 0); + QObject *create(const QString &mimeType, const QUrl &url, + const QStringList &argumentNames, + const QStringList &argumentValues) const; + QList plugins() const; + +private: + QNetworkAccessManager *manager; + QWebView *webView; +}; + +#endif diff --git a/examples/webkit/webplugin/csvplugin.qrc b/examples/webkit/webplugin/csvplugin.qrc new file mode 100644 index 0000000..14f80e7 --- /dev/null +++ b/examples/webkit/webplugin/csvplugin.qrc @@ -0,0 +1,6 @@ + + + pages/index.html + data/accounts.csv + + diff --git a/examples/webkit/webplugin/csvview.cpp b/examples/webkit/webplugin/csvview.cpp new file mode 100644 index 0000000..90a1206 --- /dev/null +++ b/examples/webkit/webplugin/csvview.cpp @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** 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 "csvview.h" + +//! [constructor] +CSVView::CSVView(const QString &mimeType, QWidget *parent) + : QTableView(parent) +{ + this->mimeType = mimeType; + + setEditTriggers(NoEditTriggers); + setSelectionBehavior(SelectRows); + setSelectionMode(SingleSelection); +} +//! [constructor] + +void CSVView::updateModel() +{ + QNetworkReply *reply = static_cast(sender()); + + if (reply->error() != QNetworkReply::NoError) + return; + + bool hasHeader = false; + QString charset = "latin1"; + + foreach (QString piece, mimeType.split(";")) { + piece = piece.trimmed(); + if (piece.contains("=")) { + int index = piece.indexOf("="); + QString left = piece.left(index).trimmed(); + QString right = piece.mid(index + 1).trimmed(); + if (left == "header") + hasHeader = (right == "present"); + else if (left == "charset") + charset = right; + } + } + + QTextStream stream(reply); + stream.setCodec(QTextCodec::codecForName(charset.toLatin1())); + + QStandardItemModel *model = new QStandardItemModel(this); + QList items; + bool firstLine = hasHeader; + bool wasQuote = false; + bool wasCR = false; + bool quoted = false; + QString text; + + while (!stream.atEnd()) { + + QString ch = stream.read(1); + + if (wasQuote) { + if (ch == "\"") { + if (quoted) { + text += ch; // quoted "" are inserted as " + wasQuote = false; // no quotes are pending + } else { + quoted = true; // unquoted "" starts quoting + wasQuote = true; // with a pending quote + } + continue; // process the next character + + } else { + quoted = !quoted; // process the pending quote + wasQuote = false; // no quotes are pending + } // process the current character + + } else if (wasCR) { + wasCR = false; + + if (ch == "\n") { // CR LF represents the end of a row + if (!text.isEmpty()) + items.append(new QStandardItem(QString(text))); + + addRow(firstLine, model, items); + items.clear(); + text = ""; + firstLine = false; + continue; // process the next character + } else + text += "\r"; // CR on its own is inserted + } // process the current character + + // wasQuote is never true here. + // wasCR is never true here. + + if (ch == "\"") + wasQuote = true; // handle the pending quote later + + else if (ch == ",") { + if (quoted) + text += ch; + else { + items.append(new QStandardItem(QString(text))); + text = ""; + } + } + + else if (ch == "\r") { + if (!quoted) + wasCR = true; + else + text += ch; + } + + else if (ch == "\n") + text += ch; + else + text += ch; + + } + + if (items.count() > 0) + addRow(firstLine, model, items); + + reply->close(); + + setModel(model); + + connect(selectionModel(), + SIGNAL(currentChanged(const QModelIndex &, const QModelIndex &)), + this, SLOT(exportRow(const QModelIndex &))); + + resizeColumnsToContents(); + horizontalHeader()->setStretchLastSection(true); +} + +void CSVView::addRow(bool firstLine, QStandardItemModel *model, + const QList &items) +{ + if (firstLine) { + for (int j = 0; j < items.count(); ++j) + model->setHorizontalHeaderItem(j, items[j]); + } else + model->appendRow(items); +} + +//! [export row] +void CSVView::exportRow(const QModelIndex ¤t) +{ + QString name = model()->index(current.row(), 0).data().toString(); + QString address = model()->index(current.row(), 1).data().toString(); + QString quantity = model()->index(current.row(), 2).data().toString(); + + emit rowSelected(name, address, quantity); +} +//! [export row] diff --git a/examples/webkit/webplugin/csvview.h b/examples/webkit/webplugin/csvview.h new file mode 100644 index 0000000..bf8918b --- /dev/null +++ b/examples/webkit/webplugin/csvview.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** 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 CSVVIEW_H +#define CSVVIEW_H + +#include +#include +#include +#include + +class QNetworkAccessManager; +class QNetworkReply; +class QWebFrame; + +//! [definition] +class CSVView : public QTableView +{ + Q_OBJECT + +public: + CSVView(const QString &mimeType, QWidget *parent = 0); + +signals: + void rowSelected(const QString &name, const QString &address, + const QString &quantity); + +public slots: + void updateModel(); + +private slots: + void exportRow(const QModelIndex ¤t); + +private: + void addRow(bool firstLine, QStandardItemModel *model, + const QList &items); + + QString mimeType; +}; +//! [definition] + +#endif diff --git a/examples/webkit/webplugin/main.cpp b/examples/webkit/webplugin/main.cpp new file mode 100644 index 0000000..fd2b233 --- /dev/null +++ b/examples/webkit/webplugin/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 "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + MainWindow window; + window.show(); + return app.exec(); +} diff --git a/examples/webkit/webplugin/mainwindow.cpp b/examples/webkit/webplugin/mainwindow.cpp new file mode 100644 index 0000000..188e08f --- /dev/null +++ b/examples/webkit/webplugin/mainwindow.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** 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 "csvfactory.h" +#include "mainwindow.h" + +MainWindow::MainWindow(QWidget *parent) + : QMainWindow(parent) +{ + QWebSettings::globalSettings()->setAttribute( + QWebSettings::PluginsEnabled, true); + + QWebView *webView = new QWebView; + CSVFactory *factory = new CSVFactory(webView, this); + webView->page()->setPluginFactory(factory); + webView->setUrl(QUrl("qrc:/pages/index.html")); + + setCentralWidget(webView); + setWindowTitle(tr("Web Plugin Example")); +} diff --git a/examples/webkit/webplugin/mainwindow.h b/examples/webkit/webplugin/mainwindow.h new file mode 100644 index 0000000..12c8306 --- /dev/null +++ b/examples/webkit/webplugin/mainwindow.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** 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 MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(QWidget *parent = 0); +}; + +#endif diff --git a/examples/webkit/webplugin/webplugin.pro b/examples/webkit/webplugin/webplugin.pro new file mode 100644 index 0000000..cb5ebf3 --- /dev/null +++ b/examples/webkit/webplugin/webplugin.pro @@ -0,0 +1,23 @@ +QT += webkit network + +HEADERS = csvfactory.h \ + csvview.h \ + mainwindow.h + +SOURCES = csvfactory.cpp \ + csvview.cpp \ + main.cpp \ + mainwindow.cpp + +RESOURCES = csvplugin.qrc + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/webkit/webplugin +sources.files = $$SOURCES $$HEADERS $$RESOURCES *.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/webkit/webplugin +INSTALLS += target sources + +symbian { + TARGET.UID3 = 0xA000EFFE + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +} -- cgit v0.12 From e422151022c10878cbeb75ab32290c60542af9ed Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 14 Mar 2011 15:06:20 +0100 Subject: Doc: Fixed qdoc warnings and made minor improvements. --- src/corelib/kernel/qobject.cpp | 20 +++++++++++--------- src/gui/kernel/qactiongroup.cpp | 4 ++-- src/opengl/qglframebufferobject.cpp | 2 +- src/opengl/qglpixelbuffer.cpp | 2 +- 4 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index c6153cb..b9a4582 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2419,20 +2419,22 @@ int QObject::receivers(const char *signal) const This helper function calculates signal and method index for the given member in the specified class. - \li If member.mobj is 0 then both signalIndex and methodIndex are set to -1. + \list + \o If member.mobj is 0 then both signalIndex and methodIndex are set to -1. - \li If specified member is not a member of obj instance class (or one of + \o If specified member is not a member of obj instance class (or one of its parent classes) then both signalIndex and methodIndex are set to -1. + \endlist This function is used by QObject::connect and QObject::disconnect which are working with QMetaMethod. - \param[out] signalIndex is set to the signal index of member. If the member + \a signalIndex is set to the signal index of member. If the member specified is not signal this variable is set to -1. - \param[out] methodIndex is set to the method index of the member. If the - member is not a method of the object specified by obj param this variable - is set to -1. + \a methodIndex is set to the method index of the member. If the + member is not a method of the object specified by the \a obj argument this + variable is set to -1. */ void QMetaObjectPrivate::memberIndexes(const QObject *obj, const QMetaMethod &member, @@ -2686,9 +2688,9 @@ bool QObject::connect(const QObject *sender, const char *signal, Qt::ConnectionType type) but it uses QMetaMethod to specify signal and method. - \see connect(const QObject *sender, const char *signal, - const QObject *receiver, const char *method, - Qt::ConnectionType type) + \sa connect(const QObject *sender, const char *signal, + const QObject *receiver, const char *method, + Qt::ConnectionType type) */ bool QObject::connect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, diff --git a/src/gui/kernel/qactiongroup.cpp b/src/gui/kernel/qactiongroup.cpp index 95ea8af..20787e4 100644 --- a/src/gui/kernel/qactiongroup.cpp +++ b/src/gui/kernel/qactiongroup.cpp @@ -108,8 +108,8 @@ void QActionGroupPrivate::_q_actionHovered() \ingroup mainwindow-classes - In some situations it is useful to group actions together. For - example, if you have a \gui{Left Align} action, a \gui{Right + In some situations it is useful to group QAction objects together. + For example, if you have a \gui{Left Align} action, a \gui{Right Align} action, a \gui{Justify} action, and a \gui{Center} action, only one of these actions should be active at any one time. One simple way of achieving this is to group the actions together in diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index cda1c79..34dd13b 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -712,7 +712,7 @@ void QGLFramebufferObjectPrivate::init(QGLFramebufferObject *q, const QSize &sz, as a texture, you first need to copy from it to a regular framebuffer object using QGLContext::blitFramebuffer(). - \section Threading + \section1 Threading As of Qt 4.8, it's possible to draw into a QGLFramebufferObject using a QPainter in a separate thread. Note that OpenGL 2.0 or diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp index ec6ac4c..1d6d125 100644 --- a/src/opengl/qglpixelbuffer.cpp +++ b/src/opengl/qglpixelbuffer.cpp @@ -77,7 +77,7 @@ \endlist - \section Threading + \section1 Threading As of Qt 4.8, it's possible to render into a QGLPixelBuffer using a QPainter in a separate thread. Note that OpenGL 2.0 or OpenGL ES -- cgit v0.12 From d4024ccfa42dffd7d7139591c3e9efdf450a0913 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 14 Mar 2011 15:22:31 +0100 Subject: Doc: Updated the datastream format enum documentation. --- src/corelib/io/qdatastream.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 0361d18..56404d9 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -584,8 +584,9 @@ void QDataStream::setByteOrder(ByteOrder bo) \value Qt_4_3 Version 9 (Qt 4.3) \value Qt_4_4 Version 10 (Qt 4.4) \value Qt_4_5 Version 11 (Qt 4.5) - \value Qt_4_6 Version 12 (Qt 4.6) + \value Qt_4_6 Version 12 (Qt 4.6, Qt 4.7, Qt 4.8) \value Qt_4_7 Same as Qt_4_6. + \value Qt_4_8 Same as Qt_4_6. \sa setVersion(), version() */ -- cgit v0.12 From 3810b99b4cad52696eee9624b5c5995adb17bb39 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Mon, 7 Mar 2011 16:26:19 +0100 Subject: Doc: QtDemo now gives error message when example doc cannot be loaded Task-number: QTBUG-16004 Reviewed-by: Richard Moe Gustavsen (cherry picked from commit 07ce2c31c3e020ad7c5ea4d7cc94296b6860adac) --- demos/qtdemo/examplecontent.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/demos/qtdemo/examplecontent.cpp b/demos/qtdemo/examplecontent.cpp index 64737c3..5385259 100644 --- a/demos/qtdemo/examplecontent.cpp +++ b/demos/qtdemo/examplecontent.cpp @@ -83,8 +83,10 @@ QString ExampleContent::loadDescription() int errorLine, errorColumn; QDomDocument exampleDoc; - if (!exampleDoc.setContent(ba, false, &errorMsg, &errorLine, &errorColumn)) { - qDebug() << errorMsg << errorLine << errorColumn; + if (ba.isEmpty()) { + qDebug() << "No documentation found for" << name << "Is the documentation built?"; + } else if (!exampleDoc.setContent(ba, false, &errorMsg, &errorLine, &errorColumn)) { + qDebug() << "Error loading documentation for " << name << ": " << errorMsg << errorLine << errorColumn; } QDomNodeList paragraphs = exampleDoc.elementsByTagName("p"); -- cgit v0.12 From 7cc93f1390d5436017ce690394388aa3e78e7986 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 25 Mar 2011 14:35:50 +0100 Subject: Fixed whitespace in examples. --- examples/webkit/simplewebplugin/csvview.cpp | 2 +- examples/webkit/webftpclient/downloader.h | 2 +- examples/webkit/webftpclient/ftpreply.h | 2 +- examples/webkit/webftpclient/networkaccessmanager.h | 2 +- examples/webkit/webplugin/csvview.cpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/webkit/simplewebplugin/csvview.cpp b/examples/webkit/simplewebplugin/csvview.cpp index 0a3eff7..3d87daa 100644 --- a/examples/webkit/simplewebplugin/csvview.cpp +++ b/examples/webkit/simplewebplugin/csvview.cpp @@ -74,7 +74,7 @@ void CSVView::updateModel() charset = right; } } - + //! [read data begin] QTextStream stream(reply); stream.setCodec(QTextCodec::codecForName(charset.toLatin1())); diff --git a/examples/webkit/webftpclient/downloader.h b/examples/webkit/webftpclient/downloader.h index abbd231..8201cea 100644 --- a/examples/webkit/webftpclient/downloader.h +++ b/examples/webkit/webftpclient/downloader.h @@ -58,7 +58,7 @@ class Downloader : public QObject public: Downloader(QWidget *parentWidget, QNetworkAccessManager *manager); -public slots: +public slots: QString chooseSaveFile(const QUrl &url); void startDownload(const QNetworkRequest &request); void saveFile(QNetworkReply *reply); diff --git a/examples/webkit/webftpclient/ftpreply.h b/examples/webkit/webftpclient/ftpreply.h index 6b73680..becd4e4 100644 --- a/examples/webkit/webftpclient/ftpreply.h +++ b/examples/webkit/webftpclient/ftpreply.h @@ -75,7 +75,7 @@ private: QByteArray content; qint64 offset; QStringList units; -}; +}; //! [class definition] #endif diff --git a/examples/webkit/webftpclient/networkaccessmanager.h b/examples/webkit/webftpclient/networkaccessmanager.h index 784bf01..256ae82 100644 --- a/examples/webkit/webftpclient/networkaccessmanager.h +++ b/examples/webkit/webftpclient/networkaccessmanager.h @@ -50,7 +50,7 @@ class NetworkAccessManager : public QNetworkAccessManager public: NetworkAccessManager(QNetworkAccessManager *oldManager, QObject *parent = 0); -protected: +protected: QNetworkReply *createRequest(Operation operation, const QNetworkRequest &request, QIODevice *device); }; diff --git a/examples/webkit/webplugin/csvview.cpp b/examples/webkit/webplugin/csvview.cpp index 90a1206..0996f24 100644 --- a/examples/webkit/webplugin/csvview.cpp +++ b/examples/webkit/webplugin/csvview.cpp @@ -76,7 +76,7 @@ void CSVView::updateModel() charset = right; } } - + QTextStream stream(reply); stream.setCodec(QTextCodec::codecForName(charset.toLatin1())); -- cgit v0.12 From c4c813bd982717c643485e22bede84c0997253bb Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 13 Apr 2011 19:16:08 +0200 Subject: Added missing data files. Renamed resource files. --- examples/webkit/simplewebplugin/data/accounts.csv | 11 ++++ examples/webkit/simplewebplugin/pages/index.html | 27 +++++++++ .../webkit/simplewebplugin/simplecsvplugin.qrc | 6 -- .../webkit/simplewebplugin/simplewebplugin.pro | 2 +- examples/webkit/webplugin/csvplugin.qrc | 6 -- examples/webkit/webplugin/data/accounts.csv | 11 ++++ examples/webkit/webplugin/pages/index.html | 64 ++++++++++++++++++++++ examples/webkit/webplugin/webplugin.pro | 2 +- 8 files changed, 115 insertions(+), 14 deletions(-) create mode 100644 examples/webkit/simplewebplugin/data/accounts.csv create mode 100644 examples/webkit/simplewebplugin/pages/index.html delete mode 100644 examples/webkit/simplewebplugin/simplecsvplugin.qrc delete mode 100644 examples/webkit/webplugin/csvplugin.qrc create mode 100644 examples/webkit/webplugin/data/accounts.csv create mode 100644 examples/webkit/webplugin/pages/index.html diff --git a/examples/webkit/simplewebplugin/data/accounts.csv b/examples/webkit/simplewebplugin/data/accounts.csv new file mode 100644 index 0000000..2ea3bd6 --- /dev/null +++ b/examples/webkit/simplewebplugin/data/accounts.csv @@ -0,0 +1,11 @@ +"Name","Address","Quantity" +"Kristian Quan","123 Company Place, Big City","4" +"Matthew Rand","The Orchard, Little Village","2" +"Eirik Asaki","497 Park Skyway, Future City","29" +"Jarek Hanssen","1023 Riviera Drive, Southern Precinct","45" +"Carlos Hartmann","The Manor House, Country Estate","1" +"Bea King","Floor 201, Sun Tower, Central City","32" +"Stian Hinton","Mechanical workshop, Fishing Village, North River","0" +"Shane Bowland","P.O. Box 419, Beach Resort","1" +"Gavin Holm","19 Library Road, University Campus, near Large Town","16" +"Adrienna Randles","98 Tapestry Road, Market Town, The Shires","1" diff --git a/examples/webkit/simplewebplugin/pages/index.html b/examples/webkit/simplewebplugin/pages/index.html new file mode 100644 index 0000000..9581a8e --- /dev/null +++ b/examples/webkit/simplewebplugin/pages/index.html @@ -0,0 +1,27 @@ + + +Simple Web Plugin + + + +

Simple Web Plugin

+ +

+ This plugin displays comma-separated value (CSV) files in Web pages using + a subclass of Qt's + QTableView + widget. +

+ + + + + +

+ The above table shows some sample data rendered by the plugin. +

+ + + diff --git a/examples/webkit/simplewebplugin/simplecsvplugin.qrc b/examples/webkit/simplewebplugin/simplecsvplugin.qrc deleted file mode 100644 index 14f80e7..0000000 --- a/examples/webkit/simplewebplugin/simplecsvplugin.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - pages/index.html - data/accounts.csv - - diff --git a/examples/webkit/simplewebplugin/simplewebplugin.pro b/examples/webkit/simplewebplugin/simplewebplugin.pro index c3f5a9b..c16302d 100644 --- a/examples/webkit/simplewebplugin/simplewebplugin.pro +++ b/examples/webkit/simplewebplugin/simplewebplugin.pro @@ -9,7 +9,7 @@ SOURCES = csvfactory.cpp \ main.cpp \ mainwindow.cpp -RESOURCES = simplecsvplugin.qrc +RESOURCES = simplewebplugin.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/webkit/simplewebplugin diff --git a/examples/webkit/webplugin/csvplugin.qrc b/examples/webkit/webplugin/csvplugin.qrc deleted file mode 100644 index 14f80e7..0000000 --- a/examples/webkit/webplugin/csvplugin.qrc +++ /dev/null @@ -1,6 +0,0 @@ - - - pages/index.html - data/accounts.csv - - diff --git a/examples/webkit/webplugin/data/accounts.csv b/examples/webkit/webplugin/data/accounts.csv new file mode 100644 index 0000000..2ea3bd6 --- /dev/null +++ b/examples/webkit/webplugin/data/accounts.csv @@ -0,0 +1,11 @@ +"Name","Address","Quantity" +"Kristian Quan","123 Company Place, Big City","4" +"Matthew Rand","The Orchard, Little Village","2" +"Eirik Asaki","497 Park Skyway, Future City","29" +"Jarek Hanssen","1023 Riviera Drive, Southern Precinct","45" +"Carlos Hartmann","The Manor House, Country Estate","1" +"Bea King","Floor 201, Sun Tower, Central City","32" +"Stian Hinton","Mechanical workshop, Fishing Village, North River","0" +"Shane Bowland","P.O. Box 419, Beach Resort","1" +"Gavin Holm","19 Library Road, University Campus, near Large Town","16" +"Adrienna Randles","98 Tapestry Road, Market Town, The Shires","1" diff --git a/examples/webkit/webplugin/pages/index.html b/examples/webkit/webplugin/pages/index.html new file mode 100644 index 0000000..fe38bba --- /dev/null +++ b/examples/webkit/webplugin/pages/index.html @@ -0,0 +1,64 @@ + + +Web Plugin + + + + + + +

Web Plugin

+ +

+ This plugin displays comma-separated value (CSV) files in Web pages using + a table widget. +

+ + + + + + +

+ The table above shows some sample data rendered by the plugin. It is exposed + to this page as the view JavaScript object. +

+ +

+ The fields shown below in an HTML table can be updated by selecting a row in + the table above. A signal in the view is connected to a JavaScript function + in this page which fills in the values. +

+ +
+ + + + + + + + + + + + +
Name:
Address:
Quantity:
+ +
+ + + diff --git a/examples/webkit/webplugin/webplugin.pro b/examples/webkit/webplugin/webplugin.pro index cb5ebf3..48f48d1 100644 --- a/examples/webkit/webplugin/webplugin.pro +++ b/examples/webkit/webplugin/webplugin.pro @@ -9,7 +9,7 @@ SOURCES = csvfactory.cpp \ main.cpp \ mainwindow.cpp -RESOURCES = csvplugin.qrc +RESOURCES = webplugin.qrc # install target.path = $$[QT_INSTALL_EXAMPLES]/webkit/webplugin -- cgit v0.12 From a273359edf9308b336d1c04f1b06185dc0bc8bdd Mon Sep 17 00:00:00 2001 From: David Boddie Date: Thu, 14 Apr 2011 15:22:43 +0200 Subject: Added missing resource files. --- examples/webkit/simplewebplugin/simplewebplugin.qrc | 6 ++++++ examples/webkit/webplugin/webplugin.qrc | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 examples/webkit/simplewebplugin/simplewebplugin.qrc create mode 100644 examples/webkit/webplugin/webplugin.qrc diff --git a/examples/webkit/simplewebplugin/simplewebplugin.qrc b/examples/webkit/simplewebplugin/simplewebplugin.qrc new file mode 100644 index 0000000..14f80e7 --- /dev/null +++ b/examples/webkit/simplewebplugin/simplewebplugin.qrc @@ -0,0 +1,6 @@ + + + pages/index.html + data/accounts.csv + + diff --git a/examples/webkit/webplugin/webplugin.qrc b/examples/webkit/webplugin/webplugin.qrc new file mode 100644 index 0000000..14f80e7 --- /dev/null +++ b/examples/webkit/webplugin/webplugin.qrc @@ -0,0 +1,6 @@ + + + pages/index.html + data/accounts.csv + + -- cgit v0.12 From 664408e1046a4d412662b00f5791a9a2b19fde64 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Fri, 15 Apr 2011 15:35:00 +0200 Subject: Doc: Clarified and tidied up OpenGL overlay color documentation. Task-number: QTBUG-701 --- src/opengl/qgl.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 19858e7..2b995cc 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1997,7 +1997,7 @@ struct DDSFormat { If you're using double buffering you can swap the screen contents with the off-screen buffer using swapBuffers(). - Please note that QGLContext is not thread safe. + Please note that QGLContext is not \l{thread-safe}. */ /*! @@ -3270,18 +3270,13 @@ bool QGLContext::areSharing(const QGLContext *context1, const QGLContext *contex \fn QColor QGLContext::overlayTransparentColor() const If this context is a valid context in an overlay plane, returns - the plane's transparent color. Otherwise returns an \link - QColor::isValid() invalid \endlink color. - - The returned color's \link QColor::pixel() pixel \endlink value is - the index of the transparent color in the colormap of the overlay - plane. (Naturally, the color's RGB values are meaningless.) + the plane's transparent color. Otherwise returns an + \{QColor::isValid()}{invalid} color. The returned QColor object will generally work as expected only when passed as the argument to QGLWidget::qglColor() or QGLWidget::qglClearColor(). Under certain circumstances it can - also be used to draw transparent graphics with a QPainter. See the - examples/opengl/overlay_x11 example for details. + also be used to draw transparent graphics with a QPainter. */ -- cgit v0.12 From 4e8672c87bd7e740b01ca29a2a3c8ba902ed664b Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 18 Apr 2011 15:21:15 +0200 Subject: Doc: Fixed incorrect inline snippet for an example .sci file. Task-number: QTBUG-18812 --- .../graphicsitems/qdeclarativeborderimage.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index 8f37e90..892d146 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -240,22 +240,20 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage() BorderImage can handle any image format supported by Qt, loaded from any URL scheme supported by Qt. - It can also handle .sci files, which are a QML-specific format. A .sci - file uses a simple text-based format that specifies the borders, the - image file and the tile rules. + This property can also be used to refer to .sci files, which are + written in a QML-specific, text-based format that specifies the + borders, the image file and the tile rules for a given border image. The following .sci file sets the borders to 10 on each side for the image \c picture.png: - \qml - BorderImage { - border.left: 10 - border.top: 10 - border.bottom: 10 - border.right: 10 - source: "picture.png" - } - \endqml + \code + border.left: 10 + border.top: 10 + border.bottom: 10 + border.right: 10 + source: "picture.png" + \endcode The URL may be absolute, or relative to the URL of the component. -- cgit v0.12 From b1c421239ddb16a6c259af2298e0608961a1f3ba Mon Sep 17 00:00:00 2001 From: David Boddie Date: Mon, 18 Apr 2011 17:36:22 +0200 Subject: Doc: Added a note about the dll CONFIG option. Task-number: QTBUG-587 --- doc/src/development/qmake-manual.qdoc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 1c5d903..39aa606 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1214,11 +1214,12 @@ automatically be added to the project. \row \o console \o The target is a Win32 console application (app only). The proper include paths, compiler flags and libraries will - automatically be added to the - project. + automatically be added to the project. \row \o shared \o{1,3} The target is a shared object/DLL. The proper include paths, compiler flags and libraries will automatically be - added to the project. + added to the project. Note that \c dll can also be used on all platforms; + a shared library file with the appropriate suffix for the target platform + (dll, so, dylib) will be created. \row \o dll \o \row \o dylib \o \row \o static \o{1,2} The target is a static library (lib only). The proper -- cgit v0.12 From 539311f7b2687e3148ea695ce06fee768abe7b44 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 27 Apr 2011 19:16:41 +0200 Subject: Squashed commit of the changes from the mobile-examples repository (4.7-generated-declarative branch). --- .commit-template | 2 +- doc/doc.pri | 4 +- doc/src/declarative/declarativeui.qdoc | 8 + doc/src/declarative/qdeclarativemodels.qdoc | 81 ++ doc/src/declarative/qtbinding.qdoc | 4 + doc/src/declarative/qtdeclarative.qdoc | 2 +- doc/src/development/qmake-manual.qdoc | 5 + doc/src/development/qtestlib.qdoc | 4 +- doc/src/examples/broadcastreceiver.qdoc | 2 +- doc/src/examples/combowidgetmapper.qdoc | 2 +- doc/src/examples/dragdroprobot.qdoc | 2 +- doc/src/examples/elasticnodes.qdoc | 2 +- doc/src/examples/ftp.qdoc | 4 +- doc/src/examples/portedasteroids.qdoc | 5 +- doc/src/examples/portedcanvas.qdoc | 4 +- doc/src/examples/recipes.qdoc | 2 +- doc/src/examples/rsslisting.qdoc | 2 +- doc/src/examples/schema.qdoc | 4 +- doc/src/platforms/symbian-introduction.qdoc | 6 +- .../declarative/mousearea/mousearea-snippet.qml | 82 +- .../qtbinding/properties-cpp/applicationdata.h | 2 +- doc/src/tutorials/modelview.qdoc | 1 - examples/animation/animatedtiles/animatedtiles.pro | 1 + examples/animation/animatedtiles/main.cpp | 4 + examples/animation/appchooser/appchooser.pro | 1 + examples/animation/appchooser/main.cpp | 30 +- examples/animation/easing/easing.pro | 9 +- examples/animation/easing/form.ui | 95 ++- examples/animation/easing/main.cpp | 8 + examples/animation/easing/window.cpp | 7 +- examples/animation/easing/window.h | 3 - examples/animation/moveblocks/main.cpp | 41 +- examples/animation/moveblocks/moveblocks.pro | 1 + examples/animation/states/main.cpp | 38 +- examples/animation/states/states.pro | 1 + examples/animation/stickman/graphicsview.cpp | 5 +- examples/animation/stickman/graphicsview.h | 1 + examples/animation/stickman/lifecycle.cpp | 6 +- examples/animation/stickman/lifecycle.h | 3 +- examples/animation/stickman/main.cpp | 34 +- examples/animation/stickman/stickman.pro | 7 +- examples/dbus/complexpingpong/complexping.pro | 4 +- examples/dbus/complexpingpong/complexpong.pro | 4 +- examples/dbus/dbus-chat/dbus-chat.pro | 4 +- examples/dbus/dbus.pro | 1 - examples/dbus/listnames/listnames.pro | 5 +- examples/dbus/pingpong/ping.pro | 3 + examples/dbus/pingpong/pong.pro | 3 + examples/dbus/remotecontrolledcar/car/car.pro | 4 +- .../remotecontrolledcar/controller/controller.pro | 4 +- .../remotecontrolledcar/remotecontrolledcar.pro | 1 - .../declarative/animation/animation.qmlproject | 16 - .../declarative/animation/basics/basics.qmlproject | 16 - .../animation/basics/images/face-smile.png | Bin 15408 -> 0 bytes .../declarative/animation/basics/images/moon.png | Bin 2433 -> 0 bytes .../declarative/animation/basics/images/shadow.png | Bin 425 -> 0 bytes .../declarative/animation/basics/images/star.png | Bin 349 -> 0 bytes .../declarative/animation/basics/images/sun.png | Bin 8153 -> 0 bytes .../animation/behaviors/behaviors.qmlproject | 16 - .../declarative/animation/easing/content/quit.png | Bin 583 -> 0 bytes .../declarative/animation/easing/easing.qmlproject | 16 - examples/declarative/animation/states/qt-logo.png | Bin 5149 -> 0 bytes .../declarative/animation/states/states.qmlproject | 16 - .../cppextensions/imageprovider/imageprovider.pro | 1 + .../declarative/cppextensions/plugins/plugins.pro | 1 + .../cppextensions/qwidgets/qwidgets.pro | 1 + examples/declarative/examples.qmlproject | 16 - examples/declarative/i18n/i18n.qmlproject | 16 - examples/declarative/i18n/i18n/base.ts | 12 - examples/declarative/i18n/i18n/qml_en_AU.qm | Bin 81 -> 0 bytes examples/declarative/i18n/i18n/qml_en_AU.ts | 12 - examples/declarative/i18n/i18n/qml_fr.qm | Bin 85 -> 0 bytes examples/declarative/i18n/i18n/qml_fr.ts | 12 - .../borderimage/borderimage.qmlproject | 16 - .../imageelements/borderimage/content/bw.png | Bin 1357 -> 0 bytes .../borderimage/content/colors-round.sci | 7 - .../borderimage/content/colors-stretch.sci | 5 - .../imageelements/borderimage/content/colors.png | Bin 1655 -> 0 bytes .../imageelements/borderimage/content/shadow.png | Bin 588 -> 0 bytes .../imageelements/image/image.qmlproject | 16 - .../declarative/imageelements/image/qt-logo.png | Bin 5149 -> 0 bytes .../imageelements/imageelements.qmlproject | 16 - .../keyinteraction/focus/Core/images/arrow.png | Bin 583 -> 0 bytes .../keyinteraction/focus/Core/images/qt-logo.png | Bin 5149 -> 0 bytes .../keyinteraction/focus/focus.qmlproject | 16 - .../keyinteraction/keyinteraction.qmlproject | 16 - .../modelviews/gridview/gridview.qmlproject | 16 - .../modelviews/gridview/pics/AddressBook_48.png | Bin 3350 -> 0 bytes .../modelviews/gridview/pics/AudioPlayer_48.png | Bin 3806 -> 0 bytes .../modelviews/gridview/pics/Camera_48.png | Bin 3540 -> 0 bytes .../modelviews/gridview/pics/DateBook_48.png | Bin 2610 -> 0 bytes .../modelviews/gridview/pics/EMail_48.png | Bin 3655 -> 0 bytes .../modelviews/gridview/pics/TodoList_48.png | Bin 3429 -> 0 bytes .../modelviews/gridview/pics/VideoPlayer_48.png | Bin 4151 -> 0 bytes .../listview/content/pics/fruit-salad.jpg | Bin 17952 -> 0 bytes .../modelviews/listview/content/pics/hamburger.jpg | Bin 8572 -> 0 bytes .../modelviews/listview/content/pics/lemonade.jpg | Bin 6645 -> 0 bytes .../modelviews/listview/content/pics/moreDown.png | Bin 217 -> 0 bytes .../modelviews/listview/content/pics/moreUp.png | Bin 212 -> 0 bytes .../modelviews/listview/content/pics/pancakes.jpg | Bin 9163 -> 0 bytes .../listview/content/pics/vegetable-soup.jpg | Bin 8639 -> 0 bytes .../modelviews/listview/listview.qmlproject | 16 - .../declarative/modelviews/modelviews.qmlproject | 16 - .../modelviews/package/package.qmlproject | 16 - .../modelviews/pathview/pathview.qmlproject | 16 - .../modelviews/pathview/pics/AddressBook_48.png | Bin 3350 -> 0 bytes .../modelviews/pathview/pics/AudioPlayer_48.png | Bin 3806 -> 0 bytes .../modelviews/pathview/pics/Camera_48.png | Bin 3540 -> 0 bytes .../modelviews/pathview/pics/DateBook_48.png | Bin 2610 -> 0 bytes .../modelviews/pathview/pics/EMail_48.png | Bin 3655 -> 0 bytes .../modelviews/pathview/pics/TodoList_48.png | Bin 3429 -> 0 bytes .../modelviews/pathview/pics/VideoPlayer_48.png | Bin 4151 -> 0 bytes .../visualitemmodel/visualitemmodel.qmlproject | 16 - .../declarative/modelviews/webview/alerts.html | 5 - .../modelviews/webview/content/Mapping/map.html | 60 -- .../modelviews/webview/content/pics/cancel.png | Bin 1038 -> 0 bytes .../modelviews/webview/content/pics/ok.png | Bin 655 -> 0 bytes .../declarative/modelviews/webview/newwindows.html | 3 - .../modelviews/webview/webview.qmlproject | 16 - examples/declarative/positioners/add.png | Bin 810 -> 0 bytes examples/declarative/positioners/del.png | Bin 488 -> 0 bytes .../declarative/positioners/positioners.qmlproject | 18 - .../sqllocalstorage/sqllocalstorage.qmlproject | 16 - examples/declarative/text/fonts/fonts.qmlproject | 16 - .../declarative/text/fonts/fonts/tarzeau_ocr_a.ttf | Bin 24544 -> 0 bytes examples/declarative/text/text.qmlproject | 16 - .../text/textselection/pics/endHandle.png | Bin 185 -> 0 bytes .../text/textselection/pics/endHandle.sci | 5 - .../text/textselection/pics/startHandle.png | Bin 178 -> 0 bytes .../text/textselection/pics/startHandle.sci | 5 - .../text/textselection/textselection.qmlproject | 16 - .../declarative/threading/threading.qmlproject | 16 - .../touchinteraction/gestures/gestures.qmlproject | 16 - .../mousearea/mousearea.qmlproject | 16 - .../touchinteraction/touchinteraction.qmlproject | 16 - examples/declarative/toys/README | 37 - examples/declarative/toys/clocks/clocks.qmlproject | 16 - examples/declarative/toys/corkboards/cork.jpg | Bin 149337 -> 0 bytes .../toys/corkboards/corkboards.qmlproject | 16 - .../declarative/toys/corkboards/note-yellow.png | Bin 54559 -> 0 bytes examples/declarative/toys/corkboards/tack.png | Bin 7282 -> 0 bytes .../toys/dynamicscene/dynamicscene.qmlproject | 16 - examples/declarative/toys/dynamicscene/images/NOTE | 1 - .../toys/dynamicscene/images/face-smile.png | Bin 15408 -> 0 bytes .../declarative/toys/dynamicscene/images/moon.png | Bin 1757 -> 0 bytes .../toys/dynamicscene/images/rabbit_brown.png | Bin 1245 -> 0 bytes .../toys/dynamicscene/images/rabbit_bw.png | Bin 1759 -> 0 bytes .../declarative/toys/dynamicscene/images/star.png | Bin 349 -> 0 bytes .../declarative/toys/dynamicscene/images/sun.png | Bin 8153 -> 0 bytes .../toys/dynamicscene/images/tree_s.png | Bin 3406 -> 0 bytes .../toys/dynamicscene/qml/itemCreation.js | 62 -- .../toys/tic-tac-toe/content/pics/board.png | Bin 12258 -> 0 bytes .../toys/tic-tac-toe/content/pics/o.png | Bin 1470 -> 0 bytes .../toys/tic-tac-toe/content/pics/x.png | Bin 1331 -> 0 bytes .../toys/tic-tac-toe/content/tic-tac-toe.js | 149 ---- .../toys/tic-tac-toe/tic-tac-toe.qmlproject | 16 - examples/declarative/toys/toys.qmlproject | 16 - .../declarative/toys/tvtennis/tvtennis.qmlproject | 16 - .../chapter6-plugins/chapter6-plugins.pro | 1 + examples/declarative/ui-components/README | 39 - .../dialcontrol/content/background.png | Bin 35876 -> 0 bytes .../ui-components/dialcontrol/content/needle.png | Bin 342 -> 0 bytes .../dialcontrol/content/needle_shadow.png | Bin 632 -> 0 bytes .../ui-components/dialcontrol/content/overlay.png | Bin 3564 -> 0 bytes .../ui-components/dialcontrol/content/quit.png | Bin 583 -> 0 bytes .../dialcontrol/dialcontrol.qmlproject | 16 - .../ui-components/flipable/content/5_heart.png | Bin 3872 -> 0 bytes .../ui-components/flipable/content/9_club.png | Bin 6135 -> 0 bytes .../ui-components/flipable/content/back.png | Bin 1418 -> 0 bytes .../ui-components/flipable/flipable.qmlproject | 16 - .../progressbar/content/background.png | Bin 426 -> 0 bytes .../progressbar/progressbar.qmlproject | 16 - .../ui-components/scrollbar/pics/niagara_falls.jpg | Bin 604121 -> 0 bytes .../ui-components/scrollbar/scrollbar.qmlproject | 16 - .../ui-components/searchbox/images/clear.png | Bin 429 -> 0 bytes .../searchbox/images/lineedit-bg-focus.png | Bin 526 -> 0 bytes .../ui-components/searchbox/images/lineedit-bg.png | Bin 426 -> 0 bytes .../ui-components/searchbox/searchbox.qmlproject | 16 - .../slideswitch/content/background.svg | 23 - .../ui-components/slideswitch/content/knob.svg | 867 --------------------- .../slideswitch/slideswitch.qmlproject | 16 - .../ui-components/spinner/content/spinner-bg.png | Bin 345 -> 0 bytes .../spinner/content/spinner-select.png | Bin 320 -> 0 bytes .../ui-components/spinner/spinner.qmlproject | 16 - .../declarative/ui-components/tabwidget/tab.png | Bin 507 -> 0 bytes .../ui-components/tabwidget/tabwidget.qmlproject | 16 - .../ui-components/ui-components.qmlproject | 16 - examples/declarative/xml/xml.qmlproject | 16 - examples/declarative/xml/xmlhttprequest/data.xml | 5 - .../xml/xmlhttprequest/xmlhttprequest.qmlproject | 16 - .../calculatorbuilder/calculatorbuilder.pro | 4 + .../designer/calculatorform/calculatorform.pro | 5 + .../containerextension/containerextension.pro | 4 + .../customwidgetplugin/customwidgetplugin.pro | 4 + examples/designer/designer.pro | 1 - .../taskmenuextension/taskmenuextension.pro | 4 + .../worldtimeclockbuilder.pro | 4 + .../worldtimeclockplugin/worldtimeclockplugin.pro | 1 + examples/desktop/desktop.pro | 1 + examples/desktop/screenshot/screenshot.pro | 4 + examples/desktop/systray/systray.pro | 5 + examples/dialogs/classwizard/classwizard.pro | 4 + examples/dialogs/configdialog/configdialog.pro | 4 + examples/dialogs/dialogs.pro | 1 + examples/dialogs/extension/extension.pro | 2 + examples/dialogs/extension/finddialog.cpp | 45 +- examples/dialogs/extension/main.cpp | 9 +- examples/dialogs/findfiles/findfiles.pro | 1 + examples/dialogs/findfiles/main.cpp | 4 + examples/dialogs/findfiles/window.cpp | 23 +- examples/dialogs/findfiles/window.h | 4 +- examples/dialogs/licensewizard/licensewizard.pro | 4 + examples/dialogs/sipdialog/sipdialog.pro | 5 +- examples/dialogs/standarddialogs/dialog.cpp | 15 +- examples/dialogs/standarddialogs/dialog.h | 4 +- examples/dialogs/standarddialogs/main.cpp | 8 +- .../dialogs/standarddialogs/standarddialogs.pro | 1 + examples/dialogs/tabdialog/main.cpp | 8 +- examples/dialogs/tabdialog/tabdialog.cpp | 1 + examples/dialogs/tabdialog/tabdialog.pro | 3 + examples/dialogs/trivialwizard/trivialwizard.cpp | 4 + examples/dialogs/trivialwizard/trivialwizard.pro | 3 + .../delayedencoding/delayedencoding.pro | 9 +- examples/draganddrop/delayedencoding/main.cpp | 4 + .../draganddrop/delayedencoding/sourcewidget.cpp | 1 + .../draganddrop/draggableicons/draggableicons.pro | 1 + examples/draganddrop/draggableicons/dragwidget.cpp | 9 +- examples/draganddrop/draggableicons/main.cpp | 4 + .../draganddrop/draggabletext/draggabletext.pro | 2 + examples/draganddrop/draggabletext/dragwidget.cpp | 4 +- examples/draganddrop/draggabletext/main.cpp | 4 + examples/draganddrop/dropsite/dropsite.pro | 4 + examples/draganddrop/fridgemagnets/dragwidget.cpp | 4 + .../draganddrop/fridgemagnets/fridgemagnets.pro | 2 +- examples/draganddrop/fridgemagnets/main.cpp | 5 + examples/draganddrop/puzzle/main.cpp | 4 + examples/draganddrop/puzzle/mainwindow.cpp | 16 +- examples/draganddrop/puzzle/pieceslist.cpp | 6 +- examples/draganddrop/puzzle/pieceslist.h | 4 +- examples/draganddrop/puzzle/puzzle.pro | 1 + examples/draganddrop/puzzle/puzzlewidget.cpp | 26 +- examples/draganddrop/puzzle/puzzlewidget.h | 6 +- examples/effects/blurpicker/blurpicker.cpp | 32 +- examples/effects/blurpicker/blurpicker.h | 2 + examples/effects/blurpicker/blurpicker.pro | 3 + examples/effects/blurpicker/main.cpp | 5 + examples/effects/fademessage/fademessage.cpp | 11 +- examples/effects/fademessage/fademessage.pro | 4 +- examples/effects/fademessage/main.cpp | 4 + examples/effects/lighting/lighting.cpp | 6 + examples/effects/lighting/lighting.h | 3 + examples/effects/lighting/lighting.pro | 4 + examples/effects/lighting/main.cpp | 5 + examples/examples.pro | 1 - examples/gestures/imagegestures/imagegestures.pro | 4 + .../graphicsview/anchorlayout/anchorlayout.pro | 5 + examples/graphicsview/anchorlayout/main.cpp | 5 + .../basicgraphicslayouts/basicgraphicslayouts.pro | 2 + .../graphicsview/basicgraphicslayouts/main.cpp | 4 + .../graphicsview/collidingmice/collidingmice.pro | 2 + examples/graphicsview/collidingmice/main.cpp | 4 + .../graphicsview/diagramscene/diagramscene.pro | 4 + .../graphicsview/dragdroprobot/dragdroprobot.pro | 3 + examples/graphicsview/dragdroprobot/main.cpp | 24 +- examples/graphicsview/elasticnodes/edge.cpp | 2 +- .../graphicsview/elasticnodes/elasticnodes.pro | 3 + examples/graphicsview/elasticnodes/graphwidget.cpp | 29 +- examples/graphicsview/elasticnodes/graphwidget.h | 5 + examples/graphicsview/elasticnodes/main.cpp | 15 +- examples/graphicsview/elasticnodes/node.cpp | 15 +- examples/graphicsview/flowlayout/flowlayout.pro | 5 +- examples/graphicsview/flowlayout/main.cpp | 6 + examples/graphicsview/graphicsview.pro | 1 - examples/graphicsview/padnavigator/main.cpp | 5 +- .../graphicsview/padnavigator/padnavigator.pro | 3 + .../graphicsview/portedasteroids/animateditem.cpp | 11 +- .../graphicsview/portedasteroids/animateditem.h | 18 +- examples/graphicsview/portedasteroids/ledmeter.cpp | 40 +- examples/graphicsview/portedasteroids/ledmeter.h | 12 +- examples/graphicsview/portedasteroids/main.cpp | 4 + .../portedasteroids/portedasteroids.pro | 13 +- examples/graphicsview/portedasteroids/sprites.h | 2 +- examples/graphicsview/portedasteroids/toplevel.cpp | 85 +- examples/graphicsview/portedasteroids/toplevel.h | 15 +- examples/graphicsview/portedasteroids/view.cpp | 270 ++++--- examples/graphicsview/portedasteroids/view.h | 21 +- examples/graphicsview/portedcanvas/canvas.cpp | 259 +++--- examples/graphicsview/portedcanvas/canvas.h | 14 +- examples/graphicsview/portedcanvas/main.cpp | 23 +- .../graphicsview/portedcanvas/portedcanvas.pro | 4 +- examples/graphicsview/simpleanchorlayout/main.cpp | 7 + .../simpleanchorlayout/simpleanchorlayout.pro | 4 + examples/graphicsview/weatheranchorlayout/main.cpp | 23 + .../weatheranchorlayout/weatheranchorlayout.pro | 3 + .../contextsensitivehelp/contextsensitivehelp.pro | 5 + examples/help/help.pro | 1 - examples/help/remotecontrol/remotecontrol.pro | 5 + .../help/simpletextviewer/simpletextviewer.pro | 4 + examples/ipc/ipc.pro | 1 - examples/ipc/localfortuneclient/client.cpp | 5 + examples/ipc/localfortuneclient/client.h | 9 + .../ipc/localfortuneclient/localfortuneclient.pro | 4 +- examples/ipc/localfortuneclient/main.cpp | 6 +- .../ipc/localfortuneserver/localfortuneserver.pro | 3 +- examples/ipc/localfortuneserver/main.cpp | 6 +- examples/ipc/localfortuneserver/server.cpp | 5 + examples/ipc/localfortuneserver/server.h | 8 + examples/ipc/sharedmemory/sharedmemory.pro | 5 + examples/itemviews/addressbook/addressbook.pro | 2 + examples/itemviews/addressbook/main.cpp | 4 + .../basicsortfiltermodel/basicsortfiltermodel.pro | 2 + examples/itemviews/basicsortfiltermodel/main.cpp | 4 + examples/itemviews/basicsortfiltermodel/window.cpp | 41 +- examples/itemviews/basicsortfiltermodel/window.h | 6 + examples/itemviews/chart/chart.pro | 2 + examples/itemviews/chart/main.cpp | 4 + .../coloreditorfactory/coloreditorfactory.pro | 4 + examples/itemviews/coloreditorfactory/main.cpp | 4 + .../combowidgetmapper/combowidgetmapper.pro | 3 + examples/itemviews/combowidgetmapper/main.cpp | 4 + .../customsortfiltermodel.pro | 1 + examples/itemviews/customsortfiltermodel/main.cpp | 4 + .../itemviews/customsortfiltermodel/window.cpp | 62 +- examples/itemviews/customsortfiltermodel/window.h | 6 + examples/itemviews/dirview/dirview.pro | 2 + examples/itemviews/dirview/main.cpp | 4 + .../editabletreemodel/editabletreemodel.pro | 2 + examples/itemviews/editabletreemodel/main.cpp | 4 + .../itemviews/editabletreemodel/mainwindow.cpp | 5 + examples/itemviews/fetchmore/fetchmore.pro | 2 + examples/itemviews/fetchmore/main.cpp | 4 + examples/itemviews/frozencolumn/frozencolumn.pro | 3 + examples/itemviews/frozencolumn/main.cpp | 6 + examples/itemviews/itemviews.pro | 9 +- examples/itemviews/pixelator/main.cpp | 4 + examples/itemviews/pixelator/pixelator.pro | 2 + examples/itemviews/pixelator/pixeldelegate.cpp | 2 +- examples/itemviews/puzzle/main.cpp | 4 + examples/itemviews/puzzle/mainwindow.cpp | 20 +- examples/itemviews/puzzle/piecesmodel.cpp | 8 +- examples/itemviews/puzzle/piecesmodel.h | 4 +- examples/itemviews/puzzle/puzzle.pro | 2 + examples/itemviews/puzzle/puzzlewidget.cpp | 26 +- examples/itemviews/puzzle/puzzlewidget.h | 6 +- examples/itemviews/simpledommodel/main.cpp | 6 + .../itemviews/simpledommodel/simpledommodel.pro | 2 + examples/itemviews/simpletreemodel/main.cpp | 4 + .../itemviews/simpletreemodel/simpletreemodel.pro | 2 + examples/itemviews/simplewidgetmapper/main.cpp | 4 + .../simplewidgetmapper/simplewidgetmapper.pro | 2 + examples/itemviews/spinboxdelegate/main.cpp | 4 + .../itemviews/spinboxdelegate/spinboxdelegate.pro | 5 + examples/itemviews/stardelegate/main.cpp | 4 + examples/itemviews/stardelegate/stardelegate.pro | 4 + examples/ja_JP/linguist/hellotr/hellotr.pro | 2 + examples/layouts/basiclayouts/basiclayouts.pro | 5 + examples/layouts/basiclayouts/main.cpp | 8 +- examples/layouts/borderlayout/borderlayout.pro | 2 + examples/layouts/borderlayout/main.cpp | 4 + examples/layouts/dynamiclayouts/dialog.cpp | 4 + examples/layouts/dynamiclayouts/dialog.h | 5 + examples/layouts/dynamiclayouts/dynamiclayouts.pro | 5 + examples/layouts/dynamiclayouts/main.cpp | 7 +- examples/layouts/flowlayout/flowlayout.pro | 2 + examples/layouts/flowlayout/main.cpp | 4 + examples/layouts/flowlayout/window.cpp | 2 +- examples/layouts/layouts.pro | 1 - examples/linguist/arrowpad/arrowpad.pro | 5 + examples/linguist/hellotr/hellotr.pro | 5 + examples/linguist/linguist.pro | 1 - examples/linguist/trollprint/trollprint.pro | 5 + examples/mainwindows/application/application.pro | 4 + examples/mainwindows/application/main.cpp | 4 + examples/mainwindows/dockwidgets/dockwidgets.pro | 5 + examples/mainwindows/mainwindows.pro | 6 - examples/mainwindows/mdi/main.cpp | 4 + examples/mainwindows/mdi/mdi.pro | 4 + examples/mainwindows/menus/main.cpp | 4 + examples/mainwindows/menus/mainwindow.cpp | 6 + examples/mainwindows/menus/menus.pro | 3 + examples/mainwindows/recentfiles/main.cpp | 4 + examples/mainwindows/recentfiles/recentfiles.pro | 3 + examples/mainwindows/sdi/main.cpp | 4 + examples/mainwindows/sdi/sdi.pro | 4 + examples/multimedia/audiodevices/audiodevices.cpp | 4 +- examples/multimedia/audiodevices/audiodevices.pro | 2 + examples/multimedia/audioinput/audioinput.pro | 3 + examples/multimedia/audioinput/main.cpp | 4 + examples/multimedia/audiooutput/audiooutput.pro | 2 + examples/multimedia/audiooutput/main.cpp | 4 + .../videographicsitem/videographicsitem.pro | 3 + examples/multimedia/videowidget/videowidget.pro | 3 + examples/network/bearercloud/bearercloud.pro | 8 +- examples/network/bearermonitor/bearermonitor.cpp | 8 +- examples/network/bearermonitor/bearermonitor.h | 4 +- examples/network/bearermonitor/bearermonitor.pro | 9 +- .../blockingfortuneclient/blockingclient.cpp | 54 +- .../network/blockingfortuneclient/blockingclient.h | 10 +- .../blockingfortuneclient.pro | 9 +- examples/network/blockingfortuneclient/main.cpp | 6 +- .../broadcastreceiver/broadcastreceiver.pro | 6 +- examples/network/broadcastreceiver/main.cpp | 6 +- examples/network/broadcastreceiver/receiver.cpp | 18 +- examples/network/broadcastreceiver/receiver.h | 9 +- .../network/broadcastsender/broadcastsender.pro | 7 +- examples/network/broadcastsender/main.cpp | 6 +- examples/network/broadcastsender/sender.cpp | 3 +- examples/network/broadcastsender/sender.h | 4 +- examples/network/download/download.pro | 5 +- .../network/downloadmanager/downloadmanager.pro | 12 +- examples/network/fortuneclient/fortuneclient.pro | 5 + examples/network/fortuneserver/fortuneserver.pro | 5 + examples/network/googlesuggest/googlesuggest.pro | 7 + examples/network/http/http.pro | 7 +- examples/network/http/httpwindow.cpp | 25 +- examples/network/http/httpwindow.h | 10 + examples/network/http/main.cpp | 17 +- examples/network/loopback/dialog.cpp | 31 + examples/network/loopback/dialog.h | 7 + examples/network/loopback/loopback.pro | 7 +- examples/network/loopback/main.cpp | 6 +- examples/network/network-chat/network-chat.pro | 4 + examples/network/network.pro | 1 - examples/network/qftp/ftpwindow.cpp | 8 +- examples/network/qftp/qftp.pro | 4 + .../network/securesocketclient/certificateinfo.cpp | 4 +- .../network/securesocketclient/certificateinfo.ui | 68 +- examples/network/securesocketclient/main.cpp | 4 + .../securesocketclient/securesocketclient.pro | 3 + examples/network/securesocketclient/sslclient.cpp | 7 +- examples/network/securesocketclient/sslclient.ui | 223 +++--- examples/network/securesocketclient/sslerrors.ui | 57 +- examples/network/threadedfortuneserver/dialog.cpp | 18 +- examples/network/threadedfortuneserver/dialog.h | 4 +- examples/network/threadedfortuneserver/main.cpp | 6 +- .../threadedfortuneserver.pro | 9 +- examples/network/torrent/torrent.pro | 5 + examples/opengl/2dpainting/2dpainting.pro | 4 + .../opengl/framebufferobject/framebufferobject.pro | 5 +- .../framebufferobject2/framebufferobject2.pro | 5 + examples/opengl/grabber/grabber.pro | 5 + examples/opengl/hellogl/hellogl.pro | 5 + examples/opengl/hellogl_es/hellogl_es.pro | 8 +- examples/opengl/hellogl_es2/hellogl_es2.pro | 13 +- examples/opengl/opengl.pro | 4 +- examples/opengl/overpainting/overpainting.pro | 5 + examples/opengl/pbuffers/pbuffers.pro | 5 + examples/opengl/pbuffers2/pbuffers2.pro | 6 +- examples/opengl/samplebuffers/samplebuffers.pro | 5 + examples/opengl/textures/textures.pro | 4 + examples/openvg/openvg.pro | 1 + examples/painting/basicdrawing/basicdrawing.pro | 3 + examples/painting/basicdrawing/main.cpp | 4 + examples/painting/basicdrawing/window.cpp | 43 +- .../concentriccircles/concentriccircles.pro | 2 + examples/painting/concentriccircles/main.cpp | 4 + examples/painting/fontsampler/fontsampler.pro | 2 + examples/painting/fontsampler/main.cpp | 4 + examples/painting/fontsampler/mainwindow.cpp | 56 +- examples/painting/fontsampler/mainwindow.h | 4 + examples/painting/fontsampler/mainwindowbase.ui | 126 +-- .../painting/imagecomposition/imagecomposer.cpp | 10 + .../painting/imagecomposition/imagecomposition.pro | 2 + examples/painting/imagecomposition/main.cpp | 4 + examples/painting/painterpaths/main.cpp | 4 + examples/painting/painterpaths/painterpaths.pro | 2 + examples/painting/painterpaths/window.cpp | 53 +- examples/painting/painterpaths/window.h | 4 +- examples/painting/painting.pro | 6 +- examples/painting/svggenerator/main.cpp | 4 + examples/painting/svggenerator/svggenerator.pro | 2 + examples/painting/svggenerator/window.cpp | 4 + examples/painting/svgviewer/main.cpp | 4 + examples/painting/svgviewer/svgviewer.pro | 2 + examples/painting/transformations/main.cpp | 4 + .../painting/transformations/transformations.pro | 5 + examples/phonon/capabilities/capabilities.pro | 11 +- examples/phonon/capabilities/main.cpp | 4 + examples/phonon/capabilities/window.cpp | 52 +- examples/phonon/capabilities/window.h | 1 - examples/phonon/phonon.pro | 1 - examples/phonon/qmusicplayer/main.cpp | 4 + examples/phonon/qmusicplayer/qmusicplayer.pro | 11 +- .../qtconcurrent/imagescaling/imagescaling.pro | 3 + examples/qtconcurrent/imagescaling/main.cpp | 21 +- examples/qtconcurrent/map/main.cpp | 19 +- examples/qtconcurrent/map/map.pro | 3 + examples/qtconcurrent/progressdialog/main.cpp | 17 +- .../qtconcurrent/progressdialog/progressdialog.pro | 4 +- examples/qtconcurrent/qtconcurrent.pro | 1 - examples/qtconcurrent/runfunction/main.cpp | 19 +- examples/qtconcurrent/runfunction/runfunction.pro | 4 +- examples/qtconcurrent/wordcount/main.cpp | 23 +- examples/qtconcurrent/wordcount/wordcount.pro | 4 +- examples/qtestlib/qtestlib.pro | 1 - examples/qtestlib/tutorial1/tutorial1.pro | 5 + examples/qtestlib/tutorial2/tutorial2.pro | 5 + examples/qtestlib/tutorial3/tutorial3.pro | 5 + examples/qtestlib/tutorial4/tutorial4.pro | 5 + examples/qtestlib/tutorial5/tutorial5.pro | 5 + examples/qws/dbscreen/dbscreen.pro | 4 + examples/qws/framebuffer/framebuffer.pro | 6 + examples/qws/mousecalibration/mousecalibration.pro | 7 + examples/qws/simpledecoration/simpledecoration.pro | 7 + examples/qws/svgalib/svgalib.pro | 6 + examples/richtext/calendar/calendar.pro | 5 + examples/richtext/calendar/main.cpp | 6 + examples/richtext/calendar/mainwindow.cpp | 7 +- examples/richtext/orderform/detailsdialog.cpp | 30 + examples/richtext/orderform/main.cpp | 6 + examples/richtext/orderform/orderform.pro | 2 + examples/richtext/richtext.pro | 1 - examples/richtext/syntaxhighlighter/main.cpp | 6 + .../syntaxhighlighter/syntaxhighlighter.pro | 2 + examples/richtext/textobject/main.cpp | 6 +- examples/richtext/textobject/textobject.pro | 5 +- examples/richtext/textobject/window.cpp | 2 +- examples/script/calculator/calculator.pro | 3 + examples/script/calculator/calculator.ui | 770 +++++++++--------- examples/script/context2d/context2d.pro | 2 + examples/script/context2d/main.cpp | 4 + examples/script/context2d/qcontext2dcanvas.cpp | 4 +- examples/script/customclass/customclass.pro | 3 + examples/script/defaultprototypes/code.js | 2 - .../script/defaultprototypes/defaultprototypes.pro | 2 + examples/script/defaultprototypes/main.cpp | 5 + examples/script/defaultprototypes/prototypes.cpp | 7 + examples/script/helloscript/helloscript.pro | 2 + examples/script/helloscript/main.cpp | 4 + examples/script/marshal/marshal.pro | 3 + examples/script/qscript/qscript.pro | 3 + examples/script/qsdbg/qsdbg.pro | 4 +- examples/script/qstetrix/qstetrix.pro | 5 + examples/script/script.pro | 1 - examples/sql/cachedtable/cachedtable.pro | 2 + examples/sql/cachedtable/main.cpp | 6 +- examples/sql/cachedtable/tableeditor.cpp | 3 +- examples/sql/cachedtable/tableeditor.h | 2 +- examples/sql/drilldown/drilldown.pro | 3 + examples/sql/drilldown/informationwindow.cpp | 6 +- examples/sql/drilldown/main.cpp | 2 +- examples/sql/drilldown/view.cpp | 2 +- examples/sql/masterdetail/main.cpp | 4 + examples/sql/masterdetail/mainwindow.cpp | 4 + examples/sql/masterdetail/masterdetail.pro | 5 + examples/sql/querymodel/main.cpp | 27 +- examples/sql/querymodel/querymodel.pro | 2 + .../relationaltablemodel/relationaltablemodel.cpp | 4 + .../relationaltablemodel/relationaltablemodel.pro | 2 + examples/sql/sql.pro | 1 - examples/sql/sqlwidgetmapper/main.cpp | 4 + examples/sql/sqlwidgetmapper/sqlwidgetmapper.pro | 3 + examples/sql/tablemodel/tablemodel.cpp | 18 +- examples/sql/tablemodel/tablemodel.pro | 2 + .../eventtransitions/eventtransitions.pro | 5 + examples/statemachine/eventtransitions/main.cpp | 11 +- examples/statemachine/factorial/factorial.pro | 5 + examples/statemachine/pingpong/pingpong.pro | 5 + examples/statemachine/rogue/main.cpp | 4 + examples/statemachine/rogue/movementtransition.h | 7 +- examples/statemachine/rogue/rogue.pro | 3 + examples/statemachine/rogue/window.cpp | 12 +- examples/statemachine/rogue/window.h | 5 + examples/statemachine/trafficlight/main.cpp | 9 + .../statemachine/trafficlight/trafficlight.pro | 4 + examples/statemachine/twowaybutton/main.cpp | 6 + .../statemachine/twowaybutton/twowaybutton.pro | 4 + examples/symbianpkgrules.pri | 1 - examples/threads/mandelbrot/main.cpp | 4 + examples/threads/mandelbrot/mandelbrot.pro | 2 + examples/threads/mandelbrot/mandelbrotwidget.cpp | 18 + examples/threads/mandelbrot/mandelbrotwidget.h | 30 +- examples/threads/queuedcustomtype/main.cpp | 4 + .../threads/queuedcustomtype/queuedcustomtype.pro | 10 + examples/threads/semaphores/semaphores.cpp | 81 +- examples/threads/semaphores/semaphores.pro | 6 +- examples/threads/threads.pro | 1 - examples/threads/waitconditions/waitconditions.cpp | 132 +++- examples/threads/waitconditions/waitconditions.pro | 5 +- examples/tools/codecs/codecs.pro | 5 + examples/tools/completer/completer.pro | 5 + examples/tools/contiguouscache/contiguouscache.pro | 7 + examples/tools/customcompleter/customcompleter.pro | 5 + examples/tools/customtype/customtype.pro | 13 + .../tools/customtypesending/customtypesending.pro | 13 + examples/tools/echoplugin/echoplugin.pro | 1 - .../tools/echoplugin/echowindow/echowindow.pro | 5 + examples/tools/echoplugin/plugin/plugin.pro | 10 +- examples/tools/i18n/i18n.pro | 5 + examples/tools/inputpanel/inputpanel.pro | 5 + examples/tools/plugandpaint/plugandpaint.pro | 5 + .../plugandpaintplugins/basictools/basictools.pro | 1 + .../extrafilters/extrafilters.pro | 1 + .../plugandpaintplugins/plugandpaintplugins.pro | 2 + examples/tools/regexp/regexp.pro | 5 + examples/tools/settingseditor/settingseditor.pro | 5 + examples/tools/styleplugin/plugin/plugin.pro | 1 + examples/tools/styleplugin/styleplugin.pro | 2 + .../tools/styleplugin/stylewindow/stylewindow.pro | 1 + examples/tools/tools.pro | 1 - .../treemodelcompleter/treemodelcompleter.pro | 5 + examples/tools/undoframework/undoframework.pro | 5 + examples/touch/dials/dials.pro | 7 + examples/touch/fingerpaint/fingerpaint.pro | 7 + examples/touch/knobs/knobs.pro | 7 + examples/touch/pinchzoom/pinchzoom.pro | 7 + .../tutorials/addressbook-fr/addressbook-fr.pro | 1 + examples/tutorials/addressbook-fr/part1/part1.pro | 7 + examples/tutorials/addressbook-fr/part2/part2.pro | 7 + examples/tutorials/addressbook-fr/part3/part3.pro | 7 + examples/tutorials/addressbook-fr/part4/part4.pro | 7 + examples/tutorials/addressbook-fr/part5/part5.pro | 7 + examples/tutorials/addressbook-fr/part6/part6.pro | 7 + examples/tutorials/addressbook-fr/part7/part7.pro | 7 + examples/tutorials/addressbook/addressbook.pro | 1 - examples/tutorials/addressbook/part1/part1.pro | 5 + examples/tutorials/addressbook/part2/part2.pro | 5 + examples/tutorials/addressbook/part3/part3.pro | 5 + examples/tutorials/addressbook/part4/part4.pro | 5 + examples/tutorials/addressbook/part5/part5.pro | 5 + examples/tutorials/addressbook/part6/part6.pro | 5 + examples/tutorials/addressbook/part7/part7.pro | 5 + .../gsQml/parts/part5/filedialog/dialogPlugin.cpp | 2 +- .../gsQml/parts/part5/filedialog/directory.cpp | 2 +- .../gsQml/parts/part5/filedialog/file.cpp | 2 +- .../gsQml/parts/part5/filedialog/file.h | 2 +- .../tutorials/modelview/1_readonly/1_readonly.pro | 5 + .../modelview/2_formatting/2_formatting.pro | 5 + .../modelview/3_changingmodel/3_changingmodel.pro | 5 + .../tutorials/modelview/4_headers/4_headers.pro | 5 + examples/tutorials/modelview/5_edit/5_edit.pro | 5 + .../tutorials/modelview/6_treeview/6_treeview.pro | 5 + .../modelview/7_selections/7_selections.pro | 5 + examples/tutorials/modelview/modelview.pro | 1 - examples/tutorials/tutorials.pro | 1 - .../tutorials/widgets/childwidget/childwidget.pro | 7 + .../widgets/nestedlayouts/nestedlayouts.pro | 7 + examples/tutorials/widgets/toplevel/toplevel.pro | 7 + .../widgets/windowlayout/windowlayout.pro | 7 + examples/uitools/multipleinheritance/main.cpp | 4 + .../multipleinheritance/multipleinheritance.pro | 2 + examples/uitools/textfinder/textfinder.pro | 4 + examples/uitools/uitools.pro | 1 - examples/webkit/domtraversal/domtraversal.pro | 8 +- examples/webkit/domtraversal/main.cpp | 6 +- examples/webkit/domtraversal/window.h | 6 +- examples/webkit/fancybrowser/fancybrowser.pro | 4 +- examples/webkit/fancybrowser/main.cpp | 6 +- examples/webkit/formextractor/formextractor.cpp | 5 + examples/webkit/formextractor/formextractor.h | 6 +- examples/webkit/formextractor/formextractor.pro | 5 +- examples/webkit/framecapture/framecapture.pro | 10 + examples/webkit/googlechat/googlechat.pro | 6 + examples/webkit/previewer/main.cpp | 6 +- examples/webkit/previewer/previewer.cpp | 5 + examples/webkit/previewer/previewer.h | 6 +- examples/webkit/previewer/previewer.pro | 5 +- examples/webkit/simpleselector/main.cpp | 6 +- examples/webkit/simpleselector/simpleselector.pro | 3 + examples/webkit/webkit.pro | 1 - examples/widgets/analogclock/analogclock.pro | 2 + examples/widgets/analogclock/main.cpp | 4 + examples/widgets/calculator/calculator.cpp | 7 +- examples/widgets/calculator/calculator.h | 4 +- examples/widgets/calculator/calculator.pro | 2 + examples/widgets/calculator/main.cpp | 4 + examples/widgets/calendarwidget/calendarwidget.pro | 5 + examples/widgets/charactermap/charactermap.pro | 5 + examples/widgets/codeeditor/codeeditor.pro | 5 + examples/widgets/codeeditor/main.cpp | 4 + examples/widgets/digitalclock/digitalclock.pro | 2 + examples/widgets/digitalclock/main.cpp | 4 + examples/widgets/groupbox/groupbox.pro | 5 + examples/widgets/groupbox/main.cpp | 4 + examples/widgets/icons/icons.pro | 5 + examples/widgets/icons/main.cpp | 4 + examples/widgets/imageviewer/imageviewer.pro | 8 + examples/widgets/imageviewer/main.cpp | 4 + examples/widgets/lineedits/lineedits.pro | 5 + examples/widgets/lineedits/main.cpp | 4 + examples/widgets/movie/main.cpp | 5 + examples/widgets/movie/movie.pro | 5 + examples/widgets/scribble/main.cpp | 4 + examples/widgets/scribble/scribble.pro | 2 + examples/widgets/shapedclock/main.cpp | 4 + examples/widgets/shapedclock/shapedclock.pro | 4 + examples/widgets/sliders/main.cpp | 4 + examples/widgets/sliders/sliders.pro | 5 + examples/widgets/softkeys/softkeys.pro | 2 + examples/widgets/spinboxes/main.cpp | 4 + examples/widgets/spinboxes/spinboxes.pro | 5 + examples/widgets/styles/styles.pro | 5 + examples/widgets/stylesheet/main.cpp | 4 + examples/widgets/stylesheet/stylesheet.pro | 5 + examples/widgets/tablet/main.cpp | 7 +- examples/widgets/tablet/tablet.pro | 5 + examples/widgets/tetrix/main.cpp | 4 + examples/widgets/tetrix/tetrix.pro | 2 + examples/widgets/tooltips/main.cpp | 4 + examples/widgets/tooltips/tooltips.pro | 2 + examples/widgets/validators/main.cpp | 4 + examples/widgets/validators/validators.pro | 5 + examples/widgets/widgets.pro | 9 +- examples/widgets/wiggly/main.cpp | 4 + examples/widgets/wiggly/wiggly.pro | 2 + examples/widgets/windowflags/main.cpp | 4 + examples/widgets/windowflags/windowflags.pro | 5 + examples/xml/dombookmarks/dombookmarks.pro | 15 +- examples/xml/dombookmarks/main.cpp | 5 + examples/xml/dombookmarks/mainwindow.cpp | 18 + examples/xml/htmlinfo/htmlinfo.pro | 11 +- examples/xml/htmlinfo/main.cpp | 5 +- examples/xml/rsslisting/main.cpp | 4 + examples/xml/rsslisting/rsslisting.cpp | 20 + examples/xml/rsslisting/rsslisting.h | 15 + examples/xml/rsslisting/rsslisting.pro | 13 +- examples/xml/saxbookmarks/saxbookmarks.pro | 2 + examples/xml/streambookmarks/main.cpp | 3 + examples/xml/streambookmarks/mainwindow.cpp | 18 + examples/xml/streambookmarks/streambookmarks.pro | 9 +- examples/xml/xml.pro | 1 - examples/xml/xmlstreamlint/xmlstreamlint.pro | 4 + examples/xmlpatterns/filetree/filetree.pro | 5 + .../qobjectxmlmodel/qobjectxmlmodel.pro | 5 + examples/xmlpatterns/recipes/main.cpp | 4 + examples/xmlpatterns/recipes/querymainwindow.h | 6 +- examples/xmlpatterns/recipes/recipes.pro | 5 +- examples/xmlpatterns/schema/main.cpp | 4 + examples/xmlpatterns/schema/mainwindow.h | 6 +- examples/xmlpatterns/schema/schema.pro | 4 +- examples/xmlpatterns/trafficinfo/trafficinfo.pro | 5 + examples/xmlpatterns/xmlpatterns.pro | 1 - .../xquery/globalVariables/globalVariables.pro | 1 - examples/xmlpatterns/xquery/xquery.pro | 2 + qmake/generators/symbian/symbiancommon.h | 1 + .../debugger/qdeclarativedebugservice_p.h | 2 +- src/declarative/debugger/qpacketprotocol_p.h | 4 +- src/gui/itemviews/qdatawidgetmapper.cpp | 2 +- src/gui/kernel/qcocoasharedwindowmethods_mac_p.h | 13 + src/gui/kernel/qwidget.cpp | 2 +- .../data/flickable-horizontal.4.png | Bin 1450 -> 1454 bytes .../qdeclarativepathview/data/test-pathview.6.png | Bin 1188 -> 1189 bytes .../data/usingRepeater.0.png | Bin 1747 -> 1199 bytes .../qdeclarativespringanimation/data/follow.0.png | Bin 950 -> 941 bytes .../qdeclarativespringanimation/data/follow.1.png | Bin 983 -> 975 bytes .../qdeclarativespringanimation/data/follow.2.png | Bin 1243 -> 1235 bytes .../qdeclarativespringanimation/data/follow.3.png | Bin 1235 -> 1225 bytes .../qdeclarativespringanimation/data/follow.4.png | Bin 1253 -> 1247 bytes .../qdeclarativespringanimation/data/follow.5.png | Bin 1249 -> 1243 bytes .../qdeclarativespringanimation/data/follow.6.png | Bin 1241 -> 1234 bytes .../qdeclarativespringanimation/data/follow.7.png | Bin 1251 -> 1242 bytes .../align/data-MAC/multilineAlign.0.png | Bin 801 -> 2388 bytes .../align/data-X11/multilineAlign.0.png | Bin 791 -> 762 bytes .../baseline/data-X11/parentanchor.0.png | Bin 1313 -> 1313 bytes .../qdeclarativetext/data-MAC/qtbug_14865.0.png | Bin 322 -> 1640 bytes .../qdeclarativetext/data-MAC/qtbug_14865.1.png | Bin 322 -> 625 bytes .../qdeclarativetext/data-X11/qtbug_14865.0.png | Bin 465 -> 303 bytes .../qdeclarativetext/data-X11/qtbug_14865.1.png | Bin 465 -> 303 bytes .../qdeclarativetext/elide/data-X11/elide.1.png | Bin 581 -> 483 bytes .../qdeclarativetext/elide/data-X11/elide2.0.png | Bin 1187 -> 1189 bytes .../qdeclarativetext/elide/data-X11/elide2.1.png | Bin 1066 -> 1068 bytes .../elide/data-X11/multilength.1.png | Bin 967 -> 814 bytes .../elide/data-X11/multilength.2.png | Bin 962 -> 809 bytes .../elide/data-X11/multilength.3.png | Bin 678 -> 527 bytes .../elide/data-X11/multilength.4.png | Bin 676 -> 526 bytes .../elide/data-X11/multilength.5.png | Bin 542 -> 399 bytes .../font/data-MAC/plaintext2.0.png | Bin 1563 -> 3481 bytes .../font/data-MAC/plaintext3.0.png | Bin 6348 -> 53503 bytes .../qdeclarativetext/font/data-X11/plaintext.0.png | Bin 13194 -> 13140 bytes .../font/data-X11/plaintext2.0.png | Bin 1510 -> 1503 bytes .../qdeclarativetext/font/data-X11/richtext.0.png | Bin 9415 -> 9297 bytes .../qdeclarativetext/font/data-X11/richtext2.0.png | Bin 10671 -> 10626 bytes .../data-MAC/usingMultilineEdit.0.png | Bin 1362 -> 5123 bytes .../data-MAC/usingMultilineEdit.1.png | Bin 1377 -> 5500 bytes .../data-MAC/usingMultilineEdit.10.png | Bin 2037 -> 8641 bytes .../data-MAC/usingMultilineEdit.11.png | Bin 2037 -> 8641 bytes .../data-MAC/usingMultilineEdit.2.png | Bin 1461 -> 6163 bytes .../data-MAC/usingMultilineEdit.3.png | Bin 1577 -> 6785 bytes .../data-MAC/usingMultilineEdit.4.png | Bin 1704 -> 6943 bytes .../data-MAC/usingMultilineEdit.5.png | Bin 1778 -> 7043 bytes .../data-MAC/usingMultilineEdit.6.png | Bin 1797 -> 7428 bytes .../data-MAC/usingMultilineEdit.7.png | Bin 1859 -> 6860 bytes .../data-MAC/usingMultilineEdit.8.png | Bin 1835 -> 8659 bytes .../data-MAC/usingMultilineEdit.9.png | Bin 2028 -> 8641 bytes .../qdeclarativetextedit/data-MAC/wrap.0.png | Bin 3756 -> 11626 bytes .../qdeclarativetextedit/data-MAC/wrap.1.png | Bin 3891 -> 11869 bytes .../qdeclarativetextedit/data-MAC/wrap.2.png | Bin 3964 -> 12264 bytes .../qdeclarativetextedit/data-MAC/wrap.3.png | Bin 4054 -> 12607 bytes .../qdeclarativetextedit/data-MAC/wrap.4.png | Bin 4132 -> 13243 bytes .../qdeclarativetextedit/data-MAC/wrap.5.png | Bin 4234 -> 13260 bytes .../qdeclarativetextedit/data-MAC/wrap.6.png | Bin 4238 -> 13260 bytes .../qdeclarativetextedit/data-X11/qt-669.0.png | Bin 855 -> 688 bytes .../qdeclarativetextedit/data-X11/qt-669.1.png | Bin 863 -> 693 bytes .../qdeclarativetextedit/data-X11/qt-669.2.png | Bin 865 -> 695 bytes .../qdeclarativetextedit/data-X11/qt-669.3.png | Bin 862 -> 694 bytes .../qdeclarativetextedit/data-X11/qt-669.4.png | Bin 855 -> 688 bytes .../data-X11/usingMultilineEdit.10.png | Bin 2032 -> 2020 bytes .../data-X11/usingMultilineEdit.11.png | Bin 2032 -> 2020 bytes .../data-X11/usingMultilineEdit.12.png | Bin 2032 -> 2020 bytes .../data-X11/usingMultilineEdit.7.png | Bin 1843 -> 1836 bytes .../data-X11/usingMultilineEdit.9.png | Bin 2024 -> 2008 bytes .../qdeclarativetextedit/data-X11/wrap.7.png | Bin 3930 -> 3943 bytes .../qdeclarativetextinput/data-MAC/echoMode.0.png | Bin 256 -> 703 bytes .../qdeclarativetextinput/data-MAC/echoMode.1.png | Bin 343 -> 1360 bytes .../qdeclarativetextinput/data-MAC/echoMode.2.png | Bin 461 -> 2031 bytes .../data-X11/usingLineEdit.11.png | Bin 1468 -> 1455 bytes tools/qdoc3/ditaxmlgenerator.cpp | 24 +- tools/qdoc3/doc/qdoc-manual.qdoc | 206 +++-- tools/qdoc3/helpprojectwriter.cpp | 1 + tools/qdoc3/htmlgenerator.cpp | 2 + tools/qdoc3/test/qt-html-default-styles.qdocconf | 6 +- tools/qdoc3/test/qt-html-templates.qdocconf | 505 ++++++------ translations/qt_de.ts | 34 + 813 files changed, 4979 insertions(+), 3897 deletions(-) delete mode 100644 examples/declarative/animation/animation.qmlproject delete mode 100644 examples/declarative/animation/basics/basics.qmlproject delete mode 100644 examples/declarative/animation/basics/images/face-smile.png delete mode 100644 examples/declarative/animation/basics/images/moon.png delete mode 100644 examples/declarative/animation/basics/images/shadow.png delete mode 100644 examples/declarative/animation/basics/images/star.png delete mode 100644 examples/declarative/animation/basics/images/sun.png delete mode 100644 examples/declarative/animation/behaviors/behaviors.qmlproject delete mode 100644 examples/declarative/animation/easing/content/quit.png delete mode 100644 examples/declarative/animation/easing/easing.qmlproject delete mode 100644 examples/declarative/animation/states/qt-logo.png delete mode 100644 examples/declarative/animation/states/states.qmlproject delete mode 100644 examples/declarative/examples.qmlproject delete mode 100644 examples/declarative/i18n/i18n.qmlproject delete mode 100644 examples/declarative/i18n/i18n/base.ts delete mode 100644 examples/declarative/i18n/i18n/qml_en_AU.qm delete mode 100644 examples/declarative/i18n/i18n/qml_en_AU.ts delete mode 100644 examples/declarative/i18n/i18n/qml_fr.qm delete mode 100644 examples/declarative/i18n/i18n/qml_fr.ts delete mode 100644 examples/declarative/imageelements/borderimage/borderimage.qmlproject delete mode 100644 examples/declarative/imageelements/borderimage/content/bw.png delete mode 100644 examples/declarative/imageelements/borderimage/content/colors-round.sci delete mode 100644 examples/declarative/imageelements/borderimage/content/colors-stretch.sci delete mode 100644 examples/declarative/imageelements/borderimage/content/colors.png delete mode 100644 examples/declarative/imageelements/borderimage/content/shadow.png delete mode 100644 examples/declarative/imageelements/image/image.qmlproject delete mode 100644 examples/declarative/imageelements/image/qt-logo.png delete mode 100644 examples/declarative/imageelements/imageelements.qmlproject delete mode 100644 examples/declarative/keyinteraction/focus/Core/images/arrow.png delete mode 100644 examples/declarative/keyinteraction/focus/Core/images/qt-logo.png delete mode 100644 examples/declarative/keyinteraction/focus/focus.qmlproject delete mode 100644 examples/declarative/keyinteraction/keyinteraction.qmlproject delete mode 100644 examples/declarative/modelviews/gridview/gridview.qmlproject delete mode 100644 examples/declarative/modelviews/gridview/pics/AddressBook_48.png delete mode 100644 examples/declarative/modelviews/gridview/pics/AudioPlayer_48.png delete mode 100644 examples/declarative/modelviews/gridview/pics/Camera_48.png delete mode 100644 examples/declarative/modelviews/gridview/pics/DateBook_48.png delete mode 100644 examples/declarative/modelviews/gridview/pics/EMail_48.png delete mode 100644 examples/declarative/modelviews/gridview/pics/TodoList_48.png delete mode 100644 examples/declarative/modelviews/gridview/pics/VideoPlayer_48.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/fruit-salad.jpg delete mode 100644 examples/declarative/modelviews/listview/content/pics/hamburger.jpg delete mode 100644 examples/declarative/modelviews/listview/content/pics/lemonade.jpg delete mode 100644 examples/declarative/modelviews/listview/content/pics/moreDown.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/moreUp.png delete mode 100644 examples/declarative/modelviews/listview/content/pics/pancakes.jpg delete mode 100644 examples/declarative/modelviews/listview/content/pics/vegetable-soup.jpg delete mode 100644 examples/declarative/modelviews/listview/listview.qmlproject delete mode 100644 examples/declarative/modelviews/modelviews.qmlproject delete mode 100644 examples/declarative/modelviews/package/package.qmlproject delete mode 100644 examples/declarative/modelviews/pathview/pathview.qmlproject delete mode 100644 examples/declarative/modelviews/pathview/pics/AddressBook_48.png delete mode 100644 examples/declarative/modelviews/pathview/pics/AudioPlayer_48.png delete mode 100644 examples/declarative/modelviews/pathview/pics/Camera_48.png delete mode 100644 examples/declarative/modelviews/pathview/pics/DateBook_48.png delete mode 100644 examples/declarative/modelviews/pathview/pics/EMail_48.png delete mode 100644 examples/declarative/modelviews/pathview/pics/TodoList_48.png delete mode 100644 examples/declarative/modelviews/pathview/pics/VideoPlayer_48.png delete mode 100644 examples/declarative/modelviews/visualitemmodel/visualitemmodel.qmlproject delete mode 100644 examples/declarative/modelviews/webview/alerts.html delete mode 100755 examples/declarative/modelviews/webview/content/Mapping/map.html delete mode 100644 examples/declarative/modelviews/webview/content/pics/cancel.png delete mode 100644 examples/declarative/modelviews/webview/content/pics/ok.png delete mode 100644 examples/declarative/modelviews/webview/newwindows.html delete mode 100644 examples/declarative/modelviews/webview/webview.qmlproject delete mode 100644 examples/declarative/positioners/add.png delete mode 100644 examples/declarative/positioners/del.png delete mode 100644 examples/declarative/positioners/positioners.qmlproject delete mode 100644 examples/declarative/sqllocalstorage/sqllocalstorage.qmlproject delete mode 100644 examples/declarative/text/fonts/fonts.qmlproject delete mode 100644 examples/declarative/text/fonts/fonts/tarzeau_ocr_a.ttf delete mode 100644 examples/declarative/text/text.qmlproject delete mode 100644 examples/declarative/text/textselection/pics/endHandle.png delete mode 100644 examples/declarative/text/textselection/pics/endHandle.sci delete mode 100644 examples/declarative/text/textselection/pics/startHandle.png delete mode 100644 examples/declarative/text/textselection/pics/startHandle.sci delete mode 100644 examples/declarative/text/textselection/textselection.qmlproject delete mode 100644 examples/declarative/threading/threading.qmlproject delete mode 100644 examples/declarative/touchinteraction/gestures/gestures.qmlproject delete mode 100644 examples/declarative/touchinteraction/mousearea/mousearea.qmlproject delete mode 100644 examples/declarative/touchinteraction/touchinteraction.qmlproject delete mode 100644 examples/declarative/toys/README delete mode 100644 examples/declarative/toys/clocks/clocks.qmlproject delete mode 100644 examples/declarative/toys/corkboards/cork.jpg delete mode 100644 examples/declarative/toys/corkboards/corkboards.qmlproject delete mode 100644 examples/declarative/toys/corkboards/note-yellow.png delete mode 100644 examples/declarative/toys/corkboards/tack.png delete mode 100644 examples/declarative/toys/dynamicscene/dynamicscene.qmlproject delete mode 100644 examples/declarative/toys/dynamicscene/images/NOTE delete mode 100644 examples/declarative/toys/dynamicscene/images/face-smile.png delete mode 100644 examples/declarative/toys/dynamicscene/images/moon.png delete mode 100644 examples/declarative/toys/dynamicscene/images/rabbit_brown.png delete mode 100644 examples/declarative/toys/dynamicscene/images/rabbit_bw.png delete mode 100644 examples/declarative/toys/dynamicscene/images/star.png delete mode 100644 examples/declarative/toys/dynamicscene/images/sun.png delete mode 100644 examples/declarative/toys/dynamicscene/images/tree_s.png delete mode 100644 examples/declarative/toys/dynamicscene/qml/itemCreation.js delete mode 100644 examples/declarative/toys/tic-tac-toe/content/pics/board.png delete mode 100644 examples/declarative/toys/tic-tac-toe/content/pics/o.png delete mode 100644 examples/declarative/toys/tic-tac-toe/content/pics/x.png delete mode 100644 examples/declarative/toys/tic-tac-toe/content/tic-tac-toe.js delete mode 100644 examples/declarative/toys/tic-tac-toe/tic-tac-toe.qmlproject delete mode 100644 examples/declarative/toys/toys.qmlproject delete mode 100644 examples/declarative/toys/tvtennis/tvtennis.qmlproject delete mode 100644 examples/declarative/ui-components/README delete mode 100644 examples/declarative/ui-components/dialcontrol/content/background.png delete mode 100644 examples/declarative/ui-components/dialcontrol/content/needle.png delete mode 100644 examples/declarative/ui-components/dialcontrol/content/needle_shadow.png delete mode 100644 examples/declarative/ui-components/dialcontrol/content/overlay.png delete mode 100644 examples/declarative/ui-components/dialcontrol/content/quit.png delete mode 100644 examples/declarative/ui-components/dialcontrol/dialcontrol.qmlproject delete mode 100644 examples/declarative/ui-components/flipable/content/5_heart.png delete mode 100644 examples/declarative/ui-components/flipable/content/9_club.png delete mode 100644 examples/declarative/ui-components/flipable/content/back.png delete mode 100644 examples/declarative/ui-components/flipable/flipable.qmlproject delete mode 100644 examples/declarative/ui-components/progressbar/content/background.png delete mode 100644 examples/declarative/ui-components/progressbar/progressbar.qmlproject delete mode 100644 examples/declarative/ui-components/scrollbar/pics/niagara_falls.jpg delete mode 100644 examples/declarative/ui-components/scrollbar/scrollbar.qmlproject delete mode 100644 examples/declarative/ui-components/searchbox/images/clear.png delete mode 100644 examples/declarative/ui-components/searchbox/images/lineedit-bg-focus.png delete mode 100644 examples/declarative/ui-components/searchbox/images/lineedit-bg.png delete mode 100644 examples/declarative/ui-components/searchbox/searchbox.qmlproject delete mode 100644 examples/declarative/ui-components/slideswitch/content/background.svg delete mode 100644 examples/declarative/ui-components/slideswitch/content/knob.svg delete mode 100644 examples/declarative/ui-components/slideswitch/slideswitch.qmlproject delete mode 100644 examples/declarative/ui-components/spinner/content/spinner-bg.png delete mode 100644 examples/declarative/ui-components/spinner/content/spinner-select.png delete mode 100644 examples/declarative/ui-components/spinner/spinner.qmlproject delete mode 100644 examples/declarative/ui-components/tabwidget/tab.png delete mode 100644 examples/declarative/ui-components/tabwidget/tabwidget.qmlproject delete mode 100644 examples/declarative/ui-components/ui-components.qmlproject delete mode 100644 examples/declarative/xml/xml.qmlproject delete mode 100644 examples/declarative/xml/xmlhttprequest/data.xml delete mode 100644 examples/declarative/xml/xmlhttprequest/xmlhttprequest.qmlproject diff --git a/.commit-template b/.commit-template index 589ca89..6e0e3a4 100644 --- a/.commit-template +++ b/.commit-template @@ -5,6 +5,6 @@ # ---[ Fields ]-----------------[ uncomment and edit as applicable ]---| #Task-number: -#Reviewed-by: +Reviewed-by: pending # ==================================[ please wrap at 72 characters ]===| diff --git a/doc/doc.pri b/doc/doc.pri index 68d729b..253e1b4 100644 --- a/doc/doc.pri +++ b/doc/doc.pri @@ -13,12 +13,14 @@ win32:!win32-g++* { unixstyle = true } +COPYWEBKITGUIDE = $$QT_SOURCE_TREE/examples/webkit/webkit-guide + $$unixstyle { QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && QT_BUILD_TREE=$$QT_BUILD_TREE QT_SOURCE_TREE=$$QT_SOURCE_TREE $$QT_BUILD_TREE/bin/qdoc3 $$DOCS_GENERATION_DEFINES - COPYWEBKITGUIDE = $$QT_SOURCE_TREE/examples/webkit/webkit-guide } else { QDOC = cd $$QT_SOURCE_TREE/tools/qdoc3/test && set QT_BUILD_TREE=$$QT_BUILD_TREE&& set QT_SOURCE_TREE=$$QT_SOURCE_TREE&& $$QT_BUILD_TREE/bin/qdoc3.exe $$DOCS_GENERATION_DEFINES QDOC = $$replace(QDOC, "/", "\\") + COPYWEBKITGUIDE = $$replace(COPYWEBKITGUIDE, "/", "\\") } ADP_DOCS_QDOCCONF_FILE = qt-build-docs-online.qdocconf QT_DOCUMENTATION = ($$QDOC qt-api-only.qdocconf assistant.qdocconf designer.qdocconf \ diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index 93571bd..8367c0f 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -147,4 +147,12 @@ examples for porting} \list \o \l{Qt Quick Licensing Information} \endlist + +\section1 Online Examples + +\list +\o Forum Nokia: +\l{http://wiki.forum.nokia.com/index.php/Qt_Quick_examples_for_porting}{Qt Quick +examples for porting} +\endlist */ diff --git a/doc/src/declarative/qdeclarativemodels.qdoc b/doc/src/declarative/qdeclarativemodels.qdoc index 23dd390..30167d7 100644 --- a/doc/src/declarative/qdeclarativemodels.qdoc +++ b/doc/src/declarative/qdeclarativemodels.qdoc @@ -422,3 +422,84 @@ a function in the model, e.g.: updated, and that \e{value} holds the new value. */ + +/*! +\page qml-presenting-data.html +\title Presenting Data with QML + +\section1 Introduction + +Qt Quick contains a set of standard items that can be used to present data in a +number of different ways. For simple user interfaces, +\l{Using QML Positioner and Repeater Items#Repeaters}{Repeaters} can be used +in combination with +\l{Using QML Positioner and Repeater Items#Positioners}{Positioners} +to obtain pieces of data and arrange them in a user interface. However, when +large quantities of data are involved, it is often better to use models with +the standard views since these contain many built-in display and navigation +features. + +\section1 Views + +Views are scrolling containers for collections of items. They are feature-rich, +supporting many of the use cases found in typical applications, and can be +customized to meet requirements on style and behavior. + +A set of standard views are provided in the basic set of Qt Quick +graphical elements: + +\list +\o \l{#ListView}{ListView} arranges items in a horizontal or vertical list +\o \l{#GridView}{GridView} arranges items in a grid within the available space +\o \l{#PathView}{PathView} arranges items on a path +\endlist + +Unlike these items, \l WebView is not a fully-featured view item, and needs +to be combined with a \l Flickable item to create a view that performs like +a Web browser. + +\section2 ListView + +\l ListView shows a classic list of items with horizontal or vertical placing +of items. + +\beginfloatright +\inlineimage qml-listview-snippet.png +\endfloat + +The following example shows a minimal ListView displaying a sequence of +numbers (using an \l{QML Data Models#An Integer}{integer as a model}). +A simple delegate is used to define an items for each piece of data in the +model. + +\clearfloat +\snippet doc/src/snippets/declarative/listview/listview-snippet.qml document + + + +\section2 GridView + +\l GridView displays items in a grid like an file manager's icon view. + +\section2 PathView + +\l PathView displays items on a path, where the selection remains in +the same place and the items move around it. + +\section1 Decorating Views + +\section2 Headers and Footers + +\section2 Sections + +\section2 Navigation + +In traditional user interfaces, views can be scrolled using standard +controls, such as scroll bars and arrow buttons. In some situations, it +is also possible to drag the view directly by pressing and holding a +mouse button while moving the cursor. In touch-based user interfaces, +this dragging action is often complemented with a flicking action, where +scrolling continues after the user has stopped touching the view. + +\section1 Further Reading +*/ diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 3659caa..02d88ae 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -465,6 +465,10 @@ below right calls this function, passing a QVariantList and a QVariantMap, which converted to JavaScript array and object values, repectively: \table +\header +\o Type +\o String format +\o Example \row \o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/MyItem.qml 0 \o \snippet doc/src/snippets/declarative/qtbinding/variantlistmap/main.cpp 0 diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 4a6f6a9..3930d3d 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -210,4 +210,4 @@ #include to use this function. Returns the QML type id. - */ +*/ diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index dea5aa1..65879b3 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -1719,6 +1719,9 @@ executable. If you need to install executable files, you can unset the files' executable flags. + Note that \c qmake will skip files that are executable. If you need to install + executable files, you can unset the files' executable flags. + \target LEXIMPLS \section1 LEXIMPLS @@ -1811,6 +1814,8 @@ \bold{Note:} On the Symbian platform, this variable is ignored. + \bold{Note:} On the Symbian platform, this variable is ignored. + \target MAKEFILE_GENERATOR \section1 MAKEFILE_GENERATOR diff --git a/doc/src/development/qtestlib.qdoc b/doc/src/development/qtestlib.qdoc index 44b682a..65677be 100644 --- a/doc/src/development/qtestlib.qdoc +++ b/doc/src/development/qtestlib.qdoc @@ -751,8 +751,8 @@ Tools for handling and visualizing test data are available as part of the \l {qtestlib-tools} project in the \l{Qt Labs} web site. - These include a tool for comparing performance data obtained from test - runs and a utility to generate Web-based graphs of performance data. + These include a tool for comparing performance data obtained from test + runs and a utility to generate Web-based graphs of performance data. See the \l{qtestlib-tools Announcement}{qtestlib-tools announcement} for more information on these tools and a simple graphing example. diff --git a/doc/src/examples/broadcastreceiver.qdoc b/doc/src/examples/broadcastreceiver.qdoc index ea3c331..3d127dc 100644 --- a/doc/src/examples/broadcastreceiver.qdoc +++ b/doc/src/examples/broadcastreceiver.qdoc @@ -29,7 +29,7 @@ \example network/broadcastreceiver \title Broadcast Receiver Example - The Broadcast Receiever example shows how to receive information that is broadcasted + The Broadcast Receiver example shows how to receive information that is broadcasted over a local network. \image broadcastreceiver-example.png diff --git a/doc/src/examples/combowidgetmapper.qdoc b/doc/src/examples/combowidgetmapper.qdoc index 897d135..e305052 100644 --- a/doc/src/examples/combowidgetmapper.qdoc +++ b/doc/src/examples/combowidgetmapper.qdoc @@ -29,7 +29,7 @@ \example itemviews/combowidgetmapper \title Combo Widget Mapper Example - The Delegate Widget Mapper example shows how to use a custom delegate to + The Combo Widget Mapper example shows how to use a custom delegate to map information from a model to specific widgets on a form. \image combowidgetmapper-example.png diff --git a/doc/src/examples/dragdroprobot.qdoc b/doc/src/examples/dragdroprobot.qdoc index bcf0fe7..0a09314 100644 --- a/doc/src/examples/dragdroprobot.qdoc +++ b/doc/src/examples/dragdroprobot.qdoc @@ -29,7 +29,7 @@ \example graphicsview/dragdroprobot \title Drag and Drop Robot Example - This GraphicsView example shows how to implement Drag and Drop in a + The Drag and Drop Robot example shows how to implement Drag and Drop in a QGraphicsItem subclass, as well as how to animate items using Qt's \l{Animation Framework}. diff --git a/doc/src/examples/elasticnodes.qdoc b/doc/src/examples/elasticnodes.qdoc index bba6d90..8526d55 100644 --- a/doc/src/examples/elasticnodes.qdoc +++ b/doc/src/examples/elasticnodes.qdoc @@ -29,7 +29,7 @@ \example graphicsview/elasticnodes \title Elastic Nodes Example - This GraphicsView example shows how to implement edges between nodes in a + The Elastic Nodes example shows how to implement edges between nodes in a graph, with basic interaction. You can click to drag a node around, and zoom in and out using the mouse wheel or the keyboard. Hitting the space bar will randomize the nodes. The example is also resolution independent; diff --git a/doc/src/examples/ftp.qdoc b/doc/src/examples/ftp.qdoc index 4fa2cfd..841d298 100644 --- a/doc/src/examples/ftp.qdoc +++ b/doc/src/examples/ftp.qdoc @@ -131,7 +131,9 @@ \snippet examples/network/qftp/ftpwindow.cpp 5 - QFtp supports canceling the download of files. + QFtp supports canceling the download of files. We make sure that + any file that is currently being written to is closed and removed, + and tidy up by deleting the file object. \snippet examples/network/qftp/ftpwindow.cpp 6 diff --git a/doc/src/examples/portedasteroids.qdoc b/doc/src/examples/portedasteroids.qdoc index ed622e6..ad34fa7 100644 --- a/doc/src/examples/portedasteroids.qdoc +++ b/doc/src/examples/portedasteroids.qdoc @@ -29,8 +29,9 @@ \example graphicsview/portedasteroids \title Ported Asteroids Example - This GraphicsView example is a port of the - Asteroids game, which was based on QCanvas. + The Ported Asteroids example is a port of the + Asteroids game, which was based on QCanvas, to the Graphics View + framework. \image portedasteroids-example.png */ diff --git a/doc/src/examples/portedcanvas.qdoc b/doc/src/examples/portedcanvas.qdoc index 3363a2d..1799673 100644 --- a/doc/src/examples/portedcanvas.qdoc +++ b/doc/src/examples/portedcanvas.qdoc @@ -29,8 +29,8 @@ \example graphicsview/portedcanvas \title Ported Canvas Example - This GraphicsView example is a port of the old - QCanvas example from Qt 3. + The Ported Canvas example is a port of the old + QCanvas example from Qt 3 to the Graphics View framework. \sa {Porting to Graphics View} diff --git a/doc/src/examples/recipes.qdoc b/doc/src/examples/recipes.qdoc index f34fe3b..8e9619a 100644 --- a/doc/src/examples/recipes.qdoc +++ b/doc/src/examples/recipes.qdoc @@ -29,7 +29,7 @@ \example xmlpatterns/recipes \title Recipes Example - The recipes example shows how to use QtXmlPatterns to query XML data + The Recipes example shows how to use QtXmlPatterns to query XML data loaded from a file. \tableofcontents diff --git a/doc/src/examples/rsslisting.qdoc b/doc/src/examples/rsslisting.qdoc index ca29c04..6bef665 100644 --- a/doc/src/examples/rsslisting.qdoc +++ b/doc/src/examples/rsslisting.qdoc @@ -29,7 +29,7 @@ \example xml/rsslisting \title RSS-Listing Example - This example shows how to create a widget that displays news items + The RSS-Listing example shows how to create a widget that displays news items from RDF news sources. \image rsslistingexample.png diff --git a/doc/src/examples/schema.qdoc b/doc/src/examples/schema.qdoc index 1cc4ed3..3fab7d6 100644 --- a/doc/src/examples/schema.qdoc +++ b/doc/src/examples/schema.qdoc @@ -29,8 +29,8 @@ \example xmlpatterns/schema \title XML Schema Validation Example - This example shows how to use QtXmlPatterns to validate XML with - a W3C XML Schema. + The XML Schema Validation example shows how to use QtXmlPatterns to + validate XML with a W3C XML Schema. \tableofcontents diff --git a/doc/src/platforms/symbian-introduction.qdoc b/doc/src/platforms/symbian-introduction.qdoc index 58a7e69..c033a5f 100644 --- a/doc/src/platforms/symbian-introduction.qdoc +++ b/doc/src/platforms/symbian-introduction.qdoc @@ -152,9 +152,9 @@ when application \c .sis needs to be separately signed before including it into smart installer \c .sis. \row \o \c unsigned_installer_sis \o Create unsigned \l{Smart Installer}{smart installer} - \c .sis file for project. - Note: The application \c .sis contained in smart installer - \c .sis will also be unsigned. + \c .sis file for project. + Note: The application \c .sis contained in smart installer + \c .sis will also be unsigned. \row \o \c stub_sis \o Create a stub sis to allow upgradability of projects that are deployed in ROM \endtable diff --git a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml index 03473ba..1b9a9ec 100644 --- a/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml +++ b/doc/src/snippets/declarative/mousearea/mousearea-snippet.qml @@ -47,53 +47,53 @@ Rectangle { width: 500; height: 500 color: "green" -Column { -//! [anchor fill] -Rectangle { - id: button - width: 100; height: 100 + Column { + //! [anchor fill] + Rectangle { + id: button + width: 100; height: 100 - MouseArea { - anchors.fill: parent - onClicked: console.log("button clicked") - } - MouseArea { - width:150; height: 75 - onClicked: console.log("irregular area clicked") - } -} -//! [anchor fill] + MouseArea { + anchors.fill: parent + onClicked: console.log("button clicked") + } + MouseArea { + width:150; height: 75 + onClicked: console.log("irregular area clicked") + } + } + //! [anchor fill] -Rectangle { - id: button - width: 100; height: 100 + Rectangle { + id: button + width: 100; height: 100 -//! [enable handlers] - MouseArea { - hoverEnabled: true - acceptedButtons: Qt.LeftButton | Qt.RightButton - onEntered: console.log("mouse entered the area") - onExited: console.log("mouse left the area") - } -//! [enable handlers] -} + //! [enable handlers] + MouseArea { + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + onEntered: console.log("mouse entered the area") + onExited: console.log("mouse left the area") + } + //! [enable handlers] + } -Rectangle { - id: button - width: 100; height: 100 + Rectangle { + id: button + width: 100; height: 100 -//! [mouse handlers] - MouseArea { - anchors.fill: parent - onClicked: console.log("area clicked") - onDoubleClicked: console.log("area double clicked") - onEntered: console.log("mouse entered the area") - onExited: console.log("mouse left the area") - } -//! [mouse handlers] -} + //! [mouse handlers] + MouseArea { + anchors.fill: parent + onClicked: console.log("area clicked") + onDoubleClicked: console.log("area double clicked") + onEntered: console.log("mouse entered the area") + onExited: console.log("mouse left the area") + } + //! [mouse handlers] + } -} //end of column + } //end of column //! [parent end] } //! [parent end] diff --git a/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h b/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h index f317d40..763a451 100644 --- a/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h +++ b/doc/src/snippets/declarative/qtbinding/properties-cpp/applicationdata.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/doc/src/tutorials/modelview.qdoc b/doc/src/tutorials/modelview.qdoc index efd0ff2..ed08252 100644 --- a/doc/src/tutorials/modelview.qdoc +++ b/doc/src/tutorials/modelview.qdoc @@ -104,7 +104,6 @@ array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that the table widget provides. - This method is very intuitive and useful in many applications, but displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the diff --git a/examples/animation/animatedtiles/animatedtiles.pro b/examples/animation/animatedtiles/animatedtiles.pro index d700642..17528b7 100644 --- a/examples/animation/animatedtiles/animatedtiles.pro +++ b/examples/animation/animatedtiles/animatedtiles.pro @@ -11,3 +11,4 @@ symbian { TARGET.UID3 = 0xA000D7D1 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/animation/animatedtiles/main.cpp b/examples/animation/animatedtiles/main.cpp index 1badb4f..46b5d1d 100644 --- a/examples/animation/animatedtiles/main.cpp +++ b/examples/animation/animatedtiles/main.cpp @@ -210,7 +210,11 @@ int main(int argc, char **argv) view->setBackgroundBrush(bgPix); view->setCacheMode(QGraphicsView::CacheBackground); view->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); +#ifdef Q_OS_SYMBIAN + view->showMaximized(); +#else view->show(); +#endif QStateMachine states; states.addState(rootState); diff --git a/examples/animation/appchooser/appchooser.pro b/examples/animation/appchooser/appchooser.pro index 7d45da2..8355c6f 100644 --- a/examples/animation/appchooser/appchooser.pro +++ b/examples/animation/appchooser/appchooser.pro @@ -11,3 +11,4 @@ symbian { TARGET.UID3 = 0xA000E3F5 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/animation/appchooser/main.cpp b/examples/animation/appchooser/main.cpp index 86ec073..3788533 100644 --- a/examples/animation/appchooser/main.cpp +++ b/examples/animation/appchooser/main.cpp @@ -80,6 +80,21 @@ private: QPixmap p; }; +class GraphicsView : public QGraphicsView +{ + Q_OBJECT +public: + GraphicsView(QGraphicsScene *scene, QWidget *parent = 0) : QGraphicsView(scene, parent) + { + } + + virtual void resizeEvent(QResizeEvent *event) + { + fitInView(sceneRect(), Qt::KeepAspectRatio); + } +}; + + void createStates(const QObjectList &objects, const QRect &selectedRect, QState *parent) { @@ -112,10 +127,10 @@ int main(int argc, char **argv) p3->setObjectName("p3"); p4->setObjectName("p4"); - p1->setGeometry(QRectF(0.0, 0.0, 64.0, 64.0)); - p2->setGeometry(QRectF(236.0, 0.0, 64.0, 64.0)); + p1->setGeometry(QRectF( 0.0, 0.0, 64.0, 64.0)); + p2->setGeometry(QRectF(236.0, 0.0, 64.0, 64.0)); p3->setGeometry(QRectF(236.0, 236.0, 64.0, 64.0)); - p4->setGeometry(QRectF(0.0, 236.0, 64.0, 64.0)); + p4->setGeometry(QRectF( 0.0, 236.0, 64.0, 64.0)); QGraphicsScene scene(0, 0, 300, 300); scene.setBackgroundBrush(Qt::white); @@ -124,7 +139,7 @@ int main(int argc, char **argv) scene.addItem(p3); scene.addItem(p4); - QGraphicsView window(&scene); + GraphicsView window(&scene); window.setFrameStyle(0); window.setAlignment(Qt::AlignLeft | Qt::AlignTop); window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -135,12 +150,13 @@ int main(int argc, char **argv) QState *group = new QState(&machine); group->setObjectName("group"); + QRect selectedRect(86, 86, 128, 128); QState *idleState = new QState(group); group->setInitialState(idleState); - QObjectList objects; + QObjectList objects; objects << p1 << p2 << p3 << p4; createStates(objects, selectedRect, group); createAnimations(objects, &machine); @@ -148,8 +164,12 @@ int main(int argc, char **argv) machine.setInitialState(group); machine.start(); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + window.showMaximized(); +#else window.resize(300, 300); window.show(); +#endif return app.exec(); } diff --git a/examples/animation/easing/easing.pro b/examples/animation/easing/easing.pro index a8eda70..763a680 100644 --- a/examples/animation/easing/easing.pro +++ b/examples/animation/easing/easing.pro @@ -5,15 +5,18 @@ SOURCES = main.cpp \ FORMS = form.ui -RESOURCES = easing.qrc +RESOURCES = easing.qrc -# install target.path = $$[QT_INSTALL_EXAMPLES]/animation/easing sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS easing.pro images sources.path = $$[QT_INSTALL_EXAMPLES]/animation/easing -INSTALLS += target sources +INSTALLS += sources + +INSTALLS += target symbian { TARGET.UID3 = 0xA000E3F6 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } + +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/animation/easing/form.ui b/examples/animation/easing/form.ui index b60ade8..364aebe 100644 --- a/examples/animation/easing/form.ui +++ b/examples/animation/easing/form.ui @@ -49,12 +49,27 @@ + + + 16777215 + 16777215 + + Path type - - + + + + + 16777215 + 40 + + + + Qt::LeftToRight + Line @@ -66,8 +81,14 @@ - + + + + 16777215 + 40 + + Circle @@ -96,6 +117,18 @@ + + + 0 + 0 + + + + + 0 + 30 + + Period @@ -106,6 +139,18 @@ false + + + 0 + 0 + + + + + 0 + 30 + + -1.000000000000000 @@ -117,18 +162,17 @@ - - - - Amplitude - - - - + false + + + 0 + 30 + + -1.000000000000000 @@ -140,18 +184,30 @@ - + + + + 0 + 30 + + Overshoot - + false + + + 0 + 30 + + -1.000000000000000 @@ -163,6 +219,19 @@ + + + + + 0 + 30 + + + + Amplitude + + + diff --git a/examples/animation/easing/main.cpp b/examples/animation/easing/main.cpp index def1db2..66a6958 100644 --- a/examples/animation/easing/main.cpp +++ b/examples/animation/easing/main.cpp @@ -46,7 +46,15 @@ int main(int argc, char **argv) Q_INIT_RESOURCE(easing); QApplication app(argc, argv); Window w; + +#if defined(Q_OS_SYMBIAN) + w.showMaximized(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + w.show(); +#else w.resize(400, 400); w.show(); +#endif + return app.exec(); } diff --git a/examples/animation/easing/window.cpp b/examples/animation/easing/window.cpp index b466cec..869bca4 100644 --- a/examples/animation/easing/window.cpp +++ b/examples/animation/easing/window.cpp @@ -41,7 +41,12 @@ #include "window.h" Window::Window(QWidget *parent) - : QWidget(parent), m_iconSize(64, 64) + : QWidget(parent), +#if defined(Q_OS_SYMBIAN) || defined(Q_WS_SIMULATOR) + m_iconSize(32, 32) +#else + m_iconSize(64, 64) +#endif { m_ui.setupUi(this); QButtonGroup *buttonGroup = findChild(); // ### workaround for uic in 4.4 diff --git a/examples/animation/easing/window.h b/examples/animation/easing/window.h index bbdf14e..17899a4 100644 --- a/examples/animation/easing/window.h +++ b/examples/animation/easing/window.h @@ -39,7 +39,6 @@ ****************************************************************************/ #include - #include "ui_form.h" #include "animation.h" @@ -73,6 +72,4 @@ private: PixmapItem *m_item; Animation *m_anim; QSize m_iconSize; - - }; diff --git a/examples/animation/moveblocks/main.cpp b/examples/animation/moveblocks/main.cpp index 3194c1b..ca1876f 100644 --- a/examples/animation/moveblocks/main.cpp +++ b/examples/animation/moveblocks/main.cpp @@ -154,25 +154,28 @@ QState *createGeometryState(QObject *w1, const QRect &rect1, } //![13] + +class GraphicsView : public QGraphicsView +{ + Q_OBJECT +public: + GraphicsView(QGraphicsScene *scene, QWidget *parent = NULL) : QGraphicsView(scene, parent) + { + } + +protected: + virtual void resizeEvent(QResizeEvent *event) + { + fitInView(scene()->sceneRect()); + QGraphicsView::resizeEvent(event); + } +}; + + int main(int argc, char **argv) { QApplication app(argc, argv); -#if 0 - QWidget window; - QPalette palette; - palette.setBrush(QPalette::Window, Qt::black); - window.setPalette(palette); - QPushButton *button1 = new QPushButton("A", &window); - QPushButton *button2 = new QPushButton("B", &window); - QPushButton *button3 = new QPushButton("C", &window); - QPushButton *button4 = new QPushButton("D", &window); - - button1->setObjectName("button1"); - button2->setObjectName("button2"); - button3->setObjectName("button3"); - button4->setObjectName("button4"); -#else //![1] QGraphicsRectWidget *button1 = new QGraphicsRectWidget; QGraphicsRectWidget *button2 = new QGraphicsRectWidget; @@ -188,12 +191,11 @@ int main(int argc, char **argv) scene.addItem(button3); scene.addItem(button4); //![1] - QGraphicsView window(&scene); + GraphicsView window(&scene); window.setFrameStyle(0); window.setAlignment(Qt::AlignLeft | Qt::AlignTop); window.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); window.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); -#endif //![2] QStateMachine machine; @@ -308,8 +310,13 @@ int main(int argc, char **argv) machine.start(); //![9] +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) + window.showMaximized(); + window.fitInView(scene.sceneRect() ); +#else window.resize(300, 300); window.show(); +#endif qsrand(QTime(0,0,0).secsTo(QTime::currentTime())); diff --git a/examples/animation/moveblocks/moveblocks.pro b/examples/animation/moveblocks/moveblocks.pro index 0a32ecf..ad83ba0 100644 --- a/examples/animation/moveblocks/moveblocks.pro +++ b/examples/animation/moveblocks/moveblocks.pro @@ -10,3 +10,4 @@ symbian { TARGET.UID3 = 0xA000E3F7 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/animation/states/main.cpp b/examples/animation/states/main.cpp index 1565489..d49aa41 100644 --- a/examples/animation/states/main.cpp +++ b/examples/animation/states/main.cpp @@ -62,6 +62,19 @@ private: QPixmap p; }; +class GraphicsView : public QGraphicsView +{ +public: + GraphicsView(QGraphicsScene *scene) : QGraphicsView(scene) + { + } + + virtual void resizeEvent(QResizeEvent *event) + { + fitInView(sceneRect(), Qt::KeepAspectRatio); + } +}; + int main(int argc, char *argv[]) { Q_INIT_RESOURCE(states); @@ -130,12 +143,12 @@ int main(int argc, char *argv[]) state1->assignProperty(button, "text", "Switch to state 2"); state1->assignProperty(widget, "geometry", QRectF(0, 0, 400, 150)); state1->assignProperty(box, "geometry", QRect(-200, 150, 200, 150)); - state1->assignProperty(p1, "pos", QPointF(68, 185)); - state1->assignProperty(p2, "pos", QPointF(168, 185)); - state1->assignProperty(p3, "pos", QPointF(268, 185)); - state1->assignProperty(p4, "pos", QPointF(68-150, 48-150)); - state1->assignProperty(p5, "pos", QPointF(168, 48-150)); - state1->assignProperty(p6, "pos", QPointF(268+150, 48-150)); + state1->assignProperty(p1, "pos", QPointF(68, 200)); // 185)); + state1->assignProperty(p2, "pos", QPointF(168, 200)); // 185)); + state1->assignProperty(p3, "pos", QPointF(268, 200)); // 185)); + state1->assignProperty(p4, "pos", QPointF(68 - 150, 48 - 150)); + state1->assignProperty(p5, "pos", QPointF(168, 48 - 150)); + state1->assignProperty(p6, "pos", QPointF(268 + 150, 48 - 150)); state1->assignProperty(p1, "rotation", qreal(0)); state1->assignProperty(p2, "rotation", qreal(0)); state1->assignProperty(p3, "rotation", qreal(0)); @@ -154,9 +167,9 @@ int main(int argc, char *argv[]) state2->assignProperty(button, "text", "Switch to state 3"); state2->assignProperty(widget, "geometry", QRectF(200, 150, 200, 150)); state2->assignProperty(box, "geometry", QRect(9, 150, 190, 150)); - state2->assignProperty(p1, "pos", QPointF(68-150, 185+150)); - state2->assignProperty(p2, "pos", QPointF(168, 185+150)); - state2->assignProperty(p3, "pos", QPointF(268+150, 185+150)); + state2->assignProperty(p1, "pos", QPointF(68 - 150, 185 + 150)); + state2->assignProperty(p2, "pos", QPointF(168, 185 + 150)); + state2->assignProperty(p3, "pos", QPointF(268 + 150, 185 + 150)); state2->assignProperty(p4, "pos", QPointF(64, 48)); state2->assignProperty(p5, "pos", QPointF(168, 48)); state2->assignProperty(p6, "pos", QPointF(268, 48)); @@ -262,8 +275,13 @@ int main(int argc, char *argv[]) machine.start(); - QGraphicsView view(&scene); + GraphicsView view(&scene); + +#if defined(Q_OS_SYMBIAN) + view.showMaximized(); +#else view.show(); +#endif return app.exec(); } diff --git a/examples/animation/states/states.pro b/examples/animation/states/states.pro index 9d9a9c1..307e098 100644 --- a/examples/animation/states/states.pro +++ b/examples/animation/states/states.pro @@ -11,3 +11,4 @@ symbian { TARGET.UID3 = 0xA000E3F8 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/animation/stickman/graphicsview.cpp b/examples/animation/stickman/graphicsview.cpp index 23036ef..0f7ce5f 100644 --- a/examples/animation/stickman/graphicsview.cpp +++ b/examples/animation/stickman/graphicsview.cpp @@ -54,4 +54,7 @@ void GraphicsView::keyPressEvent(QKeyEvent *e) emit keyPressed(Qt::Key(e->key())); } - +void GraphicsView::resizeEvent(QResizeEvent *event) +{ + fitInView(scene()->sceneRect()); +} diff --git a/examples/animation/stickman/graphicsview.h b/examples/animation/stickman/graphicsview.h index 9cf87b6..400e4a6 100644 --- a/examples/animation/stickman/graphicsview.h +++ b/examples/animation/stickman/graphicsview.h @@ -51,6 +51,7 @@ public: GraphicsView(QWidget *parent = 0); protected: + virtual void resizeEvent(QResizeEvent *event); void keyPressEvent(QKeyEvent *); signals: diff --git a/examples/animation/stickman/lifecycle.cpp b/examples/animation/stickman/lifecycle.cpp index 4abcdc2..8e9dbe1 100644 --- a/examples/animation/stickman/lifecycle.cpp +++ b/examples/animation/stickman/lifecycle.cpp @@ -159,10 +159,14 @@ void LifeCycle::start() m_machine->start(); } -void LifeCycle::addActivity(const QString &fileName, Qt::Key key) +void LifeCycle::addActivity(const QString &fileName, Qt::Key key, QObject *sender, const char *signal) { QState *state = makeState(m_alive, fileName); m_alive->addTransition(new KeyPressTransition(m_keyReceiver, key, state)); + + if((sender != NULL) || (signal != NULL)) { + m_alive->addTransition(sender, signal, state); + } } QState *LifeCycle::makeState(QState *parentState, const QString &animationFileName) diff --git a/examples/animation/stickman/lifecycle.h b/examples/animation/stickman/lifecycle.h index 1bf3661..ca1a052 100644 --- a/examples/animation/stickman/lifecycle.h +++ b/examples/animation/stickman/lifecycle.h @@ -50,6 +50,7 @@ class QAnimationGroup; class QState; class QAbstractState; class QAbstractTransition; +class QObject; QT_END_NAMESPACE class GraphicsView; class LifeCycle @@ -59,7 +60,7 @@ public: ~LifeCycle(); void setDeathAnimation(const QString &fileName); - void addActivity(const QString &fileName, Qt::Key key); + void addActivity(const QString &fileName, Qt::Key key, QObject *sender = NULL, const char *signal = NULL); void start(); diff --git a/examples/animation/stickman/main.cpp b/examples/animation/stickman/main.cpp index 08df766..902e572 100644 --- a/examples/animation/stickman/main.cpp +++ b/examples/animation/stickman/main.cpp @@ -43,6 +43,7 @@ #include "lifecycle.h" #include "stickman.h" #include "graphicsview.h" +#include "rectbutton.h" #include #include @@ -55,6 +56,11 @@ int main(int argc, char **argv) StickMan *stickMan = new StickMan; stickMan->setDrawSticks(false); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + RectButton *buttonJump = new RectButton("Jump"); buttonJump->setPos(100, 125); + RectButton *buttonDance = new RectButton("Dance"); buttonDance->setPos(100, 200); + RectButton *buttonChill = new RectButton("Chill"); buttonChill->setPos(100, 275); +#else QGraphicsTextItem *textItem = new QGraphicsTextItem(); textItem->setHtml("Stickman" "

" @@ -71,31 +77,55 @@ int main(int argc, char **argv) qreal w = textItem->boundingRect().width(); QRectF stickManBoundingRect = stickMan->mapToScene(stickMan->boundingRect()).boundingRect(); textItem->setPos(-w / 2.0, stickManBoundingRect.bottom() + 25.0); +#endif QGraphicsScene scene; scene.addItem(stickMan); + +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + scene.addItem(buttonJump); + scene.addItem(buttonDance); + scene.addItem(buttonChill); +#else scene.addItem(textItem); +#endif scene.setBackgroundBrush(Qt::black); GraphicsView view; view.setRenderHints(QPainter::Antialiasing); view.setTransformationAnchor(QGraphicsView::NoAnchor); view.setScene(&scene); - view.show(); - view.setFocus(); QRectF sceneRect = scene.sceneRect(); // making enough room in the scene for stickman to jump and die view.resize(sceneRect.width() + 100, sceneRect.height() + 100); view.setSceneRect(sceneRect); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + view.showMaximized(); + view.fitInView(scene.sceneRect(), Qt::KeepAspectRatio); +#else + view.show(); + view.setFocus(); +#endif + LifeCycle cycle(stickMan, &view); cycle.setDeathAnimation(":/animations/dead"); +#if defined(Q_WS_S60) || defined(Q_WS_MAEMO_5) || defined(Q_WS_SIMULATOR) + cycle.addActivity(":/animations/jumping", Qt::Key_J, buttonJump, SIGNAL(clicked())); + cycle.addActivity(":/animations/dancing", Qt::Key_D, buttonDance, SIGNAL(clicked())); + cycle.addActivity(":/animations/chilling", Qt::Key_C, buttonChill, SIGNAL(clicked())); +#else cycle.addActivity(":/animations/jumping", Qt::Key_J); cycle.addActivity(":/animations/dancing", Qt::Key_D); cycle.addActivity(":/animations/chilling", Qt::Key_C); +#endif + cycle.start(); + return app.exec(); } diff --git a/examples/animation/stickman/stickman.pro b/examples/animation/stickman/stickman.pro index 37ff8d3..db0c4e5 100644 --- a/examples/animation/stickman/stickman.pro +++ b/examples/animation/stickman/stickman.pro @@ -2,13 +2,15 @@ HEADERS += stickman.h \ animation.h \ node.h \ lifecycle.h \ - graphicsview.h + graphicsview.h \ + rectbutton.h SOURCES += main.cpp \ stickman.cpp \ animation.cpp \ node.cpp \ lifecycle.cpp \ - graphicsview.cpp + graphicsview.cpp \ + rectbutton.cpp RESOURCES += stickman.qrc @@ -22,3 +24,4 @@ symbian { TARGET.UID3 = 0xA000E3F9 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/dbus/complexpingpong/complexping.pro b/examples/dbus/complexpingpong/complexping.pro index a01aed6..276a39b 100644 --- a/examples/dbus/complexpingpong/complexping.pro +++ b/examples/dbus/complexpingpong/complexping.pro @@ -1,5 +1,4 @@ TEMPLATE = app -TARGET = DEPENDPATH += . INCLUDEPATH += . QT -= gui @@ -16,3 +15,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/complexpingpong INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/complexpingpong/complexpong.pro b/examples/dbus/complexpingpong/complexpong.pro index f60863f..4bb036a 100644 --- a/examples/dbus/complexpingpong/complexpong.pro +++ b/examples/dbus/complexpingpong/complexpong.pro @@ -1,5 +1,4 @@ TEMPLATE = app -TARGET = DEPENDPATH += . INCLUDEPATH += . QT -= gui @@ -16,3 +15,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/complexpingpong INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/dbus-chat/dbus-chat.pro b/examples/dbus/dbus-chat/dbus-chat.pro index 1316f64..5ed1bcc 100644 --- a/examples/dbus/dbus-chat/dbus-chat.pro +++ b/examples/dbus/dbus-chat/dbus-chat.pro @@ -1,5 +1,4 @@ TEMPLATE = app -TARGET = DEPENDPATH += . INCLUDEPATH += . CONFIG += qdbus @@ -19,3 +18,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/chat INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/dbus.pro b/examples/dbus/dbus.pro index e599334..f6629b9 100644 --- a/examples/dbus/dbus.pro +++ b/examples/dbus/dbus.pro @@ -14,4 +14,3 @@ sources.files = *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/dbus INSTALLS += sources -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/dbus/listnames/listnames.pro b/examples/dbus/listnames/listnames.pro index 4b484a5..4809ded 100644 --- a/examples/dbus/listnames/listnames.pro +++ b/examples/dbus/listnames/listnames.pro @@ -1,5 +1,4 @@ TEMPLATE = app -TARGET = DEPENDPATH += . INCLUDEPATH += . QT -= gui @@ -16,4 +15,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/listnames INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/pingpong/ping.pro b/examples/dbus/pingpong/ping.pro index 4b1affe..6d961c6 100644 --- a/examples/dbus/pingpong/ping.pro +++ b/examples/dbus/pingpong/ping.pro @@ -16,3 +16,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/pingpong INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/pingpong/pong.pro b/examples/dbus/pingpong/pong.pro index bd824e1..812677e 100644 --- a/examples/dbus/pingpong/pong.pro +++ b/examples/dbus/pingpong/pong.pro @@ -16,3 +16,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/pingpong INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/remotecontrolledcar/car/car.pro b/examples/dbus/remotecontrolledcar/car/car.pro index d362dc9..9a6931b 100644 --- a/examples/dbus/remotecontrolledcar/car/car.pro +++ b/examples/dbus/remotecontrolledcar/car/car.pro @@ -3,7 +3,6 @@ ###################################################################### TEMPLATE = app -TARGET = DEPENDPATH += . INCLUDEPATH += . CONFIG += qdbus @@ -20,3 +19,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar/car INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/remotecontrolledcar/controller/controller.pro b/examples/dbus/remotecontrolledcar/controller/controller.pro index 375b9d7..788f0fe 100644 --- a/examples/dbus/remotecontrolledcar/controller/controller.pro +++ b/examples/dbus/remotecontrolledcar/controller/controller.pro @@ -3,7 +3,6 @@ ###################################################################### TEMPLATE = app -TARGET = DEPENDPATH += . INCLUDEPATH += . CONFIG += qdbus @@ -21,3 +20,6 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar/controller INSTALLS += target sources symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) +symbian: warning(This example does not work on Symbian platform) +simulator: warning(This example does not work on Simulator platform) diff --git a/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro index 6f29977..bb97388 100644 --- a/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro +++ b/examples/dbus/remotecontrolledcar/remotecontrolledcar.pro @@ -7,4 +7,3 @@ sources.files = *.pro sources.path = $$[QT_INSTALL_EXAMPLES]/dbus/remotecontrolledcar INSTALLS += sources -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/declarative/animation/animation.qmlproject b/examples/declarative/animation/animation.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/animation/animation.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/animation/basics/basics.qmlproject b/examples/declarative/animation/basics/basics.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/animation/basics/basics.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/animation/basics/images/face-smile.png b/examples/declarative/animation/basics/images/face-smile.png deleted file mode 100644 index 3d66d72..0000000 Binary files a/examples/declarative/animation/basics/images/face-smile.png and /dev/null differ diff --git a/examples/declarative/animation/basics/images/moon.png b/examples/declarative/animation/basics/images/moon.png deleted file mode 100644 index 9407b2b..0000000 Binary files a/examples/declarative/animation/basics/images/moon.png and /dev/null differ diff --git a/examples/declarative/animation/basics/images/shadow.png b/examples/declarative/animation/basics/images/shadow.png deleted file mode 100644 index 8270565..0000000 Binary files a/examples/declarative/animation/basics/images/shadow.png and /dev/null differ diff --git a/examples/declarative/animation/basics/images/star.png b/examples/declarative/animation/basics/images/star.png deleted file mode 100644 index 27ef924..0000000 Binary files a/examples/declarative/animation/basics/images/star.png and /dev/null differ diff --git a/examples/declarative/animation/basics/images/sun.png b/examples/declarative/animation/basics/images/sun.png deleted file mode 100644 index 7713ca5..0000000 Binary files a/examples/declarative/animation/basics/images/sun.png and /dev/null differ diff --git a/examples/declarative/animation/behaviors/behaviors.qmlproject b/examples/declarative/animation/behaviors/behaviors.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/animation/behaviors/behaviors.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/animation/easing/content/quit.png b/examples/declarative/animation/easing/content/quit.png deleted file mode 100644 index b822057..0000000 Binary files a/examples/declarative/animation/easing/content/quit.png and /dev/null differ diff --git a/examples/declarative/animation/easing/easing.qmlproject b/examples/declarative/animation/easing/easing.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/animation/easing/easing.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/animation/states/qt-logo.png b/examples/declarative/animation/states/qt-logo.png deleted file mode 100644 index 14ddf2a..0000000 Binary files a/examples/declarative/animation/states/qt-logo.png and /dev/null differ diff --git a/examples/declarative/animation/states/states.qmlproject b/examples/declarative/animation/states/states.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/animation/states/states.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.pro b/examples/declarative/cppextensions/imageprovider/imageprovider.pro index f700f0b..6493640 100644 --- a/examples/declarative/cppextensions/imageprovider/imageprovider.pro +++ b/examples/declarative/cppextensions/imageprovider/imageprovider.pro @@ -26,3 +26,4 @@ symbian:{ importFiles.path = ImageProviderCore DEPLOYMENT += importFiles } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/declarative/cppextensions/plugins/plugins.pro b/examples/declarative/cppextensions/plugins/plugins.pro index b7610a8..0b9a354 100644 --- a/examples/declarative/cppextensions/plugins/plugins.pro +++ b/examples/declarative/cppextensions/plugins/plugins.pro @@ -27,3 +27,4 @@ symbian { include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.EPOCALLOWDLLDATA = 1 } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.pro b/examples/declarative/cppextensions/qwidgets/qwidgets.pro index d92e072..4b69432 100644 --- a/examples/declarative/cppextensions/qwidgets/qwidgets.pro +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.pro @@ -22,3 +22,4 @@ symbian:{ DEPLOYMENT += importFiles } +maemo5: include($$QT_SOURCE_TREE/examples/maemo5pkgrules.pri) diff --git a/examples/declarative/examples.qmlproject b/examples/declarative/examples.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/examples.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/i18n/i18n.qmlproject b/examples/declarative/i18n/i18n.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/i18n/i18n.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/i18n/i18n/base.ts b/examples/declarative/i18n/i18n/base.ts deleted file mode 100644 index 82547a1..0000000 --- a/examples/declarative/i18n/i18n/base.ts +++ /dev/null @@ -1,12 +0,0 @@ - - - - - i18n - - - Hello - - - - diff --git a/examples/declarative/i18n/i18n/qml_en_AU.qm b/examples/declarative/i18n/i18n/qml_en_AU.qm deleted file mode 100644 index fb8b710..0000000 Binary files a/examples/declarative/i18n/i18n/qml_en_AU.qm and /dev/null differ diff --git a/examples/declarative/i18n/i18n/qml_en_AU.ts b/examples/declarative/i18n/i18n/qml_en_AU.ts deleted file mode 100644 index e991aff..0000000 --- a/examples/declarative/i18n/i18n/qml_en_AU.ts +++ /dev/null @@ -1,12 +0,0 @@ - - - - - i18n - - - Hello - G'day - - - diff --git a/examples/declarative/i18n/i18n/qml_fr.qm b/examples/declarative/i18n/i18n/qml_fr.qm deleted file mode 100644 index 583562e..0000000 Binary files a/examples/declarative/i18n/i18n/qml_fr.qm and /dev/null differ diff --git a/examples/declarative/i18n/i18n/qml_fr.ts b/examples/declarative/i18n/i18n/qml_fr.ts deleted file mode 100644 index 365abd9..0000000 --- a/examples/declarative/i18n/i18n/qml_fr.ts +++ /dev/null @@ -1,12 +0,0 @@ - - - - - i18n - - - Hello - Bonjour - - - diff --git a/examples/declarative/imageelements/borderimage/borderimage.qmlproject b/examples/declarative/imageelements/borderimage/borderimage.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/imageelements/borderimage/borderimage.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/imageelements/borderimage/content/bw.png b/examples/declarative/imageelements/borderimage/content/bw.png deleted file mode 100644 index 486eaae..0000000 Binary files a/examples/declarative/imageelements/borderimage/content/bw.png and /dev/null differ diff --git a/examples/declarative/imageelements/borderimage/content/colors-round.sci b/examples/declarative/imageelements/borderimage/content/colors-round.sci deleted file mode 100644 index 506f6f5..0000000 --- a/examples/declarative/imageelements/borderimage/content/colors-round.sci +++ /dev/null @@ -1,7 +0,0 @@ -border.left:30 -border.top:30 -border.right:30 -border.bottom:30 -horizontalTileRule:Round -verticalTileRule:Round -source:colors.png diff --git a/examples/declarative/imageelements/borderimage/content/colors-stretch.sci b/examples/declarative/imageelements/borderimage/content/colors-stretch.sci deleted file mode 100644 index e4989a7..0000000 --- a/examples/declarative/imageelements/borderimage/content/colors-stretch.sci +++ /dev/null @@ -1,5 +0,0 @@ -border.left:30 -border.top:30 -border.right:30 -border.bottom:30 -source:colors.png diff --git a/examples/declarative/imageelements/borderimage/content/colors.png b/examples/declarative/imageelements/borderimage/content/colors.png deleted file mode 100644 index dfb62f3..0000000 Binary files a/examples/declarative/imageelements/borderimage/content/colors.png and /dev/null differ diff --git a/examples/declarative/imageelements/borderimage/content/shadow.png b/examples/declarative/imageelements/borderimage/content/shadow.png deleted file mode 100644 index 431af85..0000000 Binary files a/examples/declarative/imageelements/borderimage/content/shadow.png and /dev/null differ diff --git a/examples/declarative/imageelements/image/image.qmlproject b/examples/declarative/imageelements/image/image.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/imageelements/image/image.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/imageelements/image/qt-logo.png b/examples/declarative/imageelements/image/qt-logo.png deleted file mode 100644 index 14ddf2a..0000000 Binary files a/examples/declarative/imageelements/image/qt-logo.png and /dev/null differ diff --git a/examples/declarative/imageelements/imageelements.qmlproject b/examples/declarative/imageelements/imageelements.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/imageelements/imageelements.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/keyinteraction/focus/Core/images/arrow.png b/examples/declarative/keyinteraction/focus/Core/images/arrow.png deleted file mode 100644 index 14978c2..0000000 Binary files a/examples/declarative/keyinteraction/focus/Core/images/arrow.png and /dev/null differ diff --git a/examples/declarative/keyinteraction/focus/Core/images/qt-logo.png b/examples/declarative/keyinteraction/focus/Core/images/qt-logo.png deleted file mode 100644 index 14ddf2a..0000000 Binary files a/examples/declarative/keyinteraction/focus/Core/images/qt-logo.png and /dev/null differ diff --git a/examples/declarative/keyinteraction/focus/focus.qmlproject b/examples/declarative/keyinteraction/focus/focus.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/keyinteraction/focus/focus.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/keyinteraction/keyinteraction.qmlproject b/examples/declarative/keyinteraction/keyinteraction.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/keyinteraction/keyinteraction.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/modelviews/gridview/gridview.qmlproject b/examples/declarative/modelviews/gridview/gridview.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/modelviews/gridview/gridview.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/modelviews/gridview/pics/AddressBook_48.png b/examples/declarative/modelviews/gridview/pics/AddressBook_48.png deleted file mode 100644 index 1ab7c8e..0000000 Binary files a/examples/declarative/modelviews/gridview/pics/AddressBook_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/gridview/pics/AudioPlayer_48.png b/examples/declarative/modelviews/gridview/pics/AudioPlayer_48.png deleted file mode 100644 index f4b8689..0000000 Binary files a/examples/declarative/modelviews/gridview/pics/AudioPlayer_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/gridview/pics/Camera_48.png b/examples/declarative/modelviews/gridview/pics/Camera_48.png deleted file mode 100644 index c76b524..0000000 Binary files a/examples/declarative/modelviews/gridview/pics/Camera_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/gridview/pics/DateBook_48.png b/examples/declarative/modelviews/gridview/pics/DateBook_48.png deleted file mode 100644 index 58f5787..0000000 Binary files a/examples/declarative/modelviews/gridview/pics/DateBook_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/gridview/pics/EMail_48.png b/examples/declarative/modelviews/gridview/pics/EMail_48.png deleted file mode 100644 index d6d84a6..0000000 Binary files a/examples/declarative/modelviews/gridview/pics/EMail_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/gridview/pics/TodoList_48.png b/examples/declarative/modelviews/gridview/pics/TodoList_48.png deleted file mode 100644 index 0988448..0000000 Binary files a/examples/declarative/modelviews/gridview/pics/TodoList_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/gridview/pics/VideoPlayer_48.png b/examples/declarative/modelviews/gridview/pics/VideoPlayer_48.png deleted file mode 100644 index 52638c5..0000000 Binary files a/examples/declarative/modelviews/gridview/pics/VideoPlayer_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/fruit-salad.jpg b/examples/declarative/modelviews/listview/content/pics/fruit-salad.jpg deleted file mode 100644 index da5a6b1..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/fruit-salad.jpg and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/hamburger.jpg b/examples/declarative/modelviews/listview/content/pics/hamburger.jpg deleted file mode 100644 index d0a15be..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/hamburger.jpg and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/lemonade.jpg b/examples/declarative/modelviews/listview/content/pics/lemonade.jpg deleted file mode 100644 index db445c9..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/lemonade.jpg and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/moreDown.png b/examples/declarative/modelviews/listview/content/pics/moreDown.png deleted file mode 100644 index 31a35d5..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/moreDown.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/moreUp.png b/examples/declarative/modelviews/listview/content/pics/moreUp.png deleted file mode 100644 index fefb9c9..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/moreUp.png and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/pancakes.jpg b/examples/declarative/modelviews/listview/content/pics/pancakes.jpg deleted file mode 100644 index 60c4396..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/pancakes.jpg and /dev/null differ diff --git a/examples/declarative/modelviews/listview/content/pics/vegetable-soup.jpg b/examples/declarative/modelviews/listview/content/pics/vegetable-soup.jpg deleted file mode 100644 index 9dce332..0000000 Binary files a/examples/declarative/modelviews/listview/content/pics/vegetable-soup.jpg and /dev/null differ diff --git a/examples/declarative/modelviews/listview/listview.qmlproject b/examples/declarative/modelviews/listview/listview.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/modelviews/listview/listview.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/modelviews/modelviews.qmlproject b/examples/declarative/modelviews/modelviews.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/modelviews/modelviews.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/modelviews/package/package.qmlproject b/examples/declarative/modelviews/package/package.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/modelviews/package/package.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/modelviews/pathview/pathview.qmlproject b/examples/declarative/modelviews/pathview/pathview.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/modelviews/pathview/pathview.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/modelviews/pathview/pics/AddressBook_48.png b/examples/declarative/modelviews/pathview/pics/AddressBook_48.png deleted file mode 100644 index 1ab7c8e..0000000 Binary files a/examples/declarative/modelviews/pathview/pics/AddressBook_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/pathview/pics/AudioPlayer_48.png b/examples/declarative/modelviews/pathview/pics/AudioPlayer_48.png deleted file mode 100644 index f4b8689..0000000 Binary files a/examples/declarative/modelviews/pathview/pics/AudioPlayer_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/pathview/pics/Camera_48.png b/examples/declarative/modelviews/pathview/pics/Camera_48.png deleted file mode 100644 index c76b524..0000000 Binary files a/examples/declarative/modelviews/pathview/pics/Camera_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/pathview/pics/DateBook_48.png b/examples/declarative/modelviews/pathview/pics/DateBook_48.png deleted file mode 100644 index 58f5787..0000000 Binary files a/examples/declarative/modelviews/pathview/pics/DateBook_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/pathview/pics/EMail_48.png b/examples/declarative/modelviews/pathview/pics/EMail_48.png deleted file mode 100644 index d6d84a6..0000000 Binary files a/examples/declarative/modelviews/pathview/pics/EMail_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/pathview/pics/TodoList_48.png b/examples/declarative/modelviews/pathview/pics/TodoList_48.png deleted file mode 100644 index 0988448..0000000 Binary files a/examples/declarative/modelviews/pathview/pics/TodoList_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/pathview/pics/VideoPlayer_48.png b/examples/declarative/modelviews/pathview/pics/VideoPlayer_48.png deleted file mode 100644 index 52638c5..0000000 Binary files a/examples/declarative/modelviews/pathview/pics/VideoPlayer_48.png and /dev/null differ diff --git a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.qmlproject b/examples/declarative/modelviews/visualitemmodel/visualitemmodel.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/modelviews/visualitemmodel/visualitemmodel.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/modelviews/webview/alerts.html b/examples/declarative/modelviews/webview/alerts.html deleted file mode 100644 index 82caddf..0000000 --- a/examples/declarative/modelviews/webview/alerts.html +++ /dev/null @@ -1,5 +0,0 @@ - - -

This is a web page. It fires an alert when clicked. - - diff --git a/examples/declarative/modelviews/webview/content/Mapping/map.html b/examples/declarative/modelviews/webview/content/Mapping/map.html deleted file mode 100755 index a98da54..0000000 --- a/examples/declarative/modelviews/webview/content/Mapping/map.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - -

- - diff --git a/examples/declarative/modelviews/webview/c