diff options
162 files changed, 2858 insertions, 1353 deletions
@@ -617,7 +617,7 @@ fi unset QTDIR # the minimum version of libdbus-1 that we require: -MIN_DBUS_1_VERSION=0.62 +MIN_DBUS_1_VERSION=0.93 # initalize internal variables CFG_CONFIGURE_EXIT_ON_ERROR=yes @@ -7612,6 +7612,7 @@ for file in .projects .projects.3; do case $a in *winmain/winmain.pro) continue ;; *s60main/s60main.pro) continue ;; + *examples/activeqt/*) continue ;; */qmake/qmake.pro) continue ;; *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*) SPEC=$QMAKESPEC ;; *) SPEC=$XQMAKESPEC ;; diff --git a/configure.exe b/configure.exe Binary files differindex aa254f3..838889c 100755 --- a/configure.exe +++ b/configure.exe diff --git a/demos/browser/webview.cpp b/demos/browser/webview.cpp index e1d9b12..754fedc 100644 --- a/demos/browser/webview.cpp +++ b/demos/browser/webview.cpp @@ -151,6 +151,8 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) QFile file(QLatin1String(":/notfound.html")); bool isOpened = file.open(QIODevice::ReadOnly); Q_ASSERT(isOpened); + Q_UNUSED(isOpened) + QString title = tr("Error loading page: %1").arg(reply->url().toString()); QString html = QString(QLatin1String(file.readAll())) .arg(title) diff --git a/demos/mediaplayer/mediaplayer.pro b/demos/mediaplayer/mediaplayer.pro index 84293f2..a420cc3 100644 --- a/demos/mediaplayer/mediaplayer.pro +++ b/demos/mediaplayer/mediaplayer.pro @@ -28,8 +28,7 @@ DEPLOYMENT_PLUGIN += phonon_ds9 phonon_waveout symbian { TARGET.UID3 = 0xA000C613 - addFiles.sources = ../../tests/auto/mediaobject/media/sax.mp3 - + addFiles.sources = ../embedded/desktopservices/data/sax.mp3 addFiles.path = /data/sounds/ DEPLOYMENT += addFiles diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp index 812eadf..e29095e 100644 --- a/demos/sub-attaq/graphicsscene.cpp +++ b/demos/sub-attaq/graphicsscene.cpp @@ -129,7 +129,7 @@ void GraphicsScene::setupScene(QAction *newAction, QAction *quitAction) { static const int nLetters = 10; static struct { - char *pix; + char const *pix; qreal initX, initY; qreal destX, destY; } logoData[nLetters] = { diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 2e7e699..cd9f130 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -19,6 +19,9 @@ information about a particular change. * General * **************************************************************************** + - QtDBus + * The minimum required version of the D-Bus reference library is + now 0.93. **************************************************************************** @@ -133,4 +136,4 @@ information about a particular change. for all floating point numbers, and this can be changed using the new function setFloatingPointPrecision(). Set Qt_4_5 as the version of the QDataStream to get the behavior of previous versions. -
\ No newline at end of file + diff --git a/doc/src/platforms/s60-introduction.qdoc b/doc/src/platforms/s60-introduction.qdoc index 9f7448d..d145a82 100644 --- a/doc/src/platforms/s60-introduction.qdoc +++ b/doc/src/platforms/s60-introduction.qdoc @@ -122,8 +122,8 @@ build targets, as shown in the table below: \row \o \c QT_SIS_OPTIONS \o Options accepted by \c .sis creation. -i, install the package right away using PC suite. -c=<file>, read certificate information from a file. - Execute \c{createpackage.pl} script without any - parameters for more information about options. + Execute \c{perl createpackage.pl} for more information + about options. By default no otions are given. \row \o \c QT_SIS_TARGET \o Target for which \c .sis file is created. Accepted values are build targets listed in diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 6224cd4..38f346f 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -661,10 +661,9 @@ See the \l{QtMultimedia Module} documentation for more information. - \section1 Classes, functions, and other items introduced in 4.6 + \section1 Classes, functions, etc new in 4.6 - Links to classes, function, and other items that were added in - 4.6. + Links to classes, functions, and other items that are new in 4.6. \sincelist 4.6 diff --git a/examples/dialogs/standarddialogs/dialog.cpp b/examples/dialogs/standarddialogs/dialog.cpp index c29d2dd..6e06190 100644 --- a/examples/dialogs/standarddialogs/dialog.cpp +++ b/examples/dialogs/standarddialogs/dialog.cpp @@ -150,11 +150,6 @@ Dialog::Dialog(QWidget *parent) native = new QCheckBox(this); native->setText("Use native file dialog."); native->setChecked(true); -#ifndef Q_WS_WIN -#ifndef Q_OS_MAC - native->hide(); -#endif -#endif QGridLayout *layout = new QGridLayout; layout->setColumnStretch(1, 1); layout->setColumnMinimumWidth(1, 250); diff --git a/examples/richtext/textobject/svgtextobject.cpp b/examples/richtext/textobject/svgtextobject.cpp index f5810b6..cf0b0ba 100644 --- a/examples/richtext/textobject/svgtextobject.cpp +++ b/examples/richtext/textobject/svgtextobject.cpp @@ -46,7 +46,7 @@ #include "window.h" //![0] -QSizeF SvgTextObject::intrinsicSize(QTextDocument *doc, int posInDocument, +QSizeF SvgTextObject::intrinsicSize(QTextDocument * /*doc*/, int /*posInDocument*/, const QTextFormat &format) { QImage bufferedImage = qVariantValue<QImage>(format.property(Window::SvgData)); @@ -61,7 +61,7 @@ QSizeF SvgTextObject::intrinsicSize(QTextDocument *doc, int posInDocument, //![1] void SvgTextObject::drawObject(QPainter *painter, const QRectF &rect, - QTextDocument *doc, int posInDocument, + QTextDocument * /*doc*/, int /*posInDocument*/, const QTextFormat &format) { QImage bufferedImage = qVariantValue<QImage>(format.property(Window::SvgData)); diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index 2adfa20..a3293b8 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -56,7 +56,7 @@ MainWindow::MainWindow() file.close(); //! [1] - QNetworkProxyFactory::setUseSystemConfigurationEnabled(true); + QNetworkProxyFactory::setUseSystemConfiguration(true); //! [2] view = new QWebView(this); diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp index fd08114..6b5e11f 100644 --- a/examples/webkit/googlechat/main.cpp +++ b/examples/webkit/googlechat/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char * argv[]) { QApplication app(argc, argv); - QNetworkProxyFactory::setUseSystemConfigurationEnabled(true); + QNetworkProxyFactory::setUseSystemConfiguration(true); GoogleChat *chat = new GoogleChat; chat->show(); diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 243a829..6322233 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -50,7 +50,7 @@ defineTest(qtAddLibrary) { INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE } isEmpty(LINKAGE) { - CONFIG(debug, debug|release) { + if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { win32:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}d mac:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}_debug } diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp index 58e2f5e..5a00f60 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.cpp +++ b/src/3rdparty/phonon/mmf/audiooutput.cpp @@ -18,6 +18,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <e32debug.h> +#include <QCoreApplication> + #include "audiooutput.h" #include "defs.h" #include "mediaobject.h" @@ -74,16 +76,13 @@ void MMF::AudioOutput::setVolume(qreal volume) int MMF::AudioOutput::outputDevice() const { - return 0; -} - -bool MMF::AudioOutput::setOutputDevice(int) -{ - return true; + return AudioOutputDeviceID; } -bool MMF::AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice &) +bool MMF::AudioOutput::setOutputDevice(int index) { + Q_ASSERT_X(index == AudioOutputDeviceID, Q_FUNC_INFO, + "We only support one output device, with id 0"); return true; } @@ -101,4 +100,17 @@ bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo) return true; } +QHash<QByteArray, QVariant> MMF::AudioOutput::audioOutputDescription(int index) +{ + if (index == AudioOutputDeviceID) { + QHash<QByteArray, QVariant> retval; + + retval.insert("name", QCoreApplication::translate("Phonon::MMF", "Audio Output")); + retval.insert("description", QCoreApplication::translate("Phonon::MMF", "The audio output device")); + retval.insert("available", true); + + return retval; + } +} + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h index 0a962a9..d0ba086 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.h +++ b/src/3rdparty/phonon/mmf/audiooutput.h @@ -19,6 +19,8 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #ifndef PHONON_MMF_AUDIOOUTPUT_H #define PHONON_MMF_AUDIOOUTPUT_H +#include <QHash> + #include "mmf_medianode.h" #include <phonon/audiooutputinterface.h> @@ -65,10 +67,12 @@ public: */ virtual bool setOutputDevice(int); - /** - * Has no effect. - */ - virtual bool setOutputDevice(const Phonon::AudioOutputDevice &); + static QHash<QByteArray, QVariant> audioOutputDescription(int index); + + enum Constants + { + AudioOutputDeviceID = 0 + }; protected: virtual bool activateOnMediaObject(MediaObject *mo); @@ -78,6 +82,7 @@ Q_SIGNALS: void audioDeviceFailed(); private: + void setVolumeObserver(VolumeObserver* observer); qreal m_volume; diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index 6c1fc68..ceaf305 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -34,14 +34,13 @@ using namespace Phonon::MMF; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::AudioPlayer::AudioPlayer() : m_player(0) +MMF::AudioPlayer::AudioPlayer() { construct(); } MMF::AudioPlayer::AudioPlayer(const AbstractPlayer& player) : AbstractMediaPlayer(player) - , m_player(0) { construct(); } @@ -51,7 +50,7 @@ void MMF::AudioPlayer::construct() TRACE_CONTEXT(AudioPlayer::AudioPlayer, EAudioApi); TRACE_ENTRY_0(); - TRAPD(err, m_player = CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone)); + TRAPD(err, m_player.reset(CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone))); if (KErrNone != err) { changeState(ErrorState); } @@ -64,8 +63,6 @@ MMF::AudioPlayer::~AudioPlayer() TRACE_CONTEXT(AudioPlayer::~AudioPlayer, EAudioApi); TRACE_ENTRY_0(); - delete m_player; - TRACE_EXIT_0(); } @@ -237,7 +234,7 @@ void MMF::AudioPlayer::MapcPlayComplete(TInt aError) CPlayerType *MMF::AudioPlayer::player() const { - return m_player; + return m_player.data(); } diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h index f16de1d..60ef436 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.h +++ b/src/3rdparty/phonon/mmf/audioplayer.h @@ -86,6 +86,9 @@ public: virtual void MapcPlayComplete(TInt aError); #endif + /** + * This class owns the pointer. + */ CPlayerType *player() const; private: @@ -96,7 +99,7 @@ private: * Using CPlayerType typedef in order to be able to easily switch between * CMdaAudioPlayerUtility and CDrmPlayerUtility */ - CPlayerType* m_player; + QScopedPointer<CPlayerType> m_player; }; } } diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index be43f46..f542ec9 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -107,6 +107,12 @@ QList<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const { case EffectType: retval.append(EffectFactory::effectIndexes()); + break; + case AudioOutputDeviceType: + // We only have one possible output device, but we need at least + // one. + retval.append(AudioOutput::AudioOutputDeviceID); + break; default: ; } @@ -119,10 +125,14 @@ QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescripti { TRACE_CONTEXT(Backend::connectNodes, EBackend); - if (type == EffectType) - return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); - else - return QHash<QByteArray, QVariant>(); + switch (type) { + case EffectType: + return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); + case AudioOutputDeviceType: + return AudioOutput::audioOutputDescription(index); + default: + return QHash<QByteArray, QVariant>(); + } } bool Backend::startConnectionChange(QSet<QObject *>) diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h index ba3cb42..a3c72b2 100644 --- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h +++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h @@ -139,6 +139,21 @@ namespace Phonon ObjectDescriptionModelDataPrivate *const d; }; +/* Required to ensure template class vtables are exported on both symbian +and existing builds. */ +#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) +// RVCT compiler (2.2.686) requires the export declaration to be on the class to export vtables +// MWC compiler works both ways +// GCCE compiler is unknown (it can't compile QtCore yet) +#define PHONON_TEMPLATE_CLASS_EXPORT PHONON_EXPORT +#define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT +#else +// Windows builds (at least) do not support export declaration on templated class +// But if you export a member function, the vtable is implicitly exported +#define PHONON_TEMPLATE_CLASS_EXPORT +#define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT PHONON_EXPORT +#endif + /** \class ObjectDescriptionModel objectdescriptionmodel.h Phonon/ObjectDescriptionModel * \short The ObjectDescriptionModel class provides a model from * a list of ObjectDescription objects. @@ -175,7 +190,7 @@ namespace Phonon * \author Matthias Kretz <kretz@kde.org> */ template<ObjectDescriptionType type> - class ObjectDescriptionModel : public QAbstractListModel + class PHONON_TEMPLATE_CLASS_EXPORT ObjectDescriptionModel : public QAbstractListModel { public: Q_OBJECT_CHECK @@ -188,11 +203,11 @@ namespace Phonon */ #if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4 /** \internal */ - static PHONON_EXPORT const QMetaObject staticMetaObject; + static PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject staticMetaObject; /** \internal */ - PHONON_EXPORT const QMetaObject *metaObject() const; + PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject *metaObject() const; /** \internal */ - PHONON_EXPORT void *qt_metacast(const char *_clname); + PHONON_TEMPLATE_CLASS_MEMBER_EXPORT void *qt_metacast(const char *_clname); //int qt_metacall(QMetaObject::Call _c, int _id, void **_a); #endif diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index aacc3dc..4f7dd4f 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2009-10-07 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann. + + [Qt] Symbian SBSv2 .data segment adress fix + https://bugs.webkit.org/show_bug.cgi?id=30157 + + RO-section in qtwebkit.dll exceeds allocated space in SBSv2. Move RW-section + base address to start from 0x800000 instead of the toolchain default 0x400000 + + * WebCore.pro: + 2009-09-29 Dave Hyatt <hyatt@apple.com> Reviewed by Jon Honeycutt. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index bc22b7a..1c39bb8 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -13,6 +13,9 @@ symbian: { TARGET.UID3 = 0x200267C2 } +# RO-section in qtwebkit.dll exceeds allocated space in SBSv2. Move RW-section +# base address to start from 0x800000 instead of the toolchain default 0x400000. +symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000" include($$PWD/../WebKit.pri) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 3c5f89f..882f3d7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -198,7 +198,7 @@ QWebView::QWebView(QWidget *parent) { d = new QWebViewPrivate(this); -#if !defined(Q_WS_QWS) +#if !defined(Q_WS_QWS) && !defined(Q_OS_SYMBIAN) setAttribute(Qt::WA_InputMethodEnabled); #endif diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index fd2768c..99ddaa5 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,16 @@ +2009-10-06 Janne Koskinen <janne.p.koskinen@digia.com> + + Reviewed by Simon Hausmann. + + [Qt] don't enable input methods on Symbian by default. + https://bugs.webkit.org/show_bug.cgi?id=30117 + + If input methods are enabled Symbian FEP will be launched on every + pointer event making webpage navigation impossible with QWebView. + + * Api/qwebview.cpp: + (QWebView::QWebView): + 2009-10-01 Simon Hausmann <simon.hausmann@nokia.com> Reviewed by Tor Arne Vestbø. diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5cac107..b11cfb4 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1615,11 +1615,11 @@ Q_CORE_EXPORT_INLINE QDebug qCritical(); inline QNoDebug qDebug(); #endif -#define QT_NO_QDEBUG_MACRO if(1) {} else qDebug +#define QT_NO_QDEBUG_MACRO while (false) qDebug #ifdef QT_NO_DEBUG_OUTPUT # define qDebug QT_NO_QDEBUG_MACRO #endif -#define QT_NO_QWARNING_MACRO if(1) {} else qWarning +#define QT_NO_QWARNING_MACRO while (false) qWarning #ifdef QT_NO_WARNING_OUTPUT # define qWarning QT_NO_QWARNING_MACRO #endif diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 9d76dcc..4234a7e 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -71,8 +71,8 @@ Qt { Q_ENUMS(ArrowType ToolButtonStyle PenStyle PenCapStyle PenJoinStyle BrushStyle) Q_ENUMS(FillRule MaskMode BGMode ClipOperation SizeMode) Q_ENUMS(BackgroundMode) // Qt3 - Q_ENUMS(Axis Corner LayoutDirection SizeHint Orientation) - Q_FLAGS(Alignment Orientations) + Q_ENUMS(Axis Corner LayoutDirection SizeHint Orientation DropAction) + Q_FLAGS(Alignment Orientations DropActions) Q_FLAGS(DockWidgetAreas ToolBarAreas) Q_ENUMS(DockWidgetArea ToolBarArea) Q_ENUMS(TextFormat) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index b7775bd..ab232bf 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -713,7 +713,13 @@ \omitvalue Dither_Mask \omitvalue AlphaDither_Mask \omitvalue DitherMode_Mask - \omitvalue NoOpaqueDetection + + \value NoOpaqueDetection Do not check whether the image contains non-opaque + pixels. Use this if you know that the image is semi-transparent and + you want to avoid the overhead of checking the pixels in the image + until a non-opaque pixel is found, or if you want the pixmap to + retain an alpha channel for some other reason. If the image has no + alpha channel this flag has no effect. */ /*! \enum Qt::GUIStyle diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 5a0afb8..5d206ed 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -939,7 +939,7 @@ void QEventDispatcherUNIX::wakeUp() Q_D(QEventDispatcherUNIX); if (d->wakeUps.testAndSetAcquire(0, 1)) { char c = 0; - ::write( d->thread_pipe[1], &c, 1 ); + qt_safe_write( d->thread_pipe[1], &c, 1 ); } } diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index c590553..21b5e65 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -624,6 +624,7 @@ void QThread::setTerminationEnabled(bool enabled) Q_ASSERT_X(thr != 0, "QThread::setTerminationEnabled()", "Current thread was not started with QThread."); #ifndef Q_OS_SYMBIAN + Q_UNUSED(thr) pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, NULL); if (enabled) pthread_testcancel(); diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 1b559cf..1277623 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -54,7 +54,6 @@ #ifndef Q_WS_WIN #include <locale.h> #endif - #include <time.h> #if defined(Q_OS_WINCE) #include "qfunctions_wince.h" @@ -69,6 +68,31 @@ # define QDTPDEBUGN if (false) qDebug #endif +#if defined(Q_OS_SYMBIAN) + // Workaround for OpenC bug. + + // OpenC incorrectly caches DST information between localtime_r + // calls, i.e. if previous call to localtime_r has been called for DST + // affected date, also the second call will be affected by DST even + // the date is such that DST should not be applied. + + // The workaround is to call mktime with non-DST affected date before + // calling localtime_r. mktime call resets the OpenC internal DST cache + // to right value and localtime_r will return correct values. +#define FIX_OPENC_DSTCACHE \ + tm localTM; \ + localTM.tm_sec = 0; \ + localTM.tm_min = 0; \ + localTM.tm_hour = 12; \ + localTM.tm_mday = 1; \ + localTM.tm_mon = 1; \ + localTM.tm_year = 2002 - 1900; \ + localTM.tm_isdst = -1; \ + time_t temp = mktime(&localTM); +#else +#define FIX_OPENC_DSTCACHE +#endif + #if defined(Q_WS_MAC) #include <private/qcore_mac_p.h> #endif @@ -1138,6 +1162,7 @@ QDate QDate::currentDate() // use the reentrant version of localtime() where available tzset(); tm res; + FIX_OPENC_DSTCACHE t = localtime_r(<ime, &res); #else t = localtime(<ime); @@ -1834,12 +1859,13 @@ QTime QTime::currentTime() // use the reentrant version of localtime() where available tzset(); tm res; + FIX_OPENC_DSTCACHE t = localtime_r(<ime, &res); #else t = localtime(<ime); #endif Q_CHECK_PTR(t); - + ct.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec + tv.tv_usec / 1000; #else @@ -2887,6 +2913,7 @@ QDateTime QDateTime::currentDateTime() // use the reentrant version of localtime() where available tzset(); tm res; + FIX_OPENC_DSTCACHE t = localtime_r(<ime, &res); #else t = localtime(<ime); @@ -3704,6 +3731,7 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) // use the reentrant version of localtime() where available tzset(); tm res; + FIX_OPENC_DSTCACHE brokenDown = localtime_r(&secsSince1Jan1970UTC, &res); #elif defined(_MSC_VER) && _MSC_VER >= 1400 tm res; diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index 931fbb4..1660e95 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -43,6 +43,7 @@ #include <QLocale> #include <QTime> #include <QVariant> +#include <QThread> #include <e32std.h> #include "private/qcore_symbian_p.h" @@ -773,8 +774,8 @@ static QLocale::MeasurementSystem symbianMeasurementSystem() QLocale QSystemLocale::fallbackLocale() const { // load system data before query calls - static bool initDone = false; - if (!initDone) { + static QBasicAtomicInt initDone = Q_BASIC_ATOMIC_INITIALIZER(0); + if (initDone.testAndSetRelaxed(0, 1)) { _s60Locale.LoadSystemSettings(); // Initialize platform version dependent function pointers @@ -794,7 +795,12 @@ QLocale QSystemLocale::fallbackLocale() const ptrGetLongDateFormatSpec = &defaultFormatSpec; if (!ptrGetShortDateFormatSpec) ptrGetShortDateFormatSpec = &defaultFormatSpec; + bool ret = initDone.testAndSetRelease(1, 2); + Q_ASSERT(ret); + Q_UNUSED(ret); } + while(initDone != 2) + QThread::yieldCurrentThread(); TLanguage lang = User::Language(); QString locale = QLatin1String(qt_symbianLocaleName(lang)); diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index f5b2a59..ce39b47 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -41,7 +41,6 @@ #include <qstringlist.h> #include <qset.h> -#include <qstringmatcher.h> QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index c959209..2a2a1d7 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -47,6 +47,7 @@ #include <QtCore/qlist.h> #include <QtCore/qregexp.h> #include <QtCore/qstring.h> +#include <QtCore/qstringmatcher.h> #ifdef QT_INCLUDE_COMPAT #include <Qt3Support/q3valuelist.h> #endif diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index dcd8418..57c6a58 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -61,7 +61,6 @@ SOURCES += qdbusconnection.cpp \ qdbusutil.cpp \ qdbusintrospection.cpp \ qdbusabstractadaptor.cpp \ - qdbusthread.cpp \ qdbusinternalfilters.cpp \ qdbusmetaobject.cpp \ qdbusxmlgenerator.cpp \ diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h index bc90328..69c6ee4 100644 --- a/src/dbus/qdbus_symbols_p.h +++ b/src/dbus/qdbus_symbols_p.h @@ -357,6 +357,9 @@ DEFINEFUNC(dbus_bool_t , dbus_type_is_basic, (int typecode), DEFINEFUNC(dbus_bool_t , dbus_type_is_fixed, (int typecode), (typecode), return) +/* dbus-thread.h */ +DEFINEFUNC(dbus_bool_t , dbus_threads_init_default, (), (), return) + QT_END_NAMESPACE #endif diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 6ff50ac..fb2dd77 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -920,9 +920,10 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) watchAndTimeoutLock(QMutex::Recursive), rootNode(QString(QLatin1Char('/'))) { - static const bool threads = qDBusInitThreads(); + static const bool threads = q_dbus_threads_init_default(); static const int debugging = ::isDebugging = qgetenv("QDBUS_DEBUG").toInt(); Q_UNUSED(threads) + Q_UNUSED(debugging) #ifdef QDBUS_THREAD_DEBUG if (debugging > 1) diff --git a/src/dbus/qdbusthread.cpp b/src/dbus/qdbusthread.cpp deleted file mode 100644 index 6e180b1..0000000 --- a/src/dbus/qdbusthread.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/**************************************************************************** -** -** 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 QtDBus module 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 <QtCore/qmutex.h> -#include <QtCore/qwaitcondition.h> - -#include <stdlib.h> -#include <qdbus_symbols_p.h> - -QT_USE_NAMESPACE - -static DBusMutex* mutex_new() -{ - return reinterpret_cast<DBusMutex *>(new QMutex(QMutex::NonRecursive)); -} - -#if 0 -static DBusMutex* recursive_mutex_new() -{ - return reinterpret_cast<DBusMutex *>(new QMutex(QMutex::Recursive)); -} -#endif - -static void mutex_free(DBusMutex *mutex) -{ - delete reinterpret_cast<QMutex *>(mutex); -} - -static dbus_bool_t mutex_lock(DBusMutex *mutex) -{ - reinterpret_cast<QMutex *>(mutex)->lock(); - return true; -} - -static dbus_bool_t mutex_unlock(DBusMutex *mutex) -{ - reinterpret_cast<QMutex *>(mutex)->unlock(); - return true; -} - -static DBusCondVar* condvar_new() -{ - return reinterpret_cast<DBusCondVar *>(new QWaitCondition); -} - -static void condvar_free(DBusCondVar *cond) -{ - delete reinterpret_cast<QWaitCondition *>(cond); -} - -static void condvar_wait(DBusCondVar *cond, DBusMutex *mutex) -{ - reinterpret_cast<QWaitCondition *>(cond)->wait(reinterpret_cast<QMutex *>(mutex)); -} - -static dbus_bool_t condvar_wait_timeout(DBusCondVar *cond, DBusMutex *mutex, int msec) -{ - return reinterpret_cast<QWaitCondition *>(cond)->wait(reinterpret_cast<QMutex *>(mutex), msec); -} - -static void condvar_wake_one(DBusCondVar *cond) -{ - reinterpret_cast<QWaitCondition *>(cond)->wakeOne(); -} - -static void condvar_wake_all(DBusCondVar *cond) -{ - reinterpret_cast<QWaitCondition *>(cond)->wakeAll(); -} - -QT_BEGIN_NAMESPACE - -bool qDBusInitThreads() -{ - // ### Disable the recursive mutex functions. - static DBusThreadFunctions fcn = { - DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK | - DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK | - DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK | - DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK, -#if 0 - DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK | - DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK | - DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK | - DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK, -#endif - mutex_new, - mutex_free, - mutex_lock, - mutex_unlock, - condvar_new, - condvar_free, - condvar_wait, - condvar_wait_timeout, - condvar_wake_one, - condvar_wake_all, -#if 0 - recursive_mutex_new, - mutex_free, - mutex_lock, - mutex_unlock, -#else - 0, 0, 0, 0, -#endif - 0, 0, 0, 0 - }; - -#if !defined QT_LINKED_LIBDBUS - void (*threads_init_default)() = (void (*)())qdbus_resolve_conditionally("dbus_threads_init_default"); - void (*threads_init)(DBusThreadFunctions *) = (void (*)(DBusThreadFunctions*))qdbus_resolve_conditionally("dbus_threads_init"); - - if (threads_init_default) - threads_init_default(); - else if (threads_init) - threads_init(&fcn); - else - return false; - - return true; -#else - dbus_threads_init(&fcn); - - return true; -#endif -} - -QT_END_NAMESPACE diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index a7df999..44a82ef 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -62,6 +62,7 @@ #include "qmime.h" #include "qspinbox.h" #include "qdialogbuttonbox.h" +#include "private/qguiplatformplugin_p.h" #ifdef Q_WS_S60 #include "private/qt_s60_p.h" @@ -1454,6 +1455,8 @@ void QColorDialogPrivate::init(const QColor &initial) q->setSizeGripEnabled(false); q->setWindowTitle(QColorDialog::tr("Select Color")); + nativeDialogInUse = false; + nextCust = 0; QVBoxLayout *mainLay = new QVBoxLayout(q); // there's nothing in this dialog that benefits from sizing up @@ -1719,6 +1722,8 @@ void QColorDialog::setCurrentColor(const QColor &color) d->setCurrentQColor(color); d->setCocoaPanelColor(color); #endif + if (d->nativeDialogInUse) + qt_guiPlatformPlugin()->colorDialogSetCurrentColor(this, color); } QColor QColorDialog::currentColor() const @@ -1871,6 +1876,17 @@ void QColorDialog::setVisible(bool visible) setAttribute(Qt::WA_DontShowOnScreen, false); } } +#else + + if (!(d->opts & DontUseNativeDialog) && qt_guiPlatformPlugin()->colorDialogSetVisible(this, visible)) { + d->nativeDialogInUse = true; + // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below + // updates the state correctly, but skips showing the non-native version: + setAttribute(Qt::WA_DontShowOnScreen); + } else { + d->nativeDialogInUse = false; + setAttribute(Qt::WA_DontShowOnScreen, false); + } #endif QDialog::setVisible(visible); @@ -1970,8 +1986,8 @@ QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent) QColorDialog::~QColorDialog() { -#if defined(Q_WS_MAC) Q_D(QColorDialog); +#if defined(Q_WS_MAC) if (d->delegate) { d->releaseCocoaColorPanelDelegate(); QColorDialogPrivate::sharedColorPanelAvailable = true; @@ -1985,6 +2001,9 @@ QColorDialog::~QColorDialog() settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), cusrgb[i]); } #endif + if (d->nativeDialogInUse) + qt_guiPlatformPlugin()->colorDialogDelete(this); + } diff --git a/src/gui/dialogs/qcolordialog_p.h b/src/gui/dialogs/qcolordialog_p.h index c7cabfb..81df503 100644 --- a/src/gui/dialogs/qcolordialog_p.h +++ b/src/gui/dialogs/qcolordialog_p.h @@ -114,6 +114,7 @@ public: QColorDialog::ColorDialogOptions opts; QPointer<QObject> receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; + bool nativeDialogInUse; #ifdef Q_WS_MAC void openCocoaColorPanel(const QColor &initial, diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 7df49fa..ed2d676 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -673,28 +673,6 @@ void QDialog::keyPressEvent(QKeyEvent *e) case Qt::Key_Escape: reject(); break; - case Qt::Key_Up: - case Qt::Key_Left: - if (focusWidget() && - (focusWidget()->focusPolicy() == Qt::StrongFocus || - focusWidget()->focusPolicy() == Qt::WheelFocus)) { - e->ignore(); - break; - } - // call ours, since c++ blocks us from calling the one - // belonging to focusWidget(). - focusNextPrevChild(false); - break; - case Qt::Key_Down: - case Qt::Key_Right: - if (focusWidget() && - (focusWidget()->focusPolicy() == Qt::StrongFocus || - focusWidget()->focusPolicy() == Qt::WheelFocus)) { - e->ignore(); - break; - } - focusNextPrevChild(true); - break; default: e->ignore(); return; diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index 54fc0e0..32cd397 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -76,6 +76,8 @@ #include <qdebug.h> #include "qsidebar_p.h" #include "qfscompleter_p.h" +#include "private/qguiplatformplugin_p.h" + #if defined (Q_OS_UNIX) #include <unistd.h> @@ -405,17 +407,17 @@ inline QString QFileDialogPrivate::rootPath() const { #ifndef Q_WS_MAC // Dummies for platforms that don't use native dialogs: - inline void QFileDialogPrivate::deleteNativeDialog_sys() {} - inline bool QFileDialogPrivate::setVisible_sys(bool) { return false; } - inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys(){ return QDialog::Rejected; } - inline void QFileDialogPrivate::setDirectory_sys(const QString &) {} - inline QString QFileDialogPrivate::directory_sys() const { return QString(); } - inline void QFileDialogPrivate::selectFile_sys(const QString &) {} - inline QStringList QFileDialogPrivate::selectedFiles_sys() const { return QStringList(); } - inline void QFileDialogPrivate::setFilter_sys() {} - inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &) {} - inline void QFileDialogPrivate::selectNameFilter_sys(const QString &) {} - inline QString QFileDialogPrivate::selectedNameFilter_sys() const { return QString(); } + inline void QFileDialogPrivate::deleteNativeDialog_sys() { qt_guiPlatformPlugin()->fileDialogDelete(q_func()); } + inline bool QFileDialogPrivate::setVisible_sys(bool visible) { return qt_guiPlatformPlugin()->fileDialogSetVisible(q_func(), visible); } + inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys(){ return qt_guiPlatformPlugin()->fileDialogResultCode(q_func()); } + inline void QFileDialogPrivate::setDirectory_sys(const QString &directory) { qt_guiPlatformPlugin()->fileDialogSetDirectory(q_func(), directory); } + inline QString QFileDialogPrivate::directory_sys() const { return qt_guiPlatformPlugin()->fileDialogDirectory(q_func()); } + inline void QFileDialogPrivate::selectFile_sys(const QString &filename) { qt_guiPlatformPlugin()->fileDialogSelectFile(q_func(), filename); } + inline QStringList QFileDialogPrivate::selectedFiles_sys() const { return qt_guiPlatformPlugin()->fileDialogSelectedFiles(q_func()); } + inline void QFileDialogPrivate::setFilter_sys() { qt_guiPlatformPlugin()->fileDialogSetFilter(q_func()); } + inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters) { qt_guiPlatformPlugin()->fileDialogSetNameFilters(q_func(), filters); } + inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter) { qt_guiPlatformPlugin()->fileDialogSelectNameFilter(q_func(), filter); } + inline QString QFileDialogPrivate::selectedNameFilter_sys() const { return qt_guiPlatformPlugin()->fileDialogSelectedNameFilter(q_func()); } #endif QT_END_NAMESPACE diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index f66c27f..843c4e2 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -52,6 +52,13 @@ #include <private/qprintengine_win_p.h> #include <private/qprinter_p.h> +#if defined(Q_CC_MINGW) && !defined(PD_NOCURRENTPAGE) +#define PD_NOCURRENTPAGE 0x00800000 +#define PD_RESULT_PRINT 1 +#define PD_RESULT_APPLY 2 +#define START_PAGE_GENERAL 0XFFFFFFFF +#endif + QT_BEGIN_NAMESPACE extern void qt_win_eatMouseMove(); diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index e971fd8..ee01fdc 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -566,7 +566,7 @@ QGraphicsColorizeEffect::~QGraphicsColorizeEffect() \brief the color of the effect. By default, the color is light blue (QColor(0, 0, 192)). -*/; +*/ QColor QGraphicsColorizeEffect::color() const { Q_D(const QGraphicsColorizeEffect); diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index f75118b..e3cd4f9 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -92,87 +92,118 @@ qreal QGraphicsAnchorPrivate::spacing() const } +static void sizeHintsFromItem(QGraphicsLayoutItem *item, + const QGraphicsAnchorLayoutPrivate::Orientation orient, + qreal *minSize, qreal *prefSize, + qreal *expSize, qreal *maxSize) +{ + QSizePolicy::Policy policy; + qreal minSizeHint; + qreal prefSizeHint; + qreal maxSizeHint; + + if (orient == QGraphicsAnchorLayoutPrivate::Horizontal) { + policy = item->sizePolicy().horizontalPolicy(); + minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).width(); + prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).width(); + maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).width(); + } else { + policy = item->sizePolicy().verticalPolicy(); + minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).height(); + prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).height(); + maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).height(); + } + + // minSize, prefSize and maxSize are initialized + // with item's preferred Size: this is QSizePolicy::Fixed. + // + // Then we check each flag to find the resultant QSizePolicy, + // according to the following table: + // + // constant value + // QSizePolicy::Fixed 0 + // QSizePolicy::Minimum GrowFlag + // QSizePolicy::Maximum ShrinkFlag + // QSizePolicy::Preferred GrowFlag | ShrinkFlag + // QSizePolicy::Ignored GrowFlag | ShrinkFlag | IgnoreFlag + + if (policy & QSizePolicy::ShrinkFlag) + *minSize = minSizeHint; + else + *minSize = prefSizeHint; + + if (policy & QSizePolicy::GrowFlag) + *maxSize = maxSizeHint; + else + *maxSize = prefSizeHint; + + // Note that these two initializations are affected by the previous flags + if (policy & QSizePolicy::IgnoreFlag) + *prefSize = *maxSize; + else + *prefSize = prefSizeHint; + + if (policy & QSizePolicy::ExpandFlag) + *expSize = *maxSize; + else + *expSize = *prefSize; +} + void AnchorData::refreshSizeHints(qreal effectiveSpacing) { - if (!isLayoutAnchor && from->m_item == to->m_item) { - QGraphicsLayoutItem *item = from->m_item; + const bool isInternalAnchor = from->m_item == to->m_item; - const QGraphicsAnchorLayoutPrivate::Orientation orient = QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge); - const Qt::AnchorPoint centerEdge = QGraphicsAnchorLayoutPrivate::pickEdge(Qt::AnchorHorizontalCenter, orient); + if (isInternalAnchor) { + const QGraphicsAnchorLayoutPrivate::Orientation orient = + QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge); - QSizePolicy::Policy policy; - qreal minSizeHint, prefSizeHint, maxSizeHint; - if (orient == QGraphicsAnchorLayoutPrivate::Horizontal) { - policy = item->sizePolicy().horizontalPolicy(); - minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).width(); - prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).width(); - maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).width(); + if (isLayoutAnchor) { + minSize = 0; + prefSize = 0; + expSize = 0; + maxSize = QWIDGETSIZE_MAX; } else { - policy = item->sizePolicy().verticalPolicy(); - minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).height(); - prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).height(); - maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).height(); + QGraphicsLayoutItem *item = from->m_item; + sizeHintsFromItem(item, orient, &minSize, &prefSize, &expSize, &maxSize); } - // minSize, prefSize and maxSize are initialized - // with item's preferred Size: this is QSizePolicy::Fixed. - // - // Then we check each flag to find the resultant QSizePolicy, - // according to the following table: - // - // constant value - // QSizePolicy::Fixed 0 - // QSizePolicy::Minimum GrowFlag - // QSizePolicy::Maximum ShrinkFlag - // QSizePolicy::Preferred GrowFlag | ShrinkFlag - // QSizePolicy::Ignored GrowFlag | ShrinkFlag | IgnoreFlag - prefSize = prefSizeHint; - minSize = prefSize; - maxSize = prefSize; - - if (policy & QSizePolicy::GrowFlag) - maxSize = maxSizeHint; - - if (policy & QSizePolicy::ShrinkFlag) - minSize = minSizeHint; - - if (policy & QSizePolicy::IgnoreFlag) - prefSize = minSize; + const Qt::AnchorPoint centerEdge = + QGraphicsAnchorLayoutPrivate::pickEdge(Qt::AnchorHorizontalCenter, orient); bool hasCenter = (from->m_edge == centerEdge || to->m_edge == centerEdge); if (hasCenter) { minSize /= 2; prefSize /= 2; + expSize /= 2; maxSize /= 2; } - // Set the anchor effective sizes to preferred. - // - // Note: The idea here is that all items should remain at their - // preferred size unless where that's impossible. In cases where - // the item is subject to restrictions (anchored to the layout - // edges, for instance), the simplex solver will be run to - // recalculate and override the values we set here. - sizeAtMinimum = prefSize; - sizeAtPreferred = prefSize; - sizeAtMaximum = prefSize; - } else if (!hasSize) { // Anchor has no size defined, use given default information minSize = effectiveSpacing; prefSize = effectiveSpacing; + expSize = effectiveSpacing; maxSize = effectiveSpacing; - - sizeAtMinimum = prefSize; - sizeAtPreferred = prefSize; - sizeAtMaximum = prefSize; } + + // Set the anchor effective sizes to preferred. + // + // Note: The idea here is that all items should remain at their + // preferred size unless where that's impossible. In cases where + // the item is subject to restrictions (anchored to the layout + // edges, for instance), the simplex solver will be run to + // recalculate and override the values we set here. + sizeAtMinimum = prefSize; + sizeAtPreferred = prefSize; + sizeAtExpanding = prefSize; + sizeAtMaximum = prefSize; } void ParallelAnchorData::updateChildrenSizes() { firstEdge->sizeAtMinimum = secondEdge->sizeAtMinimum = sizeAtMinimum; firstEdge->sizeAtPreferred = secondEdge->sizeAtPreferred = sizeAtPreferred; + firstEdge->sizeAtExpanding = secondEdge->sizeAtExpanding = sizeAtExpanding; firstEdge->sizeAtMaximum = secondEdge->sizeAtMaximum = sizeAtMaximum; firstEdge->updateChildrenSizes(); @@ -181,9 +212,16 @@ void ParallelAnchorData::updateChildrenSizes() void ParallelAnchorData::refreshSizeHints(qreal effectiveSpacing) { - // First refresh children information - firstEdge->refreshSizeHints(effectiveSpacing); - secondEdge->refreshSizeHints(effectiveSpacing); + refreshSizeHints_helper(effectiveSpacing); +} + +void ParallelAnchorData::refreshSizeHints_helper(qreal effectiveSpacing, + bool refreshChildren) +{ + if (refreshChildren) { + firstEdge->refreshSizeHints(effectiveSpacing); + secondEdge->refreshSizeHints(effectiveSpacing); + } // ### should we warn if the parallel connection is invalid? // e.g. 1-2-3 with 10-20-30, the minimum of the latter is @@ -192,12 +230,16 @@ void ParallelAnchorData::refreshSizeHints(qreal effectiveSpacing) minSize = qMax(firstEdge->minSize, secondEdge->minSize); maxSize = qMin(firstEdge->maxSize, secondEdge->maxSize); + expSize = qMax(firstEdge->expSize, secondEdge->expSize); + expSize = qMin(expSize, maxSize); + prefSize = qMax(firstEdge->prefSize, secondEdge->prefSize); - prefSize = qMin(prefSize, maxSize); + prefSize = qMin(prefSize, expSize); // See comment in AnchorData::refreshSizeHints() about sizeAt* values sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; + sizeAtExpanding = prefSize; sizeAtMaximum = prefSize; } @@ -233,6 +275,21 @@ static qreal getFactor(qreal value, qreal min, qreal pref, qreal max) } } +static qreal getExpandingFactor(qreal expSize, qreal sizeAtPreferred, + qreal sizeAtExpanding, qreal sizeAtMaximum) +{ + const qreal lower = qMin(sizeAtPreferred, sizeAtMaximum); + const qreal upper = qMax(sizeAtPreferred, sizeAtMaximum); + const qreal boundedExpSize = qBound(lower, expSize, upper); + + const qreal bandSize = sizeAtMaximum - boundedExpSize; + if (bandSize == 0) { + return 0; + } else { + return (sizeAtExpanding - boundedExpSize) / bandSize; + } +} + void SequentialAnchorData::updateChildrenSizes() { // ### REMOVE ME @@ -242,15 +299,18 @@ void SequentialAnchorData::updateChildrenSizes() Q_ASSERT(sizeAtMinimum < maxSize || qFuzzyCompare(sizeAtMinimum, maxSize)); Q_ASSERT(sizeAtPreferred > minSize || qFuzzyCompare(sizeAtPreferred, minSize)); Q_ASSERT(sizeAtPreferred < maxSize || qFuzzyCompare(sizeAtPreferred, maxSize)); + Q_ASSERT(sizeAtExpanding > minSize || qFuzzyCompare(sizeAtExpanding, minSize)); + Q_ASSERT(sizeAtExpanding < maxSize || qFuzzyCompare(sizeAtExpanding, maxSize)); Q_ASSERT(sizeAtMaximum > minSize || qFuzzyCompare(sizeAtMaximum, minSize)); Q_ASSERT(sizeAtMaximum < maxSize || qFuzzyCompare(sizeAtMaximum, maxSize)); // Band here refers if the value is in the Minimum To Preferred // band (the lower band) or the Preferred To Maximum (the upper band). - qreal minFactor = getFactor(sizeAtMinimum, minSize, prefSize, maxSize); - qreal prefFactor = getFactor(sizeAtPreferred, minSize, prefSize, maxSize); - qreal maxFactor = getFactor(sizeAtMaximum, minSize, prefSize, maxSize); + const qreal minFactor = getFactor(sizeAtMinimum, minSize, prefSize, maxSize); + const qreal prefFactor = getFactor(sizeAtPreferred, minSize, prefSize, maxSize); + const qreal maxFactor = getFactor(sizeAtMaximum, minSize, prefSize, maxSize); + const qreal expFactor = getExpandingFactor(expSize, sizeAtPreferred, sizeAtExpanding, sizeAtMaximum); for (int i = 0; i < m_edges.count(); ++i) { AnchorData *e = m_edges.at(i); @@ -264,30 +324,45 @@ void SequentialAnchorData::updateChildrenSizes() bandSize = maxFactor > 0 ? e->maxSize - e->prefSize : e->prefSize - e->minSize; e->sizeAtMaximum = e->prefSize + bandSize * maxFactor; + const qreal lower = qMin(e->sizeAtPreferred, e->sizeAtMaximum); + const qreal upper = qMax(e->sizeAtPreferred, e->sizeAtMaximum); + const qreal edgeBoundedExpSize = qBound(lower, e->expSize, upper); + e->sizeAtExpanding = edgeBoundedExpSize + expFactor * (e->sizeAtMaximum - edgeBoundedExpSize); + e->updateChildrenSizes(); } } void SequentialAnchorData::refreshSizeHints(qreal effectiveSpacing) { + refreshSizeHints_helper(effectiveSpacing); +} + +void SequentialAnchorData::refreshSizeHints_helper(qreal effectiveSpacing, + bool refreshChildren) +{ minSize = 0; prefSize = 0; + expSize = 0; maxSize = 0; for (int i = 0; i < m_edges.count(); ++i) { AnchorData *edge = m_edges.at(i); - // First refresh children information - edge->refreshSizeHints(effectiveSpacing); + // If it's the case refresh children information first + if (refreshChildren) + edge->refreshSizeHints(effectiveSpacing); minSize += edge->minSize; prefSize += edge->prefSize; + expSize += edge->expSize; maxSize += edge->maxSize; } // See comment in AnchorData::refreshSizeHints() about sizeAt* values sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; + sizeAtExpanding = prefSize; sizeAtMaximum = prefSize; } @@ -357,6 +432,12 @@ QGraphicsAnchorLayoutPrivate::QGraphicsAnchorLayoutPrivate() : calculateGraphCacheDirty(1) { for (int i = 0; i < NOrientations; ++i) { + for (int j = 0; j < 3; ++j) { + sizeHints[i][j] = -1; + } + sizeAtExpanding[i] = -1; + interpolationProgress[i] = -1; + spacings[i] = -1; graphSimplified[i] = false; graphHasConflicts[i] = false; @@ -422,39 +503,21 @@ static bool simplifySequentialChunk(Graph<AnchorVertex, AnchorData> *graph, qDebug("simplifying [%s] to [%s - %s]", qPrintable(strPath), qPrintable(before->toString()), qPrintable(after->toString())); #endif - qreal min = 0; - qreal pref = 0; - qreal max = 0; - SequentialAnchorData *sequence = new SequentialAnchorData; AnchorVertex *prev = before; AnchorData *data; for (i = 0; i <= vertices.count(); ++i) { AnchorVertex *next = (i < vertices.count()) ? vertices.at(i) : after; data = graph->takeEdge(prev, next); - min += data->minSize; - pref += data->prefSize; - max = checkAdd(max, data->maxSize); sequence->m_edges.append(data); prev = next; } - - // insert new - sequence->minSize = min; - sequence->prefSize = pref; - sequence->maxSize = max; - - // Unless these values are overhidden by the simplex solver later-on, - // anchors will keep their own preferred size. - sequence->sizeAtMinimum = pref; - sequence->sizeAtPreferred = pref; - sequence->sizeAtMaximum = pref; - sequence->setVertices(vertices); - sequence->from = before; sequence->to = after; + sequence->refreshSizeHints_helper(0, false); + // data here is the last edge in the sequence // ### this seems to be here for supporting reverse order sequences, // but doesnt seem to be used right now @@ -469,25 +532,11 @@ static bool simplifySequentialChunk(Graph<AnchorVertex, AnchorData> *graph, AnchorData *newAnchor = sequence; if (AnchorData *oldAnchor = graph->takeEdge(before, after)) { - newAnchor = new ParallelAnchorData(oldAnchor, sequence); - - newAnchor->isLayoutAnchor = (oldAnchor->isLayoutAnchor + ParallelAnchorData *parallel = new ParallelAnchorData(oldAnchor, sequence); + parallel->isLayoutAnchor = (oldAnchor->isLayoutAnchor || sequence->isLayoutAnchor); - - min = qMax(oldAnchor->minSize, sequence->minSize); - max = qMin(oldAnchor->maxSize, sequence->maxSize); - - pref = qMax(oldAnchor->prefSize, sequence->prefSize); - pref = qMin(pref, max); - - newAnchor->minSize = min; - newAnchor->prefSize = pref; - newAnchor->maxSize = max; - - // Same as above, by default, keep preferred size. - newAnchor->sizeAtMinimum = pref; - newAnchor->sizeAtPreferred = pref; - newAnchor->sizeAtMaximum = pref; + parallel->refreshSizeHints_helper(0, false); + newAnchor = parallel; } graph->createEdge(before, after, newAnchor); @@ -817,9 +866,10 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() QGraphicsLayoutItem *layout = q; // Horizontal - AnchorData *data = new AnchorData(0, 0, QWIDGETSIZE_MAX); + AnchorData *data = new AnchorData; addAnchor_helper(layout, Qt::AnchorLeft, layout, - Qt::AnchorRight, data); + Qt::AnchorRight, data); + data->maxSize = QWIDGETSIZE_MAX; data->skipInPreferred = 1; // Set the Layout Left edge as the root of the horizontal graph. @@ -827,9 +877,10 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() graph[Horizontal].setRootVertex(v); // Vertical - data = new AnchorData(0, 0, QWIDGETSIZE_MAX); + data = new AnchorData; addAnchor_helper(layout, Qt::AnchorTop, layout, - Qt::AnchorBottom, data); + Qt::AnchorBottom, data); + data->maxSize = QWIDGETSIZE_MAX; data->skipInPreferred = 1; // Set the Layout Top edge as the root of the vertical graph. @@ -856,19 +907,15 @@ void QGraphicsAnchorLayoutPrivate::createItemEdges(QGraphicsLayoutItem *item) items.append(item); - QSizeF minSize = item->effectiveSizeHint(Qt::MinimumSize); - QSizeF prefSize = item->effectiveSizeHint(Qt::PreferredSize); - QSizeF maxSize = item->effectiveSizeHint(Qt::MaximumSize); - - // Horizontal - AnchorData *data = new AnchorData(minSize.width(), prefSize.width(), maxSize.width()); - addAnchor_helper(item, Qt::AnchorLeft, item, - Qt::AnchorRight, data); + // Create horizontal and vertical internal anchors for the item and + // refresh its size hint / policy values. + AnchorData *data = new AnchorData; + addAnchor_helper(item, Qt::AnchorLeft, item, Qt::AnchorRight, data); + data->refreshSizeHints(0); // 0 = effectiveSpacing, will not be used - // Vertical - data = new AnchorData(minSize.height(), prefSize.height(), maxSize.height()); - addAnchor_helper(item, Qt::AnchorTop, item, - Qt::AnchorBottom, data); + data = new AnchorData; + addAnchor_helper(item, Qt::AnchorTop, item, Qt::AnchorBottom, data); + data->refreshSizeHints(0); // 0 = effectiveSpacing, will not be used } /*! @@ -921,20 +968,17 @@ void QGraphicsAnchorLayoutPrivate::createCenterAnchors( Q_ASSERT(first && last); // Create new anchors - AnchorData *oldData = graph[orientation].edgeData(first, last); - - qreal minimumSize = oldData->minSize / 2; - qreal preferredSize = oldData->prefSize / 2; - qreal maximumSize = oldData->maxSize / 2; - QSimplexConstraint *c = new QSimplexConstraint; - AnchorData *data = new AnchorData(minimumSize, preferredSize, maximumSize); + + AnchorData *data = new AnchorData; c->variables.insert(data, 1.0); addAnchor_helper(item, firstEdge, item, centerEdge, data); + data->refreshSizeHints(0); - data = new AnchorData(minimumSize, preferredSize, maximumSize); + data = new AnchorData; c->variables.insert(data, -1.0); addAnchor_helper(item, centerEdge, item, lastEdge, data); + data->refreshSizeHints(0); itemCenterConstraints[orientation].append(c); @@ -995,14 +1039,9 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors( if (substitute) { // Create the new anchor that should substitute the left-center-right anchors. - AnchorData *oldData = g.edgeData(first, center); - - qreal minimumSize = oldData->minSize * 2; - qreal preferredSize = oldData->prefSize * 2; - qreal maximumSize = oldData->maxSize * 2; - - AnchorData *data = new AnchorData(minimumSize, preferredSize, maximumSize); + AnchorData *data = new AnchorData; addAnchor_helper(item, firstEdge, item, lastEdge, data); + data->refreshSizeHints(0); // Remove old anchors removeAnchor_helper(first, center); @@ -1120,7 +1159,7 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi // Use heuristics to find out what the user meant with this anchor. correctEdgeDirection(firstItem, firstEdge, secondItem, secondEdge); - AnchorData *data; + AnchorData *data = new AnchorData; if (!spacing) { // If firstItem or secondItem is the layout itself, the spacing will default to 0. // Otherwise, the following matrix is used (questionmark means that the spacing @@ -1130,22 +1169,25 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi // Left 0 0 ? // HCenter 0 0 0 // Right ? 0 0 - if (firstItem != q - && secondItem != q - && pickEdge(firstEdge, Horizontal) != Qt::AnchorHorizontalCenter - && oppositeEdge(firstEdge) == secondEdge) { - data = new AnchorData; // ask the style later + if (firstItem == q + || secondItem == q + || pickEdge(firstEdge, Horizontal) == Qt::AnchorHorizontalCenter + || oppositeEdge(firstEdge) != secondEdge) { + data->setFixedSize(0); } else { - data = new AnchorData(0); // spacing should be 0 + data->unsetSize(); } addAnchor_helper(firstItem, firstEdge, secondItem, secondEdge, data); + } else if (*spacing >= 0) { - data = new AnchorData(*spacing); + data->setFixedSize(*spacing); addAnchor_helper(firstItem, firstEdge, secondItem, secondEdge, data); + } else { - data = new AnchorData(-*spacing); + data->setFixedSize(-*spacing); addAnchor_helper(secondItem, secondEdge, firstItem, firstEdge, data); } + return acquireGraphicsAnchor(data); } @@ -1622,11 +1664,18 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( qreal min, max; feasible = solveMinMax(trunkConstraints, trunkPath, &min, &max); - // Solve for preferred. The objective function is calculated from the constraints - // and variables internally. - feasible &= solvePreferred(trunkConstraints); - if (feasible) { + // Solve for preferred. The objective function is calculated from the constraints + // and variables internally. + solvePreferred(trunkConstraints); + + // remove sizeHintConstraints from trunkConstraints + trunkConstraints = parts[0]; + + // Solve for expanding. The objective function and the constraints from items + // are calculated internally. + solveExpanding(trunkConstraints); + // Propagate the new sizes down the simplified graph, ie. tell the // group anchors to set their children anchors sizes. @@ -1636,19 +1685,23 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( for (int i = 0; i < trunkVariables.count(); ++i) trunkVariables.at(i)->updateChildrenSizes(); - // Calculate and set the preferred size for the layout from the edge sizes that - // were calculated above. + // Calculate and set the preferred and expanding sizes for the layout, + // from the edge sizes that were calculated above. qreal pref(0.0); + qreal expanding(0.0); foreach (const AnchorData *ad, trunkPath.positives) { pref += ad->sizeAtPreferred; + expanding += ad->sizeAtExpanding; } foreach (const AnchorData *ad, trunkPath.negatives) { pref -= ad->sizeAtPreferred; + expanding -= ad->sizeAtExpanding; } + sizeHints[orientation][Qt::MinimumSize] = min; sizeHints[orientation][Qt::PreferredSize] = pref; sizeHints[orientation][Qt::MaximumSize] = max; - + sizeAtExpanding[orientation] = expanding; } } else { #if 0 @@ -1664,6 +1717,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( AnchorData *ad = trunkPath.positives.toList()[0]; ad->sizeAtMinimum = ad->minSize; ad->sizeAtPreferred = ad->prefSize; + ad->sizeAtExpanding = ad->expSize; ad->sizeAtMaximum = ad->maxSize; // Propagate @@ -1672,6 +1726,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( sizeHints[orientation][Qt::MinimumSize] = ad->sizeAtMinimum; sizeHints[orientation][Qt::PreferredSize] = ad->sizeAtPreferred; sizeHints[orientation][Qt::MaximumSize] = ad->sizeAtMaximum; + sizeAtExpanding[orientation] = ad->sizeAtExpanding; } // Delete the constraints, we won't use them anymore. @@ -1701,6 +1756,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( AnchorData *ad = partVariables[j]; Q_ASSERT(ad); ad->sizeAtMinimum = ad->sizeAtPreferred; + ad->sizeAtExpanding = ad->sizeAtPreferred; ad->sizeAtMaximum = ad->sizeAtPreferred; ad->updateChildrenSizes(); } @@ -1785,6 +1841,11 @@ void QGraphicsAnchorLayoutPrivate::findPaths(Orientation orientation) queue.enqueue(qMakePair(pair.second, v)); } } + + // We will walk through every reachable items (non-float) and mark them + // by keeping their references on m_nonFloatItems. With this we can easily + // identify non-float and float items. + identifyNonFloatItems(visited, orientation); } /*! @@ -1943,6 +2004,46 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation) } /*! + \internal + + Use all visited Anchors on findPaths() so we can identify non-float Items. +*/ +void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems(QSet<AnchorData *> visited, Orientation orientation) +{ + m_nonFloatItems[orientation].clear(); + + foreach (const AnchorData *ad, visited) + identifyNonFloatItems_helper(ad, orientation); +} + +/*! + \internal + + Given an anchor, if it is an internal anchor and Normal we must mark it's item as non-float. + If the anchor is Sequential or Parallel, we must iterate on its children recursively until we reach + internal anchors (items). +*/ +void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems_helper(const AnchorData *ad, Orientation orientation) +{ + Q_Q(QGraphicsAnchorLayout); + + switch(ad->type) { + case AnchorData::Normal: + if (ad->from->m_item == ad->to->m_item && ad->to->m_item != q) + m_nonFloatItems[orientation].insert(ad->to->m_item); + break; + case AnchorData::Sequential: + foreach (const AnchorData *d, static_cast<const SequentialAnchorData *>(ad)->m_edges) + identifyNonFloatItems_helper(d, orientation); + break; + case AnchorData::Parallel: + identifyNonFloatItems_helper(static_cast<const ParallelAnchorData *>(ad)->firstEdge, orientation); + identifyNonFloatItems_helper(static_cast<const ParallelAnchorData *>(ad)->secondEdge, orientation); + break; + } +} + +/*! \internal Use the current vertices distance to calculate and set the geometry of @@ -1967,22 +2068,35 @@ void QGraphicsAnchorLayoutPrivate::setItemsGeometries(const QRectF &geom) right = geom.right() - right; foreach (QGraphicsLayoutItem *item, items) { - firstH = internalVertex(item, Qt::AnchorLeft); - secondH = internalVertex(item, Qt::AnchorRight); - firstV = internalVertex(item, Qt::AnchorTop); - secondV = internalVertex(item, Qt::AnchorBottom); - QRectF newGeom; - newGeom.setTop(top + firstV->distance); - newGeom.setBottom(top + secondV->distance); + QSizeF itemPreferredSize = item->effectiveSizeHint(Qt::PreferredSize); + if (m_nonFloatItems[Horizontal].contains(item)) { + firstH = internalVertex(item, Qt::AnchorLeft); + secondH = internalVertex(item, Qt::AnchorRight); + + if (visualDir == Qt::LeftToRight) { + newGeom.setLeft(left + firstH->distance); + newGeom.setRight(left + secondH->distance); + } else { + newGeom.setLeft(right - secondH->distance); + newGeom.setRight(right - firstH->distance); + } + } else { + newGeom.setLeft(0); + newGeom.setRight(itemPreferredSize.width()); + } + + if (m_nonFloatItems[Vertical].contains(item)) { + firstV = internalVertex(item, Qt::AnchorTop); + secondV = internalVertex(item, Qt::AnchorBottom); - if (visualDir == Qt::LeftToRight) { - newGeom.setLeft(left + firstH->distance); - newGeom.setRight(left + secondH->distance); + newGeom.setTop(top + firstV->distance); + newGeom.setBottom(top + secondV->distance); } else { - newGeom.setLeft(right - secondH->distance); - newGeom.setRight(right - firstH->distance); + newGeom.setTop(0); + newGeom.setBottom(itemPreferredSize.height()); } + item->setGeometry(newGeom); } } @@ -2058,9 +2172,13 @@ void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation( interpolationInterval[orientation] = MinToPreferred; lower = sizeHints[orientation][Qt::MinimumSize]; upper = sizeHints[orientation][Qt::PreferredSize]; - } else { - interpolationInterval[orientation] = PreferredToMax; + } else if (current < sizeAtExpanding[orientation]) { + interpolationInterval[orientation] = PreferredToExpanding; lower = sizeHints[orientation][Qt::PreferredSize]; + upper = sizeAtExpanding[orientation]; + } else { + interpolationInterval[orientation] = ExpandingToMax; + lower = sizeAtExpanding[orientation]; upper = sizeHints[orientation][Qt::MaximumSize]; } @@ -2075,11 +2193,12 @@ void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation( \internal Calculate the current Edge size based on the current Layout size and the - size the edge is supposed to have when: + size the edge is supposed to have when the layout is at its: - - the layout is at its minimum size. - - the layout is at its preferred size. - - the layout is at its maximum size. + - minimum size, + - preferred size, + - size when all expanding anchors are expanded, + - maximum size. These three key values are calculated in advance using linear programming (more expensive) or the simplification algorithm, then @@ -2099,8 +2218,11 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, if (interpolationInterval[orientation] == MinToPreferred) { lower = edge->sizeAtMinimum; upper = edge->sizeAtPreferred; - } else { + } else if (interpolationInterval[orientation] == PreferredToExpanding) { lower = edge->sizeAtPreferred; + upper = edge->sizeAtExpanding; + } else { + lower = edge->sizeAtExpanding; upper = edge->sizeAtMaximum; } @@ -2289,6 +2411,139 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList<QSimplexConstraint *> co /*! \internal + Calculate the "expanding" keyframe + + This new keyframe sits between the already existing sizeAtPreferred and + sizeAtMaximum keyframes. Its goal is to modify the interpolation between + the latter as to respect the "expanding" size policy of some anchors. + + Previously all items would be subject to a linear interpolation between + sizeAtPreferred and sizeAtMaximum values. This will change now, the + expanding anchors will change their size before the others. To calculate + this keyframe we use the following logic: + + 1) Ask each anchor for their desired expanding size (ad->expSize), this + value depends on the anchor expanding property in the following way: + + - Expanding normal anchors want to grow towards their maximum size + - Non-expanding normal anchors want to remain at their preferred size. + - Sequential anchors wants to grow towards a size that is calculated by: + summarizing it's child anchors, where it will use preferred size for non-expanding anchors + and maximum size for expanding anchors. + - Parallel anchors want to grow towards the smallest maximum size of all the expanding anchors. + + 2) Clamp their desired values to the value they assume in the neighbour + keyframes (sizeAtPreferred and sizeAtExpanding) + + 3) Run simplex with a setup that ensures the following: + + a. Anchors will change their value from their sizeAtPreferred towards + their sizeAtMaximum as much as required to ensure that ALL anchors + reach their respective "desired" expanding sizes. + + b. No anchors will change their value beyond what is NEEDED to satisfy + the requirement above. + + The final result is that, at the "expanding" keyframe expanding anchors + will grow and take with them all anchors that are parallel to them. + However, non-expanding anchors will remain at their preferred size unless + they are forced to grow by a parallel expanding anchor. + + Note: For anchors where the sizeAtPreferred is bigger than sizeAtMaximum, + the visual effect when the layout grows from its preferred size is + the following: Expanding anchors will keep their size while non + expanding ones will shrink. Only after non-expanding anchors have + shrinked all the way, the expanding anchors will start to shrink too. +*/ +void QGraphicsAnchorLayoutPrivate::solveExpanding(QList<QSimplexConstraint *> constraints) +{ + QList<AnchorData *> variables = getVariables(constraints); + QList<QSimplexConstraint *> itemConstraints; + QSimplexConstraint *objective = new QSimplexConstraint; + bool hasExpanding = false; + + // Construct the simplex constraints and objective + for (int i = 0; i < variables.size(); ++i) { + // For each anchor + AnchorData *ad = variables[i]; + + // Clamp the desired expanding size + qreal upperBoundary = qMax(ad->sizeAtPreferred, ad->sizeAtMaximum); + qreal lowerBoundary = qMin(ad->sizeAtPreferred, ad->sizeAtMaximum); + qreal boundedExpSize = qBound(lowerBoundary, ad->expSize, upperBoundary); + + // Expanding anchors are those that want to move from their preferred size + if (boundedExpSize != ad->sizeAtPreferred) + hasExpanding = true; + + // Lock anchor between boundedExpSize and sizeAtMaximum (ensure 3.a) + if (boundedExpSize == ad->sizeAtMaximum) { + // The interval has only one possible value, we can use an "Equal" + // constraint and don't need to add this variable to the objective. + QSimplexConstraint *itemC = new QSimplexConstraint; + itemC->ratio = QSimplexConstraint::Equal; + itemC->variables.insert(ad, 1.0); + itemC->constant = boundedExpSize; + itemConstraints << itemC; + } else { + // Add MoreOrEqual and LessOrEqual constraints. + QSimplexConstraint *itemC = new QSimplexConstraint; + itemC->ratio = QSimplexConstraint::MoreOrEqual; + itemC->variables.insert(ad, 1.0); + itemC->constant = qMin(boundedExpSize, ad->sizeAtMaximum); + itemConstraints << itemC; + + itemC = new QSimplexConstraint; + itemC->ratio = QSimplexConstraint::LessOrEqual; + itemC->variables.insert(ad, 1.0); + itemC->constant = qMax(boundedExpSize, ad->sizeAtMaximum); + itemConstraints << itemC; + + // Create objective to avoid the anchors from moving away from + // the preferred size more than the needed amount. (ensure 3.b) + // The objective function is the distance between sizeAtPreferred + // and sizeAtExpanding, it will be minimized. + if (ad->sizeAtExpanding < ad->sizeAtMaximum) { + // Try to shrink this variable towards its sizeAtPreferred value + objective->variables.insert(ad, 1.0); + } else { + // Try to grow this variable towards its sizeAtPreferred value + objective->variables.insert(ad, -1.0); + } + } + } + + // Solve + if (hasExpanding == false) { + // If no anchors are expanding, we don't need to run the simplex + // Set all variables to their preferred size + for (int i = 0; i < variables.size(); ++i) { + variables[i]->sizeAtExpanding = variables[i]->sizeAtPreferred; + } + } else { + // Run simplex + QSimplex simplex; + + // Satisfy expanding (3.a) + bool feasible = simplex.setConstraints(constraints + itemConstraints); + Q_ASSERT(feasible); + + // Reduce damage (3.b) + simplex.setObjective(objective); + simplex.solveMin(); + + // Collect results + for (int i = 0; i < variables.size(); ++i) { + variables[i]->sizeAtExpanding = variables[i]->result; + } + } + + delete objective; + qDeleteAll(itemConstraints); +} + +/*! + \internal Returns true if there are no arrangement that satisfies all constraints. Otherwise returns false. @@ -2298,7 +2553,11 @@ bool QGraphicsAnchorLayoutPrivate::hasConflicts() const { QGraphicsAnchorLayoutPrivate *that = const_cast<QGraphicsAnchorLayoutPrivate*>(this); that->calculateGraphs(); - return graphHasConflicts[0] || graphHasConflicts[1]; + + bool floatConflict = (m_nonFloatItems[0].size() < items.size()) + || (m_nonFloatItems[1].size() < items.size()); + + return graphHasConflicts[0] || graphHasConflicts[1] || floatConflict; } #ifdef QT_DEBUG diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index c86bfa3..24b25de 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -149,30 +149,14 @@ struct AnchorData : public QSimplexVariable { Sequential, Parallel }; - AnchorData(qreal minimumSize, qreal preferredSize, qreal maximumSize) - : QSimplexVariable(), from(0), to(0), - minSize(minimumSize), prefSize(preferredSize), - maxSize(maximumSize), sizeAtMinimum(preferredSize), - sizeAtPreferred(preferredSize), sizeAtMaximum(preferredSize), - graphicsAnchor(0), - skipInPreferred(0), type(Normal), hasSize(true), - isLayoutAnchor(false) {} - - AnchorData(qreal size) - : QSimplexVariable(), from(0), to(0), - minSize(size), prefSize(size), maxSize(size), - sizeAtMinimum(size), sizeAtPreferred(size), sizeAtMaximum(size), - graphicsAnchor(0), - skipInPreferred(0), type(Normal), hasSize(true), - isLayoutAnchor(false) {} AnchorData() : QSimplexVariable(), from(0), to(0), - minSize(0), prefSize(0), maxSize(0), - sizeAtMinimum(0), sizeAtPreferred(0), sizeAtMaximum(0), - graphicsAnchor(0), - skipInPreferred(0), type(Normal), hasSize(false), - isLayoutAnchor(false) {} + minSize(0), prefSize(0), expSize(0), maxSize(0), + sizeAtMinimum(0), sizeAtPreferred(0), + sizeAtExpanding(0), sizeAtMaximum(0), + graphicsAnchor(0), skipInPreferred(0), + type(Normal), hasSize(true), isLayoutAnchor(false) {} virtual void updateChildrenSizes() {} virtual void refreshSizeHints(qreal effectiveSpacing); @@ -189,9 +173,11 @@ struct AnchorData : public QSimplexVariable { { minSize = size; prefSize = size; + expSize = size; maxSize = size; sizeAtMinimum = size; sizeAtPreferred = size; + sizeAtExpanding = size; sizeAtMaximum = size; hasSize = true; } @@ -211,6 +197,7 @@ struct AnchorData : public QSimplexVariable { // size. qreal minSize; qreal prefSize; + qreal expSize; qreal maxSize; // These attributes define which sizes should that anchor be in when the @@ -218,6 +205,7 @@ struct AnchorData : public QSimplexVariable { // calculated by the Simplex solver based on the current layout setup. qreal sizeAtMinimum; qreal sizeAtPreferred; + qreal sizeAtExpanding; qreal sizeAtMaximum; QGraphicsAnchor *graphicsAnchor; @@ -225,15 +213,6 @@ struct AnchorData : public QSimplexVariable { uint type : 2; // either Normal, Sequential or Parallel uint hasSize : 1; // if false, get size from style. uint isLayoutAnchor : 1; // if this anchor is connected to a layout 'edge' -protected: - AnchorData(Type type, qreal size = 0) - : QSimplexVariable(), from(0), to(0), - minSize(size), prefSize(size), - maxSize(size), sizeAtMinimum(size), - sizeAtPreferred(size), sizeAtMaximum(size), - graphicsAnchor(0), - skipInPreferred(0), type(type), hasSize(true), - isLayoutAnchor(false) {} }; #ifdef QT_DEBUG @@ -245,8 +224,9 @@ inline QString AnchorData::toString() const struct SequentialAnchorData : public AnchorData { - SequentialAnchorData() : AnchorData(AnchorData::Sequential) + SequentialAnchorData() : AnchorData() { + type = AnchorData::Sequential; #ifdef QT_DEBUG name = QLatin1String("SequentialAnchorData"); #endif @@ -255,6 +235,8 @@ struct SequentialAnchorData : public AnchorData virtual void updateChildrenSizes(); virtual void refreshSizeHints(qreal effectiveSpacing); + void refreshSizeHints_helper(qreal effectiveSpacing, bool refreshChildren = true); + void setVertices(const QVector<AnchorVertex*> &vertices) { m_children = vertices; @@ -270,9 +252,10 @@ struct SequentialAnchorData : public AnchorData struct ParallelAnchorData : public AnchorData { ParallelAnchorData(AnchorData *first, AnchorData *second) - : AnchorData(AnchorData::Parallel), - firstEdge(first), secondEdge(second) + : AnchorData(), firstEdge(first), secondEdge(second) { + type = AnchorData::Parallel; + // ### Those asserts force that both child anchors have the same direction, // but can't we simplify a pair of anchors in opposite directions? Q_ASSERT(first->from == second->from); @@ -287,6 +270,8 @@ struct ParallelAnchorData : public AnchorData virtual void updateChildrenSizes(); virtual void refreshSizeHints(qreal effectiveSpacing); + void refreshSizeHints_helper(qreal effectiveSpacing, bool refreshChildren = true); + AnchorData* firstEdge; AnchorData* secondEdge; }; @@ -355,7 +340,8 @@ public: // Interval represents which interpolation interval are we operating in. enum Interval { MinToPreferred = 0, - PreferredToMax + PreferredToExpanding, + ExpandingToMax }; // Several structures internal to the layout are duplicated to handle @@ -457,6 +443,8 @@ public: void constraintsFromPaths(Orientation orientation); QList<QSimplexConstraint *> constraintsFromSizeHints(const QList<AnchorData *> &anchors); QList<QList<QSimplexConstraint *> > getGraphParts(Orientation orientation); + void identifyNonFloatItems(QSet<AnchorData *> visited, Orientation orientation); + void identifyNonFloatItems_helper(const AnchorData *ad, Orientation orientation); inline AnchorVertex *internalVertex(const QPair<QGraphicsLayoutItem*, Qt::AnchorPoint> &itemEdge) const { @@ -486,6 +474,7 @@ public: bool solveMinMax(QList<QSimplexConstraint *> constraints, GraphPath path, qreal *min, qreal *max); bool solvePreferred(QList<QSimplexConstraint *> constraints); + void solveExpanding(QList<QSimplexConstraint *> constraints); bool hasConflicts() const; #ifdef QT_DEBUG @@ -496,6 +485,7 @@ public: qreal spacings[NOrientations]; // Size hints from simplex engine qreal sizeHints[2][3]; + qreal sizeAtExpanding[2]; // Items QVector<QGraphicsLayoutItem *> items; @@ -521,6 +511,7 @@ public: // ### bool graphSimplified[2]; bool graphHasConflicts[2]; + QSet<QGraphicsLayoutItem *> m_nonFloatItems[2]; uint calculateGraphCacheDirty : 1; }; diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index 00fc204..b8f8fb4 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -285,24 +285,6 @@ bool QSimplex::setConstraints(const QList<QSimplexConstraint *> newConstraints) // anymore. clearColumns(firstArtificial, columns - 2); - #ifdef QT_DEBUG - // Ensure that at the end of the simplex each row should either: - // - Have a positive value on the column associated to its variable, or - // - Have zero values in all columns. - // - // This avoids a regression where restrictions would be lost - // due to randomness in the pivotRowForColumn method. - for (int i = 1; i < rows; ++i) { - int variableIndex = valueAt(i, 0); - if (valueAt(i, variableIndex) > 0) - continue; - - for (int j = 1; j < columns; ++j) { - Q_ASSERT(valueAt(i, j) == 0); - } - } - #endif - return true; } @@ -537,6 +519,12 @@ qreal QSimplex::solver(solverFactor factor) solveMaxHelper(); collectResults(); +#ifdef QT_DEBUG + for (int i = 0; i < constraints.size(); ++i) { + Q_ASSERT(constraints[i]->isSatisfied()); + } +#endif + return factor * valueAt(0, columns - 1); } diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h index 54b080d..51991a9 100644 --- a/src/gui/graphicsview/qsimplex_p.h +++ b/src/gui/graphicsview/qsimplex_p.h @@ -94,8 +94,32 @@ struct QSimplexConstraint QPair<QSimplexVariable *, qreal> helper; QSimplexVariable * artificial; -}; +#ifdef QT_DEBUG + bool isSatisfied() { + qreal leftHandSide(0); + + QHash<QSimplexVariable *, qreal>::const_iterator iter; + for (iter = variables.constBegin(); iter != variables.constEnd(); ++iter) { + leftHandSide += iter.value() * iter.key()->result; + } + + Q_ASSERT(constant > 0 || qFuzzyCompare(1, 1 + constant)); + + if (qFuzzyCompare(1000 + leftHandSide, 1000 + constant)) + return true; + + switch (ratio) { + case LessOrEqual: + return leftHandSide < constant; + case MoreOrEqual: + return leftHandSide > constant; + default: + return false; + } + } +#endif +}; class QSimplex { diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index fce4508..e0779a0 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -54,6 +54,7 @@ #include "qvariant.h" #include "qcache.h" #include "qdebug.h" +#include "private/qguiplatformplugin_p.h" #ifdef Q_WS_MAC #include <private/qt_mac_p.h> @@ -961,19 +962,10 @@ QString QIcon::themeName() */ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) { - static QCache <QString, QIcon> iconCache; QIcon icon; -#ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) { - icon = QKde::kdeIcon(name); - if (!icon.isNull()) - return icon; - } -#endif - if (iconCache.contains(name)) { icon = *iconCache.object(name); } else { diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index adc2967..5412e11 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -43,7 +43,7 @@ #include <private/qapplication_p.h> #include <private/qicon_p.h> -#include <private/qkde_p.h> +#include <private/qguiplatformplugin_p.h> #include <QtGui/QIconEnginePlugin> #include <QtGui/QPixmapCache> @@ -68,47 +68,25 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance) +/* Theme to use in last resort, if the theme does not have the icon, neither the parents */ static QString fallbackTheme() { - QString defaultTheme; -#ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_GNOME) - defaultTheme = QLatin1String("gnome"); - else if (X11->desktopEnvironment == DE_KDE) - defaultTheme = X11->desktopVersion >= 4 ? - QString::fromLatin1("oxygen") : - QString::fromLatin1("crystalsvg"); -#endif - return defaultTheme; -} - -static QString systemThemeName() -{ - QString result = fallbackTheme(); #ifdef Q_WS_X11 if (X11->desktopEnvironment == DE_GNOME) { -#ifndef QT_NO_STYLE_GTK - result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), - result); -#endif + return QLatin1String("gnome"); } else if (X11->desktopEnvironment == DE_KDE) { - QSettings settings(QKde::kdeHome() + - QLatin1String("/share/config/kdeglobals"), - QSettings::IniFormat); - - settings.beginGroup(QLatin1String("Icons")); - - result = settings.value(QLatin1String("Theme"), result).toString(); + return X11->desktopVersion >= 4 + ? QString::fromLatin1("oxygen") + : QString::fromLatin1("crystalsvg"); } #endif - return result; + return QString(); } - QIconLoader::QIconLoader() : m_themeKey(1), m_supportsSvg(false) { - m_systemTheme = systemThemeName(); + m_systemTheme = qt_guiPlatformPlugin()->systemIconThemeName(); QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid, QLatin1String("/iconengines"), @@ -128,7 +106,7 @@ void QIconLoader::updateSystemTheme() { // Only change if this is not explicitly set by the user if (m_userTheme.isEmpty()) { - QString theme = systemThemeName(); + QString theme = qt_guiPlatformPlugin()->systemIconThemeName(); if (theme != m_systemTheme) { m_systemTheme = theme; invalidateKey(); @@ -152,51 +130,7 @@ void QIconLoader::setThemeSearchPath(const QStringList &searchPaths) QStringList QIconLoader::themeSearchPaths() const { if (m_iconDirs.isEmpty()) { - -#if defined(Q_WS_X11) - - QString xdgDirString = QFile::decodeName(getenv("XDG_DATA_DIRS")); - if (xdgDirString.isEmpty()) - xdgDirString = QLatin1String("/usr/local/share/:/usr/share/"); - - QStringList xdgDirs = xdgDirString.split(QLatin1Char(':')); - - for (int i = 0 ; i < xdgDirs.size() ; ++i) { - QDir dir(xdgDirs[i]); - if (dir.exists()) - m_iconDirs.append(dir.path() + - QLatin1String("/icons")); - } - - if (X11->desktopEnvironment == DE_KDE) { - - m_iconDirs << QLatin1Char(':') + - QKde::kdeHome() + - QLatin1String("/share/icons"); - QStringList kdeDirs = - QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':')); - - for (int i = 0 ; i< kdeDirs.count() ; ++i) { - QDir dir(QLatin1Char(':') + kdeDirs.at(i) + - QLatin1String("/share/icons")); - if (dir.exists()) - m_iconDirs.append(dir.path()); - } - } - - // Add home directory first in search path - QDir homeDir(QDir::homePath() + QLatin1String("/.icons")); - if (homeDir.exists()) - m_iconDirs.prepend(homeDir.path()); -#endif - -#if defined(Q_WS_WIN) - m_iconDirs.append(qApp->applicationDirPath() + - QLatin1String("/icons")); -#elif defined(Q_WS_MAC) - m_iconDirs.append(qApp->applicationDirPath() + - QLatin1String("/../Resources/icons")); -#endif + m_iconDirs = qt_guiPlatformPlugin()->iconThemeSearchPaths(); // Allways add resource directory as search path m_iconDirs.append(QLatin1String(":/icons")); } @@ -291,7 +225,7 @@ QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName, if (!theme.isValid()) { theme = QIconTheme(themeName); if (!theme.isValid()) - theme = fallbackTheme(); + theme = QIconTheme(fallbackTheme()); themeList.insert(themeName, theme); } diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 37b6438..554c0f3 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -229,24 +229,15 @@ static CFbsBitmap* uncompress(CFbsBitmap* bitmap) lock.relock(); - CBitmapContext *bitmapContext = 0; CFbsBitmapDevice* bitmapDevice = 0; + CFbsBitGc *bitmapGc = 0; QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(uncompressed)); - TInt err = bitmapDevice->CreateBitmapContext(bitmapContext); - if (err != KErrNone) { - delete bitmap; - delete bitmapDevice; - bitmap = 0; - bitmapDevice = 0; - - lock.relock(); + QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); + bitmapGc->Activate(bitmapDevice); - return bitmap; - } + bitmapGc->DrawBitmap(TPoint(), bitmap); - bitmapContext->DrawBitmap(TPoint(), bitmap); - - delete bitmapContext; + delete bitmapGc; delete bitmapDevice; return uncompressed; @@ -355,7 +346,7 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), symbianBitmapDataAccess(new QSymbianBitmapDataAccess), cfbsBitmap(0), bitmapDevice(0), - bitmapContext(0), + bitmapGc(0), pengine(0), bytes(0) { @@ -365,6 +356,7 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), QS60PixmapData::~QS60PixmapData() { release(); + delete symbianBitmapDataAccess; } void QS60PixmapData::resize(int width, int height) @@ -391,6 +383,8 @@ void QS60PixmapData::resize(int width, int height) if(cfbsBitmap->SizeInPixels() != newSize) { cfbsBitmap->Resize(TSize(width, height)); + bitmapDevice->Resize(TSize(width, height)); + bitmapGc->Resized(); if(pengine) { delete pengine; pengine = 0; @@ -404,12 +398,9 @@ void QS60PixmapData::resize(int width, int height) bool QS60PixmapData::initSymbianBitmapContext() { QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(cfbsBitmap)); - TInt err = bitmapDevice->CreateBitmapContext(bitmapContext); - if (err != KErrNone) { - delete bitmapDevice; - bitmapDevice = 0; - return false; - } + QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); + bitmapGc->Activate(bitmapDevice); + return true; } @@ -417,7 +408,7 @@ void QS60PixmapData::release() { if (cfbsBitmap) { QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); - delete bitmapContext; + delete bitmapGc; delete bitmapDevice; delete cfbsBitmap; lock.relock(); @@ -426,7 +417,7 @@ void QS60PixmapData::release() delete pengine; image = QImage(); cfbsBitmap = 0; - bitmapContext = 0; + bitmapGc = 0; bitmapDevice = 0; pengine = 0; bytes = 0; @@ -559,13 +550,15 @@ void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect) resize(rect.width(), rect.height()); cfbsBitmap->SetDisplayMode(s60Data->cfbsBitmap->DisplayMode()); - bitmapContext->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect)); + bitmapGc->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect)); } bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) { - bitmapContext->CopyRect(TPoint(dx, dy), qt_QRect2TRect(rect)); - return true; + beginDataAccess(); + bool res = QRasterPixmapData::scroll(dx, dy, rect); + endDataAccess(); + return res; } int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index 4498c05..b23961a 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE class CFbsBitmap; class CFbsBitmapDevice; -class CBitmapContext; +class CFbsBitGc; class QSymbianBitmapDataAccess; @@ -114,7 +114,7 @@ private: CFbsBitmap *cfbsBitmap; CFbsBitmapDevice *bitmapDevice; - CBitmapContext *bitmapContext; + CFbsBitGc *bitmapGc; QPaintEngine *pengine; uchar* bytes; diff --git a/src/gui/inputmethod/qwininputcontext_p.h b/src/gui/inputmethod/qwininputcontext_p.h index 39d50fd..dd0490d 100644 --- a/src/gui/inputmethod/qwininputcontext_p.h +++ b/src/gui/inputmethod/qwininputcontext_p.h @@ -56,6 +56,19 @@ #include "QtGui/qinputcontext.h" #include "QtCore/qt_windows.h" +#if defined(Q_CC_MINGW) && !defined(IMR_RECONVERTSTRING) +typedef struct tagRECONVERTSTRING { + DWORD dwSize; + DWORD dwVersion; + DWORD dwStrLen; + DWORD dwStrOffset; + DWORD dwCompStrLen; + DWORD dwCompStrOffset; + DWORD dwTargetStrLen; + DWORD dwTargetStrOffset; +} RECONVERTSTRING, *PRECONVERTSTRING; +#endif + QT_BEGIN_NAMESPACE class QWinInputContext : public QInputContext diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp index 4a160d7..e9ab870 100644 --- a/src/gui/inputmethod/qwininputcontext_win.cpp +++ b/src/gui/inputmethod/qwininputcontext_win.cpp @@ -701,7 +701,7 @@ void QWinInputContext::updateImeStatus(QWidget *w, bool hasFocus) if (!focusProxyWidget) focusProxyWidget = w; bool e = w->testAttribute(Qt::WA_InputMethodEnabled) && w->isEnabled() - && !(focusProxyWidget->inputMethodHints() & Qt::ImhExclusiveInputMask); + && !(focusProxyWidget->inputMethodHints() & (Qt::ImhExclusiveInputMask | Qt::ImhHiddenText)); bool hasIme = e && hasFocus; #ifdef Q_IME_DEBUG qDebug("%s HasFocus = %d hasIme = %d e = %d ", w->className(), hasFocus, hasIme, e); diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/gui/inputmethod/qximinputcontext_x11.cpp index bee3ce8..b46b162 100644 --- a/src/gui/inputmethod/qximinputcontext_x11.cpp +++ b/src/gui/inputmethod/qximinputcontext_x11.cpp @@ -612,7 +612,7 @@ void QXIMInputContext::setFocusWidget(QWidget *w) QInputContext::setFocusWidget(w); - if (!w || w->inputMethodHints() & Qt::ImhExclusiveInputMask) + if (!w || w->inputMethodHints() & (Qt::ImhExclusiveInputMask | Qt::ImhHiddenText)) return; ICData *data = ximData.value(w->effectiveWinId()); diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 27528de..37f4184 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -761,7 +761,7 @@ void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) } } d->itemDelegate = delegate; - update(); + viewport()->update(); } /*! @@ -826,7 +826,7 @@ void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *de } d->rowDelegates.insert(row, delegate); } - update(); + viewport()->update(); } /*! @@ -883,7 +883,7 @@ void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelega } d->columnDelegates.insert(column, delegate); } - update(); + viewport()->update(); } /*! diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index c78a49b..e3d17ad 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -61,6 +61,7 @@ #endif #include <private/qfunctions_p.h> +#include <private/qguiplatformplugin_p.h> #ifndef SHGFI_ADDOVERLAYS #define SHGFI_ADDOVERLAYS 0x000000020 @@ -385,6 +386,10 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const { Q_D(const QFileIconProvider); + QIcon platformIcon = qt_guiPlatformPlugin()->fileSystemIcon(info); + if (!platformIcon.isNull()) + return platformIcon; + #if defined(Q_WS_X11) && !defined(QT_NO_STYLE_GTK) if (X11->desktopEnvironment == DE_GNOME) { QIcon gtkIcon = QGtk::getFilesystemIcon(info); diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index fc9820f..a754579 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -524,8 +524,10 @@ QSize QHeaderView::sizeHint() const Q_D(const QHeaderView); if (d->cachedSizeHint.isValid()) return d->cachedSizeHint; - d->cachedSizeHint = QSize(0, 0); //reinitialize the cached size hint + int width = 0; + int height = 0; const int sectionCount = count(); + d->executePostedLayout(); // get size hint for the first n sections int i = 0; diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 7cde384..760d73c 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -47,7 +47,8 @@ HEADERS += \ kernel/qgesture_p.h \ kernel/qstandardgestures.h \ kernel/qstandardgestures_p.h \ - kernel/qsoftkeymanager_p.h + kernel/qsoftkeymanager_p.h \ + kernel/qguiplatformplugin_p.h SOURCES += \ kernel/qaction.cpp \ @@ -79,7 +80,8 @@ SOURCES += \ kernel/qkeymapper.cpp \ kernel/qgesture.cpp \ kernel/qstandardgestures.cpp \ - kernel/qsoftkeymanager.cpp + kernel/qsoftkeymanager.cpp \ + kernel/qguiplatformplugin.cpp win32 { DEFINES += QT_NO_DIRECTDRAW diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 044fedd..43addb6 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -84,6 +84,8 @@ #include "qinputcontextfactory.h" #endif +#include "qguiplatformplugin_p.h" + #include <qthread.h> #include <private/qthread_p.h> @@ -788,6 +790,9 @@ void QApplicationPrivate::construct( qCritical("Library qttestability load failed!"); } } + + //make sure the plugin is loaded + qt_guiPlatformPlugin(); #endif } @@ -1955,38 +1960,7 @@ void QApplicationPrivate::setSystemFont(const QFont &font) */ QString QApplicationPrivate::desktopStyleKey() { -QString desktopstyle; -#if defined(Q_WS_WIN) && defined(Q_WS_WINCE) - if (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()) - desktopstyle = QLatin1String("WindowsMobile"); - else - desktopstyle = QLatin1String("WindowsCE"); - -#elif defined(Q_WS_WIN) - if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) - desktopstyle = QLatin1String("WindowsVista"); - else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) - desktopstyle = QLatin1String("WindowsXP"); - else - desktopstyle = QLatin1String("Windows"); // default styles for Windows -#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS) - desktopstyle = QLatin1String("CDE"); // default style for X11 on Solaris -#elif defined(Q_WS_S60) - desktopstyle = QLatin1String("S60"); // default style for Symbian with S60 -#elif defined(Q_OS_SYMBIAN) - desktopstyle = QLatin1String("Windows"); // default style for Symbian without S60 -#elif defined(Q_WS_X11) && defined(Q_OS_IRIX) - desktopstyle = QLatin1String("SGI"); // default style for X11 on IRIX -#elif defined(Q_WS_QWS) - desktopstyle = QLatin1String("Plastique"); // default style for X11 and small devices -#elif defined(Q_WS_X11) - desktopstyle = QApplicationPrivate::x11_desktop_style(); // default runtime dependant style for X11 -#elif defined(Q_WS_MAC) - desktopstyle = QLatin1String("Macintosh"); // default style for all Mac's -#endif - return desktopstyle; + return qt_guiPlatformPlugin()->styleName(); } /*! diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index a95ae9d..f9c8aa3 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1708,12 +1708,30 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event sizeof(axis), 0, &axis); // The 'new' event has acceleration applied by the OS, while the old (on - // Carbon only), has not. So we introduce acceleration here to be consistent: - int scrollFactor = 120 * qMin(5, qAbs(mdelt)); + // Carbon only), has not. So we introduce acceleration here to be consistent. + // The acceleration is trying to respect both pixel based and line scrolling, + // which turns out to be rather difficult. + int linesToScroll = mdelt > 0 ? 1 : -1; + static QTime t; + int elapsed = t.elapsed(); + t.restart(); + if (elapsed < 20) + linesToScroll *= 120; + else if (elapsed < 30) + linesToScroll *= 60; + else if (elapsed < 50) + linesToScroll *= 30; + else if (elapsed < 100) + linesToScroll *= 6; + else if (elapsed < 200) + linesToScroll *= 3; + else if (elapsed < 300) + linesToScroll *= 2; + if (axis == kEventMouseWheelAxisX) - wheel_deltaX = mdelt * scrollFactor; + wheel_deltaX = linesToScroll * 120; else - wheel_deltaY = mdelt * scrollFactor; + wheel_deltaY = linesToScroll * 120; } } diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 6036196..95b6d28 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -305,7 +305,6 @@ public: #if defined(Q_WS_X11) #ifndef QT_NO_SETTINGS - static QString x11_desktop_style(); static bool x11_apply_settings(); #endif static void reset_instance_pointer(); diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 44f82b6..270562f 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -171,10 +171,13 @@ typedef struct tagTOUCHINPUT #include <mywinsock.h> #endif +#ifndef IMR_RECONVERTSTRING +#define IMR_RECONVERTSTRING 4 +#endif + #ifndef IMR_CONFIRMRECONVERTSTRING #define IMR_CONFIRMRECONVERTSTRING 0x0005 #endif - QT_BEGIN_NAMESPACE #ifdef Q_WS_WINCE diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index e46a370..bf95684 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -85,6 +85,7 @@ #include "qtimer.h" #include "qlibrary.h" #include <private/qgraphicssystemfactory_p.h> +#include "qguiplatformplugin_p.h" #include "qkde_p.h" #if !defined (QT_NO_TABLET) @@ -919,7 +920,7 @@ bool QApplicationPrivate::x11_apply_settings() QString stylename = settings.value(QLatin1String("style")).toString(); if (stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull() && X11->use_xrender) { - stylename = x11_desktop_style(); + stylename = qt_guiPlatformPlugin()->styleName(); } static QString currentStyleName = stylename; @@ -1313,8 +1314,7 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue); } - if (kdeColors) - pal = QKde::kdePalette().resolve(pal); + pal = qt_guiPlatformPlugin()->palette().resolve(pal); QApplicationPrivate::setSystemPalette(pal); QColor::setAllowX11ColorNames(allowX11ColorNames); } @@ -2560,42 +2560,6 @@ void qt_init(QApplicationPrivate *priv, int, #endif } - - // run-time search for default style -/*! - \internal -*/ -QString QApplicationPrivate::x11_desktop_style() -{ - QString stylename; - switch(X11->desktopEnvironment) { - case DE_KDE: - stylename = QKde::kdeStyle(); - break; - case DE_GNOME: { - QStringList availableStyles = QStyleFactory::keys(); - // Set QGtkStyle for GNOME if available - QString gtkStyleKey = QString::fromLatin1("GTK+"); - if (availableStyles.contains(gtkStyleKey)) { - stylename = gtkStyleKey; - break; - } - if (X11->use_xrender) - stylename = QLatin1String("cleanlooks"); - else - stylename = QLatin1String("windows"); - break; - } - case DE_CDE: - stylename = QLatin1String("cde"); - break; - default: - // Don't do anything - break; - } - return stylename; -} - void QApplicationPrivate::initializeWidgetPaletteHash() { } diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp new file mode 100644 index 0000000..6e074a1 --- /dev/null +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -0,0 +1,296 @@ +/**************************************************************************** +** +** 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 QtGui module 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 "qguiplatformplugin_p.h" +#include <qdebug.h> +#include <qfile.h> +#include <qdir.h> +#include <qsettings.h> +#include "private/qfactoryloader_p.h" +#include "qstylefactory.h" +#include "qapplication.h" +#include "qplatformdefs.h" +#include "qicon.h" + +#ifdef Q_WS_WINCE +#include "qguifunctions_wince.h" +extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp +extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp +extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp +#endif + + +#if defined(Q_WS_X11) +#include "qkde_p.h" +#include "qt_x11_p.h" +#include <private/gtksymbols_p.h> +#endif + + +QT_BEGIN_NAMESPACE + + +/*! \internal + Return (an construct if necesseray) the Gui Platform plugin. + + The plugin key to be loaded is inside the QT_PLATFORM_PLUGIN environment variable. + If it is not set, it will be the DESKTOP_SESSION on X11. + + If no plugin can be loaded, the default one is returned. + */ +QGuiPlatformPlugin *qt_guiPlatformPlugin() +{ + static QGuiPlatformPlugin *plugin; + if (!plugin) + { +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + + QString key = QString::fromLocal8Bit(qgetenv("QT_PLATFORM_PLUGIN")); +#ifdef Q_WS_X11 + if (key.isEmpty()) { + switch(X11->desktopEnvironment) { + case DE_KDE: + key = QString::fromLatin1("kde"); + break; + default: + key = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION")); + break; + } + } +#endif + + if (!key.isEmpty() && QApplication::desktopSettingsAware()) { + QFactoryLoader loader(QGuiPlatformPluginInterface_iid, QLatin1String("/gui_platform")); + plugin = qobject_cast<QGuiPlatformPlugin *>(loader.instance(key)); + } +#endif // QT_NO_LIBRARY + + if(!plugin) { + static QGuiPlatformPlugin def; + plugin = &def; + } + } + return plugin; +} + + +/* \class QPlatformPlugin + QGuiPlatformPlugin can be used to integrate Qt applications in a platform built on top of Qt. + The application developer should not know or use the plugin, it is only used by Qt internaly. + + But full platform that are built on top of Qt may provide a plugin so 3rd party Qt application + running in the platform are integrated. + */ + +/* + The constructor can be used to install hooks in Qt + */ +QGuiPlatformPlugin::QGuiPlatformPlugin(QObject *parent) : QObject(parent) {} +QGuiPlatformPlugin::~QGuiPlatformPlugin() {} + + +/* return the string key to be used by default the application */ +QString QGuiPlatformPlugin::styleName() +{ +#if defined(Q_WS_WIN) && defined(Q_WS_WINCE) + if (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()) + return QLatin1String("WindowsMobile"); + else + return QLatin1String("WindowsCE"); +#elif defined(Q_WS_WIN) + if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA + && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + return QLatin1String("WindowsVista"); + else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP + && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + return QLatin1String("WindowsXP"); + else + return QLatin1String("Windows"); // default styles for Windows +#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS) + return QLatin1String("CDE"); // default style for X11 on Solaris +#elif defined(Q_WS_S60) + return QLatin1String("S60"); // default style for Symbian with S60 +#elif defined(Q_OS_SYMBIAN) + return QLatin1String("Windows"); // default style for Symbian without S60 +#elif defined(Q_WS_X11) && defined(Q_OS_IRIX) + return QLatin1String("SGI"); // default style for X11 on IRIX +#elif defined(Q_WS_QWS) + return QLatin1String("Plastique"); // default style for X11 and small devices +#elif defined(Q_WS_MAC) + return QLatin1String("Macintosh"); // default style for all Mac's +#elif defined(Q_WS_X11) + QString stylename; + switch(X11->desktopEnvironment) { + case DE_KDE: + stylename = QKde::kdeStyle(); + break; + case DE_GNOME: { + QStringList availableStyles = QStyleFactory::keys(); + // Set QGtkStyle for GNOME if available + QString gtkStyleKey = QString::fromLatin1("GTK+"); + if (availableStyles.contains(gtkStyleKey)) { + stylename = gtkStyleKey; + break; + } + if (X11->use_xrender) + stylename = QLatin1String("cleanlooks"); + else + stylename = QLatin1String("windows"); + break; + } + case DE_CDE: + stylename = QLatin1String("cde"); + break; + default: + // Don't do anything + break; + } + return stylename; +#endif +} + +/* return an aditional default palette (only work on X11) */ +QPalette QGuiPlatformPlugin::palette() +{ +#ifdef Q_WS_X11 + if (QApplication::desktopSettingsAware() && X11->desktopEnvironment == DE_KDE) + return QKde::kdePalette(); +#endif + + return QPalette(); +} + +/* the default icon theme name for QIcon::fromTheme. */ +QString QGuiPlatformPlugin::systemIconThemeName() +{ + QString result; +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_GNOME) { + result = QString::fromLatin1("gnome"); +#ifndef QT_NO_STYLE_GTK + result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), result); +#endif + } else if (X11->desktopEnvironment == DE_KDE) { + result = X11->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); + QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); + settings.beginGroup(QLatin1String("Icons")); + result = settings.value(QLatin1String("Theme"), result).toString(); + } +#endif + return result; +} + + +QStringList QGuiPlatformPlugin::iconThemeSearchPaths() +{ + QStringList paths; +#if defined(Q_WS_X11) + QString xdgDirString = QFile::decodeName(getenv("XDG_DATA_DIRS")); + if (xdgDirString.isEmpty()) + xdgDirString = QLatin1String("/usr/local/share/:/usr/share/"); + + QStringList xdgDirs = xdgDirString.split(QLatin1Char(':')); + + for (int i = 0 ; i < xdgDirs.size() ; ++i) { + QDir dir(xdgDirs[i]); + if (dir.exists()) + paths.append(dir.path() + QLatin1String("/icons")); + } + if (X11->desktopEnvironment == DE_KDE) { + paths << QLatin1Char(':') + QKde::kdeHome() + QLatin1String("/share/icons"); + QStringList kdeDirs = QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':')); + for (int i = 0 ; i< kdeDirs.count() ; ++i) { + QDir dir(QLatin1Char(':') + kdeDirs.at(i) + QLatin1String("/share/icons")); + if (dir.exists()) + paths.append(dir.path()); + } + } + + // Add home directory first in search path + QDir homeDir(QDir::homePath() + QLatin1String("/.icons")); + if (homeDir.exists()) + paths.prepend(homeDir.path()); +#endif + +#if defined(Q_WS_WIN) + paths.append(qApp->applicationDirPath() + QLatin1String("/icons")); +#elif defined(Q_WS_MAC) + paths.append(qApp->applicationDirPath() + QLatin1String("/../Resources/icons")); +#endif + return paths; +} + +/* backend for QFileIconProvider, null icon means default */ +QIcon QGuiPlatformPlugin::fileSystemIcon(const QFileInfo &) +{ + return QIcon(); +} + +/* Like QStyle::styleHint */ +int QGuiPlatformPlugin::platformHint(PlatformHint hint) +{ + int ret = 0; + switch(hint) + { + case PH_ToolButtonStyle: + ret = Qt::ToolButtonIconOnly; +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4 + && QApplication::desktopSettingsAware()) { + ret = QKde::kdeToolButtonStyle(); + } +#endif + break; + case PH_ToolBarIconSize: +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4 + && QApplication::desktopSettingsAware()) { + ret = QKde::kdeToolBarIconSize(); + } +#endif + //by default keep ret = 0 so QCommonStyle will use the style default + break; + } + return ret; +} + + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qguiplatformplugin_p.h b/src/gui/kernel/qguiplatformplugin_p.h new file mode 100644 index 0000000..2a70ee7 --- /dev/null +++ b/src/gui/kernel/qguiplatformplugin_p.h @@ -0,0 +1,126 @@ +/**************************************************************************** +** +** 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 QtGui module 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 QGUIPLATFORM_P_H +#define QGUIPLATFORM_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QtCore/qplugin.h> +#include <QtCore/qfactoryinterface.h> +#include <QtGui/qdialog.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStyle; +class QPalette; +class QIcon; +class QFileDialog; +class QColorDialog; +class QFileInfo; + +struct Q_GUI_EXPORT QGuiPlatformPluginInterface : public QFactoryInterface +{ +}; + +#define QGuiPlatformPluginInterface_iid "com.nokia.qt.QGuiPlatformPluginInterface" + +Q_DECLARE_INTERFACE(QGuiPlatformPluginInterface, QGuiPlatformPluginInterface_iid) + +class Q_GUI_EXPORT QGuiPlatformPlugin : public QObject, public QGuiPlatformPluginInterface +{ + Q_OBJECT + Q_INTERFACES(QGuiPlatformPluginInterface:QFactoryInterface) + public: + explicit QGuiPlatformPlugin(QObject *parent = 0); + ~QGuiPlatformPlugin(); + + virtual QStringList keys() const { return QStringList() << QLatin1String("default"); }; + + virtual QString styleName(); + virtual QPalette palette(); + virtual QString systemIconThemeName(); + virtual QStringList iconThemeSearchPaths(); + virtual QIcon fileSystemIcon(const QFileInfo &); + + enum PlatformHint { PH_ToolButtonStyle, PH_ToolBarIconSize, PH_ItemView_ActivateItemOnSingleClick }; + virtual int platformHint(PlatformHint hint); + + + virtual void fileDialogDelete(QFileDialog *) {} + virtual bool fileDialogSetVisible(QFileDialog *, bool) { return false; } + virtual QDialog::DialogCode fileDialogResultCode(QFileDialog *) { return QDialog::Rejected; } + virtual void fileDialogSetDirectory(QFileDialog *, const QString &) {} + virtual QString fileDialogDirectory(const QFileDialog *) const { return QString(); } + virtual void fileDialogSelectFile(QFileDialog *, const QString &) {} + virtual QStringList fileDialogSelectedFiles(const QFileDialog *) const { return QStringList(); } + virtual void fileDialogSetFilter(QFileDialog *) {} + virtual void fileDialogSetNameFilters(QFileDialog *, const QStringList &) {} + virtual void fileDialogSelectNameFilter(QFileDialog *, const QString &) {} + virtual QString fileDialogSelectedNameFilter(const QFileDialog *) const { return QString(); } + + virtual void colorDialogDelete(QColorDialog *) {} + virtual bool colorDialogSetVisible(QColorDialog *, bool) { return false; } + virtual void colorDialogSetCurrentColor(QColorDialog *, const QColor &) {} +}; + +//internal +QGuiPlatformPlugin *qt_guiPlatformPlugin(); + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif // QGUIPLATFORMPLUGIN_H diff --git a/src/gui/kernel/qkde.cpp b/src/gui/kernel/qkde.cpp index 6c8909f..edc53ac 100644 --- a/src/gui/kernel/qkde.cpp +++ b/src/gui/kernel/qkde.cpp @@ -141,14 +141,33 @@ QString QKde::kdeStyle() return QLatin1String("windows"); } -/*!\internal - placeholder to load icon from kde. - to be implemented - */ -QIcon QKde::kdeIcon(const QString &name) + +int QKde::kdeToolButtonStyle() +{ + QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), + QSettings::IniFormat); + settings.beginGroup(QLatin1String("Toolbar style")); + QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString(); + if (toolbarStyle == QLatin1String("TextBesideIcon")) + return Qt::ToolButtonTextBesideIcon; + else if (toolbarStyle == QLatin1String("TextOnly")) + return Qt::ToolButtonTextOnly; + else if (toolbarStyle == QLatin1String("TextUnderIcon")) + return Qt::ToolButtonTextUnderIcon; + + return Qt::ToolButtonTextBesideIcon; +} + +int QKde::kdeToolBarIconSize() { - //###todo - return QIcon(); + static int iconSize = -1; + if (iconSize == -1) { + QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), + QSettings::IniFormat); + settings.beginGroup(QLatin1String("ToolbarIcons")); + iconSize = settings.value(QLatin1String("Size")).toInt(); + } + return iconSize; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qkde_p.h b/src/gui/kernel/qkde_p.h index 4063f0e..c22a145 100644 --- a/src/gui/kernel/qkde_p.h +++ b/src/gui/kernel/qkde_p.h @@ -61,12 +61,17 @@ QT_BEGIN_NAMESPACE -// This namespace contains helper function to help KDE integration +/*!\internal + This namespace contains helper function to help KDE integration + They are only used if we detect the use of KDE and the KDE platform plugin is not found (old KDE version) + Or if the detected KDE version is KDE3 +*/ namespace QKde { QString kdeHome(); QString kdeStyle(); QPalette kdePalette(); - QIcon kdeIcon(const QString &name); + int kdeToolButtonStyle(); + int kdeToolBarIconSize(); } diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index 10958f3..be207df 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -905,8 +905,8 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool if(msg.wParam == VK_PROCESSKEY) return true; - // Ignore invalid virtual keycode (see bug 127424) - if (msg.wParam == 0xFF) + // Ignore invalid virtual keycodes (see bugs 127424, QTBUG-3630) + if (msg.wParam == 0 || msg.wParam == 0xFF) return true; // Translate VK_* (native) -> Key_* (Qt) keys diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 265f971..cd3ad22 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -112,7 +112,7 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act { const char* text = standardSoftKeyText(standardKey); QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget); - QAction::SoftKeyRole softKeyRole; + QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; switch (standardKey) { case OkSoftKey: case SelectSoftKey: @@ -121,7 +121,6 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act softKeyRole = QAction::PositiveSoftKey; break; case CancelSoftKey: - default: softKeyRole = QAction::NegativeSoftKey; break; } diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h index c4bb84d..b455445 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/gui/kernel/qsoftkeymanager_p.h @@ -74,7 +74,7 @@ public: SelectSoftKey, DoneSoftKey, MenuSoftKey, - CancelSoftKey, + CancelSoftKey }; static void updateSoftKeys(); diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 3328cee..b0d405a 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -434,7 +434,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de void QWidgetPrivate::show_sys() { Q_Q(QWidget); - + if (q->testAttribute(Qt::WA_OutsideWSRange)) return; @@ -490,7 +490,12 @@ void QWidgetPrivate::hide_sys() QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId()); if (id) { - if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + //Incorrect optimisation - for popup windows, Qt's focus is moved before + //hide_sys is called, resulting in the popup window keeping its elevated + //position in the CONE control stack. + //This can result in keyboard focus being in an invisible widget in some + //conditions - e.g. QTBUG-4733 + //if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->setFocusSafely(false); id->MakeVisible(false); if (QWidgetBackingStore *bs = maybeBackingStore()) @@ -1253,7 +1258,7 @@ void QWidget::grabMouse() WId id = effectiveWinId(); id->SetPointerCapture(true); QWidgetPrivate::mouseGrabber = this; - + #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(cursor()); #endif diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index c20d8d8..1182b9a 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1147,8 +1147,8 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin yTarget[rows - 1] = targetCenterBottom; yTarget[rows] = targetRect.top() + targetRect.height(); - qreal dx; - qreal dy; + qreal dx = targetCenterWidth; + qreal dy = targetCenterHeight; switch (rules.horizontal) { case Qt::StretchTile: diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index d712669..195be0a 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -932,7 +932,7 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con fill(path, brush); } -void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints) +void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints /*hints*/) { qreal oldOpacity = state()->opacity; QTransform oldTransform = state()->matrix; diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 664ad48..dc4e43b 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -85,7 +85,9 @@ QS60WindowSurface::~QS60WindowSurface() void QS60WindowSurface::beginPaint(const QRegion &rgn) { if (!qt_widget_private(window())->isOpaque) { - QImage image = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data())->image; + QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data()); + pixmapData->beginDataAccess(); + QImage &image = pixmapData->image; QRgb *data = reinterpret_cast<QRgb *>(image.bits()); const int row_stride = image.bytesPerLine() / 4; @@ -103,6 +105,7 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) row += row_stride; } } + pixmapData->endDataAccess(); } } diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index df4f866..5886512 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -63,7 +63,6 @@ #include <qtoolbar.h> #include <qtoolbutton.h> #include <qrubberband.h> -#include <../kernel/qkde_p.h> #include <private/qcommonstylepixmaps_p.h> #include <private/qmath_p.h> #include <private/qstylehelper_p.h> @@ -75,6 +74,7 @@ #include <qdir.h> #include <qsettings.h> #include <qpixmapcache.h> +#include <private/qguiplatformplugin_p.h> #include <limits.h> @@ -837,35 +837,6 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut } #endif // QT_NO_TOOLBUTTON - -#ifdef Q_WS_X11 // These functions are used to parse the X11 freedesktop icon spec - -/*!internal - -Checks if you are running KDE and looks up the toolbar -from the KDE configuration file - -*/ -int QCommonStylePrivate::lookupToolButtonStyle() const -{ - int result = Qt::ToolButtonIconOnly; - if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4) { - QSettings settings(QKde::kdeHome() + - QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); - settings.beginGroup(QLatin1String("Toolbar style")); - QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString(); - if (toolbarStyle == QLatin1String("TextBesideIcon")) - result = Qt::ToolButtonTextBesideIcon; - else if (toolbarStyle == QLatin1String("TextOnly")) - result = Qt::ToolButtonTextOnly; - else if (toolbarStyle == QLatin1String("TextUnderIcon")) - result = Qt::ToolButtonTextUnderIcon; - } - return result; -} - -#endif //Q_WS_X11 - #ifndef QT_NO_ITEMVIEWS QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, int role) const @@ -4688,19 +4659,8 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; case PM_ToolBarIconSize: -#ifdef Q_WS_X11 - if (X11->desktopVersion >= 4) { - static int iconSize = 0; - if (!iconSize) { - QSettings settings(QKde::kdeHome() + - QLatin1String("/share/config/kdeglobals"), - QSettings::IniFormat); - settings.beginGroup(QLatin1String("ToolbarIcons")); - iconSize = settings.value(QLatin1String("Size"), QLatin1String("22")).toInt(); - } - ret = iconSize; - } else -#endif + ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ToolBarIconSize); + if (!ret) ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); break; @@ -5098,7 +5058,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget break; case SH_ItemView_ActivateItemOnSingleClick: - ret = false; + ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ItemView_ActivateItemOnSingleClick); break; case SH_TitleBar_ModifyNotification: @@ -5192,13 +5152,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = true; break; case SH_ToolButtonStyle: - ret = Qt::ToolButtonIconOnly; -#ifdef Q_WS_X11 - { - static int buttonStyle = d_func()->lookupToolButtonStyle(); - return buttonStyle; - } -#endif + ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ToolButtonStyle); break; case SH_RequestSoftwareInputPanel: ret = RSIP_OnMouseClickAndAlreadyFocused; diff --git a/src/gui/styles/qcommonstyle_p.h b/src/gui/styles/qcommonstyle_p.h index 7162392..a905601 100644 --- a/src/gui/styles/qcommonstyle_p.h +++ b/src/gui/styles/qcommonstyle_p.h @@ -122,7 +122,6 @@ public: } #endif mutable QIcon tabBarcloseButtonIcon; - int lookupToolButtonStyle() const; #ifndef QT_NO_TABBAR void tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *pixmapRect) const; #endif diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 5052755..ce2109a 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -3309,7 +3309,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op // Draw the text centered QFont font = painter->font(); - font.setPointSize(font.pointSize() - 1); + font.setPointSize(QFontInfo(font).pointSize() - 1); painter->setFont(font); painter->setPen(dockWidget->palette.windowText().color()); painter->drawText(titleRect, diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index e5a88fc..21b9cca 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1160,7 +1160,7 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QVector<QRgb>, qt_grayPalette, { QRgb *it = x->data(); for (int i = 0; i < x->size(); ++i, ++it) *it = 0xff000000 | i | (i<<8) | (i<<16); -}); +}) const QVector<QRgb> &QFontEngine::grayPalette() { diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 9ae3a15..c0bd5e7 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -41,6 +41,7 @@ #include <qsettings.h> #include <qdir.h> +#include <qlibrary.h> #include <qurl.h> #include <qstringlist.h> #include <qprocess.h> @@ -58,6 +59,11 @@ # endif #endif +#if defined(Q_CC_MINGW) && !defined(CSIDL_MYMUSIC) +#define CSIDL_MYMUSIC 13 +#define CSIDL_MYVIDEO 14 +#endif + #ifndef QT_NO_DESKTOPSERVICES QT_BEGIN_NAMESPACE @@ -168,50 +174,76 @@ static bool launchWebBrowser(const QUrl &url) QString QDesktopServices::storageLocation(StandardLocation type) { -#if !defined(QT_NO_SETTINGS) - QSettings settings(QSettings::UserScope, QLatin1String("Microsoft"), QLatin1String("Windows")); - settings.beginGroup(QLatin1String("CurrentVersion/Explorer/Shell Folders")); + QString result; + +#ifndef Q_OS_WINCE + QLibrary library(QLatin1String("shell32")); +#else + QLibrary library(QLatin1String("coredll")); +#endif // Q_OS_WINCE + typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL); + static GetSpecialFolderPath SHGetSpecialFolderPath = + (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW"); + if (!SHGetSpecialFolderPath) + return QString(); + + wchar_t path[MAX_PATH]; + switch (type) { - case CacheLocation: - // Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache - // location for everyone. Most applications seem to be using a - // cache directory located in their AppData directory - return storageLocation(DataLocation) + QLatin1String("\\cache"); case DataLocation: - if (!settings.contains(QLatin1String("Local AppData"))) - break; - return settings.value(QLatin1String("Local AppData")).toString() - + QLatin1String("\\") + QCoreApplication::organizationName() - + QLatin1String("\\") + QCoreApplication::applicationName(); +#if defined Q_WS_WINCE + if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE)) +#else + if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) +#endif + result = QString::fromWCharArray(path); + if (!QCoreApplication::organizationName().isEmpty()) + result = result + QLatin1String("\\") + QCoreApplication::organizationName(); + if (!QCoreApplication::applicationName().isEmpty()) + result = result + QLatin1String("\\") + QCoreApplication::applicationName(); break; + case DesktopLocation: - return settings.value(QLatin1String("Desktop")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_DESKTOPDIRECTORY, FALSE)) + result = QString::fromWCharArray(path); break; case DocumentsLocation: - return settings.value(QLatin1String("Personal")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_PERSONAL, FALSE)) + result = QString::fromWCharArray(path); break; case FontsLocation: - return settings.value(QLatin1String("Fonts")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_FONTS, FALSE)) + result = QString::fromWCharArray(path); break; case ApplicationsLocation: - return settings.value(QLatin1String("Programs")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_PROGRAMS, FALSE)) + result = QString::fromWCharArray(path); break; case MusicLocation: - return settings.value(QLatin1String("My Music")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_MYMUSIC, FALSE)) + result = QString::fromWCharArray(path); break; case MoviesLocation: - return settings.value(QLatin1String("My Video")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_MYVIDEO, FALSE)) + result = QString::fromWCharArray(path); break; case PicturesLocation: - return settings.value(QLatin1String("My Pictures")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_MYPICTURES, FALSE)) + result = QString::fromWCharArray(path); break; + case CacheLocation: + // Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache + // location for everyone. Most applications seem to be using a + // cache directory located in their AppData directory + return storageLocation(DataLocation) + QLatin1String("\\cache"); + case QDesktopServices::HomeLocation: return QDir::homePath(); break; @@ -221,8 +253,7 @@ QString QDesktopServices::storageLocation(StandardLocation type) default: break; } -#endif - return QString(); + return result; } QString QDesktopServices::displayName(StandardLocation type) diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 19a8b63..588a48e 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -715,8 +715,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) #else stepsToScroll = int(d->offset_accumulated) * QApplication::wheelScrollLines() * d->singleStep; #endif - if (qAbs(stepsToScroll) > d->pageStep) - stepsToScroll = currentOffset > 0 ? d->pageStep : -d->pageStep; + stepsToScroll = qBound(-d->pageStep, stepsToScroll, d->pageStep); } if (d->invertedControls) diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 6cc720d..280ca63 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -468,18 +468,6 @@ void QDialogButtonBoxPrivate::layoutButtons() if (center) buttonLayout->addStretch(); - -#ifdef QT_SOFTKEYS_ENABLED - QWidget *dialog = 0; - QWidget *p = q; - while (p && !p->isWindow()) { - p = p->parentWidget(); - if (dialog = qobject_cast<QDialog *>(p)) - break; - } - if (dialog) - q->setFixedSize(0, 0); -#endif } QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardButton sbutton, @@ -1196,10 +1184,12 @@ bool QDialogButtonBox::event(QEvent *event) if (!hasDefault && firstAcceptButton) firstAcceptButton->setDefault(true); #ifdef QT_SOFTKEYS_ENABLED - if (dialog) + if (dialog) { + setFixedSize(0,0); dialog->addActions(d->softKeyActions.values()); - else + } else { addActions(d->softKeyActions.values()); + } #endif }else if (event->type() == QEvent::LanguageChange) { d->retranslateStrings(); diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index c656ef8..d757f98 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -74,12 +74,13 @@ struct SymbianMenuItem QAction* action; }; +Q_GLOBAL_STATIC_WITH_ARGS(QAction, contextAction, (0)) + static QList<SymbianMenuItem*> symbianMenus; static QList<QMenuBar*> nativeMenuBars; static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; static QPointer<QWidget> widgetWithContextMenu; static QList<QAction*> contextMenuActionList; -static QAction contextAction(0); static int contexMenuCommand=0; bool menuExists() @@ -400,8 +401,8 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::rebuild() contextMenuActionList.clear(); if (widgetWithContextMenu) { contexMenuCommand = qt_symbian_menu_static_cmd_id; // Increased inside insertNativeMenuItems - contextAction.setText(QMenuBar::tr("Actions")); - contextMenuActionList.append(&contextAction); + contextAction()->setText(QMenuBar::tr("Actions")); + contextMenuActionList.append(contextAction()); insertNativeMenuItems(contextMenuActionList); } } diff --git a/src/gui/widgets/qtoolbarextension_p.h b/src/gui/widgets/qtoolbarextension_p.h index 5d622ec..5fe74a9 100644 --- a/src/gui/widgets/qtoolbarextension_p.h +++ b/src/gui/widgets/qtoolbarextension_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TOOLBUTTON -class QToolBarExtension : public QToolButton +class Q_AUTOTEST_EXPORT QToolBarExtension : public QToolButton { Q_OBJECT Qt::Orientation orientation; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index ef4bf0e..2c4a1c2 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -189,7 +189,6 @@ void QAudioOutputPrivate::stop() { if(deviceState == QAudio::StopState) return; - deviceState = QAudio::StopState; close(); if(!pullMode && audioSource) { delete audioSource; @@ -465,13 +464,15 @@ bool QAudioOutputPrivate::deviceReady() } else if(l == 0) { bytesAvailable = bytesFree(); + int check = 0; EnterCriticalSection(&waveOutCriticalSection); - if(waveFreeBlockCount == buffer_size/period_size) { + check = waveFreeBlockCount; + LeaveCriticalSection(&waveOutCriticalSection); + if(check == buffer_size/period_size) { errorState = QAudio::UnderrunError; deviceState = QAudio::IdleState; emit stateChanged(deviceState); } - LeaveCriticalSection(&waveOutCriticalSection); } else if(l < 0) { bytesAvailable = bytesFree(); diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 7f40134..2d5c74f 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -1166,12 +1166,12 @@ QNetworkProxyFactory::~QNetworkProxyFactory() sets an application-wide proxy factory. For this reason, this method is mutually exclusive with setApplicationProxyFactory: calling setApplicationProxyFactory overrides the use of the system-wide proxy, - and calling setUseSystemConfigurationEnabled overrides any + and calling setUseSystemConfiguration overrides any application proxy or proxy factory that was previously set. \since 4.6 */ -void QNetworkProxyFactory::setUseSystemConfigurationEnabled(bool enable) +void QNetworkProxyFactory::setUseSystemConfiguration(bool enable) { if (enable) { setApplicationProxyFactory(new QSystemConfigurationProxyFactory); diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h index 6357c64..68bd6fd 100644 --- a/src/network/kernel/qnetworkproxy.h +++ b/src/network/kernel/qnetworkproxy.h @@ -171,7 +171,7 @@ public: virtual QList<QNetworkProxy> queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) = 0; - static void setUseSystemConfigurationEnabled(bool enable); + static void setUseSystemConfiguration(bool enable); static void setApplicationProxyFactory(QNetworkProxyFactory *factory); static QList<QNetworkProxy> proxyForQuery(const QNetworkProxyQuery &query); static QList<QNetworkProxy> systemProxyForQuery(const QNetworkProxyQuery &query = QNetworkProxyQuery()); diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp index 866d1a2..1fe3999 100644 --- a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp +++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp @@ -67,7 +67,30 @@ void QGL2PEXVertexArray::addRect(const QRectF &rect) << rect.bottomRight() << rect.bottomLeft() << rect.topLeft(); } -void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseScale) +void QGL2PEXVertexArray::addClosingLine(int index) +{ + if (QPointF(vertexArray.at(index)) != QPointF(vertexArray.last())) + vertexArray.add(vertexArray.at(index)); +} + +void QGL2PEXVertexArray::addCentroid(const QVectorPath &path, int subPathIndex) +{ + const QPointF *const points = reinterpret_cast<const QPointF *>(path.points()); + const QPainterPath::ElementType *const elements = path.elements(); + + QPointF sum = points[subPathIndex]; + int count = 1; + + for (int i = subPathIndex + 1; i < path.elementCount() && (!elements || elements[i] != QPainterPath::MoveToElement); ++i) { + sum += points[i]; + ++count; + } + + const QPointF centroid = sum / qreal(count); + vertexArray.add(centroid); +} + +void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline) { const QPointF* const points = reinterpret_cast<const QPointF*>(path.points()); const QPainterPath::ElementType* const elements = path.elements(); @@ -78,6 +101,10 @@ void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseSc boundingRectDirty = false; } + if (!outline) + addCentroid(path, 0); + + int lastMoveTo = vertexArray.size(); vertexArray.add(points[0]); // The first element is always a moveTo do { @@ -96,8 +123,14 @@ void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseSc const QPainterPath::ElementType elementType = elements[i]; switch (elementType) { case QPainterPath::MoveToElement: + if (!outline) + addClosingLine(lastMoveTo); // qDebug("element[%d] is a MoveToElement", i); vertexArrayStops.append(vertexArray.size()); + if (!outline) { + addCentroid(path, i); + lastMoveTo = vertexArray.size(); + } lineToArray(points[i].x(), points[i].y()); // Add the moveTo as a new vertex break; case QPainterPath::LineToElement: @@ -115,6 +148,8 @@ void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseSc } } while (0); + if (!outline) + addClosingLine(lastMoveTo); vertexArrayStops.append(vertexArray.size()); } diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h index 08ce234..719904f 100644 --- a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h +++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h @@ -104,7 +104,7 @@ public: boundingRectDirty(true) {} void addRect(const QRectF &rect); - void addPath(const QVectorPath &path, GLfloat curveInverseScale); + void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline = true); void clear(); QGLPoint* data() {return vertexArray.data();} @@ -124,6 +124,9 @@ private: bool boundingRectDirty; inline void curveToArray(const QGLPoint &cp1, const QGLPoint &cp2, const QGLPoint &ep, GLfloat inverseScale); + + void addClosingLine(int index); + void addCentroid(const QVectorPath &path, int subPathIndex); }; QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h index 25f5c2f..f8c13c5 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h @@ -64,7 +64,7 @@ QT_MODULE(OpenGL) class QGLCustomShaderStagePrivate; class Q_OPENGL_EXPORT QGLCustomShaderStage { - Q_DECLARE_PRIVATE(QGLCustomShaderStage); + Q_DECLARE_PRIVATE(QGLCustomShaderStage) public: QGLCustomShaderStage(); virtual ~QGLCustomShaderStage(); diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 5875124..ab02c69 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -391,7 +391,6 @@ void QGL2PaintEngineExPrivate::setBrush(const QBrush* brush) } -// Unless this gets used elsewhere, it's probably best to merge it into fillStencilWithVertexArray void QGL2PaintEngineExPrivate::useSimpleShader() { shaderManager->simpleProgram()->enable(); @@ -881,26 +880,36 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) || path.shape() == QVectorPath::ConvexPolygonHint) { vertexCoordinateArray.clear(); - vertexCoordinateArray.addPath(path, inverseScale); + vertexCoordinateArray.addPath(path, inverseScale, false); prepareForDraw(currentBrush->isOpaque()); drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); } else { // The path is too complicated & needs the stencil technique vertexCoordinateArray.clear(); - vertexCoordinateArray.addPath(path, inverseScale); + vertexCoordinateArray.addPath(path, inverseScale, false); fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); - // Stencil the brush onto the dest buffer - glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); // Pass if stencil buff value != 0 - glStencilOp(GL_KEEP, GL_ZERO, GL_ZERO); - glStencilMask(GL_STENCIL_HIGH_BIT); + glStencilMask(0xff); + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + + if (q->state()->clipTestEnabled) { + // Pass when high bit is set, replace stencil value with current clip + glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT); + } else if (path.hasWindingFill()) { + // Pass when any bit is set, replace stencil value with 0 + glStencilFunc(GL_NOTEQUAL, 0, 0xff); + } else { + // Pass when high bit is set, replace stencil value with 0 + glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); + } prepareForDraw(currentBrush->isOpaque()); if (inRenderText) prepareDepthRangeForRenderText(); + // Stencil the brush onto the dest buffer composite(vertexCoordinateArray.boundingRect()); if (inRenderText) @@ -916,7 +925,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& vertexArray, bool useWindingFill) { // qDebug("QGL2PaintEngineExPrivate::fillStencilWithVertexArray()"); - glStencilMask(0xffff); // Enable stencil writes + glStencilMask(0xff); // Enable stencil writes if (dirtyStencilRegion.intersects(currentScissorBounds)) { QVector<QRect> clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); @@ -948,39 +957,30 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& ve if (useWindingFill) { if (q->state()->clipTestEnabled) { + // Flatten clip values higher than current clip, and set high bit to match current clip glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); composite(vertexArray.boundingRect()); glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); - } else { - glStencilFunc(GL_ALWAYS, 0, 0xffff); + } else if (!stencilClean) { + // Clear stencil buffer within bounding rect + glStencilFunc(GL_ALWAYS, 0, 0xff); glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); composite(vertexArray.boundingRect()); } // Inc. for front-facing triangle glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_INCR_WRAP); - //Dec. for back-facing "holes" + // Dec. for back-facing "holes" glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_DECR_WRAP); glStencilMask(~GL_STENCIL_HIGH_BIT); drawVertexArrays(vertexArray, GL_TRIANGLE_FAN); if (q->state()->clipTestEnabled) { - // clear high bit of stencil outside of path - glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); - glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); - glStencilMask(GL_STENCIL_HIGH_BIT); - composite(vertexArray.boundingRect()); - // reset lower bits of stencil inside path to current clip - glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, GL_STENCIL_HIGH_BIT); + // Clear high bit of stencil outside of path + glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); - glStencilMask(~GL_STENCIL_HIGH_BIT); - composite(vertexArray.boundingRect()); - } else { - // set high bit of stencil inside path - glStencilFunc(GL_NOTEQUAL, 0, 0xffff); - glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); glStencilMask(GL_STENCIL_HIGH_BIT); composite(vertexArray.boundingRect()); } @@ -1020,7 +1020,7 @@ void QGL2PaintEngineExPrivate::resetClipIfNeeded() QGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom()); // Set high bit on clip region - glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xffff); + glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff); glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); glStencilMask(GL_STENCIL_HIGH_BIT); composite(rect); @@ -1028,7 +1028,7 @@ void QGL2PaintEngineExPrivate::resetClipIfNeeded() // Reset clipping to 1 and everything else to zero glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT); glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE); - glStencilMask(0xFFFF); + glStencilMask(0xff); composite(rect); q->state()->currentClip = 1; @@ -1636,6 +1636,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->use_system_clip = !systemClip().isEmpty(); d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); + d->stencilClean = true; // Calling begin paint should make the correct context current. So, any // code which calls into GL or otherwise needs a current context *must* @@ -1731,7 +1732,7 @@ void QGL2PaintEngineExPrivate::updateClipScissorTest() glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); } else { glDisable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 0, 0xffff); + glStencilFunc(GL_ALWAYS, 0, 0xff); } #ifdef QT_GL_NO_SCISSOR_TEST @@ -1787,7 +1788,7 @@ void QGL2PaintEngineExPrivate::clearClip(uint value) { dirtyStencilRegion -= currentScissorBounds; - glStencilMask(0xffff); + glStencilMask(0xff); glClearStencil(value); glClear(GL_STENCIL_BUFFER_BIT); glStencilMask(0x0); @@ -1802,6 +1803,8 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) if (matrixDirty) updateMatrix(); + stencilClean = false; + const bool singlePass = !path.hasWindingFill() && (((q->state()->currentClip == maxClip - 1) && q->state()->clipTestEnabled) || q->state()->needsClipBufferClear); @@ -1819,10 +1822,10 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) if (q->state()->clipTestEnabled) glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); else - glStencilFunc(GL_ALWAYS, 0, 0xffff); + glStencilFunc(GL_ALWAYS, 0, 0xff); vertexCoordinateArray.clear(); - vertexCoordinateArray.addPath(path, inverseScale); + vertexCoordinateArray.addPath(path, inverseScale, false); if (!singlePass) fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); @@ -1841,9 +1844,17 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); } else { - glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT); glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); - glStencilMask(0xffff); + glStencilMask(0xff); + + if (!q->state()->clipTestEnabled && path.hasWindingFill()) { + // Pass when any clip bit is set, set high bit + glStencilFunc(GL_NOTEQUAL, GL_STENCIL_HIGH_BIT, ~GL_STENCIL_HIGH_BIT); + composite(vertexCoordinateArray.boundingRect()); + } + + // Pass when high bit is set, replace stencil value with new clip value + glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT); composite(vertexCoordinateArray.boundingRect()); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 28c972e..46be398 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -223,6 +223,7 @@ public: bool shaderMatrixUniformDirty; bool opacityUniformDirty; + bool stencilClean; // Has the stencil not been used for clipping so far? QRegion dirtyStencilRegion; QRect currentScissorBounds; uint maxClip; diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index ae4bed0..cbb310b 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -318,7 +318,7 @@ void QGLPixmapData::ensureCreated() const } void QGLPixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags flags) + Qt::ImageConversionFlags /*flags*/) { if (image.size() == QSize(w, h)) setSerialNumber(++qt_gl_pixmap_serial); diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h index 18da5c8..340023c 100644 --- a/src/opengl/util/fragmentprograms_p.h +++ b/src/opengl/util/fragmentprograms_p.h @@ -71,7 +71,7 @@ enum FragmentVariable { VAR_FMP2_M_RADIUS2, VAR_FMP, VAR_INV_MATRIX_M0, - VAR_ANGLE, + VAR_ANGLE }; enum FragmentBrushType { @@ -80,7 +80,7 @@ enum FragmentBrushType { FRAGMENT_PROGRAM_BRUSH_CONICAL, FRAGMENT_PROGRAM_BRUSH_LINEAR, FRAGMENT_PROGRAM_BRUSH_TEXTURE, - FRAGMENT_PROGRAM_BRUSH_PATTERN, + FRAGMENT_PROGRAM_BRUSH_PATTERN }; enum FragmentCompositionModeType { @@ -109,12 +109,12 @@ enum FragmentCompositionModeType { COMPOSITION_MODES_DIFFERENCE_NOMASK, COMPOSITION_MODES_EXCLUSION_NOMASK, COMPOSITION_MODE_BLEND_MODE_MASK, - COMPOSITION_MODE_BLEND_MODE_NOMASK, + COMPOSITION_MODE_BLEND_MODE_NOMASK }; enum FragmentMaskType { FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA, - FRAGMENT_PROGRAM_MASK_ELLIPSE_AA, + FRAGMENT_PROGRAM_MASK_ELLIPSE_AA }; static const unsigned int num_fragment_variables = 19; diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index afee77e..09c0ace 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -149,6 +149,18 @@ void PvrEglWindowSurface::setPermanentState(const QByteArray &state) Q_UNUSED(state); } +void PvrEglWindowSurface::flush + (QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + // The GL paint engine is responsible for the swapBuffers() call. + // If we were to call the base class's implementation of flush() + // then it would fetch the image() and manually blit it to the + // screeen instead of using the fast PVR2D blit. + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); +} + QImage PvrEglWindowSurface::image() const { if (drawable) { @@ -165,14 +177,7 @@ QImage PvrEglWindowSurface::image() const QPaintDevice *PvrEglWindowSurface::paintDevice() { - QGLWidget *glWidget = qobject_cast<QGLWidget *>(window()); - if (glWidget) - return glWidget; - - // Should be a QGLWidget, but if not return a dummy paint device. - if (!pdevice) - pdevice = new QImage(50, 50, screen->pixelFormat()); - return pdevice; + return widget; } void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h index 80fc8f8..0da3653 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h @@ -65,6 +65,8 @@ public: QByteArray permanentState() const; void setPermanentState(const QByteArray &state); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + QImage image() const; QPaintDevice *paintDevice(); diff --git a/src/qt3support/other/q3process_unix.cpp b/src/qt3support/other/q3process_unix.cpp index d42468b..955b65f 100644 --- a/src/qt3support/other/q3process_unix.cpp +++ b/src/qt3support/other/q3process_unix.cpp @@ -60,6 +60,7 @@ #include "qregexp.h" #include "private/q3membuf_p.h" #include "private/qobject_p.h" +#include "private/qcore_unix_p.h" #include <stdlib.h> #include <errno.h> @@ -160,11 +161,11 @@ public: process->d->proc = 0; } if( socketStdin ) - ::close( socketStdin ); + qt_safe_close( socketStdin ); if( socketStdout ) - ::close( socketStdout ); + qt_safe_close( socketStdout ); if( socketStderr ) - ::close( socketStderr ); + qt_safe_close( socketStderr ); } pid_t pid; @@ -213,7 +214,7 @@ static void q3process_cleanup() } #ifdef Q_OS_QNX6 -#define BAILOUT close(tmpSocket);close(socketFD[1]);return -1; +#define BAILOUT qt_safe_close(tmpSocket);qt_safe_close(socketFD[1]);return -1; int qnx6SocketPairReplacement (int socketFD[2]) { int tmpSocket; tmpSocket = socket (AF_INET, SOCK_STREAM, 0); @@ -252,7 +253,7 @@ int qnx6SocketPairReplacement (int socketFD[2]) { if(socketFD[0] == -1) { BAILOUT }; // We're done - close(tmpSocket); + qt_safe_close(tmpSocket); // Restore original flags , ie return to blocking fcntl(socketFD[1], F_SETFL, originalFlags); @@ -319,9 +320,9 @@ Q3ProcessManager::~Q3ProcessManager() delete procList; if ( sigchldFd[0] != 0 ) - ::close( sigchldFd[0] ); + qt_safe_close( sigchldFd[0] ); if ( sigchldFd[1] != 0 ) - ::close( sigchldFd[1] ); + qt_safe_close( sigchldFd[1] ); // restore SIGCHLD handler #if defined(QT_Q3PROCESS_DEBUG) @@ -384,7 +385,7 @@ void Q3ProcessManager::sigchldHnd( int fd ) } char tmp; - ::read( fd, &tmp, sizeof(tmp) ); + qt_safe_read( fd, &tmp, sizeof(tmp) ); #if defined(QT_Q3PROCESS_DEBUG) qDebug( "Q3ProcessManager::sigchldHnd()" ); #endif @@ -434,13 +435,13 @@ void Q3ProcessManager::sigchldHnd( int fd ) // close filedescriptors if open, and disable the // socket notifiers if ( proc->socketStdout ) { - ::close( proc->socketStdout ); + qt_safe_close( proc->socketStdout ); proc->socketStdout = 0; if (process->d->notifierStdout) process->d->notifierStdout->setEnabled(false); } if ( proc->socketStderr ) { - ::close( proc->socketStderr ); + qt_safe_close( proc->socketStderr ); proc->socketStderr = 0; if (process->d->notifierStderr) process->d->notifierStderr->setEnabled(false); @@ -509,7 +510,7 @@ Q3ProcessPrivate::~Q3ProcessPrivate() if ( proc != 0 ) { if ( proc->socketStdin != 0 ) { - ::close( proc->socketStdin ); + qt_safe_close( proc->socketStdin ); proc->socketStdin = 0; } proc->process = 0; @@ -532,15 +533,15 @@ void Q3ProcessPrivate::closeOpenSocketsForChild() { if ( procManager != 0 ) { if ( procManager->sigchldFd[0] != 0 ) - ::close( procManager->sigchldFd[0] ); + qt_safe_close( procManager->sigchldFd[0] ); if ( procManager->sigchldFd[1] != 0 ) - ::close( procManager->sigchldFd[1] ); + qt_safe_close( procManager->sigchldFd[1] ); // close also the sockets from other Q3Process instances for ( QProc *p=procManager->procList->first(); p!=0; p=procManager->procList->next() ) { - ::close( p->socketStdin ); - ::close( p->socketStdout ); - ::close( p->socketStderr ); + qt_safe_close( p->socketStdin ); + qt_safe_close( p->socketStdout ); + qt_safe_close( p->socketStderr ); } } } @@ -569,7 +570,7 @@ static QT_SIGNAL_RETTYPE qt_C_sigchldHnd(QT_SIGNAL_ARGS) return; char a = 1; - ::write( Q3ProcessPrivate::procManager->sigchldFd[0], &a, sizeof(a) ); + qt_safe_write( Q3ProcessPrivate::procManager->sigchldFd[0], &a, sizeof(a) ); } @@ -682,8 +683,8 @@ bool Q3Process::start( QStringList *env ) if ( (comms & Stderr) && qnx6SocketPairReplacement(sStderr) == -1 ) { #endif if ( comms & Stdin ) { - ::close( sStdin[0] ); - ::close( sStdin[1] ); + qt_safe_close( sStdin[0] ); + qt_safe_close( sStdin[1] ); } return false; } @@ -693,12 +694,12 @@ bool Q3Process::start( QStringList *env ) if ( (comms & Stdout) && qnx6SocketPairReplacement(sStdout) == -1 ) { #endif if ( comms & Stdin ) { - ::close( sStdin[0] ); - ::close( sStdin[1] ); + qt_safe_close( sStdin[0] ); + qt_safe_close( sStdin[1] ); } if ( comms & Stderr ) { - ::close( sStderr[0] ); - ::close( sStderr[1] ); + qt_safe_close( sStderr[0] ); + qt_safe_close( sStderr[1] ); } return false; } @@ -758,15 +759,15 @@ bool Q3Process::start( QStringList *env ) // child d->closeOpenSocketsForChild(); if ( comms & Stdin ) { - ::close( sStdin[1] ); + qt_safe_close( sStdin[1] ); ::dup2( sStdin[0], STDIN_FILENO ); } if ( comms & Stdout ) { - ::close( sStdout[0] ); + qt_safe_close( sStdout[0] ); ::dup2( sStdout[1], STDOUT_FILENO ); } if ( comms & Stderr ) { - ::close( sStderr[0] ); + qt_safe_close( sStderr[0] ); ::dup2( sStderr[1], STDERR_FILENO ); } if ( comms & DupStderr ) { @@ -776,7 +777,7 @@ bool Q3Process::start( QStringList *env ) ::chdir( workingDir.absPath().latin1() ); #endif if ( fd[0] ) - ::close( fd[0] ); + qt_safe_close( fd[0] ); if ( fd[1] ) ::fcntl( fd[1], F_SETFD, FD_CLOEXEC ); // close on exec shows success @@ -850,8 +851,8 @@ bool Q3Process::start( QStringList *env ) } if ( fd[1] ) { char buf = 0; - ::write( fd[1], &buf, 1 ); - ::close( fd[1] ); + qt_safe_write( fd[1], &buf, 1 ); + qt_safe_close( fd[1] ); } ::_exit( -1 ); } else if ( pid == -1 ) { @@ -861,7 +862,7 @@ bool Q3Process::start( QStringList *env ) // test if exec was successful if ( fd[1] ) - ::close( fd[1] ); + qt_safe_close( fd[1] ); if ( fd[0] ) { char buf; for ( ;; ) { @@ -882,13 +883,13 @@ bool Q3Process::start( QStringList *env ) } break; } - ::close( fd[0] ); + qt_safe_close( fd[0] ); } d->newProc( pid, this ); if ( comms & Stdin ) { - ::close( sStdin[0] ); + qt_safe_close( sStdin[0] ); d->proc->socketStdin = sStdin[1]; // Select non-blocking mode @@ -904,7 +905,7 @@ bool Q3Process::start( QStringList *env ) } } if ( comms & Stdout ) { - ::close( sStdout[1] ); + qt_safe_close( sStdout[1] ); d->proc->socketStdout = sStdout[0]; d->notifierStdout = new QSocketNotifier( sStdout[0], QSocketNotifier::Read ); connect( d->notifierStdout, SIGNAL(activated(int)), @@ -913,7 +914,7 @@ bool Q3Process::start( QStringList *env ) d->notifierStdout->setEnabled( true ); } if ( comms & Stderr ) { - ::close( sStderr[1] ); + qt_safe_close( sStderr[1] ); d->proc->socketStderr = sStderr[0]; d->notifierStderr = new QSocketNotifier( sStderr[0], QSocketNotifier::Read ); connect( d->notifierStderr, SIGNAL(activated(int)), @@ -934,19 +935,19 @@ error: if ( d->procManager ) d->procManager->cleanup(); if ( comms & Stdin ) { - ::close( sStdin[1] ); - ::close( sStdin[0] ); + qt_safe_close( sStdin[1] ); + qt_safe_close( sStdin[0] ); } if ( comms & Stdout ) { - ::close( sStdout[0] ); - ::close( sStdout[1] ); + qt_safe_close( sStdout[0] ); + qt_safe_close( sStdout[1] ); } if ( comms & Stderr ) { - ::close( sStderr[0] ); - ::close( sStderr[1] ); + qt_safe_close( sStderr[0] ); + qt_safe_close( sStderr[1] ); } - ::close( fd[0] ); - ::close( fd[1] ); + qt_safe_close( fd[0] ); + qt_safe_close( fd[1] ); delete[] arglistQ; delete[] arglist; return false; @@ -1049,7 +1050,7 @@ void Q3Process::closeStdin() d->notifierStdin->setEnabled(false); qDeleteInEventHandler(d->notifierStdin); d->notifierStdin = 0; - if ( ::close( d->proc->socketStdin ) != 0 ) { + if ( qt_safe_close( d->proc->socketStdin ) != 0 ) { qWarning( "Could not close stdin of child process" ); } #if defined(QT_Q3PROCESS_DEBUG) @@ -1115,7 +1116,7 @@ void Q3Process::socketRead( int fd ) d->notifierStdout->setEnabled( false ); qDeleteInEventHandler(d->notifierStdout); d->notifierStdout = 0; - ::close( d->proc->socketStdout ); + qt_safe_close( d->proc->socketStdout ); d->proc->socketStdout = 0; return; } else if ( fd == d->proc->socketStderr ) { @@ -1125,7 +1126,7 @@ void Q3Process::socketRead( int fd ) d->notifierStderr->setEnabled( false ); qDeleteInEventHandler(d->notifierStderr); d->notifierStderr = 0; - ::close( d->proc->socketStderr ); + qt_safe_close( d->proc->socketStderr ); d->proc->socketStderr = 0; return; } diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index d795a62..dda89fd 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3206,11 +3206,11 @@ EXPORTS _ZN12QEasingCurveD1Ev @ 3205 NONAME _ZN12QEasingCurveD2Ev @ 3206 NONAME _ZN12QEasingCurveaSERKS_ @ 3207 NONAME - _ZN12QSignalEventC1EP7QObjectiRK5QListI8QVariantE @ 3208 NONAME - _ZN12QSignalEventC2EP7QObjectiRK5QListI8QVariantE @ 3209 NONAME - _ZN12QSignalEventD0Ev @ 3210 NONAME - _ZN12QSignalEventD1Ev @ 3211 NONAME - _ZN12QSignalEventD2Ev @ 3212 NONAME + _ZN12QSignalEventC1EP7QObjectiRK5QListI8QVariantE @ 3208 NONAME ABSENT + _ZN12QSignalEventC2EP7QObjectiRK5QListI8QVariantE @ 3209 NONAME ABSENT + _ZN12QSignalEventD0Ev @ 3210 NONAME ABSENT + _ZN12QSignalEventD1Ev @ 3211 NONAME ABSENT + _ZN12QSignalEventD2Ev @ 3212 NONAME ABSENT _ZN13QHistoryState11qt_metacallEN11QMetaObject4CallEiPPv @ 3213 NONAME _ZN13QHistoryState11qt_metacastEPKc @ 3214 NONAME _ZN13QHistoryState14setHistoryTypeENS_11HistoryTypeE @ 3215 NONAME @@ -3234,7 +3234,7 @@ EXPORTS _ZN13QStateMachine12endMicrostepEP6QEvent @ 3233 NONAME _ZN13QStateMachine14beginMicrostepEP6QEvent @ 3234 NONAME _ZN13QStateMachine16staticMetaObjectE @ 3235 NONAME DATA 16 - _ZN13QStateMachine17postInternalEventEP6QEvent @ 3236 NONAME + _ZN13QStateMachine17postInternalEventEP6QEvent @ 3236 NONAME ABSENT _ZN13QStateMachine19addDefaultAnimationEP18QAbstractAnimation @ 3237 NONAME _ZN13QStateMachine20endSelectTransitionsEP6QEvent @ 3238 NONAME _ZN13QStateMachine20setAnimationsEnabledEb @ 3239 NONAME @@ -3249,7 +3249,7 @@ EXPORTS _ZN13QStateMachine7startedEv @ 3248 NONAME _ZN13QStateMachine7stoppedEv @ 3249 NONAME _ZN13QStateMachine8addStateEP14QAbstractState @ 3250 NONAME - _ZN13QStateMachine9postEventEP6QEventi @ 3251 NONAME + _ZN13QStateMachine9postEventEP6QEventi @ 3251 NONAME ABSENT _ZN13QStateMachineC1EP7QObject @ 3252 NONAME _ZN13QStateMachineC1ER20QStateMachinePrivateP7QObject @ 3253 NONAME _ZN13QStateMachineC2EP7QObject @ 3254 NONAME @@ -3265,11 +3265,11 @@ EXPORTS _ZN13QStatePrivateD1Ev @ 3264 NONAME _ZN13QStatePrivateD2Ev @ 3265 NONAME _ZN13QUnifiedTimer8instanceEv @ 3266 NONAME - _ZN13QWrappedEventC1EP7QObjectP6QEvent @ 3267 NONAME - _ZN13QWrappedEventC2EP7QObjectP6QEvent @ 3268 NONAME - _ZN13QWrappedEventD0Ev @ 3269 NONAME - _ZN13QWrappedEventD1Ev @ 3270 NONAME - _ZN13QWrappedEventD2Ev @ 3271 NONAME + _ZN13QWrappedEventC1EP7QObjectP6QEvent @ 3267 NONAME ABSENT + _ZN13QWrappedEventC2EP7QObjectP6QEvent @ 3268 NONAME ABSENT + _ZN13QWrappedEventD0Ev @ 3269 NONAME ABSENT + _ZN13QWrappedEventD1Ev @ 3270 NONAME ABSENT + _ZN13QWrappedEventD2Ev @ 3271 NONAME ABSENT _ZN14QAbstractState11qt_metacallEN11QMetaObject4CallEiPPv @ 3272 NONAME _ZN14QAbstractState11qt_metacastEPKc @ 3273 NONAME _ZN14QAbstractState16staticMetaObjectE @ 3274 NONAME DATA 16 @@ -3299,7 +3299,7 @@ EXPORTS _ZN15QPauseAnimation11qt_metacastEPKc @ 3298 NONAME _ZN15QPauseAnimation11setDurationEi @ 3299 NONAME _ZN15QPauseAnimation16staticMetaObjectE @ 3300 NONAME DATA 16 - _ZN15QPauseAnimation17updateCurrentTimeEi @ 3301 NONAME ABSENT + _ZN15QPauseAnimation17updateCurrentTimeEi @ 3301 NONAME _ZN15QPauseAnimation5eventEP6QEvent @ 3302 NONAME _ZN15QPauseAnimationC1EP7QObject @ 3303 NONAME _ZN15QPauseAnimationC1EiP7QObject @ 3304 NONAME @@ -3361,7 +3361,7 @@ EXPORTS _ZN17QVariantAnimation13setStartValueERK8QVariant @ 3360 NONAME _ZN17QVariantAnimation14setEasingCurveERK12QEasingCurve @ 3361 NONAME _ZN17QVariantAnimation16staticMetaObjectE @ 3362 NONAME DATA 16 - _ZN17QVariantAnimation17updateCurrentTimeEi @ 3363 NONAME ABSENT + _ZN17QVariantAnimation17updateCurrentTimeEi @ 3363 NONAME _ZN17QVariantAnimation20registerInterpolatorEPF8QVariantPKvS2_fEi @ 3364 NONAME _ZN17QVariantAnimation5eventEP6QEvent @ 3365 NONAME _ZN17QVariantAnimationC2EP7QObject @ 3366 NONAME @@ -3430,7 +3430,7 @@ EXPORTS _ZN20QStateMachinePrivate14isDescendantOfEPK14QAbstractStateS2_ @ 3429 NONAME _ZN20QStateMachinePrivate15applyPropertiesERK5QListIP19QAbstractTransitionERKS0_IP14QAbstractStateESA_ @ 3430 NONAME _ZN20QStateMachinePrivate15properAncestorsEPK14QAbstractStatePK6QState @ 3431 NONAME - _ZN20QStateMachinePrivate15scheduleProcessEv @ 3432 NONAME + _ZN20QStateMachinePrivate15scheduleProcessEv @ 3432 NONAME ABSENT _ZN20QStateMachinePrivate16addStatesToEnterEP14QAbstractStateP6QStateR4QSetIS1_ES6_ @ 3433 NONAME _ZN20QStateMachinePrivate16removeStartStateEv @ 3434 NONAME _ZN20QStateMachinePrivate17stateExitLessThanEP14QAbstractStateS1_ @ 3435 NONAME @@ -3470,7 +3470,7 @@ EXPORTS _ZN23QParallelAnimationGroup11updateStateEN18QAbstractAnimation5StateES1_ @ 3469 NONAME _ZN23QParallelAnimationGroup15updateDirectionEN18QAbstractAnimation9DirectionE @ 3470 NONAME _ZN23QParallelAnimationGroup16staticMetaObjectE @ 3471 NONAME DATA 16 - _ZN23QParallelAnimationGroup17updateCurrentTimeEi @ 3472 NONAME ABSENT + _ZN23QParallelAnimationGroup17updateCurrentTimeEi @ 3472 NONAME _ZN23QParallelAnimationGroup5eventEP6QEvent @ 3473 NONAME _ZN23QParallelAnimationGroupC1EP7QObject @ 3474 NONAME _ZN23QParallelAnimationGroupC1ER30QParallelAnimationGroupPrivateP7QObject @ 3475 NONAME @@ -3498,7 +3498,7 @@ EXPORTS _ZN25QSequentialAnimationGroup13insertPauseAtEii @ 3497 NONAME _ZN25QSequentialAnimationGroup15updateDirectionEN18QAbstractAnimation9DirectionE @ 3498 NONAME _ZN25QSequentialAnimationGroup16staticMetaObjectE @ 3499 NONAME DATA 16 - _ZN25QSequentialAnimationGroup17updateCurrentTimeEi @ 3500 NONAME ABSENT + _ZN25QSequentialAnimationGroup17updateCurrentTimeEi @ 3500 NONAME _ZN25QSequentialAnimationGroup23currentAnimationChangedEP18QAbstractAnimation @ 3501 NONAME _ZN25QSequentialAnimationGroup5eventEP6QEvent @ 3502 NONAME _ZN25QSequentialAnimationGroup8addPauseEi @ 3503 NONAME @@ -3648,11 +3648,11 @@ EXPORTS _ZNK8QVariant7toFloatEPb @ 3647 NONAME _ZNK9QTimeLine11easingCurveEv @ 3648 NONAME _ZTI11QFinalState @ 3649 NONAME - _ZTI12QSignalEvent @ 3650 NONAME + _ZTI12QSignalEvent @ 3650 NONAME ABSENT _ZTI13QHistoryState @ 3651 NONAME _ZTI13QStateMachine @ 3652 NONAME _ZTI13QStatePrivate @ 3653 NONAME - _ZTI13QWrappedEvent @ 3654 NONAME + _ZTI13QWrappedEvent @ 3654 NONAME ABSENT _ZTI14QAbstractState @ 3655 NONAME _ZTI15QAnimationGroup @ 3656 NONAME _ZTI15QPauseAnimation @ 3657 NONAME @@ -3671,11 +3671,11 @@ EXPORTS _ZTI26QAbstractTransitionPrivate @ 3670 NONAME _ZTI6QState @ 3671 NONAME _ZTV11QFinalState @ 3672 NONAME - _ZTV12QSignalEvent @ 3673 NONAME + _ZTV12QSignalEvent @ 3673 NONAME ABSENT _ZTV13QHistoryState @ 3674 NONAME _ZTV13QStateMachine @ 3675 NONAME _ZTV13QStatePrivate @ 3676 NONAME - _ZTV13QWrappedEvent @ 3677 NONAME + _ZTV13QWrappedEvent @ 3677 NONAME ABSENT _ZTV14QAbstractState @ 3678 NONAME _ZTV15QAnimationGroup @ 3679 NONAME _ZTV15QPauseAnimation @ 3680 NONAME @@ -3820,8 +3820,18 @@ EXPORTS _ZTV37QNonContiguousByteDeviceByteArrayImpl @ 3819 NONAME ABSENT ; #<VT># _ZTV38QNonContiguousByteDeviceRingBufferImpl @ 3820 NONAME ABSENT ; #<VT># _Zls6QDebugRK8QMargins @ 3821 NONAME - _ZN15QPauseAnimation17updateCurrentTimeEv @ 3822 NONAME - _ZN17QVariantAnimation17updateCurrentTimeEv @ 3823 NONAME - _ZN23QParallelAnimationGroup17updateCurrentTimeEv @ 3824 NONAME - _ZN25QSequentialAnimationGroup17updateCurrentTimeEv @ 3825 NONAME + _ZN15QPauseAnimation17updateCurrentTimeEv @ 3822 NONAME ABSENT + _ZN17QVariantAnimation17updateCurrentTimeEv @ 3823 NONAME ABSENT + _ZN23QParallelAnimationGroup17updateCurrentTimeEv @ 3824 NONAME ABSENT + _ZN25QSequentialAnimationGroup17updateCurrentTimeEv @ 3825 NONAME ABSENT + _ZN11QDataStream25setFloatingPointPrecisionENS_22FloatingPointPrecisionE @ 3826 NONAME + _ZN13QStateMachine16postDelayedEventEP6QEventi @ 3827 NONAME + _ZN13QStateMachine18cancelDelayedEventEi @ 3828 NONAME + _ZN13QStateMachine9postEventEP6QEventNS_13EventPriorityE @ 3829 NONAME + _ZN20QStateMachinePrivate13processEventsENS_19EventProcessingModeE @ 3830 NONAME + _ZN20QStateMachinePrivate19handleFilteredEventEP7QObjectP6QEvent @ 3831 NONAME + _ZN20QStateMachinePrivate22cancelAllDelayedEventsEv @ 3832 NONAME + _ZN4QUrl13fromUserInputERK7QString @ 3833 NONAME + _ZNK11QDataStream22floatingPointPrecisionEv @ 3834 NONAME + qt_sine_table @ 3835 NONAME DATA 1024 diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index aad8b68..09ea6ab 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -10640,7 +10640,7 @@ EXPORTS _ZTI17QTextFramePrivate @ 10639 NONAME ABSENT _ZTI17QTextImageHandler @ 10640 NONAME ABSENT _ZTI17QTextTablePrivate @ 10641 NONAME ABSENT - _ZTI17QToolBarExtension @ 10642 NONAME ABSENT + _ZTI17QToolBarExtension @ 10642 NONAME _ZTI17QToolBarSeparator @ 10643 NONAME ABSENT _ZTI17QUpdateLaterEvent @ 10644 NONAME ABSENT _ZTI17QWhatsThisPrivate @ 10645 NONAME ABSENT @@ -11051,7 +11051,7 @@ EXPORTS _ZTV17QTextFramePrivate @ 11050 NONAME ABSENT _ZTV17QTextImageHandler @ 11051 NONAME ABSENT _ZTV17QTextTablePrivate @ 11052 NONAME ABSENT - _ZTV17QToolBarExtension @ 11053 NONAME ABSENT + _ZTV17QToolBarExtension @ 11053 NONAME _ZTV17QToolBarSeparator @ 11054 NONAME ABSENT _ZTV17QUpdateLaterEvent @ 11055 NONAME ABSENT _ZTV17QWhatsThisPrivate @ 11056 NONAME ABSENT @@ -11631,7 +11631,7 @@ EXPORTS qt_pixmap_cleanup_hook @ 11630 NONAME DATA 4 qt_pixmap_cleanup_hook_64 @ 11631 NONAME DATA 4 qt_tab_all_widgets @ 11632 NONAME DATA 1 - _Z17qDrawBorderPixmapP8QPainterRK5QRectRK8QMarginsRK7QPixmapS3_S6_RK10QTileRules @ 11633 NONAME + _Z17qDrawBorderPixmapP8QPainterRK5QRectRK8QMarginsRK7QPixmapS3_S6_RK10QTileRules @ 11633 NONAME ABSENT _Z17qHasPixmapTextureRK6QBrush @ 11634 NONAME _Z22qt_setQtEnableTestFontb @ 11635 NONAME _Z25qt_translateRawTouchEventP7QWidgetN11QTouchEvent10DeviceTypeERK5QListINS1_10TouchPointEE @ 11636 NONAME @@ -11824,7 +11824,7 @@ EXPORTS _ZN14QPaintEngineExC2Ev @ 11823 NONAME _ZN14QWidgetPrivate10allWidgetsE @ 11824 NONAME DATA 4 _ZN14QWidgetPrivate13setWSGeometryEbRK5QRect @ 11825 NONAME - _ZN14QWidgetPrivate33handleSymbianDeferredFocusChangedEv @ 11826 NONAME + _ZN14QWidgetPrivate33handleSymbianDeferredFocusChangedEv @ 11826 NONAME ABSENT _ZN15QDockAreaLayout13separatorMoveERK5QListIiERK6QPointS6_ @ 11827 NONAME _ZN15QDockAreaLayout4infoERK5QListIiE @ 11828 NONAME _ZN15QDockAreaLayout4itemERK5QListIiE @ 11829 NONAME @@ -12984,9 +12984,9 @@ EXPORTS _ZN16QS60MainDocumentD0Ev @ 12983 NONAME _ZN16QS60MainDocumentD1Ev @ 12984 NONAME _ZN16QS60MainDocumentD2Ev @ 12985 NONAME - _ZN17QPixmapBlurFilter11setBlurHintENS_8BlurHintE @ 12986 NONAME - _ZN19QGraphicsBlurEffect11setBlurHintENS_8BlurHintE @ 12987 NONAME - _ZN19QGraphicsBlurEffect15blurHintChangedENS_8BlurHintE @ 12988 NONAME + _ZN17QPixmapBlurFilter11setBlurHintENS_8BlurHintE @ 12986 NONAME ABSENT + _ZN19QGraphicsBlurEffect11setBlurHintENS_8BlurHintE @ 12987 NONAME ABSENT + _ZN19QGraphicsBlurEffect15blurHintChangedENS_8BlurHintE @ 12988 NONAME ABSENT _ZN19QS60MainApplication15CreateDocumentLEv @ 12989 NONAME _ZN19QS60MainApplicationC1Ev @ 12990 NONAME _ZN19QS60MainApplicationC2Ev @ 12991 NONAME @@ -13001,7 +13001,7 @@ EXPORTS _ZNK19QGraphicsBlurEffect8blurHintEv @ 13000 NONAME _ZNK19QS60MainApplication16ResourceFileNameEv @ 13001 NONAME _ZNK19QS60MainApplication9AppDllUidEv @ 13002 NONAME - _ZNK21QGraphicsAnchorLayout12hasConflictsEv @ 13003 NONAME + _ZNK21QGraphicsAnchorLayout12hasConflictsEv @ 13003 NONAME ABSENT _ZNK7QPixmap17toSymbianRSgImageEv @ 13004 NONAME _ZTI15QSoftKeyManager @ 13005 NONAME _ZTV15QSoftKeyManager @ 13006 NONAME @@ -13009,4 +13009,131 @@ EXPORTS _ZThn24_N13QS60MainAppUi15DynInitMenuBarLEiP11CEikMenuBar @ 13008 NONAME _ZThn24_N13QS60MainAppUi16DynInitMenuPaneLEiP12CEikMenuPane @ 13009 NONAME _ZThn88_N13QS60MainAppUi26HandleStatusPaneSizeChangeEv @ 13010 NONAME + _Z12qDrawPixmapsP8QPainterPKN12QDrawPixmaps4DataEiRK7QPixmap6QFlagsINS1_11DrawingHintEE @ 13011 NONAME + _Z17qDrawBorderPixmapP8QPainterRK5QRectRK8QMarginsRK7QPixmapS3_S6_RK10QTileRules6QFlagsIN17QDrawBorderPixmap11DrawingHintEE @ 13012 NONAME + _ZN10QImageData6createEPhiiiN6QImage6FormatEb @ 13013 NONAME + _ZN10QImageData6createERK5QSizeN6QImage6FormatEi @ 13014 NONAME + _ZN10QImageDataC1Ev @ 13015 NONAME + _ZN10QImageDataC2Ev @ 13016 NONAME + _ZN10QImageDataD1Ev @ 13017 NONAME + _ZN10QImageDataD2Ev @ 13018 NONAME + _ZN13QGraphicsItem11stackBeforeEPKS_ @ 13019 NONAME + _ZN13QGraphicsItem16setPanelModalityENS_13PanelModalityE @ 13020 NONAME + _ZN14QPaintEngineEx11drawPixmapsEPKN12QDrawPixmaps4DataEiRK7QPixmap6QFlagsINS0_11DrawingHintEE @ 13021 NONAME + _ZN14QWidgetPrivate21activateSymbianWindowEv @ 13022 NONAME + _ZN17QAbstractItemView20setDefaultDropActionEN2Qt10DropActionE @ 13023 NONAME + _ZN17QPixmapBlurFilter11setBlurHintEN2Qt10RenderHintE @ 13024 NONAME + _ZN19QApplicationPrivate16load_testabilityE @ 13025 NONAME DATA 1 + _ZN19QGraphicsBlurEffect11setBlurHintEN2Qt10RenderHintE @ 13026 NONAME + _ZN19QGraphicsBlurEffect15blurHintChangedEN2Qt10RenderHintE @ 13027 NONAME + _ZN20QGraphicsBloomEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 13028 NONAME + _ZN20QGraphicsBloomEffect11qt_metacastEPKc @ 13029 NONAME + _ZN20QGraphicsBloomEffect11setBlurHintEN2Qt10RenderHintE @ 13030 NONAME + _ZN20QGraphicsBloomEffect11setStrengthEf @ 13031 NONAME + _ZN20QGraphicsBloomEffect13setBlurRadiusEi @ 13032 NONAME + _ZN20QGraphicsBloomEffect13setBrightnessEi @ 13033 NONAME + _ZN20QGraphicsBloomEffect15blurHintChangedEN2Qt10RenderHintE @ 13034 NONAME + _ZN20QGraphicsBloomEffect15strengthChangedEf @ 13035 NONAME + _ZN20QGraphicsBloomEffect16staticMetaObjectE @ 13036 NONAME DATA 16 + _ZN20QGraphicsBloomEffect17blurRadiusChangedEi @ 13037 NONAME + _ZN20QGraphicsBloomEffect17brightnessChangedEi @ 13038 NONAME + _ZN20QGraphicsBloomEffect19getStaticMetaObjectEv @ 13039 NONAME + _ZN20QGraphicsBloomEffect4drawEP8QPainterP21QGraphicsEffectSource @ 13040 NONAME + _ZN20QGraphicsBloomEffectC1EP7QObject @ 13041 NONAME + _ZN20QGraphicsBloomEffectC2EP7QObject @ 13042 NONAME + _ZN20QGraphicsBloomEffectD0Ev @ 13043 NONAME + _ZN20QGraphicsBloomEffectD1Ev @ 13044 NONAME + _ZN20QGraphicsBloomEffectD2Ev @ 13045 NONAME + _ZN20QGraphicsItemPrivate28ensureSequentialSiblingIndexEv @ 13046 NONAME + _ZN28QGraphicsAnchorLayoutPrivate11solveMinMaxE5QListIP18QSimplexConstraintE9GraphPathPfS5_ @ 13047 NONAME + _ZN28QGraphicsAnchorLayoutPrivate12oppositeEdgeEN2Qt11AnchorPointE @ 13048 NONAME + _ZN28QGraphicsAnchorLayoutPrivate12removeAnchorEP12AnchorVertexS1_ @ 13049 NONAME + _ZN28QGraphicsAnchorLayoutPrivate12removeVertexEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13050 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13getGraphPartsENS_11OrientationE @ 13051 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13removeAnchorsEP19QGraphicsLayoutItem @ 13052 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13setAnchorSizeEP10AnchorDataPKf @ 13053 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13simplifyGraphENS_11OrientationE @ 13054 NONAME + _ZN28QGraphicsAnchorLayoutPrivate14solvePreferredE5QListIP18QSimplexConstraintE @ 13055 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15calculateGraphsENS_11OrientationE @ 13056 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15calculateGraphsEv @ 13057 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15createItemEdgesEP19QGraphicsLayoutItem @ 13058 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15edgeOrientationEN2Qt11AnchorPointE @ 13059 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15interpolateEdgeEP12AnchorVertexP10AnchorDataNS_11OrientationE @ 13060 NONAME + _ZN28QGraphicsAnchorLayoutPrivate16addAnchor_helperEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_P10AnchorData @ 13061 NONAME + _ZN28QGraphicsAnchorLayoutPrivate17addInternalVertexEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13062 NONAME + _ZN28QGraphicsAnchorLayoutPrivate17createLayoutEdgesEv @ 13063 NONAME + _ZN28QGraphicsAnchorLayoutPrivate17deleteLayoutEdgesEv @ 13064 NONAME + _ZN28QGraphicsAnchorLayoutPrivate18setItemsGeometriesERK6QRectF @ 13065 NONAME + _ZN28QGraphicsAnchorLayoutPrivate19createCenterAnchorsEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13066 NONAME + _ZN28QGraphicsAnchorLayoutPrivate19removeAnchor_helperEP12AnchorVertexS1_ @ 13067 NONAME + _ZN28QGraphicsAnchorLayoutPrivate19removeCenterAnchorsEP19QGraphicsLayoutItemN2Qt11AnchorPointEb @ 13068 NONAME + _ZN28QGraphicsAnchorLayoutPrivate20constraintsFromPathsENS_11OrientationE @ 13069 NONAME + _ZN28QGraphicsAnchorLayoutPrivate20correctEdgeDirectionERP19QGraphicsLayoutItemRN2Qt11AnchorPointES2_S5_ @ 13070 NONAME + _ZN28QGraphicsAnchorLayoutPrivate20removeInternalVertexEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13071 NONAME + _ZN28QGraphicsAnchorLayoutPrivate22restoreSimplifiedGraphENS_11OrientationE @ 13072 NONAME + _ZN28QGraphicsAnchorLayoutPrivate22simplifyGraphIterationENS_11OrientationE @ 13073 NONAME + _ZN28QGraphicsAnchorLayoutPrivate23removeCenterConstraintsEP19QGraphicsLayoutItemNS_11OrientationE @ 13074 NONAME + _ZN28QGraphicsAnchorLayoutPrivate23setupEdgesInterpolationENS_11OrientationE @ 13075 NONAME + _ZN28QGraphicsAnchorLayoutPrivate24calculateVertexPositionsENS_11OrientationE @ 13076 NONAME + _ZN28QGraphicsAnchorLayoutPrivate24constraintsFromSizeHintsERK5QListIP10AnchorDataE @ 13077 NONAME + _ZN28QGraphicsAnchorLayoutPrivate24interpolateParallelEdgesEP12AnchorVertexP18ParallelAnchorDataNS_11OrientationE @ 13078 NONAME + _ZN28QGraphicsAnchorLayoutPrivate26interpolateSequentialEdgesEP12AnchorVertexP20SequentialAnchorDataNS_11OrientationE @ 13079 NONAME + _ZN28QGraphicsAnchorLayoutPrivate27setAnchorSizeHintsFromItemsENS_11OrientationE @ 13080 NONAME + _ZN28QGraphicsAnchorLayoutPrivate9addAnchorEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_Pf @ 13081 NONAME + _ZN28QGraphicsAnchorLayoutPrivate9findPathsENS_11OrientationE @ 13082 NONAME + _ZN28QGraphicsAnchorLayoutPrivate9getAnchorEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_ @ 13083 NONAME + _ZN28QGraphicsAnchorLayoutPrivateC1Ev @ 13084 NONAME + _ZN28QGraphicsAnchorLayoutPrivateC2Ev @ 13085 NONAME + _ZNK10QImageData19checkForAlphaPixelsEv @ 13086 NONAME + _ZNK10QImageData9doImageIOEPK6QImageP12QImageWriteri @ 13087 NONAME + _ZNK13QGraphicsItem13panelModalityEv @ 13088 NONAME + _ZNK13QGraphicsItem21isBlockedByModalPanelEPPS_ @ 13089 NONAME + _ZNK17QAbstractItemView17defaultDropActionEv @ 13090 NONAME + _ZNK20QGraphicsBloomEffect10blurRadiusEv @ 13091 NONAME + _ZNK20QGraphicsBloomEffect10brightnessEv @ 13092 NONAME + _ZNK20QGraphicsBloomEffect10metaObjectEv @ 13093 NONAME + _ZNK20QGraphicsBloomEffect15boundingRectForERK6QRectF @ 13094 NONAME + _ZNK20QGraphicsBloomEffect8blurHintEv @ 13095 NONAME + _ZNK20QGraphicsBloomEffect8strengthEv @ 13096 NONAME + _ZNK28QGraphicsAnchorLayoutPrivate10anchorSizeEPK10AnchorDataPfS3_S3_ @ 13097 NONAME + _ZNK28QGraphicsAnchorLayoutPrivate12hasConflictsEv @ 13098 NONAME + _ZNK28QGraphicsAnchorLayoutPrivate16effectiveSpacingENS_11OrientationE @ 13099 NONAME + _ZTI20QGraphicsBloomEffect @ 13100 NONAME + _ZTI28QGraphicsAnchorLayoutPrivate @ 13101 NONAME + _ZTV20QGraphicsBloomEffect @ 13102 NONAME + _ZTV28QGraphicsAnchorLayoutPrivate @ 13103 NONAME + _ZN17QToolBarExtension10paintEventEP11QPaintEvent @ 13104 NONAME + _ZN17QToolBarExtension11qt_metacallEN11QMetaObject4CallEiPPv @ 13105 NONAME + _ZN17QToolBarExtension11qt_metacastEPKc @ 13106 NONAME + _ZN17QToolBarExtension14setOrientationEN2Qt11OrientationE @ 13107 NONAME + _ZN17QToolBarExtension16staticMetaObjectE @ 13108 NONAME DATA 16 + _ZN17QToolBarExtension19getStaticMetaObjectEv @ 13109 NONAME + _ZN17QToolBarExtensionC1EP7QWidget @ 13110 NONAME + _ZN17QToolBarExtensionC2EP7QWidget @ 13111 NONAME + _ZN18QGuiPlatformPlugin11qt_metacallEN11QMetaObject4CallEiPPv @ 13112 NONAME + _ZN18QGuiPlatformPlugin11qt_metacastEPKc @ 13113 NONAME + _ZN18QGuiPlatformPlugin12platformHintENS_12PlatformHintE @ 13114 NONAME + _ZN18QGuiPlatformPlugin14fileSystemIconERK9QFileInfo @ 13115 NONAME + _ZN18QGuiPlatformPlugin16staticMetaObjectE @ 13116 NONAME DATA 16 + _ZN18QGuiPlatformPlugin19getStaticMetaObjectEv @ 13117 NONAME + _ZN18QGuiPlatformPlugin19systemIconThemeNameEv @ 13118 NONAME + _ZN18QGuiPlatformPlugin20iconThemeSearchPathsEv @ 13119 NONAME + _ZN18QGuiPlatformPlugin7paletteEv @ 13120 NONAME + _ZN18QGuiPlatformPlugin9styleNameEv @ 13121 NONAME + _ZN18QGuiPlatformPluginC1EP7QObject @ 13122 NONAME + _ZN18QGuiPlatformPluginC2EP7QObject @ 13123 NONAME + _ZN18QGuiPlatformPluginD0Ev @ 13124 NONAME + _ZN18QGuiPlatformPluginD1Ev @ 13125 NONAME + _ZN18QGuiPlatformPluginD2Ev @ 13126 NONAME + _ZN28QGraphicsAnchorLayoutPrivate14solveExpandingE5QListIP18QSimplexConstraintE @ 13127 NONAME + _ZN28QGraphicsAnchorLayoutPrivate21identifyNonFloatItemsE4QSetIP10AnchorDataENS_11OrientationE @ 13128 NONAME + _ZN28QGraphicsAnchorLayoutPrivate28identifyNonFloatItems_helperEPK10AnchorDataNS_11OrientationE @ 13129 NONAME + _ZNK17QToolBarExtension10metaObjectEv @ 13130 NONAME + _ZNK17QToolBarExtension8sizeHintEv @ 13131 NONAME + _ZNK18QGuiPlatformPlugin10metaObjectEv @ 13132 NONAME + _ZTI18QGuiPlatformPlugin @ 13133 NONAME + _ZTI27QGuiPlatformPluginInterface @ 13134 NONAME + _ZTV18QGuiPlatformPlugin @ 13135 NONAME + _ZThn8_N18QGuiPlatformPluginD0Ev @ 13136 NONAME + _ZThn8_N18QGuiPlatformPluginD1Ev @ 13137 NONAME diff --git a/src/s60installs/eabi/QtNetworku.def b/src/s60installs/eabi/QtNetworku.def index 5188872..ab4562c 100644 --- a/src/s60installs/eabi/QtNetworku.def +++ b/src/s60installs/eabi/QtNetworku.def @@ -1353,7 +1353,7 @@ EXPORTS _ZN10QSslSocket22connectToHostEncryptedERK7QStringtS2_6QFlagsIN9QIODevice12OpenModeFlagEE @ 1352 NONAME _ZN13QNetworkReply15ignoreSslErrorsERK5QListI9QSslErrorE @ 1353 NONAME _ZN15QAbstractSocket12socketOptionENS_12SocketOptionE @ 1354 NONAME - _ZN15QAbstractSocket15setSocketOptionENS_12SocketOptionE8QVariant @ 1355 NONAME + _ZN15QAbstractSocket15setSocketOptionENS_12SocketOptionERK8QVariant @ 1355 NONAME _ZN17QHttpNetworkReply15ignoreSslErrorsERK5QListI9QSslErrorE @ 1356 NONAME _ZN17QHttpNetworkReply16dataSendProgressExx @ 1357 NONAME _ZN17QHttpNetworkReply7readAnyEv @ 1358 NONAME @@ -1379,7 +1379,7 @@ EXPORTS _ZN19QHttpNetworkRequest20setPipeliningAllowedEb @ 1378 NONAME _ZN19QNativeSocketEngine19getStaticMetaObjectEv @ 1379 NONAME _ZN19QSocks5SocketEngine19getStaticMetaObjectEv @ 1380 NONAME - _ZN20QNetworkProxyFactory32setUseSystemConfigurationEnabledEb @ 1381 NONAME + _ZN20QNetworkProxyFactory25setUseSystemConfigurationEb @ 1381 NONAME _ZN21QAbstractNetworkCache19getStaticMetaObjectEv @ 1382 NONAME _ZN21QAbstractSocketEngine19getStaticMetaObjectEv @ 1383 NONAME _ZN21QNetworkAccessManager19getStaticMetaObjectEv @ 1384 NONAME diff --git a/src/s60installs/eabi/QtScriptu.def b/src/s60installs/eabi/QtScriptu.def index 40d3577..1205c04 100644 --- a/src/s60installs/eabi/QtScriptu.def +++ b/src/s60installs/eabi/QtScriptu.def @@ -1,6 +1,6 @@ EXPORTS _Z14qScriptConnectP7QObjectPKcRK12QScriptValueS5_ @ 1 NONAME - _Z14qt_scriptToXmlRK7QStringi @ 2 NONAME + _Z14qt_scriptToXmlRK7QStringi @ 2 NONAME ABSENT _Z17qScriptDisconnectP7QObjectPKcRK12QScriptValueS5_ @ 3 NONAME _ZN11QScriptableC1Ev @ 4 NONAME _ZN11QScriptableC2Ev @ 5 NONAME @@ -189,11 +189,11 @@ EXPORTS _ZN24QScriptSyntaxCheckResultD1Ev @ 188 NONAME _ZN24QScriptSyntaxCheckResultD2Ev @ 189 NONAME _ZN24QScriptSyntaxCheckResultaSERKS_ @ 190 NONAME - _ZN25QScriptEngineAgentPrivateC1Ev @ 191 NONAME - _ZN25QScriptEngineAgentPrivateC2Ev @ 192 NONAME - _ZN25QScriptEngineAgentPrivateD0Ev @ 193 NONAME - _ZN25QScriptEngineAgentPrivateD1Ev @ 194 NONAME - _ZN25QScriptEngineAgentPrivateD2Ev @ 195 NONAME + _ZN25QScriptEngineAgentPrivateC1Ev @ 191 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateC2Ev @ 192 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateD0Ev @ 193 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateD1Ev @ 194 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateD2Ev @ 195 NONAME ABSENT _ZN28QScriptClassPropertyIteratorC2ERK12QScriptValue @ 196 NONAME _ZN28QScriptClassPropertyIteratorC2ERK12QScriptValueR35QScriptClassPropertyIteratorPrivate @ 197 NONAME _ZN28QScriptClassPropertyIteratorD0Ev @ 198 NONAME @@ -586,4 +586,19 @@ EXPORTS _ZThn8_N22QScriptExtensionPluginD1Ev @ 585 NONAME _ZlsR11QDataStreamRK18QScriptContextInfo @ 586 NONAME _ZrsR11QDataStreamR18QScriptContextInfo @ 587 NONAME + _Z22qt_script_isJITEnabledv @ 588 NONAME + _ZN12QScriptValueC1EP19QScriptValuePrivate @ 589 NONAME + _ZN12QScriptValueC2EP19QScriptValuePrivate @ 590 NONAME + _ZN13QScriptEngine19getStaticMetaObjectEv @ 591 NONAME + _ZN22QScriptExtensionPlugin19getStaticMetaObjectEv @ 592 NONAME + _ZN25QScriptEngineAgentPrivate11atStatementERKN5QTJSC17DebuggerCallFrameEiii @ 593 NONAME + _ZN25QScriptEngineAgentPrivate11returnEventERKN5QTJSC17DebuggerCallFrameEii @ 594 NONAME + _ZN25QScriptEngineAgentPrivate12evaluateStopERKN5QTJSC7JSValueEi @ 595 NONAME + _ZN25QScriptEngineAgentPrivate12functionExitERKN5QTJSC7JSValueEi @ 596 NONAME + _ZN25QScriptEngineAgentPrivate14exceptionCatchERKN5QTJSC17DebuggerCallFrameEi @ 597 NONAME + _ZN25QScriptEngineAgentPrivate14exceptionThrowERKN5QTJSC17DebuggerCallFrameEib @ 598 NONAME + _ZN25QScriptEngineAgentPrivate18didReachBreakpointERKN5QTJSC17DebuggerCallFrameEiii @ 599 NONAME + _ZN25QScriptEngineAgentPrivate6attachEv @ 600 NONAME + _ZN25QScriptEngineAgentPrivate6detachEv @ 601 NONAME + _Z5qHashRK13QScriptString @ 602 NONAME diff --git a/src/s60installs/eabi/QtSqlu.def b/src/s60installs/eabi/QtSqlu.def index 99f0d00..4d4791a 100644 --- a/src/s60installs/eabi/QtSqlu.def +++ b/src/s60installs/eabi/QtSqlu.def @@ -236,7 +236,7 @@ EXPORTS _ZN9QSqlFieldC1ERKS_ @ 235 NONAME _ZN9QSqlFieldC1Ev @ 236 NONAME ABSENT _ZN9QSqlFieldC2ERK7QString @ 237 NONAME ABSENT - _ZN9QSqlFieldC2ERK7QStringN8QVariant4TypeE @ 238 NONAME ABSENT + _ZN9QSqlFieldC2ERK7QStringN8QVariant4TypeE @ 238 NONAME _ZN9QSqlFieldC2ERKS_ @ 239 NONAME _ZN9QSqlFieldC2Ev @ 240 NONAME ABSENT _ZN9QSqlFieldD1Ev @ 241 NONAME diff --git a/src/s60installs/eabi/phononu.def b/src/s60installs/eabi/phononu.def index d407ba4..d70942c 100644 --- a/src/s60installs/eabi/phononu.def +++ b/src/s60installs/eabi/phononu.def @@ -495,11 +495,11 @@ EXPORTS _ZTIN6Phonon19AbstractVideoOutputE @ 494 NONAME _ZTIN6Phonon19BackendCapabilities8NotifierE @ 495 NONAME ABSENT _ZTIN6Phonon22MediaControllerPrivateE @ 496 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 497 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 498 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 499 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 500 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 501 NONAME ABSENT + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 497 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 498 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 499 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 500 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 501 NONAME _ZTIN6Phonon24VolumeFaderEffectPrivateE @ 502 NONAME ABSENT _ZTIN6Phonon26AbstractAudioOutputPrivateE @ 503 NONAME ABSENT _ZTIN6Phonon26AbstractMediaStreamPrivateE @ 504 NONAME @@ -532,11 +532,11 @@ EXPORTS _ZTVN6Phonon19AbstractVideoOutputE @ 531 NONAME _ZTVN6Phonon19BackendCapabilities8NotifierE @ 532 NONAME ABSENT _ZTVN6Phonon22MediaControllerPrivateE @ 533 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 534 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 535 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 536 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 537 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 538 NONAME ABSENT + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 534 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 535 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 536 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 537 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 538 NONAME _ZTVN6Phonon24VolumeFaderEffectPrivateE @ 539 NONAME ABSENT _ZTVN6Phonon26AbstractAudioOutputPrivateE @ 540 NONAME ABSENT _ZTVN6Phonon26AbstractMediaStreamPrivateE @ 541 NONAME diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 3aef05e..7233e8a 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -19,7 +19,6 @@ symbian: { QtXml.dll \ QtGui.dll \ QtNetwork.dll \ - QtScript.dll \ QtTest.dll \ QtSql.dll @@ -94,6 +93,10 @@ symbian: { qtlibraries.sources += Phonon.dll } + contains(QT_CONFIG, script): { + qtlibraries.sources += QtScript.dll + } + contains(QT_CONFIG, webkit): { qtlibraries.sources += QtWebKit.dll } diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 5f31054..f1fc135 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -468,6 +468,22 @@ inline QScriptValue QScriptValuePrivate::property(const QString &name, int resol return property(JSC::Identifier(exec, name), resolveMode); } +inline void* QScriptValuePrivate::operator new(size_t size, QScriptEnginePrivate *engine) +{ + if (engine) + return engine->allocateScriptValuePrivate(size); + return qMalloc(size); +} + +inline void QScriptValuePrivate::operator delete(void *ptr) +{ + QScriptValuePrivate *d = reinterpret_cast<QScriptValuePrivate*>(ptr); + if (d->engine) + d->engine->freeScriptValuePrivate(d); + else + qFree(d); +} + inline void QScriptEnginePrivate::registerScriptString(QScriptStringPrivate *value) { Q_ASSERT(value->type == QScriptStringPrivate::HeapAllocated); diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp index 65bd818..2fb157f 100644 --- a/src/script/api/qscriptstring.cpp +++ b/src/script/api/qscriptstring.cpp @@ -150,14 +150,8 @@ bool QScriptString::isValid() const bool QScriptString::operator==(const QScriptString &other) const { Q_D(const QScriptString); - if (d == other.d_func()) - return true; if (!d || !other.d_func()) return d == other.d_func(); - if (d->engine != other.d_func()->engine) - return false; - if (!d->engine) - return true; return d->identifier == other.d_func()->identifier; } @@ -195,4 +189,12 @@ QScriptString::operator QString() const return toString(); } +uint qHash(const QScriptString &key) +{ + QScriptStringPrivate *d = QScriptStringPrivate::get(key); + if (!d) + return 0; + return qHash(d->identifier.ustring().rep()); +} + QT_END_NAMESPACE diff --git a/src/script/api/qscriptstring.h b/src/script/api/qscriptstring.h index e0a808e..40d156c 100644 --- a/src/script/api/qscriptstring.h +++ b/src/script/api/qscriptstring.h @@ -76,6 +76,8 @@ private: Q_DECLARE_PRIVATE(QScriptString) }; +Q_SCRIPT_EXPORT uint qHash(const QScriptString &key); + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/script/api/qscriptstring_p.h b/src/script/api/qscriptstring_p.h index 25ce702..d3bb47d 100644 --- a/src/script/api/qscriptstring_p.h +++ b/src/script/api/qscriptstring_p.h @@ -73,6 +73,8 @@ public: inline ~QScriptStringPrivate(); static inline void init(QScriptString &q, QScriptStringPrivate *d); + static inline QScriptStringPrivate *get(const QScriptString &q); + inline void detachFromEngine(); QBasicAtomicInt ref; @@ -101,6 +103,11 @@ inline void QScriptStringPrivate::init(QScriptString &q, QScriptStringPrivate *d q.d_ptr = d; } +inline QScriptStringPrivate *QScriptStringPrivate::get(const QScriptString &q) +{ + return const_cast<QScriptStringPrivate*>(q.d_func()); +} + inline void QScriptStringPrivate::detachFromEngine() { engine = 0; diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 92c987c..b8340a7 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -280,7 +280,7 @@ QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolv { Q_ASSERT(isObject()); JSC::ExecState *exec = engine->currentFrame; - JSC::JSObject *object = jscValue.getObject(); + JSC::JSObject *object = JSC::asObject(jscValue); JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object)); JSC::JSValue result; if (const_cast<JSC::JSObject*>(object)->getOwnPropertySlot(exec, id, slot)) { @@ -303,7 +303,7 @@ QScriptValue QScriptValuePrivate::property(quint32 index, int resolveMode) const { Q_ASSERT(isObject()); JSC::ExecState *exec = engine->currentFrame; - JSC::JSObject *object = jscValue.getObject(); + JSC::JSObject *object = JSC::asObject(jscValue); JSC::PropertySlot slot(const_cast<JSC::JSObject*>(object)); JSC::JSValue result; if (const_cast<JSC::JSObject*>(object)->getOwnPropertySlot(exec, index, slot)) { @@ -466,22 +466,6 @@ void QScriptValuePrivate::detachFromEngine() engine = 0; } -void* QScriptValuePrivate::operator new(size_t size, QScriptEnginePrivate *engine) -{ - if (engine) - return engine->allocateScriptValuePrivate(size); - return qMalloc(size); -} - -void QScriptValuePrivate::operator delete(void *ptr) -{ - QScriptValuePrivate *d = reinterpret_cast<QScriptValuePrivate*>(ptr); - if (d->engine) - d->engine->freeScriptValuePrivate(d); - else - qFree(d); -} - /*! \internal */ diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 6cbda97..77b5084 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -66,10 +66,10 @@ class QScriptEnginePrivate; class QScriptValue; class QScriptValuePrivate { - Q_DISABLE_COPY(QScriptValuePrivate); + Q_DISABLE_COPY(QScriptValuePrivate) public: - void* operator new(size_t, QScriptEnginePrivate*); - void operator delete(void*); + inline void* operator new(size_t, QScriptEnginePrivate*); + inline void operator delete(void*); enum Type { JavaScriptCore, diff --git a/src/xmlpatterns/data/qvaluefactory.cpp b/src/xmlpatterns/data/qvaluefactory.cpp index bac53b2..8f7e5a3 100644 --- a/src/xmlpatterns/data/qvaluefactory.cpp +++ b/src/xmlpatterns/data/qvaluefactory.cpp @@ -66,7 +66,7 @@ public: } AtomicValue::Ptr operator()(const AtomicValue::Ptr &lexicalValue, - const SchemaType::Ptr &type, + const SchemaType::Ptr & /*type*/, const ReportContext::Ptr &context) { prepareCasting(context, BuiltinTypes::xsString); diff --git a/src/xmlpatterns/functions/qsequencefns_p.h b/src/xmlpatterns/functions/qsequencefns_p.h index e406b95..fa799d3 100644 --- a/src/xmlpatterns/functions/qsequencefns_p.h +++ b/src/xmlpatterns/functions/qsequencefns_p.h @@ -149,7 +149,6 @@ namespace QPatternist // RVCT doesn't like using template parameter in trinary operator when the trinary operator result is // passed directly into another constructor. Q_ASSERT(Id == IDExistsFN || Id == IDEmptyFN); - const Expression::Ptr me(FunctionCall::compress(context)); diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index 8f7b6af..41c6b82 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -123,6 +123,7 @@ class ElementNamespaceHandler : m_parser(parser) { Q_ASSERT(m_parser->isStartElement() && (XsdSchemaToken::toToken(m_parser->name()) == tag) && (XsdSchemaToken::toToken(m_parser->namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI)); + Q_UNUSED(tag) m_parser->m_namespaceSupport.pushContext(); m_parser->m_namespaceSupport.setPrefixes(m_parser->namespaceDeclarations()); } diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index 4e60101..d58402b 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -54,10 +54,13 @@ class tst_NetworkSelfTest: public QObject { Q_OBJECT + QHostAddress cachedIpAddress; public: tst_NetworkSelfTest(); virtual ~tst_NetworkSelfTest(); + QHostAddress serverIpAddress(); + private slots: void hostTest(); void dnsResolution_data(); @@ -325,6 +328,16 @@ tst_NetworkSelfTest::~tst_NetworkSelfTest() { } +QHostAddress tst_NetworkSelfTest::serverIpAddress() +{ + if (cachedIpAddress.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol) { + // need resolving + QHostInfo resolved = QHostInfo::fromName(QtNetworkSettings::serverName()); + cachedIpAddress = resolved.addresses().first(); + } + return cachedIpAddress; +} + void tst_NetworkSelfTest::hostTest() { // this is a localhost self-test @@ -353,14 +366,22 @@ void tst_NetworkSelfTest::dnsResolution() QHostInfo resolved = QHostInfo::fromName(hostName); QVERIFY2(resolved.error() == QHostInfo::NoError, QString("Failed to resolve hostname %1: %2").arg(hostName, resolved.errorString()).toLocal8Bit()); + QVERIFY2(resolved.addresses().size() > 0, "Got 0 addresses for server IP"); + + cachedIpAddress = resolved.addresses().first(); } void tst_NetworkSelfTest::serverReachability() { - // check that we get a proper error connecting to port 1 + // check that we get a proper error connecting to port 12346 QTcpSocket socket; - socket.connectToHost(QtNetworkSettings::serverName(), 1); + socket.connectToHost(QtNetworkSettings::serverName(), 12346); + + QTime timer; + timer.start(); socket.waitForConnected(10000); + QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong"); + QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!"); QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError, QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit()); @@ -516,7 +537,18 @@ void tst_NetworkSelfTest::httpsServer() void tst_NetworkSelfTest::httpProxy() { netChat(3128, QList<Chat>() - // proxy GET + // proxy GET by IP + << Chat::send("GET http://" + serverIpAddress().toString().toLatin1() + "/ HTTP/1.0\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Proxy-connection: close\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::DiscardUntilDisconnect + + // proxy GET by hostname + << Chat::Reconnect << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n" "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" "Proxy-connection: close\r\n" @@ -526,7 +558,17 @@ void tst_NetworkSelfTest::httpProxy() << Chat::expect("200 ") << Chat::DiscardUntilDisconnect - // proxy CONNECT + // proxy CONNECT by IP + << Chat::Reconnect + << Chat::send("CONNECT " + serverIpAddress().toString().toLatin1() + ":21 HTTP/1.0\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::discardUntil("\r\n\r\n") + << ftpChat() + + // proxy CONNECT by hostname << Chat::Reconnect << Chat::send("CONNECT " + QtNetworkSettings::serverName().toLatin1() + ":21 HTTP/1.0\r\n" "\r\n") @@ -534,7 +576,8 @@ void tst_NetworkSelfTest::httpProxy() << Chat::discardUntil(" ") << Chat::expect("200 ") << Chat::discardUntil("\r\n\r\n") - << ftpChat()); + << ftpChat() + ); } void tst_NetworkSelfTest::httpProxyBasicAuth() @@ -591,11 +634,22 @@ static const char handshakeAuthPassword[] = "\5\1\2\1\12qsockstest\10password"; static const char handshakeOkPasswdAuth[] = "\5\2\1\0"; static const char handshakeAuthNotOk[] = "\5\377"; static const char connect1[] = "\5\1\0\1\177\0\0\1\0\25"; // Connect IPv4 127.0.0.1 port 21 +static const char connect1a[] = "\5\1\0\1"; // just "Connect to IPv4" +static const char connect1b[] = "\0\25"; // just "port 21" static const char connect2[] = "\5\1\0\3\11localhost\0\25"; // Connect hostname localhost 21 +static const char connect2a[] = "\5\1\0\3"; // just "Connect to hostname" static const char connected[] = "\5\0\0"; +#define QBA(x) (QByteArray::fromRawData(x, -1 + sizeof(x))) + void tst_NetworkSelfTest::socks5Proxy() { + union { + char buf[4]; + quint32 data; + } ip4Address; + ip4Address.data = qToBigEndian(serverIpAddress().toIPv4Address()); + netChat(1080, QList<Chat>() // IP address connection << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) @@ -606,7 +660,17 @@ void tst_NetworkSelfTest::socks5Proxy() << Chat::skipBytes(6) // the server's local address and port << ftpChat() - // hostname connection + // connect by IP + << Chat::Reconnect + << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) + << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) + << Chat::send(QBA(connect1a) + QByteArray::fromRawData(ip4Address.buf, 4) + QBA(connect1b)) + << Chat::expect(QByteArray(connected, -1 + sizeof connected)) + << Chat::expect("\1") // IPv4 address following + << Chat::skipBytes(6) // the server's local address and port + << ftpChat() + + // connect to "localhost" by hostname << Chat::Reconnect << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) @@ -615,6 +679,16 @@ void tst_NetworkSelfTest::socks5Proxy() << Chat::expect("\1") // IPv4 address following << Chat::skipBytes(6) // the server's local address and port << ftpChat() + + // connect to server by its official name + << Chat::Reconnect + << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) + << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) + << Chat::send(QBA(connect2a) + char(QtNetworkSettings::serverName().size()) + QtNetworkSettings::serverName().toLatin1() + QBA(connect1b)) + << Chat::expect(QByteArray(connected, -1 + sizeof connected)) + << Chat::expect("\1") // IPv4 address following + << Chat::skipBytes(6) // the server's local address and port + << ftpChat() ); } diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index 4e385d5..d6911d2 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -1225,6 +1225,9 @@ void tst_QAbstractItemView::task250754_fontChange() void tst_QAbstractItemView::task200665_itemEntered() { +#ifdef Q_OS_WINCE_WM + QSKIP("On Windows Mobile the mouse tracking is unavailable at the moment", SkipAll); +#endif //we test that view will emit entered //when the scrollbar move but not the mouse itself QStandardItemModel model(1000,1); diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp index 9f7a78e..5c70bde 100644 --- a/tests/auto/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp @@ -714,7 +714,11 @@ void tst_QAbstractSlider::wheelEvent_data() << 1 // delta << int(Qt::Vertical) // orientation of slider << int(Qt::Vertical) // orientation of wheel +#ifdef Q_WS_MAC + << 1 // expected position after +#else << 20 // expected position after +#endif << QPoint(0,0); QTest::newRow("Normal data page") << 0 // initial position @@ -773,7 +777,11 @@ void tst_QAbstractSlider::wheelEvent_data() << 1 // delta << int(Qt::Horizontal) // orientation of slider << int(Qt::Horizontal) // orientation of wheel +#ifdef Q_WS_MAC + << 49 // expected position after +#else << 30 // expected position after +#endif << QPoint(1,1); QTest::newRow("Past end") << 50 // initial position @@ -784,7 +792,11 @@ void tst_QAbstractSlider::wheelEvent_data() << false // inverted controls << 1 // wheel scroll lines << false // with modifiers +#ifdef Q_WS_MAC + << 60 // delta +#else << 2 // delta +#endif << int(Qt::Horizontal) // orientation of slider << int(Qt::Horizontal) // orientation of wheel << 100 // expected position after @@ -798,7 +810,11 @@ void tst_QAbstractSlider::wheelEvent_data() << false // inverted controls << 1 // wheel scroll lines << false // with modifiers - << -2 // delta +#ifdef Q_WS_MAC + << -60 // delta +#else + << -2 // delta +#endif << int(Qt::Horizontal) // orientation of slider << int(Qt::Horizontal) // orientation of wheel << 0 // expected position after diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 9f13aca..286ea2d 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -69,6 +69,10 @@ private slots: void delete_anchor(); void conflicts(); void sizePolicy(); + void expandingSequence(); + void expandingSequenceFairDistribution(); + void expandingParallel(); + void floatConflict(); }; class RectWidget : public QGraphicsWidget @@ -155,7 +159,15 @@ void tst_QGraphicsAnchorLayout::simple() QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); + + // Horizontal + l->addAnchor(l, Qt::AnchorLeft, w1, Qt::AnchorLeft); l->addAnchor(w1, Qt::AnchorRight, w2, Qt::AnchorLeft); + l->addAnchor(w2, Qt::AnchorRight, l, Qt::AnchorRight); + + // Vertical + l->addAnchors(l, w1, Qt::Vertical); + l->addAnchors(l, w2, Qt::Vertical); QGraphicsWidget p; p.setLayout(l); @@ -586,6 +598,20 @@ void tst_QGraphicsAnchorLayout::snake() QCOMPARE(b->geometry(), QRectF(90.0, 100.0, 10.0, 100.0)); QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0)); QCOMPARE(p.size(), layoutMaximumSize); + + QVERIFY(layoutHasConflict(l) == false); + + // Test QSizePolicy::ExpandFlag, it shouldn't change the extreme + // points of the layout... + b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + QSizeF newLayoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QSizeF newLayoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QSizeF newLayoutPreferredSize = l->effectiveSizeHint(Qt::PreferredSize); + + QCOMPARE(layoutMinimumSize, newLayoutMinimumSize); + QCOMPARE(layoutMaximumSize, newLayoutMaximumSize); + QCOMPARE(layoutPreferredSize, newLayoutPreferredSize); } void tst_QGraphicsAnchorLayout::snakeOppositeDirections() @@ -1135,12 +1161,19 @@ void tst_QGraphicsAnchorLayout::delete_anchor() QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setSpacing(0); l->setContentsMargins(0, 0, 0, 0); + + // Horizontal l->addAnchor(l, Qt::AnchorLeft, w1, Qt::AnchorLeft); l->addAnchor(w1, Qt::AnchorRight, w2, Qt::AnchorLeft); l->addAnchor(w2, Qt::AnchorRight, l, Qt::AnchorRight); l->addAnchor(w1, Qt::AnchorRight, w3, Qt::AnchorLeft); l->addAnchor(w3, Qt::AnchorRight, l, Qt::AnchorRight); + // Vertical + l->addAnchors(l, w1, Qt::Vertical); + l->addAnchors(l, w2, Qt::Vertical); + l->addAnchors(l, w3, Qt::Vertical); + QGraphicsAnchor *anchor = l->anchor(w3, Qt::AnchorRight, l, Qt::AnchorRight); anchor->setSpacing(10); @@ -1254,7 +1287,7 @@ void tst_QGraphicsAnchorLayout::sizePolicy() w1->adjustSize(); QCOMPARE(l->effectiveSizeHint(Qt::MinimumSize), QSizeF(0, 0)); - QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(0, 0)); + QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(100, 100)); QCOMPARE(l->effectiveSizeHint(Qt::MaximumSize), QSizeF(100, 100)); delete p; @@ -1308,5 +1341,249 @@ void tst_QGraphicsAnchorLayout::conflicts() delete p; } +void tst_QGraphicsAnchorLayout::expandingSequence() +{ + QSizeF min(10, 10); + QSizeF pref(50, 10); + QSizeF max(100, 10); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + + b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + // horizontal + setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0); + setAnchor(l, b, Qt::AnchorRight, l, Qt::AnchorRight, 0); + + // vertical + l->addAnchors(l, a, Qt::Vertical); + l->addAnchors(l, b, Qt::Vertical); + + QCOMPARE(l->count(), 2); + + QGraphicsWidget p; + p.setLayout(l); + + QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QCOMPARE(layoutMinimumSize.width(), qreal(20)); + + QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); + p.resize(layoutExpandedSize); + + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), max); + + QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QCOMPARE(layoutMaximumSize.width(), qreal(200)); +} + +void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution() +{ + QSizeF min(10, 10); + QSizeF pref(50, 10); + QSizeF max(100, 10); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *c = createItem(min, pref, max, "c"); + QGraphicsWidget *d = createItem(min, pref, max, "d"); + + b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + d->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + // horizontal + setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0); + setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); + setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0); + setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 0); + + // vertical + l->addAnchors(l, a, Qt::Vertical); + l->addAnchors(l, b, Qt::Vertical); + l->addAnchors(l, c, Qt::Vertical); + l->addAnchors(l, d, Qt::Vertical); + + QCOMPARE(l->count(), 4); + + QGraphicsWidget p; + p.setLayout(l); + + QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QCOMPARE(layoutMinimumSize.width(), qreal(40)); + + QSizeF layoutPartialExpandedSize((2 * pref.width()) + (2 * (pref.width() + 10)), + layoutMinimumSize.height()); + p.resize(layoutPartialExpandedSize); + + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), pref + QSizeF(10, 0)); + QCOMPARE(c->geometry().size(), pref); + QCOMPARE(d->geometry().size(), pref + QSizeF(10, 0)); + + QSizeF layoutExpandedSize((2 * pref.width()) + (2 * max.width()), + layoutMinimumSize.height()); + p.resize(layoutExpandedSize); + + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), max); + QCOMPARE(c->geometry().size(), pref); + QCOMPARE(d->geometry().size(), max); + + QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QCOMPARE(layoutMaximumSize.width(), qreal(400)); + + // Now we change D to have more "room for growth" from its preferred size + // to its maximum size. We expect a proportional fair distribution. Note that + // this seems to not conform with what QGraphicsLinearLayout does. + d->setMaximumSize(QSizeF(150, 10)); + + QSizeF newLayoutExpandedSize((2 * pref.width()) + (max.width() + 150), + layoutMinimumSize.height()); + p.resize(newLayoutExpandedSize); + + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), max); + QCOMPARE(c->geometry().size(), pref); + QCOMPARE(d->geometry().size(), QSizeF(150, 10)); + + QSizeF newLayoutPartialExpandedSize((4 * pref.width()) + 75, + layoutMinimumSize.height()); + p.resize(newLayoutPartialExpandedSize); + + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), pref + QSizeF(25, 0)); + QCOMPARE(c->geometry().size(), pref); + QCOMPARE(d->geometry().size(), pref + QSizeF(50, 0)); +} + +void tst_QGraphicsAnchorLayout::expandingParallel() +{ + QSizeF min(10, 10); + QSizeF pref(50, 10); + QSizeF max(100, 10); + QSizeF max2(100, 50); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *c = createItem(min, pref, max2, "c"); + + b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + // horizontal + setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); + setAnchor(l, l, Qt::AnchorLeft, b, Qt::AnchorLeft, 0); + + setAnchor(l, a, Qt::AnchorRight, c, Qt::AnchorLeft, 0); + setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); + + setAnchor(l, c, Qt::AnchorRight, l, Qt::AnchorRight, 0); + + // vertical + l->addAnchors(l, c, Qt::Vertical); + setAnchor(l, l, Qt::AnchorTop, a, Qt::AnchorTop, 0); + setAnchor(l, a, Qt::AnchorBottom, c, Qt::AnchorVerticalCenter, 0); + setAnchor(l, b, Qt::AnchorTop, c, Qt::AnchorVerticalCenter, 0); + setAnchor(l, b, Qt::AnchorBottom, l, Qt::AnchorBottom, 0); + + QCOMPARE(l->count(), 3); + + QGraphicsWidget p; + p.setLayout(l); + + QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QCOMPARE(layoutMinimumSize.width(), qreal(20)); + + QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); + p.resize(layoutExpandedSize); + + QCOMPARE(a->geometry().size(), max); + QCOMPARE(b->geometry().size(), max); + QCOMPARE(c->geometry().size(), QSizeF(pref.width(), 20)); + + QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QCOMPARE(layoutMaximumSize.width(), qreal(200)); + + // + // Change the parallel connection to a paralell connection of b with a center... + // + QGraphicsAnchor *anchor = l->anchor(b, Qt::AnchorRight, c, Qt::AnchorLeft); + delete anchor; + setAnchor(l, b, Qt::AnchorRight, a, Qt::AnchorHorizontalCenter, 0); + a->setMaximumSize(max + QSizeF(100, 0)); + + QSizeF newLayoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QCOMPARE(newLayoutMinimumSize.width(), qreal(30)); + + QSizeF newLayoutExpandedSize = layoutExpandedSize + QSizeF(100, 0); + p.resize(newLayoutExpandedSize); + + QCOMPARE(a->geometry().size(), max + QSizeF(100, 0)); + QCOMPARE(b->geometry().size(), max); + QCOMPARE(c->geometry().size(), QSizeF(pref.width(), 20)); + + QSizeF newLayoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QCOMPARE(newLayoutMaximumSize.width(), qreal(300)); +} + +void tst_QGraphicsAnchorLayout::floatConflict() +{ + QGraphicsWidget *a = createItem(QSizeF(80,10), QSizeF(90,10), QSizeF(100,10), "a"); + QGraphicsWidget *b = createItem(QSizeF(80,10), QSizeF(90,10), QSizeF(100,10), "b"); + + QGraphicsAnchorLayout *l; + QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window); + + l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + p->setLayout(l); + + // horizontal + // with this anchor we have two floating items + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft); + + // Just checking if the layout is handling well the removal of floating items + delete l->anchor(a, Qt::AnchorRight, b, Qt::AnchorLeft); + QCOMPARE(l->count(), 0); + QCOMPARE(layoutHasConflict(l), false); + + // setting back the same anchor + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft); + + // We don't support floating items but they should be counted as if they are in the layout + QCOMPARE(l->count(), 2); + // Although, we have an invalid situation + QCOMPARE(layoutHasConflict(l), true); + + // Semi-floats are supported + setAnchor(l, a, Qt::AnchorLeft, l, Qt::AnchorLeft); + QCOMPARE(l->count(), 2); + + // Vertically the layout has floating items. Therefore, we have a conflict + QCOMPARE(layoutHasConflict(l), true); + + // No more floating items + setAnchor(l, b, Qt::AnchorRight, l, Qt::AnchorRight); + setAnchor(l, a, Qt::AnchorTop, l, Qt::AnchorTop); + setAnchor(l, a, Qt::AnchorBottom, l, Qt::AnchorBottom); + setAnchor(l, b, Qt::AnchorTop, l, Qt::AnchorTop); + setAnchor(l, b, Qt::AnchorBottom, l, Qt::AnchorBottom); + QCOMPARE(layoutHasConflict(l), false); + + delete p; +} + QTEST_MAIN(tst_QGraphicsAnchorLayout) #include "tst_qgraphicsanchorlayout.moc" diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index a521b78..148b2c8 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -530,16 +530,18 @@ void tst_QGraphicsAnchorLayout1::testIsValid() TestWidget *widget1 = new TestWidget(); TestWidget *widget2 = new TestWidget(); + // Vertically the layout has floating items. Therefore, we have a conflict layout->setAnchor(layout, Qt::AnchorLeft, widget1, Qt::AnchorLeft, 0.1); layout->setAnchor(layout, Qt::AnchorRight, widget1, Qt::AnchorRight, -0.1); + // Horizontally the layout has floating items. Therefore, we have a conflict layout->setAnchor(layout, Qt::AnchorTop, widget2, Qt::AnchorTop, 0.1); layout->setAnchor(layout, Qt::AnchorBottom, widget2, Qt::AnchorBottom, -0.1); widget->setLayout(layout); widget->setGeometry(QRectF(0,0,100,100)); - QCOMPARE(layout->isValid(), true); + QCOMPARE(layout->isValid(), false); delete widget; } } @@ -1413,9 +1415,6 @@ void tst_QGraphicsAnchorLayout1::testMixedSpacing_data() QTest::newRow("One widget, unsolvable") << QSizeF(10, 10) << theData << theResult; } - // ### BUG. We are not handling "floating" elements properly. Ie. elements that - // have no anchors in a given orientation. - if (0) // Two widgets, one has fixed size { BasicLayoutTestDataList theData; diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 8459331..f5e9acb 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2819,17 +2819,15 @@ void tst_QGraphicsScene::update2() CustomView view; view.setScene(&scene); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QTest::qWait(250); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.repaints >= 1); view.repaints = 0; // Make sure QGraphicsScene::update only requires one event-loop iteration // before the view is updated. scene.update(); qApp->processEvents(); - QCOMPARE(view.repaints, 1); + QTRY_COMPARE(view.repaints, 1); view.repaints = 0; // The same for partial scene updates. diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index e8979ea..b407fef 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -159,7 +159,11 @@ void tst_QGraphicsTransform::scale() // definitions correct for the difference. static inline bool fuzzyCompare(qreal p1, qreal p2) { - return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); + // increase delta on small machines using float instead of double + if (sizeof(qreal) == sizeof(float)) + return (qAbs(p1 - p2) <= 0.00002f * qMin(qAbs(p1), qAbs(p2))); + else + return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); } static bool fuzzyCompare(const QTransform& t1, const QTransform& t2) { diff --git a/tests/auto/qicoimageformat/qicoimageformat.pro b/tests/auto/qicoimageformat/qicoimageformat.pro index c0aa4b5..b9c8622 100644 --- a/tests/auto/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/qicoimageformat/qicoimageformat.pro @@ -15,9 +15,12 @@ wince*: { } else:symbian* { addFiles.sources = icons addFiles.path = . - addPlugins.sources = qico.dll - addPlugins.path = imageformats - DEPLOYMENT += addFiles addPlugins + DEPLOYMENT += addFiles + qt_not_deployed { + addPlugins.sources = qico.dll + addPlugins.path = imageformats + DEPLOYMENT += addPlugins + } TARGET.UID3 = 0xE0340004 DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x","")) } else { diff --git a/tests/auto/qicon/qicon.pro b/tests/auto/qicon/qicon.pro index 8ae252f..68b888d 100644 --- a/tests/auto/qicon/qicon.pro +++ b/tests/auto/qicon/qicon.pro @@ -18,9 +18,12 @@ wince* { QT += xml svg addFiles.sources = *.png tst_qicon.cpp *.svg *.svgz addFiles.path = . - plugins.sources = qsvgicon.dll - plugins.path = iconengines - DEPLOYMENT += addFiles plugins + DEPLOYMENT += addFiles + qt_not_deployed { + plugins.sources = qsvgicon.dll + plugins.path = iconengines + DEPLOYMENT += plugins + } } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/qimage/qimage.pro b/tests/auto/qimage/qimage.pro index 69d6f0f..3e0bd69 100644 --- a/tests/auto/qimage/qimage.pro +++ b/tests/auto/qimage/qimage.pro @@ -10,9 +10,12 @@ wince*: { TARGET.EPOCHEAPSIZE = 0x200000 0x800000 addImages.sources = images/* addImages.path = images - imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll - imagePlugins.path = imageformats - DEPLOYMENT += addImages imagePlugins + DEPLOYMENT += addImages + qt_not_deployed { + imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll + imagePlugins.path = imageformats + DEPLOYMENT += imagePlugins + } } else { contains(QT_CONFIG, qt3support): QT += qt3support DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro index 31a9b0f..5b061b0 100644 --- a/tests/auto/qimagereader/qimagereader.pro +++ b/tests/auto/qimagereader/qimagereader.pro @@ -30,8 +30,12 @@ symbian*: { images.sources = images images.path = . - imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll - imagePlugins.path = imageformats + DEPLOYMENT += images - DEPLOYMENT += images imagePlugins + qt_not_deployed { + imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll + imagePlugins.path = imageformats + + DEPLOYMENT += imagePlugins + } } diff --git a/tests/auto/qimagewriter/qimagewriter.pro b/tests/auto/qimagewriter/qimagewriter.pro index 5a2c908..8da2942 100644 --- a/tests/auto/qimagewriter/qimagewriter.pro +++ b/tests/auto/qimagewriter/qimagewriter.pro @@ -13,9 +13,12 @@ wince*: { } else:symbian* { addFiles.sources = images\*.* addFiles.path = images - imagePlugins.sources = qjpeg.dll qtiff.dll - imagePlugins.path = imageformats - DEPLOYMENT += addFiles imagePlugins + DEPLOYMENT += addFiles + qt_not_deployed { + imagePlugins.sources = qjpeg.dll qtiff.dll + imagePlugins.path = imageformats + DEPLOYMENT += imagePlugins + } } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/qitemmodel/qitemmodel.pro b/tests/auto/qitemmodel/qitemmodel.pro index eb62b24..2d0bdea 100644 --- a/tests/auto/qitemmodel/qitemmodel.pro +++ b/tests/auto/qitemmodel/qitemmodel.pro @@ -16,9 +16,11 @@ QT += sql symbian { TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb" - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 726ca55..4eb149f 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -812,6 +812,9 @@ public: void tst_QMenu::task258920_mouseBorder() { +#ifdef Q_OS_WINCE_WM + QSKIP("Mouse move related signals for Windows Mobile unavailable", SkipAll); +#endif Menu258920 menu; QAction *action = menu.addAction("test"); diff --git a/tests/auto/qmovie/qmovie.pro b/tests/auto/qmovie/qmovie.pro index 15f0c83..30e5901 100644 --- a/tests/auto/qmovie/qmovie.pro +++ b/tests/auto/qmovie/qmovie.pro @@ -18,7 +18,9 @@ symbian*: { addFiles.path = animations DEPLOYMENT += addFiles - imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll - imagePlugins.path = imageformats - DEPLOYMENT += imagePlugins -}
\ No newline at end of file + qt_not_deployed { + imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll + imagePlugins.path = imageformats + DEPLOYMENT += imagePlugins + } +} diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro index d4c0f4c..dd058a4 100644 --- a/tests/auto/qscriptengine/qscriptengine.pro +++ b/tests/auto/qscriptengine/qscriptengine.pro @@ -1,7 +1,12 @@ load(qttest_p4) QT = core gui script SOURCES += tst_qscriptengine.cpp -!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" + +wince* { + DEFINES += SRCDIR=\\\"./\\\" +} else:!symbian { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} wince*|symbian*: { addFiles.sources = script diff --git a/tests/auto/qscriptstring/tst_qscriptstring.cpp b/tests/auto/qscriptstring/tst_qscriptstring.cpp index 0968b61..e1a4bc1 100644 --- a/tests/auto/qscriptstring/tst_qscriptstring.cpp +++ b/tests/auto/qscriptstring/tst_qscriptstring.cpp @@ -58,6 +58,7 @@ public: private slots: void test(); + void hash(); }; tst_QScriptString::tst_QScriptString() @@ -138,5 +139,21 @@ void tst_QScriptString::test() } } +void tst_QScriptString::hash() +{ + QScriptEngine engine; + QHash<QScriptString, int> stringToInt; + QScriptString foo = engine.toStringHandle("foo"); + QScriptString bar = engine.toStringHandle("bar"); + QVERIFY(!stringToInt.contains(foo)); + for (int i = 0; i < 1000000; ++i) + stringToInt.insert(foo, 123); + QCOMPARE(stringToInt.value(foo), 123); + QVERIFY(!stringToInt.contains(bar)); + stringToInt.insert(bar, 456); + QCOMPARE(stringToInt.value(bar), 456); + QCOMPARE(stringToInt.value(foo), 123); +} + QTEST_MAIN(tst_QScriptString) #include "tst_qscriptstring.moc" diff --git a/tests/auto/qsound/qsound.pro b/tests/auto/qsound/qsound.pro index c48d50d..383a085 100644 --- a/tests/auto/qsound/qsound.pro +++ b/tests/auto/qsound/qsound.pro @@ -4,7 +4,7 @@ SOURCES += tst_qsound.cpp wince*|symbian*: { deploy.sources += 4.wav DEPLOYMENT = deploy - DEFINES += SRCDIR=\\\"\\\" + !symbian:DEFINES += SRCDIR=\\\"\\\" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index dd5f2ce..fdbf6a2 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -43,6 +43,10 @@ #include <QtTest/QtTest> #include <QtGui> +#if defined(Q_OS_SYMBIAN) +#define SRCDIR "" +#endif + class tst_QSound : public QObject { Q_OBJECT diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 4829b6b..2389060 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -980,26 +980,28 @@ void tst_QSpinBox::sizeHint() sizeHint_SpinBox *spinBox = new sizeHint_SpinBox; layout->addWidget(spinBox); widget->show(); - QTest::qWait(100); + QTest::qWaitForWindowShown(widget); // Prefix spinBox->sizeHintRequests = 0; spinBox->setPrefix(QLatin1String("abcdefghij")); qApp->processEvents(); - QVERIFY(spinBox->sizeHintRequests > 0); + QTRY_VERIFY(spinBox->sizeHintRequests > 0); // Suffix spinBox->sizeHintRequests = 0; spinBox->setSuffix(QLatin1String("abcdefghij")); qApp->processEvents(); - QVERIFY(spinBox->sizeHintRequests > 0); + QTRY_VERIFY(spinBox->sizeHintRequests > 0); // Range spinBox->sizeHintRequests = 0; spinBox->setRange(0, 1234567890); spinBox->setValue(spinBox->maximum()); qApp->processEvents(); - QVERIFY(spinBox->sizeHintRequests > 0); + QTRY_VERIFY(spinBox->sizeHintRequests > 0); + + delete widget; } QTEST_MAIN(tst_QSpinBox) diff --git a/tests/auto/qsql/qsql.pro b/tests/auto/qsql/qsql.pro index 167a38d..0ec581d 100644 --- a/tests/auto/qsql/qsql.pro +++ b/tests/auto/qsql/qsql.pro @@ -10,9 +10,11 @@ wince*: { } symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqldatabase/qsqldatabase.pro b/tests/auto/qsqldatabase/qsqldatabase.pro index 964c8c9..6381219 100644 --- a/tests/auto/qsqldatabase/qsqldatabase.pro +++ b/tests/auto/qsqldatabase/qsqldatabase.pro @@ -23,10 +23,12 @@ symbian { TARGET.EPOCHEAPSIZE=5000 5000000 TARGET.EPOCSTACKSIZE=50000 - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqldriver/qsqldriver.pro b/tests/auto/qsqldriver/qsqldriver.pro index 7f289a6..d04ca83 100644 --- a/tests/auto/qsqldriver/qsqldriver.pro +++ b/tests/auto/qsqldriver/qsqldriver.pro @@ -17,9 +17,11 @@ wince*: { } symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqlerror/qsqlerror.pro b/tests/auto/qsqlerror/qsqlerror.pro index 2eb7934..456f585 100644 --- a/tests/auto/qsqlerror/qsqlerror.pro +++ b/tests/auto/qsqlerror/qsqlerror.pro @@ -8,9 +8,11 @@ QT = core sql SOURCES += tst_qsqlerror.cpp symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqlfield/qsqlfield.pro b/tests/auto/qsqlfield/qsqlfield.pro index 6e5b461..7339854 100644 --- a/tests/auto/qsqlfield/qsqlfield.pro +++ b/tests/auto/qsqlfield/qsqlfield.pro @@ -4,10 +4,12 @@ SOURCES += tst_qsqlfield.cpp QT += sql symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqlquery/qsqlquery.pro b/tests/auto/qsqlquery/qsqlquery.pro index 494ca4c..97646ed 100644 --- a/tests/auto/qsqlquery/qsqlquery.pro +++ b/tests/auto/qsqlquery/qsqlquery.pro @@ -15,9 +15,11 @@ wince*: { } symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro index cd8586c..cda8cab 100644 --- a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro +++ b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro @@ -7,10 +7,12 @@ wince*: { DEPLOYMENT_PLUGIN += qsqlite LIBS += -lws2 }else:symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } else { win32:LIBS += -lws2_32 diff --git a/tests/auto/qsqlrecord/qsqlrecord.pro b/tests/auto/qsqlrecord/qsqlrecord.pro index 67e8ab9..f36f076 100644 --- a/tests/auto/qsqlrecord/qsqlrecord.pro +++ b/tests/auto/qsqlrecord/qsqlrecord.pro @@ -2,15 +2,18 @@ load(qttest_p4) SOURCES += tst_qsqlrecord.cpp symbian { -contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite -} + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } + } -TARGET.EPOCSTACKSIZE=50000 -TARGET.EPOCHEAPSIZE=50000 5000000 + TARGET.EPOCSTACKSIZE=50000 + TARGET.EPOCHEAPSIZE=50000 5000000 } + QT += sql diff --git a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro index 2fddd03..ee4f2f0 100644 --- a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro +++ b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro @@ -9,10 +9,12 @@ wince*: { DEPLOYMENT += plugFiles LIBS += -lws2 }else:symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } else { win32-g++ { diff --git a/tests/auto/qsqltablemodel/qsqltablemodel.pro b/tests/auto/qsqltablemodel/qsqltablemodel.pro index a046fb1..9a23237 100644 --- a/tests/auto/qsqltablemodel/qsqltablemodel.pro +++ b/tests/auto/qsqltablemodel/qsqltablemodel.pro @@ -9,10 +9,12 @@ wince*: { DEPLOYMENT += plugFiles LIBS += -lws2 }else:symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } }else { win32:LIBS += -lws2_32 diff --git a/tests/auto/qsqlthread/qsqlthread.pro b/tests/auto/qsqlthread/qsqlthread.pro index 2708f1a..5522232 100644 --- a/tests/auto/qsqlthread/qsqlthread.pro +++ b/tests/auto/qsqlthread/qsqlthread.pro @@ -10,10 +10,12 @@ wince*: { DEPLOYMENT += plugFiles LIBS += -lws2 }else:symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } }else { win32:LIBS += -lws2_32 diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 4bf7c2e..bb0e226 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -3412,6 +3412,12 @@ void tst_QTableView::mouseWheel() QFETCH(int, horizontalPositon); QFETCH(int, verticalPosition); + if (scrollMode == int(QAbstractItemView::ScrollPerPixel)) + { +#ifdef Q_OS_WINCE + QSKIP("Since different Windows CE versions sport different taskbars, we skip this test", SkipSingle); +#endif + } QtTestTableModel model(100, 100); QtTestTableView view; view.resize(500, 500); diff --git a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp index a5748ae..3b1e18f 100644 --- a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp +++ b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp @@ -66,6 +66,7 @@ struct TestIterator }; #include <qiterator.h> +#ifndef QT_NO_STL namespace std { template <> struct iterator_traits<TestIterator> @@ -79,6 +80,7 @@ int distance(TestIterator &a, TestIterator &b) } } +#endif #include <qtconcurrentiteratekernel.h> @@ -112,7 +114,7 @@ class PrintFor : public IterateKernel<TestIterator, void> { public: PrintFor(TestIterator begin, TestIterator end) : IterateKernel<TestIterator, void>(begin, end) {iterations = 0; } - inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) { iterations.fetchAndAddRelaxed(end - begin); #ifdef PRINT @@ -120,6 +122,11 @@ public: #endif return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } + }; class SleepPrintFor : public IterateKernel<TestIterator, void> @@ -135,6 +142,10 @@ public: #endif return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } }; @@ -165,6 +176,10 @@ public: counter.fetchAndAddRelaxed(end - begin); return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } }; void tst_iteratekernel::stresstest() @@ -215,6 +230,10 @@ public: return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } bool shouldThrottleThread() { @@ -254,6 +273,9 @@ public: void tst_iteratekernel::blockSize() { +#ifdef QT_NO_STL + QSKIP("Missing stl iterators prevent correct block size calculation", SkipAll); +#endif const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount(); BlockSizeRecorder(0, 10000).startBlocking(); if (peakBlockSize < expectedMinimumBlockSize) @@ -276,6 +298,9 @@ public: void tst_iteratekernel::multipleResults() { +#ifdef QT_NO_STL + QSKIP("Missing stl iterators prevent correct summation", SkipAll); +#endif QFuture<int> f = startThreadEngine(new MultipleResultsFor(0, 10)).startAsynchronously(); QCOMPARE(f.results().count() , 10); QCOMPARE(f.resultAt(0), 0); diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 5ccae94..fe87dfb 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -1085,10 +1085,6 @@ QT_END_NAMESPACE void tst_QTextLayout::testTabDPIScale() { - #ifdef Q_OS_WINCE - QSKIP("This test fails for large DPIs.", SkipAll); - #endif - class MyPaintDevice : public QPaintDevice { QPaintEngine *paintEngine () const { return 0; } int metric (QPaintDevice::PaintDeviceMetric metric) const { @@ -1118,14 +1114,14 @@ void tst_QTextLayout::testTabDPIScale() QTextOption option = layout.textOption(); QList<QTextOption::Tab> tabs; QTextOption::Tab tab; - tab.position = 100; + tab.position = 200; tabs.append(tab); - tab.position = 200; + tab.position = 400; tab.type = QTextOption::RightTab; tabs.append(tab); - tab.position = 300; + tab.position = 600; tab.type = QTextOption::CenterTab; tabs.append(tab); option.setTabs(tabs); @@ -1133,7 +1129,7 @@ void tst_QTextLayout::testTabDPIScale() layout.beginLayout(); QTextLine line = layout.createLine(); - line.setLineWidth(500.); + line.setLineWidth(1500.); layout.endLayout(); QCOMPARE(line.cursorToX(0), 0.); QCOMPARE(line.cursorToX(1), (double) TESTFONT_SIZE); // check that the font does not resize @@ -1142,9 +1138,9 @@ void tst_QTextLayout::testTabDPIScale() int fixedScale = (int)( scale * qreal(64)); // into a QFixed scale = ((qreal)fixedScale)/(qreal)64; // and out of a QFixed - QCOMPARE(line.cursorToX(6), 100 * scale); - QCOMPARE(line.cursorToX(12), 200 * scale - TESTFONT_SIZE * 5); - QCOMPARE(line.cursorToX(18), 300 * scale - TESTFONT_SIZE * 3 / 2.0); + QCOMPARE(line.cursorToX(6), tabs.at(0).position * scale); + QCOMPARE(line.cursorToX(12), tabs.at(1).position * scale - TESTFONT_SIZE * 5); + QCOMPARE(line.cursorToX(18), tabs.at(2).position * scale - TESTFONT_SIZE * 3 / 2.0); } void tst_QTextLayout::tabHeight() diff --git a/tests/auto/qtextstream/test/test.pro b/tests/auto/qtextstream/test/test.pro index 9f117d5..c70c27b 100644 --- a/tests/auto/qtextstream/test/test.pro +++ b/tests/auto/qtextstream/test/test.pro @@ -30,9 +30,11 @@ wince*: { }else:symbian { load(data_caging_paths) # Symbian can't define SRCDIR meaningfully here - codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll - codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs - DEPLOYMENT += codecs_plugins + qt_not_deployed { + codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll + codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs + DEPLOYMENT += codecs_plugins + } }else { DEFINES += SRCDIR=\\\"$$PWD/../\\\" } diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 0877500..01a6317 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -46,10 +46,6 @@ #include <qtimer.h> #include <qthread.h> - - - - #if defined Q_OS_UNIX #include <unistd.h> #endif @@ -242,7 +238,6 @@ public: // sleep for 2ms QTest::qSleep(2); - killTimer(te->timerId()); } @@ -277,9 +272,11 @@ void tst_QTimer::livelock() #elif defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) QEXPECT_FAIL("zero timer", "", Continue); QEXPECT_FAIL("non-zero timer", "", Continue); -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) if (QSysInfo::WindowsVersion < QSysInfo::WV_XP) QEXPECT_FAIL("non-zero timer", "Multimedia timers are not available on Windows 2000", Continue); +#elif defined(Q_OS_WINCE) + QEXPECT_FAIL("non-zero timer", "Windows CE devices often too slow", Continue); #endif QVERIFY(tester.postEventAtRightTime); } diff --git a/tests/auto/qtoolbar/tst_qtoolbar.cpp b/tests/auto/qtoolbar/tst_qtoolbar.cpp index e4f317c..ac86fd9 100644 --- a/tests/auto/qtoolbar/tst_qtoolbar.cpp +++ b/tests/auto/qtoolbar/tst_qtoolbar.cpp @@ -54,6 +54,8 @@ #include <qtoolbutton.h> #include <qlineedit.h> #include <qkeysequence.h> +#include <qmenu.h> +#include <private/qtoolbarextension_p.h> #include "../../shared/util.h" @@ -569,6 +571,29 @@ void tst_QToolBar::actionGeometry() qt_x11_wait_for_window_manager(&tb); #endif + QList<QToolBarExtension *> extensions = tb.findChildren<QToolBarExtension *>(); + + QRect rect01; + QRect rect02; + QRect rect03; + QRect rect04; + QMenu *popupMenu; + + if (extensions.size() != 0) + { + QToolBarExtension *extension = extensions.at(0); + if (extension->isVisible()) { + QRect rect0 = extension->geometry(); + QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 ); + QApplication::processEvents(); + popupMenu = qobject_cast<QMenu *>(extension->menu()); + rect01 = popupMenu->actionGeometry(&action1); + rect02 = popupMenu->actionGeometry(&action2); + rect03 = popupMenu->actionGeometry(&action3); + rect04 = popupMenu->actionGeometry(&action4); + } + } + QRect rect1 = tb.actionGeometry(&action1); QRect rect2 = tb.actionGeometry(&action2); QRect rect3 = tb.actionGeometry(&action3); @@ -590,10 +615,25 @@ void tst_QToolBar::actionGeometry() QVERIFY(!rect4.isNull()); QVERIFY(!rect4.isEmpty()); - QCOMPARE(tb.actionAt(rect1.center()), &action1); - QCOMPARE(tb.actionAt(rect2.center()), &action2); - QCOMPARE(tb.actionAt(rect3.center()), &action3); - QCOMPARE(tb.actionAt(rect4.center()), &action4); + if (rect01.isValid()) + QCOMPARE(popupMenu->actionAt(rect01.center()), &action1); + else + QCOMPARE(tb.actionAt(rect1.center()), &action1); + + if (rect02.isValid()) + QCOMPARE(popupMenu->actionAt(rect02.center()), &action2); + else + QCOMPARE(tb.actionAt(rect2.center()), &action2); + + if (rect03.isValid()) + QCOMPARE(popupMenu->actionAt(rect03.center()), &action3); + else + QCOMPARE(tb.actionAt(rect3.center()), &action3); + + if (rect04.isValid()) + QCOMPARE(popupMenu->actionAt(rect04.center()), &action4); + else + QCOMPARE(tb.actionAt(rect4.center()), &action4); } void tst_QToolBar::actionAt() @@ -864,33 +904,82 @@ void tst_QToolBar::actionTriggered() qt_x11_wait_for_window_manager(&tb); #endif + QList<QToolBarExtension *> extensions = tb.findChildren<QToolBarExtension *>(); + + QRect rect01; + QRect rect02; + QRect rect03; + QRect rect04; + QMenu *popupMenu; + + if (extensions.size() != 0) + { + QToolBarExtension *extension = extensions.at(0); + if (extension->isVisible()) { + QRect rect0 = extension->geometry(); + QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 ); + QApplication::processEvents(); + popupMenu = qobject_cast<QMenu *>(extension->menu()); + rect01 = popupMenu->actionGeometry(&action1); + rect02 = popupMenu->actionGeometry(&action2); + rect03 = popupMenu->actionGeometry(&action3); + rect04 = popupMenu->actionGeometry(&action4); + } + } + QRect rect1 = tb.actionGeometry(&action1); QRect rect2 = tb.actionGeometry(&action2); QRect rect3 = tb.actionGeometry(&action3); QRect rect4 = tb.actionGeometry(&action4); - QAbstractButton *button1 = qobject_cast<QAbstractButton *>(tb.childAt(rect1.center())); - QAbstractButton *button2 = qobject_cast<QAbstractButton *>(tb.childAt(rect2.center())); - QAbstractButton *button3 = qobject_cast<QAbstractButton *>(tb.childAt(rect3.center())); - QAbstractButton *button4 = qobject_cast<QAbstractButton *>(tb.childAt(rect4.center())); - QVERIFY(button1 != 0); - QVERIFY(button2 != 0); - QVERIFY(button3 != 0); - QVERIFY(button4 != 0); + + QAbstractButton *button1; + QAbstractButton *button2; + QAbstractButton *button3; + QAbstractButton *button4; + + if (!rect01.isValid()) { + button1 = qobject_cast<QAbstractButton *>(tb.childAt(rect1.center())); + QVERIFY(button1 != 0); + } + if (!rect02.isValid()) { + button2 = qobject_cast<QAbstractButton *>(tb.childAt(rect2.center())); + QVERIFY(button2 != 0); + } + if (!rect03.isValid()) { + button3 = qobject_cast<QAbstractButton *>(tb.childAt(rect3.center())); + QVERIFY(button3 != 0); + } + if (!rect04.isValid()) { + button4 = qobject_cast<QAbstractButton *>(tb.childAt(rect4.center())); + QVERIFY(button4 != 0); + } ::triggered = 0; - QTest::mouseClick(button1, Qt::LeftButton); + if (!rect01.isValid()) + QTest::mouseClick(button1, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect01.center(), -1 ); QCOMPARE(::triggered, &action1); ::triggered = 0; - QTest::mouseClick(button2, Qt::LeftButton); + if (!rect02.isValid()) + QTest::mouseClick(button2, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect02.center(), -1 ); QCOMPARE(::triggered, &action2); ::triggered = 0; - QTest::mouseClick(button3, Qt::LeftButton); + if (!rect03.isValid()) + QTest::mouseClick(button3, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect03.center(), -1 ); QCOMPARE(::triggered, &action3); ::triggered = 0; - QTest::mouseClick(button4, Qt::LeftButton); + if (!rect04.isValid()) + QTest::mouseClick(button4, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect04.center(), -1 ); QCOMPARE(::triggered, &action4); } @@ -977,7 +1066,7 @@ void tst_QToolBar::accel() mw.show(); QApplication::setActiveWindow(&mw); QTest::qWait(100); - QTRY_COMPARE(QApplication::activeWindow(), &mw); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&mw)); QTest::keyClick(&mw, Qt::Key_T, Qt::AltModifier); QTest::qWait(300); diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 8856792..026c30e 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -2624,6 +2624,13 @@ void tst_QUrl::tolerantParser() //QCOMPARE(tsdgeosQUrl.toEncoded(), tsdgeosExpected); // unusable output from qtestlib... QCOMPARE(QString(tsdgeosQUrl.toEncoded()), QString(tsdgeosExpected)); } + + { + QUrl url; + url.setUrl("http://strange<username>@hostname/", QUrl::TolerantMode); + QVERIFY(url.isValid()); + QCOMPARE(QString(url.toEncoded()), QString("http://strange%3Cusername%3E@hostname/")); + } } void tst_QUrl::correctEncodedMistakes_data() @@ -3594,9 +3601,9 @@ void tst_QUrl::setAuthority() void tst_QUrl::errorString() { - QUrl u = QUrl::fromEncoded("http://strange<username>@ok_hostname/", QUrl::StrictMode); + QUrl u = QUrl::fromEncoded("http://strange<username>@bad_hostname/", QUrl::StrictMode); QVERIFY(!u.isValid()); - QString errorString = "Invalid URL \"http://strange<username>@ok_hostname/\": " + QString errorString = "Invalid URL \"http://strange<username>@bad_hostname/\": " "error at position 14: expected end of URL, but found '<'"; QCOMPARE(u.errorString(), errorString); diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 1a2de65..579f4eb 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -299,7 +299,7 @@ void tst_Selftests::runSubTest() void tst_Selftests::initTestCase() { -#ifndef Q_OS_UNIX +#if !defined(Q_OS_UNIX) || defined(Q_WS_MAC) m_checkXMLBlacklist.append("crashes"); // This test crashes (XML valid on Unix only) #endif m_checkXMLBlacklist.append("waitwithoutgui"); // This test is not a QTestLib test. diff --git a/tools/assistant/lib/qhelpsearchquerywidget.cpp b/tools/assistant/lib/qhelpsearchquerywidget.cpp index 9ac4a7d..361e9ac 100644 --- a/tools/assistant/lib/qhelpsearchquerywidget.cpp +++ b/tools/assistant/lib/qhelpsearchquerywidget.cpp @@ -229,7 +229,7 @@ private: const QList<QHelpSearchQuery> &query = queryHist->queries.at(queryHist->curQuery); foreach (const QHelpSearchQuery &queryPart, query) { - QLineEdit *lineEdit; + QLineEdit *lineEdit = 0; switch (queryPart.fieldName) { case QHelpSearchQuery::DEFAULT: lineEdit = defaultQuery; diff --git a/tools/assistant/translations/qt_help.pro b/tools/assistant/translations/qt_help.pro index 69570d3..0133ea4 100644 --- a/tools/assistant/translations/qt_help.pro +++ b/tools/assistant/translations/qt_help.pro @@ -42,11 +42,9 @@ HEADERS += ../lib/qhelpcollectionhandler_p.h \ TR_DIR = $$PWD/../../../translations TRANSLATIONS = \ $$TR_DIR/qt_help_da.ts \ - $$TR_DIR/qt_help_de.ts + $$TR_DIR/qt_help_de.ts \ $$TR_DIR/qt_help_ja.ts \ $$TR_DIR/qt_help_pl.ts \ $$TR_DIR/qt_help_ru.ts \ $$TR_DIR/qt_help_zh_CN.ts \ $$TR_DIR/qt_help_zh_TW.ts - -error("This is a dummy profile to be used for translations ONLY.") diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp index 0d170f5..c958dd9 100644 --- a/tools/configure/tools.cpp +++ b/tools/configure/tools.cpp @@ -152,7 +152,7 @@ void Tools::checkLicense(QMap<QString,QString> &dictionary, QMap<QString,QString if (platforms == 'X') { dictionary["LICENSE_EXTENSION"] = "-ALLOS"; - } else if (strchr("3679ACDEHJKMSUWX", platforms)) { + } else if (strchr("2346789ABCDEGHJKMPQSTUVWX", platforms)) { dictionary["LICENSE_EXTENSION"] = "-EMBEDDED"; } else if (strchr("4BFPQRTY", platforms)) { dictionary["LICENSE_EXTENSION"] = "-DESKTOP"; diff --git a/tools/designer/translations/translations.pro b/tools/designer/translations/translations.pro index a37918c..2323882 100644 --- a/tools/designer/translations/translations.pro +++ b/tools/designer/translations/translations.pro @@ -82,7 +82,6 @@ SOURCES += $$APP_DIR/appfontdialog.cpp \ $$APP_DIR/main.cpp \ $$APP_DIR/mainwindow.cpp \ $$APP_DIR/newform.cpp \ - $$APP_DIR/plugindialog.cpp \ $$APP_DIR/preferencesdialog.cpp \ $$APP_DIR/qdesigner_actions.cpp \ $$APP_DIR/qdesigner_appearanceoptions.cpp \ @@ -100,7 +99,6 @@ HEADERS+= $$APP_DIR/appfontdialog.h \ $$APP_DIR/designer_enums.h \ $$APP_DIR/mainwindow.h \ $$APP_DIR/newform.h \ - $$APP_DIR/plugindialog.h \ $$APP_DIR/preferencesdialog.h \ $$APP_DIR/qdesigner_actions.h \ $$APP_DIR/qdesigner_appearanceoptions.h \ @@ -114,8 +112,7 @@ HEADERS+= $$APP_DIR/appfontdialog.h \ $$APP_DIR/saveformastemplate.h \ $$APP_DIR/versiondialog.h -FORMS += $$APP_DIR/plugindialog.ui \ - $$APP_DIR/preferencesdialog.ui \ +FORMS += $$APP_DIR/preferencesdialog.ui \ $$APP_DIR/qdesigner_appearanceoptions.ui \ $$APP_DIR/saveformastemplate.ui diff --git a/tools/porting/src/filewriter.cpp b/tools/porting/src/filewriter.cpp index ee8debb..99bd6e7 100644 --- a/tools/porting/src/filewriter.cpp +++ b/tools/porting/src/filewriter.cpp @@ -44,6 +44,7 @@ #include <QFileInfo> #include <QDir> #include <ctype.h> +#include <errno.h> QT_BEGIN_NAMESPACE @@ -106,11 +107,18 @@ FileWriter::WriteResult FileWriter::writeFile(QString filePath, QByteArray conte char answer = 0; while (answer != 'y' && answer != 'n' && answer != 'a') { #if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400 - scanf_s("%c", &answer); + int result = scanf_s("%c", &answer); #else - scanf("%c", &answer); + int result = scanf("%c", &answer); #endif - answer = tolower(answer); + if (1 == result) + answer = tolower(answer); + else if (EOF == result) { + if (EINTR == errno || EILSEQ == errno) + continue; + + answer = 'n'; + } } if(answer == 'n') diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index e400f8a..9858484 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -71,6 +71,8 @@ struct Section : name(name0), singularMember(singularMember0), pluralMember(pluralMember0) { } + void appendMember(Node* node) { members.append(node); } + void appendReimpMember(Node* node) { reimpMembers.append(node); } }; struct FastSection diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index ec5ce96..d93e24c 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -541,9 +541,10 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, else { lastPath = parentPath; } - - if (func) + if (func) { func->borrowParameterNames(clone); + func->setParentPath(clone->parentPath()); + } delete clone; } return func; @@ -1371,6 +1372,7 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, func->setAccess(access); func->setLocation(location()); func->setReturnType(returnType.toString()); + func->setParentPath(parentPath); func->setTemplateStuff(templateStuff); if (compat) func->setStatus(Node::Compat); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 291f60b..033c62c 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -59,6 +59,24 @@ QT_BEGIN_NAMESPACE #define COMMAND_VERSION Doc::alias("version") +QString HtmlGenerator::sinceTitles[] = + { + " New Namespaces", + " New Classes", + " New Member Functions", + " New Functions in Namespaces", + " New Global Functions", + " New Macros", + " New Enum Types", + " New Typedefs", + " New Properties", + " New Variables", + " New Qml Properties", + " New Qml Signals", + " New Qml Methods", + "" + }; + static bool showBrokenLinks = false; static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*(</@link>)"); @@ -186,7 +204,7 @@ HtmlGenerator::HtmlGenerator() : helpProjectWriter(0), inLink(false), inContents(false), inSectionHeading(false), inTableHeader(false), numTableRows(0), threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), - tre(0), slow(false), obsoleteLinks(false) + myTree(0), slow(false), obsoleteLinks(false) { } @@ -313,7 +331,7 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) ++styleIter; } - tre = tree; + myTree = tree; nonCompatClasses.clear(); mainClasses.clear(); compatClasses.clear(); @@ -332,64 +350,6 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) #endif findAllSince(tree->root()); -#if 0 - if (!sinceVersions.isEmpty()) { - SinceVersionMap::const_iterator v = sinceVersions.constEnd(); - do { - --v; - qDebug() << "SINCE:" << v.key(); - if (!v.value().isEmpty()) { - QString type; - SinceNodeMultiMap::const_iterator n = v.value().constBegin(); - while (n != v.value().constEnd()) { - switch (n.value()->type()) { - case Node::Namespace: - type = "namespace"; - break; - case Node::Class: - type = "class"; - break; - case Node::Fake: - type = "fake"; - break; - case Node::Enum: - type = "enum"; - break; - case Node::Typedef: - type = "typedef"; - break; - case Node::Function: - type = "function"; - break; - case Node::Property: - type = "property"; - break; - case Node::Variable: - type = "variable"; - break; - case Node::Target: - type = "target"; - break; - case Node::QmlProperty: - type = "QML property"; - break; - case Node::QmlSignal: - type = "QML signal"; - break; - case Node::QmlMethod: - type = "QML method"; - break; - default: - type = "No type"; - } - qDebug() << " " << type << n.key(); - ++n; - } - } - } while (v != sinceVersions.constBegin()); - } -#endif - PageGenerator::generateTree(tree, marker); dcfClassesRoot.ref = "classes.html"; @@ -433,7 +393,7 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) projectUrl, projectDescription); - helpProjectWriter->generate(tre); + helpProjectWriter->generate(myTree); } void HtmlGenerator::startText(const Node * /* relative */, @@ -598,13 +558,12 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; case Atom::AnnotatedList: { - QList<Node*> values = tre->groups().values(atom->string()); - QMap<QString, const Node*> nodeMap; + QList<Node*> values = myTree->groups().values(atom->string()); + NodeMap nodeMap; for (int i = 0; i < values.size(); ++i) { const Node* n = values.at(i); if ((n->status() != Node::Internal) && (n->access() != Node::Private)) { nodeMap.insert(n->nameForLists(),n); - //qDebug() << " " << n->nameForLists(); } } generateAnnotatedList(relative, marker, nodeMap); @@ -633,7 +592,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (editionModuleMap.contains(editionName)) { // Add all classes in the modules listed for that edition. - QMap<QString, const Node *> editionClasses; + NodeMap editionClasses; foreach (const QString &moduleName, editionModuleMap[editionName]) { if (moduleClassMap.contains(moduleName)) editionClasses.unite(moduleClassMap[moduleName]); @@ -642,7 +601,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, // Add additional groups and remove groups of classes that // should be excluded from the edition. - QMultiMap <QString, Node *> groups = tre->groups(); + QMultiMap <QString, Node *> groups = myTree->groups(); foreach (const QString &groupName, editionGroupMap[editionName]) { QList<Node *> groupClasses; if (groupName.startsWith("-")) { @@ -689,7 +648,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, else if (atom->string() == "related") { const FakeNode *fake = static_cast<const FakeNode *>(relative); if (fake && !fake->groupMembers().isEmpty()) { - QMap<QString, const Node *> groupMembersMap; + NodeMap groupMembersMap; foreach (const Node *node, fake->groupMembers()) { if (node->type() == Node::Fake) groupMembersMap[fullName(node, relative, marker)] = node; @@ -713,34 +672,116 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; case Atom::SinceList: { - QList<Node*> nodes; - SinceVersionMap::const_iterator v; - v = sinceVersions.find(atom->string()); - if ((v != sinceVersions.constEnd()) && !v.value().isEmpty()) { - for (int i=0; !Node::typeName(i).isEmpty(); i++) { - Node::Type t = (Node::Type) i; - SinceNodeMultiMap::const_iterator n=v.value().constBegin(); - QMultiMap<QString, const Node*> nodeMap; - while (n != v.value().constEnd()) { - const Node* node = n.value(); - if (node->type() == t) - nodeMap.insert(node->nameForLists(),node); - ++n; - } - if (!nodeMap.isEmpty()) { - out() << "<h2>" - << Node::typeName(i) - << " new in Qt " - << atom->string() - << "</h2>"; - generateAnnotatedList(relative, marker, nodeMap); - nodeMap.clear(); + NodeMultiMapMap::const_iterator v; + v = nodeMultiMapMap.find(atom->string()); + NodeMapMap::const_iterator nc; + nc = nodeMapMap.find(atom->string()); + if ((v != nodeMultiMapMap.constEnd()) && !v.value().isEmpty()) { + QList<Section> sections; + QList<Section>::ConstIterator s; + for (int i=0; i<LastSinceType; ++i) + sections.append(Section(sinceTitle(i),QString(),QString())); + + NodeMultiMap::const_iterator n = v.value().constBegin(); + while (n != v.value().constEnd()) { + const Node* node = n.value(); + switch (node->type()) { + case Node::Namespace: + sections[Namespace].appendMember((Node*)node); + break; + case Node::Class: + sections[Class].appendMember((Node*)node); + break; + case Node::Enum: + sections[Enum].appendMember((Node*)node); + break; + case Node::Typedef: + sections[Typedef].appendMember((Node*)node); + break; + case Node::Function: { + const FunctionNode* fn = static_cast<const FunctionNode*>(node); + if (fn->isMacro()) + sections[Macro].appendMember((Node*)node); + else { + Node* p = fn->parent(); + if (p) { + if (p->type() == Node::Class) + sections[MemberFunction].appendMember((Node*)node); + else if (p->type() == Node::Namespace) { + if (p->name().isEmpty()) + sections[GlobalFunction].appendMember((Node*)node); + else + sections[NamespaceFunction].appendMember((Node*)node); + } + else + sections[GlobalFunction].appendMember((Node*)node); + } + else + sections[GlobalFunction].appendMember((Node*)node); + } + break; + } + case Node::Property: + sections[Property].appendMember((Node*)node); + break; + case Node::Variable: + sections[Variable].appendMember((Node*)node); + break; + case Node::QmlProperty: + sections[QmlProperty].appendMember((Node*)node); + break; + case Node::QmlSignal: + sections[QmlSignal].appendMember((Node*)node); + break; + case Node::QmlMethod: + sections[QmlMethod].appendMember((Node*)node); + break; + default: + break; } + ++n; + } + int idx = 0; + s = sections.constBegin(); + while (s != sections.constEnd()) { + if (!(*s).members.isEmpty()) { + out() << "<a name=\"" + << registerRef((*s).name.toLower()) + << "\"></a>\n"; + out() << "<h3>" << protect((*s).name) << "</h3>\n"; + if (idx == Class) + generateCompactList(0, marker, nc.value(), QString("Q")); + else if (idx == MemberFunction) { + NodeMultiMapMap nodemultimapmap; + NodeMultiMapMap::iterator nmmap; + NodeList::const_iterator i = s->members.constBegin(); + while (i != s->members.constEnd()) { + Node* p = (*i)->parent(); + nmmap = nodemultimapmap.find(p->name()); + if (nmmap == nodemultimapmap.end()) + nmmap = nodemultimapmap.insert(p->name(),NodeMultiMap()); + nmmap->insert((*i)->name(),(*i)); + ++i; + } + nmmap = nodemultimapmap.begin(); + while (nmmap != nodemultimapmap.end()) { + NodeList nlist = nmmap->values(); + out() << "<p>New functions in " << protect(nmmap.key()) << ":</p>\n"; + generateSection(nlist, 0, marker, CodeMarker::Summary); + out() << "<br />"; + ++nmmap; + } + } + else + generateSection(s->members, 0, marker, CodeMarker::Summary); + } + ++idx; + ++s; } } } break; -case Atom::Image: + case Atom::Image: case Atom::InlineImage: { QString fileName = imageFileName(relative, atom->string()); @@ -1151,7 +1192,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, subtitleText << "[" << Atom(Atom::AutoLink, fixedModule) << " module]"; if (fixedModule.isEmpty()) { - QMultiMap<QString, QString> publicGroups = tre->publicGroups(); + QMultiMap<QString, QString> publicGroups = myTree->publicGroups(); QList<QString> groupNames = publicGroups.values(inner->name()); if (!groupNames.isEmpty()) { qSort(groupNames.begin(), groupNames.end()); @@ -1492,7 +1533,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateAlsoList(fake, marker); if (!fake->groupMembers().isEmpty()) { - QMap<QString, const Node *> groupMembersMap; + NodeMap groupMembersMap; foreach (const Node *node, fake->groupMembers()) { if (node->type() == Node::Class || node->type() == Node::Namespace) groupMembersMap[node->name()] = node; @@ -1564,7 +1605,7 @@ void HtmlGenerator::generateHeader(const QString& title, if (node && !node->doc().location().isEmpty()) out() << "<!-- " << node->doc().location().fileName() << " -->\n"; - shortVersion = tre->version(); + shortVersion = myTree->version(); if (shortVersion.count(QChar('.')) == 2) shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); if (!shortVersion.isEmpty()) { @@ -1686,7 +1727,7 @@ void HtmlGenerator::generateHeader(const QString& title, "<body>\n"; if (mainPage) generateMacRef(node, marker); - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, tre->version()); + out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); if (node && !node->links().empty()) @@ -1717,8 +1758,8 @@ void HtmlGenerator::generateFooter(const Node *node) if (node && !node->links().empty()) out() << "<p>\n" << navigationLinks << "</p>\n"; - out() << QString(footer).replace("\\" + COMMAND_VERSION, tre->version()) - << QString(address).replace("\\" + COMMAND_VERSION, tre->version()) + out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version()) + << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()) << "</body>\n" "</html>\n"; } @@ -1970,8 +2011,8 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, if (classMap.isEmpty()) return; - QMap<QString, const Node *> topLevel; - QMap<QString, const Node *>::ConstIterator c = classMap.begin(); + NodeMap topLevel; + NodeMap::ConstIterator c = classMap.begin(); while (c != classMap.end()) { const ClassNode *classe = static_cast<const ClassNode *>(*c); if (classe->baseClasses().isEmpty()) @@ -1979,7 +2020,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, ++c; } - QStack<QMap<QString, const Node *> > stack; + QStack<NodeMap > stack; stack.push(topLevel); out() << "<ul>\n"; @@ -1996,7 +2037,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, out() << "</li>\n"; stack.top().erase(stack.top().begin()); - QMap<QString, const Node *> newTop; + NodeMap newTop; foreach (const RelatedClass &d, child->derivedClasses()) { if (d.access != Node::Private) newTop.insert(d.node->name(), d.node); @@ -2011,7 +2052,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, void HtmlGenerator::generateAnnotatedList(const Node *relative, CodeMarker *marker, - const QMap<QString, const Node *> &nodeMap) + const NodeMap &nodeMap) { out() << "<p><table width=\"100%\" class=\"annotated\" cellpadding=\"2\" " << "cellspacing=\"1\" border=\"0\">\n"; @@ -2049,9 +2090,19 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, out() << "</table></p>\n"; } +/*! + This function finds the common prefix of the names of all + the classes in \a classMap and then generates a compact + list of the class names alphabetized on the part of the + name not including the common prefix. You can tell the + function to use \a comonPrefix as the common prefix, but + normally you let it figure it out itself by looking at + the name of the first and last classes in \a classMap. + */ void HtmlGenerator::generateCompactList(const Node *relative, CodeMarker *marker, - const QMap<QString, const Node *> &classMap) + const NodeMap &classMap, + QString commonPrefix) { const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' const int NumColumns = 4; // number of columns in the result @@ -2060,64 +2111,74 @@ void HtmlGenerator::generateCompactList(const Node *relative, return; /* - First, find out the common prefix of all non-namespaced classes. - For Qt, the prefix is Q. It can easily be derived from the first - and last classes in alphabetical order (QAccel and QXtWidget in Qt 2.1). - */ - int commonPrefixLen = 0; - QString commonPrefix; - QString first; - QString last; - - QMap<QString, const Node *>::const_iterator iter = classMap.begin(); - while (iter != classMap.end()) { - if (!iter.key().contains("::")) { - first = iter.key(); - break; + If commonPrefix is not empty, then the caller knows what + the common prefix is, so just use that. + */ + int commonPrefixLen = commonPrefix.length(); + if (commonPrefixLen == 0) { + QString first; + QString last; + + /* + First, find out the common prefix of all non-namespaced + classes. For Qt, the prefix is Q. It can easily be derived + from the first and last classes in alphabetical order + (QAccel and QXtWidget in Qt 2.1). + */ + + NodeMap::const_iterator iter = classMap.begin(); + while (iter != classMap.end()) { + if (!iter.key().contains("::")) { + first = iter.key(); + break; + } + ++iter; } - ++iter; - } - if (first.isEmpty()) - first = classMap.begin().key(); + if (first.isEmpty()) + first = classMap.begin().key(); - iter = classMap.end(); - while (iter != classMap.begin()) { - --iter; - if (!iter.key().contains("::")) { - last = iter.key(); - break; + iter = classMap.end(); + while (iter != classMap.begin()) { + --iter; + if (!iter.key().contains("::")) { + last = iter.key(); + break; + } } - } - if (last.isEmpty()) - last = classMap.begin().key(); + if (last.isEmpty()) + last = classMap.begin().key(); - if (classMap.size() > 1) { - while (commonPrefixLen < first.length() + 1 && - commonPrefixLen < last.length() + 1 && - first[commonPrefixLen] == last[commonPrefixLen]) - ++commonPrefixLen; - } + if (classMap.size() > 1) { + while (commonPrefixLen < first.length() + 1 && + commonPrefixLen < last.length() + 1 && + first[commonPrefixLen] == last[commonPrefixLen]) + ++commonPrefixLen; + } - commonPrefix = first.left(commonPrefixLen); + commonPrefix = first.left(commonPrefixLen); + } /* Divide the data into 37 paragraphs: 0, ..., 9, A, ..., Z, underscore (_). QAccel will fall in paragraph 10 (A) and QXtWidget in paragraph 33 (X). This is the only place where we assume that NumParagraphs is 37. Each paragraph is a - QMap<QString, const Node *>. + NodeMap. */ - QMap<QString, const Node *> paragraph[NumParagraphs+1]; + NodeMap paragraph[NumParagraphs+1]; QString paragraphName[NumParagraphs+1]; - QMap<QString, const Node *>::ConstIterator c = classMap.begin(); + NodeMap::ConstIterator c = classMap.begin(); while (c != classMap.end()) { QStringList pieces = c.key().split("::"); QString key; + int idx = commonPrefixLen; + if (!pieces.last().startsWith(commonPrefix)) + idx = 0; if (pieces.size() == 1) - key = pieces.last().mid(commonPrefixLen).toLower(); + key = pieces.last().mid(idx).toLower(); else key = pieces.last().toLower(); @@ -2206,7 +2267,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, if ((currentParagraphNo[i] < NumParagraphs) && !paragraphName[currentParagraphNo[i]].isEmpty()) { - QMap<QString, const Node *>::Iterator it; + NodeMap::Iterator it; it = paragraph[currentParagraphNo[i]].begin(); for (j = 0; j < currentOffsetInParagraph[i]; j++) ++it; @@ -2253,7 +2314,7 @@ void HtmlGenerator::generateFunctionIndex(const Node *relative, #if 1 out() << "<ul>\n"; #endif - QMap<QString, QMap<QString, const Node *> >::ConstIterator f = funcIndex.begin(); + QMap<QString, NodeMap >::ConstIterator f = funcIndex.begin(); while (f != funcIndex.end()) { #if 1 out() << "<li>"; @@ -2268,7 +2329,7 @@ void HtmlGenerator::generateFunctionIndex(const Node *relative, nextLetter++; } - QMap<QString, const Node *>::ConstIterator s = (*f).begin(); + NodeMap::ConstIterator s = (*f).begin(); while (s != (*f).end()) { out() << " "; generateFullName((*s)->parent(), relative, marker, *s); @@ -2384,7 +2445,7 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m QMap<QString, FakeNode *> uncategorizedNodeMap; QRegExp singleDigit("\\b([0-9])\\b"); - const NodeList children = tre->root()->childNodes(); + const NodeList children = myTree->root()->childNodes(); foreach (Node *child, children) { if (child->type() == Node::Fake && child != relative) { FakeNode *fakeNode = static_cast<FakeNode *>(child); @@ -2436,7 +2497,7 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m else if (!isGroupPage) { // If we encounter a page that belongs to a group then // we add that page to the list for that group. - const FakeNode *groupNode = static_cast<const FakeNode *>(tre->root()->findNode(group, Node::Fake)); + const FakeNode *groupNode = static_cast<const FakeNode *>(myTree->root()->findNode(group, Node::Fake)); if (groupNode) fakeNodeMap[groupNode].insert(sortKey, fakeNode); //else @@ -2748,7 +2809,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, funcTag, &i, n, &arg, &par1)) { QString link = linkForNode( marker->resolveTarget(par1.toString(), - tre, + myTree, relative), relative); addLink(link, arg, &html); @@ -2777,7 +2838,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { par1 = QStringRef(); QString link = linkForNode( - marker->resolveTarget(arg.toString(), tre, relative), + marker->resolveTarget(arg.toString(), myTree, relative), relative); addLink(link, arg, &html); handled = true; @@ -3018,7 +3079,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, funcTag, &i, n, &arg, &par1)) { QString link = linkForNode( marker->resolveTarget(par1.toString(), - tre, + myTree, relative), relative); addLink(link, arg, &html); @@ -3047,7 +3108,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { par1 = QStringRef(); QString link = linkForNode( - marker->resolveTarget(arg.toString(), tre, relative), + marker->resolveTarget(arg.toString(), myTree, relative), relative); addLink(link, arg, &html); handled = true; @@ -3591,9 +3652,13 @@ void HtmlGenerator::findAllSince(const InnerNode *node) while (c != node->childNodes().constEnd()) { QString sinceVersion = (*c)->since(); if (((*c)->access() != Node::Private) && !sinceVersion.isEmpty()) { - SinceVersionMap::iterator vmap = sinceVersions.find(sinceVersion); - if (vmap == sinceVersions.end()) - vmap = sinceVersions.insert(sinceVersion,SinceNodeMultiMap()); + NodeMultiMapMap::iterator vmap = nodeMultiMapMap.find(sinceVersion); + if (vmap == nodeMultiMapMap.end()) + vmap = nodeMultiMapMap.insert(sinceVersion,NodeMultiMap()); + NodeMapMap::iterator ncmap = nodeMapMap.find(sinceVersion); + if (ncmap == nodeMapMap.end()) + ncmap = nodeMapMap.insert(sinceVersion,NodeMap()); + if ((*c)->type() == Node::Function) { FunctionNode *func = static_cast<FunctionNode *>(*c); if ((func->status() > Node::Obsolete) && @@ -3610,6 +3675,7 @@ void HtmlGenerator::findAllSince(const InnerNode *node) !(*c)->parent()->name().isEmpty()) className = (*c)->parent()->name()+"::"+className; vmap.value().insert(className,(*c)); + ncmap.value().insert(className,(*c)); } } else { @@ -3619,7 +3685,6 @@ void HtmlGenerator::findAllSince(const InnerNode *node) !(*c)->parent()->name().isEmpty()) name = (*c)->parent()->name()+"::"+name; vmap.value().insert(name,(*c)); - qDebug() << "GOT HEAH" << name; } if ((*c)->isInnerNode()) { findAllSince(static_cast<InnerNode *>(*c)); @@ -3646,9 +3711,10 @@ void HtmlGenerator::findAllFunctions(const InnerNode *node) } else if ((*c)->type() == Node::Function) { const FunctionNode *func = static_cast<const FunctionNode *>(*c); - if (func->status() > Node::Obsolete && func->metaness() != FunctionNode::Ctor - && func->metaness() != FunctionNode::Dtor) { - funcIndex[(*c)->name()].insert(tre->fullDocumentName((*c)->parent()), *c); + if ((func->status() > Node::Obsolete) && + (func->metaness() != FunctionNode::Ctor) && + (func->metaness() != FunctionNode::Dtor)) { + funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c); } } } @@ -3762,14 +3828,14 @@ const Node *HtmlGenerator::findNodeForTarget(const QString &target, node = relative; } else if (target.endsWith(".html")) { - node = tre->root()->findNode(target, Node::Fake); + node = myTree->root()->findNode(target, Node::Fake); } else if (marker) { - node = marker->resolveTarget(target, tre, relative); + node = marker->resolveTarget(target, myTree, relative); if (!node) - node = tre->findFakeNodeByTitle(target); + node = myTree->findFakeNodeByTitle(target); if (!node && atom) { - node = tre->findUnambiguousTarget(target, + node = myTree->findUnambiguousTarget(target, *const_cast<Atom**>(&atom)); } } @@ -3827,14 +3893,14 @@ QString HtmlGenerator::getLink(const Atom *atom, *node = relative; } else if (first.endsWith(".html")) { - *node = tre->root()->findNode(first, Node::Fake); + *node = myTree->root()->findNode(first, Node::Fake); } else { - *node = marker->resolveTarget(first, tre, relative); + *node = marker->resolveTarget(first, myTree, relative); if (!*node) - *node = tre->findFakeNodeByTitle(first); + *node = myTree->findFakeNodeByTitle(first); if (!*node) - *node = tre->findUnambiguousTarget(first, targetAtom); + *node = myTree->findUnambiguousTarget(first, targetAtom); } if (*node) { @@ -3886,7 +3952,7 @@ QString HtmlGenerator::getLink(const Atom *atom, } while (!path.isEmpty()) { - targetAtom = tre->findTarget(path.first(), *node); + targetAtom = myTree->findTarget(path.first(), *node); if (targetAtom == 0) break; path.removeFirst(); @@ -3915,7 +3981,7 @@ void HtmlGenerator::generateIndex(const QString &fileBase, const QString &url, const QString &title) { - tre->generateIndex(outputDir() + "/" + fileBase + ".index", url, title); + myTree->generateIndex(outputDir() + "/" + fileBase + ".index", url, title); } void HtmlGenerator::generateStatus(const Node *node, CodeMarker *marker) @@ -3930,18 +3996,21 @@ void HtmlGenerator::generateStatus(const Node *node, CodeMarker *marker) case Node::Compat: if (node->isInnerNode()) { text << Atom::ParaLeft - << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) << "This " - << typeString(node) << " is part of the Qt 3 support library." + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "This " + << typeString(node) + << " is part of the Qt 3 support library." << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << " It is provided to keep old source code working. We strongly advise against " + << " It is provided to keep old source code working. " + << "We strongly advise against " << "using it in new code. See "; - const FakeNode *fakeNode = tre->findFakeNodeByTitle("Porting To Qt 4"); + const FakeNode *fakeNode = myTree->findFakeNodeByTitle("Porting To Qt 4"); Atom *targetAtom = 0; if (fakeNode && node->type() == Node::Class) { QString oldName(node->name()); - targetAtom = tre->findTarget(oldName.replace("3", ""), - fakeNode); + targetAtom = myTree->findTarget(oldName.replace("3", ""), + fakeNode); } if (targetAtom) { @@ -4151,7 +4220,7 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn, QPair<QString,QString> linkPair; linkPair = cn->links()[Node::InheritsLink]; QStringList strList(linkPair.first); - const Node* n = tre->findNode(strList,Node::Fake); + const Node* n = myTree->findNode(strList,Node::Fake); if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast<const QmlClassNode*>(n); out() << "<p style=\"text-align: center\">"; @@ -4210,7 +4279,7 @@ void HtmlGenerator::generateInstantiatedBy(const ClassNode* cn, CodeMarker* marker) { if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { - const Node* n = tre->root()->findNode(cn->qmlElement(),Node::Fake); + const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); if (n && n->subType() == Node::QmlClass) { out() << "<p style=\"text-align: center\">"; Text text; diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 3f6e564..fabfed1 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -67,14 +67,34 @@ struct NavigationBar }; #endif -typedef QMultiMap<QString, Node*> SinceNodeMultiMap; -typedef QMap<QString, SinceNodeMultiMap> SinceVersionMap; +typedef QMultiMap<QString, Node*> NodeMultiMap; +typedef QMap<QString, NodeMultiMap> NodeMultiMapMap; +typedef QMap<QString, const Node*> NodeMap; +typedef QMap<QString, NodeMap> NodeMapMap; class HelpProjectWriter; class HtmlGenerator : public PageGenerator { public: + enum SinceType { + Namespace, + Class, + MemberFunction, + NamespaceFunction, + GlobalFunction, + Macro, + Enum, + Typedef, + Property, + Variable, + QmlProperty, + QmlSignal, + QmlMethod, + LastSinceType + }; + + public: HtmlGenerator(); ~HtmlGenerator(); @@ -85,6 +105,7 @@ class HtmlGenerator : public PageGenerator static QString protect(const QString& string); static QString cleanRef(const QString& ref); + static QString sinceTitle(int i) { return sinceTitles[i]; } protected: virtual void startText(const Node *relative, CodeMarker *marker); @@ -134,13 +155,14 @@ class HtmlGenerator : public PageGenerator CodeMarker::Status status); void generateClassHierarchy(const Node *relative, CodeMarker *marker, - const QMap<QString,const Node *> &classMap); + const NodeMap &classMap); void generateAnnotatedList(const Node *relative, CodeMarker *marker, - const QMap<QString, const Node *> &nodeMap); + const NodeMap &nodeMap); void generateCompactList(const Node *relative, CodeMarker *marker, - const QMap<QString, const Node *> &classMap); + const NodeMap &classMap, + QString commonPrefix = QString()); void generateFunctionIndex(const Node *relative, CodeMarker *marker); void generateLegaleseList(const Node *relative, CodeMarker *marker); void generateOverviewList(const Node *relative, CodeMarker *marker); @@ -273,23 +295,25 @@ class HtmlGenerator : public PageGenerator QString navigationLinks; QStringList stylesheets; QStringList customHeadElements; - const Tree *tre; + const Tree *myTree; bool slow; bool obsoleteLinks; - QMap<QString, QMap<QString, const Node *> > moduleClassMap; - QMap<QString, QMap<QString, const Node *> > moduleNamespaceMap; - QMap<QString, const Node *> nonCompatClasses; - QMap<QString, const Node *> mainClasses; - QMap<QString, const Node *> compatClasses; - QMap<QString, const Node *> obsoleteClasses; - QMap<QString, const Node *> namespaceIndex; - QMap<QString, const Node *> serviceClasses; + QMap<QString, NodeMap > moduleClassMap; + QMap<QString, NodeMap > moduleNamespaceMap; + NodeMap nonCompatClasses; + NodeMap mainClasses; + NodeMap compatClasses; + NodeMap obsoleteClasses; + NodeMap namespaceIndex; + NodeMap serviceClasses; #ifdef QDOC_QML - QMap<QString, const Node *> qmlClasses; + NodeMap qmlClasses; #endif - QMap<QString, QMap<QString, const Node *> > funcIndex; + QMap<QString, NodeMap > funcIndex; QMap<Text, const Node *> legaleseTexts; - SinceVersionMap sinceVersions; + NodeMultiMapMap nodeMultiMapMap; + static QString sinceTitles[]; + NodeMapMap nodeMapMap; }; #define HTMLGENERATOR_ADDRESS "address" @@ -303,3 +327,4 @@ class HtmlGenerator : public PageGenerator QT_END_NAMESPACE #endif + diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index d547d20..558808f 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -48,29 +48,17 @@ QT_BEGIN_NAMESPACE -QString Node::typeNames[] = - { - "Namespaces", - "Classes", - "Fake", - "Enums", - "Typedefs", - "Functions and Macros", - "Properties", - "Variables", - "Targets", - "Qml Properties", - "Qml Signals", - "Qml Methods", - "" - }; - /*! \class Node - \brief A node in a Tree. + \brief The Node class is a node in the Tree. + + A Node represents a class or function or something else + from the source code.. */ /*! + When this Node is destroyed, if it has a parent Node, it + removes itself from the parent node's child list. */ Node::~Node() { @@ -81,6 +69,11 @@ Node::~Node() } /*! + Sets this Node's Doc to \a doc. If \a replace is false and + this Node already has a Doc, a warning is reported that the + Doc is being overridden, and it reports where the previous + Doc was found. If \a replace is true, the Doc is replaced + silently. */ void Node::setDoc(const Doc& doc, bool replace) { @@ -840,9 +833,17 @@ void TypedefNode::setAssociatedEnum(const EnumNode *enume) /*! \class Parameter + \brief The class Parameter contains one parameter. + + A parameter can be a function parameter or a macro + parameter. */ /*! + Constructs this parameter from the left and right types + \a leftType and rightType, the parameter \a name, and the + \a defaultValue. In practice, \a rightType is not used, + and I don't know what is was meant for. */ Parameter::Parameter(const QString& leftType, const QString& rightType, @@ -853,6 +854,7 @@ Parameter::Parameter(const QString& leftType, } /*! + The standard copy constructor copies the strings from \a p. */ Parameter::Parameter(const Parameter& p) : lef(p.lef), rig(p.rig), nam(p.nam), def(p.def) @@ -860,6 +862,8 @@ Parameter::Parameter(const Parameter& p) } /*! + Assigning Parameter \a p to this Parameter copies the + strings across. */ Parameter& Parameter::operator=(const Parameter& p) { @@ -871,6 +875,23 @@ Parameter& Parameter::operator=(const Parameter& p) } /*! + Reconstructs the text describing the parameter and + returns it. If \a value is true, the default value + will be included, if there is one. + */ +QString Parameter::reconstruct(bool value) const +{ + QString p = lef + rig; + if (!p.endsWith(QChar('*')) && !p.endsWith(QChar('&')) && !p.endsWith(QChar(' '))) + p += " "; + p += nam; + if (value) + p += def; + return p; +} + + +/*! \class FunctionNode */ @@ -924,6 +945,8 @@ void FunctionNode::borrowParameterNames(const FunctionNode *source) } /*! + If this function is a reimplementation, \a from points + to the FunctionNode of the function being reimplemented. */ void FunctionNode::setReimplementedFrom(FunctionNode *from) { @@ -932,6 +955,8 @@ void FunctionNode::setReimplementedFrom(FunctionNode *from) } /*! + Sets the "associated" property to \a property. The function + might be the setter or getter for a property, for example. */ void FunctionNode::setAssociatedProperty(PropertyNode *property) { @@ -939,6 +964,8 @@ void FunctionNode::setAssociatedProperty(PropertyNode *property) } /*! + Returns the overload number for this function obtained + from the parent. */ int FunctionNode::overloadNumber() const { @@ -946,6 +973,8 @@ int FunctionNode::overloadNumber() const } /*! + Returns the number of times this function name has been + overloaded, obtained from the parent. */ int FunctionNode::numOverloads() const { @@ -953,6 +982,7 @@ int FunctionNode::numOverloads() const } /*! + Returns the list of parameter names. */ QStringList FunctionNode::parameterNames() const { @@ -966,6 +996,46 @@ QStringList FunctionNode::parameterNames() const } /*! + Returns the list of reconstructed parameters. If \a values + is true, the default values are included, if any are present. + */ +QStringList FunctionNode::reconstructParams(bool values) const +{ + QStringList params; + QList<Parameter>::ConstIterator p = parameters().begin(); + while (p != parameters().end()) { + params << (*p).reconstruct(values); + ++p; + } + return params; +} + +/*! + Reconstructs and returns the function's signature. If \a values + is true, the default values of the parameters are included, if + present. + */ +QString FunctionNode::signature(bool values) const +{ + QString s; + if (!returnType().isEmpty()) + s = returnType() + " "; + s += name() + "("; + QStringList params = reconstructParams(values); + int p = params.size(); + if (p > 0) { + for (int i=0; i<p; i++) { + s += params[i]; + if (i < (p-1)) + s += ", "; + } + } + s += ")"; + return s; +} + + +/*! \class PropertyNode */ diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index 09f38d2..f933270 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -175,13 +175,11 @@ class Node virtual QString fileBase() const; - static QString typeName(int i) { return typeNames[i]; } - protected: Node(Type type, InnerNode *parent, const QString& name); private: - static QString typeNames[]; + #ifdef Q_WS_WIN Type typ; Access acc; @@ -500,8 +498,10 @@ class Parameter { public: Parameter() {} - Parameter(const QString& leftType, const QString& rightType = "", - const QString& name = "", const QString& defaultValue = ""); + Parameter(const QString& leftType, + const QString& rightType = "", + const QString& name = "", + const QString& defaultValue = ""); Parameter(const Parameter& p); Parameter& operator=(const Parameter& p); @@ -514,6 +514,8 @@ class Parameter const QString& name() const { return nam; } const QString& defaultValue() const { return def; } + QString reconstruct(bool value = false) const; + private: QString lef; QString rig; @@ -541,6 +543,7 @@ class FunctionNode : public LeafNode virtual ~FunctionNode() { } void setReturnType(const QString& returnType) { rt = returnType; } + void setParentPath(const QStringList& parentPath) { pp = parentPath; } void setMetaness(Metaness metaness) { met = metaness; } void setVirtualness(Virtualness virtualness) { vir = virtualness; } void setConst(bool conste) { con = conste; } @@ -569,6 +572,10 @@ class FunctionNode : public LeafNode const FunctionNode *reimplementedFrom() const { return rf; } const QList<FunctionNode *> &reimplementedBy() const { return rb; } const PropertyNode *associatedProperty() const { return ap; } + const QStringList& parentPath() const { return pp; } + + QStringList reconstructParams(bool values = false) const; + QString signature(bool values = false) const; private: void setAssociatedProperty(PropertyNode *property); @@ -576,9 +583,10 @@ class FunctionNode : public LeafNode friend class InnerNode; friend class PropertyNode; - QString rt; + QString rt; + QStringList pp; #ifdef Q_WS_WIN - Metaness met; + Metaness met; Virtualness vir; #else Metaness met : 4; diff --git a/translations/translations.pri b/translations/translations.pri index bc991df..aa5430f 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -9,12 +9,9 @@ defineReplace(prependAll) { } defineReplace(fixPath) { -WIN { - return ($$replace($$1, /, \)) -} ELSE { + win32:1 ~= s|/|\\| return ($$1) } -} LUPDATE = $$fixPath($$QT_BUILD_TREE/bin/lupdate) -locations relative -no-ui-lines LRELEASE = $$fixPath($$QT_BUILD_TREE/bin/lrelease) |