diff options
134 files changed, 3626 insertions, 1097 deletions
@@ -7577,6 +7577,9 @@ FNR == 1 { if ( \$3 == "moc" || \$3 ~ /^Qt/ ) { target_file = first matched_target = 1 + } else if ( \$3 == "lrelease" || \$3 == "qm_phony_target" ) { + target_file = second + matched_target = 1 } } @@ -7661,6 +7664,7 @@ for part in $CFG_BUILD_PARTS; do case "$part" in tools) PART_ROOTS="$PART_ROOTS tools" ;; libs) PART_ROOTS="$PART_ROOTS src" ;; + translations) PART_ROOTS="$PART_ROOTS tools/linguist/lrelease translations" ;; examples) PART_ROOTS="$PART_ROOTS examples demos" ;; *) ;; esac @@ -7688,7 +7692,7 @@ for file in .projects .projects.3; do *s60main/s60main.pro) continue ;; *examples/activeqt/*) continue ;; */qmake/qmake.pro) continue ;; - *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*) SPEC=$QMAKESPEC ;; + *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*|*linguist/lrelease*) SPEC=$QMAKESPEC ;; *) SPEC=$XQMAKESPEC ;; esac dir=`dirname "$a" | sed -e "s;$sepath;.;g"` diff --git a/demos/qmediaplayer/mediaplayer.cpp b/demos/qmediaplayer/mediaplayer.cpp index 624bab7..267a225 100644 --- a/demos/qmediaplayer/mediaplayer.cpp +++ b/demos/qmediaplayer/mediaplayer.cpp @@ -355,13 +355,13 @@ void MediaPlayer::stateChanged(Phonon::State newstate, Phonon::State oldstate) switch (newstate) { case Phonon::ErrorState: - QMessageBox::warning(this, "Phonon Mediaplayer", m_MediaObject.errorString(), QMessageBox::Close); if (m_MediaObject.errorType() == Phonon::FatalError) { playButton->setEnabled(false); rewindButton->setEnabled(false); } else { m_MediaObject.pause(); } + QMessageBox::warning(this, "Phonon Mediaplayer", m_MediaObject.errorString(), QMessageBox::Close); break; case Phonon::PausedState: case Phonon::StoppedState: @@ -471,6 +471,8 @@ void MediaPlayer::effectChanged() void MediaPlayer::showSettingsDialog() { + playPauseForDialog(); + if (!settingsDialog) initSettingsDialog(); @@ -516,6 +518,8 @@ void MediaPlayer::showSettingsDialog() m_videoWidget->setScaleMode(oldScale); ui->audioEffectsCombo->setCurrentIndex(currentEffect); } + + playPauseForDialog(); } void MediaPlayer::initVideoWindow() @@ -652,10 +656,25 @@ void MediaPlayer::setFile(const QString &fileName) m_MediaObject.play(); } +void MediaPlayer::playPauseForDialog() +{ + // If we're running on a small screen, we want to pause the video + // when popping up dialogs. + if (m_hasSmallScreen && + (Phonon::PlayingState == m_MediaObject.state() || + Phonon::PausedState == m_MediaObject.state())) + playPause(); +} + void MediaPlayer::openFile() { + playPauseForDialog(); + QStringList fileNames = QFileDialog::getOpenFileNames(this, QString(), QDesktopServices::storageLocation(QDesktopServices::MusicLocation)); + + playPauseForDialog(); + m_MediaObject.clearQueue(); if (fileNames.size() > 0) { QString fileName = fileNames[0]; diff --git a/demos/qmediaplayer/mediaplayer.h b/demos/qmediaplayer/mediaplayer.h index 08db0e5..a1c3d92 100644 --- a/demos/qmediaplayer/mediaplayer.h +++ b/demos/qmediaplayer/mediaplayer.h @@ -111,6 +111,8 @@ private slots: void hasVideoChanged(bool); private: + void playPauseForDialog(); + QIcon playIcon; QIcon pauseIcon; QMenu *fileMenu; diff --git a/demos/qtdemo/itemcircleanimation.cpp b/demos/qtdemo/itemcircleanimation.cpp index 8c94eb7..74c3e6a 100644 --- a/demos/qtdemo/itemcircleanimation.cpp +++ b/demos/qtdemo/itemcircleanimation.cpp @@ -302,6 +302,7 @@ void ItemCircleAnimation::setupGuides() int y = 20; this->qtGuide1 = new GuideCircle(QRectF(x, y, 260, 260), -36, 342); + this->currGuide = 0; new GuideLine(QPointF(x + 240, y + 268), this->qtGuide1); new GuideLine(QPointF(x + 265, y + 246), this->qtGuide1); new GuideLine(QPointF(x + 158, y + 134), this->qtGuide1); diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index a0ae663..3a130ca 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -19,14 +19,20 @@ Merge Request: http://qt.gitorious.org * General * **************************************************************************** - - QtDBus - * The minimum required version of the D-Bus reference library is - now 0.93. - * Support for reading and writing of custom property types added. - * Support for getting return arguments in remote method invocation - via QMetaMethod::invokeMethod. +New features +------------ - - [MR#1742] Added new multimedia keys to the Qt::Key enum. + - QState, QStateMachine + * New classes for state machine framework added to QtCore. + + - QAbstractAnimation + * New animation framework added to QtCore + + - QTouchEvent + * New class for handling multitouch events added to QtGui + + - QGesture, QGestureRecognizer + * New gesture framework added to QtGui - QMatrix4x4, QGenericMatrix, QVector2D, QVector3D, QVector4D, QQuaternion * New classes to support 3D applications. @@ -37,7 +43,14 @@ Merge Request: http://qt.gitorious.org - QGraphicsEffect * New classes for applying graphics effects to graphics items and widgets. - - Boxes demo ported to use new 3D math and shader program classes. + - QWebElement + * New class for DOM access added to QtWebKit + + - QAudioInput, QAudioOutput + * New audio input and output classes. + + - QAbstractVideoSurface, QVideoFrame + * New abstract video output classes. - OpenVG graphics system added. @@ -45,28 +58,29 @@ Merge Request: http://qt.gitorious.org - Improved support for input methods in graphics view. - - QAudioInput, QAudioOutput - * New audio input and output classes. - - - QAbstractVideoSurface, QVideoFrame - * New abstract video output classes. + - [MR#1742] Added new multimedia keys to the Qt::Key enum. - - New state machine framework added to QtCore. + - Boxes demo ported to use new 3D math and shader program classes. - QtTest now supports outputting XUnit XML documents, for integrating with existing continuous integration systems. This is enabled by running the test program with the -xunitxml option. -Third party components ----------------------- + - QtDBus + * The minimum required version of the D-Bus reference library is + now 0.93. + * Support for reading and writing of custom property types added. + * Support for getting return arguments in remote method invocation + via QMetaMethod::invokeMethod. - - Updated FreeType to version 2.3.9. - - Updated harfbuzz to the latest version from fd.org. +Optimizations +------------- - - Updated sqlite to version 3.6.19. + - Optimized rendering strategy in QGraphicsView + * See list of Important Behavior Changes below - - Updated libpng to version 1.2.40 + - Improved delivery of posted events on Windows **************************************************************************** @@ -74,6 +88,7 @@ Third party components **************************************************************************** QtCore +------ - QByteArray * New overloads for QByteArray::insert() and QByteArray::prepend(). @@ -170,6 +185,7 @@ QtCore * [256468] Fixed comment indentation. QtGui +----- - Qt::escape * Now escape the double quote ("). @@ -435,6 +451,7 @@ QtGui with Qt::WA_NoSystemBackground and window opacity set. QtDBus +------ - QDBusConnection * Made sending of invalid/incomplete messages consistently fail with error @@ -447,6 +464,7 @@ QtDBus deleted or to change owners. QtNetwork +--------- - QAbstractSocket * Only disconnect from host when all bytes have been written. @@ -483,6 +501,7 @@ QtNetwork cases the connection stalled when a buffer limit was used. QtOpenGL +-------- - QGLColormap * setEntry() was inserting entries instead of replacing them. @@ -531,6 +550,7 @@ QtOpenGL - Added lots of OpenGL autotests. QtScript +-------- - Many optimizations. - Improved ECMA script compliance. @@ -538,6 +558,7 @@ QtScript to a QtScript array index. QtSql +----- - [QTBUG-3162] Views for Sql table models should not reset state on failed queries. @@ -571,6 +592,7 @@ QtSql - Add proper iODBC linking support. QtSvg +----- - QSvgHandler * [245602] [204686] Fixed gradient and solid-color referencing. @@ -582,6 +604,7 @@ QtSvg * [257052] Changed drawImage() to ignore aspect ratio. QtWebKit +-------- - Many bug fixes. @@ -614,60 +637,43 @@ QtWebKit * Support for render hints. QtXml +----- - QDomDocument * Set the codec to UTF-8 if codec not present or unknown. QtXmlPatterns +------------- - QXmlQuery * [245219] Added QXmlQuery::setFocus(const QString &focus). Qt Plugins +---------- - Tiff plugin * [258526] Rotate the image if the tiff file contains an orientation tag. * [254317] Add support for mono and indexed format - - QPlainTextEdit - * Fixed crash when clicking on a text edit which was smaller than the - height of the font used. - - - QPrinter - * [QTBUG-4497] Removed redundant SetPen command in the postscript code - when reusing a QPrinter object. +Third party components +---------------------- + + - Updated FreeType to version 2.3.9. + + - Updated harfbuzz to the latest version from fd.org. + + - Updated sqlite to version 3.6.19. + + - Updated libpng to version 1.2.40 - - QTextLayout - * [QTBUG-4468] Count tabs as multiple characters when applying a fixed - column width. - * [176401] Take into account the negative right bearing of the last - character in an item of text if the glyph extends beyond its ascent. - - - QTextDocument - * [207189] Support setting font size using short hand syntax in the - CSS "font" property. - * [201228] Remove implicit margin on bullet lists when exporting to - HTML. - * [240086] Fixed bug which caused floating objects which span several - pages to float into the second page of the document even when it's - the only existing object, causing the document to contain a blank - first page. - * [240325] Even when wrap mode is set to Qt::TextWordWrap, the layout - would sometimes break outside word boundaries when floating objects - affected the width available to the text. This has been fixed. - - - QFontEngine - * [QTBUG-2354] Support certain 'Microsoft' platform symbol fonts which - also contain a regular unicode table for exactly the symbol range of - code points. - - - QFontMetrics - * [176401] Account for right bearing in bounding rect. **************************************************************************** * Platform Specific Changes * **************************************************************************** + - Added support for the Symbian platform with integration for the S60 + framework. + - Added community supported Qt ports for QNX and VxWorks. See platform notes in the Qt documentation for details. @@ -904,6 +910,60 @@ Qt for Embedded Linux - Add powerpc mkspec and remove "empty" ppc mkspec . +DirectFB +-------- + + - When running Qt/DirectFB the DirectFB window id of a top level QWidget can + be queried using property("_q_DirectFBWindowID") + + - Allow setting the background color of the primary layer in DirectFB with + connect options. QWS_DISPLAY=directfb:bgcolor=red or + QWS_DISPLAY=directfb:bgcolor=\#aabbccdd + + - Add support for rendering mouse cursor using a top level window when cursor + support is not working in IDirectFBDisplayLayer. Define + QT_DIRECTFB_WINDOW_AS_CURSOR to enable. + + - Add experimental support for optimized locking/unlocking of surfaces. Enable + by defining QT_DIRECTFB_SUBSURFACE. + + - Fix a bug to conceptually allow using QDirectFBScreen as a subscreen of a + proxy screen. Don't make QDirectFBScreen::instance() assume that + QScreen::instance() is a QDirectFBScreen. + + - Optimize move/resize operations with DirectFB. With a properly configured + DirectFB these operations are handled for us and we don't need to force a + repaint of the window. + + - Support top level window opacity in DirectFB + + - Fix a bug when loading RGB32 images that would lead to rendering issues. + + - Fix a bug when painting with invalid pens/brushes. + + - Fix a bug that would show up when QWidget::scroll is called. + + - Implement support for loading pixmaps using IDirectFBImageProvider. + + - Disable color table support by default. This seems to work incorrectly on + most boards and loading these images will generally require an image + conversion anyway. + + - Fix a crash when resizing windows. + + - Compile with versions < 1.0. We still recommend using newer versions. + + - Considerable code cleanup + + - Various optimizations regarding painting, loading of images and creation of + surfaces. + + - Allow forcibly falling back to raster engine for painting operations by + exporting QT_DIRECTFB_FORCE_RASTER=1 + + - Reenable support for RGB32 primary surface. + + Qt for Windows CE ----------------- @@ -973,61 +1033,6 @@ Qt for Windows CE **************************************************************************** -* DirectFB * -**************************************************************************** - - - When running Qt/DirectFB the DirectFB window id of a top level QWidget can - be queried using property("_q_DirectFBWindowID") - - - Allow setting the background color of the primary layer in DirectFB with - connect options. QWS_DISPLAY=directfb:bgcolor=red or - QWS_DISPLAY=directfb:bgcolor=\#aabbccdd - - - Add support for rendering mouse cursor using a top level window when cursor - support is not working in IDirectFBDisplayLayer. Define - QT_DIRECTFB_WINDOW_AS_CURSOR to enable. - - - Add experimental support for optimized locking/unlocking of surfaces. Enable - by defining QT_DIRECTFB_SUBSURFACE. - - - Fix a bug to conceptually allow using QDirectFBScreen as a subscreen of a - proxy screen. Don't make QDirectFBScreen::instance() assume that - QScreen::instance() is a QDirectFBScreen. - - - Optimize move/resize operations with DirectFB. With a properly configured - DirectFB these operations are handled for us and we don't need to force a - repaint of the window. - - - Support top level window opacity in DirectFB - - - Fix a bug when loading RGB32 images that would lead to rendering issues. - - - Fix a bug when painting with invalid pens/brushes. - - - Fix a bug that would show up when QWidget::scroll is called. - - - Implement support for loading pixmaps using IDirectFBImageProvider. - - - Disable color table support by default. This seems to work incorrectly on - most boards and loading these images will generally require an image - conversion anyway. - - - Fix a crash when resizing windows. - - - Compile with versions < 1.0. We still recommend using newer versions. - - - Considerable code cleanup - - - Various optimizations regarding painting, loading of images and creation of - surfaces. - - - Allow forcibly falling back to raster engine for painting operations by - exporting QT_DIRECTFB_FORCE_RASTER=1 - - - Reenable support for RGB32 primary surface. - - -**************************************************************************** * Important Behavior Changes * **************************************************************************** diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index eec0492..b5dc03d 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -706,6 +706,7 @@ \o \l{tools/customtypesending}{Custom Type Sending}\raisedaster \o \l{tools/echoplugin}{Echo Plugin}\raisedaster \o \l{tools/i18n}{I18N} + \o \l{tools/inputpanel}{Input Panel}\raisedaster \o \l{tools/plugandpaint}{Plug & Paint}\raisedaster \o Plug & Paint Plugins: \l{tools/plugandpaintplugins/basictools}{Basic Tools}\raisedaster and \l{tools/plugandpaintplugins/extrafilters}{Extra Filters}\raisedaster diff --git a/doc/src/getting-started/known-issues.qdoc b/doc/src/getting-started/known-issues.qdoc index 0b63423..5c8888d 100644 --- a/doc/src/getting-started/known-issues.qdoc +++ b/doc/src/getting-started/known-issues.qdoc @@ -59,34 +59,6 @@ \section1 Installation Issues - \section2 Building the Source Package on Windows 7 - - \list - \o When building Qt 4.5.0 with Windows 7, the build fails with an error - message regarding failing to embed manifest. This a known issue with - Windows 7, explained in the Windows 7 SDK Beta - \l{http://download.microsoft.com/download/8/8/0/8808A472-6450-4723-9C87-977069714B27/ReleaseNotes.Htm} - {release notes}. A workaround for this issue is to patch the - \bold{embed_manifest_exe.prf} file with the following: - - \code - diff --git a/mkspecs/features/win32/embed_manifest_exe.prf b/mkspecs/features/win32/embed_manifest_exe.prf - index e1747f1..05f116e 100644 - --- a/mkspecs/features/win32/embed_manifest_exe.prf - +++ b/mkspecs/features/win32/embed_manifest_exe.prf - @@ -8,4 +8,9 @@ if(win32-msvc2005|win32-msvc2008):!equals(TEMPLATE_PREFIX, "vc"):equals(TEMPLATE - QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(OBJECTS_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.ma - nifest\" -outputresource:$(DESTDIR_TARGET);1$$escape_expand(\n\t)) - QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK - QMAKE_CLEAN += \"$$replace(OBJECTS_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" - + isEmpty(RC_FILE) { - + system("echo.>$$replace(OUT_PWD,/,\\)\\$$replace(OBJECTS_DIR,/,\\)\\Windows7WorkAround.rc") - + RC_FILE = $$replace(OUT_PWD,/,\\)\\$$replace(OBJECTS_DIR,/,\\)\\Windows7WorkAround.rc - + } - + - } - \endcode - \section2 Installing the Source Package on Unix systems \o If you download a Zip source package, you will need to convert diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 3abcf7c..ef29990 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -316,6 +316,37 @@ The QtScript module is part of the \l{Qt Full Framework Edition} and the \l{Open Source Versions of Qt}. + + \section1 License Information + + Qt Commercial Edition licensees that wish to distribute applications that + use the QtScript module need to be aware of their obligations under the + GNU Library General Public License (LGPL). + + Developers using the Open Source Edition can choose to redistribute + the module under the appropriate version of the GNU LGPL. + + \legalese + QtScript is licensed under the GNU Library General Public License. + Individual contributor names and copyright dates can be found + inline in the code. + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. + \endlegalese + */ /*! diff --git a/doc/src/snippets/code/src_gui_painting_qregion_unix.cpp b/doc/src/snippets/code/src_gui_painting_qregion_unix.cpp index fb1f363..ea42e70 100644 --- a/doc/src/snippets/code/src_gui_painting_qregion_unix.cpp +++ b/doc/src/snippets/code/src_gui_painting_qregion_unix.cpp @@ -41,19 +41,15 @@ //! [0] QRegion r1(10, 10, 20, 20); -r1.isNull(); // false r1.isEmpty(); // false -QRegion r2(40, 40, 20, 20); QRegion r3; -r3.isNull(); // true r3.isEmpty(); // true +QRegion r2(40, 40, 20, 20); r3 = r1.intersected(r2); // r3: intersection of r1 and r2 -r3.isNull(); // false r3.isEmpty(); // true r3 = r1.united(r2); // r3: union of r1 and r2 -r3.isNull(); // false r3.isEmpty(); // false //! [0] diff --git a/examples/help/contextsensitivehelp/doc/source.html b/examples/help/contextsensitivehelp/doc/source.html index 2140765..68b2f8c 100644 --- a/examples/help/contextsensitivehelp/doc/source.html +++ b/examples/help/contextsensitivehelp/doc/source.html @@ -4,8 +4,8 @@ <title>Water Source</title> </head> <body> - The current pipe system connects to four different sources. Be aware that only - a limited amount of water can be taken from some sources. + The current pipe system connects to four different sources. Be aware + that only a limited amount of water can be taken from some sources. <br> <table border=1> <tr> @@ -13,7 +13,7 @@ <td>Amount</td> </tr> <tr> - <td>Foundain</td> + <td>Fountain</td> <td>4000</td> </tr> <tr> diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qch b/examples/help/contextsensitivehelp/doc/wateringmachine.qch Binary files differindex e74f9b8..35d29be 100644 --- a/examples/help/contextsensitivehelp/doc/wateringmachine.qch +++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qch diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhc b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc Binary files differindex 3227c3a2..b5653c3 100644 --- a/examples/help/contextsensitivehelp/doc/wateringmachine.qhc +++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhc diff --git a/examples/help/contextsensitivehelp/doc/wateringmachine.qhp b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp index 745d881..6dd08e7 100644 --- a/examples/help/contextsensitivehelp/doc/wateringmachine.qhp +++ b/examples/help/contextsensitivehelp/doc/wateringmachine.qhp @@ -1,25 +1,25 @@ -<?xml version="1.0" encoding="utf-8" ?> +<?xml version="1.0" encoding="utf-8" ?> <QtHelpProject version="1.0"> - <virtualFolder>wateringmachine</virtualFolder> - <namespace>wateringcompany.com.1_0_0.premium</namespace> - <filterSection> - <keywords> - <keyword name="plants" id="plants" ref="plants.html"/> - <keyword name="temperature" id="temperature" ref="temperature.html"/> - <keyword name="rain" id="rain" ref="rain.html"/> - <keyword name="time" id="time" ref="time.html"/> - <keyword name="amount" id="amount" ref="amount.html"/> - <keyword name="source" id="source" ref="source.html"/> - <keyword name="filtering" id="filtering" ref="filter.html"/> - </keywords> - <files> - <file>plants.html</file> - <file>temperature.html</file> - <file>rain.html</file> - <file>time.html</file> - <file>amount.html</file> - <file>source.html</file> - <file>filter.html</file> - </files> - </filterSection> + <virtualFolder>wateringmachine</virtualFolder> + <namespace>wateringcompany.com.1-0-0.premium</namespace> + <filterSection> + <keywords> + <keyword name="plants" id="plants" ref="plants.html"/> + <keyword name="temperature" id="temperature" ref="temperature.html"/> + <keyword name="rain" id="rain" ref="rain.html"/> + <keyword name="time" id="time" ref="time.html"/> + <keyword name="amount" id="amount" ref="amount.html"/> + <keyword name="source" id="source" ref="source.html"/> + <keyword name="filtering" id="filtering" ref="filter.html"/> + </keywords> + <files> + <file>plants.html</file> + <file>temperature.html</file> + <file>rain.html</file> + <file>time.html</file> + <file>amount.html</file> + <file>source.html</file> + <file>filter.html</file> + </files> + </filterSection> </QtHelpProject> diff --git a/examples/help/contextsensitivehelp/wateringconfigdialog.ui b/examples/help/contextsensitivehelp/wateringconfigdialog.ui index a7f5349..d7a473a 100644 --- a/examples/help/contextsensitivehelp/wateringconfigdialog.ui +++ b/examples/help/contextsensitivehelp/wateringconfigdialog.ui @@ -258,7 +258,7 @@ <widget class="QComboBox" name="sourceComboBox" > <item> <property name="text" > - <string>Foundain</string> + <string>Fountain</string> </property> </item> <item> diff --git a/projects.pro b/projects.pro index aa1eb71..497acd0 100644 --- a/projects.pro +++ b/projects.pro @@ -45,7 +45,12 @@ for(PROJECT, $$list($$lower($$unique(QT_BUILD_PARTS)))) { } else:isEqual(PROJECT, docs) { contains(QT_BUILD_PARTS, tools):include(doc/doc.pri) } else:isEqual(PROJECT, translations) { - contains(QT_BUILD_PARTS, tools):include(translations/translations.pri) + contains(QT_BUILD_PARTS, tools) { + include(translations/translations.pri) # ts targets + } else { + SUBDIRS += tools/linguist/lrelease + } + SUBDIRS += translations # qm build step } else:isEqual(PROJECT, qmake) { # SUBDIRS += qmake } else { diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri index ea6e5ab..28328e7 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/javascriptcore/JavaScriptCore/JavaScriptCore.pri @@ -52,7 +52,7 @@ win32-* { # Rules when JIT enabled (not disabled) !contains(DEFINES, ENABLE_JIT=0) { - linux-g++*:greaterThan(QT_GCC_MAJOR_VERSION,3):greaterThan(QT_GCC_MINOR_VERSION,0) { + linux*-g++*:greaterThan(QT_GCC_MAJOR_VERSION,3):greaterThan(QT_GCC_MINOR_VERSION,0) { QMAKE_CXXFLAGS += -fno-stack-protector QMAKE_CFLAGS += -fno-stack-protector } diff --git a/src/3rdparty/phonon/ds9/backend.cpp b/src/3rdparty/phonon/ds9/backend.cpp index 6ed0145..fbc4bdc 100644 --- a/src/3rdparty/phonon/ds9/backend.cpp +++ b/src/3rdparty/phonon/ds9/backend.cpp @@ -41,6 +41,8 @@ namespace Phonon { namespace DS9 { + QMutex *Backend::directShowMutex = 0; + bool Backend::AudioMoniker::operator==(const AudioMoniker &other) { return other->IsEqual(*this) == S_OK; @@ -50,6 +52,8 @@ namespace Phonon Backend::Backend(QObject *parent, const QVariantList &) : QObject(parent) { + directShowMutex = &m_directShowMutex; + ::CoInitialize(0); //registering meta types @@ -62,11 +66,8 @@ namespace Phonon m_audioOutputs.clear(); m_audioEffects.clear(); ::CoUninitialize(); - } - QMutex *Backend::directShowMutex() - { - return &qobject_cast<Backend*>(qt_plugin_instance())->m_directShowMutex; + directShowMutex = 0; } QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args) diff --git a/src/3rdparty/phonon/ds9/backend.h b/src/3rdparty/phonon/ds9/backend.h index 8b020c2..7c3c109 100644 --- a/src/3rdparty/phonon/ds9/backend.h +++ b/src/3rdparty/phonon/ds9/backend.h @@ -64,7 +64,7 @@ namespace Phonon Filter getAudioOutputFilter(int index) const; - static QMutex *directShowMutex(); + static QMutex *directShowMutex; Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); diff --git a/src/3rdparty/phonon/ds9/backendnode.cpp b/src/3rdparty/phonon/ds9/backendnode.cpp index 855357a..3afcafa 100644 --- a/src/3rdparty/phonon/ds9/backendnode.cpp +++ b/src/3rdparty/phonon/ds9/backendnode.cpp @@ -58,7 +58,24 @@ namespace Phonon BackendNode::~BackendNode() { //this will remove the filter from the graph - mediaObjectDestroyed(); + FILTER_INFO info; + for(int i = 0; i < FILTER_COUNT; ++i) { + const Filter &filter = m_filters[i]; + if (!filter) + continue; + filter->QueryFilterInfo(&info); + if (info.pGraph) { + HRESULT hr = info.pGraph->RemoveFilter(filter); + + if (hr == VFW_E_NOT_STOPPED && m_mediaObject) { + m_mediaObject->ensureStopped(); + + hr = info.pGraph->RemoveFilter(filter); + } + Q_ASSERT(SUCCEEDED(hr)); + info.pGraph->Release(); + } + } } void BackendNode::setMediaObject(MediaObject *mo) diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index 250b94a..106a4c8 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -177,7 +177,7 @@ namespace Phonon void WorkerThread::handleTask() { - QMutexLocker locker(Backend::directShowMutex()); + QMutexLocker locker(Backend::directShowMutex); { QMutexLocker locker(&m_mutex); if (m_finished || m_queue.isEmpty()) { diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp index f2efaa0..99e96cd 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.cpp @@ -109,12 +109,12 @@ void MMF::AbstractMediaPlayer::pause() case GroundState: case LoadingState: case PausedState: - case ErrorState: // Do nothing break; case StoppedState: case PlayingState: + case ErrorState: case BufferingState: doPause(); stopTickTimer(); @@ -289,10 +289,6 @@ void MMF::AbstractMediaPlayer::setNextSource(const MediaSource &source) } -//----------------------------------------------------------------------------- -// VolumeObserver -//----------------------------------------------------------------------------- - void MMF::AbstractMediaPlayer::volumeChanged(qreal volume) { TRACE_CONTEXT(AbstractMediaPlayer::volumeChanged, EAudioInternal); diff --git a/src/3rdparty/phonon/mmf/abstractmediaplayer.h b/src/3rdparty/phonon/mmf/abstractmediaplayer.h index cff7bab..cb6e437 100644 --- a/src/3rdparty/phonon/mmf/abstractmediaplayer.h +++ b/src/3rdparty/phonon/mmf/abstractmediaplayer.h @@ -56,8 +56,6 @@ public: virtual MediaSource source() const; virtual void setFileSource(const Phonon::MediaSource&, RFile&); virtual void setNextSource(const MediaSource &source); - - // VolumeObserver virtual void volumeChanged(qreal volume); protected: diff --git a/src/3rdparty/phonon/mmf/abstractplayer.cpp b/src/3rdparty/phonon/mmf/abstractplayer.cpp index de2722d..caf4092 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.cpp +++ b/src/3rdparty/phonon/mmf/abstractplayer.cpp @@ -92,11 +92,6 @@ void MMF::AbstractPlayer::setTransitionTime(qint32 time) m_transitionTime = time; } - -//----------------------------------------------------------------------------- -// VolumeObserver -//----------------------------------------------------------------------------- - void MMF::AbstractPlayer::volumeChanged(qreal volume) { m_volume = volume; @@ -134,7 +129,7 @@ void MMF::AbstractPlayer::setError(Phonon::ErrorType error, Phonon::ErrorType MMF::AbstractPlayer::errorType() const { const Phonon::ErrorType result = (ErrorState == m_state) - ? errorType() : NoError; + ? m_error : NoError; return result; } diff --git a/src/3rdparty/phonon/mmf/abstractplayer.h b/src/3rdparty/phonon/mmf/abstractplayer.h index 66496cc..2e9cfa0 100644 --- a/src/3rdparty/phonon/mmf/abstractplayer.h +++ b/src/3rdparty/phonon/mmf/abstractplayer.h @@ -24,8 +24,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QObject> -#include "volumeobserver.h" - #include "videooutput.h" class RFile; @@ -49,7 +47,6 @@ class VideoOutput; * - Video, in which case the implementation is VideoPlayer */ class AbstractPlayer : public QObject - , public VolumeObserver { // Required although this class has no signals or slots // Without this, qobject_cast will fail @@ -85,7 +82,6 @@ public: virtual void setFileSource(const Phonon::MediaSource&, RFile&) = 0; virtual void setNextSource(const Phonon::MediaSource &) = 0; - // VolumeObserver virtual void volumeChanged(qreal volume); void setVideoOutput(VideoOutput* videoOutput); diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp index 82af9f1..d6e0c13 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.cpp +++ b/src/3rdparty/phonon/mmf/audiooutput.cpp @@ -24,7 +24,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "defs.h" #include "mediaobject.h" #include "utils.h" -#include "volumeobserver.h" QT_BEGIN_NAMESPACE @@ -41,7 +40,6 @@ using namespace Phonon::MMF; MMF::AudioOutput::AudioOutput(Backend *, QObject *parent) : MediaNode(parent) , m_volume(InitialVolume) - , m_observer(0) { } @@ -59,12 +57,9 @@ qreal MMF::AudioOutput::volume() const void MMF::AudioOutput::setVolume(qreal volume) { TRACE_CONTEXT(AudioOutput::setVolume, EAudioApi); - TRACE_ENTRY("observer 0x%08x volume %f", m_observer, volume); + TRACE_ENTRY("volume %f", volume); if (volume != m_volume) { - if (m_observer) { - m_observer->volumeChanged(volume); - } m_volume = volume; TRACE("emit volumeChanged(%f)", volume) @@ -86,17 +81,12 @@ bool MMF::AudioOutput::setOutputDevice(int index) return true; } -void MMF::AudioOutput::setVolumeObserver(VolumeObserver* observer) -{ - m_observer = observer; - if (m_observer) { - m_observer->volumeChanged(m_volume); - } -} - bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo) { - setVolumeObserver(mo); + // Ensure that the MediaObject has the correct initial volume + mo->volumeChanged(m_volume); + // Connect MediaObject to receive future volume changes + connect(this, SIGNAL(volumeChanged(qreal)), mo, SLOT(volumeChanged(qreal))); return true; } diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h index d0ba086..1e1e134 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.h +++ b/src/3rdparty/phonon/mmf/audiooutput.h @@ -31,12 +31,11 @@ namespace Phonon namespace MMF { class Backend; -class VolumeObserver; /** * @short AudioOutputInterface implementation for MMF. * - * Forwards volume commands to the VolumeObserver instance, + * Forwards volume commands to the MediaObject instance, * which is provided by the backend when MediaNode objects are * connected. * @@ -82,13 +81,8 @@ Q_SIGNALS: void audioDeviceFailed(); private: - - void setVolumeObserver(VolumeObserver* observer); - qreal m_volume; - // Not owned - VolumeObserver* m_observer; }; } } diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index cac27e3..7e3a67f 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -38,10 +38,6 @@ QT_BEGIN_NAMESPACE using namespace Phonon; using namespace Phonon::MMF; -/*! \class MMF::VolumeObserver - \internal -*/ - /*! \class MMF::Backend \internal */ diff --git a/src/3rdparty/phonon/mmf/mediaobject.cpp b/src/3rdparty/phonon/mmf/mediaobject.cpp index f004fd7..e42e0fa 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.cpp +++ b/src/3rdparty/phonon/mmf/mediaobject.cpp @@ -359,11 +359,6 @@ void MMF::MediaObject::setTransitionTime(qint32 time) m_player->setTransitionTime(time); } - -//----------------------------------------------------------------------------- -// VolumeObserver -//----------------------------------------------------------------------------- - void MMF::MediaObject::volumeChanged(qreal volume) { m_player->volumeChanged(volume); diff --git a/src/3rdparty/phonon/mmf/mediaobject.h b/src/3rdparty/phonon/mmf/mediaobject.h index 409918d..ee94ea2 100644 --- a/src/3rdparty/phonon/mmf/mediaobject.h +++ b/src/3rdparty/phonon/mmf/mediaobject.h @@ -30,7 +30,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "abstractplayer.h" #include "mmf_medianode.h" #include "defs.h" -#include "volumeobserver.h" QT_BEGIN_NAMESPACE @@ -46,7 +45,6 @@ class VideoOutput; */ class MediaObject : public MediaNode , public MediaObjectInterface - , public VolumeObserver { Q_OBJECT Q_INTERFACES(Phonon::MediaObjectInterface) @@ -77,9 +75,6 @@ public: virtual qint32 transitionTime() const; virtual void setTransitionTime(qint32); - // VolumeObserver - void volumeChanged(qreal volume); - /** * This class owns the AbstractPlayer, and will delete it upon * destruction. @@ -90,6 +85,9 @@ public: virtual bool activateOnMediaObject(MediaObject *); +public Q_SLOTS: + void volumeChanged(qreal volume); + Q_SIGNALS: void totalTimeChanged(qint64 length); void hasVideoChanged(bool hasVideo); diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp index ba7d005..2059fbe 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.cpp @@ -49,7 +49,7 @@ MMF::VideoPlayer::VideoPlayer() , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) , m_window(0) , m_totalTime(0) - , m_mmfOutputChangePending(false) + , m_pendingChanges(false) { construct(); } @@ -60,7 +60,7 @@ MMF::VideoPlayer::VideoPlayer(const AbstractPlayer& player) , m_screenDevice(*CCoeEnv::Static()->ScreenDevice()) , m_window(0) , m_totalTime(0) - , m_mmfOutputChangePending(false) + , m_pendingChanges(false) { construct(); } @@ -70,24 +70,11 @@ void MMF::VideoPlayer::construct() TRACE_CONTEXT(VideoPlayer::VideoPlayer, EVideoApi); TRACE_ENTRY_0(); - if (m_videoOutput) - m_videoOutput->setObserver(this); + getVideoWindow(); const TInt priority = 0; const TMdaPriorityPreference preference = EMdaPriorityPreferenceNone; - // Ignore return value - first call must always return true - getNativeWindowSystemHandles(); - - // TODO: is this the correct way to handle errors which occur when - // creating a Symbian object in the constructor of a Qt object? - - // TODO: check whether videoOutput is visible? If not, then the - // corresponding window will not be active, meaning that the - // clipping region will be set to empty and the video will not be - // visible. If this is the case, we should set m_mmfOutputChangePending - // and respond to future showEvents from the videoOutput widget. - TRAPD(err, m_player.reset(CVideoPlayerUtility::NewL ( @@ -95,7 +82,7 @@ void MMF::VideoPlayer::construct() priority, preference, m_wsSession, m_screenDevice, *m_window, - m_rect, m_rect + m_videoRect, m_videoRect )) ); @@ -110,8 +97,8 @@ MMF::VideoPlayer::~VideoPlayer() TRACE_CONTEXT(VideoPlayer::~VideoPlayer, EVideoApi); TRACE_ENTRY_0(); - if (m_videoOutput) - m_videoOutput->setObserver(0); + // QObject destructor removes all signal-slot connections involving this + // object, so we do not need to disconnect from m_videoOutput here. TRACE_EXIT_0(); } @@ -124,11 +111,7 @@ void MMF::VideoPlayer::doPlay() { TRACE_CONTEXT(VideoPlayer::doPlay, EVideoApi); - // See comment in updateMmfOutput - if (m_mmfOutputChangePending) { - TRACE_0("MMF output change pending - pushing now"); - updateMmfOutput(); - } + applyPendingChanges(); m_player->Play(); } @@ -255,13 +238,10 @@ void MMF::VideoPlayer::MvpuoPrepareComplete(TInt aError) maxVolumeChanged(m_player->MaxVolume()); if (m_videoOutput) - m_videoOutput->setFrameSize(m_frameSize); + m_videoOutput->setVideoSize(m_videoFrameSize); - // See comment in updateMmfOutput - if (m_mmfOutputChangePending) { - TRACE_0("MMF output change pending - pushing now"); - updateMmfOutput(); - } + updateVideoRect(); + applyPendingChanges(); emit totalTimeChanged(totalTime()); changeState(StoppedState); @@ -279,7 +259,7 @@ void MMF::VideoPlayer::doPrepareCompleteL(TInt aError) // Get frame size TSize size; m_player->VideoFrameSizeL(size); - m_frameSize = QSize(size.iWidth, size.iHeight); + m_videoFrameSize = QSize(size.iWidth, size.iHeight); // Get duration m_totalTime = toMilliSeconds(m_player->DurationL()); @@ -322,27 +302,178 @@ void MMF::VideoPlayer::MvpuoEvent(const TMMFEvent &aEvent) //----------------------------------------------------------------------------- -// VideoOutputObserver +// Video window updates //----------------------------------------------------------------------------- -void MMF::VideoPlayer::videoOutputRegionChanged() +void MMF::VideoPlayer::getVideoWindow() +{ + TRACE_CONTEXT(VideoPlayer::getVideoWindow, EVideoInternal); + TRACE_ENTRY_0(); + + if(m_videoOutput) { + // Dump information to log, only in debug builds + m_videoOutput->dump(); + + initVideoOutput(); + m_window = m_videoOutput->videoWindow(); + updateVideoRect(); + } else + // Top-level window + m_window = QApplication::activeWindow()->effectiveWinId()->DrawableWindow(); + + TRACE_EXIT_0(); +} + +void MMF::VideoPlayer::videoOutputChanged() +{ + TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal); + TRACE_ENTRY_0(); + + if (m_videoOutput) { + initVideoOutput(); + videoWindowChanged(); + } + + TRACE_EXIT_0(); +} + +void MMF::VideoPlayer::initVideoOutput() +{ + m_videoOutput->winId(); + m_videoOutput->setVideoSize(m_videoFrameSize); + + bool connected = connect( + m_videoOutput, SIGNAL(videoWindowChanged()), + this, SLOT(videoWindowChanged()) + ); + Q_ASSERT(connected); + + connected = connect( + m_videoOutput, SIGNAL(aspectRatioChanged()), + this, SLOT(aspectRatioChanged()) + ); + Q_ASSERT(connected); + + connected = connect( + m_videoOutput, SIGNAL(scaleModeChanged()), + this, SLOT(scaleModeChanged()) + ); + Q_ASSERT(connected); + + // Suppress warnings in release builds + Q_UNUSED(connected); +} + +void MMF::VideoPlayer::videoWindowChanged() { TRACE_CONTEXT(VideoPlayer::videoOutputRegionChanged, EVideoInternal); TRACE_ENTRY("state %d", state()); - const bool changed = getNativeWindowSystemHandles(); + m_window = m_videoOutput->videoWindow(); - // See comment in updateMmfOutput - if (changed) { - if (state() == LoadingState) - m_mmfOutputChangePending = true; - else - updateMmfOutput(); + updateVideoRect(); + + TRACE_EXIT_0(); +} + +// Helper function for aspect ratio / scale mode handling +QSize scaleToAspect(const QSize& srcRect, int aspectWidth, int aspectHeight) +{ + const qreal aspectRatio = qreal(aspectWidth) / aspectHeight; + + int width = srcRect.width(); + int height = srcRect.width() / aspectRatio; + if (height > srcRect.height()){ + height = srcRect.height(); + width = srcRect.height() * aspectRatio; } + return QSize(width, height); +} + +void MMF::VideoPlayer::updateVideoRect() +{ + QRect videoRect; + const QRect windowRect = m_videoOutput->videoWindowRect(); + const QSize windowSize = windowRect.size(); + + // Calculate size of smallest rect which contains video frame size + // and conforms to aspect ratio + switch (m_videoOutput->aspectRatio()) { + case Phonon::VideoWidget::AspectRatioAuto: + videoRect.setSize(m_videoFrameSize); + break; + + case Phonon::VideoWidget::AspectRatioWidget: + videoRect.setSize(windowSize); + break; + + case Phonon::VideoWidget::AspectRatio4_3: + videoRect.setSize(scaleToAspect(m_videoFrameSize, 4, 3)); + break; + + case Phonon::VideoWidget::AspectRatio16_9: + videoRect.setSize(scaleToAspect(m_videoFrameSize, 16, 9)); + break; + } + + // Scale to fill the window width + const int windowWidth = windowSize.width(); + const int windowHeight = windowSize.height(); + const qreal windowScaleFactor = qreal(windowWidth) / videoRect.width(); + int videoWidth = windowWidth; + int videoHeight = videoRect.height() * windowScaleFactor; + + const qreal windowToVideoHeightRatio = qreal(windowHeight) / videoHeight; + + switch(m_videoOutput->scaleMode()) { + case Phonon::VideoWidget::ScaleAndCrop: + if(videoHeight < windowHeight) { + videoWidth *= windowToVideoHeightRatio; + videoHeight = windowHeight; + } + break; + case Phonon::VideoWidget::FitInView: + default: + if(videoHeight > windowHeight) { + videoWidth *= windowToVideoHeightRatio; + videoHeight = windowHeight; + } + break; + } + + // Calculate scale factors + m_scaleWidth = 100.0f * videoWidth / m_videoFrameSize.width(); + m_scaleHeight = 100.0f * videoHeight / m_videoFrameSize.height(); + + m_videoRect = qt_QRect2TRect(windowRect); + + if (state() == LoadingState) + m_pendingChanges = true; + else { + applyVideoWindowChange(); + m_pendingChanges = false; + } +} + +void MMF::VideoPlayer::aspectRatioChanged() +{ + TRACE_CONTEXT(VideoPlayer::aspectRatioChanged, EVideoInternal); + TRACE_ENTRY("state %d aspectRatio %d", state()); + + updateVideoRect(); TRACE_EXIT_0(); } +void MMF::VideoPlayer::scaleModeChanged() +{ + TRACE_CONTEXT(VideoPlayer::scaleModeChanged, EVideoInternal); + TRACE_ENTRY("state %d", state()); + + updateVideoRect(); + + TRACE_EXIT_0(); +} #ifndef QT_NO_DEBUG @@ -383,113 +514,61 @@ void getDsaRegion(RWsSession &session, const RWindowBase &window) #endif // _DEBUG -void MMF::VideoPlayer::updateMmfOutput() +void MMF::VideoPlayer::applyPendingChanges() { - TRACE_CONTEXT(VideoPlayer::updateMmfOutput, EVideoInternal); - TRACE_ENTRY_0(); + if(m_pendingChanges) + applyVideoWindowChange(); - // Calling SetDisplayWindowL is a no-op unless the MMF controller has - // been loaded, so we shouldn't do it. Instead, the - // m_mmfOutputChangePending flag is used to record the fact that we - // need to call SetDisplayWindowL, and this is checked in - // MvpuoPrepareComplete, at which point the MMF controller has been - // loaded. + m_pendingChanges = false; +} + +void MMF::VideoPlayer::applyVideoWindowChange() +{ + TRACE_CONTEXT(VideoPlayer::applyVideoWindowChange, EVideoInternal); + TRACE_ENTRY_0(); #ifndef QT_NO_DEBUG getDsaRegion(m_wsSession, *m_window); #endif - TRAPD(err, - m_player->SetDisplayWindowL - ( - m_wsSession, m_screenDevice, - *m_window, - m_rect, m_rect - ) - ); + static const TBool antialias = ETrue; - if (KErrNone != err) { - TRACE("SetDisplayWindowL error %d", err); + TRAPD(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, antialias)); + if(KErrNone != err) { + TRACE("SetScaleFactorL (1) err %d", err); setError(NormalError); } - m_mmfOutputChangePending = false; + if(KErrNone == err) { + TRAP(err, + m_player->SetDisplayWindowL + ( + m_wsSession, m_screenDevice, + *m_window, + m_videoRect, m_videoRect + ) + ); + + if (KErrNone != err) { + TRACE("SetDisplayWindowL err %d", err); + setError(NormalError); + } else { + TRAP(err, m_player->SetScaleFactorL(m_scaleWidth, m_scaleHeight, antialias)); + if(KErrNone != err) { + TRACE("SetScaleFactorL (2) err %d", err); + setError(NormalError); + } + } + } TRACE_EXIT_0(); } //----------------------------------------------------------------------------- -// Private functions +// Metadata //----------------------------------------------------------------------------- -void MMF::VideoPlayer::videoOutputChanged() -{ - TRACE_CONTEXT(VideoPlayer::videoOutputChanged, EVideoInternal); - TRACE_ENTRY_0(); - - if (m_videoOutput) { - m_videoOutput->setObserver(this); - m_videoOutput->setFrameSize(m_frameSize); - } - - videoOutputRegionChanged(); - - TRACE_EXIT_0(); -} - -bool MMF::VideoPlayer::getNativeWindowSystemHandles() -{ - TRACE_CONTEXT(VideoPlayer::getNativeWindowSystemHandles, EVideoInternal); - TRACE_ENTRY_0(); - - CCoeControl *control = 0; - - if (m_videoOutput) - // Create native window - control = m_videoOutput->winId(); - else - // Get top-level window - control = QApplication::activeWindow()->effectiveWinId(); - -#ifndef QT_NO_DEBUG - if (m_videoOutput) { - QScopedPointer<ObjectDump::QDumper> dumper(new ObjectDump::QDumper); - dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs - ObjectDump::addDefaultAnnotators(*dumper); - TRACE_0("Dumping VideoOutput:"); - dumper->dumpObject(*m_videoOutput); - } - else { - TRACE_0("m_videoOutput is null - dumping top-level control info:"); - TRACE("control %08x", control); - TRACE("control.parent %08x", control->Parent()); - TRACE("control.isVisible %d", control->IsVisible()); - TRACE("control.rect %d,%d %dx%d", - control->Position().iX, control->Position().iY, - control->Size().iWidth, control->Size().iHeight); - TRACE("control.ownsWindow %d", control->OwnsWindow()); - } -#endif - - RWindowBase *const window = control->DrawableWindow(); - const TRect rect(window->AbsPosition(), window->Size()); - - TRACE("rect %d %d - %d %d", - rect.iTl.iX, rect.iTl.iY, - rect.iBr.iX, rect.iBr.iY); - - bool changed = false; - - if (window != m_window || rect != m_rect) { - m_window = window; - m_rect = rect; - changed = true; - } - - TRACE_RETURN("changed %d", changed); -} - int MMF::VideoPlayer::numberOfMetaDataEntries() const { int numberOfEntries = 0; diff --git a/src/3rdparty/phonon/mmf/mmf_videoplayer.h b/src/3rdparty/phonon/mmf/mmf_videoplayer.h index fa4e59b..599bb88 100644 --- a/src/3rdparty/phonon/mmf/mmf_videoplayer.h +++ b/src/3rdparty/phonon/mmf/mmf_videoplayer.h @@ -23,7 +23,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "abstractmediaplayer.h" #include "videooutput.h" -#include "videooutputobserver.h" QT_BEGIN_NAMESPACE @@ -40,7 +39,6 @@ namespace MMF */ class VideoPlayer : public AbstractMediaPlayer , public MVideoPlayerUtilityObserver - , public VideoOutputObserver { Q_OBJECT @@ -70,8 +68,10 @@ public: virtual void MvpuoPlayComplete(TInt aError); virtual void MvpuoEvent(const TMMFEvent &aEvent); - // VideoOutputObserver - virtual void videoOutputRegionChanged(); +public Q_SLOTS: + void videoWindowChanged(); + void aspectRatioChanged(); + void scaleModeChanged(); private: void construct(); @@ -81,10 +81,13 @@ private: // AbstractPlayer virtual void videoOutputChanged(); - // Returns true if handles have changed - bool getNativeWindowSystemHandles(); + void getVideoWindow(); + void initVideoOutput(); - void updateMmfOutput(); + void updateVideoRect(); + + void applyPendingChanges(); + void applyVideoWindowChange(); // AbstractMediaPlayer virtual int numberOfMetaDataEntries() const; @@ -97,12 +100,17 @@ private: RWsSession& m_wsSession; CWsScreenDevice& m_screenDevice; RWindowBase* m_window; - TRect m_rect; - QSize m_frameSize; + /* Extent of the video display - will be clipped to m_windowRect */ + TRect m_videoRect; + + TReal32 m_scaleWidth; + TReal32 m_scaleHeight; + + QSize m_videoFrameSize; qint64 m_totalTime; - bool m_mmfOutputChangePending; + bool m_pendingChanges; }; diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp b/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp deleted file mode 100644 index 6207dac..0000000 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_stub.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* This file is part of the KDE project. - -Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - -This library is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation, either version 2.1 or 3 of the License. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with this library. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#include "objectdump.h" - -QT_BEGIN_NAMESPACE - -namespace ObjectDump -{ - -void addDefaultAnnotators_sys(QDumper& /*dumper*/) -{ - -} - -void addDefaultAnnotators_sys(QVisitor& /*visitor*/) -{ - -} - -} // namespace ObjectDump - -QT_END_NAMESPACE - - diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp b/src/3rdparty/phonon/mmf/objectdump.cpp index 9add439..6b6b71e 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.cpp +++ b/src/3rdparty/phonon/mmf/objectdump.cpp @@ -16,6 +16,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef QT_NO_DEBUG + #include <QByteArray> #include <QDebug> #include <QHash> @@ -523,5 +525,5 @@ void dumpAncestors(const QObject& leaf, QVisitor& visitor) QT_END_NAMESPACE - +#endif diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h b/src/3rdparty/phonon/mmf/objectdump.h index e94b3ac..e94b3ac 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump.h +++ b/src/3rdparty/phonon/mmf/objectdump.h diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h b/src/3rdparty/phonon/mmf/objectdump_global.h index b8987e0..b8987e0 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_global.h +++ b/src/3rdparty/phonon/mmf/objectdump_global.h diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp b/src/3rdparty/phonon/mmf/objectdump_symbian.cpp index 03220a7..41dd240 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.cpp +++ b/src/3rdparty/phonon/mmf/objectdump_symbian.cpp @@ -16,6 +16,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef QT_NO_DEBUG + #include <QTextStream> #include <QWidget> #include <coecntrl.h> @@ -99,46 +101,39 @@ QList<QByteArray> QAnnotatorWindow::annotation(const QObject& object) if (widget) { const CCoeControl* control = widget->effectiveWinId(); - RDrawableWindow *window = 0; - - if (control && (window = control->DrawableWindow())) { - QByteArray array; - QTextStream stream(&array); + if (control) { + RDrawableWindow *const window = control->DrawableWindow(); + if(window) { + QByteArray array; + QTextStream stream(&array); - stream << "window: "; + stream << "window: "; - // ClientHandle() is available first in 5.0. -#if !defined(__SERIES60_31__) && !defined(__S60_32__) - if (QSysInfo::s60Version() > QSysInfo::SV_S60_3_2) - // Client-side window handle + // Server-side address of CWsWindow object + // This is useful for correlation with the window tree dumped by the window + // server (see RWsSession::LogCommand). // Cast to a void pointer so that log output is in hexadecimal format. - stream << "cli " << reinterpret_cast<const void*>(window->ClientHandle()) << ' '; -#endif + stream << "srv " << reinterpret_cast<const void*>(window->WsHandle()) << ' '; - // Server-side address of CWsWindow object - // This is useful for correlation with the window tree dumped by the window - // server (see RWsSession::LogCommand). - // Cast to a void pointer so that log output is in hexadecimal format. - stream << "srv " << reinterpret_cast<const void*>(window->WsHandle()) << ' '; + stream << "group " << window->WindowGroupId() << ' '; - stream << "group " << window->WindowGroupId() << ' '; - - // Client-side handle to the parent window. - // Cast to a void pointer so that log output is in hexadecimal format. - stream << "parent " << reinterpret_cast<const void*>(window->Parent()) << ' '; + // Client-side handle to the parent window. + // Cast to a void pointer so that log output is in hexadecimal format. + stream << "parent " << reinterpret_cast<const void*>(window->Parent()) << ' '; - stream << window->Position().iX << ',' << window->Position().iY << ' '; - stream << '(' << window->AbsPosition().iX << ',' << window->AbsPosition().iY << ") "; - stream << window->Size().iWidth << 'x' << window->Size().iHeight << ' '; + stream << window->Position().iX << ',' << window->Position().iY << ' '; + stream << '(' << window->AbsPosition().iX << ',' << window->AbsPosition().iY << ") "; + stream << window->Size().iWidth << 'x' << window->Size().iHeight << ' '; - const TDisplayMode displayMode = window->DisplayMode(); - stream << "mode " << displayMode << ' '; + const TDisplayMode displayMode = window->DisplayMode(); + stream << "mode " << displayMode << ' '; - stream << "ord " << window->OrdinalPosition(); + stream << "ord " << window->OrdinalPosition(); - stream.flush(); - result.append(array); + stream.flush(); + result.append(array); + } } } @@ -165,4 +160,5 @@ void addDefaultAnnotators_sys(QVisitor& visitor) QT_END_NAMESPACE +#endif diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h b/src/3rdparty/phonon/mmf/objectdump_symbian.h index 563c862..563c862 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objectdump_symbian.h +++ b/src/3rdparty/phonon/mmf/objectdump_symbian.h diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp b/src/3rdparty/phonon/mmf/objecttree.cpp index bc61435..750db22 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.cpp +++ b/src/3rdparty/phonon/mmf/objecttree.cpp @@ -16,6 +16,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef QT_NO_DEBUG + #include <QTextStream> #include <QWidget> #include "objecttree.h" @@ -98,5 +100,5 @@ AncestorConstIterator::AncestorConstIterator(const QObject& leaf) QT_END_NAMESPACE - +#endif diff --git a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h b/src/3rdparty/phonon/mmf/objecttree.h index 98bdf14..98bdf14 100644 --- a/src/3rdparty/phonon/mmf/mmfphonondebug/objecttree.h +++ b/src/3rdparty/phonon/mmf/objecttree.h diff --git a/src/3rdparty/phonon/mmf/videooutput.cpp b/src/3rdparty/phonon/mmf/videooutput.cpp index 1b338a2..ddf30de 100644 --- a/src/3rdparty/phonon/mmf/videooutput.cpp +++ b/src/3rdparty/phonon/mmf/videooutput.cpp @@ -19,7 +19,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "ancestormovemonitor.h" #include "utils.h" #include "videooutput.h" -#include "videooutputobserver.h" #ifndef QT_NO_DEBUG #include "objectdump.h" @@ -30,8 +29,11 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QMoveEvent> #include <QResizeEvent> +#include <QtCore/private/qcore_symbian_p.h> // for qt_TRect2QRect #include <QtGui/private/qwidget_p.h> // to access QWExtra +#include <coecntrl.h> + QT_BEGIN_NAMESPACE using namespace Phonon; @@ -42,6 +44,16 @@ using namespace Phonon::MMF; */ //----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio = + Phonon::VideoWidget::AspectRatioAuto; +static const Phonon::VideoWidget::ScaleMode DefaultScaleMode = + Phonon::VideoWidget::FitInView; + + +//----------------------------------------------------------------------------- // Constructor / destructor //----------------------------------------------------------------------------- @@ -49,7 +61,8 @@ MMF::VideoOutput::VideoOutput (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : QWidget(parent) , m_ancestorMoveMonitor(ancestorMoveMonitor) - , m_observer(0) + , m_aspectRatio(DefaultAspectRatio) + , m_scaleMode(DefaultScaleMode) { TRACE_CONTEXT(VideoOutput::VideoOutput, EVideoInternal); TRACE_ENTRY("parent 0x%08x", parent); @@ -66,6 +79,7 @@ MMF::VideoOutput::VideoOutput // to be invisible when running on the target device. qt_widget_private(this)->extraData()->disableBlit = true; + getVideoWindowRect(); registerForAncestorMoved(); dump(); @@ -83,33 +97,35 @@ MMF::VideoOutput::~VideoOutput() TRACE_EXIT_0(); } -void MMF::VideoOutput::setFrameSize(const QSize& frameSize) +void MMF::VideoOutput::setVideoSize(const QSize& frameSize) { - TRACE_CONTEXT(VideoOutput::setFrameSize, EVideoInternal); + TRACE_CONTEXT(VideoOutput::setVideoSize, EVideoInternal); TRACE("oldSize %d %d newSize %d %d", - m_frameSize.width(), m_frameSize.height(), + m_videoFrameSize.width(), m_videoFrameSize.height(), frameSize.width(), frameSize.height()); - if (frameSize != m_frameSize) { - m_frameSize = frameSize; + if (frameSize != m_videoFrameSize) { + m_videoFrameSize = frameSize; updateGeometry(); } } -void MMF::VideoOutput::setObserver(VideoOutputObserver* observer) -{ - TRACE_CONTEXT(VideoOutput::setObserver, EVideoInternal); - TRACE("observer 0x%08x", observer); - - m_observer = observer; -} - void MMF::VideoOutput::ancestorMoved() { TRACE_CONTEXT(VideoOutput::ancestorMoved, EVideoInternal); TRACE_ENTRY_0(); - videoOutputRegionChanged(); + RWindowBase *const window = videoWindow(); + + if(window) { + const TPoint newWindowPosSymbian = window->AbsPosition(); + const QPoint newWindowPos(newWindowPosSymbian.iX, newWindowPosSymbian.iY); + + if(newWindowPos != m_videoWindowRect.topLeft()) { + m_videoWindowRect.moveTo(newWindowPos); + emit videoWindowChanged(); + } + } TRACE_EXIT_0(); } @@ -123,9 +139,8 @@ QSize MMF::VideoOutput::sizeHint() const // TODO: replace this with a more sensible default QSize result(320, 240); - if (!m_frameSize.isNull()) { - result = m_frameSize; - } + if (!m_videoFrameSize.isNull()) + result = m_videoFrameSize; return result; } @@ -149,7 +164,10 @@ void MMF::VideoOutput::resizeEvent(QResizeEvent* event) event->oldSize().width(), event->oldSize().height(), event->size().width(), event->size().height()); - videoOutputRegionChanged(); + if(event->size() != event->oldSize()) { + m_videoWindowRect.setSize(event->size()); + emit videoWindowChanged(); + } } void MMF::VideoOutput::moveEvent(QMoveEvent* event) @@ -159,7 +177,10 @@ void MMF::VideoOutput::moveEvent(QMoveEvent* event) event->oldPos().x(), event->oldPos().y(), event->pos().x(), event->pos().y()); - videoOutputRegionChanged(); + if(event->pos() != event->oldPos()) { + m_videoWindowRect.moveTo(event->pos()); + emit videoWindowChanged(); + } } bool MMF::VideoOutput::event(QEvent* event) @@ -168,7 +189,8 @@ bool MMF::VideoOutput::event(QEvent* event) if (event->type() == QEvent::WinIdChange) { TRACE_0("WinIdChange"); - videoOutputRegionChanged(); + getVideoWindowRect(); + emit videoWindowChanged(); return true; } else if (event->type() == QEvent::ParentChange) { // Tell ancestor move monitor to update ancestor list for this widget @@ -180,14 +202,66 @@ bool MMF::VideoOutput::event(QEvent* event) //----------------------------------------------------------------------------- +// Public functions +//----------------------------------------------------------------------------- + +RWindowBase* MMF::VideoOutput::videoWindow() +{ + CCoeControl *control = internalWinId(); + if(!control) + control = effectiveWinId(); + + RWindowBase *window = 0; + if(control) + window = control->DrawableWindow(); + + return window; +} + +const QRect& MMF::VideoOutput::videoWindowRect() const +{ + return m_videoWindowRect; +} + +Phonon::VideoWidget::AspectRatio MMF::VideoOutput::aspectRatio() const +{ + return m_aspectRatio; +} + +void MMF::VideoOutput::setAspectRatio + (Phonon::VideoWidget::AspectRatio aspectRatio) +{ + if(m_aspectRatio != aspectRatio) { + m_aspectRatio = aspectRatio; + emit aspectRatioChanged(); + } +} + +Phonon::VideoWidget::ScaleMode MMF::VideoOutput::scaleMode() const +{ + return m_scaleMode; +} + +void MMF::VideoOutput::setScaleMode + (Phonon::VideoWidget::ScaleMode scaleMode) +{ + if(m_scaleMode != scaleMode) { + m_scaleMode = scaleMode; + emit scaleModeChanged(); + } +} + + +//----------------------------------------------------------------------------- // Private functions //----------------------------------------------------------------------------- -void MMF::VideoOutput::videoOutputRegionChanged() +void MMF::VideoOutput::getVideoWindowRect() { - dump(); - if (m_observer) - m_observer->videoOutputRegionChanged(); + RWindowBase *const window = videoWindow(); + if(window) + m_videoWindowRect = + qt_TRect2QRect(TRect(window->AbsPosition(), window->Size())); } void MMF::VideoOutput::registerForAncestorMoved() @@ -199,15 +273,20 @@ void MMF::VideoOutput::dump() const { #ifndef QT_NO_DEBUG TRACE_CONTEXT(VideoOutput::dump, EVideoInternal); + QScopedPointer<ObjectDump::QVisitor> visitor(new ObjectDump::QVisitor); visitor->setPrefix("Phonon::MMF"); // to aid searchability of logs ObjectDump::addDefaultAnnotators(*visitor); TRACE("Dumping tree from leaf 0x%08x:", this); - //ObjectDump::dumpAncestors(*this, *visitor); ObjectDump::dumpTreeFromLeaf(*this, *visitor); + + QScopedPointer<ObjectDump::QDumper> dumper(new ObjectDump::QDumper); + dumper->setPrefix("Phonon::MMF"); // to aid searchability of logs + ObjectDump::addDefaultAnnotators(*dumper); + TRACE_0("Dumping VideoOutput:"); + dumper->dumpObject(*this); #endif } - QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/videooutput.h b/src/3rdparty/phonon/mmf/videooutput.h index db4d127..6dfe69d 100644 --- a/src/3rdparty/phonon/mmf/videooutput.h +++ b/src/3rdparty/phonon/mmf/videooutput.h @@ -24,6 +24,11 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QRect> #include "defs.h" +#include <Phonon/VideoWidget> + +#include <e32std.h> +class RWindowBase; + QT_BEGIN_NAMESPACE namespace Phonon @@ -31,7 +36,6 @@ namespace Phonon namespace MMF { class AncestorMoveMonitor; -class VideoOutputObserver; class VideoOutput : public QWidget { @@ -41,11 +45,29 @@ public: VideoOutput(AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent); ~VideoOutput(); - void setFrameSize(const QSize& size); - void setObserver(VideoOutputObserver* observer); + // Set size of video frame. Called by VideoPlayer. + void setVideoSize(const QSize& size); + + RWindowBase* videoWindow(); + const QRect& videoWindowRect() const; + Phonon::VideoWidget::AspectRatio aspectRatio() const; + void setAspectRatio(Phonon::VideoWidget::AspectRatio aspectRatio); + + Phonon::VideoWidget::ScaleMode scaleMode() const; + void setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode); + + // Called by AncestorMoveMonitor void ancestorMoved(); + // Debugging output + void dump() const; + +Q_SIGNALS: + void videoWindowChanged(); + void aspectRatioChanged(); + void scaleModeChanged(); + protected: // Override QWidget functions QSize sizeHint() const; @@ -55,19 +77,18 @@ protected: bool event(QEvent* event); private: - void dump() const; - void videoOutputRegionChanged(); - + void getVideoWindowRect(); void registerForAncestorMoved(); private: // Not owned AncestorMoveMonitor* m_ancestorMoveMonitor; - // Not owned - VideoOutputObserver* m_observer; + QSize m_videoFrameSize; + QRect m_videoWindowRect; - QSize m_frameSize; + Phonon::VideoWidget::AspectRatio m_aspectRatio; + Phonon::VideoWidget::ScaleMode m_scaleMode; }; } diff --git a/src/3rdparty/phonon/mmf/videooutputobserver.h b/src/3rdparty/phonon/mmf/videooutputobserver.h deleted file mode 100644 index e3ba305..0000000 --- a/src/3rdparty/phonon/mmf/videooutputobserver.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file is part of the KDE project. - -Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - -This library is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation, either version 2.1 or 3 of the License. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with this library. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#ifndef PHONON_MMF_VIDEOOUTPUTOBSERVER_H -#define PHONON_MMF_VIDEOOUTPUTOBSERVER_H - -#include <QtGlobal> - -QT_BEGIN_NAMESPACE - -namespace Phonon -{ -namespace MMF -{ -/** - * Interface via which VideoOutput notifies VideoPlayer of changes to the - * video output screen region. - */ -class VideoOutputObserver -{ -public: - virtual void videoOutputRegionChanged() = 0; -}; -} -} - -QT_END_NAMESPACE - -#endif diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index 7d7abf1..bd22307 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -35,11 +35,7 @@ using namespace Phonon::MMF; // Constants //----------------------------------------------------------------------------- -static const Phonon::VideoWidget::AspectRatio DefaultAspectRatio = - Phonon::VideoWidget::AspectRatioAuto; static const qreal DefaultBrightness = 1.0; -static const Phonon::VideoWidget::ScaleMode DefaultScaleMode = - Phonon::VideoWidget::FitInView; static const qreal DefaultContrast = 1.0; static const qreal DefaultHue = 1.0; static const qreal DefaultSaturation = 1.0; @@ -52,10 +48,8 @@ static const qreal DefaultSaturation = 1.0; MMF::VideoWidget::VideoWidget (AncestorMoveMonitor* ancestorMoveMonitor, QWidget* parent) : MediaNode(parent) - , m_widget(new VideoOutput(ancestorMoveMonitor, parent)) - , m_aspectRatio(DefaultAspectRatio) + , m_videoOutput(new VideoOutput(ancestorMoveMonitor, parent)) , m_brightness(DefaultBrightness) - , m_scaleMode(DefaultScaleMode) , m_contrast(DefaultContrast) , m_hue(DefaultHue) , m_saturation(DefaultSaturation) @@ -81,7 +75,7 @@ MMF::VideoWidget::~VideoWidget() Phonon::VideoWidget::AspectRatio MMF::VideoWidget::aspectRatio() const { - return m_aspectRatio; + return m_videoOutput->aspectRatio(); } void MMF::VideoWidget::setAspectRatio @@ -90,7 +84,7 @@ void MMF::VideoWidget::setAspectRatio TRACE_CONTEXT(VideoWidget::setAspectRatio, EVideoApi); TRACE("aspectRatio %d", aspectRatio); - m_aspectRatio = aspectRatio; + m_videoOutput->setAspectRatio(aspectRatio); } qreal MMF::VideoWidget::brightness() const @@ -108,7 +102,7 @@ void MMF::VideoWidget::setBrightness(qreal brightness) Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const { - return m_scaleMode; + return m_videoOutput->scaleMode(); } void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode) @@ -116,7 +110,7 @@ void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode) TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi); TRACE("setScaleMode %d", setScaleMode); - m_scaleMode = scaleMode; + m_videoOutput->setScaleMode(scaleMode); } qreal MMF::VideoWidget::contrast() const @@ -160,17 +154,12 @@ void MMF::VideoWidget::setSaturation(qreal saturation) QWidget* MMF::VideoWidget::widget() { - return m_widget.data(); -} - -VideoOutput& MMF::VideoWidget::videoOutput() -{ - return *static_cast<VideoOutput*>(widget()); + return m_videoOutput.data(); } bool MMF::VideoWidget::activateOnMediaObject(MediaObject *mo) { - mo->setVideoOutput(&videoOutput()); + mo->setVideoOutput(m_videoOutput.data()); return true; } diff --git a/src/3rdparty/phonon/mmf/videowidget.h b/src/3rdparty/phonon/mmf/videowidget.h index 318dfae..2f0978b 100644 --- a/src/3rdparty/phonon/mmf/videowidget.h +++ b/src/3rdparty/phonon/mmf/videowidget.h @@ -20,6 +20,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #define PHONON_MMF_VIDEOWIDGET_H #include "mmf_medianode.h" +#include "videooutput.h" #include <QtGui/QWidget> #include <Phonon/VideoWidget> @@ -59,17 +60,13 @@ public: virtual void setSaturation(qreal saturation); virtual QWidget *widget(); - VideoOutput& videoOutput(); - protected: virtual bool activateOnMediaObject(MediaObject *mo); private: - QScopedPointer<QWidget> m_widget; + QScopedPointer<VideoOutput> m_videoOutput; - Phonon::VideoWidget::AspectRatio m_aspectRatio; qreal m_brightness; - Phonon::VideoWidget::ScaleMode m_scaleMode; qreal m_contrast; qreal m_hue; qreal m_saturation; diff --git a/src/3rdparty/phonon/mmf/volumeobserver.h b/src/3rdparty/phonon/mmf/volumeobserver.h deleted file mode 100644 index bedd3de..0000000 --- a/src/3rdparty/phonon/mmf/volumeobserver.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file is part of the KDE project. - -Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). - -This library is free software: you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as published by -the Free Software Foundation, either version 2.1 or 3 of the License. - -This library is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Lesser General Public License for more details. - -You should have received a copy of the GNU Lesser General Public License -along with this library. If not, see <http://www.gnu.org/licenses/>. - -*/ - -#ifndef PHONON_MMF_VOLUMEOBSERVER_H -#define PHONON_MMF_VOLUMEOBSERVER_H - -#include <QtGlobal> - -QT_BEGIN_NAMESPACE - -namespace Phonon -{ -namespace MMF -{ -/** - * Interface used by AudioOutput to pass volume control commands - * back along the audio path to the MediaObject. - */ -class VolumeObserver -{ -public: - virtual void volumeChanged(qreal volume) = 0; -}; -} -} - -QT_END_NAMESPACE - -#endif diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri index 8bd4225..bb531e5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri +++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pri @@ -54,7 +54,7 @@ win32-* { # Rules when JIT enabled (not disabled) !contains(DEFINES, ENABLE_JIT=0) { - linux-g++*:greaterThan(QT_GCC_MAJOR_VERSION,3):greaterThan(QT_GCC_MINOR_VERSION,0) { + linux*-g++*:greaterThan(QT_GCC_MAJOR_VERSION,3):greaterThan(QT_GCC_MINOR_VERSION,0) { QMAKE_CXXFLAGS += -fno-stack-protector QMAKE_CFLAGS += -fno-stack-protector } diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc index 09dfae5..411762a 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc +++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc @@ -25,13 +25,10 @@ Qt Commercial Edition licensees that wish to distribute applications that use the QtWebKit module need to be aware of their obligations under the - GNU Lesser General Public License (LGPL). + GNU Library General Public License (LGPL). Developers using the Open Source Edition can choose to redistribute - the module under the appropriate version of the GNU LGPL; version 2.1 - for applications and libraries licensed under the GNU GPL version 2, - or version 3 for applications and libraries licensed under the GNU - GPL version 2. + the module under the appropriate version of the GNU LGPL. \legalese WebKit is licensed under the GNU Library General Public License. diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 0fe757d..b916b4d 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -19,7 +19,7 @@ INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global # Only used on platforms with CONFIG += precompile_header PRECOMPILED_HEADER = global/qt_pch.h -linux-g++*:!static { +linux*-g++*:!static { QMAKE_LFLAGS += -Wl,-e,qt_core_boilerplate prog=$$quote(if (/program interpreter: (.*)]/) { print $1; }) DEFINES += ELF_INTERPRETER=\\\"$$system(readelf -l /bin/ls | perl -n -e \'$$prog\')\\\" diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 77785e8..1c52d4c 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -217,6 +217,9 @@ // Session Manager //#define QT_NO_SESSIONMANAGER +// QSettings +//#define QT_NO_SETTINGS + // QSharedMemory //#define QT_NO_SHAREDMEMORY @@ -352,6 +355,11 @@ #define QT_NO_IMAGEFORMAT_XPM #endif +// QLibrary +#if !defined(QT_NO_LIBRARY) && (defined(QT_NO_SETTINGS)) +#define QT_NO_LIBRARY +#endif + // QMenu #if !defined(QT_NO_MENU) && (defined(QT_NO_ACTION)) #define QT_NO_MENU @@ -367,6 +375,11 @@ #define QT_NO_PHONON_SEEKSLIDER #endif +// Phonon::AbstractMediaStream +#if !defined(QT_NO_PHONON_SETTINGSGROUP) && (defined(QT_NO_SETTINGS)) +#define QT_NO_PHONON_SETTINGSGROUP +#endif + // Phonon::VideoPlayer #if !defined(QT_NO_PHONON_VIDEOPLAYER) && (defined(QT_NO_PHONON_VIDEO)) #define QT_NO_PHONON_VIDEOPLAYER @@ -422,11 +435,6 @@ #define QT_NO_SCROLLBAR #endif -// QSettings -#if !defined(QT_NO_SETTINGS) && (defined(QT_NO_TEXTSTREAM)) -#define QT_NO_SETTINGS -#endif - // SOCKS5 #if !defined(QT_NO_SOCKS5) && (defined(QT_NO_NETWORKPROXY)) #define QT_NO_SOCKS5 @@ -507,14 +515,14 @@ #define QT_NO_HTTP #endif -// QLibrary -#if !defined(QT_NO_LIBRARY) && (defined(QT_NO_SETTINGS)) -#define QT_NO_LIBRARY +// QInputContext +#if !defined(QT_NO_IM) && (defined(QT_NO_LIBRARY)) +#define QT_NO_IM #endif -// Phonon::AbstractMediaStream -#if !defined(QT_NO_PHONON_SETTINGSGROUP) && (defined(QT_NO_SETTINGS)) -#define QT_NO_PHONON_SETTINGSGROUP +// Phonon::PlatformPlugin +#if !defined(QT_NO_PHONON_PLATFORMPLUGIN) && (defined(QT_NO_LIBRARY)) +#define QT_NO_PHONON_PLATFORMPLUGIN #endif // QScrollArea @@ -562,21 +570,11 @@ #define QT_NO_GRAPHICSVIEW #endif -// QInputContext -#if !defined(QT_NO_IM) && (defined(QT_NO_LIBRARY)) -#define QT_NO_IM -#endif - // QMdiArea #if !defined(QT_NO_MDIAREA) && (defined(QT_NO_SCROLLAREA)) #define QT_NO_MDIAREA #endif -// Phonon::PlatformPlugin -#if !defined(QT_NO_PHONON_PLATFORMPLUGIN) && (defined(QT_NO_LIBRARY)) -#define QT_NO_PHONON_PLATFORMPLUGIN -#endif - // Phonon::VolumeSlider #if !defined(QT_NO_PHONON_VOLUMESLIDER) && (defined(QT_NO_SLIDER) || defined(QT_NO_TOOLBUTTON)) #define QT_NO_PHONON_VOLUMESLIDER @@ -587,6 +585,11 @@ #define QT_NO_PRINTER #endif +// QWSInputMethod +#if !defined(QT_NO_QWS_INPUTMETHODS) && (defined(QT_NO_IM)) +#define QT_NO_QWS_INPUTMETHODS +#endif + // QSpinBox #if !defined(QT_NO_SPINBOX) && (defined(QT_NO_SPINWIDGET) || defined(QT_NO_LINEEDIT) || defined(QT_NO_VALIDATOR)) #define QT_NO_SPINBOX @@ -627,6 +630,11 @@ #define QT_NO_TABDIALOG #endif +// QTextCodecPlugin +#if !defined(QT_NO_TEXTCODECPLUGIN) && (defined(QT_NO_TEXTCODEC) || defined(QT_NO_LIBRARY)) +#define QT_NO_TEXTCODECPLUGIN +#endif + // QColorDialog #if !defined(QT_NO_COLORDIALOG) && (defined(QT_NO_SPINBOX)) #define QT_NO_COLORDIALOG @@ -647,11 +655,6 @@ #define QT_NO_MENUBAR #endif -// QWSInputMethod -#if !defined(QT_NO_QWS_INPUTMETHODS) && (defined(QT_NO_IM)) -#define QT_NO_QWS_INPUTMETHODS -#endif - // Sound Server #if !defined(QT_NO_QWS_SOUNDSERVER) && (defined(QT_NO_SOUND) || defined(QT_NO_HOSTINFO) || defined(QT_NO_QWS_MULTIPROCESS)) #define QT_NO_QWS_SOUNDSERVER @@ -672,11 +675,6 @@ #define QT_NO_TABWIDGET #endif -// QTextCodecPlugin -#if !defined(QT_NO_TEXTCODECPLUGIN) && (defined(QT_NO_TEXTCODEC) || defined(QT_NO_LIBRARY)) -#define QT_NO_TEXTCODECPLUGIN -#endif - // QTextEdit #if !defined(QT_NO_TEXTEDIT) && (defined(QT_NO_SCROLLAREA) || defined(QT_NO_PROPERTIES)) #define QT_NO_TEXTEDIT @@ -757,6 +755,11 @@ #define QT_NO_COMPLETER #endif +// Common UNIX Printing System +#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY)) +#define QT_NO_CUPS +#endif + // QDataWidgetMapper #if !defined(QT_NO_DATAWIDGETMAPPER) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_PROPERTIES)) #define QT_NO_DATAWIDGETMAPPER @@ -787,11 +790,6 @@ #define QT_NO_TREEWIDGET #endif -// Common UNIX Printing System -#if !defined(QT_NO_CUPS) && (defined(QT_NO_PRINTER) || defined(QT_NO_LIBRARY)) -#define QT_NO_CUPS -#endif - // QDirModel #if !defined(QT_NO_DIRMODEL) && (defined(QT_NO_ITEMVIEWS) || defined(QT_NO_FILESYSTEMMODEL)) #define QT_NO_DIRMODEL diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index ec4945f..251391e 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -216,7 +216,7 @@ SeeAlso: ??? Feature: SETTINGS Description: Supports persistent application settings. Section: File I/O -Requires: TEXTSTREAM +Requires: Name: QSettings SeeAlso: ??? diff --git a/src/corelib/global/qlibraryinfo.cpp b/src/corelib/global/qlibraryinfo.cpp index 15325ae..77a86bb 100644 --- a/src/corelib/global/qlibraryinfo.cpp +++ b/src/corelib/global/qlibraryinfo.cpp @@ -46,7 +46,11 @@ #include "qlibraryinfo.h" #include "qscopedpointer.h" -#ifdef QT_BUILD_QMAKE +#if defined(QT_BUILD_QMAKE) || defined(QT_BOOTSTRAPPED) +# define BOOTSTRAPPING +#endif + +#ifdef BOOTSTRAPPING QT_BEGIN_NAMESPACE extern QString qmake_libraryInfoFile(); QT_END_NAMESPACE @@ -91,7 +95,7 @@ public: QLibrarySettings::QLibrarySettings() : settings(QLibraryInfoPrivate::findConfiguration()) { -#ifndef QT_BUILD_QMAKE +#ifndef BOOTSTRAPPING qAddPostRoutine(QLibraryInfoPrivate::cleanup); #endif } @@ -99,7 +103,7 @@ QLibrarySettings::QLibrarySettings() QSettings *QLibraryInfoPrivate::findConfiguration() { QString qtconfig = QLatin1String(":/qt/etc/qt.conf"); -#ifdef QT_BUILD_QMAKE +#ifdef BOOTSTRAPPING if(!QFile::exists(qtconfig)) qtconfig = qmake_libraryInfoFile(); #else @@ -425,7 +429,7 @@ QLibraryInfo::location(LibraryLocation loc) if (QDir::isRelativePath(ret)) { if (loc == PrefixPath) { // we make the prefix path absolute to the executable's directory -#ifdef QT_BUILD_QMAKE +#ifdef BOOTSTRAPPING return QFileInfo(qmake_libraryInfoFile()).absolutePath(); #else if (QCoreApplication::instance()) { diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 19e86a6..b10d603 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -42,7 +42,7 @@ #include "qdatastream.h" #include "qdatastream_p.h" -#ifndef QT_NO_DATASTREAM +#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED) #include "qbuffer.h" #include "qstring.h" #include <stdio.h> diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h index f61a59c..2e4e7c1 100644 --- a/src/corelib/io/qdatastream.h +++ b/src/corelib/io/qdatastream.h @@ -66,7 +66,7 @@ template <typename T> class QSet; template <class Key, class T> class QHash; template <class Key, class T> class QMap; -#ifndef QT_NO_DATASTREAM +#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED) class QDataStreamPrivate; class Q_CORE_EXPORT QDataStream { diff --git a/src/corelib/io/qdatastream_p.h b/src/corelib/io/qdatastream_p.h index 157fee9..98dd21f 100644 --- a/src/corelib/io/qdatastream_p.h +++ b/src/corelib/io/qdatastream_p.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE -#ifndef QT_NO_DATASTREAM +#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED) class QDataStreamPrivate { public: diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp index 40b9f04..a850df0 100644 --- a/src/corelib/kernel/qsharedmemory_unix.cpp +++ b/src/corelib/kernel/qsharedmemory_unix.cpp @@ -49,6 +49,7 @@ #include <errno.h> +#ifndef QT_NO_SHAREDMEMORY #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> @@ -56,6 +57,7 @@ #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> +#endif //QT_NO_SHAREDMEMORY #include "private/qcore_unix_p.h" diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp index d8557e5..bf9b6bd 100644 --- a/src/corelib/tools/qbytearray.cpp +++ b/src/corelib/tools/qbytearray.cpp @@ -48,9 +48,7 @@ #include "qlocale_p.h" #include "qunicodetables_p.h" #include "qscopedpointer.h" -#ifndef QT_NO_DATASTREAM #include <qdatastream.h> -#endif #ifndef QT_NO_COMPRESS #include <zlib.h> @@ -2640,7 +2638,7 @@ void QByteArray::clear() d->ref.ref(); } -#ifndef QT_NO_DATASTREAM +#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) /*! \relates QByteArray diff --git a/src/corelib/tools/qbytearray.h b/src/corelib/tools/qbytearray.h index e258481..7dd6f4f 100644 --- a/src/corelib/tools/qbytearray.h +++ b/src/corelib/tools/qbytearray.h @@ -572,7 +572,7 @@ inline QByteArray &QByteArray::setNum(float n, char f, int prec) { return setNum(double(n),f,prec); } -#ifndef QT_NO_DATASTREAM +#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QByteArray &); Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QByteArray &); #endif diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index f7321ef..086a2f3 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -7204,7 +7204,7 @@ QString QString::fromRawData(const QChar *unicode, int size) */ -#ifndef QT_NO_DATASTREAM +#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) /*! \fn QDataStream &operator<<(QDataStream &stream, const QString &string) \relates QString diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 74f93a4..668be35 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -1065,7 +1065,7 @@ inline QChar &QString::ref(uint i) } #endif -#ifndef QT_NO_DATASTREAM +#if !defined(QT_NO_DATASTREAM) || (defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)) Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QString &); Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QString &); #endif diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index 8089b43..d8ae73e 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -509,7 +509,7 @@ static bool qt_win_set_IFileDialogOptions(IFileDialog *pfd, DWORD newOptions; hr = pfd->GetOptions(&newOptions); if (SUCCEEDED(hr)) { - newOptions |= (FOS_NOCHANGEDIR | FOS_NOREADONLYRETURN); + newOptions |= FOS_NOCHANGEDIR; if (mode == QFileDialog::ExistingFile || mode == QFileDialog::ExistingFiles) newOptions |= (FOS_FILEMUSTEXIST | FOS_PATHMUSTEXIST); diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp index 3ef311c..3f9f443 100644 --- a/src/gui/graphicsview/qgraphicsview.cpp +++ b/src/gui/graphicsview/qgraphicsview.cpp @@ -1517,6 +1517,8 @@ void QGraphicsView::setScene(QGraphicsScene *scene) QEvent windowDeactivate(QEvent::WindowDeactivate); QApplication::sendEvent(d->scene, &windowDeactivate); } + if(hasFocus()) + d->scene->clearFocus(); } // Assign the new scene and update the contents (scrollbars, etc.)). diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp index 3f297df..7008fbd 100644 --- a/src/gui/image/qpixmap_x11.cpp +++ b/src/gui/image/qpixmap_x11.cpp @@ -416,6 +416,11 @@ void QX11PixmapData::fromImage(const QImage &img, d = img.depth(); is_null = (w <= 0 || h <= 0); + if (is_null) { + w = h = 0; + return; + } + if (defaultScreen >= 0 && defaultScreen != xinfo.screen()) { QX11InfoData* xd = xinfo.getX11Data(true); xd->screen = defaultScreen; diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 15db9a6..c6622cb 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -972,9 +972,9 @@ void QListView::paintEvent(QPaintEvent *e) option.rect = visualRect(*it); if (flow() == TopToBottom) - option.rect.setWidth(qMin(viewport()->size().width() - 2 * d->spacing(), option.rect.width())); + option.rect.setWidth(qMin(d->contentsSize().width() - 2 * d->spacing(), option.rect.width())); else - option.rect.setHeight(qMin(viewport()->size().height() - 2 * d->spacing(), option.rect.height())); + option.rect.setHeight(qMin(d->contentsSize().height() - 2 * d->spacing(), option.rect.height())); option.state = state; if (selections && selections->isSelected(*it)) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 04e4b31..c7f0c00 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -323,7 +323,6 @@ QSymbianControl::QSymbianControl(QWidget *w) , qwidget(w) , m_longTapDetector(0) , m_ignoreFocusChanged(0) - , m_previousEventLongTap(0) , m_symbianPopupIsOpen(0) { } @@ -362,9 +361,6 @@ QSymbianControl::~QSymbianControl() setFocusSafely(false); S60->appUi()->RemoveFromStack(this); delete m_longTapDetector; - - if(m_previousEventLongTap) - QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & ~Qt::RightButton; } void QSymbianControl::setWidget(QWidget *w) @@ -379,19 +375,11 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons alienWidget = qwidget->childAt(widgetPos); if (!alienWidget) alienWidget = qwidget; - QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons &(~Qt::LeftButton); - QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons | Qt::RightButton; - QMouseEvent mEvent(QEvent::MouseButtonPress, alienWidget->mapFrom(qwidget, widgetPos), globalPos, - Qt::RightButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier); - - bool res = sendMouseEvent(alienWidget, &mEvent); #if !defined(QT_NO_CONTEXTMENU) - QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, mEvent.modifiers()); + QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, Qt::NoModifier); qt_sendSpontaneousEvent(alienWidget, &contextMenuEvent); #endif - - m_previousEventLongTap = true; } #ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER @@ -515,12 +503,6 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent) mapS60MouseEventTypeToQt(&type, &button, &pEvent); Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers); - if (m_previousEventLongTap) - if (type == QEvent::MouseButtonRelease){ - button = Qt::RightButton; - QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & ~Qt::RightButton; - m_previousEventLongTap = false; - } if (type == QMouseEvent::None) return; diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 89c18fb..e3af683 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -1036,7 +1036,7 @@ QKeySequence QKeySequence::mnemonic(const QString &text) #else found = true; } else { - qWarning(qPrintable(QString::fromLatin1("QKeySequence::mnemonic: \"%1\" contains multiple occurences of '&'").arg(text))); + qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occurences of '&'", qPrintable(text)); #endif } } diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h index ec8c9cb..08f8bb5 100644 --- a/src/gui/kernel/qt_s60_p.h +++ b/src/gui/kernel/qt_s60_p.h @@ -204,7 +204,6 @@ private: QWidget *qwidget; QLongTapTimer* m_longTapDetector; bool m_ignoreFocusChanged : 1; - bool m_previousEventLongTap : 1; bool m_symbianPopupIsOpen : 1; #ifdef Q_WS_S60 diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 754e7f5..709f6f3 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -11871,8 +11871,7 @@ void QWidget::ungrabGesture(Qt::GestureType gesture) isVisible() returns false for a widget, that widget cannot call grabMouse(). - \sa releaseMouse() grabKeyboard() releaseKeyboard() grabKeyboard() - focusWidget() + \sa releaseMouse() grabKeyboard() releaseKeyboard() */ /*! diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index ba1b642..b92c5c2 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -227,9 +227,6 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl, quint32 basex; quint32 srcy; - const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1; - const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1; - if (sx < 0) { int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1; basex = quint32(srcRect.right() * 65536) + dstx; diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index b640858..d45bd10 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -78,8 +78,8 @@ const char *qt_real_to_string(qreal val, char *buf) { unsigned int ival = (unsigned int) val; qreal frac = val - (qreal)ival; - int ifrac = (int)(frac * 1000000); - if (ifrac == 1000000) { + int ifrac = (int)(frac * 1000000000); + if (ifrac == 1000000000) { ++ival; ifrac = 0; } @@ -90,7 +90,7 @@ const char *qt_real_to_string(qreal val, char *buf) { ++i; ival /= 10; } - int fact = 100000; + int fact = 100000000; if (i == 0) { *(buf++) = '0'; } else { diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 70b7aa3..58aa3b8 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -3206,10 +3206,6 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option, } break; - case CT_MenuBarItem://cleanlooks adds 2 pixels - newSize = QWindowsStyle::sizeFromContents(type, option, size, widget) + QSize(0, 1); - break; - case CT_LineEdit: { GtkWidget *gtkEntry = d->gtkWidget(QLS("GtkEntry")); newSize = size + QSize(2*gtkEntry->style->xthickness, 2*gtkEntry->style->ythickness); diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp index 7119a4f..62d9197 100644 --- a/src/gui/styles/qgtkstyle_p.cpp +++ b/src/gui/styles/qgtkstyle_p.cpp @@ -202,8 +202,12 @@ Ptr_gnome_vfs_init QGtkStylePrivate::gnome_vfs_init = 0; typedef int (*x11ErrorHandler)(Display*, XErrorEvent*); +Q_DECLARE_METATYPE(QGtkStylePrivate*); + static void gtkStyleSetCallback(GtkWidget*, QGtkStylePrivate* stylePrivate) { + qRegisterMetaType<QGtkStylePrivate *>(); + // We have to let this function return and complete the event // loop to ensure that all gtk widgets have been styled before // updating diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 939ea45..7c3e11f 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -783,6 +783,14 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const widgetPalette.setBrush(QPalette::Window, QBrush()); QApplication::setPalette(widgetPalette, "QScrollArea"); widgetPalette = *palette; + + //Webpages should not use S60 theme colors as they are designed to work + //with themeBackground and do not generally mesh well with web page backgrounds. + QPalette webPalette = *palette; + webPalette.setColor(QPalette::WindowText, Qt::black); + webPalette.setColor(QPalette::Text, Qt::black); + QApplication::setPalette(webPalette, "QWebView"); + QApplication::setPalette(webPalette, "QGraphicsWebView"); } QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags) @@ -2007,7 +2015,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti buttonRect.adjust(0,-newY,0,-newY); painter->save(); - QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnIconColors, 13, option); + QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option); QColor buttonTextColor = option->palette.buttonText().color(); if (themeColor != buttonTextColor) painter->setPen(buttonTextColor); diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index 59210c3..8b40931 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -4637,6 +4637,7 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const } break; +#ifndef QT_NO_TABWIDGET case PM_TabBarTabHSpace: case PM_TabBarTabVSpace: subRule = renderRule(w, opt, PseudoElement_TabBarTab); @@ -4660,11 +4661,14 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const return 0; break; - case PM_TabBarBaseOverlap: - if (hasStyleRule(w->parentWidget(), PseudoElement_TabWidgetPane)) { + case PM_TabBarBaseOverlap: { + const QWidget *tabWidget = qobject_cast<const QTabWidget *>(w) ? w : w->parentWidget(); + if (hasStyleRule(tabWidget, PseudoElement_TabWidgetPane)) { return 0; } break; + } +#endif // QT_NO_TABWIDGET case PM_SliderThickness: // horizontal slider's height (sizeHint) case PM_SliderLength: // minimum length of slider diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp index 2ad6512..18e1ffc 100644 --- a/src/gui/text/qtextdocument_p.cpp +++ b/src/gui/text/qtextdocument_p.cpp @@ -1114,9 +1114,11 @@ void QTextDocumentPrivate::endEditBlock() return; if (undoEnabled && undoState > 0) { + const bool wasBlocking = !undoStack[undoState - 1].block_end; if (undoStack[undoState - 1].block_part) { undoStack[undoState - 1].block_end = true; - emit document()->undoCommandAdded(); + if (wasBlocking) + emit document()->undoCommandAdded(); } } diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index f5dbe1c..9f3fe4f 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1515,7 +1515,8 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e) } #endif - d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); + if (!isReadOnly()) + d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); d->clickCausedFocus = 0; } @@ -1594,7 +1595,9 @@ void QLineEdit::keyPressEvent(QKeyEvent *event) && !isReadOnly()) { setEditFocus(true); +#ifndef Q_OS_SYMBIAN clear(); +#endif } else { event->ignore(); return; @@ -1651,7 +1654,9 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e) && hasFocus() && !hasEditFocus() && !e->preeditString().isEmpty()) { setEditFocus(true); +#ifndef Q_OS_SYMBIAN selectAll(); // so text is replaced rather than appended to +#endif } #endif diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 54d1612..fc88d06 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1106,6 +1106,7 @@ void QMenuPrivate::_q_actionTriggered() { Q_Q(QMenu); if (QAction *action = qobject_cast<QAction *>(q->sender())) { + QWeakPointer<QAction> actionGuard = action; #ifdef QT3_SUPPORT //we store it here because the action might be deleted/changed by connected slots const int id = q->findIdForAction(action); @@ -1115,7 +1116,7 @@ void QMenuPrivate::_q_actionTriggered() emit q->activated(id); #endif - if (!activationRecursionGuard) { + if (!activationRecursionGuard && actionGuard) { //in case the action has not been activated by the mouse //we check the parent hierarchy QList< QPointer<QWidget> > list; diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp index 18adc6c..c7759e8 100644 --- a/src/gui/widgets/qplaintextedit.cpp +++ b/src/gui/widgets/qplaintextedit.cpp @@ -1966,7 +1966,8 @@ void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e) d->ensureCursorVisible(); } - d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); + if (!isReadOnly()) + d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); d->clickCausedFocus = 0; } diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp index 998ab4f..1c49ef0 100644 --- a/src/gui/widgets/qtextedit.cpp +++ b/src/gui/widgets/qtextedit.cpp @@ -1212,7 +1212,9 @@ void QTextEdit::keyPressEvent(QKeyEvent *e) if (!hasEditFocus() && !(e->modifiers() & Qt::ControlModifier)) { if (e->text()[0].isPrint()) { setEditFocus(true); +#ifndef Q_OS_SYMBIAN clear(); +#endif } else { e->ignore(); return; @@ -1576,7 +1578,8 @@ void QTextEdit::mouseReleaseEvent(QMouseEvent *e) d->autoScrollTimer.stop(); ensureCursorVisible(); } - d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); + if (!isReadOnly()) + d->handleSoftwareInputPanel(e->button(), d->clickCausedFocus); d->clickCausedFocus = 0; } @@ -1674,7 +1677,9 @@ void QTextEdit::inputMethodEvent(QInputMethodEvent *e) && QApplication::keypadNavigationEnabled() && !hasEditFocus()) { setEditFocus(true); +#ifndef Q_OS_SYMBIAN selectAll(); // so text is replaced rather than appended to +#endif } #endif d->sendControlEvent(e); diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp index 5de6c70..9645fa8 100644 --- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp @@ -152,13 +152,23 @@ bool QAudioDeviceInfoInternal::open() { int err = 0; QString dev = device; - if(!dev.contains(QLatin1String("default"))) { + QList<QByteArray> devices = availableDevices(mode); + + if(dev.compare(QLatin1String("default")) == 0) { +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) + dev = QLatin1String(devices.first().constData()); +#else + dev = QLatin1String("hw:0,0"); +#endif + } else { #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) - dev = QString(QLatin1String("default:CARD=%1")).arg(dev); + dev = device; #else int idx = 0; char *name; + QString shortName = device.mid(device.indexOf(QLatin1String("="),0)+1); + while(snd_card_get_name(idx,&name) == 0) { if(dev.contains(QLatin1String(name))) break; @@ -195,16 +205,25 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const snd_pcm_hw_params_t *params; QString dev = device; - // open() - if(!dev.contains(QLatin1String("default"))) { + QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput); + + if(dev.compare(QLatin1String("default")) == 0) { #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) - dev = QString(QLatin1String("default:CARD=%1")).arg(dev); + dev = QLatin1String(devices.first().constData()); +#else + dev = QLatin1String("hw:0,0"); +#endif + } else { +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) + dev = device; #else int idx = 0; char *name; - + + QString shortName = device.mid(device.indexOf(QLatin1String("="),0)+1); + while(snd_card_get_name(idx,&name) == 0) { - if(dev.contains(QLatin1String(name))) + if(shortName.compare(QLatin1String(name)) == 0) break; idx++; } @@ -386,6 +405,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) { QList<QByteArray> devices; QByteArray filter; + #if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) // Create a list of all current audio devices that support mode void **hints, **n; @@ -408,12 +428,10 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode) descr = snd_device_name_get_hint(*n, "DESC"); io = snd_device_name_get_hint(*n, "IOID"); if((name != NULL) && (descr != NULL) && ((io == NULL) || (io == filter))) { - QString str = QLatin1String(name); - - if(str.contains(QLatin1String("default"))) { - int pos = str.indexOf(QLatin1String("="),0); - devices.append(str.mid(pos+1).toLocal8Bit().constData()); - } + QString deviceName = QLatin1String(name); + QString deviceDescription = QLatin1String(descr); + if(deviceDescription.contains(QLatin1String("Default Audio Device"))) + devices.append(deviceName.toLocal8Bit().constData()); } if(name != NULL) free(name); @@ -448,7 +466,7 @@ QByteArray QAudioDeviceInfoInternal::defaultInputDevice() if(devices.size() == 0) return QByteArray(); - return QByteArray("default"); + return devices.first(); } QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() @@ -457,7 +475,7 @@ QByteArray QAudioDeviceInfoInternal::defaultOutputDevice() if(devices.size() == 0) return QByteArray(); - return QByteArray("default"); + return devices.first(); } QT_END_NAMESPACE diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp index e794eaf..8b368d5 100644 --- a/src/multimedia/audio/qaudioinput.cpp +++ b/src/multimedia/audio/qaudioinput.cpp @@ -47,7 +47,6 @@ #include "qaudiodevicefactory_p.h" - QT_BEGIN_NAMESPACE /*! diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp index 8a8f0db..3dbe66c 100644 --- a/src/multimedia/audio/qaudioinput_alsa_p.cpp +++ b/src/multimedia/audio/qaudioinput_alsa_p.cpp @@ -52,6 +52,7 @@ #include <QtCore/qcoreapplication.h> #include "qaudioinput_alsa_p.h" +#include "qaudiodeviceinfo_alsa_p.h" QT_BEGIN_NAMESPACE @@ -80,8 +81,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFor pullMode = true; resuming = false; - QStringList list1 = QString(QLatin1String(device)).split(QLatin1String(":")); - m_device = QByteArray(list1.at(0).toLocal8Bit().constData()); + m_device = device; timer = new QTimer(this); connect(timer,SIGNAL(timeout()),SLOT(userFeed())); @@ -259,22 +259,31 @@ bool QAudioInputPrivate::open() unsigned int freakuency=settings.frequency(); QString dev = QString(QLatin1String(m_device.constData())); - if(!dev.contains(QLatin1String("default"))) { -#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) - dev = QString(QLatin1String("default:CARD=%1")).arg(QLatin1String(m_device.constData())); + QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioInput); + if(dev.compare(QLatin1String("default")) == 0) { +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) + dev = QLatin1String(devices.first()); +#else + dev = QLatin1String("hw:0,0"); +#endif + } else { +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) + dev = QLatin1String(m_device); #else int idx = 0; char *name; + QString shortName = QLatin1String(m_device.mid(m_device.indexOf('=',0)+1).constData()); + while(snd_card_get_name(idx,&name) == 0) { - if(m_device.contains(name)) + if(qstrncmp(shortName.toLocal8Bit().constData(),name,shortName.length()) == 0) break; idx++; } dev = QString(QLatin1String("hw:%1,0")).arg(idx); #endif } - + // Step 1: try and open the device while((count < 5) && (err < 0)) { err=snd_pcm_open(&handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0); @@ -614,7 +623,7 @@ qint64 QAudioInputPrivate::elapsedUSecs() const if (deviceState == QAudio::StoppedState) return 0; -#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) snd_pcm_status_t* status; snd_pcm_status_alloca(&status); diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp index e9784d2..020a104 100644 --- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp +++ b/src/multimedia/audio/qaudiooutput_alsa_p.cpp @@ -52,6 +52,7 @@ #include <QtCore/qcoreapplication.h> #include "qaudiooutput_alsa_p.h" +#include "qaudiodeviceinfo_alsa_p.h" QT_BEGIN_NAMESPACE @@ -281,21 +282,31 @@ bool QAudioOutputPrivate::open() unsigned int freakuency=settings.frequency(); QString dev = QLatin1String(m_device.constData()); - if(!dev.contains(QLatin1String("default"))) { -#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) - dev = QString(QLatin1String("default:CARD=%1")).arg(QLatin1String(m_device.constData())); + QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput); + if(dev.compare(QLatin1String("default")) == 0) { +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) + dev = QLatin1String(devices.first().constData()); +#else + dev = QLatin1String("hw:0,0"); +#endif + } else { +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) + dev = QLatin1String(m_device); #else int idx = 0; char *name; + QString shortName = QLatin1String(m_device.mid(m_device.indexOf('=',0)+1).constData()); + while(snd_card_get_name(idx,&name) == 0) { - if(m_device.contains(name)) + if(qstrncmp(shortName.toLocal8Bit().constData(),name,shortName.length()) == 0) break; idx++; } dev = QString(QLatin1String("hw:%1,0")).arg(idx); #endif } + // Step 1: try and open the device while((count < 5) && (err < 0)) { err=snd_pcm_open(&handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0); @@ -666,7 +677,7 @@ qint64 QAudioOutputPrivate::elapsedUSecs() const if (deviceState == QAudio::StoppedState) return 0; -#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) +#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14) snd_pcm_status_t* status; snd_pcm_status_alloca(&status); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index f8a2ea4..d5ca218 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -184,8 +184,13 @@ public: engineType = QPaintEngine::OpenGL2; #else // We can't do this in the constructor for this object because it - // needs to be called *before* the QApplication constructor + // needs to be called *before* the QApplication constructor. + // Also check for the FragmentProgram extension in conjunction with + // the 2.0 version flag, to cover the case where we export the display + // from an old GL 1.1 server to a GL 2.x client. In that case we can't + // use GL 2.0. if ((QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) + && (QGLExtensions::glExtensions & QGLExtensions::FragmentProgram) && qgetenv("QT_GL_USE_OPENGL1ENGINE").isEmpty()) engineType = QPaintEngine::OpenGL2; else @@ -2170,8 +2175,8 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G int tx_h = qt_next_power_of_two(image.height()); QImage img = image; - if (( !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0) && - !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0) ) + if (!(QGLExtensions::glExtensions & QGLExtensions::NPOTTextures) + && !(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_ES_Version_2_0) && (target == GL_TEXTURE_2D && (tx_w != image.width() || tx_h != image.height()))) { img = img.scaled(tx_w, tx_h); @@ -2192,9 +2197,9 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G bool genMipmap = false; #endif if (glFormat.directRendering() - && QGLExtensions::glExtensions & QGLExtensions::GenerateMipmap + && (QGLExtensions::glExtensions & QGLExtensions::GenerateMipmap) && target == GL_TEXTURE_2D - && options & QGLContext::MipmapBindOption) + && (options & QGLContext::MipmapBindOption)) { #ifdef QGL_BIND_TEXTURE_DEBUG printf(" - generating mipmaps (%d ms)\n", time.elapsed()); @@ -2220,7 +2225,7 @@ QGLTexture* QGLContextPrivate::bindTexture(const QImage &image, GLenum target, G bool premul = options & QGLContext::PremultipliedAlphaBindOption; GLenum externalFormat; GLuint pixel_type; - if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_1_2) { + if (QGLExtensions::glExtensions & QGLExtensions::BGRATextureFormat) { externalFormat = GL_BGRA; pixel_type = GL_UNSIGNED_INT_8_8_8_8_REV; } else { @@ -4886,54 +4891,59 @@ QGLWidget::QGLWidget(QGLContext *context, QWidget *parent, void QGLExtensions::init_extensions() { - QString extensions = QLatin1String(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS))); - if (extensions.contains(QLatin1String("texture_rectangle"))) + QList<QByteArray> extensions = QByteArray(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS))).split(' '); + if (extensions.contains("GL_ARB_texture_rectangle")) glExtensions |= TextureRectangle; - if (extensions.contains(QLatin1String("multisample"))) + if (extensions.contains("GL_ARB_multisample")) glExtensions |= SampleBuffers; - if (extensions.contains(QLatin1String("generate_mipmap"))) + if (extensions.contains("GL_SGIS_generate_mipmap")) glExtensions |= GenerateMipmap; - if (extensions.contains(QLatin1String("texture_compression_s3tc"))) + if (extensions.contains("GL_EXT_texture_compression_s3tc")) glExtensions |= TextureCompression; - if (extensions.contains(QLatin1String("ARB_fragment_program"))) + if (extensions.contains("GL_ARB_fragment_program")) glExtensions |= FragmentProgram; - if (extensions.contains(QLatin1String("mirrored_repeat"))) + if (extensions.contains("GL_ARB_texture_mirrored_repeat")) glExtensions |= MirroredRepeat; - if (extensions.contains(QLatin1String("EXT_framebuffer_object"))) + if (extensions.contains("GL_EXT_framebuffer_object")) glExtensions |= FramebufferObject; - if (extensions.contains(QLatin1String("EXT_stencil_two_side"))) + if (extensions.contains("GL_EXT_stencil_two_side")) glExtensions |= StencilTwoSide; - if (extensions.contains(QLatin1String("EXT_stencil_wrap"))) + if (extensions.contains("GL_EXT_stencil_wrap")) glExtensions |= StencilWrap; - if (extensions.contains(QLatin1String("EXT_packed_depth_stencil"))) + if (extensions.contains("GL_EXT_packed_depth_stencil")) glExtensions |= PackedDepthStencil; - if (extensions.contains(QLatin1String("GL_NV_float_buffer"))) + if (extensions.contains("GL_NV_float_buffer")) glExtensions |= NVFloatBuffer; - if (extensions.contains(QLatin1String("ARB_pixel_buffer_object"))) + if (extensions.contains("GL_ARB_pixel_buffer_object")) glExtensions |= PixelBufferObject; #if defined(QT_OPENGL_ES_2) glExtensions |= FramebufferObject; glExtensions |= GenerateMipmap; #endif #if defined(QT_OPENGL_ES_1) || defined(QT_OPENGL_ES_1_CL) - if (extensions.contains(QLatin1String("OES_framebuffer_object"))) + if (extensions.contains("GL_OES_framebuffer_object")) glExtensions |= FramebufferObject; #endif #if defined(QT_OPENGL_ES) - if (extensions.contains(QLatin1String("OES_packed_depth_stencil"))) + if (extensions.contains("GL_OES_packed_depth_stencil")) glExtensions |= PackedDepthStencil; #endif - if (extensions.contains(QLatin1String("ARB_framebuffer_object"))) { + if (extensions.contains("GL_ARB_framebuffer_object")) { // ARB_framebuffer_object also includes EXT_framebuffer_blit. glExtensions |= FramebufferObject; glExtensions |= FramebufferBlit; } - if (extensions.contains(QLatin1String("EXT_framebuffer_blit"))) + + if (extensions.contains("GL_EXT_framebuffer_blit")) glExtensions |= FramebufferBlit; - if (extensions.contains(QLatin1String("GL_ARB_texture_non_power_of_two"))) + if (extensions.contains("GL_ARB_texture_non_power_of_two")) glExtensions |= NPOTTextures; + if (extensions.contains("GL_EXT_bgra")) + glExtensions |= BGRATextureFormat; + + QGLContext cx(QGLFormat::defaultFormat()); if (glExtensions & TextureCompression) { qt_glCompressedTexImage2DARB = (pfn_glCompressedTexImage2DARB) cx.getProcAddress(QLatin1String("glCompressedTexImage2DARB")); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 45b2942..8e472e5 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -375,7 +375,8 @@ public: NVFloatBuffer = 0x00000400, PixelBufferObject = 0x00000800, FramebufferBlit = 0x00001000, - NPOTTextures = 0x00002000 + NPOTTextures = 0x00002000, + BGRATextureFormat = 0x00004000 }; Q_DECLARE_FLAGS(Extensions, Extension) diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index 899047a..a037282 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -343,8 +343,8 @@ void* qglx_getProcAddress(const char* procName) static bool triedResolvingGlxGetProcAddress = false; if (!triedResolvingGlxGetProcAddress) { triedResolvingGlxGetProcAddress = true; - QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); - if (glxExt.contains(QLatin1String("GLX_ARB_get_proc_address"))) { + QList<QByteArray> glxExt = QByteArray(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)).split(' '); + if (glxExt.contains("GLX_ARB_get_proc_address")) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); if (handle) { @@ -523,8 +523,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) if (!d->gpm) return false; } - QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); - if (glxExt.contains(QLatin1String("GLX_SGI_video_sync"))) { + QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' '); + if (glxExt.contains("GLX_SGI_video_sync")) { if (d->glFormat.swapInterval() == -1) d->glFormat.setSwapInterval(0); } else { @@ -874,8 +874,9 @@ void QGLContext::swapBuffers() const static qt_glXWaitVideoSyncSGI glXWaitVideoSyncSGI = 0; static bool resolved = false; if (!resolved) { - QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); - if (glxExt.contains(QLatin1String("GLX_SGI_video_sync"))) { + const QX11Info *xinfo = qt_x11Info(d->paintDevice); + QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' '); + if (glxExt.contains("GLX_SGI_video_sync")) { glXGetVideoSyncSGI = (qt_glXGetVideoSyncSGI)qglx_getProcAddress("glXGetVideoSyncSGI"); glXWaitVideoSyncSGI = (qt_glXWaitVideoSyncSGI)qglx_getProcAddress("glXWaitVideoSyncSGI"); } @@ -1106,8 +1107,8 @@ void *QGLContext::getProcAddress(const QString &proc) const if (resolved && !glXGetProcAddressARB) return 0; if (!glXGetProcAddressARB) { - QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); - if (glxExt.contains(QLatin1String("GLX_ARB_get_proc_address"))) { + QList<QByteArray> glxExt = QByteArray(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)).split(' '); + if (glxExt.contains("GLX_ARB_get_proc_address")) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); if (handle) { @@ -1594,7 +1595,7 @@ typedef void (*qt_glXReleaseTexImageEXT)(Display*, GLXDrawable, int); static qt_glXBindTexImageEXT glXBindTexImageEXT = 0; static qt_glXReleaseTexImageEXT glXReleaseTexImageEXT = 0; -bool qt_resolveTextureFromPixmap() +static bool qt_resolveTextureFromPixmap(QPaintDevice *paintDevice) { static bool resolvedTextureFromPixmap = false; @@ -1607,9 +1608,9 @@ bool qt_resolveTextureFromPixmap() { return false; // Can't use TFP without NPOT } - - QString glxExt = QLatin1String(glXGetClientString(QX11Info::display(), GLX_EXTENSIONS)); - if (glxExt.contains(QLatin1String("GLX_EXT_texture_from_pixmap"))) { + const QX11Info *xinfo = qt_x11Info(paintDevice); + QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(xinfo->display(), xinfo->screen())).split(' '); + if (glxExt.contains("GLX_EXT_texture_from_pixmap")) { glXBindTexImageEXT = (qt_glXBindTexImageEXT) qglx_getProcAddress("glXBindTexImageEXT"); glXReleaseTexImageEXT = (qt_glXReleaseTexImageEXT) qglx_getProcAddress("glXReleaseTexImageEXT"); } @@ -1630,7 +1631,7 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmapData *pmd, con Q_ASSERT(pmd->classId() == QPixmapData::X11Class); - if (!qt_resolveTextureFromPixmap()) + if (!qt_resolveTextureFromPixmap(paintDevice)) return 0; QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd); diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp index 744fbd4..de08655 100644 --- a/src/opengl/qglpixelbuffer_egl.cpp +++ b/src/opengl/qglpixelbuffer_egl.cpp @@ -72,37 +72,53 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge return false; } + // Find the shared context. + QEglContext *shareContext = 0; + if (shareWidget && shareWidget->d_func()->glcx) + shareContext = shareWidget->d_func()->glcx->d_func()->eglContext; + // Choose an appropriate configuration. We use the best format // we can find, even if it is greater than the requested format. // We try for a pbuffer that is capable of texture rendering if possible. - QEglProperties configProps; - qt_egl_set_format(configProps, QInternal::Pbuffer, f); - configProps.setRenderableType(ctx->api()); - bool ok = false; + textureFormat = EGL_NONE; + if (shareContext) { + // Use the same configuration as the widget we are sharing with. + ctx->setConfig(shareContext->config()); +#if QGL_RENDER_TEXTURE + EGLint value = EGL_FALSE; + if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGBA, &value) && value) + textureFormat = EGL_TEXTURE_RGBA; + else if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGB, &value) && value) + textureFormat = EGL_TEXTURE_RGB; +#endif + } else { + QEglProperties configProps; + qt_egl_set_format(configProps, QInternal::Pbuffer, f); + configProps.setRenderableType(ctx->api()); + bool ok = false; #if QGL_RENDER_TEXTURE - textureFormat = EGL_TEXTURE_RGBA; - configProps.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE); - ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat); - if (!ok) { - // Try again with RGB texture rendering. - textureFormat = EGL_TEXTURE_RGB; - configProps.removeValue(EGL_BIND_TO_TEXTURE_RGBA); - configProps.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE); + textureFormat = EGL_TEXTURE_RGBA; + configProps.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE); ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat); if (!ok) { - // One last try for a pbuffer with no texture rendering. - configProps.removeValue(EGL_BIND_TO_TEXTURE_RGB); - textureFormat = EGL_NONE; + // Try again with RGB texture rendering. + textureFormat = EGL_TEXTURE_RGB; + configProps.removeValue(EGL_BIND_TO_TEXTURE_RGBA); + configProps.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE); + ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat); + if (!ok) { + // One last try for a pbuffer with no texture rendering. + configProps.removeValue(EGL_BIND_TO_TEXTURE_RGB); + textureFormat = EGL_NONE; + } } - } -#else - textureFormat = EGL_NONE; #endif - if (!ok) { - if (!ctx->chooseConfig(configProps, QEgl::BestPixelFormat)) { - delete ctx; - ctx = 0; - return false; + if (!ok) { + if (!ctx->chooseConfig(configProps, QEgl::BestPixelFormat)) { + delete ctx; + ctx = 0; + return false; + } } } @@ -137,9 +153,6 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge } // Create a new context for the configuration. - QEglContext *shareContext = 0; - if (shareWidget && shareWidget->d_func()->glcx) - shareContext = shareWidget->d_func()->glcx->d_func()->eglContext; if (!ctx->createContext(shareContext)) { delete ctx; ctx = 0; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index c9a010f..021d52e 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -138,7 +138,7 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect) DFBWindowDescription description; memset(&description, 0, sizeof(DFBWindowDescription)); - description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER; + description.caps = DWCAPS_NODECORATION; description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY; #if (Q_DIRECTFB_VERSION >= 0x010200) description.flags |= DWDESC_OPTIONS; diff --git a/src/plugins/phonon/mmf/mmf.pro b/src/plugins/phonon/mmf/mmf.pro index ff27ea1..c070605 100644 --- a/src/plugins/phonon/mmf/mmf.pro +++ b/src/plugins/phonon/mmf/mmf.pro @@ -1,4 +1,99 @@ -TEMPLATE = subdirs -SUBDIRS = mmfphonondebug plugin +# MMF Phonon backend + +QT += phonon +TARGET = phonon_mmf +PHONON_MMF_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf + +# Uncomment the following line in order to use the CDrmPlayerUtility client +# API for audio playback, rather than CMdaAudioPlayerUtility. +#CONFIG += phonon_mmf_audio_drm + +phonon_mmf_audio_drm { + LIBS += -lDrmAudioPlayUtility + DEFINES += QT_PHONON_MMF_AUDIO_DRM +} else { + LIBS += -lmediaclientaudio +} + +# This is necessary because both epoc32/include and Phonon contain videoplayer.h. +# By making /epoc32/include the first SYSTEMINCLUDE, we ensure that +# '#include <videoplayer.h>' picks up the Symbian header, as intended. +PREPEND_INCLUDEPATH = /epoc32/include + +INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE + +HEADERS += \ + $$PHONON_MMF_DIR/abstractaudioeffect.h \ + $$PHONON_MMF_DIR/abstractmediaplayer.h \ + $$PHONON_MMF_DIR/abstractplayer.h \ + $$PHONON_MMF_DIR/ancestormovemonitor.h \ + $$PHONON_MMF_DIR/audioequalizer.h \ + $$PHONON_MMF_DIR/audiooutput.h \ + $$PHONON_MMF_DIR/audioplayer.h \ + $$PHONON_MMF_DIR/backend.h \ + $$PHONON_MMF_DIR/bassboost.h \ + $$PHONON_MMF_DIR/defs.h \ + $$PHONON_MMF_DIR/dummyplayer.h \ + $$PHONON_MMF_DIR/effectfactory.h \ + $$PHONON_MMF_DIR/mediaobject.h \ + $$PHONON_MMF_DIR/mmf_medianode.h \ + $$PHONON_MMF_DIR/mmf_videoplayer.h \ + $$PHONON_MMF_DIR/objectdump.h \ + $$PHONON_MMF_DIR/objectdump_global.h \ + $$PHONON_MMF_DIR/objecttree.h \ + $$PHONON_MMF_DIR/utils.h \ + $$PHONON_MMF_DIR/videooutput.h \ + $$PHONON_MMF_DIR/videowidget.h + +SOURCES += \ + $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ + $$PHONON_MMF_DIR/abstractmediaplayer.cpp \ + $$PHONON_MMF_DIR/abstractplayer.cpp \ + $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ + $$PHONON_MMF_DIR/audioequalizer.cpp \ + $$PHONON_MMF_DIR/audiooutput.cpp \ + $$PHONON_MMF_DIR/audioplayer.cpp \ + $$PHONON_MMF_DIR/backend.cpp \ + $$PHONON_MMF_DIR/bassboost.cpp \ + $$PHONON_MMF_DIR/dummyplayer.cpp \ + $$PHONON_MMF_DIR/effectfactory.cpp \ + $$PHONON_MMF_DIR/mediaobject.cpp \ + $$PHONON_MMF_DIR/mmf_medianode.cpp \ + $$PHONON_MMF_DIR/mmf_videoplayer.cpp \ + $$PHONON_MMF_DIR/objectdump.cpp \ + $$PHONON_MMF_DIR/objecttree.cpp \ + $$PHONON_MMF_DIR/utils.cpp \ + $$PHONON_MMF_DIR/videooutput.cpp \ + $$PHONON_MMF_DIR/videowidget.cpp + +HEADERS += $$PHONON_MMF_DIR/objectdump_symbian.h +SOURCES += $$PHONON_MMF_DIR/objectdump_symbian.cpp + +LIBS += -lcone +LIBS += -lws32 + +# This is only needed for debug builds, but is always linked against. +LIBS += -lhal + +TARGET.CAPABILITY = all -tcb + +LIBS += -lmediaclientvideo # For CVideoPlayerUtility +LIBS += -lcone # For CCoeEnv +LIBS += -lws32 # For RWindow +LIBS += -lefsrv # For file server +LIBS += -lapgrfx -lapmime # For recognizer +LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry + +# These are for effects. +LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect + +# This is needed for having the .qtplugin file properly created on Symbian. +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend + +target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend +INSTALLS += target + +include(../../qpluginbase.pri) + +TARGET.UID3=0x2001E629 -plugin.depends = mmfphonondebug diff --git a/src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro b/src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro deleted file mode 100644 index 2cfec15..0000000 --- a/src/plugins/phonon/mmf/mmfphonondebug/mmfphonondebug.pro +++ /dev/null @@ -1,31 +0,0 @@ -TEMPLATE = lib -TARGET = phonon_mmf_debug -OBJECTDUMP_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf/mmfphonondebug - -CONFIG += staticlib - -DEFINES += OBJECTDUMP_LIBRARY - -HEADERS += \ - $$OBJECTDUMP_DIR/objectdump_global.h \ - $$OBJECTDUMP_DIR/objectdump.h \ - $$OBJECTDUMP_DIR/objecttree.h - -SOURCES += \ - $$OBJECTDUMP_DIR/objectdump.cpp \ - $$OBJECTDUMP_DIR/objecttree.cpp - -symbian { - HEADERS += $$OBJECTDUMP_DIR/objectdump_symbian.h - SOURCES += $$OBJECTDUMP_DIR/objectdump_symbian.cpp - - LIBS += -lcone - LIBS += -lws32 - - TARGET.CAPABILITY = all -tcb - -} else { - SOURCES += $$OBJECTDUMP_DIR/objectdump_stub.cpp -} - -TARGET.UID3=0x2001E62A diff --git a/src/plugins/phonon/mmf/plugin/plugin.pro b/src/plugins/phonon/mmf/plugin/plugin.pro deleted file mode 100644 index 8a7de98..0000000 --- a/src/plugins/phonon/mmf/plugin/plugin.pro +++ /dev/null @@ -1,91 +0,0 @@ -# MMF Phonon backend - -QT += phonon -TARGET = phonon_mmf -PHONON_MMF_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/mmf - -# Uncomment the following line in order to use the CDrmPlayerUtility client -# API for audio playback, rather than CMdaAudioPlayerUtility. -#CONFIG += phonon_mmf_audio_drm - -phonon_mmf_audio_drm { - LIBS += -lDrmAudioPlayUtility - DEFINES += QT_PHONON_MMF_AUDIO_DRM -} else { - LIBS += -lmediaclientaudio -} - -# This is necessary because both epoc32/include and Phonon contain videoplayer.h. -# By making /epoc32/include the first SYSTEMINCLUDE, we ensure that -# '#include <videoplayer.h>' picks up the Symbian header, as intended. -PREPEND_INCLUDEPATH = /epoc32/include - -INCLUDEPATH += $$MW_LAYER_SYSTEMINCLUDE - -HEADERS += \ - $$PHONON_MMF_DIR/abstractaudioeffect.h \ - $$PHONON_MMF_DIR/abstractmediaplayer.h \ - $$PHONON_MMF_DIR/abstractplayer.h \ - $$PHONON_MMF_DIR/ancestormovemonitor.h \ - $$PHONON_MMF_DIR/audiooutput.h \ - $$PHONON_MMF_DIR/audioequalizer.h \ - $$PHONON_MMF_DIR/audioplayer.h \ - $$PHONON_MMF_DIR/backend.h \ - $$PHONON_MMF_DIR/bassboost.h \ - $$PHONON_MMF_DIR/defs.h \ - $$PHONON_MMF_DIR/dummyplayer.h \ - $$PHONON_MMF_DIR/effectfactory.h \ - $$PHONON_MMF_DIR/mmf_medianode.h \ - $$PHONON_MMF_DIR/mediaobject.h \ - $$PHONON_MMF_DIR/utils.h \ - $$PHONON_MMF_DIR/videooutput.h \ - $$PHONON_MMF_DIR/videooutputobserver.h \ - $$PHONON_MMF_DIR/mmf_videoplayer.h \ - $$PHONON_MMF_DIR/videowidget.h \ - $$PHONON_MMF_DIR/volumeobserver.h - -SOURCES += \ - $$PHONON_MMF_DIR/abstractaudioeffect.cpp \ - $$PHONON_MMF_DIR/abstractmediaplayer.cpp \ - $$PHONON_MMF_DIR/abstractplayer.cpp \ - $$PHONON_MMF_DIR/ancestormovemonitor.cpp \ - $$PHONON_MMF_DIR/audiooutput.cpp \ - $$PHONON_MMF_DIR/audioequalizer.cpp \ - $$PHONON_MMF_DIR/audioplayer.cpp \ - $$PHONON_MMF_DIR/backend.cpp \ - $$PHONON_MMF_DIR/bassboost.cpp \ - $$PHONON_MMF_DIR/dummyplayer.cpp \ - $$PHONON_MMF_DIR/effectfactory.cpp \ - $$PHONON_MMF_DIR/mmf_medianode.cpp \ - $$PHONON_MMF_DIR/mediaobject.cpp \ - $$PHONON_MMF_DIR/utils.cpp \ - $$PHONON_MMF_DIR/videooutput.cpp \ - $$PHONON_MMF_DIR/mmf_videoplayer.cpp \ - $$PHONON_MMF_DIR/videowidget.cpp - -debug { - INCLUDEPATH += $$PHONON_MMF_DIR/mmfphonondebug - LIBS += -lphonon_mmf_debug.lib - LIBS += -lhal -} - -LIBS += -lmediaclientvideo # For CVideoPlayerUtility -LIBS += -lcone # For CCoeEnv -LIBS += -lws32 # For RWindow -LIBS += -lefsrv # For file server -LIBS += -lapgrfx -lapmime # For recognizer -LIBS += -lmmfcontrollerframework # For CMMFMetaDataEntry - -# These are for effects. -LIBS += -lAudioEqualizerEffect -lBassBoostEffect -lDistanceAttenuationEffect -lDopplerBase -lEffectBase -lEnvironmentalReverbEffect -lListenerDopplerEffect -lListenerLocationEffect -lListenerOrientationEffect -lLocationBase -lLoudnessEffect -lOrientationBase -lSourceDopplerEffect -lSourceLocationEffect -lSourceOrientationEffect -lStereoWideningEffect - -# This is needed for having the .qtplugin file properly created on Symbian. -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/phonon_backend - -target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend -INSTALLS += target - -include(../../../qpluginbase.pri) - -TARGET.UID3=0x2001E629 - diff --git a/src/qbase.pri b/src/qbase.pri index 6428130..0aae24d 100644 --- a/src/qbase.pri +++ b/src/qbase.pri @@ -36,7 +36,7 @@ CONFIG += qt warn_on depend_includepath CONFIG += qmake_cache target_qt CONFIG -= fix_output_dirs win32|mac:!macx-xcode:CONFIG += debug_and_release -linux-g++*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF +linux*-g++*:QMAKE_LFLAGS += $$QMAKE_LFLAGS_NOUNDEF contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols unix:contains(QT_CONFIG, reduce_relocations):CONFIG += bsymbolic_functions diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri index b4f9b2f..b3ee948 100644 --- a/src/tools/bootstrap/bootstrap.pri +++ b/src/tools/bootstrap/bootstrap.pri @@ -38,7 +38,7 @@ DEPENDPATH += $$INCLUDEPATH \ $$QT_SOURCE_TREE/src/xml hpux-acc*|hpuxi-acc* { - LIBS += ../bootstrap/libbootstrap.a + LIBS += $$QT_BUILD_TREE/src/tools/bootstrap/libbootstrap.a } else { contains(CONFIG, debug_and_release_target) { CONFIG(debug, debug|release) { diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro index 1f81a6c..722981c 100644 --- a/src/tools/bootstrap/bootstrap.pro +++ b/src/tools/bootstrap/bootstrap.pro @@ -31,6 +31,7 @@ win32:DEFINES += QT_NODLL INCLUDEPATH += $$QT_BUILD_TREE/include \ $$QT_BUILD_TREE/include/QtCore \ $$QT_BUILD_TREE/include/QtXml \ + $$QT_BUILD_TREE/src/corelib/global # qlibraryinfo.cpp includes qconfig.cpp DEPENDPATH += $$INCLUDEPATH \ ../../corelib/global \ @@ -48,10 +49,12 @@ SOURCES += \ ../../corelib/codecs/qtsciicodec.cpp \ ../../corelib/codecs/qutfcodec.cpp \ ../../corelib/global/qglobal.cpp \ + ../../corelib/global/qlibraryinfo.cpp \ ../../corelib/global/qmalloc.cpp \ ../../corelib/global/qnumeric.cpp \ ../../corelib/io/qabstractfileengine.cpp \ ../../corelib/io/qbuffer.cpp \ + ../../corelib/io/qdatastream.cpp \ ../../corelib/io/qdir.cpp \ ../../corelib/io/qdiriterator.cpp \ ../../corelib/io/qfile.cpp \ @@ -62,6 +65,7 @@ SOURCES += \ ../../corelib/io/qtemporaryfile.cpp \ ../../corelib/io/qtextstream.cpp \ ../../corelib/io/qurl.cpp \ + ../../corelib/io/qsettings.cpp \ ../../corelib/kernel/qmetatype.cpp \ ../../corelib/kernel/qvariant.cpp \ ../../corelib/tools/qbitarray.cpp \ @@ -86,11 +90,12 @@ unix:SOURCES += ../../corelib/io/qfsfileengine_unix.cpp \ ../../corelib/io/qfsfileengine_iterator_unix.cpp win32:SOURCES += ../../corelib/io/qfsfileengine_win.cpp \ - ../../corelib/io/qfsfileengine_iterator_win.cpp + ../../corelib/io/qfsfileengine_iterator_win.cpp \ + ../../corelib/io/qsettings_win.cpp macx: { QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported) - SOURCES += ../../corelib/kernel/qcore_mac.cpp + SOURCES += ../../corelib/kernel/qcore_mac.cpp ../../corelib/io/qsettings_mac.cpp LIBS += -framework CoreServices } diff --git a/src/tools/rcc/rcc.cpp b/src/tools/rcc/rcc.cpp index 51f850a..6b3227a 100644 --- a/src/tools/rcc/rcc.cpp +++ b/src/tools/rcc/rcc.cpp @@ -709,46 +709,6 @@ bool RCCResourceLibrary::writeHeader() { if (m_format == C_Code) { writeString("/****************************************************************************\n"); - writeString("**\n"); - writeString("** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).\n"); - writeString("** All rights reserved.\n"); - writeString("** Contact: Nokia Corporation (qt-info@nokia.com)\n"); - writeString("**\n"); - writeString("** This file is part of the tools applications of the Qt Toolkit.\n"); - writeString("**\n"); - writeString("** $QT_BEGIN_LICENSE:LGPL$\n"); - writeString("** No Commercial Usage\n"); - writeString("** This file contains pre-release code and may not be distributed.\n"); - writeString("** You may use this file in accordance with the terms and conditions\n"); - writeString("** contained in the Technology Preview License Agreement accompanying\n"); - writeString("** this package.\n"); - writeString("**\n"); - writeString("** GNU Lesser General Public License Usage\n"); - writeString("** Alternatively, this file may be used under the terms of the GNU Lesser\n"); - writeString("** General Public License version 2.1 as published by the Free Software\n"); - writeString("** Foundation and appearing in the file LICENSE.LGPL included in the\n"); - writeString("** packaging of this file. Please review the following information to\n"); - writeString("** ensure the GNU Lesser General Public License version 2.1 requirements\n"); - writeString("** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.\n"); - writeString("**\n"); - writeString("** In addition, as a special exception, Nokia gives you certain additional\n"); - writeString("** rights. These rights are described in the Nokia Qt LGPL Exception\n"); - writeString("** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.\n"); - writeString("**\n"); - writeString("** If you have questions regarding the use of this file, please contact\n"); - writeString("** Nokia at qt-info@nokia.com.\n"); - writeString("**\n"); - writeString("**\n"); - writeString("**\n"); - writeString("**\n"); - writeString("**\n"); - writeString("**\n"); - writeString("**\n"); - writeString("**\n"); - writeString("** $QT_END_LICENSE$\n"); - writeString("**\n"); - writeString("****************************************************************************/\n"); - writeString("/****************************************************************************\n"); writeString("** Resource object code\n"); writeString("**\n"); writeString("** Created: "); diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 1690c2e..b2e8f4f 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -670,10 +670,13 @@ void WriteInitialization::acceptWidget(DomWidget *node) m_layoutWidget = false; if (className == QLatin1String("QWidget") && !node->hasAttributeNative()) { - if (m_widgetChain.top() - && m_widgetChain.top()->attributeClass() != QLatin1String("QMainWindow") - && !m_uic->isContainer(m_widgetChain.top()->attributeClass())) + if (const DomWidget* parentWidget = m_widgetChain.top()) { + const QString parentClass = parentWidget->attributeClass(); + if (parentClass != QLatin1String("QMainWindow") + && !m_uic->isCustomWidgetContainer(parentClass) + && !m_uic->isContainer(parentClass)) m_layoutWidget = true; + } } m_widgetChain.push(node); m_layoutChain.push(0); @@ -718,7 +721,7 @@ void WriteInitialization::acceptWidget(DomWidget *node) m_output << m_indent << parentWidget << "->addDockWidget(" << area << varName << ");\n"; } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QStatusBar"))) { m_output << m_indent << parentWidget << "->setStatusBar(" << varName << ");\n"; - } else if (className == QLatin1String("QWidget")) { + } else { m_output << m_indent << parentWidget << "->setCentralWidget(" << varName << ");\n"; } } diff --git a/src/tools/uic/customwidgetsinfo.cpp b/src/tools/uic/customwidgetsinfo.cpp index 70adba2..ca3fd19 100644 --- a/src/tools/uic/customwidgetsinfo.cpp +++ b/src/tools/uic/customwidgetsinfo.cpp @@ -88,6 +88,14 @@ bool CustomWidgetsInfo::extends(const QString &classNameIn, const QLatin1String return false; } +bool CustomWidgetsInfo::isCustomWidgetContainer(const QString &className) const +{ + if (const DomCustomWidget *dcw = m_customWidgets.value(className, 0)) + if (dcw->hasElementContainer()) + return dcw->elementContainer() != 0; + return false; +} + QString CustomWidgetsInfo::realClassName(const QString &className) const { if (className == QLatin1String("Line")) diff --git a/src/tools/uic/customwidgetsinfo.h b/src/tools/uic/customwidgetsinfo.h index 1471118..d5be5a2 100644 --- a/src/tools/uic/customwidgetsinfo.h +++ b/src/tools/uic/customwidgetsinfo.h @@ -78,6 +78,8 @@ public: bool extends(const QString &className, const QLatin1String &baseClassName) const; + bool isCustomWidgetContainer(const QString &className) const; + private: typedef QMap<QString, DomCustomWidget*> NameCustomWidgetMap; NameCustomWidgetMap m_customWidgets; diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index 32e5e3d..71b6ac1 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -363,6 +363,11 @@ bool Uic::isContainer(const QString &className) const || customWidgetsInfo()->extends(className, QLatin1String("QDockWidget")); } +bool Uic::isCustomWidgetContainer(const QString &className) const +{ + return customWidgetsInfo()->isCustomWidgetContainer(className); +} + bool Uic::isStatusBar(const QString &className) const { return customWidgetsInfo()->extends(className, QLatin1String("QStatusBar")); diff --git a/src/tools/uic/uic.h b/src/tools/uic/uic.h index 3e072a4..5175ea9 100644 --- a/src/tools/uic/uic.h +++ b/src/tools/uic/uic.h @@ -115,6 +115,7 @@ public: bool isStatusBar(const QString &className) const; bool isButton(const QString &className) const; bool isContainer(const QString &className) const; + bool isCustomWidgetContainer(const QString &className) const; bool isMenuBar(const QString &className) const; bool isMenu(const QString &className) const; diff --git a/src/tools/uic3/uic.cpp b/src/tools/uic3/uic.cpp index 7872866..6761eaf 100644 --- a/src/tools/uic3/uic.cpp +++ b/src/tools/uic3/uic.cpp @@ -322,6 +322,11 @@ bool Uic::isContainer(const QString &className) const || customWidgetsInfo()->extends(className, QLatin1String("QDockWidget")); } +bool Uic::isCustomWidgetContainer(const QString &className) const +{ + return customWidgetsInfo()->isCustomWidgetContainer(className); +} + bool Uic::isStatusBar(const QString &className) const { return customWidgetsInfo()->extends(className, QLatin1String("QStatusBar")); diff --git a/src/tools/uic3/uic.h b/src/tools/uic3/uic.h index 50aa71c..63a1f8d 100644 --- a/src/tools/uic3/uic.h +++ b/src/tools/uic3/uic.h @@ -114,6 +114,7 @@ public: bool isStatusBar(const QString &className) const; bool isButton(const QString &className) const; bool isContainer(const QString &className) const; + bool isCustomWidgetContainer(const QString &className) const; bool isMenuBar(const QString &className) const; bool isMenu(const QString &className) const; diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 46f26f8..da1f7ca 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -10,7 +10,8 @@ TEMPLATE = subdirs linguist \ moc \ uic \ - uic3 + uic3 \ + guiapplauncher Q3SUBDIRS += \ q3accel \ q3action \ diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp index f97805e..84f466b 100644 --- a/tests/auto/collections/tst_collections.cpp +++ b/tests/auto/collections/tst_collections.cpp @@ -3586,7 +3586,7 @@ void tst_Collections::alignment() #else void tst_Collections::alignment() { - QSKIP("Compiler doesn't support necessary extension keywords", SkipAll) + QSKIP("Compiler doesn't support necessary extension keywords", SkipAll); } #endif diff --git a/tests/auto/guiapplauncher/README.txt b/tests/auto/guiapplauncher/README.txt new file mode 100644 index 0000000..317f9d0 --- /dev/null +++ b/tests/auto/guiapplauncher/README.txt @@ -0,0 +1,14 @@ +This test launches gui applications (tools, demos and prominent examples), +keeps them running a while (grabbing their top level from the window manager) +and sends them a Close event via window manager. + +It checks that they do not crash nor produce unexpected error output. + +Note: Do not play with the machine while it is running as otherwise +the top-level find algorithm might get confused (especially on Windows). + +Environment variables are checked to turned off some tests (see code). + +It is currently implemented for X11 (Skips unless DISPLAY is set) and +Windows, pending an implementation of the WindowManager class and deployment +on the other platforms. diff --git a/tests/auto/guiapplauncher/guiapplauncher.pro b/tests/auto/guiapplauncher/guiapplauncher.pro new file mode 100644 index 0000000..27c3553 --- /dev/null +++ b/tests/auto/guiapplauncher/guiapplauncher.pro @@ -0,0 +1,20 @@ +# ------------------------------------------------- +# Project created by QtCreator 2009-11-10T14:39:06 +# ------------------------------------------------- + +# Link against gui for X11,etc. + +DEFINES += SRCDIR=\\\"$$PWD/\\\" +TARGET = tst_guiapplauncher +CONFIG += console +CONFIG -= app_bundle +CONFIG += qtestlib +TEMPLATE = app +SOURCES += tst_guiapplauncher.cpp \ + windowmanager.cpp +HEADERS += windowmanager.h + +win32 { + # process enumeration,etc. + LIBS+=user32.lib +} diff --git a/tests/auto/guiapplauncher/test.ts b/tests/auto/guiapplauncher/test.ts new file mode 100644 index 0000000..79c9c76 --- /dev/null +++ b/tests/auto/guiapplauncher/test.ts @@ -0,0 +1,973 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="de"> +<context> + <name>AssistantServer</name> + <message> + <location filename="../tools/assistant/compat/main.cpp" line="+225"/> + <source>Qt Assistant</source> + <translation>Qt Assistant</translation> + </message> + <message> + <location line="+1"/> + <source>Failed to bind to port %1</source> + <translation>Kann Port %1 nicht binden</translation> + </message> +</context> +<context> + <name>FontPanel</name> + <message> + <location filename="../tools/shared/fontpanel/fontpanel.cpp" line="+63"/> + <source>Font</source> + <translation>Schrift</translation> + </message> + <message> + <location line="+11"/> + <source>&Writing system</source> + <translation>S&kript</translation> + </message> + <message> + <location line="+3"/> + <source>&Family</source> + <translation>&Schriftart</translation> + </message> + <message> + <location line="+4"/> + <source>&Style</source> + <translation>S&chriftschnitt</translation> + </message> + <message> + <location line="+4"/> + <source>&Point size</source> + <translation>Schriftg&rad</translation> + </message> +</context> +<context> + <name>FontSettingsDialog</name> + <message> + <location filename="../tools/assistant/compat/fontsettingsdialog.cpp" line="+63"/> + <source>Font Settings</source> + <translation>Schriftart</translation> + </message> + <message> + <location line="+7"/> + <source>Font settings for:</source> + <translation>Schriftart für:</translation> + </message> + <message> + <location line="+4"/> + <source>Browser</source> + <translation>Hilfeseiten</translation> + </message> + <message> + <location line="+1"/> + <source>Application</source> + <translation>Anwendung</translation> + </message> + <message> + <location line="+6"/> + <source>Use custom settings</source> + <translation>Erweitere Einstellungen nutzen</translation> + </message> +</context> +<context> + <name>HelpDialog</name> + <message> + <location filename="../tools/assistant/compat/helpdialog.ui"/> + <source>Con&tents</source> + <translation>Inhal&t</translation> + </message> + <message> + <location filename="../tools/assistant/compat/helpdialog.cpp" line="+376"/> + <location line="+16"/> + <location line="+661"/> + <source>Qt Assistant</source> + <translation>Qt Assistant</translation> + </message> + <message> + <location line="-771"/> + <source>Open Link in New Window</source> + <translation>Öffne Link in neuem Fenster</translation> + </message> + <message> + <location line="+76"/> + <location line="+82"/> + <source>Prepare...</source> + <translation>Initialisiere...</translation> + </message> + <message> + <location line="-47"/> + <source>Cannot open the index file %1</source> + <translation>Kann Indexdatei %1 nicht öffnen</translation> + </message> + <message> + <location line="+58"/> + <location line="+124"/> + <location line="+8"/> + <source>Warning</source> + <translation>Warnung</translation> + </message> + <message> + <location line="-131"/> + <location line="+124"/> + <source>Documentation file %1 does not exist! +Skipping file.</source> + <translation>Dokumentation %1 existiert nicht! +Überspringe Datei.</translation> + </message> + <message> + <location line="-112"/> + <location line="+133"/> + <source>Parse Error</source> + <translation>Syntaxfehler</translation> + </message> + <message> + <location line="+35"/> + <location line="+469"/> + <source>Done</source> + <translation>Fertig</translation> + </message> + <message> + <location line="-18"/> + <source>Indexing files...</source> + <translation>Indiziere Dokumentation...</translation> + </message> + <message> + <location line="+15"/> + <source>Reading dictionary...</source> + <translation>Lese Suchindex...</translation> + </message> + <message> + <location line="+46"/> + <location line="+9"/> + <source>Full Text Search</source> + <translation>Volltextsuche</translation> + </message> + <message> + <location line="-8"/> + <source>Using a wildcard within phrases is not allowed.</source> + <translation>Wildcards innerhalb von Phrasen sind nicht zugelassen.</translation> + </message> + <message> + <location line="+9"/> + <source>The closing quotation mark is missing.</source> + <translation>Das schließende Anführungszeichen fehlt.</translation> + </message> + <message numerus="yes"> + <location line="+7"/> + <source>%n document(s) found.</source> + <translation> + <numerusform>%n Dokumente gefunden.</numerusform> + <numerusform></numerusform> + </translation> + </message> + <message> + <location line="-882"/> + <source>Open Link in Current Tab</source> + <translation>Link im Aktuellen Tab öffnen</translation> + </message> + <message> + <location line="+6"/> + <source>Open Link in New Tab</source> + <translation>Link in einem neuen Tab öffnen</translation> + </message> + <message> + <location line="+91"/> + <source>Failed to load keyword index file +Assistant will not work!</source> + <translation>Die Indexdatei konnte nicht geladen werden. +Der Assistent ist nicht einsatzbereit!</translation> + </message> + <message> + <location line="+208"/> + <source>Documentation file %1 is not compatible! +Skipping file.</source> + <translation>Dokumentation %1 ist nicht kompatibel! Datei wird übersprungen.</translation> + </message> + <message> + <location line="+470"/> + <source>Failed to save fulltext search index +Assistant will not work!</source> + <translation>Der Index für die Volltextsuche konnte nicht gespeichert werden. +Assistent ist nicht einsatzbereit!</translation> + </message> + <message> + <location filename="../tools/assistant/compat/helpdialog.ui"/> + <source>Help</source> + <translation>Hilfe</translation> + </message> + <message> + <location/> + <source><b>Help</b><p>Choose the topic you want help on from the contents list, or search the index for keywords.</p></source> + <translation><b>Hilfe</b><p>Wählen Sie ein Hilfethema aus dem Inhalt oder suchen Sie im Index nach Schlüsselwörtern.</p></translation> + </message> + <message> + <location/> + <source>Displays help topics organized by category, index or bookmarks. Another tab inherits the full text search.</source> + <translation>Zeigt Hilfethemen geordnet nach Kategorie, Index oder Lesezeichen an. Ein weiterer Abschnitt enthält die Volltextsuche.</translation> + </message> + <message> + <location/> + <source><b>Help topics organized by category.</b><p>Double-click an item to see the topics in that category. To view a topic, just double-click it.</p></source> + <translation><b>Hilfethemen geordnet nach Kategorie.</b><p>Doppelklicken Sie einen Eintrag, um die Themen dieser Kategorie zu sehen. Doppelklicken Sie ein Thema, um es angezeigt zu bekommen.</p></translation> + </message> + <message> + <location/> + <source>column 1</source> + <translation>Spalte 1</translation> + </message> + <message> + <location/> + <source>&Index</source> + <translation>&Index</translation> + </message> + <message> + <location/> + <source>&Look For:</source> + <translation>Suchen &nach:</translation> + </message> + <message> + <location/> + <source>Enter keyword</source> + <translation>Geben Sie ein Schlüsselwort ein</translation> + </message> + <message> + <location/> + <source><b>Enter a keyword.</b><p>The list will select an item that matches the entered string best.</p></source> + <translation><b>Geben Sie ein Schlüsselwort ein.</b><p>Es wird dann der Eintrag aus der Liste ausgewählt, der am besten mit dem eingegebenen Begriff übereinstimmt.</p></translation> + </message> + <message> + <location/> + <source><b>List of available help topics.</b><p>Double-click on an item to open its help page. If more than one is found, you must specify which page you want.</p></source> + <translation><b>Liste aller verfügbaren Hilfethemen.</b><p>Doppelklicken Sie auf einen Eintrag, um die Hilfe zu öffnen. Wenn mehr als eine Seite gefunden wurde, wählen Sie die gewünschte Seite aus.</p></translation> + </message> + <message> + <location/> + <source>&Bookmarks</source> + <translation>L&esezeichen</translation> + </message> + <message> + <location/> + <source>Displays the list of bookmarks.</source> + <translation>Zeigt alle Lesezeichen an.</translation> + </message> + <message> + <location/> + <source>Add new bookmark</source> + <translation>Füge neues Lesezeichen hinzu</translation> + </message> + <message> + <location/> + <source>Add the currently displayed page as a new bookmark.</source> + <translation>Füge aktuelle Seite zu den Lesezeichen hinzu.</translation> + </message> + <message> + <location/> + <source>&New</source> + <translation>&Neu</translation> + </message> + <message> + <location/> + <source>Delete bookmark</source> + <translation>Lösche Lesezeichen</translation> + </message> + <message> + <location/> + <source>Delete the selected bookmark.</source> + <translation>Lösche markiertes Lesezeichen.</translation> + </message> + <message> + <location/> + <source>&Delete</source> + <translation>&Löschen</translation> + </message> + <message> + <location/> + <source>&Search</source> + <translation>&Suche</translation> + </message> + <message> + <location/> + <source>Searching f&or:</source> + <translation>Suche &nach:</translation> + </message> + <message> + <location/> + <source><b>Enter search word(s).</b><p>Enter here the word(s) you are looking for. The words may contain wildcards (*). For a sequence of words quote them.</p></source> + <translation><b>Geben Sie Suchbegriffe ein.</b><p>Geben Sie hier die gesuchten Begriffe ein. Die Begriffe können Wildcards (*) enthalten. Eine Phrase muß in Anführungszeichen stehen.</p></translation> + </message> + <message> + <location/> + <source><b>Found documents</b><p>This list contains all found documents from the last search. The documents are ordered, i.e. the first document has the most matches.</p></source> + <translation><b>Gefundene Dokumente</b><p>Diese Liste beinhaltet alle gefundenen Dokumente der letzten Suche. Die Dokumente sind nach der Häufigkeit der Treffer geordnet.</p></translation> + </message> + <message> + <location/> + <source>Found &Documents:</source> + <translation>Gefundene &Dokumente:</translation> + </message> + <message> + <location/> + <source>Display the help page for the full text search.</source> + <translation>Zeigt die Hilfeseite für die Volltextsuche an.</translation> + </message> + <message> + <location/> + <source>He&lp</source> + <translation>Hi&lfe</translation> + </message> + <message> + <location/> + <source>Pressing this button starts the search.</source> + <translation>Startet die Suche.</translation> + </message> + <message> + <location/> + <source>Preparing...</source> + <translation>Initialisiere...</translation> + </message> + <message> + <location/> + <source>Enter searchword(s)</source> + <translation>Geben Sie Suchbegriffe ein</translation> + </message> + <message> + <location/> + <source>Display the help page</source> + <translation>Hilfeseite anzeigen</translation> + </message> + <message> + <location/> + <source>Start searching</source> + <translation>Suche beginnen</translation> + </message> +</context> +<context> + <name>HelpWindow</name> + <message> + <location filename="../tools/assistant/compat/helpwindow.cpp" line="+97"/> + <source>Help</source> + <translation>Hilfe</translation> + </message> + <message> + <location line="+93"/> + <source>Open Link in New Window Shift+LMB</source> + <translation>Öffne Link in neuem Fenster</translation> + </message> + <message> + <location line="-2"/> + <source>Open Link in New Tab</source> + <translation>Link in einem neuen Tab öffnen</translation> + </message> + <message> + <location line="-90"/> + <source>Unable to launch web browser. +</source> + <translation>Der Webbrowser konnte nicht gestartet werden. +</translation> + </message> + <message> + <location line="+1"/> + <source>OK</source> + <translation>OK</translation> + </message> + <message> + <location line="+27"/> + <source>Failed to open link: '%1'</source> + <translation>Der Link '%1' konnte nicht geöffnet werden</translation> + </message> + <message> + <location line="+1"/> + <source><div align="center"><h1>The page could not be found</h1><br><h3>'%1'</h3></div></source> + <translation><div align="center"><h1>Die Seite wurde nicht gefunden</h1><br><h3>'%1'</h3></div></translation> + </message> + <message> + <location line="+2"/> + <source>Error...</source> + <translation>Fehler ...</translation> + </message> + <message> + <location line="+56"/> + <source>Copy &Link Location</source> + <translation>Link-Adresse kopieren</translation> + </message> +</context> +<context> + <name>Index</name> + <message> + <location filename="../tools/assistant/compat/index.cpp" line="+385"/> + <source>Untitled</source> + <translation>Unbenannt</translation> + </message> +</context> +<context> + <name>MainWindow</name> + <message> + <location filename="../tools/assistant/compat/mainwindow.ui"/> + <source>Toolbar</source> + <translation>Werkzeugleiste</translation> + </message> + <message> + <location/> + <source>&Print...</source> + <translation>&Drucken...</translation> + </message> + <message> + <location/> + <source>E&xit</source> + <translation>&Beenden</translation> + </message> + <message> + <location/> + <source>&Copy</source> + <translation>&Kopieren</translation> + </message> + <message> + <location/> + <source>&Find in Text...</source> + <translation>Text&suche...</translation> + </message> + <message> + <location/> + <source>&Home</source> + <translation>St&artseite</translation> + </message> + <message> + <location/> + <source>&Previous</source> + <translation>&Vorherige</translation> + </message> + <message> + <location/> + <source>&Next</source> + <translation>&Nächste</translation> + </message> + <message> + <location/> + <source>About Qt</source> + <translation>Über Qt</translation> + </message> + <message> + <location/> + <source>Zoom &in</source> + <translation>Vergrößern</translation> + </message> + <message> + <location/> + <source>Zoom &out</source> + <translation>Ver&kleinern</translation> + </message> + <message> + <location/> + <source>New Window</source> + <translation>Neues Fenster...</translation> + </message> + <message> + <location filename="../tools/assistant/compat/mainwindow.cpp" line="+198"/> + <source>Ctrl+T</source> + <translation>Strg+T +</translation> + </message> + <message> + <location line="+1"/> + <source>Ctrl+I</source> + <translation>Strg+I</translation> + </message> + <message> + <location line="+1"/> + <source>Ctrl+B</source> + <translation>Strg+E</translation> + </message> + <message> + <location line="+129"/> + <location line="+1"/> + <source>Qt Assistant</source> + <translation>Qt Assistant</translation> + </message> + <message> + <location filename="../tools/assistant/compat/mainwindow.ui"/> + <source>&Add Bookmark</source> + <translation>&Füge Lesezeichen hinzu</translation> + </message> + <message> + <location/> + <source>&File</source> + <translation>&Datei</translation> + </message> + <message> + <location/> + <source>&Edit</source> + <translation>&Bearbeiten</translation> + </message> + <message> + <location/> + <source>&View</source> + <translation>&Ansicht</translation> + </message> + <message> + <location/> + <source>&Go</source> + <translation>&Gehe zu</translation> + </message> + <message> + <location/> + <source>Boo&kmarks</source> + <translation>&Lesezeichen</translation> + </message> + <message> + <location/> + <source>Qt Assistant by Nokia</source> + <translation>Qt Assistant von Nokia</translation> + </message> + <message> + <location/> + <source>&Help</source> + <translation>&Hilfe</translation> + </message> + <message> + <location/> + <source>Print the currently displayed page.</source> + <translation>Drucke aktuelle Seite.</translation> + </message> + <message> + <location/> + <source>Ctrl+P</source> + <translation>Strg+P</translation> + </message> + <message> + <location/> + <source>Quit Qt Assistant.</source> + <translation>Qt Assistant beenden.</translation> + </message> + <message> + <location/> + <source>Ctrl+Q</source> + <translation>Strg+Q</translation> + </message> + <message> + <location/> + <source>Copy the selected text to the clipboard.</source> + <translation>Den markierten Text in die Zwischenablage kopieren.</translation> + </message> + <message> + <location/> + <source>Ctrl+C</source> + <translation>Strg+C</translation> + </message> + <message> + <location/> + <source>Open the Find dialog. Qt Assistant will search the currently displayed page for the text you enter.</source> + <translation>Den Suchdialog öffnen. Qt Assistant sucht in der aktuellen Seite nach dem eingegebenen Text.</translation> + </message> + <message> + <location/> + <source>Ctrl+F</source> + <translation>Strg+F</translation> + </message> + <message> + <location/> + <source>Go to the home page. Qt Assistant's home page is the Qt Reference Documentation.</source> + <translation>Zur Startseite gehen. Startseite im Qt Assistant ist die Qt-Referenzdokumentation.</translation> + </message> + <message> + <location/> + <source>Ctrl+Home</source> + <translation>Strg+Pos1</translation> + </message> + <message> + <location/> + <source>Go to the previous page.</source> + <translation>Gehe zur vorherigen Seite.</translation> + </message> + <message> + <location/> + <source>Alt+Left</source> + <translation>Alt+Links</translation> + </message> + <message> + <location/> + <source>Go to the next page.</source> + <translation>Gehe zur nächsten Seite.</translation> + </message> + <message> + <location/> + <source>Alt+Right</source> + <translation>Alt+Rechts</translation> + </message> + <message> + <location/> + <source>Display further information about Qt Assistant.</source> + <translation>Zeigt das Handbuch zum Qt Designer an.</translation> + </message> + <message> + <location/> + <source>Zoom in on the document, i.e. increase the font size.</source> + <translation>Vergrößert die Schrift.</translation> + </message> + <message> + <location/> + <source>Ctrl++</source> + <translation>Strg++</translation> + </message> + <message> + <location/> + <source>Zoom out on the document, i.e. decrease the font size.</source> + <translation>Verkleinert die Schrift.</translation> + </message> + <message> + <location/> + <source>Ctrl+-</source> + <translation>Strg+-</translation> + </message> + <message> + <location/> + <source>Open a new window.</source> + <translation>Öffnet ein neues Fenster.</translation> + </message> + <message> + <location/> + <source>Ctrl+N</source> + <translation>Strg+N</translation> + </message> + <message> + <location/> + <source>&Close</source> + <translation>&Schließen</translation> + </message> + <message> + <location/> + <source>Close the current window.</source> + <translation>Schließt das aktuelle Fenster.</translation> + </message> + <message> + <location/> + <source>Qt Assistant Manual</source> + <translation>Handbuch zu Qt Assistant</translation> + </message> + <message> + <location/> + <source>F1</source> + <translation>F1</translation> + </message> + <message> + <location/> + <source>Add the currently displayed page as a new bookmark.</source> + <translation>Aktuelle Seite zu den Lesezeichen hinzufügen.</translation> + </message> + <message> + <location/> + <source>What's This?</source> + <translation>Direkthilfe</translation> + </message> + <message> + <location/> + <source>"What's This?" context sensitive help.</source> + <translation>Kontextbezogene Direkthilfe.</translation> + </message> + <message> + <location/> + <source>Shift+F1</source> + <translation>Umschalt+F1</translation> + </message> + <message> + <location filename="../tools/assistant/compat/mainwindow.cpp" line="-129"/> + <source>Ctrl+S</source> + <translation>Strg+S</translation> + </message> + <message> + <location line="-33"/> + <source>Initializing Qt Assistant...</source> + <translation>Qt Assistant wird initialisiert...</translation> + </message> + <message> + <location filename="../tools/assistant/compat/mainwindow.ui"/> + <source>Go</source> + <translation>Gehe zu</translation> + </message> + <message> + <location/> + <source>Find &Next</source> + <translation>Weitersuchen</translation> + </message> + <message> + <location/> + <source>F3</source> + <translation>F3</translation> + </message> + <message> + <location/> + <source>Find &Previous</source> + <translation>Vorheriges suchen</translation> + </message> + <message> + <location/> + <source>Shift+F3</source> + <translation>Umschalt+F3</translation> + </message> + <message> + <location/> + <source>About Qt Assistant</source> + <translation>Über Qt Assistent</translation> + </message> + <message> + <location/> + <source>Add Tab</source> + <translation>Tab einfügen</translation> + </message> + <message> + <location/> + <source>Ctrl+Alt+N</source> + <translation></translation> + </message> + <message> + <location/> + <source>Next Tab</source> + <translation>Nächster Tab</translation> + </message> + <message> + <location/> + <source>Ctrl+Alt+Right</source> + <translation></translation> + </message> + <message> + <location/> + <source>Previous Tab</source> + <translation>Voriger Tab</translation> + </message> + <message> + <location/> + <source>Ctrl+Alt+Left</source> + <translation></translation> + </message> + <message> + <location/> + <source>Close Tab</source> + <translation>Tab schließen</translation> + </message> + <message> + <location/> + <source>Ctrl+Alt+Q</source> + <translation></translation> + </message> + <message> + <location filename="../tools/assistant/compat/mainwindow.cpp" line="+181"/> + <source>Failed to open about application contents in file: '%1'</source> + <translation>Fehler beim Öffnen des Inhalts in Datei: '%1'</translation> + </message> + <message> + <location line="-246"/> + <source>Sidebar</source> + <translation>Sidebar</translation> + </message> + <message> + <location line="+18"/> + <source>&Window</source> + <translation>&Fenster</translation> + </message> + <message> + <location line="+2"/> + <source>Minimize</source> + <translation>Minimieren</translation> + </message> + <message> + <location line="+1"/> + <source>Ctrl+M</source> + <translation>Strg+M</translation> + </message> + <message> + <location line="+70"/> + <source>SHIFT+CTRL+=</source> + <translation>Umschalt+Strg+=</translation> + </message> + <message> + <location filename="../tools/assistant/compat/mainwindow.ui"/> + <source>Ctrl+W</source> + <translation>Strg+W</translation> + </message> + <message> + <location filename="../tools/assistant/compat/mainwindow.cpp" line="+8"/> + <source>Ctrl+]</source> + <translation>Strg+AltGr+]</translation> + </message> + <message> + <location line="+1"/> + <source>Ctrl+[</source> + <translation>Strg+AltGr+[</translation> + </message> + <message> + <location line="+7"/> + <source>Views</source> + <translation>Menüleisten/Sidebar</translation> + </message> + <message> + <location line="+80"/> + <source>Displays the main page of a specific documentation set.</source> + <translation>Zeigt die Hauptseite eines Dokumentensets an.</translation> + </message> + <message> + <location line="+262"/> + <source>...</source> + <translation>...</translation> + </message> + <message> + <location line="+238"/> + <location line="+6"/> + <source>Save Page</source> + <translation>Seite speichern</translation> + </message> + <message> + <location line="+0"/> + <source>Cannot open file for writing!</source> + <translation>Die Datei konnte nicht zum Schreiben geöffnet werden.</translation> + </message> + <message> + <location filename="../tools/assistant/compat/mainwindow.ui"/> + <source>Save Page As...</source> + <translation>Seite speichern als...</translation> + </message> + <message> + <location/> + <source>Ctrl+Alt+S</source> + <translation>Strg+Alt+S</translation> + </message> + <message> + <location/> + <source>Sync with Table of Contents</source> + <translation>Seite mit Inhalt-Tab syncronisieren</translation> + </message> + <message> + <location/> + <source>Select the page in contents tab.</source> + <translation>Wählt die Seite im Inhalt-Tab aus.</translation> + </message> + <message> + <location/> + <source>Font Settings...</source> + <translation>Schriftart...</translation> + </message> +</context> +<context> + <name>QObject</name> + <message> + <location filename="../tools/assistant/compat/config.cpp" line="+350"/> + <source>Qt Assistant by Nokia</source> + <translation>Qt Assistant von Nokia</translation> + </message> +</context> +<context> + <name>TabbedBrowser</name> + <message> + <location filename="../tools/assistant/compat/tabbedbrowser.ui"/> + <source>TabbedBrowser</source> + <translation></translation> + </message> + <message> + <location/> + <source>Untitled</source> + <translation>Unbenannt</translation> + </message> + <message> + <location filename="../tools/assistant/compat/tabbedbrowser.cpp" line="+235"/> + <source>Add page</source> + <translation>Seite einfügen</translation> + </message> + <message> + <location line="+9"/> + <source>Close page</source> + <translation>Seite schließen</translation> + </message> + <message> + <location line="-95"/> + <source>...</source> + <translation>...</translation> + </message> + <message> + <location line="+338"/> + <source>New Tab</source> + <translation>Neuer Tab</translation> + </message> + <message> + <location line="+1"/> + <source>Close Tab</source> + <translation>Tab schließen</translation> + </message> + <message> + <location line="+1"/> + <source>Close Other Tabs</source> + <translation>Andere Tabs schließen</translation> + </message> + <message> + <location filename="../tools/assistant/compat/tabbedbrowser.ui"/> + <source>Previous</source> + <translation>Vorheriger</translation> + </message> + <message> + <location/> + <source>Next</source> + <translation>Nächster</translation> + </message> + <message> + <location/> + <source>Case Sensitive</source> + <translation>Groß-/Kleinschreibung beachten</translation> + </message> + <message> + <location/> + <source>Whole words</source> + <translation>Ganze Wörter</translation> + </message> + <message> + <location/> + <source><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Search wrapped</source> + <translation><img src=":/trolltech/assistant/images/wrap.png">&nbsp;Seitenende</translation> + </message> +</context> +<context> + <name>TopicChooser</name> + <message> + <location filename="../tools/assistant/compat/topicchooser.cpp" line="+56"/> + <source>Choose a topic for <b>%1</b></source> + <translation>Wählen Sie ein Thema für <b>%1</b></translation> + </message> + <message> + <location filename="../tools/assistant/compat/topicchooser.ui"/> + <source>Choose Topic</source> + <translation>Thema wählen</translation> + </message> + <message> + <location/> + <source>Select a topic from the list and click the <b>Display</b>-button to open the online help.</source> + <translation>Wählen Sie ein Thema aus der Liste aus und klicken Sie <b>Anzeigen</b> um die Hilfe zu öffnen.</translation> + </message> + <message> + <location/> + <source>&Topics</source> + <translation>&Themen</translation> + </message> + <message> + <location/> + <source>Displays a list of available help topics for the keyword.</source> + <translation>Zeigt eine Liste der verfügbaren Hilfethemen für diesen Begriff an.</translation> + </message> + <message> + <location/> + <source>&Display</source> + <translation>&Anzeigen</translation> + </message> + <message> + <location/> + <source>Open the topic selected in the list.</source> + <translation>Öffne das gewählte Thema aus der Liste.</translation> + </message> + <message> + <location/> + <source>&Close</source> + <translation>&Schließen</translation> + </message> + <message> + <location/> + <source>Close the Dialog.</source> + <translation>Schließt den Dialog.</translation> + </message> +</context> +</TS> diff --git a/tests/auto/guiapplauncher/test.ui b/tests/auto/guiapplauncher/test.ui new file mode 100644 index 0000000..02efcd4 --- /dev/null +++ b/tests/auto/guiapplauncher/test.ui @@ -0,0 +1,66 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>600</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="centralwidget"> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QPlainTextEdit" name="plainTextEdit"/> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>800</width> + <height>23</height> + </rect> + </property> + <widget class="QMenu" name="menuFile"> + <property name="title"> + <string>File</string> + </property> + <addaction name="actionExit"/> + </widget> + <addaction name="menuFile"/> + </widget> + <widget class="QStatusBar" name="statusbar"/> + <action name="actionExit"> + <property name="text"> + <string>Exit</string> + </property> + </action> + </widget> + <resources/> + <connections> + <connection> + <sender>actionExit</sender> + <signal>triggered()</signal> + <receiver>MainWindow</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel"> + <x>-1</x> + <y>-1</y> + </hint> + <hint type="destinationlabel"> + <x>399</x> + <y>299</y> + </hint> + </hints> + </connection> + </connections> +</ui> diff --git a/tests/auto/guiapplauncher/tst_guiapplauncher.cpp b/tests/auto/guiapplauncher/tst_guiapplauncher.cpp new file mode 100644 index 0000000..a61bd5e --- /dev/null +++ b/tests/auto/guiapplauncher/tst_guiapplauncher.cpp @@ -0,0 +1,526 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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 "windowmanager.h" + +#include <QtCore/QDir> +#include <QtCore/QString> +#include <QtTest/QtTest> +#include <QtCore/QProcess> +#include <QtCore/QByteArray> +#include <QtCore/QLibraryInfo> +#include <QtCore/QVariant> +#include <QtCore/QDateTime> +#include <QtCore/QMap> + +// AppLaunch: Launch gui applications, keep them running a while +// (grabbing their top level from the window manager) and send +// them a Close event via window manager. Verify that they do not +// not crash nor produces unexpected error output. +// Note: Do not play with the machine while it is running as otherwise +// the top-level find algorithm might get confused (especially on Windows). +// Environment variables are checked to turned off some tests +// It is currently implemented for X11 and Windows, pending an +// implementation of the WindowManager class and deployment on +// the other platforms. + +enum { defaultUpTimeMS = 3000, defaultTopLevelWindowTimeoutMS = 30000, + defaultTerminationTimeoutMS = 35000 }; + +// List the examples to test (Gui examples only). +struct Example { + const char *name; + const char *directory; + const char *binary; + unsigned priority; // 0-highest + int upTimeMS; +}; + +const struct Example examples[] = { + {"animation/animatedtiles Example", "animation/animatedtiles", "animatedtiles", 0, -1}, + {"animation/appchooser Example", "animation/appchooser", "appchooser", 10, -1}, + {"animation/easing Example", "animation/easing", "easing", 10, -1}, + {"animation/moveblocks Example", "animation/moveblocks", "moveblocks", 10, -1}, + {"animation/states Example", "animation/states", "states", 10, -1}, + {"animation/stickman Example", "animation/stickman", "stickman", 10, -1}, + {"designer/calculatorbuilder Example", "designer/calculatorbuilder", "calculatorbuilder", 10, -1}, + {"dialogs/standarddialogs Example", "dialogs/standarddialogs", "standarddialogs", 10, -1}, + {"draganddrop/dropsite Example", "draganddrop/dropsite", "dropsite", 10, -1}, + {"draganddrop/fridgemagnets Example", "draganddrop/fridgemagnets", "fridgemagnets", 10, -1}, + {"draganddrop/puzzle Example", "draganddrop/puzzle", "puzzle", 10, -1}, + {"effects/blurpicker Example", "effects/blurpicker", "blurpicker", 10, -1}, + {"effects/customshader Example", "effects/customshader", "customshader", 10, -1}, + {"effects/fademessage Example", "effects/fademessage", "fademessage", 10, -1}, + {"effects/lighting Example", "effects/lighting", "lighting", 10, -1}, + {"graphicsview/anchorlayout Example", "graphicsview/anchorlayout", "anchorlayout", 10, -1}, + {"graphicsview/basicgraphicslayouts Example", "graphicsview/basicgraphicslayouts", "basicgraphicslayouts", 0, -1}, + {"graphicsview/collidingmice Example", "graphicsview/collidingmice", "collidingmice", 10, -1}, + {"graphicsview/diagramscene Example", "graphicsview/diagramscene", "diagramscene", 10, -1}, + {"graphicsview/dragdroprobot Example", "graphicsview/dragdroprobot", "dragdroprobot", 10, -1}, + {"graphicsview/elasticnodes Example", "graphicsview/elasticnodes", "elasticnodes", 10, -1}, + {"graphicsview/flowlayout Example", "graphicsview/flowlayout", "flowlayout", 10, -1}, + {"graphicsview/padnavigator Example", "graphicsview/padnavigator", "padnavigator", 0, -1}, + {"graphicsview/portedasteroids Example", "graphicsview/portedasteroids", "portedasteroids", 10, -1}, + {"graphicsview/portedcanvas Example", "graphicsview/portedcanvas", "portedcanvas", 10, -1}, + {"graphicsview/weatheranchorlayout Example", "graphicsview/weatheranchorlayout", "weatheranchorlayout", 10, -1}, + {"itemviews/addressbook Example", "itemviews/addressbook", "addressbook", 0, -1}, + {"itemviews/basicsortfiltermodel Example", "itemviews/basicsortfiltermodel", "basicsortfiltermodel", 10, -1}, + {"itemviews/chart Example", "itemviews/chart", "chart", 0, -1}, + {"itemviews/coloreditorfactory Example", "itemviews/coloreditorfactory", "coloreditorfactory", 10, -1}, + {"itemviews/combowidgetmapper Example", "itemviews/combowidgetmapper", "combowidgetmapper", 6, -1}, + {"itemviews/customsortfiltermodel Example", "itemviews/customsortfiltermodel", "customsortfiltermodel", 6, -1}, + {"itemviews/dirview Example", "itemviews/dirview", "dirview", 0, -1}, + {"itemviews/editabletreemodel Example", "itemviews/editabletreemodel", "editabletreemodel", 0, -1}, + {"itemviews/fetchmore Example", "itemviews/fetchmore", "fetchmore", 10, -1}, + {"itemviews/frozencolumn Example", "itemviews/frozencolumn", "frozencolumn", 10, -1}, + {"itemviews/pixelator Example", "itemviews/pixelator", "pixelator", 10, -1}, + {"itemviews/puzzle Example", "itemviews/puzzle", "puzzle", 10, -1}, + {"itemviews/simpledommodel Example", "itemviews/simpledommodel", "simpledommodel", 10, -1}, + {"itemviews/simpletreemodel Example", "itemviews/simpletreemodel", "simpletreemodel", 10, -1}, + {"itemviews/simplewidgetmapper Example", "itemviews/simplewidgetmapper", "simplewidgetmapper", 10, -1}, + {"itemviews/spinboxdelegate Example", "itemviews/spinboxdelegate", "spinboxdelegate", 0, -1}, + {"itemviews/stardelegate Example", "itemviews/stardelegate", "stardelegate", 10, -1}, + {"layouts/basiclayouts Example", "layouts/basiclayouts", "basiclayouts", 0, -1}, + {"layouts/borderlayout Example", "layouts/borderlayout", "borderlayout", 10, -1}, + {"layouts/dynamiclayouts Example", "layouts/dynamiclayouts", "dynamiclayouts", 10, -1}, + {"layouts/flowlayout Example", "layouts/flowlayout", "flowlayout", 10, -1}, + {"mainwindows/application Example", "mainwindows/application", "application", 6, -1}, + {"mainwindows/dockwidgets Example", "mainwindows/dockwidgets", "dockwidgets", 0, -1}, + {"mainwindows/mdi Example", "mainwindows/mdi", "mdi", 0, -1}, + {"mainwindows/menus Example", "mainwindows/menus", "menus", 10, -1}, + {"mainwindows/recentfiles Example", "mainwindows/recentfiles", "recentfiles", 10, -1}, + {"mainwindows/sdi Example", "mainwindows/sdi", "sdi", 10, -1}, + {"multitouch/dials Example", "multitouch/dials", "dials", 10, -1}, + {"multitouch/fingerpaint Example", "multitouch/fingerpaint", "fingerpaint", 10, -1}, + {"multitouch/knobs Example", "multitouch/knobs", "knobs", 10, -1}, + {"multitouch/pinchzoom Example", "multitouch/pinchzoom", "pinchzoom", 10, -1}, + {"opengl/2dpainting Example", "opengl/2dpainting", "2dpainting", 10, -1}, + {"opengl/grabber Example", "opengl/grabber", "grabber", 10, -1}, + {"opengl/hellogl Example", "opengl/hellogl", "hellogl", 10, -1}, + {"opengl/overpainting Example", "opengl/overpainting", "overpainting", 10, -1}, + {"opengl/samplebuffers Example", "opengl/samplebuffers", "samplebuffers", 10, -1}, + {"opengl/textures Example", "opengl/textures", "textures", 10, -1}, + {"painting/basicdrawing Example", "painting/basicdrawing", "basicdrawing", 10, -1}, + {"painting/concentriccircles Example", "painting/concentriccircles", "concentriccircles", 0, -1}, + {"painting/fontsampler Example", "painting/fontsampler", "fontsampler", 0, -1}, + {"painting/imagecomposition Example", "painting/imagecomposition", "imagecomposition", 10, -1}, + {"painting/painterpaths Example", "painting/painterpaths", "painterpaths", 10, -1}, + {"painting/svggenerator Example", "painting/svggenerator", "svggenerator", 10, -1}, + {"painting/svgviewer Example", "painting/svgviewer", "svgviewer", 0, -1}, + {"painting/transformations Example", "painting/transformations", "transformations", 0, -1}, + {"qtconcurrent/imagescaling Example", "qtconcurrent/imagescaling", "imagescaling", 10, -1}, + {"richtext/calendar Example", "richtext/calendar", "calendar", 0, -1}, + {"richtext/orderform Example", "richtext/orderform", "orderform", 10, -1}, + {"richtext/syntaxhighlighter Example", "richtext/syntaxhighlighter", "syntaxhighlighter", 0, -1}, + {"richtext/textobject Example", "richtext/textobject", "textobject", 10, -1}, + {"script/calculator Example", "script/calculator", "calculator", 6, -1}, + {"script/qstetrix Example", "script/qstetrix", "qstetrix", 0, -1}, + {"statemachine/eventtransitions Example", "statemachine/eventtransitions", "eventtransitions", 10, -1}, + {"statemachine/rogue Example", "statemachine/rogue", "rogue", 10, -1}, + {"statemachine/trafficlight Example", "statemachine/trafficlight", "trafficlight", 0, -1}, + {"statemachine/twowaybutton Example", "statemachine/twowaybutton", "twowaybutton", 10, -1}, + {"tutorials/addressbook/part7 Example", "tutorials/addressbook/part7", "part7", 0, -1}, + {"webkit/fancybrowser Example", "webkit/fancybrowser", "fancybrowser", 0, 7000}, + {"widgets/analogclock Example", "widgets/analogclock", "analogclock", 6, -1}, + {"widgets/calculator Example", "widgets/calculator", "calculator", 6, -1}, + {"widgets/calendarwidget Example", "widgets/calendarwidget", "calendarwidget", 10, -1}, + {"widgets/charactermap Example", "widgets/charactermap", "charactermap", 10, -1}, + {"widgets/codeeditor Example", "widgets/codeeditor", "codeeditor", 0, -1}, + {"widgets/digitalclock Example", "widgets/digitalclock", "digitalclock", 10, -1}, + {"widgets/groupbox Example", "widgets/groupbox", "groupbox", 10, -1}, + {"widgets/icons Example", "widgets/icons", "icons", 10, -1}, + {"widgets/imageviewer Example", "widgets/imageviewer", "imageviewer", 10, -1}, + {"widgets/lineedits Example", "widgets/lineedits", "lineedits", 10, -1}, + {"widgets/scribble Example", "widgets/scribble", "scribble", 10, -1}, + {"widgets/sliders Example", "widgets/sliders", "sliders", 10, -1}, + {"widgets/spinboxes Example", "widgets/spinboxes", "spinboxes", 10, -1}, + {"widgets/styles Example", "widgets/styles", "styles", 0, -1}, + {"widgets/stylesheet Example", "widgets/stylesheet", "stylesheet", 0, -1}, + {"widgets/tablet Example", "widgets/tablet", "tablet", 10, -1}, + {"widgets/tetrix Example", "widgets/tetrix", "tetrix", 0, -1}, + {"widgets/tooltips Example", "widgets/tooltips", "tooltips", 10, -1}, + {"widgets/validators Example", "widgets/validators", "validators", 10, -1}, + {"widgets/wiggly Example", "widgets/wiggly", "wiggly", 10, -1} +}; + +const struct Example demos[] = { + {"Affine Demo", "affine", "affine", 0, -1}, + {"Books Demo", "books", "books", 0, -1}, + {"Browser Demo", "browser", "browser", 0, 0000}, + {"Chip Demo", "chip", "chip", 0, -1}, + {"Composition Demo", "composition", "composition", 0, -1}, + {"Deform Demo", "deform", "deform", 0, -1}, + {"Embeddeddialogs Demo", "embeddeddialogs", "embeddeddialogs", 0, -1}, + {"Gradients Demo", "gradients", "gradients", 0, -1}, + {"Interview Demo", "interview", "interview", 0, -1}, + {"Mainwindow Demo", "mainwindow", "mainwindow", 0, -1}, + {"PathStroke Demo", "pathstroke", "pathstroke", 0, -1}, + {"Spreadsheet Demo", "spreadsheet", "spreadsheet", 0, -1}, + {"Sub-Attac Demo", "sub-attaq", "sub-attaq", 0, -1}, + {"TextEdit Demo", "textedit", "textedit", 0, -1}, + {"Undo Demo", "undo", "undo", 0, -1} +}; + +// Data struct used in tests, specifying paths and timeouts +struct AppLaunchData { + AppLaunchData(); + void clear(); + + QString binary; + QStringList args; + QString workingDirectory; + int upTimeMS; + int topLevelWindowTimeoutMS; + int terminationTimeoutMS; + bool splashScreen; +}; + +AppLaunchData::AppLaunchData() : + upTimeMS(defaultUpTimeMS), + topLevelWindowTimeoutMS(defaultTopLevelWindowTimeoutMS), + terminationTimeoutMS(defaultTerminationTimeoutMS), + splashScreen(false) +{ +} + +void AppLaunchData::clear() +{ + binary.clear(); + args.clear(); + workingDirectory.clear(); + upTimeMS = defaultUpTimeMS; + topLevelWindowTimeoutMS = defaultTopLevelWindowTimeoutMS; + terminationTimeoutMS = defaultTerminationTimeoutMS; + splashScreen = false; +} + +Q_DECLARE_METATYPE(AppLaunchData) + + +class tst_GuiAppLauncher : public QObject +{ + Q_OBJECT + +public: + // Test name (static const char title!) + data + typedef QPair<const char*, AppLaunchData> TestDataEntry; + typedef QList<TestDataEntry> TestDataEntries; + + enum { TestTools = 0x1, TestDemo = 0x2, TestExamples = 0x4, + TestAll = TestTools|TestDemo|TestExamples }; + + tst_GuiAppLauncher(); + +private Q_SLOTS: + void initTestCase(); + + void run(); + void run_data(); + + void cleanupTestCase(); + +private: + QString workingDir() const; + +private: + bool runApp(const AppLaunchData &data, QString *errorMessage) const; + TestDataEntries testData() const; + + const unsigned m_testMask; + const unsigned m_examplePriority; + const QString m_dir; + const QSharedPointer<WindowManager> m_wm; +}; + +// Test mask from enviroment as test lib does not allow options. +static inline unsigned testMask() +{ + unsigned testMask = tst_GuiAppLauncher::TestAll; + if (!qgetenv("QT_TEST_NOTOOLS").isEmpty()) + testMask &= ~ tst_GuiAppLauncher::TestTools; + if (!qgetenv("QT_TEST_NOEXAMPLES").isEmpty()) + testMask &= ~tst_GuiAppLauncher::TestExamples; + if (!qgetenv("QT_TEST_NODEMOS").isEmpty()) + testMask &= ~tst_GuiAppLauncher::TestDemo; + return testMask; +} + +static inline unsigned testExamplePriority() +{ + const QByteArray priorityD = qgetenv("QT_TEST_EXAMPLE_PRIORITY"); + if (!priorityD.isEmpty()) { + bool ok; + const unsigned rc = priorityD.toUInt(&ok); + if (ok) + return rc; + } + return 5; +} + +tst_GuiAppLauncher::tst_GuiAppLauncher() : + m_testMask(testMask()), + m_examplePriority(testExamplePriority()), + m_dir(QLatin1String(SRCDIR)), + m_wm(WindowManager::create()) +{ +} + +void tst_GuiAppLauncher::initTestCase() +{ + QString message = QString::fromLatin1("### App Launcher test on %1 in %2 (%3)"). + arg(QDateTime::currentDateTime().toString(), QDir::currentPath()). + arg(QLibraryInfo::buildKey()); + qDebug("%s", qPrintable(message)); + qWarning("### PLEASE LEAVE THE MACHINE UNATTENDED WHILE THIS TEST IS RUNNING\n"); + + // Does a window manager exist on the platform? + if (!m_wm->openDisplay(&message)) { + QSKIP(message.toLatin1().constData(), SkipAll); + } + + // Paranoia: Do we have our test file? + const QDir workDir(m_dir); + if (!workDir.exists()) { + message = QString::fromLatin1("Invalid working directory %1").arg(m_dir); + QFAIL(message.toLocal8Bit().constData()); + } +} + +void tst_GuiAppLauncher::run() +{ + QString errorMessage; + QFETCH(AppLaunchData, data); + const bool rc = runApp(data, &errorMessage); + if (!rc) // Wait for windows to disappear after kill + WindowManager::sleepMS(500); + QVERIFY2(rc, qPrintable(errorMessage)); +} + +// Cross platform galore! +static inline QString guiBinary(QString in) +{ +#ifdef Q_OS_MAC + return in + QLatin1String(".app/Contents/MacOS/") + in; +#endif + in[0] = in.at(0).toLower(); +#ifdef Q_OS_WIN + in += QLatin1String(".exe"); +#endif + return in; +} + +void tst_GuiAppLauncher::run_data() +{ + QTest::addColumn<AppLaunchData>("data"); + foreach(const TestDataEntry &data, testData()) + QTest::newRow(data.first) << data.second; +} + +// Read out the examples array structures and convert to test data. +static tst_GuiAppLauncher::TestDataEntries exampleData(unsigned priority, + const QString &path, + bool debug, + const Example *exArray, + unsigned n) +{ + Q_UNUSED(debug) + tst_GuiAppLauncher::TestDataEntries rc; + const QChar slash = QLatin1Char('/'); + AppLaunchData data; + for (unsigned e = 0; e < n; e++) { + const Example &example = exArray[e]; + if (example.priority <= priority) { + data.clear(); + const QString examplePath = path + slash + QLatin1String(example.directory); + data.binary = examplePath + slash; +#ifdef Q_OS_WIN + data.binary += debug? QLatin1String("debug/") : QLatin1String("release/"); +#endif + data.binary += guiBinary(QLatin1String(example.binary)); + data.workingDirectory = examplePath; + if (example.upTimeMS > 0) + data.upTimeMS = example.upTimeMS; + rc.append(tst_GuiAppLauncher::TestDataEntry(example.name, data)); + } + } + return rc; +} + +tst_GuiAppLauncher::TestDataEntries tst_GuiAppLauncher::testData() const +{ + TestDataEntries rc; + const QChar slash = QLatin1Char('/'); + const QString binPath = QLibraryInfo::location(QLibraryInfo::BinariesPath) + slash; + const bool debug = QLibraryInfo::buildKey().contains(QLatin1String("debug")); + Q_UNUSED(debug) + + AppLaunchData data; + + if (m_testMask & TestTools) { + data.binary = binPath + guiBinary(QLatin1String("Designer")); + data.args.append(m_dir + QLatin1String("test.ui")); + rc.append(TestDataEntry("Qt Designer", data)); + + data.clear(); + data.binary = binPath + guiBinary(QLatin1String("Linguist")); + data.splashScreen = true; + data.upTimeMS = 5000; // Slow loading + data.args.append(m_dir + QLatin1String("test.ts")); + rc.append(TestDataEntry("Qt Linguist", data)); + } + + if (m_testMask & TestDemo) { + data.clear(); + data.upTimeMS = 5000; // Startup animation + data.binary = binPath + guiBinary(QLatin1String("qtdemo")); + rc.append(TestDataEntry("Qt Demo", data)); + + const QString demosPath = QLibraryInfo::location(QLibraryInfo::DemosPath); + if (!demosPath.isEmpty()) + rc += exampleData(m_examplePriority, demosPath, debug, demos, sizeof(demos)/sizeof(Example)); + } + + if (m_testMask & TestExamples) { + const QString examplesPath = QLibraryInfo::location(QLibraryInfo::ExamplesPath); + if (!examplesPath.isEmpty()) + rc += exampleData(m_examplePriority, examplesPath, debug, examples, sizeof(examples)/sizeof(Example)); + } + qDebug("Running %d tests...", rc.size()); + return rc; +} + +static inline void ensureTerminated(QProcess *p) +{ + if (p->state() != QProcess::Running) + return; + p->terminate(); + if (p->waitForFinished(300)) + return; + p->kill(); + if (!p->waitForFinished(500)) + qWarning("Unable to terminate process"); +} + +static const QStringList &stderrWhiteList() +{ + static QStringList rc; + if (rc.empty()) { + rc << QLatin1String("QPainter::begin: Paint device returned engine == 0, type: 2") + << QLatin1String("QPainter::setRenderHint: Painter must be active to set rendering hints") + << QLatin1String("QPainter::setPen: Painter not active") + << QLatin1String("QPainter::setBrush: Painter not active") + << QLatin1String("QPainter::end: Painter not active, aborted"); + } + return rc; +} + +bool tst_GuiAppLauncher::runApp(const AppLaunchData &data, QString *errorMessage) const +{ + qDebug("Launching: %s\n", qPrintable(data.binary)); + QProcess process; + process.setProcessChannelMode(QProcess::MergedChannels); + if (!data.workingDirectory.isEmpty()) + process.setWorkingDirectory(data.workingDirectory); + process.start(data.binary, data.args); + process.closeWriteChannel(); + if (!process.waitForStarted()) { + *errorMessage = QString::fromLatin1("Unable to execute %1: %2").arg(data.binary, process.errorString()); + return false; + } + // Get window id. + const QString winId = m_wm->waitForTopLevelWindow(data.splashScreen ? 2 : 1, process.pid(), data.topLevelWindowTimeoutMS, errorMessage); + if (winId.isEmpty()) { + ensureTerminated(&process); + return false; + } + qDebug("Window: %s\n", qPrintable(winId)); + // Wait a bit, then send close + WindowManager::sleepMS(data.upTimeMS); + if (m_wm->sendCloseEvent(winId, process.pid(), errorMessage)) { + qDebug("Sent close to window: %s\n", qPrintable(winId)); + } else { + ensureTerminated(&process); + return false; + } + // Terminate + if (!process.waitForFinished(data.terminationTimeoutMS)) { + *errorMessage = QString::fromLatin1("%1: Timeout %2ms").arg(data.binary).arg(data.terminationTimeoutMS); + ensureTerminated(&process); + return false; + } + if (process.exitStatus() != QProcess::NormalExit) { + *errorMessage = QString::fromLatin1("%1: Startup crash").arg(data.binary); + return false; + } + + const int exitCode = process.exitCode(); + // check stderr + const QStringList stderrOutput = QString::fromLocal8Bit(process.readAllStandardOutput()).split(QLatin1Char('\n')); + foreach(const QString &stderrLine, stderrOutput) { + // Skip expected QPainter warnings from oxygen. + if (stderrWhiteList().contains(stderrLine)) { + qWarning("%s: stderr: %s\n", qPrintable(data.binary), qPrintable(stderrLine)); + } else { + if (!stderrLine.isEmpty()) { // Split oddity gives empty messages + *errorMessage = QString::fromLatin1("%1: Unexpected output (ex=%2): '%3'").arg(data.binary).arg(exitCode).arg(stderrLine); + return false; + } + } + } + + if (exitCode != 0) { + *errorMessage = QString::fromLatin1("%1: Exit code %2").arg(data.binary).arg(exitCode); + return false; + } + return true; +} + +void tst_GuiAppLauncher::cleanupTestCase() +{ +} + +#if defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) +QTEST_NOOP_MAIN +#else +QTEST_APPLESS_MAIN(tst_GuiAppLauncher) +#endif + +#include "tst_guiapplauncher.moc" diff --git a/tests/auto/guiapplauncher/windowmanager.cpp b/tests/auto/guiapplauncher/windowmanager.cpp new file mode 100644 index 0000000..758a14e --- /dev/null +++ b/tests/auto/guiapplauncher/windowmanager.cpp @@ -0,0 +1,508 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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 "windowmanager.h" +#include <QtCore/QTime> +#include <QtCore/QThread> +#include <QtCore/QDebug> +#include <QtCore/QTextStream> + +#ifdef Q_WS_X11 +# include <string.h> // memset +# include <X11/Xlib.h> +# include <X11/Xatom.h> // XA_WM_STATE +# include <X11/Xutil.h> +# include <X11/Xmd.h> // CARD32 +#endif + +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +# include <windows.h> +#endif + +// Export the sleep function +class FriendlySleepyThread : public QThread { +public: + static void sleepMS(int milliSeconds) { msleep(milliSeconds); } +}; + +#ifdef Q_WS_X11 +// X11 Window manager + +// Register our own error handler to prevent the defult crashing +// behaviour. It simply counts errors in global variables that +// can be checked after calls. + +static unsigned x11ErrorCount = 0; +static const char *currentX11Function = 0; + +int xErrorHandler(Display *, XErrorEvent *e) +{ + x11ErrorCount++; + + QString msg; + QTextStream str(&msg); + str << "An X11 error (#" << x11ErrorCount<< ") occurred: "; + if (currentX11Function) + str << ' ' << currentX11Function << "()"; + str << " code: " << e->error_code; + str.setIntegerBase(16); + str << " resource: 0x" << e->resourceid; + qWarning("%s", qPrintable(msg)); + + return 0; +} + +static bool isMapped(Display *display, Atom xa_wm_state, Window window, bool *isMapped) +{ + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes_after; + unsigned char *prop; + + *isMapped = false; + currentX11Function = "XGetWindowProperty"; + const int retv = XGetWindowProperty(display, window, xa_wm_state, 0L, 1L, False, xa_wm_state, + &actual_type, &actual_format, &nitems, &bytes_after, &prop); + + if (retv != Success || actual_type == None || actual_type != xa_wm_state + || nitems != 1 || actual_format != 32) + return false; + + const CARD32 state = * reinterpret_cast<CARD32 *>(prop); + + switch ((int) state) { + case WithdrawnState: + *isMapped = false; + break; + case NormalState: + case IconicState: + *isMapped = true; + break; + default: + *isMapped = true; + break; + } + return true; +} + +// Wait until a X11 top level has been mapped, courtesy of xtoolwait. +static Window waitForTopLevelMapped(Display *display, unsigned count, int timeOutMS, QString * errorMessage) +{ + unsigned mappingsCount = count; + Atom xa_wm_state; + XEvent event; + + // Discard all pending events + currentX11Function = "XSync"; + XSync(display, True); + + // Listen for top level creation + currentX11Function = "XSelectInput"; + XSelectInput(display, DefaultRootWindow(display), SubstructureNotifyMask); + + /* We assume that the window manager provides the WM_STATE property on top-level + * windows, as required by ICCCM 2.0. + * If the window manager has not yet completed its initialisation, the WM_STATE atom + * might not exist, in which case we create it. */ + +#ifdef XA_WM_STATE /* probably in X11R7 */ + xa_wm_state = XA_WM_STATE; +#else + xa_wm_state = XInternAtom(display, "WM_STATE", False); +#endif + + QTime elapsedTime; + elapsedTime.start(); + while (mappingsCount) { + if (elapsedTime.elapsed() > timeOutMS) { + *errorMessage = QString::fromLatin1("X11: Timed out waiting for toplevel %1ms").arg(timeOutMS); + return 0; + } + currentX11Function = "XNextEvent"; + unsigned errorCount = x11ErrorCount; + XNextEvent(display, &event); + if (x11ErrorCount > errorCount) { + *errorMessage = QString::fromLatin1("X11: Error in XNextEvent"); + return 0; + } + switch (event.type) { + case CreateNotify: + // Window created, listen for its mapping now + if (!event.xcreatewindow.send_event && !event.xcreatewindow.override_redirect) + XSelectInput(display, event.xcreatewindow.window, PropertyChangeMask); + break; + case PropertyNotify: + // Watch for map + if (!event.xproperty.send_event && event.xproperty.atom == xa_wm_state) { + bool mapped; + if (isMapped(display, xa_wm_state, event.xproperty.window, &mapped)) { + if (mapped && --mappingsCount == 0) + return event.xproperty.window; + // Past splash screen, listen for next window to be created + XSelectInput(display, DefaultRootWindow(display), SubstructureNotifyMask); + } else { + // Some temporary window disappeared. Listen for next creation + XSelectInput(display, DefaultRootWindow(display), SubstructureNotifyMask); + } + // Main app window opened? + } + break; + default: + break; + } + } + *errorMessage = QString::fromLatin1("X11: Timed out waiting for toplevel %1ms").arg(timeOutMS); + return 0; +} + + +class X11_WindowManager : public WindowManager +{ +public: + X11_WindowManager(); + ~X11_WindowManager(); + +protected: + virtual bool isDisplayOpenImpl() const; + virtual bool openDisplayImpl(QString *errorMessage); + virtual QString waitForTopLevelWindowImpl(unsigned count, Q_PID, int timeOutMS, QString *errorMessage); + virtual bool sendCloseEventImpl(const QString &winId, Q_PID pid, QString *errorMessage); + +private: + Display *m_display; + const QByteArray m_displayVariable; + XErrorHandler m_oldErrorHandler; +}; + +X11_WindowManager::X11_WindowManager() : + m_display(0), + m_displayVariable(qgetenv("DISPLAY")), + m_oldErrorHandler(0) +{ +} + +X11_WindowManager::~X11_WindowManager() +{ + if (m_display) { + XSetErrorHandler(m_oldErrorHandler); + XCloseDisplay(m_display); + } +} + +bool X11_WindowManager::isDisplayOpenImpl() const +{ + return m_display != 0; +} + +bool X11_WindowManager::openDisplayImpl(QString *errorMessage) +{ + if (m_displayVariable.isEmpty()) { + *errorMessage = QLatin1String("X11: Display not set"); + return false; + } + m_display = XOpenDisplay(NULL); + if (!m_display) { + *errorMessage = QString::fromLatin1("X11: Cannot open display %1.").arg(QString::fromLocal8Bit(m_displayVariable)); + return false; + } + + m_oldErrorHandler = XSetErrorHandler(xErrorHandler); + return true; +} + +QString X11_WindowManager::waitForTopLevelWindowImpl(unsigned count, Q_PID, int timeOutMS, QString *errorMessage) +{ + const Window w = waitForTopLevelMapped(m_display, count, timeOutMS, errorMessage); + if (w == 0) + return QString(); + return QLatin1String("0x") + QString::number(w, 16); +} + + bool X11_WindowManager::sendCloseEventImpl(const QString &winId, Q_PID, QString *errorMessage) + { + // Get win id + bool ok; + const Window window = winId.toULong(&ok, 16); + if (!ok) { + *errorMessage = QString::fromLatin1("Invalid win id %1.").arg(winId); + return false; + } + // Send a window manager close event + XEvent ev; + memset(&ev, 0, sizeof (ev)); + ev.xclient.type = ClientMessage; + ev.xclient.window = window; + ev.xclient.message_type = XInternAtom(m_display, "WM_PROTOCOLS", true); + ev.xclient.format = 32; + ev.xclient.data.l[0] = XInternAtom(m_display, "WM_DELETE_WINDOW", false); + ev.xclient.data.l[1] = CurrentTime; + // Window disappeared or some error triggered? + unsigned errorCount = x11ErrorCount; + currentX11Function = "XSendEvent"; + XSendEvent(m_display, window, False, NoEventMask, &ev); + if (x11ErrorCount > errorCount) { + *errorMessage = QString::fromLatin1("Error sending event to win id %1.").arg(winId); + return false; + } + currentX11Function = "XSync"; + errorCount = x11ErrorCount; + XSync(m_display, False); + if (x11ErrorCount > errorCount) { + *errorMessage = QString::fromLatin1("Error sending event to win id %1 (XSync).").arg(winId); + return false; + } + return true; + } + +#endif + +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) +// Windows + + QString winErrorMessage(unsigned long error) +{ + QString rc = QString::fromLatin1("#%1: ").arg(error); + ushort *lpMsgBuf; + + const int len = FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, + NULL, error, 0, (LPTSTR)&lpMsgBuf, 0, NULL); + if (len) { + rc = QString::fromUtf16(lpMsgBuf, len); + LocalFree(lpMsgBuf); + } else { + rc += QString::fromLatin1("<unknown error>"); + } + return rc; +} + + class Win_WindowManager : public WindowManager + { + public: + Win_WindowManager() {} + + protected: + virtual bool isDisplayOpenImpl() const; + virtual bool openDisplayImpl(QString *errorMessage); + virtual QString waitForTopLevelWindowImpl(unsigned count, Q_PID, int timeOutMS, QString *errorMessage); + virtual bool sendCloseEventImpl(const QString &winId, Q_PID pid, QString *errorMessage); + + private: + }; + +bool Win_WindowManager::isDisplayOpenImpl() const +{ + return true; +} + +bool Win_WindowManager::openDisplayImpl(QString *) +{ + return true; +} + +// Enumerate window looking for toplevel of process id +struct FindProcessWindowEnumContext { + FindProcessWindowEnumContext(DWORD pid) : window(0),processId(pid) {} + + HWND window; + DWORD processId; +}; + +/* Check for the active main window of the Application + * of class QWidget. */ +static inline bool isQtMainWindow(HWND hwnd) +{ + static char buffer[MAX_PATH]; + if (!GetClassNameA(hwnd, buffer, MAX_PATH) || qstrcmp(buffer, "QWidget")) + return false; + WINDOWINFO windowInfo; + if (!GetWindowInfo(hwnd, &windowInfo)) + return false; + if (!(windowInfo.dwWindowStatus & WS_ACTIVECAPTION)) + return false; + // Check the style for a real mainwindow + const DWORD excluded = WS_DISABLED | WS_POPUP; + const DWORD required = WS_CAPTION | WS_SYSMENU | WS_VISIBLE; + return (windowInfo.dwStyle & excluded) == 0 + && (windowInfo.dwStyle & required) == required; +} + +static BOOL CALLBACK findProcessWindowEnumWindowProc(HWND hwnd, LPARAM lParam) +{ + DWORD processId = 0; + FindProcessWindowEnumContext *context= reinterpret_cast<FindProcessWindowEnumContext *>(lParam); + GetWindowThreadProcessId(hwnd, &processId); + if (context->processId == processId && isQtMainWindow(hwnd)) { + context->window = hwnd; + return FALSE; + } + return TRUE; +} + +QString Win_WindowManager::waitForTopLevelWindowImpl(unsigned /* count */, Q_PID pid, int timeOutMS, QString *errorMessage) +{ + QTime elapsed; + elapsed.start(); + // First, wait until the application is up + if (WaitForInputIdle(pid->hProcess, timeOutMS) != 0) { + *errorMessage = QString::fromLatin1("WaitForInputIdle time out after %1ms").arg(timeOutMS); + return QString(); + } + // Try to locate top level app window. App still might be in splash screen or initialization + // phase. + const int remainingMilliSeconds = qMax(timeOutMS - elapsed.elapsed(), 500); + const int attempts = 10; + const int intervalMilliSeconds = remainingMilliSeconds / attempts; + for (int a = 0; a < attempts; a++) { + FindProcessWindowEnumContext context(pid->dwProcessId); + EnumWindows(findProcessWindowEnumWindowProc, reinterpret_cast<LPARAM>(&context)); + if (context.window) + return QLatin1String("0x") + QString::number(reinterpret_cast<quintptr>(context.window), 16); + sleepMS(intervalMilliSeconds); + } + *errorMessage = QString::fromLatin1("Unable to find toplevel of process %1 after %2ms.").arg(pid->dwProcessId).arg(timeOutMS); + return QString(); +} + +bool Win_WindowManager::sendCloseEventImpl(const QString &winId, Q_PID, QString *errorMessage) +{ + // Convert window back. + quintptr winIdIntPtr; + QTextStream str(const_cast<QString*>(&winId), QIODevice::ReadOnly); + str.setIntegerBase(16); + str >> winIdIntPtr; + if (str.status() != QTextStream::Ok) { + *errorMessage = QString::fromLatin1("Invalid win id %1.").arg(winId); + return false; + } + if (!PostMessage(reinterpret_cast<HWND>(winIdIntPtr), WM_CLOSE, 0, 0)) { + *errorMessage = QString::fromLatin1("Cannot send event to 0x%1: %2").arg(winIdIntPtr, 0, 16).arg(winErrorMessage(GetLastError())); + return false; + } + return true; +} +#endif + +// ------- Default implementation + +WindowManager::WindowManager() +{ +} + +WindowManager::~WindowManager() +{ +} + +QSharedPointer<WindowManager> WindowManager::create() +{ +#ifdef Q_WS_X11 + return QSharedPointer<WindowManager>(new X11_WindowManager); +#endif +#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) + return QSharedPointer<WindowManager>(new Win_WindowManager); +#else + return QSharedPointer<WindowManager>(new WindowManager); +#endif +} + +static inline QString msgNoDisplayOpen() { return QLatin1String("No display opened."); } + +bool WindowManager::openDisplay(QString *errorMessage) +{ + if (isDisplayOpen()) + return true; + return openDisplayImpl(errorMessage); +} + +bool WindowManager::isDisplayOpen() const +{ + return isDisplayOpenImpl(); +} + + + +QString WindowManager::waitForTopLevelWindow(unsigned count, Q_PID pid, int timeOutMS, QString *errorMessage) +{ + if (!isDisplayOpen()) { + *errorMessage = msgNoDisplayOpen(); + return QString(); + } + return waitForTopLevelWindowImpl(count, pid, timeOutMS, errorMessage); +} + +bool WindowManager::sendCloseEvent(const QString &winId, Q_PID pid, QString *errorMessage) +{ + if (!isDisplayOpen()) { + *errorMessage = msgNoDisplayOpen(); + return false; + } + return sendCloseEventImpl(winId, pid, errorMessage); +} + +// Default Implementation +bool WindowManager::openDisplayImpl(QString *errorMessage) +{ + *errorMessage = QLatin1String("Not implemented."); + return false; +} + +bool WindowManager::isDisplayOpenImpl() const +{ + return false; +} + +QString WindowManager::waitForTopLevelWindowImpl(unsigned, Q_PID, int, QString *errorMessage) +{ + *errorMessage = QLatin1String("Not implemented."); + return QString(); +} + +bool WindowManager::sendCloseEventImpl(const QString &, Q_PID, QString *errorMessage) +{ + *errorMessage = QLatin1String("Not implemented."); + return false; +} + +void WindowManager::sleepMS(int milliSeconds) +{ + FriendlySleepyThread::sleepMS(milliSeconds); +} diff --git a/tests/auto/guiapplauncher/windowmanager.h b/tests/auto/guiapplauncher/windowmanager.h new file mode 100644 index 0000000..56e2eb9 --- /dev/null +++ b/tests/auto/guiapplauncher/windowmanager.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite 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 WINDOWMANAGER_H +#define WINDOWMANAGER_H + +#include <QtCore/QSharedPointer> +#include <QtCore/QString> +#include <QtCore/QProcess> + +/* WindowManager: Provides functions to retrieve the top level window of + * an application and send it a close event. */ + +class WindowManager +{ + Q_DISABLE_COPY(WindowManager) +public: + static QSharedPointer<WindowManager> create(); + + virtual ~WindowManager(); + + bool openDisplay(QString *errorMessage); + bool isDisplayOpen() const; + + // Count: Number of toplevels, 1 for normal apps, 2 for apps with a splash screen + QString waitForTopLevelWindow(unsigned count, Q_PID pid, int timeOutMS, QString *errorMessage); + bool sendCloseEvent(const QString &winId, Q_PID pid, QString *errorMessage); + + static void sleepMS(int milliSeconds); + +protected: + WindowManager(); + + virtual bool openDisplayImpl(QString *errorMessage); + virtual bool isDisplayOpenImpl() const; + virtual QString waitForTopLevelWindowImpl(unsigned count, Q_PID pid, int timeOutMS, QString *errorMessage); + virtual bool sendCloseEventImpl(const QString &winId, Q_PID pid, QString *errorMessage); +}; + +#endif // WINDOWMANAGER_H diff --git a/tests/auto/qfile/qfile.pro b/tests/auto/qfile/qfile.pro index f70f750..33fd2fd 100644 --- a/tests/auto/qfile/qfile.pro +++ b/tests/auto/qfile/qfile.pro @@ -5,5 +5,5 @@ wince*:{ SUBDIRS = test stdinprocess } -SUBDIRS += largefile +!symbian*:SUBDIRS += largefile diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 9269164..36ee22c 100644 --- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -1286,8 +1286,9 @@ void tst_QGraphicsProxyWidget::paintEvent() QGraphicsScene scene; QGraphicsView view(&scene); view.show(); + QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTest::qWait(70); + QTRY_VERIFY(view.isActiveWindow()); SubQGraphicsProxyWidget proxy; @@ -1298,14 +1299,14 @@ void tst_QGraphicsProxyWidget::paintEvent() w->show(); QTest::qWaitForWindowShown(w); QApplication::processEvents(); - QTest::qWait(100); + QTest::qWait(30); proxy.setWidget(w); scene.addItem(&proxy); //make sure we flush all the paint events - QTest::qWait(70); + QTest::qWait(30); QTRY_VERIFY(proxy.paintCount > 1); - QTest::qWait(110); + QTest::qWait(30); proxy.paintCount = 0; w->update(); @@ -2573,20 +2574,22 @@ void tst_QGraphicsProxyWidget::changingCursor_basic() proxy->setWidget(widget); proxy->show(); scene.addItem(proxy); + QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); QApplication::processEvents(); + QTRY_VERIFY(view.isActiveWindow()); // in QTest::mouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); sendMouseMove(view.viewport(), view.mapFromScene(proxy->mapToScene(proxy->boundingRect().center()))); - QTest::qWait(125); - QCOMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor); + QTest::qWait(12); + QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor); // out QTest::mouseMove(view.viewport(), QPoint(1, 1)); sendMouseMove(view.viewport(), QPoint(1, 1)); - QTest::qWait(125); - QCOMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor); + QTest::qWait(12); + QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor); #endif } @@ -2746,10 +2749,12 @@ void tst_QGraphicsProxyWidget::windowOpacity() widget->resize(100, 100); QGraphicsProxyWidget *proxy = scene.addWidget(widget); proxy->setCacheMode(QGraphicsItem::ItemCoordinateCache); + + QApplication::setActiveWindow(&view); view.show(); QTest::qWaitForWindowShown(&view); QApplication::sendPostedEvents(); - QTest::qWait(150); + QTRY_VERIFY(view.isActiveWindow()); qRegisterMetaType<QList<QRectF> >("QList<QRectF>"); QSignalSpy signalSpy(&scene, SIGNAL(changed(const QList<QRectF> &))); diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 9a561eb..a49c2c1 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -3983,20 +3983,28 @@ void tst_QGraphicsScene::isActive() QVERIFY(!scene1.isActive()); //it is hidden; QVERIFY(scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(scene2.hasFocus()); view1->show(); QVERIFY(scene1.isActive()); QVERIFY(scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(scene2.hasFocus()); view2->hide(); QVERIFY(scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); toplevel1.hide(); - QTest::qWait(12); + QTest::qWait(50); QTRY_VERIFY(!scene1.isActive()); QTRY_VERIFY(!scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); toplevel1.show(); QApplication::setActiveWindow(&toplevel1); @@ -4005,14 +4013,21 @@ void tst_QGraphicsScene::isActive() QTRY_VERIFY(scene1.isActive()); QTRY_VERIFY(!scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); view2->show(); QVERIFY(scene1.isActive()); QVERIFY(scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); } QVERIFY(!scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); + { QWidget toplevel2; @@ -4025,6 +4040,8 @@ void tst_QGraphicsScene::isActive() QVERIFY(!scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); toplevel2.show(); QApplication::setActiveWindow(&toplevel2); @@ -4033,66 +4050,89 @@ void tst_QGraphicsScene::isActive() QVERIFY(scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); view2->setScene(&scene2); QVERIFY(scene1.isActive()); QVERIFY(scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); view1->setScene(&scene2); QVERIFY(!scene1.isActive()); QVERIFY(scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(scene2.hasFocus()); view1->hide(); QVERIFY(!scene1.isActive()); QVERIFY(scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(scene2.hasFocus()); view1->setScene(&scene1); QVERIFY(!scene1.isActive()); QVERIFY(scene2.isActive()); - - view1->show(); + QVERIFY(!scene1.hasFocus()); + QVERIFY(scene2.hasFocus()); view1->show(); QVERIFY(scene1.isActive()); QVERIFY(scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(scene2.hasFocus()); view2->hide(); QVERIFY(scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); QGraphicsView topLevelView; topLevelView.show(); QApplication::setActiveWindow(&topLevelView); + topLevelView.setFocus(); QTest::qWaitForWindowShown(&topLevelView); QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&topLevelView)); QVERIFY(!scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); topLevelView.setScene(&scene1); QVERIFY(scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); view2->show(); QVERIFY(scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); view1->hide(); QVERIFY(scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); QApplication::setActiveWindow(&toplevel2); QTRY_COMPARE(QApplication::activeWindow(), &toplevel2); QVERIFY(!scene1.isActive()); QVERIFY(scene2.isActive()); - - + QVERIFY(!scene1.hasFocus()); + QVERIFY(scene2.hasFocus()); } QVERIFY(!scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); { QWidget toplevel3; @@ -4104,6 +4144,9 @@ void tst_QGraphicsScene::isActive() QVERIFY(!scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); + toplevel3.show(); QApplication::setActiveWindow(&toplevel3); @@ -4112,23 +4155,30 @@ void tst_QGraphicsScene::isActive() QVERIFY(scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); layout->addWidget(view2); QApplication::processEvents(); QVERIFY(scene1.isActive()); QVERIFY(scene2.isActive()); + QVERIFY(scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); view1->setParent(0); QVERIFY(!scene1.isActive()); QVERIFY(scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(scene2.hasFocus()); delete view1; } QVERIFY(!scene1.isActive()); QVERIFY(!scene2.isActive()); + QVERIFY(!scene1.hasFocus()); + QVERIFY(!scene2.hasFocus()); } - QTEST_MAIN(tst_QGraphicsScene) #include "tst_qgraphicsscene.moc" diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index f07453c..1ff06c2 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -3600,6 +3600,7 @@ void tst_QGraphicsView::inputMethodSensitivity() item->setFlag(QGraphicsItem::ItemIsFocusable); scene.addItem(item); scene.setFocusItem(item); + QCOMPARE(scene.focusItem(), item); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); item->setFlag(QGraphicsItem::ItemAcceptsInputMethod, false); @@ -3614,27 +3615,35 @@ void tst_QGraphicsView::inputMethodSensitivity() scene.addItem(item2); scene.setFocusItem(item2); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + QCOMPARE(scene.focusItem(), item2); scene.setFocusItem(item); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + QCOMPARE(scene.focusItem(), item); view.setScene(0); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + QCOMPARE(scene.focusItem(), item); view.setScene(&scene); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + QCOMPARE(scene.focusItem(), item); scene.setFocusItem(item2); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + QCOMPARE(scene.focusItem(), item2); view.setScene(0); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + QCOMPARE(scene.focusItem(), item2); scene.setFocusItem(item); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), false); + QCOMPARE(scene.focusItem(), item); view.setScene(&scene); QCOMPARE(view.testAttribute(Qt::WA_InputMethodEnabled), true); + QCOMPARE(scene.focusItem(), item); } class InputContextTester : public QInputContext diff --git a/tests/auto/qlibrary/lib2/lib2.pro b/tests/auto/qlibrary/lib2/lib2.pro index 436d7ba..fc00af8 100644 --- a/tests/auto/qlibrary/lib2/lib2.pro +++ b/tests/auto/qlibrary/lib2/lib2.pro @@ -37,9 +37,9 @@ symbian-abld: { symbian-sbsv2: { TARGET.CAPABILITY=ALL -TCB QMAKE_POST_LINK = \ - $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dl2 && \ - $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/system.trolltech.test.mylib.dll && \ - if test $(PLATFORM) != WINSCW;then $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${PWD}/../tst/mylib.dl2; fi + $(GNUCP) $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dl2 && \ + $(GNUCP) $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/system.trolltech.test.mylib.dll && \ + if test $(PLATFORM) != WINSCW;then $(GNUCP) $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${PWD}/../tst/mylib.dl2; fi } #no special install rule for the library used by test diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index f12fa92..f0f69a4 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -101,11 +101,13 @@ private slots: void menuSizeHint(); void task258920_mouseBorder(); void setFixedWidth(); + void deleteActionInTriggered(); protected slots: void onActivated(QAction*); void onHighlighted(QAction*); void onStatusMessageChanged(const QString &); void onStatusTipTimer(); + void deleteAction(QAction *a) { delete a; } private: void createActions(); QMenu *menus[2], *lastMenu; @@ -858,6 +860,17 @@ void tst_QMenu::setFixedWidth() QCOMPARE(menu.sizeHint().width(), menu.minimumWidth()); } +void tst_QMenu::deleteActionInTriggered() +{ + // should not crash + QMenu m; + QObject::connect(&m, SIGNAL(triggered(QAction*)), this, SLOT(deleteAction(QAction*))); + QWeakPointer<QAction> a = m.addAction("action"); + a.data()->trigger(); + QVERIFY(!a); +} + + QTEST_MAIN(tst_QMenu) diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp index 1d54409..11e32b0 100644 --- a/tests/auto/qtextdocument/tst_qtextdocument.cpp +++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp @@ -2615,6 +2615,17 @@ void tst_QTextDocument::testUndoCommandAdded() cf.setFontItalic(true); cursor.mergeCharFormat(cf); QCOMPARE(spy.count(), 1); + + spy.clear(); + doc->undo(); + QCOMPARE(spy.count(), 0); + doc->undo(); + QCOMPARE(spy.count(), 0); + spy.clear(); + doc->redo(); + QCOMPARE(spy.count(), 0); + doc->redo(); + QCOMPARE(spy.count(), 0); } void tst_QTextDocument::testUndoBlocks() diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 58f059b..4fc6dd3 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -3653,7 +3653,9 @@ void tst_QTreeView::doubleClickedWithSpans() view.setModel(&model); view.setFirstColumnSpanned(0, QModelIndex(), true); view.show(); + QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.isActiveWindow()); QPoint p(10, 10); QCOMPARE(view.indexAt(p), model.index(0, 0)); diff --git a/tests/auto/uic/baseline/mainwindowbase.ui.h b/tests/auto/uic/baseline/mainwindowbase.ui.h index 46270a7..8472dbb 100644 --- a/tests/auto/uic/baseline/mainwindowbase.ui.h +++ b/tests/auto/uic/baseline/mainwindowbase.ui.h @@ -221,7 +221,6 @@ public: hboxLayout->setSpacing(4); hboxLayout->setContentsMargins(8, 8, 8, 8); hboxLayout->setObjectName(QString::fromUtf8("hboxLayout")); - hboxLayout->setContentsMargins(0, 0, 0, 0); helpview = new QTextEdit(widget); helpview->setObjectName(QString::fromUtf8("helpview")); helpview->setMinimumSize(QSize(200, 0)); diff --git a/tools/assistant/tools/assistant/main.cpp b/tools/assistant/tools/assistant/main.cpp index 12bc5b1..9568df0 100644 --- a/tools/assistant/tools/assistant/main.cpp +++ b/tools/assistant/tools/assistant/main.cpp @@ -189,6 +189,7 @@ QString indexFilesFolder(const QString &collectionFile) int main(int argc, char *argv[]) { +#ifndef Q_OS_WIN // First do a quick search for arguments that imply command-line mode. const char * cmdModeArgs[] = { "-help", "-register", "-unregister", "-remove-search-index" @@ -202,8 +203,10 @@ int main(int argc, char *argv[]) } } } - QApplication a(argc, argv, useGui); +#else + QApplication a(argc, argv); +#endif a.addLibraryPath(a.applicationDirPath() + QLatin1String("/plugins")); CmdLineParser cmd; diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 3cd25ae..cd3feec 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -3402,7 +3402,8 @@ void Configure::buildHostTools() QString pwd = QDir::currentPath(); QStringList hostToolsDirs; hostToolsDirs - << "src/tools"; + << "src/tools" + << "tools/linguist/lrelease"; if(dictionary["XQMAKESPEC"].startsWith("wince")) hostToolsDirs << "tools/checksdk"; diff --git a/tools/designer/src/lib/uilib/abstractformbuilder.cpp b/tools/designer/src/lib/uilib/abstractformbuilder.cpp index 24d2c01..eb3dc1c 100644 --- a/tools/designer/src/lib/uilib/abstractformbuilder.cpp +++ b/tools/designer/src/lib/uilib/abstractformbuilder.cpp @@ -285,23 +285,8 @@ void QAbstractFormBuilder::initialize(const DomUI *ui) if (!customWidgets.empty()) { QFormBuilderExtra *formBuilderPrivate = QFormBuilderExtra::instance(this); const DomCustomWidgetList::const_iterator cend = customWidgets.constEnd(); - for (DomCustomWidgetList::const_iterator it = customWidgets.constBegin(); it != cend; ++it) { - const DomCustomWidget *cw = *it; -#ifndef QT_FORMBUILDER_NO_SCRIPT - if (const DomScript *domScript = cw->elementScript()) { - const QString script = domScript->text(); - if (!script.isEmpty()) - formBuilderPrivate->storeCustomWidgetScript(cw->elementClass(), script); - } -#endif - const QString addPageMethod = cw->elementAddPageMethod(); - if (!addPageMethod.isEmpty()) - formBuilderPrivate->storeCustomWidgetAddPageMethod(cw->elementClass(), addPageMethod); - - const QString extends = cw->elementExtends(); - if (!extends.isEmpty()) - formBuilderPrivate->storeCustomWidgetBaseClass(cw->elementClass(), extends); - } + for (DomCustomWidgetList::const_iterator it = customWidgets.constBegin(); it != cend; ++it) + formBuilderPrivate->storeCustomWidgetData((*it)->elementClass(), *it); } } } diff --git a/tools/designer/src/lib/uilib/formbuilder.cpp b/tools/designer/src/lib/uilib/formbuilder.cpp index 0a722ba..2de8388 100644 --- a/tools/designer/src/lib/uilib/formbuilder.cpp +++ b/tools/designer/src/lib/uilib/formbuilder.cpp @@ -123,6 +123,8 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) QFormBuilderExtra *fb = QFormBuilderExtra::instance(this); if (!fb->parentWidgetIsSet()) fb->setParentWidget(parentWidget); + // Is this a QLayoutWidget with a margin of 0: Not a known page-based + // container and no method for adding pages registered. fb->setProcessingLayoutWidget(false); if (ui_widget->attributeClass() == QFormBuilderStrings::instance().qWidgetClass && !ui_widget->hasAttributeNative() && parentWidget @@ -147,8 +149,11 @@ QWidget *QFormBuilder::create(DomWidget *ui_widget, QWidget *parentWidget) #ifndef QT_NO_DOCKWIDGET && !qobject_cast<QDockWidget *>(parentWidget) #endif - ) - fb->setProcessingLayoutWidget(true); + ) { + const QString parentClassName = QLatin1String(parentWidget->metaObject()->className()); + if (!fb->isCustomWidgetContainer(parentClassName)) + fb->setProcessingLayoutWidget(true); + } return QAbstractFormBuilder::create(ui_widget, parentWidget); } diff --git a/tools/designer/src/lib/uilib/formbuilderextra.cpp b/tools/designer/src/lib/uilib/formbuilderextra.cpp index 0e803fb..ce71d59 100644 --- a/tools/designer/src/lib/uilib/formbuilderextra.cpp +++ b/tools/designer/src/lib/uilib/formbuilderextra.cpp @@ -65,6 +65,23 @@ void uiLibWarning(const QString &message) { qWarning("Designer: %s", qPrintable(message)); } + +QFormBuilderExtra::CustomWidgetData::CustomWidgetData() : + isContainer(false) +{ +} + +QFormBuilderExtra::CustomWidgetData::CustomWidgetData(const DomCustomWidget *dcw) : + addPageMethod(dcw->elementAddPageMethod()), + baseClass(dcw->elementExtends()), + isContainer(dcw->hasElementContainer() && dcw->elementContainer() != 0) +{ +#ifndef QT_FORMBUILDER_NO_SCRIPT + if (const DomScript *domScript = dcw->elementScript()) + script = domScript->text(); +#endif +} + QFormBuilderExtra::QFormBuilderExtra() : m_layoutWidget(false), m_resourceBuilder(0), @@ -85,8 +102,8 @@ void QFormBuilderExtra::clear() m_parentWidgetIsSet = false; #ifndef QT_FORMBUILDER_NO_SCRIPT m_FormScriptRunner.clearErrors(); - m_customWidgetScriptHash.clear(); #endif + m_customWidgetDataHash.clear(); m_buttonGroups.clear(); } @@ -160,45 +177,44 @@ QFormScriptRunner &QFormBuilderExtra::formScriptRunner() return m_FormScriptRunner; } -void QFormBuilderExtra::storeCustomWidgetScript(const QString &className, const QString &script) -{ - m_customWidgetScriptHash.insert(className, script); -} - QString QFormBuilderExtra::customWidgetScript(const QString &className) const { - const CustomWidgetScriptHash::const_iterator it = m_customWidgetScriptHash.constFind(className); - if ( it == m_customWidgetScriptHash.constEnd()) - return QString(); - return it.value(); + const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className); + if (it != m_customWidgetDataHash.constEnd()) + return it.value().script; + return QString(); } #endif -void QFormBuilderExtra::storeCustomWidgetBaseClass(const QString &className, const QString &baseClassName) +void QFormBuilderExtra::storeCustomWidgetData(const QString &className, const DomCustomWidget *d) { - m_customWidgetBaseClassHash.insert(className, baseClassName); + if (d) + m_customWidgetDataHash.insert(className, CustomWidgetData(d)); } QString QFormBuilderExtra::customWidgetBaseClass(const QString &className) const { - const QHash<QString, QString>::const_iterator it = m_customWidgetBaseClassHash.constFind(className); - if (it == m_customWidgetBaseClassHash.constEnd()) - return QString(); - return it.value(); + const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className); + if (it != m_customWidgetDataHash.constEnd()) + return it.value().baseClass; + return QString(); } -void QFormBuilderExtra::storeCustomWidgetAddPageMethod(const QString &className, const QString &ct) +QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) const { - m_customWidgetAddPageMethodHash.insert(className, ct); + const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className); + if (it != m_customWidgetDataHash.constEnd()) + return it.value().addPageMethod; + return QString(); } -QString QFormBuilderExtra::customWidgetAddPageMethod(const QString &className) const +bool QFormBuilderExtra::isCustomWidgetContainer(const QString &className) const { - const QHash<QString, QString>::const_iterator it = m_customWidgetAddPageMethodHash.constFind(className); - if (it == m_customWidgetAddPageMethodHash.constEnd()) - return QString(); - return it.value(); + const QHash<QString, CustomWidgetData>::const_iterator it = m_customWidgetDataHash.constFind(className); + if (it != m_customWidgetDataHash.constEnd()) + return it.value().isContainer; + return false; } namespace { diff --git a/tools/designer/src/lib/uilib/formbuilderextra_p.h b/tools/designer/src/lib/uilib/formbuilderextra_p.h index ce4d25b..3bcd1eb 100644 --- a/tools/designer/src/lib/uilib/formbuilderextra_p.h +++ b/tools/designer/src/lib/uilib/formbuilderextra_p.h @@ -82,6 +82,7 @@ namespace QFormInternal class DomButtonGroups; class DomButtonGroup; +class DomCustomWidget; class QAbstractFormBuilder; class QResourceBuilder; @@ -92,6 +93,16 @@ class QDESIGNER_UILIB_EXPORT QFormBuilderExtra QFormBuilderExtra(); ~QFormBuilderExtra(); public: + struct CustomWidgetData { + CustomWidgetData(); + explicit CustomWidgetData(const DomCustomWidget *dc); + + QString addPageMethod; + QString script; + QString baseClass; + bool isContainer; + }; + void clear(); bool applyPropertyInternally(QObject *o, const QString &propertyName, const QVariant &value); @@ -107,7 +118,6 @@ public: #ifndef QT_FORMBUILDER_NO_SCRIPT QFormScriptRunner &formScriptRunner(); - void storeCustomWidgetScript(const QString &className, const QString &script); QString customWidgetScript(const QString &className) const; #endif @@ -123,11 +133,10 @@ public: static QFormBuilderExtra *instance(const QAbstractFormBuilder *afb); static void removeInstance(const QAbstractFormBuilder *afb); - void storeCustomWidgetAddPageMethod(const QString &className, const QString &ct); + void storeCustomWidgetData(const QString &className, const DomCustomWidget *d); QString customWidgetAddPageMethod(const QString &className) const; - - void storeCustomWidgetBaseClass(const QString &className, const QString &baseClassName); QString customWidgetBaseClass(const QString &className) const; + bool isCustomWidgetContainer(const QString &className) const; // --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group void registerButtonGroups(const DomButtonGroups *groups); @@ -169,13 +178,9 @@ private: #ifndef QT_FORMBUILDER_NO_SCRIPT QFormScriptRunner m_FormScriptRunner; - - typedef QHash<QString, QString> CustomWidgetScriptHash; - CustomWidgetScriptHash m_customWidgetScriptHash; #endif - QHash<QString, QString> m_customWidgetAddPageMethodHash; - QHash<QString, QString> m_customWidgetBaseClassHash; + QHash<QString, CustomWidgetData> m_customWidgetDataHash; ButtonGroupHash m_buttonGroups; diff --git a/tools/linguist/lrelease/lrelease.pro b/tools/linguist/lrelease/lrelease.pro index 01091b3..e4c18ee 100644 --- a/tools/linguist/lrelease/lrelease.pro +++ b/tools/linguist/lrelease/lrelease.pro @@ -2,21 +2,14 @@ TEMPLATE = app TARGET = lrelease DESTDIR = ../../../bin -QT -= gui - -CONFIG += qt warn_on console -CONFIG -= app_bundle - -build_all:!build_pass { - CONFIG -= build_all - CONFIG += release -} - DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII SOURCES += main.cpp +include(../../../src/tools/bootstrap/bootstrap.pri) include(../shared/formats.pri) include(../shared/proparser.pri) +win32-msvc*:LIBS += advapi32.lib # for qsettings_win.cpp + target.path=$$[QT_INSTALL_BINS] INSTALLS += target diff --git a/tools/linguist/lrelease/main.cpp b/tools/linguist/lrelease/main.cpp index 742c2e6..c45459a 100644 --- a/tools/linguist/lrelease/main.cpp +++ b/tools/linguist/lrelease/main.cpp @@ -42,7 +42,10 @@ #include "translator.h" #include "proreader.h" +#ifndef QT_BOOTSTRAPPED #include <QtCore/QCoreApplication> +#include <QtCore/QTranslator> +#endif #include <QtCore/QDebug> #include <QtCore/QDir> #include <QtCore/QFile> @@ -51,7 +54,14 @@ #include <QtCore/QString> #include <QtCore/QStringList> #include <QtCore/QTextStream> -#include <QtCore/QTranslator> + +#ifdef QT_BOOTSTRAPPED +static void initBinaryDir( +#ifndef Q_OS_WIN + const char *argv0 +#endif + ); +#endif static void printOut(const QString & out) { @@ -157,11 +167,18 @@ static bool releaseTsFile(const QString& tsFileName, int main(int argc, char **argv) { +#ifdef QT_BOOTSTRAPPED + initBinaryDir( +#ifndef Q_OS_WIN + argv[0] +#endif + ); +#else QCoreApplication app(argc, argv); - QStringList args = app.arguments(); QTranslator translator; if (translator.load(QLatin1String("lrelease_") + QLocale::system().name())) app.installTranslator(&translator); +#endif ConversionData cd; cd.m_verbose = true; // the default is true starting with Qt 4.2 @@ -171,50 +188,50 @@ int main(int argc, char **argv) QString outputFile; for (int i = 1; i < argc; ++i) { - if (args[i] == QLatin1String("-compress")) { + if (!strcmp(argv[i], "-compress")) { cd.m_saveMode = SaveStripped; continue; - } else if (args[i] == QLatin1String("-idbased")) { + } else if (!strcmp(argv[i], "-idbased")) { cd.m_idBased = true; continue; - } else if (args[i] == QLatin1String("-nocompress")) { + } else if (!strcmp(argv[i], "-nocompress")) { cd.m_saveMode = SaveEverything; continue; - } else if (args[i] == QLatin1String("-removeidentical")) { + } else if (!strcmp(argv[i], "-removeidentical")) { removeIdentical = true; continue; - } else if (args[i] == QLatin1String("-nounfinished")) { + } else if (!strcmp(argv[i], "-nounfinished")) { cd.m_ignoreUnfinished = true; continue; - } else if (args[i] == QLatin1String("-markuntranslated")) { + } else if (!strcmp(argv[i], "-markuntranslated")) { if (i == argc - 1) { printUsage(); return 1; } - cd.m_unTrPrefix = args[++i]; - } else if (args[i] == QLatin1String("-silent")) { + cd.m_unTrPrefix = QString::fromLocal8Bit(argv[++i]); + } else if (!strcmp(argv[i], "-silent")) { cd.m_verbose = false; continue; - } else if (args[i] == QLatin1String("-verbose")) { + } else if (!strcmp(argv[i], "-verbose")) { cd.m_verbose = true; continue; - } else if (args[i] == QLatin1String("-version")) { + } else if (!strcmp(argv[i], "-version")) { printOut(QCoreApplication::tr( "lrelease version %1\n").arg(QLatin1String(QT_VERSION_STR)) ); return 0; - } else if (args[i] == QLatin1String("-qm")) { + } else if (!strcmp(argv[i], "-qm")) { if (i == argc - 1) { printUsage(); return 1; } - outputFile = args[++i]; - } else if (args[i] == QLatin1String("-help")) { + outputFile = QString::fromLocal8Bit(argv[++i]); + } else if (!strcmp(argv[i], "-help")) { printUsage(); return 0; - } else if (args[i].startsWith(QLatin1Char('-'))) { + } else if (argv[i][0] == '-') { printUsage(); return 1; } else { - inputFiles << args[i]; + inputFiles << QString::fromLocal8Bit(argv[i]); } } @@ -261,3 +278,79 @@ int main(int argc, char **argv) return 0; } + +#ifdef QT_BOOTSTRAPPED + +#ifdef Q_OS_WIN +# include <windows.h> +#endif + +static QString binDir; + +static void initBinaryDir( +#ifndef Q_OS_WIN + const char *_argv0 +#endif + ) +{ +#ifdef Q_OS_WIN + wchar_t module_name[MAX_PATH]; + GetModuleFileName(0, module_name, MAX_PATH); + QFileInfo filePath = QString::fromWCharArray(module_name); + binDir = filePath.filePath(); +#else + QString argv0 = QFile::decodeName(QByteArray(_argv0)); + QString absPath; + + if (!argv0.isEmpty() && argv0.at(0) == QLatin1Char('/')) { + /* + If argv0 starts with a slash, it is already an absolute + file path. + */ + absPath = argv0; + } else if (argv0.contains(QLatin1Char('/'))) { + /* + If argv0 contains one or more slashes, it is a file path + relative to the current directory. + */ + absPath = QDir::current().absoluteFilePath(argv0); + } else { + /* + Otherwise, the file path has to be determined using the + PATH environment variable. + */ + QByteArray pEnv = qgetenv("PATH"); + QDir currentDir = QDir::current(); + QStringList paths = QString::fromLocal8Bit(pEnv.constData()).split(QLatin1String(":")); + for (QStringList::const_iterator p = paths.constBegin(); p != paths.constEnd(); ++p) { + if ((*p).isEmpty()) + continue; + QString candidate = currentDir.absoluteFilePath(*p + QLatin1Char('/') + argv0); + QFileInfo candidate_fi(candidate); + if (candidate_fi.exists() && !candidate_fi.isDir()) { + binDir = candidate_fi.canonicalPath(); + return; + } + } + return; + } + + QFileInfo fi(absPath); + if (fi.exists()) + binDir = fi.canonicalPath(); +#endif +} + +QT_BEGIN_NAMESPACE + +// The name is hard-coded in QLibraryInfo +QString qmake_libraryInfoFile() +{ + if (binDir.isEmpty()) + return QString(); + return QDir(binDir).filePath(QString::fromLatin1("qt.conf")); +} + +QT_END_NAMESPACE + +#endif // QT_BOOTSTRAPPED diff --git a/tools/linguist/shared/proparserutils.h b/tools/linguist/shared/proparserutils.h index 9a83733..1ed3d6c 100644 --- a/tools/linguist/shared/proparserutils.h +++ b/tools/linguist/shared/proparserutils.h @@ -43,10 +43,35 @@ #define PROPARSERUTILS_H #include <QtCore/QDir> +#ifndef QT_BOOTSTRAPPED #include <QtCore/QLibraryInfo> +#endif QT_BEGIN_NAMESPACE +#ifdef QT_BOOTSTRAPPED +// this is a stripped down version of the one found in QtCore +class QLibraryInfo +{ +public: + enum LibraryLocation + { + PrefixPath, + DocumentationPath, + HeadersPath, + LibrariesPath, + BinariesPath, + PluginsPath, + DataPath, + TranslationsPath, + SettingsPath, + DemosPath, + ExamplesPath + }; + static QString location(LibraryLocation); +}; +#endif + // Pre- and postcondition macros #define PRE(cond) do {if (!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0) #define POST(cond) do {if (!(cond))qt_assert(#cond,__FILE__,__LINE__);} while (0) diff --git a/tools/linguist/shared/qm.cpp b/tools/linguist/shared/qm.cpp index 99aedef..e4c26bc 100644 --- a/tools/linguist/shared/qm.cpp +++ b/tools/linguist/shared/qm.cpp @@ -41,7 +41,9 @@ #include "translator.h" +#ifndef QT_BOOTSTRAPPED #include <QtCore/QCoreApplication> +#endif #include <QtCore/QDebug> #include <QtCore/QDir> #include <QtCore/QFile> diff --git a/tools/linguist/shared/translator.cpp b/tools/linguist/shared/translator.cpp index bc27daf..05fc6e5 100644 --- a/tools/linguist/shared/translator.cpp +++ b/tools/linguist/shared/translator.cpp @@ -56,6 +56,16 @@ QT_BEGIN_NAMESPACE +#ifdef QT_BOOTSTRAPPED +QString QObject::tr(const char *sourceText, const char *, int n) +{ + QString ret = QString::fromLatin1(sourceText); + if (n >= 0) + ret.replace(QLatin1String("%n"), QString::number(n)); + return ret; +} +#endif + Translator::Translator() : m_codecName("ISO-8859-1"), m_locationsType(AbsoluteLocations) diff --git a/tools/linguist/shared/translator.h b/tools/linguist/shared/translator.h index eec704a..f29317b 100644 --- a/tools/linguist/shared/translator.h +++ b/tools/linguist/shared/translator.h @@ -54,6 +54,18 @@ QT_BEGIN_NAMESPACE +#ifdef QT_BOOTSTRAPPED +struct QObject { + static QString tr(const char *sourceText, const char * = 0, int n = -1); +}; +struct QCoreApplication : public QObject { + enum Encoding { CodecForTr }; + static QString translate(const char *, const char *sourceText, const char * = 0, + Encoding = CodecForTr, int n = -1) + { return tr(sourceText, 0, n); } +}; +#endif + class QIODevice; // A struct of "interesting" data passed to and from the load and save routines diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index f0ddade..8711c6b 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -2300,7 +2300,8 @@ void HtmlGenerator::generateCompactList(const Node *relative, << " </b>"; } out() << "</td>\n"; - + + out() << "<td>"; if ((currentParagraphNo[i] < NumParagraphs) && !paragraphName[currentParagraphNo[i]].isEmpty()) { NodeMap::Iterator it; @@ -2308,7 +2309,6 @@ void HtmlGenerator::generateCompactList(const Node *relative, for (j = 0; j < currentOffsetInParagraph[i]; j++) ++it; - out() << "<td>"; // Previously, we used generateFullName() for this, but we // require some special formatting. out() << "<a href=\"" @@ -2322,8 +2322,8 @@ void HtmlGenerator::generateCompactList(const Node *relative, generateFullName(it.value()->parent(), relative, marker); out() << ")"; } - out() << "</td>\n"; - } + } + out() << "</td>\n"; currentOffset[i]++; currentOffsetInParagraph[i]++; @@ -4080,7 +4080,7 @@ void HtmlGenerator::generateMacRef(const Node *node, CodeMarker *marker) QStringList macRefs = marker->macRefsForNode(node); foreach (const QString &macRef, macRefs) - out() << "<a name=\"" << "//apple_ref/" << macRef << "\" />\n"; + out() << "<a name=\"" << "//apple_ref/" << macRef << "\"></a>\n"; } void HtmlGenerator::beginLink(const QString &link, diff --git a/translations/translations.pri b/translations/translations.pri index c77876a..5eb7328 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -8,13 +8,8 @@ defineReplace(prependAll) { return ($$result) } -defineReplace(fixPath) { - win32:1 ~= s|/|\\| - return ($$1) -} - -LUPDATE = $$fixPath($$QT_BUILD_TREE/bin/lupdate) -locations relative -no-ui-lines -LRELEASE = $$fixPath($$QT_BUILD_TREE/bin/lrelease) +LUPDATE = $$QT_BUILD_TREE/bin/lupdate -locations relative -no-ui-lines +win32:isEmpty(QMAKE_SH):LUPDATE ~= s|/|\\|g ###### Qt Libraries @@ -41,27 +36,18 @@ ts-qt.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ -ts $$prependAll($$QT_SOURCE_TREE/translations/qt_,$$QT_TS,.ts)) ts-qt.depends = sub-tools -qm-qt.commands = $$LRELEASE $$prependAll($$QT_SOURCE_TREE/translations/qt_,$$QT_TS,.ts) -qm-qt.depends = sub-tools - ###### Designer ts-designer.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/designer/translations/translations.pro) ts-designer.depends = sub-tools -qm-designer.commands = $$LRELEASE $$QT_SOURCE_TREE/tools/designer/translations/translations.pro -qm-designer.depends = sub-tools - ###### Linguist ts-linguist.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/linguist/linguist/linguist.pro) ts-linguist.depends = sub-tools -qm-linguist.commands = $$LRELEASE $$QT_SOURCE_TREE/tools/linguist/linguist/linguist.pro -qm-linguist.depends = sub-tools - ###### Assistant ts-assistant.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ @@ -72,36 +58,21 @@ ts-assistant.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/assistant/translations/translations_adp.pro) ts-assistant.depends = sub-tools -qm-assistant.commands = ($$LRELEASE $$QT_SOURCE_TREE/tools/assistant/translations/translations.pro \ - && $$LRELEASE \ - $$QT_SOURCE_TREE/tools/assistant/translations/qt_help.pro \ - && $$LRELEASE \ - $$QT_SOURCE_TREE/tools/assistant/translations/translations_adp.pro) -qm-assistant.depends = sub-tools - ###### Qtconfig ts-qtconfig.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/qtconfig/translations/translations.pro) ts-qtconfig.depends = sub-tools -qm-qtconfig.commands = $$LRELEASE $$QT_SOURCE_TREE/tools/qtconfig/translations/translations.pro -qm-qtconfig.depends = sub-tools - ###### Qvfp ts-qvfb.commands = (cd $$QT_SOURCE_TREE/src && $$LUPDATE \ ../tools/qvfb/translations/translations.pro) ts-qvfb.depends = sub-tools -qm-qvfb.commands = $$LRELEASE $$QT_SOURCE_TREE/tools/qvfb/translations/translations.pro -qm-qvfb.depends = sub-tools - ###### Overall Rules ts.depends = ts-qt ts-designer ts-linguist ts-assistant ts-qtconfig ts-qvfb -qm.depends = qm-qt qm-designer qm-linguist qm-assistant qm-qtconfig qm-qvfb QMAKE_EXTRA_TARGETS += ts-qt ts-designer ts-linguist ts-assistant ts-qtconfig ts-qvfb \ - qm-qt qm-designer qm-linguist qm-assistant qm-qtconfig qm-qvfb \ - ts qm + ts diff --git a/translations/translations.pro b/translations/translations.pro new file mode 100644 index 0000000..60f84e6 --- /dev/null +++ b/translations/translations.pro @@ -0,0 +1,42 @@ +TRANSLATIONS = $$files(*.ts) + +LRELEASE = $$QT_BUILD_TREE/bin/lrelease +win32:isEmpty(QMAKE_SH):LRELEASE ~= s|/|\\|g + +contains(TEMPLATE_PREFIX, vc):vcproj = 1 + +TEMPLATE = app +TARGET = qm_phony_target +CONFIG -= qt separate_debug_info +QT = +LIBS = + +updateqm.input = TRANSLATIONS +updateqm.output = ${QMAKE_FILE_BASE}.qm +isEmpty(vcproj):updateqm.variable_out = PRE_TARGETDEPS +updateqm.commands = @echo lrelease ${QMAKE_FILE_IN}; $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT} +updateqm.name = LRELEASE ${QMAKE_FILE_IN} +updateqm.CONFIG += no_link +QMAKE_EXTRA_COMPILERS += updateqm + +isEmpty(vcproj) { + QMAKE_LINK = @: IGNORE THIS LINE + OBJECTS_DIR = + win32:CONFIG -= embed_manifest_exe +} else { + CONFIG += console + PHONY_DEPS = . + phony_src.input = PHONY_DEPS + phony_src.output = phony.c + phony_src.variable_out = GENERATED_SOURCES + phony_src.commands = echo int main() { return 0; } > phony.c + phony_src.name = CREATE phony.c + phony_src.CONFIG += combine + QMAKE_EXTRA_COMPILERS += phony_src +} + +translations.path = $$[QT_INSTALL_TRANSLATIONS] +translations.files = $$TRANSLATIONS +translations.files ~= s,\\.ts$,.qm,g +translations.CONFIG += no_check_exist +INSTALLS += translations |