diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-08-05 02:12:31 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-08-05 02:12:31 (GMT) |
commit | 5a98d58c1ed78262c20b05aa178a92b4a1a097df (patch) | |
tree | 00c8c459c2bdbf438a35e5087250319d4766fe29 | |
parent | 7de5f19f0f62f181132394da6d7b2c8484cd42d9 (diff) | |
parent | 5749421fdaff0305d217712e3174c85a76b367c4 (diff) | |
download | Qt-5a98d58c1ed78262c20b05aa178a92b4a1a097df.zip Qt-5a98d58c1ed78262c20b05aa178a92b4a1a097df.tar.gz Qt-5a98d58c1ed78262c20b05aa178a92b4a1a097df.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
162 files changed, 4020 insertions, 1873 deletions
@@ -794,6 +794,7 @@ OPT_VERBOSE=no OPT_HELP= CFG_SILENT=no CFG_GRAPHICS_SYSTEM=default +CFG_RUNTIME_SYSTEM= CFG_ALSA=auto CFG_PULSEAUDIO=auto CFG_COREWLAN=auto @@ -823,6 +824,7 @@ QT_LFLAGS_MYSQL_R= QT_CFLAGS_SQLITE= QT_LFLAGS_SQLITE= QT_LFLAGS_ODBC="-lodbc" +QT_LFLAGS_TDS= # flags for libdbus-1 QT_CFLAGS_DBUS= @@ -1036,6 +1038,11 @@ while [ "$#" -gt 0 ]; do shift VAL=$1 ;; + -runtimegraphicssystem) + VAR="runtimegraphicssystem" + shift + VAL=$1 + ;; -qtlibinfix) VAR="qtlibinfix" shift @@ -1280,11 +1287,18 @@ while [ "$#" -gt 0 ]; do CFG_GRAPHICS_SYSTEM="openvg" elif [ "$VAL" = "raster" ]; then CFG_GRAPHICS_SYSTEM="raster" + elif [ "$VAL" = "runtime" ]; then + CFG_GRAPHICS_SYSTEM="runtime" else UNKNOWN_OPT=yes fi fi ;; + runtimegraphicssystem) + if [ "$VAL" != "runtime" ]; then + CFG_RUNTIME_SYSTEM="$VAL" + fi + ;; qvfb) # left for commandline compatibility, not documented if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then @@ -2087,7 +2101,7 @@ while [ "$#" -gt 0 ]; do [ "$VAR" = "decoration" ] && QMakeVar del "${VAR}s" "$VAL" [ "$VAR" = "decoration" ] && CFG_DECORATION_ON=`echo "${CFG_DECORATION_ON} " | sed "s,${VAL} ,,g"` && CFG_DECORATION_PLUGIN="$CFG_DECORATION_PLUGIN ${VAL}" [ "$VAR" = "kbd" ] && QMakeVar del "${VAR}s" "$VAL" - [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_KBD_PLUGIN="$CFG_KBD_PLUGIN ${VAL}" + [ "$VAR" = "kbd" ] && CFG_KBD_ON=`echo "${CFG_KBD_ON} " | sed "s,${VAL} ,,g"` && CFG_KBD_PLUGIN="$CFG_KBD_PLUGIN ${VAL}" [ "$VAR" = "mouse" ] && QMakeVar del "${VAR}s" "$VAL" [ "$VAR" = "mouse" ] && CFG_MOUSE_ON=`echo "${CFG_MOUSE_ON} " | sed "s,${VAL} ,,g"` && CFG_MOUSE_PLUGIN="$CFG_MOUSE_PLUGIN ${VAL}" [ "$VAR" = "gfx" ] && QMakeVar del "${VAR}s" "$VAL" @@ -2397,6 +2411,14 @@ if [ "$OPT_SHADOW" = "yes" ]; then ln -s "$relpath"/mkspecs/* "$outpath/mkspecs" rm -f "$outpath/mkspecs/default" + # Special case for mkspecs/features directory. + # To be able to place .prf files into a shadow build directory, + # we're creating links for files only. The directory structure is reproduced. + # A simple "cp -rs" doesn't work on Mac. :( + rm -rf "$outpath/mkspecs/features" + find "$relpath/mkspecs/features" -type d | sed "s,^$relpath,$outpath," | xargs mkdir -p + find "$relpath/mkspecs/features" -type f | sed "s,^$relpath/,," | xargs -n 1 -I % ln -s "$relpath/%" "$outpath/%" + # symlink the doc directory rm -rf "$outpath/doc" ln -s "$relpath/doc" "$outpath/doc" @@ -3669,6 +3691,8 @@ cat << EOF -graphicssystem <sys> Sets an alternate graphics system. Available options are: raster - Software rasterizer opengl - Rendering via OpenGL, Experimental! + openvg - Rendering via OpenVG, Experimental! + EOF fi cat << EOF @@ -4841,23 +4865,24 @@ case "$XPLATFORM" in *symbian*) exit 1 fi - # the main commands needed to compile; - (cd config.tests/symbian - mkdir -p rcomp - cd rcomp - rm -f rcomp_test.rsg - touch rcomp_test.rpp rcomp_test.rsc rcomp_test.rss - rcomp -u -m045,046,047 -s./rcomp_test.rpp -o./rcomp_test.rsc -h./rcomp_test.rsg -i./rcomp_test.rss 2>&1 > /dev/null - if test ! -f rcomp_test.rsg; then - echo "Finding a working rcomp in your PATH failed." - echo "Fatal error. Make sure you have the epoc tools working and in your PATH"; - exit 1; - fi - ) - - # compile a simple main that uses printf if ! echo $XPLATFORM | grep symbian-sbsv2 > /dev/null; then # Raptor does not support configure tests. + + # the main commands needed to compile; + (cd config.tests/symbian + mkdir -p rcomp + cd rcomp + rm -f rcomp_test.rsg + touch rcomp_test.rpp rcomp_test.rsc rcomp_test.rss + rcomp -u -m045,046,047 -s./rcomp_test.rpp -o./rcomp_test.rsc -h./rcomp_test.rsg -i./rcomp_test.rss 2>&1 > /dev/null + if test ! -f rcomp_test.rsg; then + echo "Finding a working rcomp in your PATH failed." + echo "Fatal error. Make sure you have the epoc tools working and in your PATH"; + exit 1; + fi + ) + + # compile a simple main that uses printf if ! "$symbiantests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/symbian/simple "simple" $L_FLAGS $I_FLAGS $l_FLAGS then echo "Testing your compiler failed. Could not compile a simple application." @@ -5111,7 +5136,9 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; tds) if [ "$CFG_SQL_tds" != "no" ]; then - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then + [ -z "$SYBASE" ] || QT_LFLAGS_TDS="-L$SYBASE/lib" + [ -z "$SYBASE_LIBS" ] || QT_LFLAGS_TDS="$QT_LFLAGS_TDS $SYBASE_LIBS" + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/tds "TDS" $QT_LFLAGS_TDS $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then if [ "$CFG_SQL_tds" = "auto" ]; then CFG_SQL_tds=plugin fi @@ -5374,7 +5401,7 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then fi fi - # Auto-detect GStreamer support (needed for both Phonon & QtMultimedia) + # Auto-detect GStreamer support (needed for Phonon) if [ "$CFG_PHONON" != "no" ]; then if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then if [ -n "$PKG_CONFIG" ]; then @@ -6354,6 +6381,11 @@ if [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && [ "$CFG_OPENVG" = "no" ]; then CFG_GRAPHICS_SYSTEM=default fi +if [ -n "$CFG_RUNTIME_SYSTEM" -a "$CFG_GRAPHICS_SYSTEM" != "runtime" ] || [ "$CFG_RUNTIME_SYSTEM" = "runtime" ]; then + echo "Argument to -runtimegraphicssystem is invalid so ignoring..." + CFG_RUNTIME_SYSTEM= +fi + if [ "$CFG_PTMALLOC" != "no" ]; then # build ptmalloc, copy .a file to lib/ echo "Building ptmalloc. Please wait..." @@ -7657,6 +7689,7 @@ if [ "$PLATFORM_QWS" != "yes" ]; then [ "$CFG_GRAPHICS_SYSTEM" = "raster" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_RASTER" [ "$CFG_GRAPHICS_SYSTEM" = "opengl" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENGL" [ "$CFG_GRAPHICS_SYSTEM" = "openvg" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_OPENVG" + [ "$CFG_GRAPHICS_SYSTEM" = "runtime" ] && QCONFIG_FLAGS="$QCONFIG_FLAGS QT_GRAPHICSSYSTEM_RUNTIME" fi # X11/Unix/Mac only configs @@ -7770,6 +7803,13 @@ cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF EOF fi +if [ -n "$CFG_RUNTIME_SYSTEM" ]; then +cat >>"$outpath/src/corelib/global/qconfig.h.new" << EOF +#define QT_DEFAULT_RUNTIME_SYSTEM "$CFG_RUNTIME_SYSTEM" + +EOF +fi + # avoid unecessary rebuilds by copying only if qconfig.h has changed if cmp -s "$outpath/src/corelib/global/qconfig.h" "$outpath/src/corelib/global/qconfig.h.new"; then rm -f "$outpath/src/corelib/global/qconfig.h.new" @@ -7920,6 +7960,9 @@ fi if [ -n "$QT_LFLAGS_ODBC" ]; then echo "QT_LFLAGS_ODBC = $QT_LFLAGS_ODBC" >> "$CACHEFILE.tmp" fi +if [ -n "$QT_LFLAGS_TDS" ]; then + echo "QT_LFLAGS_TDS = $QT_LFLAGS_TDS" >> "$CACHEFILE.tmp" +fi if [ "$QT_EDITION" != "QT_EDITION_OPENSOURCE" ]; then echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$CACHEFILE.tmp" diff --git a/configure.exe b/configure.exe Binary files differindex 6dfd14e48..220e605 100755 --- a/configure.exe +++ b/configure.exe diff --git a/demos/qtdemo/examplecontent.cpp b/demos/qtdemo/examplecontent.cpp index 19be3e0..65c078d 100644 --- a/demos/qtdemo/examplecontent.cpp +++ b/demos/qtdemo/examplecontent.cpp @@ -91,8 +91,8 @@ QString ExampleContent::loadDescription() if (paragraphs.length() < 1 && Colors::verbose) qDebug() << "- ExampleContent::loadDescription(): Could not load description:" << MenuManager::instance()->info[this->name]["docfile"]; - QString description = Colors::contentColor + - QLatin1String("Could not load description. Ensure that the documentation for Qt is built."); + QString description = Colors::contentColor + QLatin1String(""); + //QLatin1String("Could not load description. Ensure that the documentation for Qt is built."); // QTBUG-12522: If there is no description why show an error to the user when qDebug above communications the issue (if it is indeed an issue at all) when demos are built? for (int p = 0; p < int(paragraphs.length()); ++p) { description = this->extractTextFromParagraph(paragraphs.item(p)); if (this->isSummary(description)) { diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp index 7168b57..c9ffecb 100644 --- a/demos/qtdemo/menumanager.cpp +++ b/demos/qtdemo/menumanager.cpp @@ -313,7 +313,7 @@ void MenuManager::showDocInAssistant(const QString &name) // Send command through remote control even if the process // was started to activate assistant and bring it to front: QTextStream str(&this->assistantProcess); - str << "SetSource " << url << QLatin1Char('\0') << endl; + str << "SetSource " << url << QLatin1Char('\n') << endl; } void MenuManager::launchExample(const QString &name) diff --git a/dist/changes-4.7.0 b/dist/changes-4.7.0 index 518d362..790aabc 100644 --- a/dist/changes-4.7.0 +++ b/dist/changes-4.7.0 @@ -474,6 +474,9 @@ QtCore: ABIs, but it also allowed for unaligned access. Qt never generates or uses unaligned access and the new EABI aligns as expected, so the flag was removed. + - QTextBoundaryFinder is now consistent with ICU when it comes to + line breaking, reporting the index of the boundary at which the line + break should occur rather than the index of the character. QtNetwork: - Qt does no longer provide its own CA bundle, but uses system APIs for diff --git a/doc/src/development/debug.qdoc b/doc/src/development/debug.qdoc index 36970ee..9e881d1 100644 --- a/doc/src/development/debug.qdoc +++ b/doc/src/development/debug.qdoc @@ -49,7 +49,7 @@ The basic stuff you need to know about debug libraries and frameworks is found at developer.apple.com in: \l{http://developer.apple.com/technotes/tn2004/tn2124.html#SECDEBUGLIB} - {Apple Technicle Note TN2124} Qt follows that. + {Apple Technical Note TN2124}. When you build Qt, frameworks are built by default, and inside the framework you will find both a release and a debug version (e.g., diff --git a/doc/src/development/developing-with-qt.qdoc b/doc/src/development/developing-with-qt.qdoc index ffc5a8e..f9b38b8 100644 --- a/doc/src/development/developing-with-qt.qdoc +++ b/doc/src/development/developing-with-qt.qdoc @@ -27,12 +27,22 @@ /*! \page developing-with-qt.html - \title Cross Platform Development with Qt + + \title Cross-platform & Platform-specific Development + Qt allows you to write advanced applications and UIs once, and deploy them + across desktop and embedded operating systems without rewriting the source + code. The top section of this page provides an overview of the tools and + techniques used in Qt application development. Still, you might want to add + platform-specific features to your code. The bottom section of the page + links to documents that describe platform-specific features provided by Qt, + and discuss issues related to particular platforms and environments. + + \section1 Cross-platform Development with Qt Qt is provided with a set of build tools to help developers automate the process of building and installing Qt applications. - \table 100% + \table \header \o Development \o Cross-Platform Issues \o Specific Tools \row \o @@ -57,4 +67,49 @@ \o \l {Resource Compiler (rcc)} \endlist \endtable -*/ + + \section1 Platform-specific Development with Qt + + These documents describe platform-specific features provided by Qt, and + discuss issues related to particular platforms and environments. + + \table + \row + \o + \list + \o \l {Calling Qt Functions From Unix Signal Handlers} + \o \l {Compiler Notes} + \o \l {Developing Qt Applications for Mac OS X} + \o \l {Known Issues} + \o \l {Platform Notes} + \o \l {Platform Notes - Symbian} + \o \l {Qt For ActiveX} + \o \l {Qt for Embedded Linux Classes} + \o \l {Qt for Embedded Platforms} + \o \l {Qt for Mac OS X - Specific Issues} + \o \l {Qt is Mac OS X Native} + \o \l {Supported Platforms} + \o \l {The qtmain Library} + \o \l {Window System Specific Notes} + \endlist + \o + \list + \o Workaround to make it work. + \o Information about the C++ compilers and tools used to build Qt. + \o Information for developing Qt applications for Mac OS X + \o A summary of known issues in this Qt version at the time of release. + \o Information about the platforms on which Qt can be used. + \o Information about the state of support for the Symbian platform. + \o Qt API's for using ActiveX controls, servers, and COM. + \o Classes that are specific to Qt for Embedded Linux. + \o Documents related to Qt for Embedded Platforms. + \o A description of issues with Qt that are specific to Mac OS X. + \o An explanation of Qt's native features on Mac OS X. + \o The platforms supported by Nokia for Qt. + \o Describes the use and license of the qtmain helper library. + \o Collections of notes about Qt implementations on different window systems. + \endlist + \endtable + + +*/
\ No newline at end of file diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index 0fdeff8..baa30fc 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -3015,6 +3015,13 @@ For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 150 + \target SYMBIAN_VERSION + \section1 SYMBIAN_VERSION + + \e {This is only used on the Symbian platform.} + + Contains the version number of the underlying Symbian SDK; e.g. "9.2" or "Symbian3". + \target TARGET \section1 TARGET diff --git a/doc/src/files-and-resources/resources.qdoc b/doc/src/files-and-resources/resources.qdoc index b0b0e3c..3177af8 100644 --- a/doc/src/files-and-resources/resources.qdoc +++ b/doc/src/files-and-resources/resources.qdoc @@ -54,7 +54,7 @@ The resource system is based on tight cooperation between \l qmake, \l rcc (Qt's resource compiler), and QFile. It obsoletes Qt 3's \c qembed tool and the - \l{http://qt.nokia.com/doc/qq/qq05-iconography.html#imagestorage}{image + \l{http://doc.qt.nokia.com/qq/qq05-iconography.html}{image collection} mechanism. \section1 Resource Collection Files (\c{.qrc}) diff --git a/doc/src/frameworks-technologies/eventsandfilters.qdoc b/doc/src/frameworks-technologies/eventsandfilters.qdoc index e792161..fb14a3b 100644 --- a/doc/src/frameworks-technologies/eventsandfilters.qdoc +++ b/doc/src/frameworks-technologies/eventsandfilters.qdoc @@ -100,7 +100,7 @@ event delivery mechanisms are flexible. The documentation for QCoreApplication::notify() concisely tells the whole story; the \e{Qt Quarterly} article - \l{http://qt.nokia.com/doc/qq/qq11-events.html}{Another Look at Events} + \l{http://doc.qt.nokia.com/qq/qq11-events.html}{Another Look at Events} rehashes it less concisely. Here we will explain enough for 95% of applications. diff --git a/doc/src/getting-started/gettingstarted.qdoc b/doc/src/getting-started/gettingstarted.qdoc index 391aec3..145982b 100644 --- a/doc/src/getting-started/gettingstarted.qdoc +++ b/doc/src/getting-started/gettingstarted.qdoc @@ -26,491 +26,12 @@ ****************************************************************************/ /*! - \page gettingstarted.html + \title Getting Started Guides - \title Getting Started - - Welcome to the world of Qt--the cross-platform GUI toolkit. In - this getting started guide, we teach basic Qt knowledge by - implementing a simple Notepad application. After reading this - guide, you should be ready to delve into our overviews and API - documentation, and find the information you need for the - application you are developing. - - \section1 Hello Notepad - - In this first example, we simply create and show a text edit in a - window frame on the desktop. This represents the simplest possible - Qt program that has a GUI. - - \image gs1.png - - Here is the code: - - \code - 1 #include <QApplication> - 2 #include <QTextEdit> - 3 - 4 int main(int argv, char **args) - 5 { - 6 QApplication app(argv, args); - 7 - 8 QTextEdit textEdit; - 9 textEdit.show(); -10 -11 return app.exec(); -12 } - \endcode - - Let's go through the code line by line. In the first two lines, we - include the header files for QApplication and QTextEdit, which are - the two classes that we need for this example. All Qt classes have - a header file named after them. - - Line 6 creates a QApplication object. This object manages - application-wide resources and is necessary to run any Qt program - that has a GUI. It needs \c argv and \c args because Qt accepts a - few command line arguments. - - Line 8 creates a QTextEdit object. A text edit is a visual element - in the GUI. In Qt, we call such elements widgets. Examples of - other widgets are scroll bars, labels, and radio buttons. A widget - can also be a container for other widgets; a dialog or a main - application window, for example. - - Line 9 shows the text edit on the screen in its own window frame. - Since widgets also function as containers (for instance a - QMainWindow, which has toolbars, menus, a status bar, and a few - other widgets), it is possible to show a single widget in its own - window. Widgets are not visible by default; the function - \l{QWidget::}{show()} makes the widget visible. - - Line 11 makes the QApplication enter its event loop. When a Qt - application is running, events are generated and sent to the - widgets of the application. Examples of events are mouse presses - and key strokes. When you type text in the text edit widget, it - receives key pressed events and responds by drawing the text - typed. - - To run the application, open a command prompt, and enter the - directory in which you have the \c .cpp file of the program. The - following shell commands build the program. - - \code - vattekar@positive:~/testing/gssnippets/part1$ qmake -project - vattekar@positive:~/testing/gssnippets/part1$ qmake - vattekar@positive:~/testing/gssnippets/part1$ make - \endcode - - 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. - - \section2 Learn More - - \table - \header - \o About - \o Here - \row - \o Widgets and Window Geometry - \o \l{Window and Dialog Widgets} - \row - \o Events and event handling - \o \l{The Event System} - \endtable - - \section1 Adding a Quit Button - - In a real application, you will normally need more than one - widget. We will now introduce a QPushButton beneath the text edit. - The button will exit the Notepad application when pushed (i.e., - clicked on with the mouse). - - \image gs2.png - - Let's take a look at the code. - - \code - 1 #include <QtGui> - 2 - 3 int main(int argv, char **args) - 4 { - 5 QApplication app(argv, args); - 6 - 7 QTextEdit textEdit; - 8 QPushButton quitButton("Quit"); - 9 -10 QObject::connect(&quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); -11 -12 QVBoxLayout layout; -13 layout.addWidget(&textEdit); -14 layout.addWidget(&quitButton); -15 -16 QWidget window; -17 window.setLayout(&layout); -18 -19 window.show(); -20 -21 return app.exec(); -22 } - \endcode - - Line 1 includes QtGui, which contains all of Qt's GUI classes. - - Line 10 uses Qt's Signals and Slots mechanism to make the - application exit when the \gui {Quit button} is pushed. A slot is - a function that can be invoked at runtime using its name (as a - literal string). A signal is a function that when called will - invoke slots registered with it; we call that to connect the slot - to the signal and to emit the signal. - - \l{QApplication::}{quit()} is a slot of QApplication that exits - the application. \l{QPushButton::}{clicked()} is a signal that - QPushButton emits when it is pushed. The static - QObject::connect() function takes care of connecting the slot to - the signal. SIGNAL() and SLOT() are two macros that take the - function signatures of the signal and slot to connect. We also - need to give pointers to the objects that should send and receive - the signal. - - Line 12 creates a QVBoxLayout. As mentioned, widgets can contain - other widgets. It is possible to set the bounds (the location and - size) of child widgets directly, but it is usually easier to use a - layout. A layout manages the bounds of a widget's children. - QVBoxLayout, for instance, places the children in a vertical row. - - Line 13 and 14 adds the text edit and button to the layout. In - line 17, we set the layout on a widget. - - \section2 Learn More - - \table - \header - \o About - \o Here - \row - \o Signals and slots - \o \l{Signals & Slots} - \row - \o Layouts - \o \l{Layout Management}, - \l{Widgets and Layouts}, - \l{Layout Examples} - \row - \o The widgets that come with Qt - \o \l{Qt Widget Gallery}, - \l{Widget Examples} - \endtable - - \section1 Subclassing QWidget - - When the user wants to quit an application, you might want to - pop-up a dialog that asks whether he/she really wants to quit. In - this example, we subclass QWidget, and add a slot that we connect - to the \gui {Quit button}. - - \image gs3.png - - Let's look at the code: - - \code - 5 class Notepad : public QWidget - 6 { - 7 Q_OBJECT - 8 - 9 public: -10 Notepad(); -11 -12 private slots: -13 void quit(); -14 -15 private: -16 QTextEdit *textEdit; -17 QPushButton *quitButton; -18 }; - \endcode - - The \c Q_OBJECT macro must be first in the class definition, and - declares our class as a \c QObject (Naturally, it must also - inherit from QObject). A \l{QObject} adds several abilities to a - normal C++ class. Notably, the class name and slot names can be - queried at run-time. It is also possible to query a slot's - 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). - - 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")); - } - \endcode - - As you saw in the class definition, we use pointers to our \l - {QObject}s (\c textEdit and \c quitButton). As a rule, you should - always allocate \l{QObject}s on the heap and never copy them. - - We now use the function \l{QObject::}{tr()} around our user - visible strings. This function is necessary when you want to - provide your application in more than one language (e.g. English - and Chinese). We won't go into details here, but you can follow - the \c {Qt Linguist} link from the learn more table. - - \section2 Learn More - - \table - \header - \o About - \o Here - \row - \o tr() and internationalization - \o \l{Qt Linguist Manual}, - \l{Writing Source Code for Translation}, - \l{Hello tr() Example}, - \l{Internationalization with Qt} - \row - \o QObjects and the Qt Object model (This is essential to understand Qt) - \o \l{Object Model} - \row - \o qmake and the Qt build system - \o \l{qmake Manual} - \endtable - - \section2 Creating a .pro file - - For this example, we write our own \c .pro file instead of - using \c qmake's \c -project option. - - \code - HEADERS = notepad.h - SOURCES = notepad.cpp \ - main.cpp - \endcode - - The following shell commands build the example. - - \code - vattekar@positive:~/testing/gssnippets/part3$ qmake - vattekar@positive:~/testing/gssnippets/part3$ make - \endcode - - \section1 Using a QMainWindow - - Many applications will benefit from using a QMainWindow, which has - its own layout to which you can add a menu bar, dock widgets, tool - bars, and a status bar. QMainWindow has a center area that can be - occupied by any kind of widget. In our case, we will place our - text edit there. - - \image gs4.png - - Let's look at the new \c Notepad class definition. - - \code - #include <QtGui> - - 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; - }; - \endcode - - We include two more slots that can save and open a document. We - will implement these in the next section. - - Often, in a main window, the same slot should be invoked by - several widgets. Examples are menu items and buttons on a tool - bar. To make this easier, Qt provides QAction, which can be given - to several widgets, and be connected to a slot. For instance, both - QMenu and QToolBar can create menu items and tool buttons from the - same \l{QAction}s. We will see how this works shortly. - - As before, we use the \c {Notepad}s constructor to set up the - 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")); - } - \endcode - - \l{QAction}s are created with the text that should appear on the - widgets that we add them to (in our case, menu items). If we also - wanted to add them to a tool bar, we could have given - \l{QIcon}{icons} to the actions. - - When a menu item is clicked now, the item will trigger the action, - and the respective slot will be invoked. - - \section2 Learn More - - \table - \header - \o About - \o Here - \row - \o Main windows and main window classes - \o \l{Application Main Window}, - \l{Main Window Examples} - \row - \o MDI applications - \o QMdiArea, - \l{MDI Example} - \endtable - - \section1 Saving and Loading - - In this example, we will implement the functionality of the \c - open() and \c save() slots that we added in the previous example. - - \image gs5.png - - Let's 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(); - } - \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 - selected, or an empty string if the user canceled the dialog. - - If we have a file name, we try to open the file with - \l{QIODevice::}{open()}, which returns true if the file could be - opened. We won't go into error handling here, but you can follow - the links from the learn more section. If the file could not be - opened, we use QMessageBox to display a dialog with an error - 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 - edit. We then \l{QIODevice::}{close()} the file to return the file - descriptor back to the operating system. - - Now, let's 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(); - } - } - \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. - - \section2 Learn More - - \table - \header - \o About - \o Here - \row - \o Files and I/O devices - \o QFile, QIODevice - \endtable - - \omit - \section1 Moving On - - This may not be true for the first release. - The Qt documentation comes with three getting started guides. You - have come to the end of the first, which concerns itself with - basic Qt concepts. We also have guides covering intermediate and - advanced topics. They are found here: You may also have noticed that the learn more sections in - this guide frequently linked to them. - Basic Qt Architecture - \endomit + \group gettingStarted + + Following is a list. + \generatelist{related} + */ diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc new file mode 100644 index 0000000..2bfb71c --- /dev/null +++ b/doc/src/getting-started/gettingstartedqml.qdoc @@ -0,0 +1,1050 @@ +/**************************************************************************** +** +** Copyright (C) 2010 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$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** 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$ +** +****************************************************************************/ + +/*! + \page qml-textEditor.html + + \title Getting Started programming with QML + \ingroup gettingStarted + + Welcome to the world of QML - the declarative UI language. In this Getting + Started guide, we will create a simple text editor application using QML. + After reading this guide, you should be ready to develop your own applications + using QML and Qt C++. + + \section1 QML to Build User Interfaces + + The application we are building is a simple text editor that will load, save, + and perform some text manipulation. This guide will consist of two parts. The + first part will involve designing the application layout and behaviors using + declarative language in QML. For the second part, file loading and saving will + be implemented using Qt C++. Using + \l {The Meta-Object System}{Qt's Meta-Object System}, we can expose C++ functions + as properties that QML elements can use. Utilizing QML and Qt C++, we can + efficiently decouple the interface logic from the application logic. + + \image qml-texteditor5_editmenu.png + + To run the QML example code, merely provide the included \l{QML Viewer}{qmlviewer} + tool with the QML file as the argument. The C++ portion of this tutorial assumes + that the reader possesses basic knowledge of Qt's compilation procedures. + + Tutorial chapters: + \list 1 + \o \l {Defining a Button and a Menu}{Defining a Button and a Menu} + \o \l {Implementing a Menu Bar}{Implementing a Menu Bar} + \o \l {Building a Text Editor}{Building a Text Editor} + \o \l {Decorating the Text Editor}{Decorating the Text Editor} + \o \l {Extending QML using Qt C++}{Extending QML using Qt C++} + \endlist + + \section1 Defining a Button and a Menu + + \section2 Basic Component - a Button + + We start our text editor by building a button. Functionally, a button has a mouse + sensitive area and a label. Buttons perform actions when a user presses the button. + + In QML, the basic visual item is the \l {Rectangle}{Rectangle} element. The + \c Rectangle element has properties to control the element's appearance and location. + + \code + import Qt 4.7 + Rectangle { + id: simplebutton + color: "grey" + width: 150; height: 75 + + Text{ + id: buttonLabel + anchors.centerIn: parent + text: "button label" + } + } + \endcode + + First, the \c { import Qt 4.7 } allows the qmlviewer tool to import the QML elements + we will later use. This line must exist for every QML file. Notice that the version + of Qt modules is included in the import statement. + + This simple rectangle has a unique identifier, \c simplebutton, which is bound to the + id property. The \c Rectangle element's properties are bound to values by listing the + property, followed by a colon, then the value. In the code sample, the color \c grey + is bound to the the Rectangle's \c color property. Similarly, we bind the \c width + and \c height of the Rectangle. + + The \l {Text}{Text} element is a non-editable text field. We name this \c Text element + \c buttonLabel. To set the string content of the Text field, we bind a value to the + \c text property. The label is contained within the Rectangle and in order to center + it in the middle, we assign the \c anchors of the Text element to its parent, which + is called \c simplebutton. Anchors may bind to other items' anchors, allowing layout + assignments simpler. + + We shall save this code as \c SimpleButton.qml. Running qmlviewer with the file as the + argument will display the grey rectangle with a text label. + + \image qml-texteditor1_simplebutton.png + + To implement the button click functionality, we can use QML's event handling. QML's event + handling is very similar to \l {Signals & Slots}{Qt's signal and slot} mechanism. Signals + are emitted and the connected slot is called. + + \code + Rectangle{ + id:simplebutton + ... + + MouseArea{ + id: buttonMouseArea + + anchors.fill: parent //anchor all sides of the mouse area to the rectangle's anchors + //onClicked handles valid mouse button clicks + onClicked: console.log(buttonLabel.text + " clicked" ) + } + } + \endcode + + We include a \l{MouseArea} element in our simplebutton. \c MouseArea elements describe + the interactive area where mouse movements are detected. For our button, we anchor the + whole MouseArea to its parent, which is \c simplebutton. The \c anchors.fill syntax is + one way of accessing a specific property called \c fill inside a group of properties + called \c anchors. QML uses \l {Anchor-based Layout in QML}{anchor based layouts} where + items can anchor to another item, creating robust layouts. + + The \c MouseArea has many signal handlers that are called during mouse movements within + the specfied \c MouseArea boundaries. One of them is \c onClicked and it is called + whenever the acceptable mouse button is clicked, the left click being the default. We + can bind actions to the onClicked handler. In our example, \c console.log() outputs text + whenever the mouse area is clicked. The function \c console.log() is a useful tool for + debugging purposes and for outputting text. + + The code in \c SimpleButton.qml is sufficient to display a button on the screen and + output text whenever it is clicked with a mouse. + + \code + Rectangle { + id:Button + ... + + property color buttonColor: "lightblue" + property color onHoverColor: "gold" + property color borderColor: "white" + + signal buttonClick() + onButtonClick: { + console.log(buttonLabel.text + " clicked" ) + } + + MouseArea{ + onClicked: buttonClick() + hoverEnabled: true + onEntered: parent.border.color = onHoverColor + onExited: parent.border.color = borderColor + } + + //determines the color of the button by using the conditional operator + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + } + \endcode + + A fully functioning button is in \c Button.qml. The code snippets in this article + have some code omitted, denoted by ellipses because they were either introduced + earlier in the previous sections or irrelevant to the current code discussion. + + Custom properties are declared using the \c {property type name} syntax. In the + code, the property \c buttonColor, of type \c color, is declared and bound to + the value \c{"lightblue"}. The \c buttonColor is later used in a conditional + operation to determine the buttons's fill color. Note that property value + assignment is possible using the \c= equals sign, in addition to value binding + using the \c : colon character. Custom properties allow internal items to be + accessible outside of the Rectangle's scope. There are basic + \l{QML Basic Types}{QML types} such as \c int, \c string, \c real, as well as + a type called \c variant. + + By binding the \c onEntered and \c onExited signal handlers to colors, the + button's border will turn yellow when the mouse hovers above the button and + reverts the color when the mouse exits the mouse area. + + A \c buttonClick() signal is declared in \c Button.qml by placing the \c signal + keyword in front of the signal name. All signals have their handlers automatically + created, their names starting with \c on. As a result, the \c onButtonClick is + \c buttonClick's handler. The \c onButtonClick is then assigned an action to + perform. In our button example, the \c onClicked mouse handler will simply call + \c onButtonClick, which displays a text. The \c onButtonClick enables outside + objects to access the \c {Button}'s mouse area easily. For example, items may + have more than one \c MouseArea declarations and a \c buttonClick signal can + make the distinction between the several \c MouseArea signal handlers better. + + We now have the basic knowledge to implement items in QML that can handle + basic mouse movements. We created a \c Text label inside a \c Rectangle, + customized its properties, and implemented behaviors that respond to mouse + movements. This idea of creating elements within elements is repeated + throughout the text editor application. + + This button is not useful unless used as a component to perform an action. + In the next section, we will soon create a menu containing several of these + buttons. + + \image qml-texteditor1_button.png + + \section2 Creating a Menu Page + + Up to this stage, we covered how to create elements and assign behaviors inside + a single QML file. In this section, we will cover how to import QML elements and how + to reuse some of the created components to build other components. + + Menus display the contents of a list, each item having the ability to perform an action. + In QML, we can create a menu in several ways. First, we will create a menu containing + buttons which will eventually perform different actions. The menu code is in + \c FileMenu.qml. + + \code + import Qt 4.7 \\import the main Qt QML module + import “folderName” \\import the contents of the folder + import “Button.qml” \\import a QML file + import “NewButton.qml” as ButtonModule \\import a QML file and give it a name + import “script.js” as Script \\import a Javascript file and name it as Script + \endcode + + To use the \c Button element in \c FileMenu.qml, we need to import \c Button.qml. + The syntax shown above, shows how to use the \c import keyword. However, the + \c {import Button.qml} is not necessary; qmlviewer will import all the contents + of the current directory. We can directly create a \c Button element by declaring + \c Button{}, similar to a \c Rectangle{} declaration. + + \code + In FileMenu.qml: + + Row{ + anchors.centerIn: parent + spacing: parent.width/6 + + Button{ + id: loadButton + buttonColor: "lightgrey" + label: "Load" + } + Button{ + buttonColor: "grey" + id: saveButton + label: "Save" + } + Button{ + id: exitButton + label: "Exit" + buttonColor: "darkgrey" + + onButtonClick: Qt.quit() + } + } + \endcode + + In \c FileMenu.qml, we declare three \c Button elements. They are declared + inside a \l {Row}{Row} element, a positioner that will position its children + along a vertical row. The \c Button declaration resides in Button.qml, + which is the same as the \c Button.qml we used in the previous section. + New property bindings can be declared within the newly created buttons, + effectively overwriting the properties set in \c Button.qml. The button + called \c exitButton will quit and close the window when it is clicked. + Note that the signal handler \c onButtonClick in \c Button.qml will be + called in addition to the \c onButtonClick handler in \c exitButton. + + \image qml-texteditor1_filemenu.png + + The \c Row declaration is declared in a \c Rectangle, creating a rectangle + container for the row of buttons. This additional rectangle creates an indirect + way of organizing the row of buttons inside a menu. + + The declaration of the edit menu is very similar at this stage. The menu has + buttons that have the labels: \c Copy, \c Paste, and \c {Select All}. + + \image qml-texteditor1_editmenu.png + + Armed with our knowledge of importing and customizing previously made + components, we may now combine these menu pages to create a menu bar, + consisting of buttons to select the menu, and look at how we may structure + data using QML. + + \section1 Implementing a Menu Bar + + Our text editor application will need a way to display menus using a menu bar. + The menu bar will switch the different menus and the user can choose which menu + to display. Menu switching implies that the menus need more structure than + merely displaying them in a row. QML uses models and views to structure data + and display the structured data. + + \section2 Using Data Models and Views + + QML has different \l {Data Models}{data views} that display + \l {Data Models}{data models}. Our menu bar will display the menus in a list, + with a header that displays a row of menu names. The list of menus are declared + inside a \c VisualItemModel. The \l{VisualItemModel}{\c VisualItemModel} + element contains items that already have views such as \c Rectangle elements + and imported UI elements. Other model types such as the \l {ListModel}{\c ListModel} + element need a delegate to display their data. + + We declare two visual items in the \c menuListModel, the \c FileMenu and the + \c EditMenu. We customize the two menus and display them using a + \l {ListView}{ListView}. The \c MenuBar.qml file contains the QML declarations + and a simple edit menu is defined in \c EditMenu.qml. + + \code + VisualItemModel{ + id: menuListModel + FileMenu{ + width: menuListView.width + height: menuBar.height + color: fileColor + } + EditMenu{ + color: editColor + width: menuListView.width + height: menuBar.height + } + } + \endcode + + The \l {ListView}{ListView} element will display a model according to a delegate. + The delegate may declare the model items to display in a \c Row element or display + the items in a grid. Our \c menuListModel already has visible items, therefore, + we do not need to declare a delegate. + + \code + ListView{ + id: menuListView + + //Anchors are set to react to window anchors + anchors.fill:parent + anchors.bottom: parent.bottom + width:parent.width + height: parent.height + + //the model contains the data + model: menuListModel + + //control the movement of the menu switching + snapMode: ListView.SnapOneItem + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds + flickDeceleration: 5000 + highlightFollowsCurrentItem: true + highlightMoveDuration:240 + highlightRangeMode: ListView.StrictlyEnforceRange + } + \endcode + + Additionally, \c ListView inherits from \l {Flickable}{\c Flickable}, making + the list respond to mouse drags and other gestures. The last portion of the + code above sets \c Flickable properties to create the desired flicking movement + to our view. In particular,the property \c highlightMoveDuration changes the + duration of the flick transition. A higher \c highlightMoveDuration value + results in slower menu switching. + + The \c ListView maintains the model items through an \c index and each visual + item in the model is accessible through the \c index, in the order of the + declaration. Changing the \c currentIndex effectively changes the highlighted + item in the \c ListView. The header of our menu bar exemplify this effect. + There are two buttons in a row, both changing the current menu when clicked. + The \c fileButton changes the current menu to the file menu when clicked, + the \c index being \c 0 because \c FileMenu is declared first in the + \c menuListModel. Similarly, the \c editButton will change the current + menu to the \c EditMenu when clicked. + + The \c labelList rectangle has \c z value of \c 1, denoting that it is displayed + at the front of the menu bar. Items with higher \c z values are displayed in front + of items with lower \c z values. The default \c z value is \c 0. + + \code + Rectangle{ + id: labelList + ... + z: 1 + Row{ + anchors.centerIn: parent + spacing:40 + Button{ + label: "File" + id: fileButton + ... + onButtonClick: menuListView.currentIndex = 0 + } + Button{ + id: editButton + label: "Edit" + ... + onButtonClick: menuListView.currentIndex = 1 + } + } + } + \endcode + + The menu bar we just created can be flicked to access the menus or by clicking + on the menu names at the top. Switching menu screens feel intuitive and responsive. + + \image qml-texteditor2_menubar.png + + */ + + /*! + \page qml-textEditor3.html + \title Building a Text Editor + + \section1 Declaring a TextArea + + Our text editor is not a text editor if it didn't contain an editable text area. + QML's \l {TextEdit}{TextEdit} element allows the declaration of a multi-line + editable text area. \l {TextEdit}{TextEdit} is different from a \l {Text}{Text} + element, which doesn't allow the user to directly edit the text. + + \code + TextEdit{ + id: textEditor + anchors.fill:parent + width:parent.width; height:parent.height + color:"midnightblue" + focus: true + + wrapMode: TextEdit.Wrap + + onCursorRectangleChanged: flickArea.ensureVisible(cursorRectangle) + } + \endcode + + The editor has its font color property set and set to wrap the text. The + \c TextEdit area is inside a flickable area that will scroll the text if the + text cursor is outside the visible area. The function \c ensureVisible() will + check if the cursor rectangle is outside the visible boundaries and move the + text area accordingly. QML uses Javascript syntax for its scripts, and as previously + mentioned, Javascript files can be imported and used within a QML file. + + \code + function ensureVisible(r){ + if (contentX >= r.x) + contentX = r.x; + else if (contentX+width <= r.x+r.width) + contentX = r.x+r.width-width; + if (contentY >= r.y) + contentY = r.y; + else if (contentY+height <= r.y+r.height) + contentY = r.y+r.height-height; + } + \endcode + + \section1 Combining Components for the Text Editor + + We are now ready to create the layout of our text editor using QML. The text + editor has two components, the menu bar we created and the text area. QML allows + us to reuse components, therefore making our code simpler, by importing components + and customizing when necessary. Our text editor splits the window into two; + one-third of the screen is dedicated to the menu bar and two-thirds of the screen + displays the text area. The menu bar is displayed in front of any other elements. + + \code + Rectangle{ + + id: screen + width: 1000; height: 1000 + + //the screen is partitioned into the MenuBar and TextArea. 1/3 of the screen is assigned to the MenuBar + property int partition: height/3 + + MenuBar{ + id:menuBar + height: partition + width:parent.width + z: 1 + } + + TextArea{ + id:textArea + anchors.bottom:parent.bottom + y: partition + color: "white" + height: partition*2 + width:parent.width + } + } + \endcode + + By importing reusable components, our \c TextEditor code looks much simpler. + We can then customize the main application, without worrying about properties + that already have defined behaviors. Using this approach, application layouts + and UI components can be created easily. + + \image qml-texteditor3_texteditor.png + + */ + + /*! + \page qml-textEditor4 + \title Decorating the Text Editor + \section1 Implementing a Drawer Interface + + Our text editor looks simple and we need to decorate it. Using QML, we can declare + transitions and animate our text editor. Our menu bar is occupying one-third of the + screen and it would be nice to have it only appear when we want it. + + We can add a drawer interface, that will contract or expand the menu bar when clicked. + In our implementation, we have a thin rectangle that responds to mouse clicks. The + \c drawer, as well as the application, has two sates: the "drawer is open" state and + the "drawer is closed" state. The \c drawer item is a strip of rectangle with a small + height. There is a nested \l {Image}{Image} element declaring that an arrow icon will + be centered inside the drawer. The drawer assigns a state to the whole application, + with the identifier \c screen, whenever a user clicks the mouse area. + + \code + Rectangle{ + id:drawer + height:15 + + Image{ + id: arrowIcon + source: "images/arrow.png" + anchors.horizontalCenter: parent.horizontalCenter + } + + MouseArea{ + id: drawerMouseArea + anchors.fill:parent + onClicked:{ + if (screen.state == "DRAWER_CLOSED"){ + screen.state = "DRAWER_OPEN" + } + else if (screen.state == "DRAWER_OPEN"){ + screen.state = "DRAWER_CLOSED" + } + } + ... + } + } + \endcode + + A state is simply a collection of configurations and it is declared in a + \l{State}{State} element. A list of states can be listed and bound to the + \c states property. In our application, the two states are called + \c DRAWER_CLOSED and \c DRAWER_OPEN. Item configurations are declared in + \l {PropertyChanges}{PropertyChanges} elements. In the \c DRAWER_OPEN state, + there are four items that will receive property changes. The first target, + \c menuBar, will change its \c y property to \c 0. Similarly, the \c textArea + will lower to a new position when the state is \c DRAWER_OPEN. The \c textArea, + the \c drawer, and the drawer's icon will undergo property changes to meet the + current state. + + \code + + states:[ + State{ + name: "DRAWER_OPEN" + PropertyChanges { target: menuBar; y:0} + PropertyChanges { target: textArea; y: partition + drawer.height} + PropertyChanges { target: drawer; y: partition} + PropertyChanges { target: arrowIcon; rotation: 180} + }, + State{ + name: "DRAWER_CLOSED" + PropertyChanges { target: menuBar; y:-partition} + PropertyChanges { target: textArea; y: drawer.height; height: screen.height - drawer.height} + PropertyChanges { target: drawer; y: 0} + PropertyChanges { target: arrowIcon; rotation: 0} + } + + ] + + \endcode + + State changes are abrupt and needs smoother transitions. Transitions between states + are defined using the \l {Transition}{Transition} element, which can then bind to + the item's \c transitions property. Our text editor has a state transition whenever + the state changes to either \c DRAWER_OPEN or \c DRAWER_CLOSED. Importantly, the + transition needs a \c from and a \c to state but for our transitions, we can use + the wild card \c * symbol to denote that the transition applies to all state changes. + + During transitions, we can assign animations to the property changes. Our + \c menuBar switches position from \c {y:0} to \c {y:-partition} and we can animate + this transition using the \l {NumberAnimation}{NumberAnimation} element. We declare + that the targets' properties will animate for a certain duration of time and using + a certain easing curve. An easing curve controls the animation rates and + interpolation behavior during state transitions. The easing curve we chose is + \l {PropertyAnimation::easing.type}{Easing.OutQuint}, which slows the movement near + the end of the animation. Pleae read \l {qdeclarativeanimation.html}{QML's Animation} + article. + + \code + transitions: [ + Transition{ + to: "*" + NumberAnimation { target: textArea; properties: "y, height"; duration: 100; easing.type: Easing.OutQuint } + NumberAnimation { target: menuBar; properties: "y"; duration: 100;easing.type: Easing.OutQuint } + NumberAnimation { target: drawer; properties: "y"; duration: 100;easing.type: Easing.OutQuint } + } + ] + \endcode + + Another way of animating property changes is by declaring a \l {Behavior}{Behavior} + element. A transition only works during state changes and \c Behavior can set an + animation for a general property change. In the text editor, the arrow has a + \c NumberAnimation animating its \c rotation property whenever the property changes. + + \code + In TextEditor.qml: + + Behavior{ + NumberAnimation{property: "rotation";easing.type: Easing.OutExpo } + } + \endcode + + Going back to our components with knowledge of states and animations, we can improve + the appearances of the components. In \c Button.qml, we can add \c color and \c scale + property changes when the button is clicked. Color types are animated using + \l {ColorAnimation}{ColorAnimation} and numbers are animated using + \l {NumberAnimation}{NumberAnimation}. The \c {on propertyName} syntax displayed below + is helpful when targeting a single property. + + \code + In Button.qml: + ... + + color: buttonMouseArea.pressed ? Qt.darker(buttonColor, 1.5) : buttonColor + Behavior on color { ColorAnimation{ duration: 55} } + + scale: buttonMouseArea.pressed ? 1.1 : 1.00 + Behavior on scale { NumberAnimation{ duration: 55} } + \endcode + + Additionally, we can enhance the appearances of our QML components by adding color + effects such as gradients and opacity effects. Declaring a \l {Gradient}{Gradient} + element will override the \c color property of the element. You may declare a color + in the gradient using the \l {GradientStop}{GradientStop} element. The gradient is + positioned using a scale, between \c 0.0 and \c 1.0. + + \code + In MenuBar.qml + gradient: Gradient { + GradientStop { position: 0.0; color: "#8C8F8C" } + GradientStop { position: 0.17; color: "#6A6D6A" } + GradientStop { position: 0.98;color: "#3F3F3F" } + GradientStop { position: 1.0; color: "#0e1B20" } + } + \endcode + + This gradient is used by the menu bar to display a gradient simulating depth. + The first color starts at \c 0.0 and the last color is at \c 1.0. + + + \section2 Where to Go from Here + + We are finished building the user interface of a very simple text editor. + Going forward, the user interface is complete, and we can implement the + application logic using regular Qt and C++. QML works nicely as a prototyping + tool, separating the application logic away from the UI design. + + \image qml-texteditor4_texteditor.png + + \section1 Extending QML using Qt C++ + + Now that we have our text editor layout, we may now implement the text editor + functionalities in C++. Using QML with C++ enables us to create our application + logic using Qt. We can create a QML context in a C++ application using the + \l {Using QML in C++ Applications}{Qt's Declarative} classes and display the QML + elements using a Graphics Scene. Alternatively, we can export our C++ code into + a plugin that the \l {QML Viewer}{qmlviewer} tool can read. For our application, + we shall implement the load and save functions in C++ and export it as a plugin. + This way, we only need to load the QML file directly instead of running an executable. + + \section2 Exposing C++ Classes to QML + + We will be implementing file loading and saving using Qt and C++. C++ classes + and functions can be used in QML by registering them. The class also needs to be + compiled as a Qt plugin and the QML file will need to know where the plugin is located. + + For our application, we need to create the following items: + \list 1 + \o \c Directory class that will handle directory related operations + \o \c File class which is a QObject, simulating the list of files in a directory + \o plugin class that will register the class to the QML context + \o Qt project file that will compile the plugin + \o A \c qmldir file telling the qmlviewer tool where to find the plugin + \endlist + + \section2 Building a Qt Plugin + + To build a plugin, we need to set the following in a Qt project file. First, + the necessary sources, headers, and Qt modules need to be added into our + project file. All the C++ code and project files are in the \c filedialog + directory. + + \code + In cppPlugins.pro: + + TEMPLATE = lib + CONFIG += qt plugin + QT += declarative + + DESTDIR += ../plugins + OBJECTS_DIR = tmp + MOC_DIR = tmp + + TARGET = FileDialog + + HEADERS += directory.h \ + file.h \ + dialogPlugin.h + + SOURCES += directory.cpp \ + file.cpp \ + dialogPlugin.cpp + \endcode + + In particular, we compile Qt with the \c declarative module and configure it as a + \c plugin, needing a \c lib template. We shall put the compiled plugin into the + parent's \c plugins directory. + + + \section2 Registering a Class into QML + + \code + In dialogPlugin.h: + + #include <QtDeclarative/QDeclarativeExtensionPlugin> + + class DialogPlugin : public QDeclarativeExtensionPlugin + { + Q_OBJECT + + public: + void registerTypes(const char *uri); + + }; + + \endcode + Our plugin class, \c DialogPlugin is a subclass of \l {QDeclarativeExtensionPlugin}{QDeclarativeExtensionPlugin}. We need to implement the inherited function, \l {QDeclarativeExtensionPlugin::registerTypes}{registerTypes}. The \c dialogPlugin.cpp file looks like this: + + \code + DialogPlugin.cpp: + + #include "dialogPlugin.h" + #include "directory.h" + #include "file.h" + #include <QtDeclarative/qdeclarative.h> + + void DialogPlugin::registerTypes(const char *uri){ + + qmlRegisterType<Directory>(uri, 1, 0, "Directory"); + qmlRegisterType<File>(uri, 1, 0,"File"); + } + + Q_EXPORT_PLUGIN2(FileDialog, DialogPlugin); + \endcode + + The \l {QDeclarativeExtensionPlugin::registerTypes}{registerTypes} + function registers our File and Directory classes into QML. This function + needs the class name for its template, a major version number, a minor version + number, and a name for our classes. + + We need to export the plugin using the \l {Q_EXPORT_PLUGIN2}{Q_EXPORT_PLUGIN2} + macro. Note that in our \c dialogPlugin.h file, we have the \l {Q_OBJECT}{Q_OBJECT} + macro at the top of our class. As well, we need to run \c qmake on the project + file to generate the necessary meta-object code. + + + \section2 Creating QML Properties in a C++ class + + We can create QML elements and properties using C++ and + \l {The Meta-Object System}{Qt's Meta-Object System}. We can implement + properties using slots and signals, making Qt aware of these properties. + These properties can then be used in QML. + + For the text editor, we need to be able to load and save files. Typically, + these features are contained in a file dialog. Fortunately, we can use + \l {QDir}{QDir}, \l {QFile}{QFile}, and \l {QTextStream}{QTextStream} to + implement directory reading and input/output streams. + + \code + class Directory : public QObject{ + + Q_OBJECT + + Q_PROPERTY(int filesCount READ filesCount CONSTANT) + Q_PROPERTY(QString filename READ filename WRITE setFilename NOTIFY filenameChanged) + Q_PROPERTY(QString fileContent READ fileContent WRITE setFileContent NOTIFY fileContentChanged) + Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT ) + + ... + \endcode + + The \c Directory class uses Qt's Meta-Object System to register properties it + needs to accomplish file handling. The \c Directory class is exported as a plugin + and is useable in QML as the \c Directory element. Each of the listed properties + using the \l {Q_PROPERTY()}{Q_PROPERTY} macro is a QML property. + + The \l {Q_PROPERTY()} {Q_PROPERTY} declares a property as well as its read and + write functions into Qt's Meta-Object System. For example, the \c filename + property, of type \l {QString}{QString}, is readable using the \c filename() + function and writable using the function \c setFilename(). Additionally, there + is a signal associated to the filename property called \c filenameChanged(), + which is emitted whenever the property changes. The read and write functions + are declared as \c public in the header file. + + Similarly, we have the other properties declared according to their uses. The + \c filesCount property indicates the number of files in a directory. The filename + property is set to the currently selected file's name and the loaded/saved file + content is stored in \c fileContent property. + + \code + Q_PROPERTY(QDeclarativeListProperty<File> files READ files CONSTANT ) + \endcode + + The \c files list property is a list of all the filtered files in a directory. + The \c Directory class is implemented to filter out invalid text files; only + files with a \c .txt extension are valid. Further, \l {QLists}{QLists} can be + used in QML files by declaring them as a \c QDeclarativeListProperty in C++. + The templated object needs to inherit from a \l {QObject}{QObject}, therefore, + the \c File class must also inherit from \c QObject. In the \c Directory class, + the list of \c File objects is stored in a \c QList called \c m_fileList. + + \code + class File : public QObject{ + + Q_OBJECT + Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) + + ... + }; + \endcode + + The properties can then be used in QML as part of the \c Directory element's + properties. Note that we do not have to create an identifier \c id property + in our C++ code. + + \code + Directory{ + id: directory + + filesCount + filename + fileContent + files + + files[0].name + } + + \endcode + + Because QML uses Javascript's syntax and structure, we can iterate through + the list of files and retrieve its properties. To retrieve the first file's + name property, we can call \c { files[0].name }. + + Regular C++ functions are also accessible from QML. The file loading and saving + functions are implemented in C++ and declared using the + \l {Q_INVOKABLE}{Q_INVOKABLE} macro. Alternatively, we can declare the functions + as a \c slot and the functions will be accessible from QML. + + \code + In Directory.h: + + Q_INVOKABLE void saveFile(); + Q_INVOKABLE void loadFile(); + \endcode + + The \c Directory class also has to notify other objects whenever the directory + contents change. This feature is performed using a \c signal. As previously + mentioned, QML signals have a corresponding handler with their names prepended + with \c on. The signal is called \c directoryChanged and it is emitted whenever + there is a directory refresh. The refresh simply reloads the directory contents + and updates the list of valid files in the directory. QML items can then be + notified by attaching an action to the \c onDirectoryChanged signal handler. + + The \c list properties need to be explored further. This is because list + properties use callbacks to access and modify the list contents. The list + property is of type \c QDeclarativeListProperty<File>. Whenever the list + is accessed, the accessor function needs to return a + \c QDeclarativeListProperty<File>. The template type, \c File, needs to be a + \c QObject derivative. Further, to create the + \l {QDeclarativeListProperty}{QDeclarativeListProperty}, the list's accessor + and modifiers need to be passed to the consructor as function pointers. The list, + a \c QList in our case, also needs to be a list of \c File pointers. + + The constructor of \l {QDeclarativeListProperty}{QDeclarativeListProperty} + constructor and the \c Directory implementation: + \code + QDeclarativeListProperty ( QObject * object, void * data, AppendFunction append, CountFunction count = 0, AtFunction at = 0, ClearFunction clear = 0 ) + QDeclarativeListProperty<File>( this, &m_fileList, &appendFiles, &filesSize, &fileAt, &clearFilesPtr ); + \endcode + + The constructor passes pointers to functions that will append the list, count + the list, retrieve the item using an index, and empty the list. Only the append + function is mandatory. Note that the function pointers must match the definition + of \l {QDeclarativeListProperty::AppendFunction}{AppendFunction}, + \l {QDeclarativeListProperty::CountFunction}{CountFunction}, + \l {QDeclarativeListProperty::AtFunction}{AtFunction}, or + \l {QDeclarativeListProperty::ClearFunction}{ClearFunction}. + + \code + void appendFiles(QDeclarativeListProperty<File> * property, File * file) + File* fileAt(QDeclarativeListProperty<File> * property, int index) + int filesSize(QDeclarativeListProperty<File> * property) + void clearFilesPtr(QDeclarativeListProperty<File> *property) + \endcode + + To simplify our file dialog, the \c Directory class filters out invalid text + files, which are files that do not have a \c .txt extension. If a file name + doesn't have the \c .txt extension, then it won't be seen in our file dialog. + Also, the implementation makes sure that saved files have a \c .txt extension in + the file name. \c Directory uses \l {QTextStream}{QTextStream} to read the file + and to output the file contents to a file. + + With our \c Directory element, we can retrieve the files as a list, know how many + text files is in the application directory, get the file's name and content as a + string, and be notified whenever there are changes in the directory contents. + + To build the plugin, run \c qmake on the \c cppPlugins.pro project file, then run + \c make to build and transfer the plugin to the \c plugins directory. + + + \section2 Importing a Plugin in QML + + The qmlviewer tool imports files that are in the same directory as the + application. We can also create a \c qmldir file containing the locations of + QML files we wish to import. The \c qmldir file can also store locations of + plugins and other resources. + + \code + In qmldir: + + Button ./Button.qml + FileDialog ./FileDialog.qml + TextArea ./TextArea.qml + TextEditor ./TextEditor.qml + EditMenu ./EditMenu.qml + + plugin FileDialog plugins + \endcode + + The plugin we just created is called \c FileDialog, as indicated by the + \c TARGET field in the project file. The compiled plugin is in the \c plugins directory. + + + \section2 Integrating a File Dialog into the File Menu + + Our \c FileMenu needs to display the \c FileDialog element, containing a list of + the text files in a directory thus allowing the user to select the file by + clicking on the list. We also need to assign the save, load, and new buttons + to their respective actions. The FileMenu contains an editable text input to + allow the user to type a file name using the keyboard. + + The \c Directory element is used in the \c FileMenu.qml file and it notifies the + \c FileDialog element that the directory refreshed its contents. This notification + is performed in the signal handler, \c onDirectoryChanged. + + \code + In FileMenu.qml: + + Directory{ + id:directory + filename: textInput.text + onDirectoryChanged: fileDialog.notifyRefresh() + } + \endcode + + Keeping with the simplicity of our application, the file dialog will always be + visible and will not display invalid text files, which do not have a \c .txt + extension to their filenames. + + \code + In FileDialog.qml: + + signal notifyRefresh() + onNotifyRefresh: dirView.model = directory.files + \endcode + + The \c FileDialog element will display the contents of a directory by reading its + list property called \c files. The files are used as the model of a + \l {GridView}{GridView} element, which displays data items in a grid according + to a delegate. The delegate handles the appearance of the model and our file + dialog will simply create a grid with text centered in the middle. Clicking on + the file name will result in the appearance of a rectangle to highlight the file + name. The \c FileDialog is notified whenever the \c notifyRefresh signal is emitted, + reloading the files in the directory. + + \code + In FileMenu.qml: + + Button{ + id: newButton + label: "New" + onButtonClick:{ + textArea.textContent = "" + } + } + Button{ + id: loadButton + label: "Load" + onButtonClick:{ + directory.filename = textInput.text + directory.loadFile() + textArea.textContent = directory.fileContent + } + } + Button{ + id: saveButton + label: "Save" + onButtonClick:{ + directory.fileContent = textArea.textContent + directory.filename = textInput.text + directory.saveFile() + } + } + Button{ + id: exitButton + label: "Exit" + onButtonClick:{ + Qt.quit() + } + } + \endcode + + Our \c FileMenu can now connect to their respective actions. The \c saveButton + will transfer the text from the \c TextEdit onto the directory's \c fileContent + property, then copy its file name from the editable text input. Finally, the button + calls the \c saveFile() function, saving the file. The \c sloadButton has a similar + execution. Also, the \c New action will empty the contents of the \c TextEdit. + + Further, the \c EditMenu buttons are connected to the \c TextEdit functions to copy, + paste, and select all the text in the text editor. + + \image qml-texteditor5_filemenu.png + + \section1 Text Editor Completion + + \image qml-texteditor5_newfile.png + + The application can function as a simple text editor, able to accept text + and save the text into a file. The text editor can also load from a file and + perform text manipulation. + + +*/
\ No newline at end of file diff --git a/doc/src/getting-started/gettingstartedqt.qdoc b/doc/src/getting-started/gettingstartedqt.qdoc new file mode 100644 index 0000000..1b3770f --- /dev/null +++ b/doc/src/getting-started/gettingstartedqt.qdoc @@ -0,0 +1,517 @@ +/**************************************************************************** +** +** Copyright (C) 2010 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$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in a +** written agreement between you and Nokia. +** +** 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$ +** +****************************************************************************/ + +/*! + \page gettingstartedqt.html + + \title Getting Started programming with Qt + \ingroup gettingStarted + + Welcome to the world of Qt--the cross-platform GUI toolkit. In + this getting started guide, we teach basic Qt knowledge by + implementing a simple Notepad application. After reading this + guide, you should be ready to delve into our overviews and API + documentation, and find the information you need for the + application you are developing. + + \section1 Hello Notepad + + In this first example, we simply create and show a text edit in a + window frame on the desktop. This represents the simplest possible + Qt program that has a GUI. + + \image gs1.png + + Here is the code: + + \code + 1 #include <QApplication> + 2 #include <QTextEdit> + 3 + 4 int main(int argv, char **args) + 5 { + 6 QApplication app(argv, args); + 7 + 8 QTextEdit textEdit; + 9 textEdit.show(); +10 +11 return app.exec(); +12 } + \endcode + + Let us go through the code line by line. In the first two lines, we + include the header files for QApplication and QTextEdit, which are + the two classes that we need for this example. All Qt classes have + a header file named after them. + + Line 6 creates a QApplication object. This object manages + application-wide resources and is necessary to run any Qt program + that has a GUI. It needs \c argv and \c args because Qt accepts a + few command line arguments. + + Line 8 creates a QTextEdit object. A text edit is a visual element + in the GUI. In Qt, we call such elements widgets. Examples of + other widgets are scroll bars, labels, and radio buttons. A widget + can also be a container for other widgets; a dialog or a main + application window, for example. + + Line 9 shows the text edit on the screen in its own window frame. + Since widgets also function as containers (for instance a + QMainWindow, which has toolbars, menus, a status bar, and a few + other widgets), it is possible to show a single widget in its own + window. Widgets are not visible by default; the function + \l{QWidget::}{show()} makes the widget visible. + + Line 11 makes the QApplication enter its event loop. When a Qt + application is running, events are generated and sent to the + widgets of the application. Examples of events are mouse presses + and key strokes. When you type text in the text edit widget, it + receives key pressed events and responds by drawing the text + typed. + + To run the application, open a command prompt, and enter the + directory in which you have the \c .cpp file of the program. The + following shell commands build the program. + + \code + qmake -project + qmake + make + \endcode + + 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. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o Widgets and Window Geometry + \o \l{Window and Dialog Widgets} + \row + \o Events and event handling + \o \l{The Event System} + \endtable + + \section1 Adding a Quit Button + + In a real application, you will normally need more than one + widget. We will now introduce a QPushButton beneath the text edit. + The button will exit the Notepad application when pushed (i.e., + clicked on with the mouse). + + \image gs2.png + + Let us take a look at the code. + + \code + 1 #include <QtGui> + 2 + 3 int main(int argv, char **args) + 4 { + 5 QApplication app(argv, args); + 6 + 7 QTextEdit textEdit; + 8 QPushButton quitButton("Quit"); + 9 +10 QObject::connect(&quitButton, SIGNAL(clicked()), qApp, SLOT(quit())); +11 +12 QVBoxLayout layout; +13 layout.addWidget(&textEdit); +14 layout.addWidget(&quitButton); +15 +16 QWidget window; +17 window.setLayout(&layout); +18 +19 window.show(); +20 +21 return app.exec(); +22 } + \endcode + + Line 1 includes QtGui, which contains all of Qt's GUI classes. + + Line 10 uses Qt's Signals and Slots mechanism to make the + application exit when the \gui {Quit button} is pushed. A slot is + a function that can be invoked at runtime using its name (as a + literal string). A signal is a function that when called will + invoke slots registered with it; we call that to connect the slot + to the signal and to emit the signal. + + \l{QApplication::}{quit()} is a slot of QApplication that exits + the application. \l{QPushButton::}{clicked()} is a signal that + QPushButton emits when it is pushed. The static + QObject::connect() function takes care of connecting the slot to + the signal. SIGNAL() and SLOT() are two macros that take the + function signatures of the signal and slot to connect. We also + need to give pointers to the objects that should send and receive + the signal. + + Line 12 creates a QVBoxLayout. As mentioned, widgets can contain + other widgets. It is possible to set the bounds (the location and + size) of child widgets directly, but it is usually easier to use a + layout. A layout manages the bounds of a widget's children. + QVBoxLayout, for instance, places the children in a vertical row. + + Line 13 and 14 adds the text edit and button to the layout. In + line 17, we set the layout on a widget. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o Signals and slots + \o \l{Signals & Slots} + \row + \o Layouts + \o \l{Layout Management}, + \l{Widgets and Layouts}, + \l{Layout Examples} + \row + \o The widgets that come with Qt + \o \l{Qt Widget Gallery}, + \l{Widget Examples} + \endtable + + \section1 Subclassing QWidget + + When the user wants to quit an application, you might want to + pop-up a dialog that asks whether he/she really wants to quit. In + this example, we subclass QWidget, and add a slot that we connect + to the \gui {Quit button}. + + \image gs3.png + + Let us look at the code: + + \code + 5 class Notepad : public QWidget + 6 { + 7 Q_OBJECT + 8 + 9 public: +10 Notepad(); +11 +12 private slots: +13 void quit(); +14 +15 private: +16 QTextEdit *textEdit; +17 QPushButton *quitButton; +18 }; + \endcode + + The \c Q_OBJECT macro must be first in the class definition, and + declares our class as a \c QObject (Naturally, it must also + inherit from QObject). A \l{QObject} adds several abilities to a + normal C++ class. Notably, the class name and slot names can be + queried at run-time. It is also possible to query a slot's + 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). + + 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")); + } + \endcode + + As you saw in the class definition, we use pointers to our \l + {QObject}s (\c textEdit and \c quitButton). As a rule, you should + always allocate \l{QObject}s on the heap and never copy them. + + We now use the function \l{QObject::}{tr()} around our user + 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. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o tr() and internationalization + \o \l{Qt Linguist Manual}, + \l{Writing Source Code for Translation}, + \l{Hello tr() Example}, + \l{Internationalization with Qt} + \row + \o QObjects and the Qt Object model (This is essential to understand Qt) + \o \l{Object Model} + \row + \o qmake and the Qt build system + \o \l{qmake Manual} + \endtable + + \section2 Creating a .pro file + + For this example, we write our own \c .pro file instead of + using \c qmake's \c -project option. + + \code + HEADERS = notepad.h + SOURCES = notepad.cpp \ + main.cpp + \endcode + + The following shell commands build the example. + + \code + qmake + make + \endcode + + \section1 Using a QMainWindow + + Many applications will benefit from using a QMainWindow, which has + its own layout to which you can add a menu bar, dock widgets, tool + bars, and a status bar. QMainWindow has a center area that can be + occupied by any kind of widget. In our case, we will place our + text edit there. + + \image gs4.png + + Let us look at the new \c Notepad class definition. + + \code + #include <QtGui> + + 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; + }; + \endcode + + We include two more slots that can save and open a document. We + will implement these in the next section. + + Often, in a main window, the same slot should be invoked by + several widgets. Examples are menu items and buttons on a tool + bar. To make this easier, Qt provides QAction, which can be given + to several widgets, and be connected to a slot. For instance, both + QMenu and QToolBar can create menu items and tool buttons from the + same \l{QAction}s. We will see how this works shortly. + + As before, we use the \c {Notepad}s constructor to set up the + 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")); + } + \endcode + + \l{QAction}s are created with the text that should appear on the + widgets that we add them to (in our case, menu items). If we also + wanted to add them to a tool bar, we could have given + \l{QIcon}{icons} to the actions. + + When a menu item is clicked now, the item will trigger the action, + and the respective slot will be invoked. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o Main windows and main window classes + \o \l{Application Main Window}, + \l{Main Window Examples} + \row + \o MDI applications + \o QMdiArea, + \l{MDI Example} + \endtable + + \section1 Saving and Loading + + In this example, we will implement the functionality of the \c + open() and \c save() slots that we added in the previous example. + + \image gs5.png + + 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(); + } + \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 + selected, or an empty string if the user canceled the dialog. + + If we have a file name, we try to open the file with + \l{QIODevice::}{open()}, which returns true if the file could be + opened. We will not go into error handling here, but you can follow + the links from the learn more section. If the file could not be + opened, we use QMessageBox to display a dialog with an error + 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 + 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(); + } + } + \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. + + \section2 Learn More + + \table + \header + \o About + \o Here + \row + \o Files and I/O devices + \o QFile, QIODevice + \endtable + + \omit + \section1 Moving On + + This may not be true for the first release. + The Qt documentation comes with three getting started guides. You + have come to the end of the first, which concerns itself with + basic Qt concepts. We also have guides covering intermediate and + advanced topics. They are found here: You may also have noticed that the learn more sections in + this guide frequently linked to them. + Basic Qt Architecture + \endomit +*/ + diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 90723ec..629d8b7 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -30,10 +30,13 @@ \title Installation \brief Installing Qt on supported platforms. -The installation procedure is different on each Qt platform. -Please follow the instructions for your platform from the following list. +The installation procedure is different on each Qt platform. This page provides +information on how to install Qt, as well as software and hardware requirements +for using Qt on each of the supported platforms. Please follow the instructions +for your platform from the following list. \generatelist{related} + */ /*! \page install-x11.html diff --git a/doc/src/index.qdoc b/doc/src/index.qdoc index 4acf212..7efd1e6 100644 --- a/doc/src/index.qdoc +++ b/doc/src/index.qdoc @@ -65,8 +65,8 @@ </div> <div class="sectionlist tricol"> <ul> - <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> - <li><a href="qt-basic-concepts.html">Qt Architecture</a></li> + <!-- <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> --> + <li><a href="qt-basic-concepts.html">Basic Qt Architecture</a></li> <li><a href="developing-with-qt.html">Cross-platform & Platform-specific Development</a></li> <li><a href="technology-apis.html">Qt & standard technologies </a></li> <li><a href="best-practices.html">Qt How-to's & best practices</a></li> @@ -78,7 +78,7 @@ <li><a href="qdeclarativeintroduction.html">Introduction to QML</a></li> <li><a href="qdeclarativeelements.html">QML Elements</a></li> <li><a href="qt-gui-concepts.html">UI components</a></li> - <li><a href="declarativeui.html">Qt & GUI design</a></li> + <!-- <li><a href="declarativeui.html">Qt & GUI design</a></li> --> </ul> </div> </div> @@ -94,12 +94,12 @@ </div> <div class="section sectionlist"> <ul> - <li><a href="http://doc.qt.nokia.com/qtcreator-2.0/index.html">Qt Creator</a></li> + <li><a href="http://doc.qt.nokia.com/qtcreator-2.0/index.html">Qt Creator</a> (online document)</li> <li><a href="designer-manual.html">Qt Designer</a></li> <li><a href="linguist-manual.html">Qt Linguist</a></li> <li><a href="assistant-manual.html">Qt Assistant</a></li> - <li><a href="http://doc.qt.nokia.com/qtsimulator-1.0/simulator-description.html">Qt Simulator</a></li> - <li><a href="http://qt.nokia.com/developer/eclipse-integration">Integration</a> and <a href="http://qt.nokia.com/products/appdev">add-ins</a></li> + <li><a href="http://doc.qt.nokia.com/qtsimulator-1.0/simulator-description.html">Qt Simulator</a> (online document)</li> + <li><a href="http://qt.nokia.com/developer/eclipse-integration">Integration</a> (online document) and <a href="http://qt.nokia.com/products/appdev">add-ins</a> (online document)</li> <li><a href="qvfb.html">Virtual Framebuffer</a></li> </ul> </div> diff --git a/doc/src/internationalization/linguist-manual.qdoc b/doc/src/internationalization/linguist-manual.qdoc index c8d8e9d..fa992af 100644 --- a/doc/src/internationalization/linguist-manual.qdoc +++ b/doc/src/internationalization/linguist-manual.qdoc @@ -1414,8 +1414,8 @@ \c -pluralonly command line option, which allows the creation of TS files containing only entries with plural forms. - See the \l{http://qt.nokia.com/doc/qq/}{Qt Quarterly} Article - \l{http://qt.nokia.com/doc/qq/qq19-plurals.html}{Plural Forms in Translations} + See the \l{http://doc.qt.nokia.com/qq/}{Qt Quarterly} Article + \l{http://doc.qt.nokia.com/qq/qq19-plurals.html}{Plural Forms in Translations} for further details on this issue. \section2 Coping With C++ Namespaces diff --git a/doc/src/platforms/emb-directfb-EmbLinux.qdoc b/doc/src/platforms/emb-directfb-EmbLinux.qdoc index b4f44bf..955258e 100644 --- a/doc/src/platforms/emb-directfb-EmbLinux.qdoc +++ b/doc/src/platforms/emb-directfb-EmbLinux.qdoc @@ -147,8 +147,8 @@ your qmake.conf. #DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" \endcode -As demonstrated above, you need to Qt which drawing operations you want to -warn/disable. Since there are varying implementations of DirectFB from +As demonstrated above, you need to tell Qt which drawing operations you want +to warn/disable. Since there are varying implementations of DirectFB from manufacturer to manufacture, different operations will be optimized. This require you to define the operations you want to warn about or disable. These are listed above in the DIRECTFB_DRAWINGOPERATIONS variable. diff --git a/doc/src/platforms/platform-notes.qdocinc b/doc/src/platforms/platform-notes.qdocinc new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/doc/src/platforms/platform-notes.qdocinc diff --git a/doc/src/porting/porting4.qdoc b/doc/src/porting/porting4.qdoc index f355e7b..0bbf35f 100644 --- a/doc/src/porting/porting4.qdoc +++ b/doc/src/porting/porting4.qdoc @@ -472,7 +472,7 @@ \section1 Explicit Sharing Qt 4 is the first version of Qt that contains no \link - http://qt.nokia.com/doc/3.3/shclass.html explicitly shared + http://doc.qt.nokia.com/3.3/shclass.html explicitly shared \endlink classes. All classes that were explicitly shared in Qt 3 are \e implicitly shared in Qt 4: @@ -1079,7 +1079,7 @@ ensuring that the string is '\\0'-terminated. Another important issue was that conversions between \c QCString and QByteArray often gave confusing results. (See the - \l{http://qt.nokia.com/doc/qq/qq05-achtung.html#qcstringisastringofchars}{Achtung! + \l{http://doc.qt.nokia.com/qq/qq05-achtung.html#qcstringisastringofchars}{Achtung! Binary and Character Data} article in \e{Qt Quarterly} for an overview of the pitfalls.) @@ -2440,13 +2440,13 @@ that provides the old semantics. See the Q3Painter documentation for details and for the reasons why we had to make this change. - The \l{http://qt.nokia.com/doc/3.3/qpainter.html#CoordinateMode-enum}{QPainter::CoordinateMode} + The \l{http://doc.qt.nokia.com/3.3/qpainter.html#CoordinateMode-enum}{QPainter::CoordinateMode} enum has been removed in Qt 4. All clipping operations are now defined using logical coordinates and are subject to transformation operations. The - \l{http://qt.nokia.com/doc/3.3/qpainter.html#RasterOP-enum}{QPainter::RasterOP} + \l{http://doc.qt.nokia.com/3.3/qpainter.html#RasterOP-enum}{QPainter::RasterOP} enum has been replaced with QPainter::CompositionMode. \section1 QPicture @@ -3258,7 +3258,7 @@ \list \o If you use Q3SocketDevice in a thread to perform blocking network I/O (a technique encouraged by the \e{Qt Quarterly} - article \l{http://qt.nokia.com/doc/qq/qq09-networkthread.html} + article \l{http://doc.qt.nokia.com/qq/qq09-networkthread.html} {Unblocking Networking}), you can now use QTcpSocket, QFtp, or QNetworkAccessManager, which can be used from non-GUI threads. @@ -4052,7 +4052,7 @@ Sample code on how to do obtain similar behavior from Qt 4, previously handled by some of the above functions can be found in the - \l{http://qt.nokia.com/doc/qwidget-qt3.html}{Qt 3 Support Members for QWidget} + \l{http://doc.qt.nokia.com/qwidget-qt3.html}{Qt 3 Support Members for QWidget} page. A widget now receives change events in its QWidget::changeEvent() @@ -4150,7 +4150,7 @@ clearWFlags() has no direct replacement. You can use QWidget::setAttribute() instead. For example, \c{setAttribute(..., false)} to clear an attribute. More information - is available \l{http://qt.nokia.com/doc/qwidget.html#setAttribute}{here}. + is available \l{http://doc.qt.nokia.com/qwidget.html#setAttribute}{here}. testWFlags() was renamed to \l{QWidget::testAttribute()}{testAttribute()}. diff --git a/doc/src/qt-webpages.qdoc b/doc/src/qt-webpages.qdoc index 89d564f..0c61285 100644 --- a/doc/src/qt-webpages.qdoc +++ b/doc/src/qt-webpages.qdoc @@ -141,7 +141,7 @@ */ /*! - \externalpage http://qt.nokia.com/doc/supported-platforms.html + \externalpage http://doc.qt.nokia.com/supported-platforms.html \title Platform Support Policy */ @@ -151,7 +151,7 @@ */ /*! - \externalpage http://qt.nokia.com/doc/supported-platforms.html + \externalpage http://doc.qt.nokia.com/supported-platforms.html \title Qt 4 Platforms Overview */ @@ -161,7 +161,7 @@ */ /*! - \externalpage http://qt.nokia.com/doc/qq/ + \externalpage http://doc.qt.nokia.com/qq/ \title Qt Quarterly */ @@ -181,7 +181,7 @@ */ /*! - \externalpage http://qt.nokia.com/doc/qtcanvas + \externalpage http://doc.qt.nokia.com/qtcanvas \title QtCanvas */ diff --git a/doc/src/template/style/OfflineStyle.css b/doc/src/template/style/OfflineStyle.css deleted file mode 100644 index 9f5d28b..0000000 --- a/doc/src/template/style/OfflineStyle.css +++ /dev/null @@ -1,251 +0,0 @@ -@media screen -{ - - .wrapper - { - top:50px; - background: none; - - } - .wrapper .bd - { - background: none; - position: relative; - } - - - - - body.offline - { - background-image: none; - background-color: #FFFFFF; - - } - - .offline .footer { - margin: 0; - } - .offline .header - { - width: 100%; - margin: 0; - height: auto; - background-color: #ffffff; - padding: 10px 0 5px 0; - overflow: visible; - border-bottom: solid #E5E5E5 1px; - z-index:1; - position:fixed; - } - - .offline .header .content - { - } - .offline .header .qtref - { - color: #00732F; - position: static; - float: left; - margin-left: 5px; - font: bold 18px/1 Arial; - } - - .offline .header .qtref:visited - { - color: #00732F; - } - .offline .header .qtref:hover - { - color: #00732F; - text-decoration:none; - } - .offline .header .qtref span - { - background-image: none; - text-indent: 0; - text-decoration:none; - } - - .offline .wrap - { - margin: 0 5px 0 5px; - } - - .offline .wrap .toolbar - { - display:block; - padding-top:5px; - } - - .offline .wrap .breadcrumb ul li { - font-weight: normal; - } - - .offline .wrap .breadcrumb ul li a { - /*color: #44a51c;*/ - } - - .offline .wrap .breadcrumb ul li.last a { - /*color: #363534;*/ - } - - - - .narrow .indexboxcont .section { - width: 64%; - padding-left: 0; - } - - .narrow .indexboxcont .sectionlist { - width: 32.5%; - } - - .header .icon, - .sidebar, - .feedback, - .t_button, - .feedback, - #feedbackBox, - #feedback, - #blurpage, - .indexbox .indexIcon span, - .wrapper .hd, - .offline .indexbox .indexIcon, - .offline .header #nav-logo, - #offlinemenu, - #offlinesearch, - .offline .header #nav-topright, - .offline .header #shortCut , - .offline .wrapper .hd, - .offline .wrapper .ft, - .offline .sidebar, - .offline .wrap .feedback - { - display:none; - } - - /* end offline mode */ -#narrowmenu { - display: none; - float: right; - margin: 15px 40px 0 0; - font-size: 11px; - } - - .narrow #narrowmenu { - display: block; - } - - #narrowsearch{ - display:none; - } - - #narrowmenu ul - { - border-bottom:solid 1px #E5E5E5; - border-left:solid 1px #E5E5E5; - border-right:solid 1px #E5E5E5; - } - - #narrowmenu a { - line-height: 1.1; - background: url(../images/arrow_down.png) no-repeat 100% 50%; - white-space: nowrap; - padding: 0 16px 0 5px; - } - - #narrowmenu li { - margin-left: 20px; - } - - #narrowmenu li li { - margin: 0 0 5px 0; - } - - #narrowmenu li li a { - padding: 0; - background-image: none; - } - - #narrowmenu li, - #narrowmenu li ul { - background-color: #fff; - } - - #narrowmenu li ul { - width: auto; - padding: 5px; - margin-top:-15px; - } - - .sf-menu li:hover ul, .sf-menu li.sfHover ul { - top: 1.2em; - } -.sf-menu, .sf-menu * { - margin: 0; - padding: 0; - list-style: none; -} -.sf-menu { - line-height: 1.0; -} -.sf-menu ul { - position: absolute; - top: -999em; - width: 10em; /* left offset of submenus need to match (see below) */ -} -.sf-menu ul li { - width: 100%; -} -.sf-menu li:hover { - visibility: inherit; /* fixes IE7 'sticky bug' */ -} -.sf-menu li { - float: left; - position: relative; -} -.sf-menu a { - display: block; - position: relative; -} -.sf-menu li:hover ul, -.sf-menu li.sfHover ul { - left: 0; - top: 2.5em; /* match top ul list item height */ - z-index: 99; -} -ul.sf-menu li:hover li ul, -ul.sf-menu li.sfHover li ul { - top: -999em; -} -ul.sf-menu li li:hover ul, -ul.sf-menu li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; -} -ul.sf-menu li li:hover li ul, -ul.sf-menu li li.sfHover li ul { - top: -999em; -} -ul.sf-menu li li li:hover ul, -ul.sf-menu li li li.sfHover ul { - left: 10em; /* match ul width */ - top: 0; -} - .wrap .content ol li { - background:none; - font:400 10pt/1 Verdana; - margin-bottom:10px; - margin-left:12px; - } - .wrap .content ol li { - list-style-type:decimal; - - } - - - -} -/* end of screen media */ - diff --git a/doc/src/template/style/narrow.css b/doc/src/template/style/narrow.css index 05159aa..e4ad135 100644 --- a/doc/src/template/style/narrow.css +++ b/doc/src/template/style/narrow.css @@ -15,7 +15,12 @@ } .narrow .footer { - margin: 0; + margin: 0px; + } + + .creator .header, .creator .header .content, .creator .footer, .creator .wrapper { + margin: 0px; + min-width: 300px; } .narrow .header { @@ -126,6 +131,11 @@ margin: 0 5px 0 5px; } + .creator .wrap + { + margin: 0px; + background:#FFFFFF; + } .narrow .wrap .toolbar { border-bottom: none; @@ -135,7 +145,14 @@ { padding-top: 15px; } - + .creator .wrap .content + { + padding-top: 10px; + } + .creator .wrap .content .guide + { + padding-top: 15px; + } .narrow .wrap .feedback { display: none; diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index 9f80921..9b37693 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -1345,7 +1345,7 @@ font: normal 13px/1.2 Verdana; color: #363534; - background-color: #FFFFFF; + background-color: #FAFAFA; } @@ -1406,7 +1406,9 @@ border-bottom:1px solid #E5E5E5; - width:100%, + /*width:100%;*/ + margin-left:-5px; + margin-right:-5px; } .creator .wrap .breadcrumb ul li a { @@ -1550,18 +1552,17 @@ @media print { - input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft + input, textarea, .header, .footer, .toolbar, .feedback, .wrapper .hd, .wrapper .bd .sidebar, .wrapper .ft, #feedbackBox, #blurpage, .toc, .breadcrumb, .toolbar, .floatingResult { display: none; background: none; } .content { - position: absolute; - top: 0px; - left: 0px; background: none; display: block; + width: 100%; margin: 0; float: none; + } } /* end of print media */ diff --git a/doc/src/template/style/superfish_skin.css b/doc/src/template/style/superfish_skin.css deleted file mode 100644 index 8d84827..0000000 --- a/doc/src/template/style/superfish_skin.css +++ /dev/null @@ -1,83 +0,0 @@ - -/*** DEMO SKIN ***/ -.sf-menu { - float: left; - margin-bottom: 1em; -} -.sf-menu a { - border-left: 1px solid #fff; - border-top: 1px solid #CFDEFF; - padding: .75em 1em; - text-decoration:none; -} -.sf-menu a, .sf-menu a:visited { /* visited pseudo selector so IE6 applies text colour*/ - color: #13a; -} -.sf-menu li { - background: #BDD2FF; -} -.sf-menu li li { - background: #AABDE6; -} -.sf-menu li li li { - background: #9AAEDB; -} -.sf-menu li:hover, .sf-menu li.sfHover, -.sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active { - background: #CFDEFF; - outline: 0; -} - -/*** arrows **/ -.sf-menu a.sf-with-ul { - padding-right: 2.25em; - min-width: 1px; /* trigger IE7 hasLayout so spans position accurately */ -} -.sf-sub-indicator { - position: absolute; - display: block; - right: .75em; - top: 1.05em; /* IE6 only */ - width: 10px; - height: 10px; - text-indent: -999em; - overflow: hidden; - background: url('../images/arrows-ffffff.png') no-repeat -10px -100px; /* 8-bit indexed alpha png. IE6 gets solid image only */ -} -a > .sf-sub-indicator { /* give all except IE6 the correct values */ - top: .8em; - background-position: 0 -100px; /* use translucent arrow for modern browsers*/ -} -/* apply hovers to modern browsers */ -a:focus > .sf-sub-indicator, -a:hover > .sf-sub-indicator, -a:active > .sf-sub-indicator, -li:hover > a > .sf-sub-indicator, -li.sfHover > a > .sf-sub-indicator { - background-position: -10px -100px; /* arrow hovers for modern browsers*/ -} - -/* point right for anchors in subs */ -.sf-menu ul .sf-sub-indicator { background-position: -10px 0; } -.sf-menu ul a > .sf-sub-indicator { background-position: 0 0; } -/* apply hovers to modern browsers */ -.sf-menu ul a:focus > .sf-sub-indicator, -.sf-menu ul a:hover > .sf-sub-indicator, -.sf-menu ul a:active > .sf-sub-indicator, -.sf-menu ul li:hover > a > .sf-sub-indicator, -.sf-menu ul li.sfHover > a > .sf-sub-indicator { - background-position: -10px 0; /* arrow hovers for modern browsers*/ -} - -/*** shadows for all but IE6 ***/ -.sf-shadow ul { - background: url('../images/shadow.png') no-repeat bottom right; - padding: 0 8px 9px 0; - -moz-border-radius-bottomleft: 17px; - -moz-border-radius-topright: 17px; - -webkit-border-top-right-radius: 17px; - -webkit-border-bottom-left-radius: 17px; -} -.sf-shadow ul.sf-shadow-off { - background: transparent; -} diff --git a/doc/src/widgets-and-layouts/layout.qdoc b/doc/src/widgets-and-layouts/layout.qdoc index aa4a933..798a7a1 100644 --- a/doc/src/widgets-and-layouts/layout.qdoc +++ b/doc/src/widgets-and-layouts/layout.qdoc @@ -242,7 +242,7 @@ For further guidance when implementing these functions, see the \e{Qt Quarterly} article - \l{http://qt.nokia.com/doc/qq/qq04-height-for-width.html} + \l{http://doc.qt.nokia.com/qq/qq04-height-for-width.html} {Trading Height for Width}. diff --git a/examples/network/bearercloud/bluetooth.svg b/examples/network/bearercloud/bluetooth.svg new file mode 100644 index 0000000..32e2fa3 --- /dev/null +++ b/examples/network/bearercloud/bluetooth.svg @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY ns_svg "http://www.w3.org/2000/svg"> + <!ENTITY ns_xlink "http://www.w3.org/1999/xlink"> +]> +<svg version="1.1" id="图层_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="21.792" height="21.819" + viewBox="0 0 21.792 21.819" overflow="visible" enable-background="new 0 0 21.792 21.819" xml:space="preserve"> +<linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="11.0322" y1="2.8701" x2="11.0322" y2="21.2133"> + <stop offset="0" style="stop-color:#95D1DB"/> + <stop offset="0.0684" style="stop-color:#7FBAE0"/> + <stop offset="0.2073" style="stop-color:#5892EA"/> + <stop offset="0.3506" style="stop-color:#3871F1"/> + <stop offset="0.4971" style="stop-color:#2058F7"/> + <stop offset="0.648" style="stop-color:#0E45FC"/> + <stop offset="0.8061" style="stop-color:#033BFE"/> + <stop offset="0.9831" style="stop-color:#0037FF"/> +</linearGradient> +<path fill="url(#XMLID_2_)" stroke="#4D4D4D" stroke-width="0.5" stroke-linejoin="round" d="M10.496,10.931l5.303-4.672 + L9.172,0.292l-0.05,9.427L9.109,9.708v0.029L7.304,8.168L6.266,9.364l1.802,1.567l-1.802,1.567l1.038,1.195l1.806-1.569v0.029 + l0.013-0.012l0.05,9.428l6.627-5.966L10.496,10.931z M10.672,3.993l2.502,2.252l-2.525,2.225L10.672,3.993z M13.174,15.617 + l-2.502,2.252l-0.023-4.477L13.174,15.617z"/> +<rect opacity="0" fill="#FFFFFF" width="21.792" height="21.792"/> +</svg> diff --git a/examples/network/bearercloud/cell.svg b/examples/network/bearercloud/cell.svg new file mode 100644 index 0000000..7519868 --- /dev/null +++ b/examples/network/bearercloud/cell.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY ns_svg "http://www.w3.org/2000/svg"> + <!ENTITY ns_xlink "http://www.w3.org/1999/xlink"> +]> +<svg version="1.1" id="图层_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="15.667" height="15.794" + viewBox="0 0 15.667 15.794" style="overflow:visible;enable-background:new 0 0 15.667 15.794;" xml:space="preserve"> +<rect style="fill:none;" width="15.667" height="15.666"/> +<g> + <rect x="3.791" y="0.583" style="fill:#996633;" width="1" height="7.963"/> + <rect x="10.917" y="0.583" style="fill:#996633;" width="1" height="7.963"/> + <linearGradient id="XMLID_2_" gradientUnits="userSpaceOnUse" x1="7.8936" y1="1.6753" x2="7.8936" y2="15.1908"> + <stop offset="0" style="stop-color:#D9C7A8"/> + <stop offset="0.1575" style="stop-color:#CEB28C"/> + <stop offset="0.395" style="stop-color:#C09869"/> + <stop offset="0.6188" style="stop-color:#B58550"/> + <stop offset="0.8212" style="stop-color:#AF7940"/> + <stop offset="0.9831" style="stop-color:#AD753B"/> + </linearGradient> + <rect x="6.728" y="0.583" style="fill:url(#XMLID_2_);stroke:#000000;stroke-width:0.75;" width="2.333" height="14.836"/> + <rect x="3.433" y="2.541" style="fill:#C4AB96;stroke:#000000;stroke-width:0.75;" width="8.92" height="2.413"/> + <rect x="3.433" y="6.635" style="fill:#C4AB96;stroke:#000000;stroke-width:0.75;" width="8.92" height="2.412"/> +</g> +</svg> diff --git a/examples/network/bearercloud/cloud.cpp b/examples/network/bearercloud/cloud.cpp index 980efbf..6019d9b 100644 --- a/examples/network/bearercloud/cloud.cpp +++ b/examples/network/bearercloud/cloud.cpp @@ -53,7 +53,7 @@ #include <math.h> -static QMap<QString, QSvgRenderer *> svgCache; +static QMap<QNetworkConfiguration::BearerType, QSvgRenderer *> svgCache; //! [0] Cloud::Cloud(const QNetworkConfiguration &config, QGraphicsItem *parent) @@ -261,9 +261,9 @@ void Cloud::stateChanged(QNetworkSession::State state) tooltip += tr("<br>Id: %1").arg(configuration.identifier()); #endif - const QString bearerName = configuration.bearerName(); - if (!bearerName.isEmpty()) - tooltip += tr("<br>Bearer: %1").arg(bearerName); + const QString bearerTypeName = configuration.bearerTypeName(); + if (!bearerTypeName.isEmpty()) + tooltip += tr("<br>Bearer: %1").arg(bearerTypeName); QString s = tr("<br>State: %1 (%2)"); switch (state) { @@ -313,17 +313,36 @@ void Cloud::stateChanged(QNetworkSession::State state) //! [1] void Cloud::newConfigurationActivated() { - const QString bearerName = configuration.bearerName(); - if (!svgCache.contains(bearerName)) { - if (bearerName == QLatin1String("WLAN")) - svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":wlan.svg"))); - else if (bearerName == QLatin1String("Ethernet")) - svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":lan.svg"))); - else - svgCache.insert(bearerName, new QSvgRenderer(QLatin1String(":unknown.svg"))); + QNetworkConfiguration::BearerType bearerType = configuration.bearerType(); + if (!svgCache.contains(bearerType)) { + QSvgRenderer *renderer = 0; + switch (bearerType) { + case QNetworkConfiguration::BearerWLAN: + renderer = new QSvgRenderer(QLatin1String(":wlan.svg")); + break; + case QNetworkConfiguration::BearerEthernet: + renderer = new QSvgRenderer(QLatin1String(":lan.svg")); + break; + case QNetworkConfiguration::Bearer2G: + renderer = new QSvgRenderer(QLatin1String(":cell.svg")); + break; + case QNetworkConfiguration::BearerBluetooth: + renderer = new QSvgRenderer(QLatin1String(":bluetooth.svg")); + break; + case QNetworkConfiguration::BearerCDMA2000: + case QNetworkConfiguration::BearerWCDMA: + case QNetworkConfiguration::BearerHSPA: + renderer = new QSvgRenderer(QLatin1String(":umts.svg")); + break; + default: + renderer = new QSvgRenderer(QLatin1String(":unknown.svg")); + } + + if (renderer) + svgCache.insert(bearerType, renderer); } - icon->setSharedRenderer(svgCache[bearerName]); + icon->setSharedRenderer(svgCache[bearerType]); if (configuration.name().isEmpty()) { text->setPlainText(tr("HIDDEN NETWORK")); diff --git a/examples/network/bearercloud/gprs.svg b/examples/network/bearercloud/gprs.svg new file mode 100644 index 0000000..4a992c1 --- /dev/null +++ b/examples/network/bearercloud/gprs.svg @@ -0,0 +1,199 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.0" + id="图层_1" + width="13" + height="14" + viewBox="0 0 21.228 20.825" + style="overflow:visible;enable-background:new 0 0 21.228 20.825;" + xml:space="preserve" + sodipodi:version="0.32" + inkscape:version="0.44.1" + sodipodi:docname="GPRS-online.svg" + sodipodi:docbase="/home/user"><metadata + id="metadata76"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs + id="defs74"> + <linearGradient + y2="18.770201" + x2="19.1735" + y1="2.1933999" + x1="2.5967" + gradientUnits="userSpaceOnUse" + id="XMLID_5_" + gradientTransform="matrix(1.749056,0,0,1.749987,1.149567,1.483541)"> + <stop + id="stop6" + style="stop-color:#F8DB41" + offset="0" /> + <stop + id="stop8" + style="stop-color:#F8D73F" + offset="0.1193" /> + <stop + id="stop10" + style="stop-color:#F9CB3A" + offset="0.2384" /> + <stop + id="stop12" + style="stop-color:#FAB731" + offset="0.3576" /> + <stop + id="stop14" + style="stop-color:#FC9B24" + offset="0.4768" /> + <stop + id="stop16" + style="stop-color:#FE7714" + offset="0.595" /> + <stop + id="stop18" + style="stop-color:#FE7513" + offset="0.6011" /> + </linearGradient> + + <linearGradient + y2="13.7331" + x2="24.2068" + y1="-2.8408" + x1="7.6328001" + gradientUnits="userSpaceOnUse" + id="XMLID_6_"> + <stop + id="stop23" + style="stop-color:#F8DB41" + offset="0" /> + <stop + id="stop25" + style="stop-color:#F8D73F" + offset="0.1193" /> + <stop + id="stop27" + style="stop-color:#F9CB3A" + offset="0.2384" /> + <stop + id="stop29" + style="stop-color:#FAB731" + offset="0.3576" /> + <stop + id="stop31" + style="stop-color:#FC9B24" + offset="0.4768" /> + <stop + id="stop33" + style="stop-color:#FE7714" + offset="0.595" /> + <stop + id="stop35" + style="stop-color:#FE7513" + offset="0.6011" /> + </linearGradient> + + <linearGradient + y2="23.8965" + x2="14.043" + y1="7.3242002" + x1="-2.5293" + gradientUnits="userSpaceOnUse" + id="XMLID_7_"> + <stop + id="stop40" + style="stop-color:#F8DB41" + offset="0" /> + <stop + id="stop42" + style="stop-color:#F8D73F" + offset="0.1193" /> + <stop + id="stop44" + style="stop-color:#F9CB3A" + offset="0.2384" /> + <stop + id="stop46" + style="stop-color:#FAB731" + offset="0.3576" /> + <stop + id="stop48" + style="stop-color:#FC9B24" + offset="0.4768" /> + <stop + id="stop50" + style="stop-color:#FE7714" + offset="0.595" /> + <stop + id="stop52" + style="stop-color:#FE7513" + offset="0.6011" /> + </linearGradient> + + <linearGradient + y2="18.5788" + x2="19.364" + y1="2.0039001" + x1="2.7890999" + gradientUnits="userSpaceOnUse" + id="XMLID_8_"> + <stop + id="stop57" + style="stop-color:#F8DB41" + offset="0" /> + <stop + id="stop59" + style="stop-color:#F8D73F" + offset="0.1193" /> + <stop + id="stop61" + style="stop-color:#F9CB3A" + offset="0.2384" /> + <stop + id="stop63" + style="stop-color:#FAB731" + offset="0.3576" /> + <stop + id="stop65" + style="stop-color:#FC9B24" + offset="0.4768" /> + <stop + id="stop67" + style="stop-color:#FE7714" + offset="0.595" /> + <stop + id="stop69" + style="stop-color:#FE7513" + offset="0.6011" /> + </linearGradient> + +</defs><sodipodi:namedview + inkscape:window-height="960" + inkscape:window-width="1183" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + guidetolerance="10.0" + gridtolerance="10.0" + objecttolerance="10.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base" + width="13px" + height="14px" + inkscape:zoom="19.543817" + inkscape:cx="10.614" + inkscape:cy="10.386917" + inkscape:window-x="186" + inkscape:window-y="93" + inkscape:current-layer="图层_1" /> +<path + id="path20" + d="M 11.043976,12.916206 L 11.043976,9.4232323 L 19.388723,9.4232323 L 19.388723,16.573679 C 17.790085,17.616671 16.380346,18.330666 15.15076,18.708663 C 13.922922,19.084911 12.465959,19.272159 10.779869,19.272159 C 8.7054879,19.272159 7.0141507,18.934412 5.7076059,18.253667 C 4.399312,17.574672 3.3866086,16.564929 2.6677466,15.222689 C 1.9488846,13.880449 1.58683,12.336961 1.58683,10.599223 C 1.58683,8.7652372 1.9803676,7.172749 2.7674428,5.820009 C 3.5527689,4.4655191 4.7053968,3.4365268 6.2288246,2.7312819 C 7.4111865,2.190536 9.0045765,1.921038 11.008995,1.921038 C 12.939953,1.921038 14.386422,2.0890367 15.343156,2.4232842 C 16.301639,2.7610318 17.093961,3.2825279 17.728868,3.9860227 C 18.360278,4.6930174 18.834272,5.5890108 19.150851,6.6722527 L 13.938664,7.5629961 C 13.72353,6.9330008 13.361475,6.4465044 12.849002,6.1157569 C 12.33478,5.7815093 11.68588,5.6117606 10.890059,5.6117606 C 9.7111951,5.6117606 8.7632067,6.0072577 8.0653334,6.7965018 C 7.3622129,7.5839959 7.0071545,8.8352366 7.0071545,10.541474 C 7.0071545,12.35621 7.365711,13.654701 8.0740787,14.433445 C 8.7824464,15.212189 9.7776592,15.600686 11.043976,15.600686 C 11.647401,15.600686 12.224589,15.514937 12.770295,15.346938 C 13.321247,15.18069 13.943911,14.897192 14.652279,14.492945 L 14.652279,12.917956 L 11.043976,12.917956 L 11.043976,12.916206 z " + style="fill:black;stroke:white;stroke-width:1.30633846;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round;stroke-linecap:butt;stroke-opacity:1;fill-opacity:1" /> +</svg> diff --git a/examples/network/bearercloud/icons.qrc b/examples/network/bearercloud/icons.qrc index 84a8939..7dea1f2 100644 --- a/examples/network/bearercloud/icons.qrc +++ b/examples/network/bearercloud/icons.qrc @@ -3,5 +3,9 @@ <file>wlan.svg</file> <file>lan.svg</file> <file>unknown.svg</file> + <file>bluetooth.svg</file> + <file>cell.svg</file> + <file>gprs.svg</file> + <file>umts.svg</file> </qresource> </RCC> diff --git a/examples/network/bearercloud/lan.svg b/examples/network/bearercloud/lan.svg index 3cce805..4f7f63d 100644..100755 --- a/examples/network/bearercloud/lan.svg +++ b/examples/network/bearercloud/lan.svg @@ -1,76 +1,33 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://creativecommons.org/ns#" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="25.000002" - height="9.6406126" - id="svg2" - sodipodi:version="0.32" - inkscape:version="0.46" - version="1.0" - sodipodi:docname="lan.svg" - inkscape:output_extension="org.inkscape.output.svg.inkscape"> - <defs - id="defs4"> - <inkscape:perspective - sodipodi:type="inkscape:persp3d" - inkscape:vp_x="0 : 526.18109 : 1" - inkscape:vp_y="0 : 1000 : 0" - inkscape:vp_z="744.09448 : 526.18109 : 1" - inkscape:persp3d-origin="372.04724 : 350.78739 : 1" - id="perspective10" /> - </defs> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - gridtolerance="10000" - guidetolerance="10" - objecttolerance="10" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="19.416667" - inkscape:cx="15.244635" - inkscape:cy="11.639485" - inkscape:document-units="px" - inkscape:current-layer="layer1" - showgrid="false" - inkscape:window-width="1459" - inkscape:window-height="964" - inkscape:window-x="453" - inkscape:window-y="166" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1" - transform="translate(-4.0978193e-8,-19.359387)"> - <text - xml:space="preserve" - style="font-size:13.99289513px;font-style:normal;font-weight:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" - x="-1.1205248" - y="29" - id="text3239"><tspan - sodipodi:role="line" - id="tspan3241" - x="-1.1205248" - y="29">LAN</tspan></text> - </g> +<?xml version="1.0" encoding="iso-8859-1"?> +<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) --> +<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" [ + <!ENTITY ns_svg "http://www.w3.org/2000/svg"> + <!ENTITY ns_xlink "http://www.w3.org/1999/xlink"> +]> +<svg version="1.1" id="图层_1" xmlns="&ns_svg;" xmlns:xlink="&ns_xlink;" width="21.929" height="20.665" + viewBox="0 0 21.929 20.665" style="overflow:visible;enable-background:new 0 0 21.929 20.665;" xml:space="preserve"> +<g> + <linearGradient id="XMLID_3_" gradientUnits="userSpaceOnUse" x1="1.7178" y1="5.3706" x2="20.9333" y2="5.3706"> + <stop offset="0.0393" style="stop-color:#C2DC1A"/> + <stop offset="0.2192" style="stop-color:#BEDA1A"/> + <stop offset="0.3978" style="stop-color:#B2D61B"/> + <stop offset="0.5758" style="stop-color:#9ECE1D"/> + <stop offset="0.7536" style="stop-color:#82C320"/> + <stop offset="0.9298" style="stop-color:#5FB423"/> + <stop offset="0.9326" style="stop-color:#5EB423"/> + </linearGradient> + <polygon style="fill:url(#XMLID_3_);stroke:#000000;stroke-linejoin:round;" points="21.429,7.716 10.965,7.716 10.965,0.5 + 0.5,10.241 21.429,10.241 "/> + <linearGradient id="XMLID_4_" gradientUnits="userSpaceOnUse" x1="1.7178" y1="15.2944" x2="20.9333" y2="15.2944"> + <stop offset="0.0393" style="stop-color:#C2DC1A"/> + <stop offset="0.2192" style="stop-color:#BEDA1A"/> + <stop offset="0.3978" style="stop-color:#B2D61B"/> + <stop offset="0.5758" style="stop-color:#9ECE1D"/> + <stop offset="0.7536" style="stop-color:#82C320"/> + <stop offset="0.9298" style="stop-color:#5FB423"/> + <stop offset="0.9326" style="stop-color:#5EB423"/> + </linearGradient> + <polygon style="fill:url(#XMLID_4_);stroke:#000000;stroke-linejoin:round;" points="0.5,12.949 10.965,12.949 10.965,20.165 + 21.429,10.424 0.5,10.424 "/> +</g> </svg> diff --git a/examples/network/bearercloud/umts.svg b/examples/network/bearercloud/umts.svg new file mode 100644 index 0000000..c1b372e --- /dev/null +++ b/examples/network/bearercloud/umts.svg @@ -0,0 +1,200 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Generator: Adobe Illustrator 12.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 51448) --> +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://web.resource.org/cc/" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + version="1.0" + id="图层_1" + width="13" + height="14" + viewBox="0 0 21.228 20.825" + style="overflow:visible;enable-background:new 0 0 21.228 20.825;" + xml:space="preserve" + sodipodi:version="0.32" + inkscape:version="0.44.1" + sodipodi:docname="umts-enabled.svg" + sodipodi:docbase="/home/user"><metadata + id="metadata76"><rdf:RDF><cc:Work + rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs + id="defs74"> + <linearGradient + y2="18.770201" + x2="19.1735" + y1="2.1933999" + x1="2.5967" + gradientUnits="userSpaceOnUse" + id="XMLID_5_" + gradientTransform="matrix(1.749056,0,0,1.749987,1.149567,1.483541)"> + <stop + id="stop6" + style="stop-color:#F8DB41" + offset="0" /> + <stop + id="stop8" + style="stop-color:#F8D73F" + offset="0.1193" /> + <stop + id="stop10" + style="stop-color:#F9CB3A" + offset="0.2384" /> + <stop + id="stop12" + style="stop-color:#FAB731" + offset="0.3576" /> + <stop + id="stop14" + style="stop-color:#FC9B24" + offset="0.4768" /> + <stop + id="stop16" + style="stop-color:#FE7714" + offset="0.595" /> + <stop + id="stop18" + style="stop-color:#FE7513" + offset="0.6011" /> + </linearGradient> + + <linearGradient + y2="13.7331" + x2="24.2068" + y1="-2.8408" + x1="7.6328001" + gradientUnits="userSpaceOnUse" + id="XMLID_6_"> + <stop + id="stop23" + style="stop-color:#F8DB41" + offset="0" /> + <stop + id="stop25" + style="stop-color:#F8D73F" + offset="0.1193" /> + <stop + id="stop27" + style="stop-color:#F9CB3A" + offset="0.2384" /> + <stop + id="stop29" + style="stop-color:#FAB731" + offset="0.3576" /> + <stop + id="stop31" + style="stop-color:#FC9B24" + offset="0.4768" /> + <stop + id="stop33" + style="stop-color:#FE7714" + offset="0.595" /> + <stop + id="stop35" + style="stop-color:#FE7513" + offset="0.6011" /> + </linearGradient> + + <linearGradient + y2="23.8965" + x2="14.043" + y1="7.3242002" + x1="-2.5293" + gradientUnits="userSpaceOnUse" + id="XMLID_7_"> + <stop + id="stop40" + style="stop-color:#F8DB41" + offset="0" /> + <stop + id="stop42" + style="stop-color:#F8D73F" + offset="0.1193" /> + <stop + id="stop44" + style="stop-color:#F9CB3A" + offset="0.2384" /> + <stop + id="stop46" + style="stop-color:#FAB731" + offset="0.3576" /> + <stop + id="stop48" + style="stop-color:#FC9B24" + offset="0.4768" /> + <stop + id="stop50" + style="stop-color:#FE7714" + offset="0.595" /> + <stop + id="stop52" + style="stop-color:#FE7513" + offset="0.6011" /> + </linearGradient> + + <linearGradient + y2="18.5788" + x2="19.364" + y1="2.0039001" + x1="2.7890999" + gradientUnits="userSpaceOnUse" + id="XMLID_8_"> + <stop + id="stop57" + style="stop-color:#F8DB41" + offset="0" /> + <stop + id="stop59" + style="stop-color:#F8D73F" + offset="0.1193" /> + <stop + id="stop61" + style="stop-color:#F9CB3A" + offset="0.2384" /> + <stop + id="stop63" + style="stop-color:#FAB731" + offset="0.3576" /> + <stop + id="stop65" + style="stop-color:#FC9B24" + offset="0.4768" /> + <stop + id="stop67" + style="stop-color:#FE7714" + offset="0.595" /> + <stop + id="stop69" + style="stop-color:#FE7513" + offset="0.6011" /> + </linearGradient> + +</defs><sodipodi:namedview + inkscape:window-height="960" + inkscape:window-width="1183" + inkscape:pageshadow="2" + inkscape:pageopacity="0.0" + guidetolerance="10.0" + gridtolerance="10.0" + objecttolerance="10.0" + borderopacity="1.0" + bordercolor="#666666" + pagecolor="#ffffff" + id="base" + width="13px" + height="14px" + inkscape:zoom="53.714286" + inkscape:cx="6.5" + inkscape:cy="7" + inkscape:window-x="252" + inkscape:window-y="164" + inkscape:current-layer="图层_1" /> + +<path + style="font-size:26.12677002px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:black;fill-opacity:1;stroke:white;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans" + d="M 10.438113,0.60410378 C 9.5195858,0.60412318 8.5840584,0.67216158 7.6315264,0.80821918 C 6.6789835,0.94431518 5.6924268,1.1484304 4.7228823,1.4205653 L 4.7228823,5.0436132 C 5.5223309,4.6949314 6.3643059,4.4057684 7.1722669,4.2271517 C 7.9802179,4.0485668 8.7796689,3.9720237 9.5706225,3.9720075 C 10.64222,3.9720235 11.433166,4.1846436 12.020007,4.5843536 C 12.606829,4.9840947 12.938516,5.5369062 12.938526,6.2683055 C 12.938515,7.0592656 12.623838,7.663106 12.020007,8.054315 C 11.416156,8.4370429 10.497638,8.615644 9.2644494,8.615632 L 7.1722669,8.615632 L 7.1722669,11.779421 L 9.1623917,11.779421 C 10.548667,11.779429 11.569243,11.992048 12.275151,12.442796 C 12.989544,12.885053 13.346746,13.565437 13.346757,14.43292 C 13.346746,15.2749 13.023563,15.921266 12.32618,16.372017 C 11.637281,16.822775 10.616705,17.035395 9.3154783,17.035392 C 8.4394768,17.035395 7.5719873,16.907823 6.6619784,16.67819 C 5.7604653,16.440059 4.8249372,16.116877 3.9064208,15.657613 L 3.9064208,19.433747 C 4.8674613,19.748424 5.8370084,19.995064 6.815065,20.148151 C 7.8016169,20.309742 8.7966784,20.403295 9.7747379,20.403295 C 12.547295,20.403294 14.656485,19.901511 16.102315,18.923459 C 17.548116,17.936904 18.296539,16.474077 18.296555,14.586007 C 18.296539,13.318797 17.947843,12.289717 17.275978,11.473248 C 16.612589,10.648291 15.286744,9.8267627 14.975337,9.738267 C 15.211467,9.5707147 16.382959,8.96434 16.969805,8.2584304 C 17.556621,7.544039 17.837281,6.617016 17.837296,5.5028728 C 17.837281,3.8699658 17.233439,2.6367701 16.000257,1.8287961 C 14.775552,1.0123535 12.913001,0.60412318 10.438113,0.60410378 z M 10.570571,1.2772502 C 13.045459,1.2772695 14.306521,1.5736708 15.531226,2.3901134 C 16.764408,3.1980876 17.174992,3.8601944 17.175007,5.4931014 C 17.174992,6.6072444 16.924732,7.1976942 16.337916,7.9120856 C 15.75107,8.617996 15.186496,9.1223119 15.071966,9.2290638 L 14.321733,9.8826672 C 15.605945,10.214364 16.173958,10.84372 16.837348,11.668677 C 17.509211,12.485146 17.613621,13.298168 17.613637,14.565378 C 17.613621,16.453449 16.977028,17.365815 15.531226,18.35237 C 14.085396,19.330422 12.587467,19.720376 9.8149096,19.720377 C 8.8368504,19.720377 7.7809882,19.596424 6.7944362,19.434833 C 5.8163797,19.281747 5.4689503,19.167564 4.5079098,18.852887 L 4.4775095,16.626075 C 5.3960259,17.085338 5.6790363,17.174005 6.5805495,17.412136 C 7.4905585,17.641769 8.5827919,17.809513 9.4587934,17.80951 C 10.76002,17.809513 12.167112,17.341749 12.856012,16.89099 C 13.553395,16.440238 14.111093,15.203243 14.111104,14.361263 C 14.111093,13.493779 13.591033,12.385621 12.87664,11.943364 C 12.170732,11.492617 10.853754,11.107368 9.4674791,11.10736 L 7.8041559,11.117131 L 7.8041559,9.277922 L 9.3871358,9.257293 C 10.620324,9.257304 12.006788,8.936474 12.610639,8.553746 C 13.21447,8.1625376 13.682233,7.0288655 13.682244,6.2379054 C 13.682234,5.5065062 13.268032,4.4542632 12.681211,4.0545222 C 12.09437,3.6548121 10.824621,3.2391624 9.7530236,3.2391464 C 8.9620698,3.2391624 7.9791321,3.3048486 7.1711811,3.4834335 C 6.3632201,3.66205 6.1954773,3.6645831 5.3960287,4.0132649 L 5.3862573,1.9308538 C 6.3558019,1.6587188 6.8320701,1.5566613 7.784613,1.4205653 C 8.7371446,1.2845077 9.6520438,1.2772696 10.570571,1.2772502 z " + id="text1901" + sodipodi:nodetypes="csccsssssccccsssssccssssscsssccsssccsssssccsssssccccsssssccsc" /></svg>
\ No newline at end of file diff --git a/examples/network/bearermonitor/sessionwidget.cpp b/examples/network/bearermonitor/sessionwidget.cpp index 8b5693a..ecc2a93 100644 --- a/examples/network/bearermonitor/sessionwidget.cpp +++ b/examples/network/bearermonitor/sessionwidget.cpp @@ -111,11 +111,11 @@ void SessionWidget::updateSession() killTimer(statsTimer); if (session->configuration().type() == QNetworkConfiguration::InternetAccessPoint) - bearer->setText(session->configuration().bearerName()); + bearer->setText(session->configuration().bearerTypeName()); else { QNetworkConfigurationManager mgr; QNetworkConfiguration c = mgr.configurationFromIdentifier(session->sessionProperty("ActiveConfiguration").toString()); - bearer->setText(c.bearerName()); + bearer->setText(c.bearerTypeName()); } #ifndef QT_NO_NETWORKINTERFACE diff --git a/examples/network/fortuneserver/fortuneserver.pro b/examples/network/fortuneserver/fortuneserver.pro index e13f309..0ef3e97 100644 --- a/examples/network/fortuneserver/fortuneserver.pro +++ b/examples/network/fortuneserver/fortuneserver.pro @@ -10,7 +10,7 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/network/fortuneserver INSTALLS += target sources symbian { - TARGET.UID3 = 0xA000CF71 + TARGET.UID3 = 0xA000E406 include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.CAPABILITY = "NetworkServices ReadUserData" TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 diff --git a/examples/tutorials/addressbook-fr/part2/addressbook.cpp b/examples/tutorials/addressbook-fr/part2/addressbook.cpp index 1fa9d52..8d5b0e1 100644 --- a/examples/tutorials/addressbook-fr/part2/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part2/addressbook.cpp @@ -111,7 +111,7 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if ( name.isEmpty()|| address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); return; diff --git a/examples/tutorials/addressbook-fr/part3/addressbook.cpp b/examples/tutorials/addressbook-fr/part3/addressbook.cpp index 840f529..2d182c5 100644 --- a/examples/tutorials/addressbook-fr/part3/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part3/addressbook.cpp @@ -122,9 +122,10 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); + return; } if (!contacts.contains(name)) { diff --git a/examples/tutorials/addressbook-fr/part4/addressbook.cpp b/examples/tutorials/addressbook-fr/part4/addressbook.cpp index f6390a4..d3bf030 100644 --- a/examples/tutorials/addressbook-fr/part4/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part4/addressbook.cpp @@ -131,9 +131,10 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); + return; } //! [submitContact() function part1] if (currentMode == AddingMode) { diff --git a/examples/tutorials/addressbook-fr/part5/addressbook.cpp b/examples/tutorials/addressbook-fr/part5/addressbook.cpp index 80c18c3..d5f5778 100644 --- a/examples/tutorials/addressbook-fr/part5/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part5/addressbook.cpp @@ -138,10 +138,11 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); - } + return; + } if (currentMode == AddingMode) { diff --git a/examples/tutorials/addressbook-fr/part6/addressbook.cpp b/examples/tutorials/addressbook-fr/part6/addressbook.cpp index fc41190..7c57db7 100644 --- a/examples/tutorials/addressbook-fr/part6/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part6/addressbook.cpp @@ -144,9 +144,10 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); + return; } if (currentMode == AddingMode) { diff --git a/examples/tutorials/addressbook-fr/part7/addressbook.cpp b/examples/tutorials/addressbook-fr/part7/addressbook.cpp index 3ab8702..b0f35a7 100644 --- a/examples/tutorials/addressbook-fr/part7/addressbook.cpp +++ b/examples/tutorials/addressbook-fr/part7/addressbook.cpp @@ -146,9 +146,10 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); + return; } if (currentMode == AddingMode) { diff --git a/examples/tutorials/addressbook/part2/addressbook.cpp b/examples/tutorials/addressbook/part2/addressbook.cpp index 1fa9d52..f2f0d65 100644 --- a/examples/tutorials/addressbook/part2/addressbook.cpp +++ b/examples/tutorials/addressbook/part2/addressbook.cpp @@ -111,7 +111,7 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); return; diff --git a/examples/tutorials/addressbook/part3/addressbook.cpp b/examples/tutorials/addressbook/part3/addressbook.cpp index 28a570a..4e58fa1 100644 --- a/examples/tutorials/addressbook/part3/addressbook.cpp +++ b/examples/tutorials/addressbook/part3/addressbook.cpp @@ -122,7 +122,7 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); return; diff --git a/examples/tutorials/addressbook/part4/addressbook.cpp b/examples/tutorials/addressbook/part4/addressbook.cpp index 55d551f..896a427 100644 --- a/examples/tutorials/addressbook/part4/addressbook.cpp +++ b/examples/tutorials/addressbook/part4/addressbook.cpp @@ -131,7 +131,7 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); return; diff --git a/examples/tutorials/addressbook/part5/addressbook.cpp b/examples/tutorials/addressbook/part5/addressbook.cpp index 1b3f451..874b151 100644 --- a/examples/tutorials/addressbook/part5/addressbook.cpp +++ b/examples/tutorials/addressbook/part5/addressbook.cpp @@ -138,7 +138,7 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); return; diff --git a/examples/tutorials/addressbook/part6/addressbook.cpp b/examples/tutorials/addressbook/part6/addressbook.cpp index 724971c..a6bb4a5 100644 --- a/examples/tutorials/addressbook/part6/addressbook.cpp +++ b/examples/tutorials/addressbook/part6/addressbook.cpp @@ -144,7 +144,7 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); return; diff --git a/examples/tutorials/addressbook/part7/addressbook.cpp b/examples/tutorials/addressbook/part7/addressbook.cpp index bf00298..fb70ba4 100644 --- a/examples/tutorials/addressbook/part7/addressbook.cpp +++ b/examples/tutorials/addressbook/part7/addressbook.cpp @@ -146,7 +146,7 @@ void AddressBook::submitContact() QString name = nameLine->text(); QString address = addressText->toPlainText(); - if (name == "" || address == "") { + if (name.isEmpty() || address.isEmpty()) { QMessageBox::information(this, tr("Empty Field"), tr("Please enter a name and address.")); return; diff --git a/mkspecs/common/symbian/header-wrappers/AknBitmapAnimation.h b/mkspecs/common/symbian/header-wrappers/AknBitmapAnimation.h new file mode 100644 index 0000000..d53605e --- /dev/null +++ b/mkspecs/common/symbian/header-wrappers/AknBitmapAnimation.h @@ -0,0 +1 @@ +#include <aknbitmapanimation.h> diff --git a/mkspecs/common/symbian/header-wrappers/AknFontAccess.h b/mkspecs/common/symbian/header-wrappers/AknFontAccess.h new file mode 100644 index 0000000..e33baaf --- /dev/null +++ b/mkspecs/common/symbian/header-wrappers/AknFontAccess.h @@ -0,0 +1 @@ +#include <aknfontaccess.h> diff --git a/mkspecs/common/symbian/header-wrappers/AknInputLanguageInfo.h b/mkspecs/common/symbian/header-wrappers/AknInputLanguageInfo.h new file mode 100644 index 0000000..5f993d7 --- /dev/null +++ b/mkspecs/common/symbian/header-wrappers/AknInputLanguageInfo.h @@ -0,0 +1 @@ +#include <akninputlanguageinfo.h> diff --git a/mkspecs/common/symbian/header-wrappers/ApAccessPointItem.h b/mkspecs/common/symbian/header-wrappers/ApAccessPointItem.h new file mode 100644 index 0000000..75b6c69 --- /dev/null +++ b/mkspecs/common/symbian/header-wrappers/ApAccessPointItem.h @@ -0,0 +1 @@ +#include <apaccesspointitem.h> diff --git a/mkspecs/common/symbian/header-wrappers/ApDataHandler.h b/mkspecs/common/symbian/header-wrappers/ApDataHandler.h new file mode 100644 index 0000000..b7b972d --- /dev/null +++ b/mkspecs/common/symbian/header-wrappers/ApDataHandler.h @@ -0,0 +1 @@ +#include <apdatahandler.h> diff --git a/mkspecs/common/symbian/header-wrappers/ApUtils.h b/mkspecs/common/symbian/header-wrappers/ApUtils.h new file mode 100644 index 0000000..09cedce --- /dev/null +++ b/mkspecs/common/symbian/header-wrappers/ApUtils.h @@ -0,0 +1 @@ +#include <aputils.h> diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index b1ca367..364e91b 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -29,7 +29,12 @@ QMAKE_PREFIX_STATICLIB = QMAKE_EXTENSION_STATICLIB = lib QMAKE_SYMBIAN_SHLIB = 1 -DEFINES *= __PRODUCT_INCLUDE__=\\<$${EPOCROOT}epoc32/include/variant/symbian_os.hrh\\> \ +is_using_gnupoc { + DEFINES *= __PRODUCT_INCLUDE__=\\<$${EPOCROOT}epoc32/include/variant/symbian_os.hrh\\> +} else { + DEFINES *= __PRODUCT_INCLUDE__=\\<$${EPOCROOT}epoc32/include/variant/Symbian_OS.hrh\\> +} +DEFINES *= \ __SYMBIAN32__ \ __MARM_INTERWORK__ \ _UNICODE \ diff --git a/mkspecs/common/symbian/symbian-mmp.conf b/mkspecs/common/symbian/symbian-mmp.conf index 5a7b2d2..4230ad7 100644 --- a/mkspecs/common/symbian/symbian-mmp.conf +++ b/mkspecs/common/symbian/symbian-mmp.conf @@ -38,24 +38,7 @@ INCLUDEPATH = \ # RVCT seems to do this automatically, but WINSCW compiler does not, so add it here. MMP_RULES += "USERINCLUDE ." -exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis) { - S60_VERSION = 5.2 symbian3 -} else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { - S60_VERSION = 5.1 symbian2 - } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { - S60_VERSION = 5.0 - } else { - exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { - S60_VERSION = 3.2 - } else { - S60_VERSION = 3.1 - MMP_RULES -= PAGED BYTEPAIRCOMPRESSTARGET - } - } - } -} +contains(S60_VERSION, 3.1):MMP_RULES -= PAGED BYTEPAIRCOMPRESSTARGET QMAKE_CXXFLAGS_FAST_VFP.ARMCC = --fpmode fast # [TODO] QMAKE_CXXFLAGS_FAST_VFP.GCCE = diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index 7ec5c6c..6d96b01 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -119,6 +119,38 @@ QT_IMPORTS_BASE_DIR = /resource/qt/imports load(qt_config) load(symbian/platform_paths) +# The Symbian^3 PDK does not necessarily contain the required sis files. +# However, libstdcppv5 first appeared in Symbian^3 (S60 5.2), so check for that too. +exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.2.sis)|exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso) { + S60_VERSION = 5.2 +} else { + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.1.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.1.sis) { + S60_VERSION = 5.1 + } else { + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v5.0.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v5.0.sis) { + S60_VERSION = 5.0 + } else { + exists($${EPOCROOT}epoc32/release/winscw/udeb/z/system/install/series60v3.2.sis)|exists($${EPOCROOT}epoc32/data/z/system/install/series60v3.2.sis) { + S60_VERSION = 3.2 + } else { + S60_VERSION = 3.1 + } + } + } +} + +contains(S60_VERSION, "3\\.1") { + SYMBIAN_VERSION = 9.2 +} else:contains(S60_VERSION, "3\\.2") { + SYMBIAN_VERSION = 9.3 +} else:contains(S60_VERSION, "5\\.0") { + SYMBIAN_VERSION = 9.4 +} else:contains(S60_VERSION, "5\\.1") { + SYMBIAN_VERSION = Symbian2 +} else:contains(S60_VERSION, "5\\.2") { + SYMBIAN_VERSION = Symbian3 +} + # pkg_depends_webkit, pkg_depends_core, and pkg_platform_dependencies can be removed by developer # if multiple languages need to be supported by pkg file. In that case the developer should declare # multiple language compatible dependency statements him/herself. diff --git a/mkspecs/features/qt.prf b/mkspecs/features/qt.prf index e8946de..aa0f06e 100644 --- a/mkspecs/features/qt.prf +++ b/mkspecs/features/qt.prf @@ -209,3 +209,16 @@ wince*:static:gui { mac { !isEmpty(QT_NAMESPACE_MAC_CRC):DEFINES *= QT_NAMESPACE_MAC_CRC=$$QT_NAMESPACE_MAC_CRC } + +#SIMD defines: +neon: DEFINES += QT_HAVE_NEON +mmx:DEFINES += QT_HAVE_MMX +3dnow:DEFINES += QT_HAVE_3DNOW +sse:DEFINES += QT_HAVE_SSE QT_HAVE_MMXEXT +sse2:DEFINES += QT_HAVE_SSE2 +sse3:DEFINES += QT_HAVE_SSE3 +ssse3:DEFINES += QT_HAVE_SSSE3 +sse4_1:DEFINES += QT_HAVE_SSE4_1 +sse4_2:DEFINES += QT_HAVE_SSE4_2 +avx:DEFINES += QT_HAVE_AVX +iwmmxt:DEFINES += QT_HAVE_IWMMXT diff --git a/mkspecs/features/symbian/platform_paths.prf b/mkspecs/features/symbian/platform_paths.prf index 5c190c8..f19898f 100644 --- a/mkspecs/features/symbian/platform_paths.prf +++ b/mkspecs/features/symbian/platform_paths.prf @@ -65,8 +65,11 @@ symbian-abld|symbian-sbsv2 { epocroot_prefix = $${EPOCROOT} } -exists($${EPOCROOT}epoc32/include/platform_paths.prf) { - +symbian-abld|symbian-sbsv2:exists($${EPOCROOT}epoc32/include/platform_paths.prf) { + + # Symbian does not provide correct profiles for non-mmp based systems, so + # we only should get in here with abld and sbsv2. + # Load platform specific paths load($${EPOCROOT}epoc32/include/platform_paths.prf) diff --git a/mkspecs/features/symbian/stl.prf b/mkspecs/features/symbian/stl.prf index 3091fce..2a3bce4 100644 --- a/mkspecs/features/symbian/stl.prf +++ b/mkspecs/features/symbian/stl.prf @@ -15,18 +15,24 @@ INCLUDEPATH += $$OS_LAYER_STDCPP_SYSTEMINCLUDE INCLUDEPATH -= $$[QT_INSTALL_PREFIX]/mkspecs/common/symbian/stl-off # libstdcppv5 is preferred over libstdcpp as it has/uses the throwing version of operator new -STL_LIB = -llibstdcppv5.dll - # STDCPP turns on standard C++ new behaviour (ie. throwing new) -STL_MMP_RULE = "STDCPP" +use_libstdcppv5 = true # Fall back to old implementation if that is the only one that is found exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcpp.dso)|exists($${EPOCROOT}epoc32/release/winscw/udeb/libstdcpp.dll) { !exists($${EPOCROOT}epoc32/release/armv5/lib/libstdcppv5.dso):!exists($${EPOCROOT}epoc32/release/winscw/udeb/libstdcppv5.dll) { - STL_LIB = -llibstdcpp.dll - STL_MMP_RULE = + use_libstdcppv5 = false } } -LIBS *= $$STL_LIB -MMP_RULES *= $$STL_MMP_RULE +equals(use_libstdcppv5, true) { + LIBS *= -llibstdcppv5.dll + symbian-abld|symbian-sbsv2 { + MMP_RULES *= "STDCPP" + } else { + DEFINES *= __SYMBIAN_STDCPP_SUPPORT__ + LIBS *= -lstdnew.dll + } +} else { + LIBS *= -llibstdcpp.dll +} diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index c119c90..374fe21 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -186,7 +186,7 @@ contains(TEMPLATE, app):!contains(QMAKE_LINK, "^@:.*") { $$elf2e32_LIBPATH \ $$capability \ $$QMAKE_ELF2E32_FLAGS \ - && ln "$${symbianDestdir}/$${baseTarget}.exe" "$${symbianDestdir}/$${baseTarget}" \ + && $$QMAKE_COPY "$${symbianDestdir}/$${baseTarget}.exe" "$${symbianDestdir}/$${baseTarget}" \ $$QMAKE_POST_LINK silent:QMAKE_POST_LINK = @echo postlinking $@ && $$QMAKE_POST_LINK QMAKE_DISTCLEAN += $${symbianDestdir}/$${baseTarget}.sym diff --git a/mkspecs/symbian/linux-armcc/qmake.conf b/mkspecs/symbian/linux-armcc/qmake.conf index f8072e3..f058421 100644 --- a/mkspecs/symbian/linux-armcc/qmake.conf +++ b/mkspecs/symbian/linux-armcc/qmake.conf @@ -31,7 +31,7 @@ QMAKE_QtWebKit_CXXFLAGS = --arm # Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. QMAKE_QtWebKit_LFLAGS = --rw-base 0xE00000 -QMAKE_CFLAGS += --dllimport_runtime --preinclude rvct2_2.h --diag_suppress 186,611,654,1300 --thumb --fpu softvfp --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --no_vfe --apcs /inter +QMAKE_CFLAGS += --dllimport_runtime --diag_suppress 186,611,654,1300 --thumb --fpu softvfp --cpu 5T --enum_is_int -Ono_known_library --fpmode ieee_no_fenv --no_vfe --apcs /inter QMAKE_CXXFLAGS += $$QMAKE_CFLAGS QMAKE_LFLAGS += --symver_soname --diag_suppress 6331,6780 --bpabi --reloc --datacompressor=off --split --dll --no_scanlib QMAKE_LFLAGS_APP += --entry _E32Startup @@ -47,7 +47,16 @@ QMAKE_LIBDIR += $${EPOCROOT}epoc32/release/armv5/lib QMAKE_LIBDIR *= $$(RVCT22LIB) INCLUDEPATH = $${EPOCROOT}epoc32/include \ - $${EPOCROOT}epoc32/include/rvct2_2 \ $${EPOCROOT}epoc32/include/variant \ $${EPOCROOT}epoc32/include/stdapis \ $$INCLUDEPATH + +exists($${EPOCROOT}epoc32/include/rvct2_2) { + INCLUDEPATH += $${EPOCROOT}epoc32/include/rvct2_2 + QMAKE_CFLAGS += --preinclude rvct2_2.h + QMAKE_CXXFLAGS += --preinclude rvct2_2.h +} else { + INCLUDEPATH += $${EPOCROOT}epoc32/include/rvct + QMAKE_CFLAGS += --preinclude rvct.h + QMAKE_CXXFLAGS += --preinclude rvct.h +} diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 3a4bdbc..d124b02 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -252,8 +252,30 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB tw << languageRules.join("\n") << endl; ts << languageRules.join("\n") << endl; - // name of application, UID and version - QString applicationVersion = project->first("VERSION").isEmpty() ? "1,0,0" : project->first("VERSION").replace('.', ','); + // Determine application version. If version has missing component values, + // those will default to zero. + // If VERSION is missing altogether or is invalid, use "1,0,0" + QStringList verNumList = project->first("VERSION").split('.'); + uint major = 0; + uint minor = 0; + uint patch = 0; + bool success = false; + + if (verNumList.size() > 0) { + major = verNumList[0].toUInt(&success); + if (success && verNumList.size() > 1) { + minor = verNumList[1].toUInt(&success); + if (success && verNumList.size() > 2) { + patch = verNumList[2].toUInt(&success); + } + } + } + + QString applicationVersion("1,0,0"); + if (success) + applicationVersion = QString("%1,%2,%3").arg(major).arg(minor).arg(patch); + + // Package header QString sisHeader = "; SIS header: name, uid, version\n#{\"%1\"},(%2),%3\n\n"; QString visualTarget = generator->escapeFilePath(project->first("TARGET")); diff --git a/src/3rdparty/libconninet/src/dbusdispatcher.cpp b/src/3rdparty/libconninet/src/dbusdispatcher.cpp index 7581982..f5b830a 100644 --- a/src/3rdparty/libconninet/src/dbusdispatcher.cpp +++ b/src/3rdparty/libconninet/src/dbusdispatcher.cpp @@ -31,7 +31,7 @@ namespace Maemo { /*! - \class DBusDispatcher + \class Maemo::DBusDispatcher \brief DBusDispatcher is a class, which is able to send DBUS method call messages and receive unicast signals from DBUS object. diff --git a/src/3rdparty/phonon/CMakeLists.txt b/src/3rdparty/phonon/CMakeLists.txt index ef7d6f5..e2054d3 100644 --- a/src/3rdparty/phonon/CMakeLists.txt +++ b/src/3rdparty/phonon/CMakeLists.txt @@ -152,8 +152,8 @@ set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON) set(CMAKE_COLOR_MAKEFILE ON) set(PHONON_LIB_MAJOR_VERSION "4") -set(PHONON_LIB_MINOR_VERSION "3") -set(PHONON_LIB_PATCH_VERSION "80") +set(PHONON_LIB_MINOR_VERSION "4") +set(PHONON_LIB_PATCH_VERSION "0") set(PHONON_LIB_VERSION "${PHONON_LIB_MAJOR_VERSION}.4.0") set(PHONON_LIB_SOVERSION ${PHONON_LIB_MAJOR_VERSION}) diff --git a/src/3rdparty/phonon/phonon/phononnamespace.h b/src/3rdparty/phonon/phonon/phononnamespace.h index ec42d51..eb899de 100644 --- a/src/3rdparty/phonon/phonon/phononnamespace.h +++ b/src/3rdparty/phonon/phonon/phononnamespace.h @@ -41,12 +41,12 @@ /** * PHONON_VERSION is (major << 16) + (minor << 8) + patch. */ -#define PHONON_VERSION PHONON_VERSION_CHECK(4, 3, 1) +#define PHONON_VERSION PHONON_VERSION_CHECK(4, 4, 0) /** * PHONON_VERSION_STR is "major.minor.patch". E.g. "4.2.1" */ -#define PHONON_VERSION_STR "4.3.1" +#define PHONON_VERSION_STR "4.4.0" QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 0b414ab..718ea9d 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -e6e692bb056670e2781dd0bc473a60757ae53992 +d6aa024c84f61d0602bef4eef84efaed7cfeefcc diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index f8403fb..1826cb6 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - e6e692bb056670e2781dd0bc473a60757ae53992 + d6aa024c84f61d0602bef4eef84efaed7cfeefcc diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 5189eb5..5b78226 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,40 @@ +2010-06-14 Andreas Kling <andreas.kling@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Stack overflow when converting navigator object to QVariant + https://bugs.webkit.org/show_bug.cgi?id=40572 + + Protect against infinite recursion in JSValue->QVariant conversion. + This fixes a crash when trying to convert MimeType objects (they + recurse infinitely and on-the-fly via the enabledPlugin property.) + + * bridge/qt/qt_runtime.cpp: + (JSC::Bindings::convertValueToQVariant): + +2010-03-30 Kent Tamura <tkent@chromium.org> + + Reviewed by Brady Eidson. + + REGRESSION (r56439) - Crash when a renderer for a file upload control + with a selected file is recreated + https://bugs.webkit.org/show_bug.cgi?id=36723 + + RenderFileUploadControl::chooseIconForFiles was called before + m_fileChooser was initialized. + + * platform/FileChooser.cpp: + (WebCore::FileChooser::FileChooser): Introduce m_isInitializing flag to + avoid FileChooserClient::repaint() call. + (WebCore::FileChooser::loadIcon): + (WebCore::FileChooser::iconLoaded): + * platform/FileChooser.h: Add a FielChooser parameter to + FileChooserClient::chooseIconForFiles(). + * rendering/RenderFileUploadControl.cpp: + (WebCore::RenderFileUploadControl::chooseIconForFiles): + (WebCore::RenderFileUploadControl::paintObject): Add an assertion. + * rendering/RenderFileUploadControl.h: + 2010-07-06 Nikolas Zimmermann <nzimmermann@rim.com> Reviewed by Dirk Schulze. diff --git a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp index a39dc7a..2212f58 100644 --- a/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp +++ b/src/3rdparty/webkit/WebCore/bridge/qt/qt_runtime.cpp @@ -162,9 +162,11 @@ static JSRealType valueRealType(ExecState* exec, JSValue val) return String; // I don't know. } -QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance, HashSet<JSObject*>* visitedObjects) +QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance, HashSet<JSObject*>* visitedObjects, int recursionLimit) { - if (!value) + --recursionLimit; + + if (!value || !recursionLimit) return QVariant(); JSObject* object = 0; @@ -344,7 +346,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type while(it != properties.end()) { if (object->propertyIsEnumerable(exec, *it)) { JSValue val = object->get(exec, *it); - QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects); + QVariant v = convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit); if (objdist >= 0) { UString ustring = (*it).ustring(); QString id = QString((const QChar*)ustring.rep()->characters(), ustring.size()); @@ -368,7 +370,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type qConvDebug() << "converting a " << len << " length Array"; for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); - result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects)); + result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit)); if (objdist == -1) { qConvDebug() << "Failed converting element at index " << i; break; // Failed converting a list entry, so fail the array @@ -387,7 +389,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type qConvDebug() << "converting a " << len << " length Array"; for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); - result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects)); + result.append(convertValueToQVariant(exec, val, QMetaType::Void, &objdist, visitedObjects, recursionLimit)); if (objdist == -1) { qConvDebug() << "Failed converting element at index " << i; break; // Failed converting a list entry, so fail the array @@ -401,7 +403,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type // Make a single length array int objdist; qConvDebug() << "making a single length variantlist"; - QVariant var = convertValueToQVariant(exec, value, QMetaType::Void, &objdist, visitedObjects); + QVariant var = convertValueToQVariant(exec, value, QMetaType::Void, &objdist, visitedObjects, recursionLimit); if (objdist != -1) { QVariantList result; result << var; @@ -645,7 +647,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<QObject*>()); else @@ -664,7 +666,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::QObjectStar, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<QObject*>()); else @@ -679,7 +681,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type // Make a single length array QObjectList result; int itemdist = -1; - QVariant item = convertValueToQVariant(exec, value, QMetaType::QObjectStar, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, value, QMetaType::QObjectStar, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) { result.append(item.value<QObject*>()); dist = 10; @@ -696,7 +698,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = rtarray->getConcreteArray()->valueAt(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<int>()); else @@ -715,7 +717,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type for (int i = 0; i < len; ++i) { JSValue val = array->get(exec, i); int itemdist = -1; - QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, val, QMetaType::Int, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) result.append(item.value<int>()); else @@ -730,7 +732,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type // Make a single length array QList<int> result; int itemdist = -1; - QVariant item = convertValueToQVariant(exec, value, QMetaType::Int, &itemdist, visitedObjects); + QVariant item = convertValueToQVariant(exec, value, QMetaType::Int, &itemdist, visitedObjects, recursionLimit); if (itemdist >= 0) { result.append(item.value<int>()); dist = 10; @@ -757,7 +759,7 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type } // And then recurse with the autodetect flag - ret = convertValueToQVariant(exec, value, QMetaType::Void, distance, visitedObjects); + ret = convertValueToQVariant(exec, value, QMetaType::Void, distance, visitedObjects, recursionLimit); dist = 10; } break; @@ -777,8 +779,9 @@ QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type QVariant convertValueToQVariant(ExecState* exec, JSValue value, QMetaType::Type hint, int *distance) { + const int recursionLimit = 200; HashSet<JSObject*> visitedObjects; - return convertValueToQVariant(exec, value, hint, distance, &visitedObjects); + return convertValueToQVariant(exec, value, hint, distance, &visitedObjects, recursionLimit); } JSValue convertQVariantToValue(ExecState* exec, PassRefPtr<RootObject> root, const QVariant& variant) diff --git a/src/3rdparty/webkit/WebCore/platform/FileChooser.cpp b/src/3rdparty/webkit/WebCore/platform/FileChooser.cpp index dd4fc0d..90dd567 100644 --- a/src/3rdparty/webkit/WebCore/platform/FileChooser.cpp +++ b/src/3rdparty/webkit/WebCore/platform/FileChooser.cpp @@ -39,9 +39,11 @@ FileChooserClient::~FileChooserClient() inline FileChooser::FileChooser(FileChooserClient* client, const Vector<String>& initialFilenames) : m_client(client) + , m_isInitializing(true) { m_filenames = initialFilenames; loadIcon(); + m_isInitializing = false; } PassRefPtr<FileChooser> FileChooser::create(FileChooserClient* client, const Vector<String>& initialFilenames) @@ -79,13 +81,13 @@ void FileChooser::chooseFiles(const Vector<String>& filenames) void FileChooser::loadIcon() { if (m_filenames.size() && m_client) - m_client->chooseIconForFiles(m_filenames); + m_client->chooseIconForFiles(this, m_filenames); } void FileChooser::iconLoaded(PassRefPtr<Icon> icon) { m_icon = icon; - if (m_icon && m_client) + if (!m_isInitializing && m_icon && m_client) m_client->repaint(); } diff --git a/src/3rdparty/webkit/WebCore/platform/FileChooser.h b/src/3rdparty/webkit/WebCore/platform/FileChooser.h index 4028d41..e93b9ac 100644 --- a/src/3rdparty/webkit/WebCore/platform/FileChooser.h +++ b/src/3rdparty/webkit/WebCore/platform/FileChooser.h @@ -35,6 +35,7 @@ namespace WebCore { +class FileChooser; class Font; class Icon; @@ -44,7 +45,7 @@ public: virtual void repaint() = 0; virtual bool allowsMultipleFiles() = 0; virtual String acceptTypes() = 0; - virtual void chooseIconForFiles(const Vector<String>&) = 0; + virtual void chooseIconForFiles(FileChooser*, const Vector<String>&) = 0; virtual ~FileChooserClient(); }; @@ -79,6 +80,7 @@ private: FileChooserClient* m_client; Vector<String> m_filenames; RefPtr<Icon> m_icon; + bool m_isInitializing; }; } // namespace WebCore diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.cpp b/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.cpp index 14d126d..6a5c1e0 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.cpp +++ b/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.cpp @@ -114,10 +114,10 @@ String RenderFileUploadControl::acceptTypes() return static_cast<HTMLInputElement*>(node())->accept(); } -void RenderFileUploadControl::chooseIconForFiles(const Vector<String>& filenames) +void RenderFileUploadControl::chooseIconForFiles(FileChooser* chooser, const Vector<String>& filenames) { if (Chrome* chromePointer = chrome()) - chromePointer->chooseIconForFiles(filenames, m_fileChooser); + chromePointer->chooseIconForFiles(filenames, chooser); } void RenderFileUploadControl::click() @@ -195,6 +195,7 @@ void RenderFileUploadControl::paintObject(PaintInfo& paintInfo, int tx, int ty) { if (style()->visibility() != VISIBLE) return; + ASSERT(m_fileChooser); // Push a clip. if (paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseChildBlockBackgrounds) { diff --git a/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.h b/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.h index a5f3367..25d2639 100644 --- a/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.h +++ b/src/3rdparty/webkit/WebCore/rendering/RenderFileUploadControl.h @@ -63,7 +63,7 @@ private: void repaint() { RenderBlock::repaint(); } bool allowsMultipleFiles(); String acceptTypes(); - void chooseIconForFiles(const Vector<String>&); + void chooseIconForFiles(FileChooser*, const Vector<String>&); Chrome* chrome() const; int maxFilenameWidth() const; diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index b2bff0c..94aca65 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,19 @@ +2010-07-27 Simon Hausmann <simon.hausmann@nokia.com> + + Reviewed by Tor Arne Vestbø. + + [Qt] Incorrect input method hints + https://bugs.webkit.org/show_bug.cgi?id=43037 + + Properly set or reset all input method hints when + activating input fields. + + * WebCoreSupport/EditorClientQt.cpp: + (WebCore::EditorClientQt::setInputMethodState): + * tests/qwebview/tst_qwebview.cpp: + (tst_QWebView::focusInputTypes): Extended unit test to verify that we + reset hints. + 2009-10-30 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> Reviewed by Kenneth Rohde Christiansen. diff --git a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp index 1cebef7..cdc4013 100644 --- a/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp +++ b/src/3rdparty/webkit/WebKit/qt/WebCoreSupport/EditorClientQt.cpp @@ -606,20 +606,18 @@ void EditorClientQt::setInputMethodState(bool active) inputElement = static_cast<HTMLInputElement*>(frame->document()->focusedNode()); if (inputElement) { - if (!active) { - // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag - // for password fields. The Qt platform is responsible for determining which widget - // will receive input method events for password fields. - active = inputElement->isPasswordField(); - webPageClient->setInputMethodHint(Qt::ImhHiddenText, active); - } else { - // Set input method hints for "number", "tel", "email", and "url" input elements. - webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); - webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); - webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); - webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); - webPageClient->setInputMethodHint(Qt::ImhHiddenText, inputElement->isPasswordField()); - } + // Set input method hints for "number", "tel", "email", "url" and "password" input elements. + webPageClient->setInputMethodHint(Qt::ImhDialableCharactersOnly, inputElement->isTelephoneField()); + webPageClient->setInputMethodHint(Qt::ImhDigitsOnly, inputElement->isNumberField()); + webPageClient->setInputMethodHint(Qt::ImhEmailCharactersOnly, inputElement->isEmailField()); + webPageClient->setInputMethodHint(Qt::ImhUrlCharactersOnly, inputElement->isUrlField()); + // Setting the Qt::WA_InputMethodEnabled attribute true and Qt::ImhHiddenText flag + // for password fields. The Qt platform is responsible for determining which widget + // will receive input method events for password fields. + bool isPasswordField = inputElement->isPasswordField(); + webPageClient->setInputMethodHint(Qt::ImhHiddenText, isPasswordField); + if (isPasswordField) + active = true; } #if defined(Q_WS_MAEMO_5) || defined(Q_OS_SYMBIAN) diff --git a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp index 835ad82..5dc5e41 100644 --- a/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/tests/qwebview/tst_qwebview.cpp @@ -267,23 +267,36 @@ void tst_QWebView::focusInputTypes() // 'password' field webView->fireMouseClick(QPoint(20, 60)); - QVERIFY(webView->inputMethodHints() & Qt::ImhHiddenText); + QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); // 'tel' field webView->fireMouseClick(QPoint(20, 110)); - QVERIFY(webView->inputMethodHints() & Qt::ImhDialableCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhDialableCharactersOnly); // 'number' field webView->fireMouseClick(QPoint(20, 160)); - QVERIFY(webView->inputMethodHints() & Qt::ImhDigitsOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhDigitsOnly); // 'email' field webView->fireMouseClick(QPoint(20, 210)); - QVERIFY(webView->inputMethodHints() & Qt::ImhEmailCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhEmailCharactersOnly); // 'url' field webView->fireMouseClick(QPoint(20, 260)); - QVERIFY(webView->inputMethodHints() & Qt::ImhUrlCharactersOnly); + QVERIFY(webView->inputMethodHints() == Qt::ImhUrlCharactersOnly); + + // 'password' field + webView->fireMouseClick(QPoint(20, 60)); + QVERIFY(webView->inputMethodHints() == Qt::ImhHiddenText); + + // 'text' type + webView->fireMouseClick(QPoint(20, 10)); +#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || defined(Q_OS_SYMBIAN) + QVERIFY(webView->inputMethodHints() & Qt::ImhNoAutoUppercase); + QVERIFY(webView->inputMethodHints() & Qt::ImhNoPredictiveText); +#else + QVERIFY(webView->inputMethodHints() == Qt::ImhNone); +#endif delete webView; diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index bbf445f..bc8ef9f 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -53,39 +53,6 @@ symbian: { DEPLOYMENT = partial_upgrade $$DEPLOYMENT } -mmx { - DEFINES += QT_HAVE_MMX -} -3dnow { - DEFINES += QT_HAVE_3DNOW -} -sse { - DEFINES += QT_HAVE_SSE - DEFINES += QT_HAVE_MMXEXT -} -sse2 { - DEFINES += QT_HAVE_SSE2 -} -sse3 { - DEFINES += QT_HAVE_SSE3 -} -ssse3 { - DEFINES += QT_HAVE_SSSE3 -} -sse4_1 { - DEFINES += QT_HAVE_SSE4_1 -} -sse4_2 { - DEFINES += QT_HAVE_SSE4_2 -} -avx { - DEFINES += QT_HAVE_AVX -} -iwmmxt { - DEFINES += QT_HAVE_IWMMXT -} -neon { - DEFINES += QT_HAVE_NEON - QMAKE_CXXFLAGS *= -mfpu=neon -} +neon: QMAKE_CXXFLAGS *= -mfpu=neon + diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp index 861d77d..0e3a8d3 100644 --- a/src/corelib/global/qglobal.cpp +++ b/src/corelib/global/qglobal.cpp @@ -1877,9 +1877,9 @@ QSysInfo::SymbianVersion QSysInfo::symbianVersion() case SV_S60_5_0: return SV_9_4; case SV_S60_5_1: - return SV_9_4; + return SV_SF_2; case SV_S60_5_2: - return SV_9_4; + return SV_SF_3; default: return SV_Unknown; } diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 7b915cd..8f27b03 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -981,9 +981,11 @@ redefine to built-in booleans to make autotests work properly */ # undef QT_DEPRECATED_VARIABLE # undef QT_DEPRECATED_CONSTRUCTOR #elif defined(QT_DEPRECATED_WARNINGS) +# ifdef QT3_SUPPORT /* enable Qt3 support warnings as well */ -# undef QT3_SUPPORT_WARNINGS -# define QT3_SUPPORT_WARNINGS +# undef QT3_SUPPORT_WARNINGS +# define QT3_SUPPORT_WARNINGS +# endif # undef QT_DEPRECATED # define QT_DEPRECATED Q_DECL_DEPRECATED # undef QT_DEPRECATED_VARIABLE diff --git a/src/corelib/io/qfilesystemwatcher_kqueue.cpp b/src/corelib/io/qfilesystemwatcher_kqueue.cpp index 99c165e..378ad20 100644 --- a/src/corelib/io/qfilesystemwatcher_kqueue.cpp +++ b/src/corelib/io/qfilesystemwatcher_kqueue.cpp @@ -295,12 +295,12 @@ void QKqueueFileSystemWatcherEngine::run() path = idToPath.value(id); if (path.isEmpty()) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent for a file we're not watching"; - continue; + goto process_next_event; } } if (kev.filter != EVFILT_VNODE) { DEBUG() << "QKqueueFileSystemWatcherEngine: received a kevent with the wrong filter"; - continue; + goto process_next_event; } if ((kev.fflags & (NOTE_DELETE | NOTE_REVOKE | NOTE_RENAME)) != 0) { @@ -337,6 +337,7 @@ void QKqueueFileSystemWatcherEngine::run() } // are there any more? +process_next_event: r = kevent(kqfd, 0, 0, &kev, 1, &ZeroTimeout); } while (r > 0); } diff --git a/src/corelib/tools/qeasingcurve.cpp b/src/corelib/tools/qeasingcurve.cpp index 1734b03..ee791e0 100644 --- a/src/corelib/tools/qeasingcurve.cpp +++ b/src/corelib/tools/qeasingcurve.cpp @@ -91,6 +91,16 @@ animation.setDuration(1000); animation.setEasingCurve(QEasingCurve::InOutQuad); \endcode + + The ability to set an amplitude, overshoot, or period depends on the QEasingCurve type. Amplitude access + is available to curves that behave as springs such as elastic and bounce curves. Changing the amplitude changes + the height of the curve. Period access is only available to elastic curves and setting a higher period slows + the rate of bounce. Only curves that have "boomerang" behaviors such as the InBack, OutBack, InOutBack, and OutInBack + have overshoot settings. These curves will interpolate beyond the end points and return to the end point, + acting similar to a boomerang. + + The \l{Easing Curves Example} contains samples of QEasingCurve types and lets you change the curve settings. + */ /*! @@ -140,15 +150,15 @@ accelerating from zero velocity. \value OutQuart \inlineimage qeasingcurve-outquart.png \br - Easing curve for a cubic (t^4) function: + Easing curve for a quartic (t^4) function: decelerating to zero velocity. \value InOutQuart \inlineimage qeasingcurve-inoutquart.png \br - Easing curve for a cubic (t^4) function: + Easing curve for a quartic (t^4) function: acceleration until halfway, then deceleration. \value OutInQuart \inlineimage qeasingcurve-outinquart.png \br - Easing curve for a cubic (t^4) function: + Easing curve for a quartic (t^4) function: deceleration until halfway, then acceleration. \value InQuint \inlineimage qeasingcurve-inquint.png \br @@ -156,15 +166,15 @@ in: accelerating from zero velocity. \value OutQuint \inlineimage qeasingcurve-outquint.png \br - Easing curve for a cubic (t^5) function: + Easing curve for a quintic (t^5) function: decelerating to zero velocity. \value InOutQuint \inlineimage qeasingcurve-inoutquint.png \br - Easing curve for a cubic (t^5) function: + Easing curve for a quintic (t^5) function: acceleration until halfway, then deceleration. \value OutInQuint \inlineimage qeasingcurve-outinquint.png \br - Easing curve for a cubic (t^5) function: + Easing curve for a quintic (t^5) function: deceleration until halfway, then acceleration. \value InSine \inlineimage qeasingcurve-insine.png \br diff --git a/src/declarative/debugger/qpacketprotocol.cpp b/src/declarative/debugger/qpacketprotocol.cpp index 878f42f..c2f7709 100644 --- a/src/declarative/debugger/qpacketprotocol.cpp +++ b/src/declarative/debugger/qpacketprotocol.cpp @@ -125,7 +125,7 @@ public: QObject::connect(this, SIGNAL(invalidPacket()), parent, SIGNAL(invalidPacket())); QObject::connect(dev, SIGNAL(readyRead()), - this, SLOT(readyToRead())); + this, SLOT(readyToRead()), Qt::QueuedConnection); QObject::connect(dev, SIGNAL(aboutToClose()), this, SLOT(aboutToClose())); QObject::connect(dev, SIGNAL(bytesWritten(qint64)), diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 2c295cd..50998eb 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -1432,11 +1432,6 @@ QDeclarativeKeysAttached *QDeclarativeKeysAttached::qmlAttachedProperties(QObjec */ /*! - \fn void QDeclarativeItem::childrenChanged() - \internal -*/ - -/*! \fn void QDeclarativeItem::focusChanged(bool) \internal */ @@ -2855,6 +2850,41 @@ void QDeclarativeItem::setSmooth(bool smooth) } /*! + \property QDeclarativeItem::anchors + \internal +*/ + +/*! + \property QDeclarativeItem::left + \internal +*/ + +/*! + \property QDeclarativeItem::right + \internal +*/ + +/*! + \property QDeclarativeItem::horizontalCenter + \internal +*/ + +/*! + \property QDeclarativeItem::top + \internal +*/ + +/*! + \property QDeclarativeItem::bottom + \internal +*/ + +/*! + \property QDeclarativeItem::verticalCenter + \internal +*/ + +/*! \property QDeclarativeItem::focus \internal */ @@ -2875,6 +2905,41 @@ void QDeclarativeItem::setSmooth(bool smooth) */ /*! + \property QDeclarativeItem::baseline + \internal +*/ + +/*! + \property QDeclarativeItem::data + \internal +*/ + +/*! + \property QDeclarativeItem::resources + \internal +*/ + +/*! + \property QDeclarativeItem::state + \internal +*/ + +/*! + \property QDeclarativeItem::states + \internal +*/ + +/*! + \property QDeclarativeItem::transformOriginPoint + \internal +*/ + +/*! + \property QDeclarativeItem::transitions + \internal +*/ + +/*! \internal Return the width of the item */ diff --git a/src/declarative/graphicsitems/qdeclarativetranslate.cpp b/src/declarative/graphicsitems/qdeclarativetranslate.cpp index be9b3f3..0bae0cd 100644 --- a/src/declarative/graphicsitems/qdeclarativetranslate.cpp +++ b/src/declarative/graphicsitems/qdeclarativetranslate.cpp @@ -125,12 +125,4 @@ void QDeclarativeTranslate::applyTo(QMatrix4x4 *matrix) const matrix->translate(d->x, d->y, 0); } -/*! - \fn QDeclarativeTranslate::positionChanged() - - QDeclarativeTranslate emits this signal when its position changes. - - \sa QDeclarativeTranslate::x, QDeclarativeTranslate::y -*/ - QT_END_NAMESPACE diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index e8cb36e..3822373 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -206,10 +206,9 @@ Text { \section1 Enums -The Qt object contains all enums in the Qt namespace. For example, you can -access the \c AlignLeft member of the \c Qt::AlignmentFlag enum with \c Qt.AlignLeft. +The Qt object contains enums that declared into Qt's Meta-Object System. For example, you can access +the \c Leftbutton member of the \c Qt::MouseButton enum with \c Qt.LeftButton. -For a full list of enums, see the \l{Qt Namespace} documentation. \section1 Types The Qt object also contains helper functions for creating objects of specific diff --git a/src/declarative/util/qdeclarativespringanimation.cpp b/src/declarative/util/qdeclarativespringanimation.cpp index 8ce4832..cfc7b8e 100644 --- a/src/declarative/util/qdeclarativespringanimation.cpp +++ b/src/declarative/util/qdeclarativespringanimation.cpp @@ -54,36 +54,32 @@ QT_BEGIN_NAMESPACE - -class QDeclarativeSpringAnimationPrivate : public QDeclarativeAbstractAnimationPrivate +class QDeclarativeSpringAnimationPrivate : public QDeclarativePropertyAnimationPrivate { Q_DECLARE_PUBLIC(QDeclarativeSpringAnimation) public: - QDeclarativeSpringAnimationPrivate() - : currentValue(0), to(0), from(0), maxVelocity(0), lastTime(0) - , mass(1.0), spring(0.), damping(0.), velocity(0), epsilon(0.01) - , modulus(0.0), useMass(false), haveModulus(false), enabled(true) - , fromDefined(false), toDefined(false) - , mode(Track), clock(this) {} - - qreal currentValue; - qreal to; - qreal from; + + + struct SpringAnimation { + SpringAnimation() + : currentValue(0), to(0), velocity(0){} + qreal currentValue; + qreal to; + qreal velocity; + }; + QHash<QDeclarativeProperty, SpringAnimation> activeAnimations; + qreal maxVelocity; qreal velocityms; int lastTime; qreal mass; qreal spring; qreal damping; - qreal velocity; qreal epsilon; qreal modulus; bool useMass : 1; bool haveModulus : 1; - bool enabled : 1; - bool fromDefined : 1; - bool toDefined : 1; enum Mode { Track, @@ -92,38 +88,68 @@ public: }; Mode mode; - void tick(int); + QDeclarativeSpringAnimationPrivate() + : maxVelocity(0), velocityms(0), lastTime(0) + , mass(1.0), spring(0.), damping(0.), epsilon(0.01) + , modulus(0.0), useMass(false), haveModulus(false) + , mode(Track), clock(0) + { } + + void tick(int time); + bool animate(const QDeclarativeProperty &property, SpringAnimation &animation, int elapsed); void updateMode(); - QTickAnimationProxy<QDeclarativeSpringAnimationPrivate, &QDeclarativeSpringAnimationPrivate::tick> clock; + typedef QTickAnimationProxy<QDeclarativeSpringAnimationPrivate, &QDeclarativeSpringAnimationPrivate::tick> Clock; + Clock *clock; }; void QDeclarativeSpringAnimationPrivate::tick(int time) { if (mode == Track) { - clock.stop(); + clock->stop(); return; } - int elapsed = time - lastTime; if (!elapsed) return; - qreal srcVal = to; + + if (mode == Spring) { + if (elapsed < 16) // capped at 62fps. + return; + int count = elapsed / 16; + lastTime = time - (elapsed - count * 16); + } else { + lastTime = time; + } + + QMutableHashIterator<QDeclarativeProperty, SpringAnimation> it(activeAnimations); + while (it.hasNext()) { + it.next(); + if (animate(it.key(), it.value(), elapsed)) + it.remove(); + } + + if (activeAnimations.isEmpty()) + clock->stop(); +} + +bool QDeclarativeSpringAnimationPrivate::animate(const QDeclarativeProperty &property, SpringAnimation &animation, int elapsed) +{ + + qreal srcVal = animation.to; bool stop = false; if (haveModulus) { - currentValue = fmod(currentValue, modulus); + animation.currentValue = fmod(animation.currentValue, modulus); srcVal = fmod(srcVal, modulus); } if (mode == Spring) { - if (elapsed < 16) // capped at 62fps. - return; // Real men solve the spring DEs using RK4. // We'll do something much simpler which gives a result that looks fine. int count = elapsed / 16; for (int i = 0; i < count; ++i) { - qreal diff = srcVal - currentValue; + qreal diff = srcVal - animation.currentValue; if (haveModulus && qAbs(diff) > modulus / 2) { if (diff < 0) diff += modulus; @@ -131,32 +157,31 @@ void QDeclarativeSpringAnimationPrivate::tick(int time) diff -= modulus; } if (useMass) - velocity = velocity + (spring * diff - damping * velocity) / mass; + animation.velocity = animation.velocity + (spring * diff - damping * animation.velocity) / mass; else - velocity = velocity + spring * diff - damping * velocity; + animation.velocity = animation.velocity + spring * diff - damping * animation.velocity; if (maxVelocity > 0.) { // limit velocity - if (velocity > maxVelocity) - velocity = maxVelocity; - else if (velocity < -maxVelocity) - velocity = -maxVelocity; + if (animation.velocity > maxVelocity) + animation.velocity = maxVelocity; + else if (animation.velocity < -maxVelocity) + animation.velocity = -maxVelocity; } - currentValue += velocity * 16.0 / 1000.0; + animation.currentValue += animation.velocity * 16.0 / 1000.0; if (haveModulus) { - currentValue = fmod(currentValue, modulus); - if (currentValue < 0.0) - currentValue += modulus; + animation.currentValue = fmod(animation.currentValue, modulus); + if (animation.currentValue < 0.0) + animation.currentValue += modulus; } } - if (qAbs(velocity) < epsilon && qAbs(srcVal - currentValue) < epsilon) { - velocity = 0.0; - currentValue = srcVal; + if (qAbs(animation.velocity) < epsilon && qAbs(srcVal - animation.currentValue) < epsilon) { + animation.velocity = 0.0; + animation.currentValue = srcVal; stop = true; } - lastTime = time - (elapsed - count * 16); } else { qreal moveBy = elapsed * velocityms; - qreal diff = srcVal - currentValue; + qreal diff = srcVal - animation.currentValue; if (haveModulus && qAbs(diff) > modulus / 2) { if (diff < 0) diff += modulus; @@ -164,33 +189,31 @@ void QDeclarativeSpringAnimationPrivate::tick(int time) diff -= modulus; } if (diff > 0) { - currentValue += moveBy; + animation.currentValue += moveBy; if (haveModulus) - currentValue = fmod(currentValue, modulus); - if (currentValue > to) { - currentValue = to; + animation.currentValue = fmod(animation.currentValue, modulus); + if (animation.currentValue > animation.to) { + animation.currentValue = animation.to; stop = true; } } else { - currentValue -= moveBy; - if (haveModulus && currentValue < 0.0) - currentValue = fmod(currentValue, modulus) + modulus; - if (currentValue < to) { - currentValue = to; + animation.currentValue -= moveBy; + if (haveModulus && animation.currentValue < 0.0) + animation.currentValue = fmod(animation.currentValue, modulus) + modulus; + if (animation.currentValue < animation.to) { + animation.currentValue = animation.to; stop = true; } } - lastTime = time; } - qreal old_to = to; + qreal old_to = animation.to; - QDeclarativePropertyPrivate::write(defaultProperty, currentValue, + QDeclarativePropertyPrivate::write(property, animation.currentValue, QDeclarativePropertyPrivate::BypassInterceptor | QDeclarativePropertyPrivate::DontRemoveBinding); - if (stop && old_to == to) // do not stop if we got restarted - clock.stop(); + return (stop && old_to == animation.to); // do not stop if we got restarted } void QDeclarativeSpringAnimationPrivate::updateMode() @@ -230,79 +253,16 @@ void QDeclarativeSpringAnimationPrivate::updateMode() */ QDeclarativeSpringAnimation::QDeclarativeSpringAnimation(QObject *parent) -: QDeclarativeAbstractAnimation(*(new QDeclarativeSpringAnimationPrivate),parent) -{ -} - -QDeclarativeSpringAnimation::~QDeclarativeSpringAnimation() -{ -} - -void QDeclarativeSpringAnimation::setTarget(const QDeclarativeProperty &property) +: QDeclarativeNumberAnimation(*(new QDeclarativeSpringAnimationPrivate),parent) { Q_D(QDeclarativeSpringAnimation); - d->defaultProperty = property; - d->currentValue = property.read().toReal(); - if (!d->avoidPropertyValueSourceStart) { - setRunning(true); - } -} - -qreal QDeclarativeSpringAnimation::to() const -{ - Q_D(const QDeclarativeSpringAnimation); - return d->toDefined ? d->to : 0; -} - -/*! - \qmlproperty real SpringAnimation::to - - This property holds the value at which the animation will end. - - If not set, the animation will continue until it reaches the - value that is being tracked. -*/ - -void QDeclarativeSpringAnimation::setTo(qreal value) -{ - Q_D(QDeclarativeSpringAnimation); - if (d->to == value) - return; - - d->to = value; - d->toDefined = true; - d->lastTime = 0; - emit toChanged(value); + d->clock = new QDeclarativeSpringAnimationPrivate::Clock(d, this); } -qreal QDeclarativeSpringAnimation::from() const -{ - Q_D(const QDeclarativeSpringAnimation); - return d->fromDefined ? d->from : 0; -} - -/*! - \qmlproperty real SpringAnimation::from - - This property holds the value from which the animation will begin. - - If not set, the animation will start whenever the tracked value has - changed, regardless of its value. -*/ - -void QDeclarativeSpringAnimation::setFrom(qreal value) +QDeclarativeSpringAnimation::~QDeclarativeSpringAnimation() { - Q_D(QDeclarativeSpringAnimation); - if (d->from == value) - return; - - d->currentValue = d->from = value; - d->fromDefined = true; - d->lastTime = 0; - emit fromChanged(value); } - /*! \qmlproperty real SpringAnimation::velocity @@ -452,17 +412,25 @@ void QDeclarativeSpringAnimation::transition(QDeclarativeStateActions &actions, Q_D(QDeclarativeSpringAnimation); Q_UNUSED(direction); - if (d->clock.state() != QAbstractAnimation::Running) + if (d->clock->state() != QAbstractAnimation::Running) { d->lastTime = 0; + } - if (!actions.isEmpty()) { - for (int i = 0; i < actions.size(); ++i) { - if (!d->toDefined) - d->to = actions.at(i).toValue.toReal(); - if (!d->fromDefined) - d->currentValue = actions.at(i).fromValue.toReal(); - if (d->mode != QDeclarativeSpringAnimationPrivate::Track) - modified << d->defaultProperty; + QDeclarativeNumberAnimation::transition(actions, modified, direction); + + if (!d->actions) + return; + + if (!d->actions->isEmpty()) { + for (int i = 0; i < d->actions->size(); ++i) { + const QDeclarativeProperty &property = d->actions->at(i).property; + QDeclarativeSpringAnimationPrivate::SpringAnimation &animation + = d->activeAnimations[property]; + animation.to = d->actions->at(i).toValue.toReal(); + if (d->fromIsDefined) + animation.currentValue = d->actions->at(i).fromValue.toReal(); + else + animation.currentValue = property.read().toReal(); } } } @@ -471,7 +439,7 @@ void QDeclarativeSpringAnimation::transition(QDeclarativeStateActions &actions, QAbstractAnimation *QDeclarativeSpringAnimation::qtAnimation() { Q_D(QDeclarativeSpringAnimation); - return &d->clock; + return d->clock; } QT_END_NAMESPACE diff --git a/src/declarative/util/qdeclarativespringanimation_p.h b/src/declarative/util/qdeclarativespringanimation_p.h index 6f574ef..ee276ec 100644 --- a/src/declarative/util/qdeclarativespringanimation_p.h +++ b/src/declarative/util/qdeclarativespringanimation_p.h @@ -54,14 +54,12 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeSpringAnimationPrivate; -class Q_AUTOTEST_EXPORT QDeclarativeSpringAnimation : public QDeclarativeAbstractAnimation +class Q_AUTOTEST_EXPORT QDeclarativeSpringAnimation : public QDeclarativeNumberAnimation { Q_OBJECT Q_DECLARE_PRIVATE(QDeclarativeSpringAnimation) Q_INTERFACES(QDeclarativePropertyValueSource) - Q_PROPERTY(qreal to READ to WRITE setTo NOTIFY toChanged) - Q_PROPERTY(qreal from READ from WRITE setFrom NOTIFY fromChanged) Q_PROPERTY(qreal velocity READ velocity WRITE setVelocity) Q_PROPERTY(qreal spring READ spring WRITE setSpring) Q_PROPERTY(qreal damping READ damping WRITE setDamping) @@ -73,14 +71,6 @@ public: QDeclarativeSpringAnimation(QObject *parent=0); ~QDeclarativeSpringAnimation(); - virtual void setTarget(const QDeclarativeProperty &); - - qreal to() const; - void setTo(qreal value); - - qreal from() const; - void setFrom(qreal value); - qreal velocity() const; void setVelocity(qreal velocity); @@ -99,9 +89,6 @@ public: qreal modulus() const; void setModulus(qreal modulus); - bool enabled() const; - void setEnabled(bool enabled); - virtual void transition(QDeclarativeStateActions &actions, QDeclarativeProperties &modified, TransitionDirection direction); @@ -110,8 +97,6 @@ protected: virtual QAbstractAnimation *qtAnimation(); Q_SIGNALS: - void toChanged(qreal); - void fromChanged(qreal); void modulusChanged(); void massChanged(); void syncChanged(); diff --git a/src/gui/dialogs/qfontdialog_mac.mm b/src/gui/dialogs/qfontdialog_mac.mm index bb8ef3f..9c63dfa 100644 --- a/src/gui/dialogs/qfontdialog_mac.mm +++ b/src/gui/dialogs/qfontdialog_mac.mm @@ -131,6 +131,7 @@ const int StyleMask = NSTitledWindowMask | NSClosableWindowMask | NSResizableWin - (QFont)qtFont; - (void)finishOffWithCode:(NSInteger)result; - (void)cleanUpAfterMyself; +- (void)setSubwindowStacking; @end static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) @@ -187,6 +188,12 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) [cancelButton setTarget:self]; } + mQtFont = new QFont(); + return self; +} + +- (void)setSubwindowStacking +{ #ifdef QT_MAC_USE_COCOA // Stack the native dialog in front of its parent, if any: QFontDialog *q = mPriv->fontDialog(); @@ -199,9 +206,6 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont) } } #endif - - mQtFont = new QFont(); - return self; } - (void)dealloc @@ -610,6 +614,7 @@ void QFontDialogPrivate::createNSFontPanelDelegate() [ourPanel setFrame:frameRect display:NO]; [ourPanel center]; } + [del setSubwindowStacking]; NSString *title = @"Select font"; [ourPanel setTitle:title]; } diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 1b43ef2..28440cc 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -80,17 +80,6 @@ symbian { contains(QMAKE_MAC_XARCH, no) { DEFINES += QT_NO_MAC_XARCH } else { - mmx:DEFINES += QT_HAVE_MMX - 3dnow:DEFINES += QT_HAVE_3DNOW - sse:DEFINES += QT_HAVE_SSE QT_HAVE_MMXEXT - sse2:DEFINES += QT_HAVE_SSE2 - sse3:DEFINES += QT_HAVE_SSE3 - ssse3:DEFINES += QT_HAVE_SSSE3 - sse4_1:DEFINES += QT_HAVE_SSE4_1 - sse4_2:DEFINES += QT_HAVE_SSE4_2 - avx:DEFINES += QT_HAVE_AVX - iwmmxt:DEFINES += QT_HAVE_IWMMXT - win32-g++*|!win32:!*-icc* { mmx { mmx_compiler.commands = $$QMAKE_CXX -c -Winline diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 30cf758..cb834c0 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -4829,7 +4829,7 @@ QImage QImage::rgbSwapped() const QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { uint *q = (uint*)res.scanLine(i); - uint *p = (uint*)scanLine(i); + uint *p = (uint*)constScanLine(i); uint *end = p + d->width; while (p < end) { *q = ((*p << 16) & 0xff0000) | ((*p >> 16) & 0xff) | (*p & 0xff00ff00); @@ -4843,7 +4843,7 @@ QImage QImage::rgbSwapped() const QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { ushort *q = (ushort*)res.scanLine(i); - const ushort *p = (const ushort*)scanLine(i); + const ushort *p = (const ushort*)constScanLine(i); const ushort *end = p + d->width; while (p < end) { *q = ((*p << 11) & 0xf800) | ((*p >> 11) & 0x1f) | (*p & 0x07e0); @@ -4856,12 +4856,15 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - quint8 *p = (quint8*)scanLine(i); + const quint8 *p = constScanLine(i); + quint8 *q = res.scanLine(i); const quint8 *end = p + d->width * sizeof(qargb8565); while (p < end) { - quint16 *q = reinterpret_cast<quint16*>(p + 1); - *q = ((*q << 11) & 0xf800) | ((*q >> 11) & 0x1f) | (*q & 0x07e0); + q[0] = p[0]; + q[1] = (p[1] & 0xe0) | (p[2] >> 3); + q[2] = (p[2] & 0x07) | (p[1] << 3); p += sizeof(qargb8565); + q += sizeof(qargb8565); } } break; @@ -4870,7 +4873,7 @@ QImage QImage::rgbSwapped() const QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { qrgb666 *q = reinterpret_cast<qrgb666*>(res.scanLine(i)); - const qrgb666 *p = reinterpret_cast<const qrgb666*>(scanLine(i)); + const qrgb666 *p = reinterpret_cast<const qrgb666*>(constScanLine(i)); const qrgb666 *end = p + d->width; while (p < end) { const QRgb rgb = quint32(*p++); @@ -4882,12 +4885,15 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - qargb6666 *q = reinterpret_cast<qargb6666*>(res.scanLine(i)); - const qargb6666 *p = reinterpret_cast<const qargb6666*>(scanLine(i)); - const qargb6666 *end = p + d->width; + const quint8 *p = constScanLine(i); + const quint8 *end = p + d->width * sizeof(qargb6666); + quint8 *q = res.scanLine(i); while (p < end) { - const QRgb rgb = quint32(*p++); - *q++ = qRgba(qBlue(rgb), qGreen(rgb), qRed(rgb), qAlpha(rgb)); + q[0] = (p[1] >> 4) | ((p[2] & 0x3) << 4) | (p[0] & 0xc0); + q[1] = (p[1] & 0xf) | (p[0] << 4); + q[2] = (p[2] & 0xfc) | ((p[0] >> 4) & 0x3); + p += sizeof(qargb6666); + q += sizeof(qargb6666); } } break; @@ -4895,11 +4901,11 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - ushort *q = (ushort*)res.scanLine(i); - const ushort *p = (const ushort*)scanLine(i); - const ushort *end = p + d->width; + quint16 *q = (quint16*)res.scanLine(i); + const quint16 *p = (const quint16*)constScanLine(i); + const quint16 *end = p + d->width; while (p < end) { - *q = ((*p << 10) & 0x7800) | ((*p >> 10) & 0x1f) | (*p & 0x83e0); + *q = ((*p << 10) & 0x7c00) | ((*p >> 10) & 0x1f) | (*p & 0x3e0); p++; q++; } @@ -4909,12 +4915,15 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - quint8 *p = (quint8*)scanLine(i); + const quint8 *p = constScanLine(i); + quint8 *q = res.scanLine(i); const quint8 *end = p + d->width * sizeof(qargb8555); while (p < end) { - quint16 *q = reinterpret_cast<quint16*>(p + 1); - *q = ((*q << 10) & 0x7800) | ((*q >> 10) & 0x1f) | (*q & 0x83e0); + q[0] = p[0]; + q[1] = (p[1] & 0xe0) | (p[2] >> 2); + q[2] = (p[2] & 0x03) | ((p[1] << 2) & 0x7f); p += sizeof(qargb8555); + q += sizeof(qargb8555); } } break; @@ -4922,8 +4931,8 @@ QImage QImage::rgbSwapped() const res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i)); - const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i)); + quint8 *q = res.scanLine(i); + const quint8 *p = constScanLine(i); const quint8 *end = p + d->width * sizeof(qrgb888); while (p < end) { q[0] = p[2]; @@ -4935,32 +4944,17 @@ QImage QImage::rgbSwapped() const } break; case Format_RGB444: - res = QImage(d->width, d->height, d->format); - QIMAGE_SANITYCHECK_MEMORY(res); - for (int i = 0; i < d->height; i++) { - quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i)); - const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i)); - const quint8 *end = p + d->width * sizeof(qrgb444); - while (p < end) { - q[0] = (p[0] & 0xf0) | ((p[1] & 0x0f) << 8); - q[1] = ((p[0] & 0x0f) >> 8) | (p[1] & 0xf0); - q += sizeof(qrgb444); - p += sizeof(qrgb444); - } - } - break; case Format_ARGB4444_Premultiplied: res = QImage(d->width, d->height, d->format); QIMAGE_SANITYCHECK_MEMORY(res); for (int i = 0; i < d->height; i++) { - quint8 *q = reinterpret_cast<quint8*>(res.scanLine(i)); - const quint8 *p = reinterpret_cast<const quint8*>(scanLine(i)); - const quint8 *end = p + d->width * sizeof(qargb4444); + quint16 *q = reinterpret_cast<quint16*>(res.scanLine(i)); + const quint16 *p = reinterpret_cast<const quint16*>(constScanLine(i)); + const quint16 *end = p + d->width; while (p < end) { - q[0] = (p[0] & 0xf0) | ((p[1] & 0x0f) << 8); - q[1] = ((p[0] & 0x0f) >> 8) | (p[1] & 0xf0); - q += sizeof(qargb4444); - p += sizeof(qargb4444); + *q = (*p & 0xf0f0) | ((*p & 0x0f) << 8) | ((*p & 0xf00) >> 8); + p++; + q++; } } break; diff --git a/src/gui/image/qimage_ssse3.cpp b/src/gui/image/qimage_ssse3.cpp index 1c664f2..9aed011 100644 --- a/src/gui/image/qimage_ssse3.cpp +++ b/src/gui/image/qimage_ssse3.cpp @@ -45,13 +45,12 @@ #ifdef QT_HAVE_SSSE3 -#include <stdio.h> QT_BEGIN_NAMESPACE // Convert a scanline of RGB888 (src) to RGB32 (dst) // src must be at least len * 3 bytes // dst must be at least len * 4 bytes -inline void convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len) +Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len) { quint32 *const end = dst + len; @@ -139,7 +138,7 @@ void convert_RGB888_to_RGB32_ssse3(QImageData *dest, const QImageData *src, Qt:: quint32 *dest_data = (quint32 *) dest->data; for (int i = 0; i < src->height; ++i) { - convert_rgb888_to_rgb32_ssse3(dest_data, src_data, src->width); + qt_convert_rgb888_to_rgb32_ssse3(dest_data, src_data, src->width); src_data += src->bytes_per_line; dest_data = (quint32 *)((uchar*)dest_data + dest->bytes_per_line); } diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp index 972dd65..d358a5e 100644 --- a/src/gui/image/qjpeghandler.cpp +++ b/src/gui/image/qjpeghandler.cpp @@ -45,6 +45,7 @@ #include <qvariant.h> #include <qvector.h> #include <qbuffer.h> +#include <private/qsimd_p.h> #include <stdio.h> // jpeglib needs this to be pre-included #include <setjmp.h> @@ -75,6 +76,19 @@ extern "C" { QT_BEGIN_NAMESPACE +void QT_FASTCALL convert_rgb888_to_rgb32_C(quint32 *dst, const uchar *src, int len) +{ + // Expand 24->32 bpp. + for (int i = 0; i < len; ++i) { + *dst++ = qRgb(src[0], src[1], src[2]); + src += 3; + } +} + +typedef void (QT_FASTCALL *Rgb888ToRgb32Converter)(quint32 *dst, const uchar *src, int len); + +static Rgb888ToRgb32Converter rgb888ToRgb32ConverterPtr = convert_rgb888_to_rgb32_C; + struct my_error_mgr : public jpeg_error_mgr { jmp_buf setjmp_buffer; }; @@ -393,13 +407,9 @@ static bool read_jpeg_image(QImage *outImage, continue; // Haven't reached the starting line yet. if (info->output_components == 3) { - // Expand 24->32 bpp. uchar *in = rows[0] + clip.x() * 3; QRgb *out = (QRgb*)outImage->scanLine(y); - for (int i = 0; i < clip.width(); ++i) { - *out++ = qRgb(in[0], in[1], in[2]); - in += 3; - } + rgb888ToRgb32ConverterPtr(out, in, clip.width()); } else if (info->out_color_space == JCS_CMYK) { // Convert CMYK->RGB. uchar *in = rows[0] + clip.x() * 4; @@ -793,6 +803,15 @@ bool QJpegHandlerPrivate::read(QImage *image) QJpegHandler::QJpegHandler() : d(new QJpegHandlerPrivate(this)) { +#if defined(QT_HAVE_SSSE3) + const uint features = qDetectCPUFeatures(); + + // from qimage_ssse3.cpp + Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len); + + if (features & SSSE3) + rgb888ToRgb32ConverterPtr = qt_convert_rgb888_to_rgb32_ssse3; +#endif // QT_HAVE_SSSE3 } QJpegHandler::~QJpegHandler() diff --git a/src/gui/inputmethod/qinputcontextfactory.cpp b/src/gui/inputmethod/qinputcontextfactory.cpp index ec8d8e2..865c1b2 100644 --- a/src/gui/inputmethod/qinputcontextfactory.cpp +++ b/src/gui/inputmethod/qinputcontextfactory.cpp @@ -73,7 +73,7 @@ #endif #ifdef Q_WS_S60 #include "qcoefepinputcontext_p.h" -#include "akninputlanguageinfo.h" +#include "AknInputLanguageInfo.h" #endif #include "private/qfactoryloader_p.h" diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 5c333b0..3303800 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -2540,6 +2540,13 @@ void QApplication::setActiveWindow(QWidget* act) sendSpontaneousEvent(w, &activationChange); } +#ifdef QT_MAC_USE_COCOA + // In case the user clicked on a child window, we need to + // reestablish the stacking order of the window so + // it pops in front of other child windows in cocoa: + qt_cocoaStackChildWindowOnTopOfOtherChildren(window); +#endif + for(int i = 0; i < toBeDeactivated.size(); ++i) { QWidget *w = toBeDeactivated.at(i); sendSpontaneousEvent(w, &windowDeactivate); diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp index 38ec806..55d5727 100644 --- a/src/gui/kernel/qpalette.cpp +++ b/src/gui/kernel/qpalette.cpp @@ -872,7 +872,7 @@ void QPalette::detach() \note The current ColorGroup is not taken into account when comparing palettes - \sa operator== + \sa operator==() */ /*! @@ -882,7 +882,7 @@ void QPalette::detach() \note The current ColorGroup is not taken into account when comparing palettes - \sa operator!= + \sa operator!=() */ bool QPalette::operator==(const QPalette &p) const { diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 3fc27f4..7d23abf 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -685,9 +685,11 @@ bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEve unsigned int info = 0; if ([event type] == NSKeyDown) { NSString *characters = [event characters]; - unichar value = [characters characterAtIndex:0]; - qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value); - info = value; + if ([characters length]) { + unichar value = [characters characterAtIndex:0]; + qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value); + info = value; + } } // Redirect keys to alien widgets. @@ -1527,6 +1529,22 @@ void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window) [theWindow display]; } } + +void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *childWidget) +{ + if (!childWidget) + return; + + QWidget *parent = childWidget->parentWidget(); + if (childWidget->isWindow() && parent) { + if ([[qt_mac_window_for(parent) childWindows] containsObject:qt_mac_window_for(childWidget)]) { + QWidgetPrivate *d = qt_widget_private(childWidget); + d->setSubWindowStacking(false); + d->setSubWindowStacking(true); + } + } +} + #endif // QT_MAC_USE_COCOA QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 44fb4f0..c6c2db2 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -148,6 +148,7 @@ void qt_cocoaChangeOverrideCursor(const QCursor &cursor); // These methods exists only for supporting unified mode. void macDrawRectOnTop(void * /*OSWindowRef */ window); void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window); +void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *widget); #endif void qt_mac_menu_collapseSeparators(void * /*NSMenu */ menu, bool collapse); bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent); diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 4ce2bee..1ff3d7b 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -7820,8 +7820,10 @@ void qInitDrawhelperAsm() uint const_alpha); extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha); extern void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha); + extern void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha); functionForModeAsm[0] = comp_func_SourceOver_sse2; + functionForModeAsm[QPainter::CompositionMode_Source] = comp_func_Source_sse2; functionForModeAsm[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2; functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2; diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index e090ae5..7ab9eda 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -229,6 +229,39 @@ void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uin } } +void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha) +{ + if (const_alpha == 255) { + ::memcpy(dst, src, length * sizeof(uint)); + } else { + const int ialpha = 255 - const_alpha; + + int x = 0; + + // 1) prologue, align on 16 bytes + const int offsetToAlignOn16Bytes = (4 - ((reinterpret_cast<quintptr>(dst) >> 2) & 0x3)) & 0x3; + const int prologLength = qMin(length, offsetToAlignOn16Bytes); + for (; x < prologLength; ++x) + dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha); + + // 2) interpolate pixels with SSE2 + const __m128i half = _mm_set1_epi16(0x80); + const __m128i colorMask = _mm_set1_epi32(0x00ff00ff); + const __m128i constAlphaVector = _mm_set1_epi16(const_alpha); + const __m128i oneMinusConstAlpha = _mm_set1_epi16(ialpha); + for (; x < length - 3; x += 4) { + const __m128i srcVector = _mm_loadu_si128((__m128i *)&src[x]); + __m128i dstVector = _mm_load_si128((__m128i *)&dst[x]); + INTERPOLATE_PIXEL_255_SSE2(dstVector, srcVector, dstVector, constAlphaVector, oneMinusConstAlpha, colorMask, half) + _mm_store_si128((__m128i *)&dst[x], dstVector); + } + + // 3) Epilogue + for (; x < length; ++x) + dst[x] = INTERPOLATE_PIXEL_255(src[x], const_alpha, dst[x], ialpha); + } +} + void qt_memfill32_sse2(quint32 *dest, quint32 value, int count) { if (count < 7) { diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 3438137..568f4d7 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -346,11 +346,14 @@ QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() QApplicationPrivate::graphics_system_name = QLatin1String("runtime"); QApplicationPrivate::runtime_graphics_system = true; +#ifdef QT_DEFAULT_RUNTIME_SYSTEM + m_graphicsSystemName = QLatin1String(QT_DEFAULT_RUNTIME_SYSTEM); + if (m_graphicsSystemName.isNull()) +#endif + m_graphicsSystemName = QLatin1String("raster"); + #ifdef Q_OS_SYMBIAN - m_graphicsSystemName = QLatin1String("openvg"); m_windowSurfaceDestroyPolicy = DestroyAfterFirstFlush; -#else - m_graphicsSystemName = QLatin1String("raster"); #endif m_graphicsSystem = QGraphicsSystemFactory::create(m_graphicsSystemName); diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index e0746fb..881bd6e 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -831,7 +831,7 @@ void QPaintEngineEx::drawEllipse(const QRectF &r) int point_count = 0; x.points[0] = qt_curves_for_arc(r, 0, -360, x.points + 1, &point_count); - QVectorPath vp((qreal *) pts, 13, qpaintengineex_ellipse_types, QVectorPath::EllipseHint); + QVectorPath vp((qreal *) pts, point_count, qpaintengineex_ellipse_types, QVectorPath::EllipseHint); draw(vp); } diff --git a/src/gui/s60framework/qs60maindocument.cpp b/src/gui/s60framework/qs60maindocument.cpp index ed33a41..26e2d00 100644 --- a/src/gui/s60framework/qs60maindocument.cpp +++ b/src/gui/s60framework/qs60maindocument.cpp @@ -105,11 +105,17 @@ CEikAppUi *QS60MainDocument::CreateAppUiL() return (static_cast <CEikAppUi*>(new(ELeave)QS60MainAppUi)); } +/*! + \internal + */ CFileStore *QS60MainDocument::OpenFileL(TBool aDoOpen, const TDesC &aFilename, RFs &aFs) { return QS60MainDocumentBase::OpenFileL(aDoOpen, aFilename, aFs); } +/*! + \internal + */ void QS60MainDocument::OpenFileL(CFileStore *&aFileStore, RFile &aFile) { QS60MainDocumentBase::OpenFileL(aFileStore, aFile); diff --git a/src/gui/s60framework/qs60maindocument.h b/src/gui/s60framework/qs60maindocument.h index 2f0564f..fc32d8b 100644 --- a/src/gui/s60framework/qs60maindocument.h +++ b/src/gui/s60framework/qs60maindocument.h @@ -47,7 +47,7 @@ #ifdef Q_OS_SYMBIAN #ifdef Q_WS_S60 -#include <akndoc.h> +#include <AknDoc.h> typedef CAknDocument QS60MainDocumentBase; #else #include <eikdoc.h> diff --git a/src/gui/styles/qmacstyle_mac.h b/src/gui/styles/qmacstyle_mac.h index bcebb1d..d5fcdae 100644 --- a/src/gui/styles/qmacstyle_mac.h +++ b/src/gui/styles/qmacstyle_mac.h @@ -60,6 +60,8 @@ class QPalette; #define Q_GUI_EXPORT_STYLE_MAC Q_GUI_EXPORT #endif +class QPushButton; +class QStyleOptionButton; class QMacStylePrivate; class Q_GUI_EXPORT_STYLE_MAC QMacStyle : public QWindowsStyle { @@ -133,6 +135,8 @@ private: Q_DISABLE_COPY(QMacStyle) QMacStylePrivate *d; + + friend bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); }; #endif // Q_WS_MAC diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm index d18383c..ae90d26 100644 --- a/src/gui/styles/qmacstyle_mac.mm +++ b/src/gui/styles/qmacstyle_mac.mm @@ -1059,6 +1059,16 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn, } } +bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option) +{ + QMacStyle *macStyle = qobject_cast<QMacStyle *>(pushButton->style()); + if (!macStyle) + return false; + HIThemeButtonDrawInfo bdi; + macStyle->d->initHIThemePushButton(option, pushButton, kThemeStateActive, &bdi); + return bdi.kind == kThemeBevelButton; +} + /** Creates a HIThemeButtonDrawInfo structure that specifies the correct button kind and other details to use for drawing the given combobox. Which button diff --git a/src/gui/styles/qmacstyle_mac_p.h b/src/gui/styles/qmacstyle_mac_p.h index 5a0ba4c..f9b9d30 100644 --- a/src/gui/styles/qmacstyle_mac_p.h +++ b/src/gui/styles/qmacstyle_mac_p.h @@ -150,6 +150,8 @@ enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2 return sizes[controlSize]; \ } while (0) +bool qt_mac_buttonIsRenderedFlat(const QPushButton *pushButton, const QStyleOptionButton *option); + class QMacStylePrivate : public QObject { Q_OBJECT diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 2527662..f44b85e 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -58,12 +58,12 @@ #include <AknsSkinInstance.h> #include <AknsBasicBackgroundControlContext.h> #include <avkon.mbg> -#include <aknfontaccess.h> -#include <aknlayoutfont.h> +#include <AknFontAccess.h> +#include <AknLayoutFont.h> #include <AknUtils.h> #include <aknnavi.h> #include <gulicon.h> -#include <aknbitmapanimation.h> +#include <AknBitmapAnimation.h> #if !defined(QT_NO_STYLE_S60) || defined(QT_PLUGIN) diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm index deaad57..91b6082 100644 --- a/src/gui/text/qfontengine_mac.mm +++ b/src/gui/text/qfontengine_mac.mm @@ -349,11 +349,32 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay int *nglyphs, QTextEngine::ShaperFlags flags) const { *nglyphs = len; + QCFType<CFStringRef> cfstring; + QVarLengthArray<CGGlyph> cgGlyphs(len); CTFontGetGlyphsForCharacters(ctfont, (const UniChar*)str, cgGlyphs.data(), len); - for (int i = 0; i < len; ++i) - glyphs->glyphs[i] = cgGlyphs[i]; + for (int i = 0; i < len; ++i) { + if (cgGlyphs[i]) { + glyphs->glyphs[i] = cgGlyphs[i]; + } else { + if (!cfstring) + cfstring = CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar *>(str), len, kCFAllocatorNull); + QCFType<CTFontRef> substituteFont = CTFontCreateForString(ctfont, cfstring, CFRangeMake(i, 1)); + CGGlyph substituteGlyph = 0; + CTFontGetGlyphsForCharacters(substituteFont, (const UniChar*)str + i, &substituteGlyph, 1); + if (substituteGlyph) { + const uint fontIndex = (fontIndexForFont(substituteFont) << 24); + glyphs->glyphs[i] = substituteGlyph | fontIndex; + if (!(flags & QTextEngine::GlyphIndicesOnly)) { + CGSize advance; + CTFontGetAdvancesForGlyphs(substituteFont, kCTFontHorizontalOrientation, &substituteGlyph, &advance, 1); + glyphs->advances_x[i] = QFixed::fromReal(advance.width); + glyphs->advances_y[i] = QFixed::fromReal(advance.height); + } + } + } + } if (flags & QTextEngine::GlyphIndicesOnly) return true; @@ -362,9 +383,14 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay CTFontGetAdvancesForGlyphs(ctfont, kCTFontHorizontalOrientation, cgGlyphs.data(), advances.data(), len); for (int i = 0; i < len; ++i) { + if (glyphs->glyphs[i] & 0xff000000) + continue; glyphs->advances_x[i] = QFixed::fromReal(advances[i].width); glyphs->advances_y[i] = QFixed::fromReal(advances[i].height); - if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) { + } + + if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) { + for (int i = 0; i < len; ++i) { glyphs->advances_x[i] = glyphs->advances_x[i].round(); glyphs->advances_y[i] = glyphs->advances_y[i].round(); } diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp index 8a18ed0..237c266 100644 --- a/src/gui/widgets/qpushbutton.cpp +++ b/src/gui/widgets/qpushbutton.cpp @@ -687,11 +687,11 @@ bool QPushButton::event(QEvent *e) /*! \reimp */ bool QPushButton::hitButton(const QPoint &pos) const { - // This is only required if we are using the native style, so check that first. - QMacStyle *macStyle = qobject_cast<QMacStyle *>(style()); - // If this is a flat button we just bail out. - if(isFlat() || (0 == macStyle)) + QStyleOptionButton opt; + initStyleOption(&opt); + if (qt_mac_buttonIsRenderedFlat(this, &opt)) return QAbstractButton::hitButton(pos); + // Now that we know we are using the native style, let's proceed. Q_D(const QPushButton); QPushButtonPrivate *nonConst = const_cast<QPushButtonPrivate *>(d); diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index 5d4274f..c4f7c00 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -150,25 +150,29 @@ QNetworkConfiguration QNetworkConfigurationManagerPrivate::defaultConfiguration( end = engine->accessPointConfigurations.end(); it != end; ++it) { QNetworkConfigurationPrivatePointer ptr = it.value(); - const QString bearerName = ptr->bearerName(); QMutexLocker configLocker(&ptr->mutex); + QNetworkConfiguration::BearerType bearerType = ptr->bearerType; if ((ptr->state & QNetworkConfiguration::Discovered) == QNetworkConfiguration::Discovered) { if (!defaultConfiguration) { defaultConfiguration = ptr; } else { + QMutexLocker defaultConfigLocker(&defaultConfiguration->mutex); + if (defaultConfiguration->state == ptr->state) { - if (defaultConfiguration->bearerName() == QLatin1String("Ethernet")) { + switch (defaultConfiguration->bearerType) { + case QNetworkConfiguration::BearerEthernet: // do nothing - } else if (defaultConfiguration->bearerName() == QLatin1String("WLAN")) { - // ethernet beats wlan - if (bearerName == QLatin1String("Ethernet")) - defaultConfiguration = ptr; - } else { - // ethernet and wlan beats other - if (bearerName == QLatin1String("Ethernet") || - bearerName == QLatin1String("WLAN")) { + break; + case QNetworkConfiguration::BearerWLAN: + // Ethernet beats WLAN + defaultConfiguration = ptr; + break; + default: + // Ethernet and WLAN beats other + if (bearerType == QNetworkConfiguration::BearerEthernet || + bearerType == QNetworkConfiguration::BearerWLAN) { defaultConfiguration = ptr; } } diff --git a/src/network/bearer/qnetworkconfiguration.cpp b/src/network/bearer/qnetworkconfiguration.cpp index d7fceba..3190a30 100644 --- a/src/network/bearer/qnetworkconfiguration.cpp +++ b/src/network/bearer/qnetworkconfiguration.cpp @@ -183,6 +183,23 @@ QT_BEGIN_NAMESPACE */ /*! + \enum QNetworkConfiguration::BearerType + + Specifies the type of bearer used by a configuration. + + \value BearerUnknown The type of bearer is unknown or unspecified. The bearerTypeName() + function may return additional information. + \value BearerEthernet The configuration is for an Ethernet interfaces. + \value BearerWLAN The configuration is for a Wireless LAN interface. + \value Bearer2G The configuration is for a CSD, GPRS, HSCSD, EDGE or cdmaOne interface. + \value BearerCDMA2000 The configuration is for CDMA interface. + \value BearerWCDMA The configuration is for W-CDMA/UMTS interface. + \value BearerHSPA The configuration is for High Speed Packet Access (HSPA) interface. + \value BearerBluetooth The configuration is for a Bluetooth interface. + \value BearerWiMAX The configuration is for a WiMAX interface. +*/ + +/*! Constructs an invalid configuration object. \sa isValid() @@ -383,53 +400,113 @@ QList<QNetworkConfiguration> QNetworkConfiguration::children() const } /*! - Returns the type of bearer. The string is not translated and - therefore can not be shown to the user. The subsequent table presents the currently known - bearer types: + \fn QString QNetworkConfiguration::bearerName() const + \deprecated + + This function is deprecated. It is equivalent to calling bearerTypeName(), however + bearerType() should be used in preference. +*/ + +/*! + Returns the type of bearer used by this network configuration. + + If the bearer type is \l {QNetworkConfiguration::BearerUnknown}{unknown} the bearerTypeName() + function can be used to retrieve a textural type name for the bearer. + + An invalid network configuration always returns the BearerUnknown value. +*/ +QNetworkConfiguration::BearerType QNetworkConfiguration::bearerType() const +{ + if (!isValid()) + return BearerUnknown; + + QMutexLocker locker(&d->mutex); + + return d->bearerType; +} + +/*! + Returns the type of bearer used by this network configuration as a string. + + The string is not translated and therefore can not be shown to the user. The subsequent table + shows the fixed mappings between BearerType and the bearer type name for known types. If the + BearerType is unknown this function may return additional information if it is available; + otherwise an empty string will be returned. \table - \header + \header + \o BearerType \o Value - \o Description \row - \o Unknown - \o The session is based on an unknown or unspecified bearer type. + \o BearerUnknown + \o + \o The session is based on an unknown or unspecified bearer type. The value of the + string returned describes the bearer type. \row + \o BearerEthernet \o Ethernet - \o The session is based on Ethernet. \row + \o BearerWLAN \o WLAN - \o The session is based on Wireless LAN. \row + \o Bearer2G \o 2G - \o The session uses CSD, GPRS, HSCSD, EDGE or cdmaOne. - \row + \row + \o BearerCDMA2000 \o CDMA2000 - \o The session uses CDMA. \row + \o BearerWCDMA \o WCDMA - \o The session uses W-CDMA/UMTS. \row + \o BearerHSPA \o HSPA - \o The session uses High Speed Packet Access. \row + \o BearerBluetooth \o Bluetooth - \o The session uses Bluetooth. \row + \o BearerWiMAX \o WiMAX - \o The session uses WiMAX. \endtable - This function returns an empty string if this is an invalid configuration, - a network configuration of type \l QNetworkConfiguration::ServiceNetwork or + This function returns an empty string if this is an invalid configuration, a network + configuration of type \l QNetworkConfiguration::ServiceNetwork or \l QNetworkConfiguration::UserChoice. + + \sa bearerType() */ -QString QNetworkConfiguration::bearerName() const +QString QNetworkConfiguration::bearerTypeName() const { if (!isValid()) return QString(); - return d->bearerName(); + QMutexLocker locker(&d->mutex); + + if (d->type == QNetworkConfiguration::ServiceNetwork || + d->type == QNetworkConfiguration::UserChoice) + return QString(); + + switch (d->bearerType) { + case BearerUnknown: + return d->bearerTypeName(); + case BearerEthernet: + return QLatin1String("Ethernet"); + case BearerWLAN: + return QLatin1String("WLAN"); + case Bearer2G: + return QLatin1String("2G"); + case BearerCDMA2000: + return QLatin1String("CDMA2000"); + case BearerWCDMA: + return QLatin1String("WCDMA"); + case BearerHSPA: + return QLatin1String("HSPA"); + case BearerBluetooth: + return QLatin1String("Bluetooth"); + case BearerWiMAX: + return QLatin1String("WiMAX"); + } + + return QLatin1String("Unknown"); } QT_END_NAMESPACE diff --git a/src/network/bearer/qnetworkconfiguration.h b/src/network/bearer/qnetworkconfiguration.h index dce39eb..d9d36fd 100644 --- a/src/network/bearer/qnetworkconfiguration.h +++ b/src/network/bearer/qnetworkconfiguration.h @@ -103,10 +103,27 @@ public: Q_DECLARE_FLAGS(StateFlags, StateFlag) + enum BearerType { + BearerUnknown, + BearerEthernet, + BearerWLAN, + Bearer2G, + BearerCDMA2000, + BearerWCDMA, + BearerHSPA, + BearerBluetooth, + BearerWiMAX + }; + StateFlags state() const; Type type() const; Purpose purpose() const; - QString bearerName() const; + + // Required to maintain source compatibility with Qt Mobility. + QT_DEPRECATED inline QString bearerName() const { return bearerTypeName(); } + BearerType bearerType() const; + QString bearerTypeName() const; + QString identifier() const; bool isRoamingAvailable() const; QList<QNetworkConfiguration> children() const; diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index 966dfb2..2b0bbf6 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -68,6 +68,7 @@ public: QNetworkConfigurationPrivate () : mutex(QMutex::Recursive), type(QNetworkConfiguration::Invalid), purpose(QNetworkConfiguration::UnknownPurpose), + bearerType(QNetworkConfiguration::BearerUnknown), isValid(false), roamingSupported(false) { } @@ -78,24 +79,22 @@ public: serviceNetworkMembers.clear(); } - virtual QString bearerName() const + virtual QString bearerTypeName() const { - QMutexLocker locker(&mutex); - - return bearer; + return QLatin1String("Unknown"); } QMap<unsigned int, QNetworkConfigurationPrivatePointer> serviceNetworkMembers; mutable QMutex mutex; - QString bearer; QString name; QString id; QNetworkConfiguration::StateFlags state; QNetworkConfiguration::Type type; QNetworkConfiguration::Purpose purpose; + QNetworkConfiguration::BearerType bearerType; bool isValid; bool roamingSupported; diff --git a/src/plugins/bearer/connman/qconnmanengine.cpp b/src/plugins/bearer/connman/qconnmanengine.cpp index 8775623..a1e7d37 100644 --- a/src/plugins/bearer/connman/qconnmanengine.cpp +++ b/src/plugins/bearer/connman/qconnmanengine.cpp @@ -125,7 +125,7 @@ QList<QNetworkConfigurationPrivate *> QConnmanEngine::getConfigurations() config->type = cpPriv->type; config->roamingSupported = cpPriv->roamingSupported; config->purpose = cpPriv->purpose; - config->bearer = cpPriv->bearer; + config->bearerType = cpPriv->bearerType; fetchedConfigurations.append(config); } @@ -149,7 +149,6 @@ void QConnmanEngine::getNetworkListing() } - void QConnmanEngine::doRequestUpdate() { connmanManager->requestScan(""); @@ -169,30 +168,6 @@ bool QConnmanEngine::hasIdentifier(const QString &id) return accessPointConfigurations.contains(id); } -QString QConnmanEngine::bearerName(const QString &id) -{ - QMutexLocker locker(&mutex); - QConnmanServiceInterface serv(serviceFromId(id)); - QString connectionType = serv.getType(); - - if (connectionType == "ethernet") - return QLatin1String("Ethernet"); - else if (connectionType == "wifi") - return QLatin1String("WLAN"); - else if (connectionType == "cellular") { - QString mode = serv.getMode(); - if(mode == "gprs" || mode == "edge") { - return QLatin1String("2G"); - } else if(mode == "umts") { - return QLatin1String("WCDMA"); - } - } - else if (connectionType == "wimax") - return QLatin1String("WIMAX"); - - return QString(); -} - void QConnmanEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); @@ -336,6 +311,9 @@ QString QConnmanEngine::getServiceForNetwork(const QString &netPath) QMutexLocker locker(&mutex); QConnmanNetworkInterface network(netPath, this); foreach(QString service,connmanManager->getServices()) { + + QString devicePath = netPath.section("/",5,5); + QConnmanServiceInterface serv(service,this); if(serv.getName() == network.getName() && network.getSignalStrength() == serv.getSignalStrength()) { @@ -378,17 +356,6 @@ void QConnmanEngine::propertyChangedContext(const QString &path,const QString &i technologies.insert(listPath, tech); } } - - foreach(const QString old, oldtech.keys()) { - if(!newlist.contains(old)) { - QConnmanTechnologyInterface *tech = oldtech.value(old); - disconnect(tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), - this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); - - technologies.remove(old); - getNetworkListing(); - } - } } } if(item == "State") { @@ -409,15 +376,21 @@ void QConnmanEngine::servicePropertyChangedContext(const QString &path,const QSt } } -void QConnmanEngine::networkPropertyChangedContext(const QString &/*path*/,const QString &/*item*/, const QDBusVariant &/*value*/) +void QConnmanEngine::networkPropertyChangedContext(const QString &path,const QString &item, const QDBusVariant &value) { QMutexLocker locker(&mutex); +// qDebug() << __FUNCTION__ << path << item << value.variant(); } void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const QString &item,const QDBusVariant &value) { +// qDebug() << __FUNCTION__ << devpath << item << value.variant(); QMutexLocker locker(&mutex); if(item == "Networks") { + + QConnmanNetworkInterface network(devpath, this); + + QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant()); QStringList remainingNetworks = qdbus_cast<QStringList>(arg); QString devicetype; @@ -455,6 +428,7 @@ void QConnmanEngine::devicePropertyChangedContext(const QString &devpath,const Q void QConnmanEngine::technologyPropertyChangedContext(const QString & path, const QString &item, const QDBusVariant &value) { +// qDebug() << __FUNCTION__ << path << item << value.variant(); if(item == "Devices") { QDBusArgument arg = qvariant_cast<QDBusArgument>(value.variant()); QStringList list = qdbus_cast<QStringList>(arg); @@ -476,6 +450,12 @@ void QConnmanEngine::technologyPropertyChangedContext(const QString & path, cons } if(value.variant().toString() == "offline") { deviceMap.remove(path); + QConnmanTechnologyInterface tech(path); + disconnect(&tech,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), + this,SLOT(technologyPropertyChangedContext(QString,QString,QDBusVariant))); + + technologies.remove(path); + getNetworkListing(); } } } @@ -538,25 +518,25 @@ QNetworkConfiguration::StateFlags QConnmanEngine::getStateForService(const QStri return flag; } -QString QConnmanEngine::typeToBearer(const QString &type) +QNetworkConfiguration::BearerType QConnmanEngine::typeToBearer(const QString &type) { - QMutexLocker locker(&mutex); - if(type == "wifi") - return "WLAN"; - if(type == "ethernet") - return "Ethernet"; - if(type == "bluetooth") - return "Bluetooth"; - if(type == "cellular") { - return "Cellular"; + if (type == "wifi") + return QNetworkConfiguration::BearerWLAN; + if (type == "ethernet") + return QNetworkConfiguration::BearerEthernet; + if (type == "bluetooth") + return QNetworkConfiguration::BearerBluetooth; + if (type == "cellular") { + return QNetworkConfiguration::Bearer2G; // not handled: CDMA2000 HSPA } - if(type == "wimax") - return "WiMax"; + if (type == "wimax") + return QNetworkConfiguration::BearerWiMAX; + // if(type == "gps") // if(type == "vpn") - return "Unknown"; + return QNetworkConfiguration::BearerUnknown; } void QConnmanEngine::removeConfiguration(const QString &id) @@ -612,15 +592,35 @@ void QConnmanEngine::addServiceConfiguration(const QString &servicePath) QString networkName = serv->getName(); - if(serv->getType() == "Cellular") { + if(serv->getType() == "cellular") { networkName = serv->getAPN(); + if(networkName.isEmpty()) { + networkName = serv->getName(); + } } cpPriv->name = networkName; cpPriv->isValid = true; cpPriv->id = id; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->bearer = bearerName(id); + + + const QString connectionType = serv->getType(); + if (connectionType == "ethernet") { + cpPriv->bearerType = QNetworkConfiguration::BearerEthernet; + } else if (connectionType == "wifi") { + cpPriv->bearerType = QNetworkConfiguration::BearerWLAN; + } else if (connectionType == "cellular") { + const QString mode = serv->getMode(); + if (mode == "gprs" || mode == "edge") + cpPriv->bearerType = QNetworkConfiguration::Bearer2G; + else if (mode == "umts") + cpPriv->bearerType = QNetworkConfiguration::BearerWCDMA; + } else if (connectionType == "wimax") { + cpPriv->bearerType = QNetworkConfiguration::BearerWiMAX; + } else { + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; + } if(serv->getSecurity() == "none") { cpPriv->purpose = QNetworkConfiguration::PublicPurpose; @@ -650,6 +650,9 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) { QMutexLocker locker(&mutex); + if(networkPath.isNull()) + return; + QConnmanNetworkInterface *network; network = new QConnmanNetworkInterface(networkPath, this); QString servicePath = getServiceForNetwork(networkPath); @@ -665,9 +668,10 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) serv = new QConnmanServiceInterface(servicePath,this); connect(serv,SIGNAL(propertyChangedContext(QString,QString,QDBusVariant)), this,SLOT(servicePropertyChangedContext(QString,QString, QDBusVariant))); + } - if (!accessPointConfigurations.contains(id)) { + if (!id.isEmpty() && !accessPointConfigurations.contains(id)) { knownNetworks[device.getType()].append(networkPath); @@ -683,31 +687,38 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) if(networkName.isEmpty()) networkName = "Hidden Network"; - QString bearerName; + + QNetworkConfiguration::BearerType bearerType; if(servicePath.isEmpty()) { QString devicePath = networkPath.section("/",0,5); + QConnmanDeviceInterface device(devicePath,this); - bearerName = typeToBearer(device.getType()); + bearerType = typeToBearer(device.getType()); } else { - bearerName = typeToBearer(serv->getType()); + bearerType = typeToBearer(serv->getType()); } - if(bearerName == "Cellular") { + if (bearerType == QNetworkConfiguration::Bearer2G) { QString mode = serv->getMode(); - if(mode == "gprs" || mode == "edge") { - bearerName = "2G"; - } else if(mode == "umts") { - bearerName = "WCDMA"; + if (mode == "gprs" || mode == "edge") { + bearerType = QNetworkConfiguration::Bearer2G; + } else if (mode == "umts") { + bearerType = QNetworkConfiguration::BearerWCDMA; + } + if(servicePath.isEmpty()) { + networkName = serv->getAPN(); + if(networkName.isEmpty()) { + networkName = serv->getName(); + } } - networkName = serv->getAPN(); } cpPriv->name = networkName; cpPriv->isValid = true; cpPriv->id = id; cpPriv->type = QNetworkConfiguration::InternetAccessPoint; - cpPriv->bearer = bearerName; + cpPriv->bearerType = bearerType; if(network->getWifiSecurity() == "none") { cpPriv->purpose = QNetworkConfiguration::PublicPurpose; @@ -729,7 +740,9 @@ void QConnmanEngine::addNetworkConfiguration(const QString &networkPath) emit configurationAdded(ptr); locker.relock(); emit updateCompleted(); - } + } /*else { + qDebug() << "Not added~~~~~~~~~~~"; + }*/ } bool QConnmanEngine::requiresPolling() const diff --git a/src/plugins/bearer/connman/qconnmanengine.h b/src/plugins/bearer/connman/qconnmanengine.h index 0f6dc1c..2ee6da5 100644 --- a/src/plugins/bearer/connman/qconnmanengine.h +++ b/src/plugins/bearer/connman/qconnmanengine.h @@ -80,8 +80,6 @@ public: virtual QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - virtual QString bearerName(const QString &id); - virtual void connectToId(const QString &id); virtual void disconnectFromId(const QString &id); @@ -125,7 +123,7 @@ private: QString networkFromId(const QString &id); QNetworkConfiguration::StateFlags getStateForService(const QString &service); - QString typeToBearer(const QString &type); + QNetworkConfiguration::BearerType typeToBearer(const QString &type); void removeConfiguration(const QString &servicePath); void addServiceConfiguration(const QString &servicePath); diff --git a/src/plugins/bearer/connman/qconnmanservice_linux.cpp b/src/plugins/bearer/connman/qconnmanservice_linux.cpp index b20e7c1..eb88317 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux.cpp +++ b/src/plugins/bearer/connman/qconnmanservice_linux.cpp @@ -53,6 +53,8 @@ #include "qconnmanservice_linux_p.h" +#ifndef QT_NO_BEARERMANAGEMENT +#ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE static QDBusConnection dbusConnection = QDBusConnection::systemBus(); @@ -129,8 +131,10 @@ QVariant QConnmanManagerInterface::getProperty(const QString &property) QVariantMap QConnmanManagerInterface::getProperties() { - QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties")); - return reply.value(); + if(this->isValid()) { + QDBusReply<QVariantMap > reply = this->call(QLatin1String("GetProperties")); + return reply.value(); + } else return QVariantMap(); } QString QConnmanManagerInterface::getState() @@ -551,8 +555,12 @@ void QConnmanServiceInterface::disconnectNotify(const char *signal) QVariantMap QConnmanServiceInterface::getProperties() { - QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties")); - return reply.value(); + if(this->isValid()) { + QDBusReply<QVariantMap> reply = this->call(QLatin1String("GetProperties")); + return reply.value(); + } + else + return QVariantMap(); } QVariant QConnmanServiceInterface::getProperty(const QString &property) @@ -725,6 +733,99 @@ QVariantMap QConnmanServiceInterface::getEthernet() return qdbus_cast<QVariantMap >(var); } +QString QConnmanServiceInterface::getMethod() +{ + QVariant var; + QVariantMap map = getEthernet(); + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Method") { + return it.value().toString(); + } + } + return QString(); +} + +QString QConnmanServiceInterface::getInterface() +{ + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Interface") { + return it.value().toString(); + } + } + + return QString(); +} + +QString QConnmanServiceInterface::getMacAddress() +{ + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Address") { + return it.value().toString(); + } + } + return QString(); +} + +quint16 QConnmanServiceInterface::getMtu() +{ + quint16 mtu=0; + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "MTU") { + return it.value().toUInt(); + } + } + return mtu; +} + +quint16 QConnmanServiceInterface::getSpeed() +{ + quint16 speed=0; + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Speed") { + return it.value().toUInt(); + } + } + return speed; +} + +QString QConnmanServiceInterface::getDuplex() +{ + QVariant var; + QVariantMap map = getEthernet(); + + QMapIterator<QString,QVariant> it(map); + while(it.hasNext()) { + it.next(); + if(it.key() == "Duplex") { + return it.value().toString(); + } + } + return QString(); +} + + bool QConnmanServiceInterface::isOfflineMode() { QVariant var = getProperty("OfflineMode"); @@ -1070,3 +1171,7 @@ void QConnmanDBusHelper::propertyChanged(const QString &item, const QDBusVariant ///////////////// QT_END_NAMESPACE + +#endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT + diff --git a/src/plugins/bearer/connman/qconnmanservice_linux_p.h b/src/plugins/bearer/connman/qconnmanservice_linux_p.h index 35e3f3d..a2b1e73 100644 --- a/src/plugins/bearer/connman/qconnmanservice_linux_p.h +++ b/src/plugins/bearer/connman/qconnmanservice_linux_p.h @@ -65,6 +65,9 @@ #include <QtDBus/QDBusContext> #include <QMap> +#ifndef QT_NO_BEARERMANAGEMENT +#ifndef QT_NO_DBUS + #ifndef __CONNMAN_DBUS_H #define CONNMAN_SERVICE "org.moblin.connman" @@ -249,6 +252,13 @@ public: QVariantMap getProxy(); QVariantMap getEthernet(); + QString getMethod(); + QString getInterface(); + QString getMacAddress(); + quint16 getMtu(); + quint16 getSpeed(); + QString getDuplex(); + bool isOfflineMode(); QStringList getServices(); @@ -378,4 +388,7 @@ Q_SIGNALS: QT_END_NAMESPACE +#endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT + #endif //QCONNMANSERVICE_H diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 4d90648..56da66a 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -68,8 +68,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index 6ba9504..131f36d 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -264,7 +264,7 @@ QStringList QScanThread::foundNetwork(const QString &id, const QString &name, co ptr->id = id; ptr->state = state; ptr->type = QNetworkConfiguration::InternetAccessPoint; - ptr->bearer = QLatin1String("WLAN"); + ptr->bearerType = QNetworkConfiguration::BearerWLAN; ptr->purpose = purpose; fetchedConfigurations.append( ptr); @@ -789,8 +789,8 @@ void QCoreWlanEngine::networksChanged() changed = true; } - if (ptr->bearer != cpPriv->bearer) { - ptr->bearer = cpPriv->bearer; + if (ptr->bearerType != cpPriv->bearerType) { + ptr->bearerType = cpPriv->bearerType; changed = true; } diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index 652fe4a..fad3ae8 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -69,7 +69,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_NETWORKINTERFACE -static QString qGetInterfaceType(const QString &interface) +static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface) { #ifdef Q_OS_WIN32 unsigned long oid; @@ -78,10 +78,10 @@ static QString qGetInterfaceType(const QString &interface) NDIS_MEDIUM medium; NDIS_PHYSICAL_MEDIUM physicalMedium; - HANDLE handle = CreateFile((TCHAR *)QString("\\\\.\\%1").arg(interface).utf16(), 0, + HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (handle == INVALID_HANDLE_VALUE) - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; oid = OID_GEN_MEDIA_SUPPORTED; bytesWritten = 0; @@ -89,7 +89,7 @@ static QString qGetInterfaceType(const QString &interface) &medium, sizeof(medium), &bytesWritten, 0); if (!result) { CloseHandle(handle); - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } oid = OID_GEN_PHYSICAL_MEDIUM; @@ -100,9 +100,9 @@ static QString qGetInterfaceType(const QString &interface) CloseHandle(handle); if (medium == NdisMedium802_3) - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; else - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } CloseHandle(handle); @@ -110,16 +110,16 @@ static QString qGetInterfaceType(const QString &interface) if (medium == NdisMedium802_3) { switch (physicalMedium) { case NdisPhysicalMediumWirelessLan: - return QLatin1String("WLAN"); + return QNetworkConfiguration::BearerWLAN; case NdisPhysicalMediumBluetooth: - return QLatin1String("Bluetooth"); + return QNetworkConfiguration::BearerBluetooth; case NdisPhysicalMediumWiMax: - return QLatin1String("WiMAX"); + return QNetworkConfiguration::BearerWiMAX; default: #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << "Physical Medium" << physicalMedium; #endif - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; } } @@ -135,12 +135,12 @@ static QString qGetInterfaceType(const QString &interface) close(sock); if (result >= 0 && request.ifr_hwaddr.sa_family == ARPHRD_ETHER) - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; #else Q_UNUSED(interface); #endif - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } #endif @@ -214,7 +214,7 @@ void QGenericEngine::doRequestUpdate() continue; // ignore WLAN interface handled in separate engine - if (qGetInterfaceType(interface.name()) == QLatin1String("WLAN")) + if (qGetInterfaceType(interface.name()) == QNetworkConfiguration::BearerWLAN) continue; uint identifier; @@ -277,7 +277,7 @@ void QGenericEngine::doRequestUpdate() ptr->id = id; ptr->state = state; ptr->type = QNetworkConfiguration::InternetAccessPoint; - ptr->bearer = qGetInterfaceType(interface.name()); + ptr->bearerType = qGetInterfaceType(interface.name()); accessPointConfigurations.insert(id, ptr); configurationInterface.insert(id, interface.name()); diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index cdbbc9d..021b35b 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -65,8 +65,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index 0083380..0900329 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -60,16 +60,11 @@ IcdNetworkConfigurationPrivate::~IcdNetworkConfigurationPrivate() { } -QString IcdNetworkConfigurationPrivate::bearerName() const +QString IcdNetworkConfigurationPrivate::bearerTypeName() const { - if (iap_type == QLatin1String("WLAN_INFRA") || - iap_type == QLatin1String("WLAN_ADHOC")) { - return QLatin1String("WLAN"); - } else if (iap_type == QLatin1String("GPRS")) { - return QLatin1String("HSPA"); - } else { - return iap_type; - } + QMutexLocker locker(&mutex); + + return iap_type; } /* The IapAddTimer is a helper class that makes sure we update @@ -222,7 +217,7 @@ void IapMonitor::iapRemoved(const QString &iap_id) } QIcdEngine::QIcdEngine(QObject *parent) -: QBearerEngine(parent), iapMonitor(new IapMonitor), m_dbusInterface(0), +: QBearerEngine(parent), iapMonitor(0), m_dbusInterface(0), firstUpdate(true), m_scanGoingOn(false) { } @@ -263,6 +258,7 @@ void QIcdEngine::initialize() startListeningStateSignalsForAllConnections(); /* Turn on IAP add/remove monitoring */ + iapMonitor = new IapMonitor; iapMonitor->setup(this); /* We create a default configuration which is a pseudo config */ @@ -400,6 +396,7 @@ void QIcdEngine::addConfiguration(QString& iap_id) ptr->mutex.lock(); ptr->id = iap_id; toIcdConfig(ptr)->iap_type = iap_type; + ptr->bearerType = bearerTypeFromIapType(iap_type); toIcdConfig(ptr)->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); toIcdConfig(ptr)->network_id = ssid; toIcdConfig(ptr)->service_id = saved_iap.value("service_id").toString(); @@ -424,6 +421,7 @@ void QIcdEngine::addConfiguration(QString& iap_id) cpPriv->isValid = true; cpPriv->id = iap_id; cpPriv->iap_type = iap_type; + cpPriv->bearerType = bearerTypeFromIapType(iap_type); cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); cpPriv->service_id = saved_iap.value("service_id").toString(); cpPriv->service_type = saved_iap.value("service_type").toString(); @@ -480,6 +478,7 @@ void QIcdEngine::addConfiguration(QString& iap_id) ptr->isValid = true; if (toIcdConfig(ptr)->iap_type != iap_type) { toIcdConfig(ptr)->iap_type = iap_type; + ptr->bearerType = bearerTypeFromIapType(iap_type); update_needed = true; } if (iap_type.startsWith(QLatin1String("WLAN"))) { @@ -522,8 +521,6 @@ void QIcdEngine::addConfiguration(QString& iap_id) void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned) { - QMutexLocker locker(&mutex); - /* Contains all known iap_ids from storage */ QList<QString> knownConfigs = accessPointConfigurations.keys(); @@ -580,6 +577,7 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned) cpPriv->network_id = ssid; cpPriv->network_attrs = getNetworkAttrs(true, iap_id, iap_type, QString()); cpPriv->iap_type = iap_type; + cpPriv->bearerType = bearerTypeFromIapType(iap_type); cpPriv->service_id = saved_ap.value("service_id").toString(); cpPriv->service_type = saved_ap.value("service_type").toString(); cpPriv->type = QNetworkConfiguration::InternetAccessPoint; @@ -588,9 +586,9 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned) QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(iap_id, ptr); - locker.unlock(); + mutex.unlock(); emit configurationAdded(ptr); - locker.relock(); + mutex.lock(); #ifdef BEARER_MANAGEMENT_DEBUG qDebug("IAP: %s, name: %s, ssid: %s, added to known list", @@ -643,9 +641,9 @@ void QIcdEngine::doRequestUpdate(QList<Maemo::IcdScanResult> scanned) ptr->mutex.unlock(); if (changed) { - locker.unlock(); + mutex.unlock(); emit configurationChanged(ptr); - locker.relock(); + mutex.lock(); } if (!ap.scan.network_type.startsWith(QLatin1String("WLAN"))) @@ -688,6 +686,7 @@ rescan_list: cpPriv->id = scanned_ssid.data(); // Note: id is now ssid, it should be set to IAP id if the IAP is saved cpPriv->network_id = scanned_ssid; cpPriv->iap_type = ap.scan.network_type; + cpPriv->bearerType = bearerTypeFromIapType(cpPriv->iap_type); cpPriv->network_attrs = ap.scan.network_attrs; cpPriv->service_id = ap.scan.service_id; cpPriv->service_type = ap.scan.service_type; @@ -703,9 +702,9 @@ rescan_list: QNetworkConfigurationPrivatePointer ptr(cpPriv); accessPointConfigurations.insert(ptr->id, ptr); - locker.unlock(); + mutex.unlock(); emit configurationAdded(ptr); - locker.relock(); + mutex.lock(); } else { knownConfigs.removeOne(scanned_ssid); } @@ -733,9 +732,9 @@ rescan_list: ptr->state = QNetworkConfiguration::Defined; configLocker.unlock(); - locker.unlock(); + mutex.unlock(); emit configurationChanged(ptr); - locker.relock(); + mutex.lock(); } } } @@ -744,9 +743,9 @@ rescan_list: foreach (const QString &oldIface, knownConfigs) { QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(oldIface); if (ptr) { - locker.unlock(); + mutex.unlock(); emit configurationRemoved(ptr); - locker.relock(); + mutex.lock(); //if we would have SNAP support we would have to remove the references //from existing ServiceNetworks to the removed access point configuration } @@ -762,9 +761,9 @@ rescan_list: } if (!firstUpdate) { - locker.unlock(); + mutex.unlock(); emit updateCompleted(); - locker.relock(); + mutex.lock(); } if (firstUpdate) @@ -781,8 +780,6 @@ QNetworkConfigurationPrivatePointer QIcdEngine::defaultConfiguration() void QIcdEngine::startListeningStateSignalsForAllConnections() { - QMutexLocker locker(&mutex); - // Start listening ICD_DBUS_API_STATE_SIG signals m_dbusInterface->connection().connect(ICD_DBUS_API_INTERFACE, ICD_DBUS_API_PATH, @@ -906,8 +903,6 @@ void QIcdEngine::requestUpdate() void QIcdEngine::cancelAsyncConfigurationUpdate() { - QMutexLocker locker(&mutex); - if (!m_scanGoingOn) { return; } @@ -947,7 +942,9 @@ void QIcdEngine::asyncUpdateConfigurationsSlot(QDBusMessage msg) if (icd_scan_status == ICD_SCAN_COMPLETE) { m_typesToBeScanned.removeOne(arguments[6].toString()); if (!m_typesToBeScanned.count()) { + locker.unlock(); finishAsyncConfigurationUpdate(); + locker.relock(); } } else { Maemo::IcdScanResult scanResult; @@ -977,7 +974,8 @@ void QIcdEngine::cleanup() m_scanTimer.stop(); m_dbusInterface->call(ICD_DBUS_API_SCAN_CANCEL); } - iapMonitor->cleanup(); + if (iapMonitor) + iapMonitor->cleanup(); } bool QIcdEngine::hasIdentifier(const QString &id) diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h index 1b291eb..a768d84 100644 --- a/src/plugins/bearer/icd/qicdengine.h +++ b/src/plugins/bearer/icd/qicdengine.h @@ -54,13 +54,25 @@ class QNetworkConfigurationPrivate; class IapMonitor; class QDBusInterface; +inline QNetworkConfiguration::BearerType bearerTypeFromIapType(const QString &iapType) +{ + if (iapType == QLatin1String("WLAN_INFRA") || + iapType == QLatin1String("WLAN_ADHOC")) { + return QNetworkConfiguration::BearerWLAN; + } else if (iapType == QLatin1String("GPRS")) { + return QNetworkConfiguration::BearerHSPA; + } else { + return QNetworkConfiguration::BearerUnknown; + } +} + class IcdNetworkConfigurationPrivate : public QNetworkConfigurationPrivate { public: IcdNetworkConfigurationPrivate(); ~IcdNetworkConfigurationPrivate(); - QString bearerName() const; + virtual QString bearerTypeName() const; // In Maemo the id field (defined in QNetworkConfigurationPrivate) // is the IAP id (which typically is UUID) @@ -114,13 +126,13 @@ public: QMutexLocker locker(&mutex); accessPointConfigurations.insert(ptr->id, ptr); + + locker.unlock(); emit configurationAdded(ptr); } inline void changedSessionConfiguration(QNetworkConfigurationPrivatePointer ptr) { - QMutexLocker locker(&mutex); - emit configurationChanged(ptr); } @@ -132,14 +144,14 @@ Q_SIGNALS: void iapStateChanged(const QString& iapid, uint icd_connection_state); private Q_SLOTS: - void doRequestUpdate(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>()); - void cancelAsyncConfigurationUpdate(); void finishAsyncConfigurationUpdate(); void asyncUpdateConfigurationsSlot(QDBusMessage msg); void connectionStateSignalsSlot(QDBusMessage msg); private: void startListeningStateSignalsForAllConnections(); + void doRequestUpdate(QList<Maemo::IcdScanResult> scanned = QList<Maemo::IcdScanResult>()); + void cancelAsyncConfigurationUpdate(); private: IapMonitor *iapMonitor; diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index e8e5183..2583b28 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -318,6 +318,7 @@ QNetworkConfiguration& QNetworkSessionPrivateImpl::copyConfig(QNetworkConfigurat cpPriv->purpose = fromPriv->purpose; cpPriv->network_id = fromPriv->network_id; cpPriv->iap_type = fromPriv->iap_type; + cpPriv->bearerType = fromPriv->bearerType; cpPriv->network_attrs = fromPriv->network_attrs; cpPriv->service_type = fromPriv->service_type; cpPriv->service_id = fromPriv->service_id; @@ -443,6 +444,7 @@ void QNetworkSessionPrivateImpl::syncStateWithInterface() ptr->id = toIcdConfig(ptr)->network_id; toIcdConfig(ptr)->network_attrs = state_results.first().params.network_attrs; toIcdConfig(ptr)->iap_type = state_results.first().params.network_type; + ptr->bearerType = bearerTypeFromIapType(toIcdConfig(ptr)->iap_type); toIcdConfig(ptr)->service_type = state_results.first().params.service_type; toIcdConfig(ptr)->service_id = state_results.first().params.service_id; toIcdConfig(ptr)->service_attrs = state_results.first().params.service_attrs; @@ -819,6 +821,7 @@ void QNetworkSessionPrivateImpl::stateChange(const QDBusMessage& rep) icdConfig->name = name; icdConfig->iap_type = rep.arguments().at(3).toString(); // connect_result.connect.network_type; + icdConfig->bearerType = bearerTypeFromIapType(icdConfig->iap_type); icdConfig->isValid = true; icdConfig->state = QNetworkConfiguration::Active; icdConfig->type = QNetworkConfiguration::InternetAccessPoint; diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 1a55402..ba8297e 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -206,7 +206,7 @@ void QNativeWifiEngine::scanComplete() ptr->id = id; ptr->state = state; ptr->type = QNetworkConfiguration::InternetAccessPoint; - ptr->bearer = QLatin1String("WLAN"); + ptr->bearerType = QNetworkConfiguration::BearerWLAN; accessPointConfigurations.insert(id, ptr); @@ -350,11 +350,6 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id) return false; } -/*QString QNativeWifiEngine::bearerName(const QString &) -{ - return QLatin1String("WLAN"); -}*/ - void QNativeWifiEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 0e9576b..dccf2e2 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -75,8 +75,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - //QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 3ebc356..29445ce 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -104,14 +104,23 @@ void QNetworkManagerEngine::initialize() QMutexLocker locker(&mutex); // Get current list of access points. - foreach (const QDBusObjectPath &devicePath, interface->getDevices()) + foreach (const QDBusObjectPath &devicePath, interface->getDevices()) { + locker.unlock(); deviceAdded(devicePath); + locker.relock(); + } // Get connections. - foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) + foreach (const QDBusObjectPath &settingsPath, systemSettings->listConnections()) { + locker.unlock(); newConnection(settingsPath, systemSettings); - foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) + locker.relock(); + } + foreach (const QDBusObjectPath &settingsPath, userSettings->listConnections()) { + locker.unlock(); newConnection(settingsPath, userSettings); + locker.relock(); + } // Get active connections. foreach (const QDBusObjectPath &acPath, interface->activeConnections()) { @@ -132,11 +141,6 @@ bool QNetworkManagerEngine::networkManagerAvailable() const return interface->isValid(); } -void QNetworkManagerEngine::doRequestUpdate() -{ - emit updateCompleted(); -} - QString QNetworkManagerEngine::getInterfaceFromId(const QString &id) { QMutexLocker locker(&mutex); @@ -181,30 +185,6 @@ bool QNetworkManagerEngine::hasIdentifier(const QString &id) return false; } -QString QNetworkManagerEngine::bearerName(const QString &id) -{ - QMutexLocker locker(&mutex); - - QNetworkManagerSettingsConnection *connection = connectionFromId(id); - - if (!connection) - return QString(); - - QNmSettingsMap map = connection->getSettings(); - const QString connectionType = map.value("connection").value("type").toString(); - - if (connectionType == "802-3-ethernet") - return QLatin1String("Ethernet"); - else if (connectionType == "802-11-wireless") - return QLatin1String("WLAN"); - else if (connectionType == "gsm") - return QLatin1String("2G"); - else if (connectionType == "cdma") - return QLatin1String("CDMA2000"); - else - return QString(); -} - void QNetworkManagerEngine::connectToId(const QString &id) { QMutexLocker locker(&mutex); @@ -257,9 +237,7 @@ void QNetworkManagerEngine::disconnectFromId(const QString &id) void QNetworkManagerEngine::requestUpdate() { - QMutexLocker locker(&mutex); - - QTimer::singleShot(0, this, SLOT(doRequestUpdate())); + QMetaObject::invokeMethod(this, "updateCompleted", Qt::QueuedConnection); } void QNetworkManagerEngine::interfacePropertiesChanged(const QString &path, @@ -385,13 +363,10 @@ void QNetworkManagerEngine::devicePropertiesChanged(const QString &path, void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) { - QMutexLocker locker(&mutex); - QNetworkManagerInterfaceDevice device(path.path()); if (device.deviceType() == DEVICE_TYPE_802_11_WIRELESS) { QNetworkManagerInterfaceDeviceWireless *wirelessDevice = new QNetworkManagerInterfaceDeviceWireless(device.connectionInterface()->path()); - wirelessDevices.insert(path.path(), wirelessDevice); wirelessDevice->setConnections(); connect(wirelessDevice, SIGNAL(accessPointAdded(QString,QDBusObjectPath)), @@ -403,6 +378,10 @@ void QNetworkManagerEngine::deviceAdded(const QDBusObjectPath &path) foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints()) newAccessPoint(QString(), apPath); + + mutex.lock(); + wirelessDevices.insert(path.path(), wirelessDevice); + mutex.unlock(); } } @@ -611,7 +590,7 @@ void QNetworkManagerEngine::newAccessPoint(const QString &path, const QDBusObjec ptr->purpose = QNetworkConfiguration::PublicPurpose; } ptr->state = QNetworkConfiguration::Undefined; - ptr->bearer = QLatin1String("WLAN"); + ptr->bearerType = QNetworkConfiguration::BearerWLAN; accessPointConfigurations.insert(ptr->id, ptr); @@ -709,8 +688,6 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri const QString &settingsPath, const QNmSettingsMap &map) { - QMutexLocker locker(&mutex); - QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate; cpPriv->name = map.value("connection").value("id").toString(); cpPriv->isValid = true; @@ -724,7 +701,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri const QString connectionType = map.value("connection").value("type").toString(); if (connectionType == QLatin1String("802-3-ethernet")) { - cpPriv->bearer = QLatin1String("Ethernet"); + cpPriv->bearerType = QNetworkConfiguration::BearerEthernet; cpPriv->purpose = QNetworkConfiguration::PublicPurpose; foreach (const QDBusObjectPath &devicePath, interface->getDevices()) { @@ -739,7 +716,7 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri } } } else if (connectionType == QLatin1String("802-11-wireless")) { - cpPriv->bearer = QLatin1String("WLAN"); + cpPriv->bearerType = QNetworkConfiguration::BearerWLAN; const QString connectionSsid = map.value("802-11-wireless").value("ssid").toString(); const QString connectionSecurity = map.value("802-11-wireless").value("security").toString(); @@ -759,17 +736,17 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(accessPointId); - locker.unlock(); + mutex.unlock(); emit configurationRemoved(ptr); - locker.relock(); + mutex.lock(); } break; } } } else if (connectionType == "gsm") { - cpPriv->bearer = QLatin1String("2G"); + cpPriv->bearerType = QNetworkConfiguration::Bearer2G; } else if (connectionType == "cdma") { - cpPriv->bearer = QLatin1String("CDMA2000"); + cpPriv->bearerType = QNetworkConfiguration::BearerCDMA2000; } return cpPriv; @@ -777,8 +754,6 @@ QNetworkConfigurationPrivate *QNetworkManagerEngine::parseConnection(const QStri QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const { - QMutexLocker locker(&mutex); - for (int i = 0; i < connections.count(); ++i) { QNetworkManagerSettingsConnection *connection = connections.at(i); const QString service = connection->connectionInterface()->service(); diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 8e95a2c..78ebb0a 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -78,8 +78,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); @@ -118,8 +116,6 @@ private Q_SLOTS: void removeAccessPoint(const QString &path, const QDBusObjectPath &objectPath); void updateAccessPoint(const QMap<QString, QVariant> &map); - void doRequestUpdate(); - private: QNetworkConfigurationPrivate *parseConnection(const QString &service, const QString &settingsPath, diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp index 31a9aa1..f47c97c 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp @@ -718,146 +718,80 @@ QNmSettingsMap QNetworkManagerSettingsConnection::getSettings() NMDeviceType QNetworkManagerSettingsConnection::getType() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("type")); - while (ii != innerMap.end() && ii.key() == QLatin1String("type")) { - QString devType = ii.value().toString(); - if (devType == QLatin1String("802-3-ethernet")) { - return DEVICE_TYPE_802_3_ETHERNET; - } - if (devType == QLatin1String("802-11-wireless")) { - return DEVICE_TYPE_802_11_WIRELESS; - } - ii++; - } - i++; - } - return DEVICE_TYPE_UNKNOWN; + const QString devType = + d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("type")).toString(); + + if (devType == QLatin1String("802-3-ethernet")) + return DEVICE_TYPE_802_3_ETHERNET; + else if (devType == QLatin1String("802-11-wireless")) + return DEVICE_TYPE_802_11_WIRELESS; + else + return DEVICE_TYPE_UNKNOWN; } bool QNetworkManagerSettingsConnection::isAutoConnect() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("autoconnect")); - while (ii != innerMap.end() && ii.key() == QLatin1String("autoconnect")) { - return ii.value().toBool(); - ii++; - } - i++; - } - return true; //default networkmanager is autoconnect + const QVariant autoConnect = + d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("autoconnect")); + + // NetworkManager default is to auto connect + if (!autoConnect.isValid()) + return true; + + return autoConnect.toBool(); } quint64 QNetworkManagerSettingsConnection::getTimestamp() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("timestamp")); - while (ii != innerMap.end() && ii.key() == QLatin1String("timestamp")) { - return ii.value().toUInt(); - ii++; - } - i++; - } - return 0; + qDebug() << d->settingsMap.value(QLatin1String("connection")); + + return d->settingsMap.value(QLatin1String("connection")) + .value(QLatin1String("timestamp")).toUInt(); } QString QNetworkManagerSettingsConnection::getId() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("id")); - while (ii != innerMap.end() && ii.key() == QLatin1String("id")) { - return ii.value().toString(); - ii++; - } - i++; - } - return QString(); + return d->settingsMap.value(QLatin1String("connection")).value(QLatin1String("id")).toString(); } QString QNetworkManagerSettingsConnection::getUuid() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("connection")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("connection")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("uuid")); - while (ii != innerMap.end() && ii.key() == QLatin1String("uuid")) { - return ii.value().toString(); - ii++; - } - i++; - } + const QString id = d->settingsMap.value(QLatin1String("connection")) + .value(QLatin1String("uuid")).toString(); + // is no uuid, return the connection path - return d->connectionInterface->path(); + return id.isEmpty() ? d->connectionInterface->path() : id; } QString QNetworkManagerSettingsConnection::getSsid() { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("ssid")); - while (ii != innerMap.end() && ii.key() == QLatin1String("ssid")) { - return ii.value().toString(); - ii++; - } - i++; - } - return QString(); + return d->settingsMap.value(QLatin1String("802-11-wireless")) + .value(QLatin1String("ssid")).toString(); } QString QNetworkManagerSettingsConnection::getMacAddress() { - if(getType() == DEVICE_TYPE_802_3_ETHERNET) { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-3-ethernet")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("802-3-ethernet")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address")); - while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) { - return ii.value().toString(); - ii++; - } - i++; - } - } + NMDeviceType type = getType(); - else if(getType() == DEVICE_TYPE_802_11_WIRELESS) { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("mac-address")); - while (ii != innerMap.end() && ii.key() == QLatin1String("mac-address")) { - return ii.value().toString(); - ii++; - } - i++; - } + if (type == DEVICE_TYPE_802_3_ETHERNET) { + return d->settingsMap.value(QLatin1String("802-3-ethernet")) + .value(QLatin1String("mac-address")).toString(); + } else if (type == DEVICE_TYPE_802_11_WIRELESS) { + return d->settingsMap.value(QLatin1String("802-11-wireless")) + .value(QLatin1String("mac-address")).toString(); + } else { + return QString(); } - return QString(); -} - -QStringList QNetworkManagerSettingsConnection::getSeenBssids() -{ - if(getType() == DEVICE_TYPE_802_11_WIRELESS) { - QNmSettingsMap::const_iterator i = d->settingsMap.find(QLatin1String("802-11-wireless")); - while (i != d->settingsMap.end() && i.key() == QLatin1String("802-11-wireless")) { - QMap<QString,QVariant> innerMap = i.value(); - QMap<QString,QVariant>::const_iterator ii = innerMap.find(QLatin1String("seen-bssids")); - while (ii != innerMap.end() && ii.key() == QLatin1String("seen-bssids")) { - return ii.value().toStringList(); - ii++; - } - i++; - } +} + +QStringList QNetworkManagerSettingsConnection::getSeenBssids() +{ + if (getType() == DEVICE_TYPE_802_11_WIRELESS) { + return d->settingsMap.value(QLatin1String("802-11-wireless")) + .value(QLatin1String("seen-bssids")).toStringList(); + } else { + return QStringList(); } - return QStringList(); } class QNetworkManagerConnectionActivePrivate diff --git a/src/plugins/bearer/nla/qnlaengine.cpp b/src/plugins/bearer/nla/qnlaengine.cpp index 9ab9924..fd50099 100644 --- a/src/plugins/bearer/nla/qnlaengine.cpp +++ b/src/plugins/bearer/nla/qnlaengine.cpp @@ -119,7 +119,7 @@ static void printBlob(NLA_BLOB *blob) } #endif -static QString qGetInterfaceType(const QString &interface) +static QNetworkConfiguration::BearerType qGetInterfaceType(const QString &interface) { #ifdef Q_OS_WINCE Q_UNUSED(interface) @@ -130,10 +130,10 @@ static QString qGetInterfaceType(const QString &interface) NDIS_MEDIUM medium; NDIS_PHYSICAL_MEDIUM physicalMedium; - HANDLE handle = CreateFile((TCHAR *)QString(QLatin1String("\\\\.\\%1")).arg(interface).utf16(), - 0, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); + HANDLE handle = CreateFile((TCHAR *)QString::fromLatin1("\\\\.\\%1").arg(interface).utf16(), 0, + FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0); if (handle == INVALID_HANDLE_VALUE) - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; oid = OID_GEN_MEDIA_SUPPORTED; bytesWritten = 0; @@ -141,7 +141,7 @@ static QString qGetInterfaceType(const QString &interface) &medium, sizeof(medium), &bytesWritten, 0); if (!result) { CloseHandle(handle); - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } oid = OID_GEN_PHYSICAL_MEDIUM; @@ -152,9 +152,9 @@ static QString qGetInterfaceType(const QString &interface) CloseHandle(handle); if (medium == NdisMedium802_3) - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; else - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } CloseHandle(handle); @@ -162,16 +162,16 @@ static QString qGetInterfaceType(const QString &interface) if (medium == NdisMedium802_3) { switch (physicalMedium) { case NdisPhysicalMediumWirelessLan: - return QLatin1String("WLAN"); + return QNetworkConfiguration::BearerWLAN; case NdisPhysicalMediumBluetooth: - return QLatin1String("Bluetooth"); + return QNetworkConfiguration::BearerBluetooth; case NdisPhysicalMediumWiMax: - return QLatin1String("WiMAX"); + return QNetworkConfiguration::BearerWiMAX; default: #ifdef BEARER_MANAGEMENT_DEBUG qDebug() << "Physical Medium" << physicalMedium; #endif - return QLatin1String("Ethernet"); + return QNetworkConfiguration::BearerEthernet; } } @@ -181,7 +181,7 @@ static QString qGetInterfaceType(const QString &interface) #endif - return QLatin1String("Unknown"); + return QNetworkConfiguration::BearerUnknown; } class QNlaThread : public QThread @@ -374,10 +374,9 @@ DWORD QNlaThread::parseBlob(NLA_BLOB *blob, QNetworkConfigurationPrivate *cpPriv #endif break; case NLA_CONNECTIVITY: - if (blob->data.connectivity.internet == NLA_INTERNET_YES) - cpPriv->internet = true; - else - cpPriv->internet = false; +#ifdef BEARER_MANAGEMENT_DEBUG + qDebug("%s: unhandled header type NLA_CONNECTIVITY", __FUNCTION__); +#endif break; case NLA_ICS: #ifdef BEARER_MANAGEMENT_DEBUG @@ -438,8 +437,10 @@ QNetworkConfigurationPrivate *QNlaThread::parseQuerySet(const WSAQUERYSET *query } while (offset != 0 && offset < querySet->lpBlob->cbSize); } - if (QNlaEngine *engine = qobject_cast<QNlaEngine *>(parent())) - cpPriv->bearer = engine->bearerName(cpPriv->id); + if (QNlaEngine *engine = qobject_cast<QNlaEngine *>(parent())) { + const QString interface = engine->getInterfaceFromId(cpPriv->id); + cpPriv->bearerType = qGetInterfaceType(interface); + } return cpPriv; } @@ -586,16 +587,6 @@ bool QNlaEngine::hasIdentifier(const QString &id) return configurationInterface.contains(id.toUInt()); } -QString QNlaEngine::bearerName(const QString &id) -{ - QString interface = getInterfaceFromId(id); - - if (interface.isEmpty()) - return QString(); - - return qGetInterfaceType(interface); -} - void QNlaEngine::connectToId(const QString &id) { emit connectionError(id, OperationNotSupported); diff --git a/src/plugins/bearer/nla/qnlaengine.h b/src/plugins/bearer/nla/qnlaengine.h index 1d49464..69f54c9 100644 --- a/src/plugins/bearer/nla/qnlaengine.h +++ b/src/plugins/bearer/nla/qnlaengine.h @@ -85,8 +85,6 @@ public: QString getInterfaceFromId(const QString &id); bool hasIdentifier(const QString &id); - QString bearerName(const QString &id); - void connectToId(const QString &id); void disconnectFromId(const QString &id); diff --git a/src/plugins/bearer/symbian/3_1/3_1.pro b/src/plugins/bearer/symbian/3_1/3_1.pro index 2d721a8..b7c6aef 100644 --- a/src/plugins/bearer/symbian/3_1/3_1.pro +++ b/src/plugins/bearer/symbian/3_1/3_1.pro @@ -1,5 +1,9 @@ include(../symbian.pri) -LIBS += -lapengine +is_using_gnupoc { + LIBS += -lapengine +} else { + LIBS += -lAPEngine +} TARGET = $${TARGET}_3_1 TARGET.UID3 = 0x2002131C diff --git a/src/plugins/bearer/symbian/symbian.pri b/src/plugins/bearer/symbian/symbian.pri index afe84dc..9b3f50c 100644 --- a/src/plugins/bearer/symbian/symbian.pri +++ b/src/plugins/bearer/symbian/symbian.pri @@ -14,8 +14,6 @@ INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE symbian-abld:INCLUDEPATH += $$QT_BUILD_TREE/include/QtNetwork/private LIBS += -lcommdb \ - -lapsettingshandlerui \ - -lconnmon \ -lcentralrepository \ -lesock \ -linsock \ @@ -23,6 +21,14 @@ LIBS += -lcommdb \ -lefsrv \ -lnetmeta +is_using_gnupoc { + LIBS += -lconnmon \ + -lapsettingshandlerui +} else { + LIBS += -lConnMon \ + -lApSettingsHandlerUI +} + QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer target.path += $$[QT_INSTALL_PLUGINS]/bearer INSTALLS += target diff --git a/src/plugins/bearer/symbian/symbian_3/symbian_3.pro b/src/plugins/bearer/symbian/symbian_3/symbian_3.pro index ff0f11c..fd66198 100644 --- a/src/plugins/bearer/symbian/symbian_3/symbian_3.pro +++ b/src/plugins/bearer/symbian/symbian_3/symbian_3.pro @@ -12,7 +12,11 @@ symbian { } } else { # Fall back to 3_1 implementation on platforms that do not have cmmanager - LIBS += -lapengine + is_using_gnupoc { + LIBS += -lapengine + } else { + LIBS += -lAPEngine + } } } diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 4bd6d2f..9593461 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -63,9 +63,9 @@ #include <cmpluginpacketdatadef.h> #include <cmplugindialcommondefs.h> #else - #include <apaccesspointitem.h> - #include <apdatahandler.h> - #include <aputils.h> + #include <ApAccessPointItem.h> + #include <ApDataHandler.h> + #include <ApUtils.h> #endif #ifndef QT_NO_BEARERMANAGEMENT @@ -75,7 +75,7 @@ QT_BEGIN_NAMESPACE static const int KUserChoiceIAPId = 0; SymbianNetworkConfigurationPrivate::SymbianNetworkConfigurationPrivate() -: bearer(BearerUnknown), numericId(0), connectionId(0) +: numericId(0), connectionId(0) { } @@ -83,32 +83,6 @@ SymbianNetworkConfigurationPrivate::~SymbianNetworkConfigurationPrivate() { } -QString SymbianNetworkConfigurationPrivate::bearerName() const -{ - QMutexLocker locker(&mutex); - - switch (bearer) { - case BearerEthernet: - return QLatin1String("Ethernet"); - case BearerWLAN: - return QLatin1String("WLAN"); - case Bearer2G: - return QLatin1String("2G"); - case BearerCDMA2000: - return QLatin1String("CDMA2000"); - case BearerWCDMA: - return QLatin1String("WCDMA"); - case BearerHSPA: - return QLatin1String("HSPA"); - case BearerBluetooth: - return QLatin1String("Bluetooth"); - case BearerWiMAX: - return QLatin1String("WiMAX"); - default: - return QString(); - } -} - SymbianEngine::SymbianEngine(QObject *parent) : QBearerEngine(parent), CActive(CActive::EPriorityHigh), iFirstUpdate(true), iInitOk(true), iUpdatePending(false) @@ -146,7 +120,7 @@ void SymbianEngine::initialize() SymbianNetworkConfigurationPrivate *cpPriv = new SymbianNetworkConfigurationPrivate; cpPriv->name = "UserChoice"; - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; cpPriv->state = QNetworkConfiguration::Discovered; cpPriv->isValid = true; cpPriv->id = QString::number(qHash(KUserChoiceIAPId)); @@ -517,25 +491,25 @@ SymbianNetworkConfigurationPrivate *SymbianEngine::configFromConnectionMethodL( TUint32 bearerId = connectionMethod.GetIntAttributeL(CMManager::ECmCommsDBBearerType); switch (bearerId) { case KCommDbBearerCSD: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + cpPriv->bearerType = QNetworkConfiguration::Bearer2G; break; case KCommDbBearerWcdma: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + cpPriv->bearerType = QNetworkConfiguration::BearerWCDMA; break; case KCommDbBearerLAN: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + cpPriv->bearerType = QNetworkConfiguration::BearerEthernet; break; case KCommDbBearerVirtual: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; break; case KCommDbBearerPAN: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; break; case KCommDbBearerWLAN: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerWLAN; + cpPriv->bearerType = QNetworkConfiguration::BearerWLAN; break; default: - cpPriv->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + cpPriv->bearerType = QNetworkConfiguration::BearerUnknown; break; } @@ -619,28 +593,28 @@ void SymbianEngine::readNetworkConfigurationValuesFromCommsDbL( apNetworkConfiguration->roamingSupported = false; switch (pAPItem->BearerTypeL()) { case EApBearerTypeCSD: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + apNetworkConfiguration->bearerType = QNetworkConfiguration::Bearer2G; break; case EApBearerTypeGPRS: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + apNetworkConfiguration->bearerType = QNetworkConfiguration::Bearer2G; break; case EApBearerTypeHSCSD: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerHSPA; break; case EApBearerTypeCDMA: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerCDMA2000; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerCDMA2000; break; case EApBearerTypeWLAN: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerWLAN; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerWLAN; break; case EApBearerTypeLAN: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerEthernet; break; case EApBearerTypeLANModem: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerEthernet; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerEthernet; break; default: - apNetworkConfiguration->bearer = SymbianNetworkConfigurationPrivate::BearerUnknown; + apNetworkConfiguration->bearerType = QNetworkConfiguration::BearerUnknown; break; } @@ -870,38 +844,38 @@ void SymbianEngine::updateMobileBearerToConfigs(TConnMonBearerInfo bearerInfo) SymbianNetworkConfigurationPrivate *p = toSymbianConfig(ptr); - if (p->bearer >= SymbianNetworkConfigurationPrivate::Bearer2G && - p->bearer <= SymbianNetworkConfigurationPrivate::BearerHSPA) { + if (p->bearerType >= QNetworkConfiguration::Bearer2G && + p->bearerType <= QNetworkConfiguration::BearerHSPA) { switch (bearerInfo) { case EBearerInfoCSD: - p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + p->bearerType = QNetworkConfiguration::Bearer2G; break; case EBearerInfoWCDMA: - p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + p->bearerType = QNetworkConfiguration::BearerWCDMA; break; case EBearerInfoCDMA2000: - p->bearer = SymbianNetworkConfigurationPrivate::BearerCDMA2000; + p->bearerType = QNetworkConfiguration::BearerCDMA2000; break; case EBearerInfoGPRS: - p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + p->bearerType = QNetworkConfiguration::Bearer2G; break; case EBearerInfoHSCSD: - p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + p->bearerType = QNetworkConfiguration::Bearer2G; break; case EBearerInfoEdgeGPRS: - p->bearer = SymbianNetworkConfigurationPrivate::Bearer2G; + p->bearerType = QNetworkConfiguration::Bearer2G; break; case EBearerInfoWcdmaCSD: - p->bearer = SymbianNetworkConfigurationPrivate::BearerWCDMA; + p->bearerType = QNetworkConfiguration::BearerWCDMA; break; case EBearerInfoHSDPA: - p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + p->bearerType = QNetworkConfiguration::BearerHSPA; break; case EBearerInfoHSUPA: - p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + p->bearerType = QNetworkConfiguration::BearerHSPA; break; case EBearerInfoHSxPA: - p->bearer = SymbianNetworkConfigurationPrivate::BearerHSPA; + p->bearerType = QNetworkConfiguration::BearerHSPA; break; } } diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index ecd858d..1fe6395 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -73,23 +73,9 @@ class AccessPointsAvailabilityScanner; class SymbianNetworkConfigurationPrivate : public QNetworkConfigurationPrivate { public: - enum Bearer { - BearerEthernet, - BearerWLAN, - Bearer2G, - BearerCDMA2000, - BearerWCDMA, - BearerHSPA, - BearerBluetooth, - BearerWiMAX, - BearerUnknown = -1 - }; - SymbianNetworkConfigurationPrivate(); ~SymbianNetworkConfigurationPrivate(); - QString bearerName() const; - inline TUint32 numericIdentifier() const { QMutexLocker locker(&mutex); @@ -110,8 +96,6 @@ public: QString mappingName; - Bearer bearer; - // So called IAP id from the platform. Remains constant as long as the // platform is aware of the configuration ie. it is stored in the databases // --> does not depend on whether connections are currently open or not. diff --git a/src/s60installs/bwins/QtNetworku.def b/src/s60installs/bwins/QtNetworku.def index 48af60c..2cf62a8 100644 --- a/src/s60installs/bwins/QtNetworku.def +++ b/src/s60installs/bwins/QtNetworku.def @@ -1143,4 +1143,6 @@ EXPORTS ?setNetworkAccessible@QNetworkAccessManager@@QAEXW4NetworkAccessibility@1@@Z @ 1142 NONAME ; void QNetworkAccessManager::setNetworkAccessible(enum QNetworkAccessManager::NetworkAccessibility) ??_EQBearerEngineFactoryInterface@@UAE@I@Z @ 1143 NONAME ; QBearerEngineFactoryInterface::~QBearerEngineFactoryInterface(unsigned int) ?enablePolling@QNetworkConfigurationManagerPrivate@@QAEXXZ @ 1144 NONAME ; void QNetworkConfigurationManagerPrivate::enablePolling(void) + ?bearerTypeName@QNetworkConfiguration@@QBE?AVQString@@XZ @ 1145 NONAME ; class QString QNetworkConfiguration::bearerTypeName(void) const + ?bearerType@QNetworkConfiguration@@QBE?AW4BearerType@1@XZ @ 1146 NONAME ; enum QNetworkConfiguration::BearerType QNetworkConfiguration::bearerType(void) const diff --git a/src/s60installs/eabi/QtNetworku.def b/src/s60installs/eabi/QtNetworku.def index eb30832..6b34a19 100644 --- a/src/s60installs/eabi/QtNetworku.def +++ b/src/s60installs/eabi/QtNetworku.def @@ -1131,7 +1131,7 @@ EXPORTS _ZNK21QNetworkAccessManager13configurationEv @ 1130 NONAME _ZNK21QNetworkAccessManager17networkAccessibleEv @ 1131 NONAME _ZNK21QNetworkAccessManager19activeConfigurationEv @ 1132 NONAME - _ZNK21QNetworkConfiguration10bearerNameEv @ 1133 NONAME + _ZNK21QNetworkConfiguration10bearerNameEv @ 1133 NONAME ABSENT _ZNK21QNetworkConfiguration10identifierEv @ 1134 NONAME _ZNK21QNetworkConfiguration18isRoamingAvailableEv @ 1135 NONAME _ZNK21QNetworkConfiguration4nameEv @ 1136 NONAME @@ -1167,4 +1167,6 @@ EXPORTS _ZN14QAuthenticator9setOptionERK7QStringRK8QVariant @ 1166 NONAME _ZNK14QAuthenticator6optionERK7QString @ 1167 NONAME _ZNK14QAuthenticator7optionsEv @ 1168 NONAME + _ZNK21QNetworkConfiguration10bearerTypeEv @ 1169 NONAME + _ZNK21QNetworkConfiguration14bearerTypeNameEv @ 1170 NONAME diff --git a/src/sql/drivers/tds/qsql_tds.pri b/src/sql/drivers/tds/qsql_tds.pri index c552ead..037f793 100644 --- a/src/sql/drivers/tds/qsql_tds.pri +++ b/src/sql/drivers/tds/qsql_tds.pri @@ -1,8 +1,10 @@ HEADERS += $$PWD/qsql_tds.h SOURCES += $$PWD/qsql_tds.cpp -unix { +unix|win32-g++: { + !isEmpty(QT_LFLAGS_TDS):!static:LIBS *= $$QT_LFLAGS_TDS !contains(LIBS, .*sybdb.*):LIBS += -lsybdb + QMAKE_CXXFLAGS *= $$QT_CFLAGS_TDS } else:win32-borland { LIBS *= $(BCB)/lib/PSDK/NTWDBLIB.LIB } else { diff --git a/src/src.pro b/src/src.pro index 9704716..f856a0c 100644 --- a/src/src.pro +++ b/src/src.pro @@ -112,6 +112,7 @@ src_webkit_declarative.target = sub-webkitdeclarative src_declarative.depends = src_gui src_script src_network src_plugins.depends = src_gui src_sql src_svg src_multimedia src_s60installs.depends = $$TOOLS_SUBDIRS $$SRC_SUBDIRS + src_s60installs.depends -= src_s60installs src_imports.depends = src_gui src_declarative contains(QT_CONFIG, webkit) { src_webkit.depends = src_gui src_sql src_network diff --git a/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition7.qml b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition7.qml new file mode 100644 index 0000000..b47b5f2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition7.qml @@ -0,0 +1,29 @@ +import Qt 4.7 + +Rectangle { + width: 400 + height: 400 + Rectangle { + id: theRect + objectName: "TheRect" + color: "red" + width: 50; height: 50 + x: 100; y: 100 + } + + states: State { + name: "moved" + PropertyChanges { + target: theRect + x: 200 + } + } + transitions: Transition { + SpringAnimation { targets: theRect; properties: "x"; velocity: 10000 } + } + + MouseArea { + anchors.fill: parent + onClicked: parent.state = "moved" + } +} diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 3e80c2c..ec867fe 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -551,6 +551,20 @@ void tst_qdeclarativeanimations::propertiesTransition() QTest::qWait(waitDuration); QTIMED_COMPARE(myRect->x(),qreal(100)); }*/ + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition7.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeItemPrivate::get(rect)->setState("moved"); + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(200)); + } + } void tst_qdeclarativeanimations::invalidDuration() diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp index 1330d96..49514dc 100644 --- a/tests/auto/qimage/tst_qimage.cpp +++ b/tests/auto/qimage/tst_qimage.cpp @@ -139,6 +139,9 @@ private slots: void premultipliedAlphaConsistency(); void compareIndexed(); + + void rgbSwapped_data(); + void rgbSwapped(); }; tst_QImage::tst_QImage() @@ -1820,5 +1823,68 @@ void tst_QImage::compareIndexed() QCOMPARE(img, imgInverted); } +void tst_QImage::rgbSwapped_data() +{ + QTest::addColumn<QImage::Format>("format"); + + QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8; + QTest::newRow("Format_RGB32") << QImage::Format_RGB32; + QTest::newRow("Format_ARGB32") << QImage::Format_ARGB32; + QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied; + QTest::newRow("Format_RGB16") << QImage::Format_RGB16; + QTest::newRow("Format_ARGB8565_Premultiplied") << QImage::Format_ARGB8565_Premultiplied; + QTest::newRow("Format_ARGB6666_Premultiplied") << QImage::Format_ARGB6666_Premultiplied; + QTest::newRow("Format_ARGB4444_Premultiplied") << QImage::Format_ARGB4444_Premultiplied; + QTest::newRow("Format_RGB666") << QImage::Format_RGB666; + QTest::newRow("Format_RGB555") << QImage::Format_RGB555; + QTest::newRow("Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied; + QTest::newRow("Format_RGB888") << QImage::Format_RGB888; + QTest::newRow("Format_RGB444") << QImage::Format_RGB444; +} + +void tst_QImage::rgbSwapped() +{ + QFETCH(QImage::Format, format); + + QImage image(100, 1, format); + image.fill(0); + + QVector<QColor> testColor(image.width()); + + for (int i = 0; i < image.width(); ++i) + testColor[i] = QColor(i, 10 + i, 20 + i * 2, 30 + i); + + if (format != QImage::Format_Indexed8) { + QPainter p(&image); + p.setCompositionMode(QPainter::CompositionMode_Source); + for (int i = 0; i < image.width(); ++i) + p.fillRect(QRect(i, 0, 1, 1), testColor[i].rgb()); + } else { + image.setColorCount(image.width()); + for (int i = 0; i < image.width(); ++i) { + image.setColor(0, testColor[i].rgba()); + image.setPixel(i, 0, i); + } + } + + QImage imageSwapped = image.rgbSwapped(); + + for (int i = 0; i < image.width(); ++i) { + QColor referenceColor = QColor(image.pixel(i, 0)); + QColor swappedColor = QColor(imageSwapped.pixel(i, 0)); + + QCOMPARE(swappedColor.alpha(), referenceColor.alpha()); + QCOMPARE(swappedColor.red(), referenceColor.blue()); + QCOMPARE(swappedColor.green(), referenceColor.green()); + QCOMPARE(swappedColor.blue(), referenceColor.red()); + } + + QImage imageSwappedTwice = imageSwapped.rgbSwapped(); + + QCOMPARE(image, imageSwappedTwice); + + QCOMPARE(memcmp(image.constBits(), imageSwappedTwice.constBits(), image.numBytes()), 0); +} + QTEST_MAIN(tst_QImage) #include "tst_qimage.moc" diff --git a/tests/benchmarks/gui/image/blendbench/main.cpp b/tests/benchmarks/gui/image/blendbench/main.cpp index 92d1633..f53654b 100644 --- a/tests/benchmarks/gui/image/blendbench/main.cpp +++ b/tests/benchmarks/gui/image/blendbench/main.cpp @@ -103,6 +103,9 @@ class BlendBench : public QObject private slots: void blendBench_data(); void blendBench(); + + void blendBenchAlpha_data(); + void blendBenchAlpha(); }; void BlendBench::blendBench_data() @@ -147,6 +150,35 @@ void BlendBench::blendBench() } } +void BlendBench::blendBenchAlpha_data() +{ + blendBench_data(); +} + +void BlendBench::blendBenchAlpha() +{ + QFETCH(int, brushType); + QFETCH(int, compositionMode); + + QImage img(512, 512, QImage::Format_ARGB32_Premultiplied); + QImage src(512, 512, QImage::Format_ARGB32_Premultiplied); + paint(&src); + QPainter p(&img); + p.setPen(Qt::NoPen); + + p.setCompositionMode(QPainter::CompositionMode(compositionMode)); + if (brushType == ImageBrush) { + p.setBrush(QBrush(src)); + } else if (brushType == SolidBrush) { + p.setBrush(QColor(127, 127, 127, 127)); + } + p.setOpacity(0.7f); + + QBENCHMARK { + p.drawRect(0, 0, 512, 512); + } +} + QTEST_MAIN(BlendBench) #include "main.moc" diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index b7de052..e27e16d 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -1029,6 +1029,10 @@ void Configure::parseCmdLine() opensslLibs = configCmdLine.at(i); } else if (configCmdLine.at(i).startsWith("PSQL_LIBS=")) { psqlLibs = configCmdLine.at(i); + } else if (configCmdLine.at(i).startsWith("SYBASE=")) { + sybase = configCmdLine.at(i); + } else if (configCmdLine.at(i).startsWith("SYBASE_LIBS=")) { + sybaseLibs = configCmdLine.at(i); } else if ((configCmdLine.at(i) == "-override-version") || (configCmdLine.at(i) == "-version-override")){ @@ -1159,6 +1163,13 @@ void Configure::parseCmdLine() dictionary["GRAPHICS_SYSTEM"] = configCmdLine.at(i); } + else if (configCmdLine.at(i) == "-runtimegraphicssystem") { + ++i; + if (i == argCount) + break; + dictionary["RUNTIME_SYSTEM"] = configCmdLine.at(i); + } + else if (configCmdLine.at(i).indexOf(QRegExp("^-(en|dis)able-")) != -1) { // Scan to see if any specific modules and drivers are enabled or disabled for (QStringList::Iterator module = modules.begin(); module != modules.end(); ++module) { @@ -1624,7 +1635,7 @@ bool Configure::displayHelp() "[-phonon] [-no-phonon-backend] [-phonon-backend]\n" "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n" "[-no-script] [-script] [-no-scripttools] [-scripttools]\n" - "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg|runtime]\n\n", 0, 7); + "[-no-webkit] [-webkit] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7); desc("Installation options:\n\n"); @@ -1729,9 +1740,7 @@ bool Configure::displayHelp() "Available values for <sys>:"); desc("GRAPHICS_SYSTEM", "raster", "", " raster - Software rasterizer", ' '); desc("GRAPHICS_SYSTEM", "opengl", "", " opengl - Using OpenGL acceleration, experimental!", ' '); - desc("GRAPHICS_SYSTEM", "openvg", "", " openvg - Using OpenVG acceleration, experimental!", ' '); - desc("GRAPHICS_SYSTEM", "runtime", "", " runtime - Runtime switching of graphics sytems", ' '); - + desc("GRAPHICS_SYSTEM", "openvg", "", " openvg - Using OpenVG acceleration, experimental!\n", ' '); desc( "-help, -h, -?", "Display this information.\n"); @@ -2747,6 +2756,17 @@ void Configure::generateOutputVars() } if (!psqlLibs.isEmpty()) qmakeVars += QString("QT_LFLAGS_PSQL=") + psqlLibs.section("=", 1); + + { + QStringList lflagsTDS; + if (!sybase.isEmpty()) + lflagsTDS += QString("-L") + fixSeparators(sybase.section("=", 1) + "/lib"); + if (!sybaseLibs.isEmpty()) + lflagsTDS += sybaseLibs.section("=", 1); + if (!lflagsTDS.isEmpty()) + qmakeVars += QString("QT_LFLAGS_TDS=") + lflagsTDS.join(" "); + } + if (!qmakeSql.isEmpty()) qmakeVars += QString("sql-drivers += ") + qmakeSql.join(" "); if (!qmakeSqlPlugins.isEmpty()) @@ -3025,6 +3045,9 @@ void Configure::generateConfigfiles() tmpStream << endl << "// Compile time features" << endl; tmpStream << "#define QT_ARCH_" << dictionary["ARCHITECTURE"].toUpper() << endl; + if (dictionary["GRAPHICS_SYSTEM"] == "runtime" && dictionary["RUNTIME_SYSTEM"] != "runtime") + tmpStream << "#define QT_DEFAULT_RUNTIME_SYSTEM \"" << dictionary["RUNTIME_SYSTEM"] << "\"" << endl; + QStringList qconfigList; if (dictionary["STL"] == "no") qconfigList += "QT_NO_STL"; if (dictionary["STYLE_WINDOWS"] != "yes") qconfigList += "QT_NO_STYLE_WINDOWS"; diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index ff2ee8b..b3c07f7 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -134,6 +134,8 @@ private: QStringList qmakeLibs; QString opensslLibs; QString psqlLibs; + QString sybase; + QString sybaseLibs; QMap<QString,QString> licenseInfo; QString outputLine; diff --git a/tools/designer/src/designer/assistantclient.cpp b/tools/designer/src/designer/assistantclient.cpp index e47817f..bddaf63 100644 --- a/tools/designer/src/designer/assistantclient.cpp +++ b/tools/designer/src/designer/assistantclient.cpp @@ -101,7 +101,7 @@ bool AssistantClient::sendCommand(const QString &cmd, QString *errorMessage) return false; } QTextStream str(m_process); - str << cmd << QLatin1Char('\0') << endl; + str << cmd << QLatin1Char('\n') << endl; return true; } diff --git a/tools/linguist/linguist/mainwindow.cpp b/tools/linguist/linguist/mainwindow.cpp index 1611699..163ef54 100644 --- a/tools/linguist/linguist/mainwindow.cpp +++ b/tools/linguist/linguist/mainwindow.cpp @@ -1347,7 +1347,7 @@ void MainWindow::manual() << (QT_VERSION >> 16) << ((QT_VERSION >> 8) & 0xFF) << (QT_VERSION & 0xFF) << QLatin1String("/qdoc/linguist-manual.html") - << QLatin1Char('\0') << endl; + << QLatin1Char('\n') << endl; } void MainWindow::about() diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index b087b1c..7665f1a 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -119,6 +119,7 @@ class Config }; #define CONFIG_ALIAS "alias" +#define CONFIG_APPLICATION "application" #define CONFIG_BASE "base" // ### don't document for now #define CONFIG_CODEINDENT "codeindent" #define CONFIG_DEFINES "defines" diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 76d8c0d..723f516 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -1756,10 +1756,10 @@ void HtmlGenerator::generateBreadCrumbs(const QString& title, if (sl.contains("declarative")) out() << " <li><a href=\"qdeclarativeexamples.html\">QML Examples & Demos</a></li>"; else { - QString name = "examples-" + sl.at(0) + ".html"; + QString name = "examples-" + sl.at(0) + ".html"; // this generates an empty link QString t = CodeParser::titleFromName(name); - out() << " <li><a href=\"" << name << "\">" - << t << "</a></li>"; + // out() << " <li> <a href=\"" << name << "\">" + // << t << "</a></li>"; } out() << " <li>" << title << "</li>"; } diff --git a/tools/qdoc3/main.cpp b/tools/qdoc3/main.cpp index 616ae2f..47a4b67 100644 --- a/tools/qdoc3/main.cpp +++ b/tools/qdoc3/main.cpp @@ -105,6 +105,8 @@ static bool showInternal = false; static bool obsoleteLinks = false; static QStringList defines; static QHash<QString, Tree *> trees; +static QString application = "base"; //application +static bool applicationArg = 0; //if 1, then the argument is provided and it will override the qdocconf file /*! Find the Tree for language \a lang and return a pointer to it. @@ -192,6 +194,38 @@ static void processQdocconfFile(const QString &fileName) config.load(fileName); /* + Set the application to which qdoc will create the output. + The three applications are: + base: simple, basic html output. Best suited for offline viewing + creator: additional formatting. + online: full-featured online version with search and links to Qt topics + + Note: This will override the offline, online, creator defines. + */ + if(applicationArg == false){ + + QString appConfig = config.getString(CONFIG_APPLICATION); + if (!appConfig.isEmpty()){ + application = appConfig; + } + } + if(application == "online"){ + config.setStringList(CONFIG_ONLINE, QStringList("true")); + config.setStringList(CONFIG_OFFLINE, QStringList("false")); + config.setStringList(CONFIG_CREATOR, QStringList("false")); + } + else if(application == "creator"){ + config.setStringList(CONFIG_ONLINE, QStringList("false")); + config.setStringList(CONFIG_OFFLINE, QStringList("true")); + config.setStringList(CONFIG_CREATOR, QStringList("false")); + } + else if(application == "base"){ + config.setStringList(CONFIG_ONLINE, QStringList("false")); + config.setStringList(CONFIG_OFFLINE, QStringList("false")); + config.setStringList(CONFIG_CREATOR, QStringList("true")); + } + + /* Add the defines to the configuration variables. */ QStringList defs = defines + config.getStringList(CONFIG_DEFINES); @@ -462,12 +496,24 @@ int main(int argc, char **argv) else if (opt == "-obsoletelinks") { obsoleteLinks = true; } + else if (opt == "-base") { + application = "base"; + applicationArg = true; + } + else if (opt == "-creator") { + application = "creator"; + applicationArg = true; + } + else if (opt == "-online") { + application = "online"; + applicationArg = true; + } else { qdocFiles.append(opt); } } - if (qdocFiles.isEmpty()) { + if (qdocFiles.isEmpty()) { printHelp(); return EXIT_FAILURE; } @@ -475,8 +521,10 @@ int main(int argc, char **argv) /* Main loop. */ - foreach (QString qf, qdocFiles) + foreach (QString qf, qdocFiles) { + qDebug() << "PROCESSING:" << qf; processQdocconfFile(qf); + } qDeleteAll(trees); return EXIT_SUCCESS; diff --git a/tools/qdoc3/test/assistant.qdocconf b/tools/qdoc3/test/assistant.qdocconf index efe3b3b..119a676 100644 --- a/tools/qdoc3/test/assistant.qdocconf +++ b/tools/qdoc3/test/assistant.qdocconf @@ -19,39 +19,39 @@ qhp.Assistant.file = assistant.qhp qhp.Assistant.namespace = com.trolltech.assistant.470 qhp.Assistant.virtualFolder = qdoc qhp.Assistant.indexTitle = Qt Assistant Manual -qhp.Assistant.extraFiles = images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_ll_blank.png \ - images/bg_ul_blank.png \ - images/header_bg.png \ +qhp.Assistant.extraFiles = images/bg_l.png \ + images/bg_l_blank.png \ + images/bg_ll_blank.png \ + images/bg_ul_blank.png \ + images/header_bg.png \ images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ images/bullet_dn.png \ - images/bullet_sq.png \ + images/bullet_sq.png \ images/bullet_up.png \ - images/arrow_down.png \ + images/arrow_down.png \ images/feedbackground.png \ images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/spinner.gif \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/spinner.gif \ images/stylesheet-coffee-plastique.png \ images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - scripts/narrow.js \ - scripts/superfish.js \ - style/narrow.css \ - style/superfish.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + scripts/narrow.js \ + scripts/superfish.js \ + style/narrow.css \ + style/superfish.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css qhp.Assistant.filterAttributes = qt 4.7.0 tools assistant qhp.Assistant.customFilters.Assistant.name = Qt Assistant Manual diff --git a/tools/qdoc3/test/qdeclarative.qdocconf b/tools/qdoc3/test/qdeclarative.qdocconf index 0cff98e..7628519 100644 --- a/tools/qdoc3/test/qdeclarative.qdocconf +++ b/tools/qdoc3/test/qdeclarative.qdocconf @@ -31,32 +31,32 @@ qhp.Qml.indexTitle = Qml Reference # Files not referenced in any qdoc file # See also extraimages.HTML qhp.Qml.extraFiles = images/bg_l.png \ - images/bg_l_blank.png \ - images/bg_r.png \ - images/box_bg.png \ - images/breadcrumb.png \ - images/bullet_gt.png \ - images/bullet_dn.png \ - images/bullet_sq.png \ - images/bullet_up.png \ - images/feedbackground.png \ - images/horBar.png \ - images/page.png \ - images/page_bg.png \ - images/sprites-combined.png \ - images/arrow-down.png \ - images/spinner.png \ - images/stylesheet-coffee-plastique.png \ - images/taskmenuextension-example.png \ - images/coloreditorfactoryimage.png \ - images/dynamiclayouts-example.png \ - scripts/functions.js \ - scripts/jquery.js \ - style/OfflineStyle.css \ - style/style_ie6.css \ - style/style_ie7.css \ - style/style_ie8.css \ - style/style.css + images/bg_l_blank.png \ + images/bg_r.png \ + images/box_bg.png \ + images/breadcrumb.png \ + images/bullet_gt.png \ + images/bullet_dn.png \ + images/bullet_sq.png \ + images/bullet_up.png \ + images/feedbackground.png \ + images/horBar.png \ + images/page.png \ + images/page_bg.png \ + images/sprites-combined.png \ + images/arrow-down.png \ + images/spinner.png \ + images/stylesheet-coffee-plastique.png \ + images/taskmenuextension-example.png \ + images/coloreditorfactoryimage.png \ + images/dynamiclayouts-example.png \ + scripts/functions.js \ + scripts/jquery.js \ + style/OfflineStyle.css \ + style/style_ie6.css \ + style/style_ie7.css \ + style/style_ie8.css \ + style/style.css qhp.Qml.filterAttributes = qt 4.7.0 qtrefdoc qhp.Qml.customFilters.Qt.name = Qt 4.7.0 diff --git a/tools/qdoc3/test/qt-api-only.qdocconf b/tools/qdoc3/test/qt-api-only.qdocconf index 1ec0c6b..7387810 100644 --- a/tools/qdoc3/test/qt-api-only.qdocconf +++ b/tools/qdoc3/test/qt-api-only.qdocconf @@ -30,10 +30,7 @@ qhp.Qt.excluded += $QT_SOURCE_TREE/doc/src/development/assistant-manual.qdoc \ # Remove the QML documentation from the Qt-only documentation. -excludedirs += $QT_SOURCE_TREE/src/declarative \ - $QT_SOURCE_TREE/src/imports \ - $QT_SOURCE_TREE/src/3rdparty/webkit/WebKit/qt/declarative \ - $QT_SOURCE_TREE/doc/src/declarative +excludedirs += $QT_SOURCE_TREE/src/imports outputdir = $QT_BUILD_TREE/doc-build/html-qt tagfile = $QT_BUILD_TREE/doc-build/html-qt/qt.tags diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index f663016..415457e 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -21,6 +21,7 @@ qhp.Qt.file = qt.qhp qhp.Qt.namespace = com.trolltech.qt.470 qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation +qhp.Qt.indexRoot = # Files not referenced in any qdoc file (last four are needed by qtdemo) # See also extraimages.HTML diff --git a/tools/qdoc3/test/qt-cpp-ignore.qdocconf b/tools/qdoc3/test/qt-cpp-ignore.qdocconf index 4963b96..b78b512 100644 --- a/tools/qdoc3/test/qt-cpp-ignore.qdocconf +++ b/tools/qdoc3/test/qt-cpp-ignore.qdocconf @@ -64,6 +64,7 @@ Cpp.ignoretokens = QAXFACTORY_EXPORT \ Q_XMLSTREAM_EXPORT \ Q_XMLPATTERNS_EXPORT \ QDBUS_EXPORT \ + Q_DBUS_EXPORT \ QT_BEGIN_NAMESPACE \ QT_BEGIN_INCLUDE_NAMESPACE \ QT_END_NAMESPACE \ diff --git a/tools/qdoc3/test/qt-html-templates.qdocconf b/tools/qdoc3/test/qt-html-templates.qdocconf index e439708..cf15628 100644 --- a/tools/qdoc3/test/qt-html-templates.qdocconf +++ b/tools/qdoc3/test/qt-html-templates.qdocconf @@ -30,7 +30,7 @@ HTML.postheader = " <div class=\"header\" id=\"qtdocheader\">\n" \ " <div id=\"shortCut\">\n" \ " <ul>\n" \ " <li class=\"shortCut-topleft-inactive\"><span><a href=\"index.html\">Qt 4.7</a></span></li>\n" \ - " <li class=\"shortCut-topleft-active\"><a href=\"http://qt.nokia.com/doc/\">ALL VERSIONS" \ + " <li class=\"shortCut-topleft-active\"><a href=\"http://doc.qt.nokia.com\">ALL VERSIONS" \ " </a></li>\n" \ " </ul>\n" \ " </div>\n" \ diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index 08492e3..a5e6578 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -9,9 +9,9 @@ versionsym = version = %VERSION% description = Qt Reference Documentation url = http://qt.nokia.com/doc/4.7 -online = false +online = true offline = false -creator = true +creator = false sourceencoding = UTF-8 outputencoding = UTF-8 diff --git a/tools/runonphone/main.cpp b/tools/runonphone/main.cpp index 7767e4b..93b087b 100644 --- a/tools/runonphone/main.cpp +++ b/tools/runonphone/main.cpp @@ -51,6 +51,7 @@ #include "trksignalhandler.h" #include "serenum.h" +#include "ossignalconverter.h" void printUsage(QTextStream& outstream, QString exeName) { @@ -235,6 +236,8 @@ int main(int argc, char *argv[]) QObject::connect(&handler, SIGNAL(getRegistersAndCallStack(uint,uint)), launcher.data(), SLOT(getRegistersAndCallStack(uint,uint))); QObject::connect(launcher.data(), SIGNAL(finished()), &handler, SLOT(finished())); + QObject::connect(OsSignalConverter::instance(), SIGNAL(terminate()), launcher.data(), SLOT(terminate()), Qt::QueuedConnection); + QTimer timer; timer.setSingleShot(true); QObject::connect(&timer, SIGNAL(timeout()), &handler, SLOT(timeout())); diff --git a/tools/runonphone/ossignalconverter.cpp b/tools/runonphone/ossignalconverter.cpp new file mode 100644 index 0000000..6554e9f --- /dev/null +++ b/tools/runonphone/ossignalconverter.cpp @@ -0,0 +1,120 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "ossignalconverter_p.h" +#include <signal.h> +#include <QTimer> + +Q_GLOBAL_STATIC(OsSignalConverter, osSignalConverter); + +OsSignalConverter* OsSignalConverter::instance() +{ + return osSignalConverter(); +} + +OsSignalConverter::OsSignalConverter() +: d(new OsSignalConverterPrivate(this)) +{ +}; + +OsSignalConverter::~OsSignalConverter() +{ +} + +OsSignalConverterPrivate::OsSignalConverterPrivate(OsSignalConverter* owner) +: QObject(owner), q(owner), poller(new QTimer(this)) +{ + trap(); + connect(poller, SIGNAL(timeout()), this, SLOT(poll())); + poller->start(1000); +} + +OsSignalConverterPrivate::~OsSignalConverterPrivate() +{ + untrap(); +} + +void OsSignalConverterPrivate::trap() +{ + signal(SIGINT, handler); + signal(SIGTERM, handler); +#ifdef SIGBREAK + signal(SIGBREAK, handler); +#endif +#ifdef SIGHUP + signal(SIGHUP, handler); +#endif +#ifdef SIGQUIT + signal(SIGQUIT, handler); +#endif +} + +void OsSignalConverterPrivate::untrap() +{ + signal(SIGINT, SIG_DFL); + signal(SIGTERM, SIG_DFL); +#ifdef SIGBREAK + signal(SIGBREAK, SIG_DFL); +#endif +#ifdef SIGHUP + signal(SIGHUP, SIG_DFL); +#endif +#ifdef SIGQUIT + signal(SIGQUIT, SIG_DFL); +#endif +} + +void OsSignalConverterPrivate::handler(int sig) +{ + untrap(); //allow 2nd ctrl-c to really kill us + terminateRequest = sig; +} + +void OsSignalConverterPrivate::poll() +{ + if (terminateRequest) { + fprintf(stderr, "\n*** caught signal %d, terminating ***\n", terminateRequest); + poller->stop(); + emit q->terminate(); + } +} + +sig_atomic_t OsSignalConverterPrivate::terminateRequest; diff --git a/tools/runonphone/ossignalconverter.h b/tools/runonphone/ossignalconverter.h new file mode 100644 index 0000000..f53f3c1 --- /dev/null +++ b/tools/runonphone/ossignalconverter.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OSSIGNALCONVERTER_H +#define OSSIGNALCONVERTER_H +#include <QObject> + +class OsSignalConverter : public QObject +{ + friend class OsSignalConverterPrivate; + Q_OBJECT +public: + static OsSignalConverter* instance(); + OsSignalConverter(); + ~OsSignalConverter(); +signals: + //emitted when this process is asked to quit, e.g. by SIGINT + void terminate(); +private: + OsSignalConverterPrivate *d; +}; + +#endif // OSSIGNALCONVERTER_H diff --git a/tools/runonphone/ossignalconverter_p.h b/tools/runonphone/ossignalconverter_p.h new file mode 100644 index 0000000..dddc9ca --- /dev/null +++ b/tools/runonphone/ossignalconverter_p.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the tools applications of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** 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 Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef OSSIGNALCONVERTER_P_H +#define OSSIGNALCONVERTER_P_H +#include "ossignalconverter.h" +#include <signal.h> + +class QTimer; +class OsSignalConverterPrivate : public QObject +{ + Q_OBJECT +public: + OsSignalConverterPrivate(OsSignalConverter* owner); + ~OsSignalConverterPrivate(); +private: + + static void trap(); + static void untrap(); + static void handler(int signal); + +private slots: + + void poll(); + +private: + + OsSignalConverter* q; + static sig_atomic_t terminateRequest; + QTimer *poller; +}; + +#endif // OSSIGNALCONVERTER_P_H diff --git a/tools/runonphone/runonphone.pro b/tools/runonphone/runonphone.pro index 0c63723..15dff51 100644 --- a/tools/runonphone/runonphone.pro +++ b/tools/runonphone/runonphone.pro @@ -7,10 +7,13 @@ CONFIG -= app_bundle include(symbianutils/symbianutils.pri) SOURCES += main.cpp \ - trksignalhandler.cpp + trksignalhandler.cpp \ + ossignalconverter.cpp HEADERS += trksignalhandler.h \ - serenum.h + serenum.h \ + ossignalconverter.h \ + ossignalconverter_p.h DEFINES += SYMBIANUTILS_INCLUDE_PRI |