summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/kernel.pri2
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.cpp4
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher.h5
-rw-r--r--src/corelib/kernel/qabstracteventdispatcher_p.h4
-rw-r--r--src/corelib/kernel/qbasictimer.cpp4
-rw-r--r--src/corelib/kernel/qbasictimer.h5
-rw-r--r--src/corelib/kernel/qcore_mac.cpp4
-rw-r--r--src/corelib/kernel/qcore_mac_objc.mm54
-rw-r--r--src/corelib/kernel/qcore_mac_p.h13
-rw-r--r--src/corelib/kernel/qcore_unix.cpp4
-rw-r--r--src/corelib/kernel/qcore_unix_p.h10
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp312
-rw-r--r--src/corelib/kernel/qcoreapplication.h17
-rw-r--r--src/corelib/kernel/qcoreapplication_mac.cpp4
-rw-r--r--src/corelib/kernel/qcoreapplication_p.h27
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp10
-rw-r--r--src/corelib/kernel/qcorecmdlineargs_p.h19
-rw-r--r--src/corelib/kernel/qcoreevent.cpp4
-rw-r--r--src/corelib/kernel/qcoreevent.h5
-rw-r--r--src/corelib/kernel/qcoreglobaldata.cpp4
-rw-r--r--src/corelib/kernel/qcoreglobaldata_p.h4
-rw-r--r--src/corelib/kernel/qcrashhandler.cpp4
-rw-r--r--src/corelib/kernel/qcrashhandler_p.h4
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib.cpp4
-rw-r--r--src/corelib/kernel/qeventdispatcher_glib_p.h4
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp4
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix_p.h4
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp14
-rw-r--r--src/corelib/kernel/qeventdispatcher_win_p.h5
-rw-r--r--src/corelib/kernel/qeventloop.cpp118
-rw-r--r--src/corelib/kernel/qeventloop.h31
-rw-r--r--src/corelib/kernel/qeventloop_p.h83
-rw-r--r--src/corelib/kernel/qfunctions_nacl.cpp4
-rw-r--r--src/corelib/kernel/qfunctions_nacl.h5
-rw-r--r--src/corelib/kernel/qfunctions_p.h4
-rw-r--r--src/corelib/kernel/qfunctions_vxworks.cpp4
-rw-r--r--src/corelib/kernel/qfunctions_vxworks.h5
-rw-r--r--src/corelib/kernel/qfunctions_wince.cpp4
-rw-r--r--src/corelib/kernel/qfunctions_wince.h5
-rw-r--r--src/corelib/kernel/qmath.cpp4
-rw-r--r--src/corelib/kernel/qmath.h159
-rw-r--r--src/corelib/kernel/qmath.qdoc4
-rw-r--r--src/corelib/kernel/qmetaobject.cpp18
-rw-r--r--src/corelib/kernel/qmetaobject.h5
-rw-r--r--src/corelib/kernel/qmetaobject_moc_p.h4
-rw-r--r--src/corelib/kernel/qmetaobject_p.h6
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder.cpp80
-rw-r--r--src/corelib/kernel/qmetaobjectbuilder_p.h4
-rw-r--r--src/corelib/kernel/qmetatype.cpp289
-rw-r--r--src/corelib/kernel/qmetatype.h118
-rw-r--r--src/corelib/kernel/qmetatype_p.h6
-rw-r--r--src/corelib/kernel/qmetatypeswitcher_p.h4
-rw-r--r--src/corelib/kernel/qmimedata.cpp4
-rw-r--r--src/corelib/kernel/qmimedata.h5
-rw-r--r--src/corelib/kernel/qobject.cpp18
-rw-r--r--src/corelib/kernel/qobject.h7
-rw-r--r--src/corelib/kernel/qobject_impl.h5
-rw-r--r--src/corelib/kernel/qobject_p.h4
-rw-r--r--src/corelib/kernel/qobjectcleanuphandler.cpp4
-rw-r--r--src/corelib/kernel/qobjectcleanuphandler.h5
-rw-r--r--src/corelib/kernel/qobjectdefs.h14
-rw-r--r--src/corelib/kernel/qpointer.cpp4
-rw-r--r--src/corelib/kernel/qpointer.h5
-rw-r--r--src/corelib/kernel/qsharedmemory.cpp21
-rw-r--r--src/corelib/kernel/qsharedmemory.h5
-rw-r--r--src/corelib/kernel/qsharedmemory_p.h23
-rw-r--r--src/corelib/kernel/qsharedmemory_unix.cpp4
-rw-r--r--src/corelib/kernel/qsharedmemory_win.cpp5
-rw-r--r--src/corelib/kernel/qsignalmapper.cpp4
-rw-r--r--src/corelib/kernel/qsignalmapper.h5
-rw-r--r--src/corelib/kernel/qsocketnotifier.cpp4
-rw-r--r--src/corelib/kernel/qsocketnotifier.h5
-rw-r--r--src/corelib/kernel/qsystemerror.cpp70
-rw-r--r--src/corelib/kernel/qsystemerror_p.h4
-rw-r--r--src/corelib/kernel/qsystemsemaphore.cpp16
-rw-r--r--src/corelib/kernel/qsystemsemaphore.h5
-rw-r--r--src/corelib/kernel/qsystemsemaphore_p.h19
-rw-r--r--src/corelib/kernel/qsystemsemaphore_unix.cpp4
-rw-r--r--src/corelib/kernel/qsystemsemaphore_win.cpp5
-rw-r--r--src/corelib/kernel/qtcore_eval.cpp6
-rw-r--r--src/corelib/kernel/qtimer.cpp4
-rw-r--r--src/corelib/kernel/qtimer.h5
-rw-r--r--src/corelib/kernel/qtimerinfo_unix.cpp4
-rw-r--r--src/corelib/kernel/qtimerinfo_unix_p.h4
-rw-r--r--src/corelib/kernel/qtranslator.cpp8
-rw-r--r--src/corelib/kernel/qtranslator.h5
-rw-r--r--src/corelib/kernel/qtranslator_p.h4
-rw-r--r--src/corelib/kernel/qvariant.cpp120
-rw-r--r--src/corelib/kernel/qvariant.h9
-rw-r--r--src/corelib/kernel/qvariant_p.h4
-rw-r--r--src/corelib/kernel/qwineventnotifier.cpp4
-rw-r--r--src/corelib/kernel/qwineventnotifier.h5
92 files changed, 869 insertions, 1109 deletions
diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri
index 1139e3074a..6ebc62614b 100644
--- a/src/corelib/kernel/kernel.pri
+++ b/src/corelib/kernel/kernel.pri
@@ -90,6 +90,8 @@ mac {
mac:!nacl {
SOURCES += \
kernel/qcore_mac.cpp
+ OBJECTIVE_SOURCES += \
+ kernel/qcore_mac_objc.mm
}
nacl {
diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp
index 1d4bf3cf1f..31a46ad744 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.cpp
+++ b/src/corelib/kernel/qabstracteventdispatcher.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qabstracteventdispatcher.h b/src/corelib/kernel/qabstracteventdispatcher.h
index 80e77c02af..76f264c3c0 100644
--- a/src/corelib/kernel/qabstracteventdispatcher.h
+++ b/src/corelib/kernel/qabstracteventdispatcher.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QAbstractEventDispatcherPrivate;
class QSocketNotifier;
diff --git a/src/corelib/kernel/qabstracteventdispatcher_p.h b/src/corelib/kernel/qabstracteventdispatcher_p.h
index 6e1c81ae33..b6f0160342 100644
--- a/src/corelib/kernel/qabstracteventdispatcher_p.h
+++ b/src/corelib/kernel/qabstracteventdispatcher_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qbasictimer.cpp b/src/corelib/kernel/qbasictimer.cpp
index a52152875f..621223eb88 100644
--- a/src/corelib/kernel/qbasictimer.cpp
+++ b/src/corelib/kernel/qbasictimer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qbasictimer.h b/src/corelib/kernel/qbasictimer.h
index 84b232e766..4d01fbc4fd 100644
--- a/src/corelib/kernel/qbasictimer.h
+++ b/src/corelib/kernel/qbasictimer.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QObject;
diff --git a/src/corelib/kernel/qcore_mac.cpp b/src/corelib/kernel/qcore_mac.cpp
index 88cc83ce48..6d661911ca 100644
--- a/src/corelib/kernel/qcore_mac.cpp
+++ b/src/corelib/kernel/qcore_mac.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm
new file mode 100644
index 0000000000..76705f1c8c
--- /dev/null
+++ b/src/corelib/kernel/qcore_mac_objc.mm
@@ -0,0 +1,54 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+ ** Contact: http://www.qt-project.org/
+ **
+ ** This file is part of the QtCore module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** GNU Lesser General Public License Usage
+ ** 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.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU General
+ ** Public License version 3.0 as published by the Free Software Foundation
+ ** and appearing in the file LICENSE.GPL included in the packaging of this
+ ** file. Please review the following information to ensure the GNU General
+ ** Public License version 3.0 requirements will be met:
+ ** http://www.gnu.org/copyleft/gpl.html.
+ **
+ ** Other Usage
+ ** Alternatively, this file may be used in accordance with the terms and
+ ** conditions contained in a signed written agreement between you and Nokia.
+ **
+ **
+ **
+ **
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+#include <private/qcore_mac_p.h>
+
+NSString *QCFString::toNSString(const QString &string)
+{
+ // The const cast below is safe: CfStringRef is immutable and so is NSString.
+ return [const_cast<NSString *>(reinterpret_cast<const NSString *>(toCFStringRef(string))) autorelease];
+}
+
+QString QCFString::toQString(const NSString *nsstr)
+{
+ return toQString(reinterpret_cast<CFStringRef>(nsstr));
+}
+
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index 4efd6bf653..78cb0eff3b 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -78,6 +78,10 @@
#include <CoreServices/CoreServices.h>
#endif
+#ifdef __OBJC__
+#include <Foundation/Foundation.h>
+#endif
+
#undef DEBUG
#ifdef OLD_DEBUG
# define DEBUG OLD_DEBUG
@@ -144,6 +148,11 @@ public:
operator CFStringRef() const;
static QString toQString(CFStringRef cfstr);
static CFStringRef toCFStringRef(const QString &str);
+#ifdef __OBJC__
+ static QString toQString(const NSString *nsstr);
+ static NSString *toNSString(const QString &string);
+#endif
+
private:
QString string;
};
diff --git a/src/corelib/kernel/qcore_unix.cpp b/src/corelib/kernel/qcore_unix.cpp
index 08a2f69bf3..3f4d4431e6 100644
--- a/src/corelib/kernel/qcore_unix.cpp
+++ b/src/corelib/kernel/qcore_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qcore_unix_p.h b/src/corelib/kernel/qcore_unix_p.h
index 9ac4f5c480..6ec8e269f8 100644
--- a/src/corelib/kernel/qcore_unix_p.h
+++ b/src/corelib/kernel/qcore_unix_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -274,9 +274,8 @@ static inline int qt_safe_close(int fd)
#undef QT_CLOSE
#define QT_CLOSE qt_safe_close
-// - Open C does not (yet?) implement these on Symbian OS
// - VxWorks doesn't have processes
-#if !defined(Q_OS_SYMBIAN) && !defined(Q_OS_VXWORKS)
+#if !defined(Q_OS_VXWORKS)
static inline int qt_safe_execve(const char *filename, char *const argv[],
char *const envp[])
{
@@ -298,16 +297,13 @@ static inline int qt_safe_execvp(const char *file, char *const argv[])
EINTR_LOOP(ret, ::execvp(file, argv));
return ret;
}
-#endif
-#ifndef Q_OS_VXWORKS // no processes on VxWorks
static inline pid_t qt_safe_waitpid(pid_t pid, int *status, int options)
{
register int ret;
EINTR_LOOP(ret, ::waitpid(pid, status, options));
return ret;
}
-
#endif // Q_OS_VXWORKS
#if !defined(_POSIX_MONOTONIC_CLOCK)
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 05f26cc87f..cf3ae1b7c5 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -66,15 +66,7 @@
#include <private/qfunctions_p.h>
#include <private/qlocale_p.h>
-#ifdef Q_OS_SYMBIAN
-# include <exception>
-# include <f32file.h>
-# include <e32ldr.h>
-# include "qeventdispatcher_symbian_p.h"
-# include "private/qcore_symbian_p.h"
-# include "private/qfilesystemengine_p.h"
-# include <apacmdln.h>
-#elif defined(Q_OS_UNIX)
+#if defined(Q_OS_UNIX)
# if !defined(QT_NO_GLIB)
# include "qeventdispatcher_glib_p.h"
# endif
@@ -116,62 +108,6 @@ private:
QMutex *mtx;
};
-#ifdef Q_OS_SYMBIAN
-typedef TDriveNumber (*SystemDriveFunc)(RFs&);
-static SystemDriveFunc PtrGetSystemDrive = 0;
-static CApaCommandLine* apaCommandLine = 0;
-static char *apaTail = 0;
-static QVector<char *> *apaArgv = 0;
-
-static void qt_cleanup_apa_cmd_line()
-{
- delete apaCommandLine;
- apaCommandLine = 0;
- delete apaArgv;
- apaArgv = 0;
- delete apaTail;
- apaTail = 0;
-}
-
-static inline void qt_init_symbian_apa_arguments(int &argc, char **&argv)
-{
- // If app is launched via CApaCommandLine::StartApp(), normal arguments only contain
- // application name.
- if (argc == 1) {
- CApaCommandLine* commandLine = QCoreApplicationPrivate::symbianCommandLine();
- if(commandLine) {
- TPtrC8 apaCmdLine = commandLine->TailEnd();
- int tailLen = apaCmdLine.Length();
- if (tailLen) {
- apaTail = reinterpret_cast<char *>(malloc(tailLen + 1));
- qMemCopy(apaTail, reinterpret_cast<const char *>(apaCmdLine.Ptr()), tailLen);
- apaTail[tailLen] = '\0';
- apaArgv = new QVector<char *>(8);
- // Reuse windows command line parsing
- *apaArgv = qWinCmdLine<char>(apaTail, tailLen, argc);
- apaArgv->insert(0, argv[0]);
- argc++;
- argv = apaArgv->data();
- }
- }
- }
-}
-
-CApaCommandLine* QCoreApplicationPrivate::symbianCommandLine()
-{
- // Getting of Apa command line needs to be static as it can only be called successfully
- // once per process.
- if (!apaCommandLine) {
- TInt err = CApaCommandLine::GetCommandLineFromProcessEnvironment(apaCommandLine);
- if (err == KErrNone) {
- qAddPostRoutine(qt_cleanup_apa_cmd_line);
- }
- }
- return apaCommandLine;
-}
-
-#endif
-
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
extern QString qAppFileName();
#endif
@@ -335,6 +271,8 @@ struct QCoreApplicationData {
Q_GLOBAL_STATIC(QCoreApplicationData, coreappdata)
+static bool quitLockRefEnabled = true;
+
QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint flags)
: QObjectPrivate(), argc(aargc), argv(aargv), application_type(0), eventFilter(0),
in_exec(false), aboutToQuitEmitted(false), threadData_clean(false)
@@ -347,10 +285,6 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint
}
QCoreApplicationPrivate::is_app_closing = false;
-#ifdef Q_OS_SYMBIAN
- qt_init_symbian_apa_arguments(argc, argv);
-#endif
-
#ifdef Q_OS_UNIX
qt_application_thread_id = QThread::currentThreadId();
#endif
@@ -393,9 +327,7 @@ void QCoreApplicationPrivate::cleanupThreadData()
void QCoreApplicationPrivate::createEventDispatcher()
{
Q_Q(QCoreApplication);
-#if defined(Q_OS_SYMBIAN)
- eventDispatcher = new QEventDispatcherSymbian(q);
-#elif defined(Q_OS_UNIX)
+#if defined(Q_OS_UNIX)
# if !defined(QT_NO_GLIB)
if (qgetenv("QT_NO_GLIB").isEmpty() && QEventDispatcherGlib::versionSupported())
eventDispatcher = new QEventDispatcherGlib(q);
@@ -443,11 +375,6 @@ void QCoreApplicationPrivate::checkReceiverThread(QObject *receiver)
Q_UNUSED(currentThread);
Q_UNUSED(thr);
}
-#elif defined(Q_OS_SYMBIAN) && defined (QT_NO_DEBUG)
-// no implementation in release builds, but keep the symbol present
-void QCoreApplicationPrivate::checkReceiverThread(QObject * /* receiver */)
-{
-}
#endif
void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths()
@@ -455,17 +382,10 @@ void QCoreApplicationPrivate::appendApplicationPathToLibraryPaths()
#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
QStringList *app_libpaths = coreappdata()->app_libpaths;
Q_ASSERT(app_libpaths);
-# if defined(Q_OS_SYMBIAN)
- QString app_location( QCoreApplication::applicationDirPath() );
- // File existence check for application's private dir requires additional '\' or
- // platform security will not allow it.
- if (app_location != QLibraryInfo::location(QLibraryInfo::PluginsPath) && QFile::exists(app_location + QLatin1Char('\\')) && !app_libpaths->contains(app_location))
-# else
QString app_location( QCoreApplication::applicationFilePath() );
app_location.truncate(app_location.lastIndexOf(QLatin1Char('/')));
app_location = QDir(app_location).canonicalPath();
if (QFile::exists(app_location) && !app_libpaths->contains(app_location))
-# endif
app_libpaths->append(app_location);
#endif
}
@@ -607,17 +527,6 @@ QCoreApplication::QCoreApplication(int &argc, char **argv, int _internal)
{
init();
QCoreApplicationPrivate::eventDispatcher->startingUp();
-#if defined(Q_OS_SYMBIAN)
-#ifndef QT_NO_LIBRARY
- // Refresh factoryloader, as text codecs are requested during lib path
- // resolving process and won't be therefore properly loaded.
- // Unknown if this is symbian specific issue.
- QFactoryLoader::refreshAll();
-#endif
-#ifndef QT_NO_SYSTEMLOCALE
- d_func()->symbianInit();
-#endif
-#endif //Q_OS_SYMBIAN
}
@@ -634,12 +543,6 @@ void QCoreApplication::init()
Q_ASSERT_X(!self, "QCoreApplication", "there should be only one application object");
QCoreApplication::self = this;
-#ifdef Q_OS_SYMBIAN
- //ensure temp and working directories exist
- QFileSystemEngine::createDirectory(QFileSystemEntry(QFileSystemEngine::tempPath()), true);
- QFileSystemEngine::createDirectory(QFileSystemEntry(QFileSystemEngine::currentPath()), true);
-#endif
-
#ifndef QT_NO_THREAD
QThread::initialize();
#endif
@@ -673,41 +576,11 @@ void QCoreApplication::init()
qt_core_eval_init(d->application_type);
#endif
-#if defined(Q_OS_SYMBIAN) \
- && defined(Q_CC_NOKIAX86) \
- && defined(QT_DEBUG)
- /**
- * Prevent the executable from being locked in the Symbian emulator. The
- * code dramatically simplifies debugging on Symbian, but beyond that has
- * no impact.
- *
- * Force the ZLazyUnloadTimer to fire and therefore unload code segments
- * immediately. The code affects Symbian's file server and on the other
- * hand needs only to be run once in each emulator run.
- */
- {
- RLoader loader;
- CleanupClosePushL(loader);
- User::LeaveIfError(loader.Connect());
- User::LeaveIfError(loader.CancelLazyDllUnload());
- CleanupStack::PopAndDestroy(&loader);
- }
-#endif
-
d->processCommandLineArguments();
qt_startup_hook();
}
-#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_SYSTEMLOCALE)
-void QCoreApplicationPrivate::symbianInit()
-{
- if (!environmentChangeNotifier)
- environmentChangeNotifier.reset(new QEnvironmentChangeNotifier);
-}
-#endif
-
-
/*!
Destroys the QCoreApplication object.
*/
@@ -720,7 +593,6 @@ QCoreApplication::~QCoreApplication()
QCoreApplicationPrivate::is_app_running = false;
#if !defined(QT_NO_THREAD)
-#if !defined(QT_NO_CONCURRENT)
// Synchronize and stop the global thread pool threads.
QThreadPool *globalThreadPool = 0;
QT_TRY {
@@ -730,7 +602,6 @@ QCoreApplication::~QCoreApplication()
}
if (globalThreadPool)
globalThreadPool->waitForDone();
-#endif
QThread::cleanup();
#endif
@@ -778,6 +649,29 @@ bool QCoreApplication::testAttribute(Qt::ApplicationAttribute attribute)
return QCoreApplicationPrivate::testAttribute(attribute);
}
+/*!/
+ Returns true if the use of the QEventLoopLocker feature can cause the
+ application to quit, otherwise returns false.
+
+ \sa QEventLoopLocker
+ */
+bool QCoreApplication::isQuitLockEnabled()
+{
+ return quitLockRefEnabled;
+}
+
+/*!
+ Enables the ability of the QEventLoopLocker feature to quit
+ the application.
+
+ If disabled, the use of QEventLoopLocker will not quit the application.
+
+ \sa QEventLoopLocker
+ */
+void QCoreApplication::setQuitLockEnabled(bool enabled)
+{
+ quitLockRefEnabled = enabled;
+}
/*!
\internal
@@ -973,8 +867,6 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags)
QThreadData *data = QThreadData::current();
if (!data->eventDispatcher)
return;
- if (flags & QEventLoop::DeferredDeletion)
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
data->eventDispatcher->processEvents(flags);
}
@@ -1001,13 +893,9 @@ void QCoreApplication::processEvents(QEventLoop::ProcessEventsFlags flags, int m
return;
QElapsedTimer start;
start.start();
- if (flags & QEventLoop::DeferredDeletion)
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
while (data->eventDispatcher->processEvents(flags & ~QEventLoop::WaitForMoreEvents)) {
if (start.elapsed() > maxtime)
break;
- if (flags & QEventLoop::DeferredDeletion)
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
}
}
@@ -1611,6 +1499,17 @@ bool QCoreApplication::event(QEvent *e)
\sa QObject::tr(), QObject::trUtf8(), QString::fromUtf8()
*/
+void QCoreApplicationPrivate::ref()
+{
+ quitLockRef.ref();
+}
+
+void QCoreApplicationPrivate::deref()
+{
+ if (!quitLockRef.deref() && in_exec && quitLockRefEnabled)
+ QCoreApplication::postEvent(qApp, new QEvent(QEvent::Quit));
+}
+
/*!
Tells the application to exit with return code 0 (success).
Equivalent to calling QCoreApplication::exit(0).
@@ -1846,11 +1745,6 @@ bool QCoreApplicationPrivate::isTranslatorInstalled(QTranslator *translator)
function also assumes that the current directory has not been
changed by the application.
- In Symbian this function will return the application private directory,
- not the path to executable itself, as those are always in \c {/sys/bin}.
- If the application is in a read only drive, i.e. ROM, then the private path
- on the system drive will be returned.
-
\sa applicationFilePath()
*/
QString QCoreApplication::applicationDirPath()
@@ -1862,49 +1756,7 @@ QString QCoreApplication::applicationDirPath()
QCoreApplicationPrivate *d = self->d_func();
if (d->cachedApplicationDirPath.isNull())
-#if defined(Q_OS_SYMBIAN)
- {
- QString appPath;
- RFs& fs = qt_s60GetRFs();
- TChar driveChar;
- QChar qDriveChar;
- driveChar = (RProcess().FileName())[0];
-
- //Check if the process is installed in a read only drive (typically ROM),
- //and use the system drive (typically C:) if so.
- TInt drive;
- TDriveInfo driveInfo;
- TInt err = fs.CharToDrive(driveChar, drive);
- if (err == KErrNone) {
- err = fs.Drive(driveInfo, drive);
- }
- if (err != KErrNone || (driveInfo.iDriveAtt & KDriveAttRom) || (driveInfo.iMediaAtt
- & KMediaAttWriteProtected)) {
- if(!PtrGetSystemDrive)
- PtrGetSystemDrive = reinterpret_cast<SystemDriveFunc>(qt_resolveS60PluginFunc(S60Plugin_GetSystemDrive));
- Q_ASSERT(PtrGetSystemDrive);
- drive = PtrGetSystemDrive(fs);
- fs.DriveToChar(drive, driveChar);
- }
-
- qDriveChar = QChar(QLatin1Char(driveChar)).toUpper();
-
- TFileName privatePath;
- fs.PrivatePath(privatePath);
- appPath = qt_TDesC2QString(privatePath);
- appPath.prepend(QLatin1Char(':')).prepend(qDriveChar);
-
- // Create the appPath if it doesn't exist. Non-existing appPath will cause
- // Platform Security violations later on if the app doesn't have AllFiles capability.
- err = fs.CreatePrivatePath(drive);
- if (err != KErrNone)
- qWarning("QCoreApplication::applicationDirPath: Failed to create private path.");
-
- d->cachedApplicationDirPath = QFileInfo(appPath).path();
- }
-#else
d->cachedApplicationDirPath = QFileInfo(applicationFilePath()).path();
-#endif
return d->cachedApplicationDirPath;
}
@@ -1945,20 +1797,7 @@ QString QCoreApplication::applicationFilePath()
return d->cachedApplicationFilePath;
}
#endif
-#if defined(Q_OS_SYMBIAN)
- QString appPath;
- RProcess proc;
- TInt err = proc.Open(proc.Id());
- if (err == KErrNone) {
- TFileName procName = proc.FileName();
- appPath.append(QString(reinterpret_cast<const QChar*>(procName.Ptr()), procName.Length()));
- proc.Close();
- }
-
- d->cachedApplicationFilePath = appPath;
- return d->cachedApplicationFilePath;
-
-#elif defined( Q_OS_UNIX )
+#if defined( Q_OS_UNIX )
# ifdef Q_OS_LINUX
// Try looking for a /proc/<pid>/exe symlink first which points to
// the absolute path of the executable
@@ -1969,7 +1808,7 @@ QString QCoreApplication::applicationFilePath()
}
# endif
- QString argv0 = QFile::decodeName(QByteArray(argv()[0]));
+ QString argv0 = QFile::decodeName(arguments().at(0).toLocal8Bit());
QString absPath;
if (!argv0.isEmpty() && argv0.at(0) == QLatin1Char('/')) {
@@ -2017,35 +1856,6 @@ qint64 QCoreApplication::applicationPid()
}
/*!
- \obsolete
-
- Use arguments().size() instead.
-*/
-int QCoreApplication::argc()
-{
- if (!self) {
- qWarning("QCoreApplication::argc: Please instantiate the QApplication object first");
- return 0;
- }
- return self->d_func()->argc;
-}
-
-
-/*!
- \obsolete
-
- Use arguments() instead.
-*/
-char **QCoreApplication::argv()
-{
- if (!self) {
- qWarning("QCoreApplication::argv: Please instantiate the QApplication object first");
- return 0;
- }
- return self->d_func()->argv;
-}
-
-/*!
\since 4.1
Returns the list of command-line arguments.
@@ -2072,12 +1882,6 @@ char **QCoreApplication::argv()
As a result of this, the string given by arguments().at(0) might not be
the program name on Windows, depending on how the application was started.
- For Symbian applications started with \c RApaLsSession::StartApp one can specify
- arguments using \c CApaCommandLine::SetTailEndL function. Such arguments are only
- available via this method; they will not be passed to \c main function. Also note
- that only 8-bit string data set with \c CApaCommandLine::SetTailEndL is supported
- by this function.
-
\sa applicationFilePath()
*/
@@ -2256,34 +2060,12 @@ QStringList QCoreApplication::libraryPaths()
if (!coreappdata()->app_libpaths) {
QStringList *app_libpaths = coreappdata()->app_libpaths = new QStringList;
QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath);
-#if defined(Q_OS_SYMBIAN)
- // Add existing path on all drives for relative PluginsPath in Symbian
- if (installPathPlugins.at(1) != QChar(QLatin1Char(':'))) {
- QString tempPath = installPathPlugins;
- if (tempPath.at(tempPath.length() - 1) != QDir::separator()) {
- tempPath += QDir::separator();
- }
- RFs& fs = qt_s60GetRFs();
- TPtrC tempPathPtr(reinterpret_cast<const TText*> (tempPath.constData()));
- TFindFile finder(fs);
- TInt err = finder.FindByDir(tempPathPtr, tempPathPtr);
- while (err == KErrNone) {
- QString foundDir(reinterpret_cast<const QChar *>(finder.File().Ptr()),
- finder.File().Length());
- foundDir = QDir(foundDir).canonicalPath();
- if (!app_libpaths->contains(foundDir))
- app_libpaths->append(foundDir);
- err = finder.Find();
- }
- }
-#else
if (QFile::exists(installPathPlugins)) {
// Make sure we convert from backslashes to slashes.
installPathPlugins = QDir(installPathPlugins).canonicalPath();
if (!app_libpaths->contains(installPathPlugins))
app_libpaths->append(installPathPlugins);
}
-#endif
// If QCoreApplication is not yet instantiated,
// make sure we add the application path when we construct the QCoreApplication
@@ -2291,7 +2073,7 @@ QStringList QCoreApplication::libraryPaths()
const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH");
if (!libPathEnv.isEmpty()) {
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
QLatin1Char pathSep(';');
#else
QLatin1Char pathSep(':');
@@ -2317,10 +2099,6 @@ QStringList QCoreApplication::libraryPaths()
\a paths. All existing paths will be deleted and the path list
will consist of the paths given in \a paths.
- In Symbian this function is only useful for setting paths for
- finding Qt extension plugin stubs, since the OS can only
- load libraries from the \c{/sys/bin} directory.
-
\sa libraryPaths(), addLibraryPath(), removeLibraryPath(), QLibrary
*/
void QCoreApplication::setLibraryPaths(const QStringList &paths)
@@ -2343,10 +2121,6 @@ void QCoreApplication::setLibraryPaths(const QStringList &paths)
is \c INSTALL/plugins, where \c INSTALL is the directory where Qt was
installed.
- In Symbian this function is only useful for adding paths for
- finding Qt extension plugin stubs, since the OS can only
- load libraries from the \c{/sys/bin} directory.
-
\sa removeLibraryPath(), libraryPaths(), setLibraryPaths()
*/
void QCoreApplication::addLibraryPath(const QString &path)
diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h
index abbc6e5821..d1fba3b63c 100644
--- a/src/corelib/kernel/qcoreapplication.h
+++ b/src/corelib/kernel/qcoreapplication.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QCoreApplicationPrivate;
class QTextCodec;
@@ -72,6 +71,7 @@ class Q_CORE_EXPORT QCoreApplication : public QObject
Q_PROPERTY(QString applicationVersion READ applicationVersion WRITE setApplicationVersion)
Q_PROPERTY(QString organizationName READ organizationName WRITE setOrganizationName)
Q_PROPERTY(QString organizationDomain READ organizationDomain WRITE setOrganizationDomain)
+ Q_PROPERTY(bool quitLockEnabled READ isQuitLockEnabled WRITE setQuitLockEnabled)
Q_DECLARE_PRIVATE(QCoreApplication)
public:
@@ -88,10 +88,6 @@ public:
~QCoreApplication();
-#ifdef QT_DEPRECATED
- QT_DEPRECATED static int argc();
- QT_DEPRECATED static char **argv();
-#endif
static QStringList arguments();
static void setAttribute(Qt::ApplicationAttribute attribute, bool on = true);
@@ -157,7 +153,7 @@ public:
virtual bool winEventFilter(MSG *message, long *result);
#endif
-#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_UNIX)
static void watchUnixSignal(int signal, bool watch);
#endif
@@ -165,6 +161,9 @@ public:
EventFilter setEventFilter(EventFilter filter);
bool filterEvent(void *message, long *result);
+ static bool isQuitLockEnabled();
+ static void setQuitLockEnabled(bool enabled);
+
public Q_SLOTS:
static void quit();
@@ -188,7 +187,7 @@ private:
void init();
static QCoreApplication *self;
-
+
Q_DISABLE_COPY(QCoreApplication)
friend class QEventDispatcherUNIXPrivate;
diff --git a/src/corelib/kernel/qcoreapplication_mac.cpp b/src/corelib/kernel/qcoreapplication_mac.cpp
index 289c2f4bdb..d304ee0593 100644
--- a/src/corelib/kernel/qcoreapplication_mac.cpp
+++ b/src/corelib/kernel/qcoreapplication_mac.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h
index 692e460114..861a046f16 100644
--- a/src/corelib/kernel/qcoreapplication_p.h
+++ b/src/corelib/kernel/qcoreapplication_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,20 +58,10 @@
#include "QtCore/qsettings.h"
#include "private/qobject_p.h"
-#ifdef Q_OS_SYMBIAN
-#include <f32file.h>
-#endif
-
QT_BEGIN_NAMESPACE
typedef QList<QTranslator*> QTranslatorList;
-#if defined(Q_OS_SYMBIAN)
-# if !defined(QT_NO_SYSTEMLOCALE)
-class QEnvironmentChangeNotifier;
-# endif
-class CApaCommandLine;
-#endif
class QAbstractEventDispatcher;
class Q_CORE_EXPORT QCoreApplicationPrivate : public QObjectPrivate
@@ -99,12 +89,16 @@ public:
static QString macMenuBarName();
#endif
+ QAtomicInt quitLockRef;
+ void ref();
+ void deref();
+
static QThread *theMainThread;
static QThread *mainThread();
static bool checkInstance(const char *method);
static void sendPostedEvents(QObject *receiver, int event_type, QThreadData *data);
-#if !defined (QT_NO_DEBUG) || defined (QT_MAC_FRAMEWORK_BUILD) || defined (Q_OS_SYMBIAN)
+#if !defined (QT_NO_DEBUG) || defined (QT_MAC_FRAMEWORK_BUILD)
void checkReceiverThread(QObject *receiver);
#endif
int &argc;
@@ -124,13 +118,6 @@ public:
bool threadData_clean;
QString cachedApplicationDirPath;
QString cachedApplicationFilePath;
-#if defined(Q_OS_SYMBIAN)
-# if !defined(QT_NO_SYSTEMLOCALE)
- QScopedPointer<QEnvironmentChangeNotifier> environmentChangeNotifier;
- void symbianInit();
-# endif
- static CApaCommandLine* symbianCommandLine();
-#endif
static bool isTranslatorInstalled(QTranslator *translator);
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 3cba628a41..9a45f28f16 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -42,13 +42,13 @@
#include "qcoreapplication.h"
#include "qcoreapplication_p.h"
#include "qstringlist.h"
-#include "qt_windows.h"
#include "qvector.h"
#include "qmutex.h"
#include "qfileinfo.h"
#include "qcorecmdlineargs_p.h"
#include <private/qthread_p.h>
#include <ctype.h>
+#include <qt_windows.h>
QT_BEGIN_NAMESPACE
@@ -161,6 +161,10 @@ Q_CORE_EXPORT void qWinMsgHandler(QtMsgType t, const char* str)
staticCriticalSection.unlock();
}
+Q_CORE_EXPORT void qWinMessageHandler(QtMsgType t, const QMessageLogContext &, const char* str)
+{
+ qWinMsgHandler(t, str);
+}
/*****************************************************************************
qWinMain() - Initializes Windows. Called from WinMain() in qtmain_win.cpp
diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h
index 937c9898cd..151818b005 100644
--- a/src/corelib/kernel/qcorecmdlineargs_p.h
+++ b/src/corelib/kernel/qcorecmdlineargs_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,13 +58,11 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN)
+#ifdef Q_OS_WIN
QT_BEGIN_INCLUDE_NAMESPACE
-#include "QtCore/qvector.h"
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
-# include "qt_windows.h"
-#endif
+# include "QtCore/qvector.h"
+# include <qt_windows.h>
QT_END_INCLUDE_NAMESPACE
// template implementation of the parsing algorithm
@@ -132,7 +130,6 @@ static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc)
return argv;
}
-#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
static inline QStringList qWinCmdArgs(QString cmdLine) // not const-ref: this might be modified
{
QStringList args;
@@ -153,8 +150,8 @@ static inline QStringList qCmdLineArgs(int argc, char *argv[])
QString cmdLine = QString::fromWCharArray(GetCommandLine());
return qWinCmdArgs(cmdLine);
}
-#endif
-#else // !Q_OS_WIN || !Q_OS_SYMBIAN
+
+#else // !Q_OS_WIN
static inline QStringList qCmdLineArgs(int argc, char *argv[])
{
@@ -164,7 +161,7 @@ static inline QStringList qCmdLineArgs(int argc, char *argv[])
return args;
}
-#endif // Q_OS_WIN || Q_OS_SYMBIAN
+#endif // Q_OS_WIN
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp
index bf8207283b..9ed696539a 100644
--- a/src/corelib/kernel/qcoreevent.cpp
+++ b/src/corelib/kernel/qcoreevent.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h
index cbdf13c992..8910763daf 100644
--- a/src/corelib/kernel/qcoreevent.h
+++ b/src/corelib/kernel/qcoreevent.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QEventPrivate;
class Q_CORE_EXPORT QEvent // event base class
diff --git a/src/corelib/kernel/qcoreglobaldata.cpp b/src/corelib/kernel/qcoreglobaldata.cpp
index 3854f7d53a..d8ffcaae48 100644
--- a/src/corelib/kernel/qcoreglobaldata.cpp
+++ b/src/corelib/kernel/qcoreglobaldata.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qcoreglobaldata_p.h b/src/corelib/kernel/qcoreglobaldata_p.h
index 7b5120a0dc..50f619acf5 100644
--- a/src/corelib/kernel/qcoreglobaldata_p.h
+++ b/src/corelib/kernel/qcoreglobaldata_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qcrashhandler.cpp b/src/corelib/kernel/qcrashhandler.cpp
index 8f4577be24..1941300a28 100644
--- a/src/corelib/kernel/qcrashhandler.cpp
+++ b/src/corelib/kernel/qcrashhandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qcrashhandler_p.h b/src/corelib/kernel/qcrashhandler_p.h
index a23dc98967..2d292f8a19 100644
--- a/src/corelib/kernel/qcrashhandler_p.h
+++ b/src/corelib/kernel/qcrashhandler_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qeventdispatcher_glib.cpp b/src/corelib/kernel/qeventdispatcher_glib.cpp
index f34570007b..4adcb7678c 100644
--- a/src/corelib/kernel/qeventdispatcher_glib.cpp
+++ b/src/corelib/kernel/qeventdispatcher_glib.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qeventdispatcher_glib_p.h b/src/corelib/kernel/qeventdispatcher_glib_p.h
index facacb07a8..7bd40564b9 100644
--- a/src/corelib/kernel/qeventdispatcher_glib_p.h
+++ b/src/corelib/kernel/qeventdispatcher_glib_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 26a9e9f0ca..d5805112e9 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qeventdispatcher_unix_p.h b/src/corelib/kernel/qeventdispatcher_unix_p.h
index f4862bd9c3..e618853e09 100644
--- a/src/corelib/kernel/qeventdispatcher_unix_p.h
+++ b/src/corelib/kernel/qeventdispatcher_unix_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 3ade11ca60..768fde682b 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -408,7 +408,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
const int localSerialNumber = d->serialNumber.load();
if (localSerialNumber != d->lastSerialNumber) {
d->lastSerialNumber = localSerialNumber;
- QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
+ q->sendPostedEvents();
}
return 0;
} else if (message == WM_TIMER) {
@@ -761,7 +761,7 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
if (!seenWM_QT_SENDPOSTEDEVENTS && (flags & QEventLoop::EventLoopExec) == 0) {
// when called "manually", always send posted events
- QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
+ sendPostedEvents();
}
if (needWM_QT_SENDPOSTEDEVENTS)
@@ -1076,4 +1076,10 @@ bool QEventDispatcherWin32::event(QEvent *e)
return QAbstractEventDispatcher::event(e);
}
+void QEventDispatcherWin32::sendPostedEvents()
+{
+ Q_D(QEventDispatcherWin32);
+ QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h
index 833fcf13ac..c404967e6a 100644
--- a/src/corelib/kernel/qeventdispatcher_win_p.h
+++ b/src/corelib/kernel/qeventdispatcher_win_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -104,6 +104,7 @@ public:
protected:
QEventDispatcherWin32(QEventDispatcherWin32Private &dd, QObject *parent = 0);
+ virtual void sendPostedEvents();
private:
friend LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPARAM lp);
diff --git a/src/corelib/kernel/qeventloop.cpp b/src/corelib/kernel/qeventloop.cpp
index 05e284ba34..8b0ec85679 100644
--- a/src/corelib/kernel/qeventloop.cpp
+++ b/src/corelib/kernel/qeventloop.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,24 +43,15 @@
#include "qabstracteventdispatcher.h"
#include "qcoreapplication.h"
+#include "qcoreapplication_p.h"
#include "qelapsedtimer.h"
#include "qobject_p.h"
+#include "qeventloop_p.h"
#include <private/qthread_p.h>
QT_BEGIN_NAMESPACE
-class QEventLoopPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QEventLoop)
-public:
- inline QEventLoopPrivate()
- : exit(true), inExec(false), returnCode(-1)
- { }
- bool exit, inExec;
- int returnCode;
-};
-
/*!
\class QEventLoop
\brief The QEventLoop class provides a means of entering and leaving an event loop.
@@ -96,11 +87,8 @@ public:
available.
\omitvalue X11ExcludeTimers
- \omitvalue ExcludeUserInput
- \omitvalue WaitForMore
\omitvalue EventLoopExec
\omitvalue DialogExec
- \value DeferredDeletion deprecated - do not use.
\sa processEvents()
*/
@@ -144,8 +132,6 @@ bool QEventLoop::processEvents(ProcessEventsFlags flags)
Q_D(QEventLoop);
if (!d->threadData->eventDispatcher)
return false;
- if (flags & DeferredDeletion)
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
return d->threadData->eventDispatcher->processEvents(flags);
}
@@ -252,13 +238,9 @@ void QEventLoop::processEvents(ProcessEventsFlags flags, int maxTime)
QElapsedTimer start;
start.start();
- if (flags & DeferredDeletion)
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
while (processEvents(flags & ~WaitForMoreEvents)) {
if (start.elapsed() > maxTime)
break;
- if (flags & DeferredDeletion)
- QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete);
}
}
@@ -314,6 +296,17 @@ void QEventLoop::wakeUp()
d->threadData->eventDispatcher->wakeUp();
}
+
+bool QEventLoop::event(QEvent *event)
+{
+ if (event->type() == QEvent::Quit) {
+ quit();
+ return true;
+ } else {
+ return QObject::event(event);
+ }
+}
+
/*!
Tells the event loop to exit normally.
@@ -324,4 +317,85 @@ void QEventLoop::wakeUp()
void QEventLoop::quit()
{ exit(0); }
+
+class QEventLoopLockerPrivate
+{
+public:
+ explicit QEventLoopLockerPrivate(QEventLoopPrivate *loop)
+ : loop(loop), app(0)
+ {
+ loop->ref();
+ }
+
+ explicit QEventLoopLockerPrivate(QCoreApplicationPrivate *app)
+ : loop(0), app(app)
+ {
+ app->ref();
+ }
+
+ ~QEventLoopLockerPrivate()
+ {
+ if (loop)
+ loop->deref();
+ else
+ app->deref();
+ }
+
+private:
+ QEventLoopPrivate *loop;
+ QCoreApplicationPrivate *app;
+};
+
+/*!
+ \class QEventLoopLocker
+ \brief The QEventLoopLocker class provides a means to quit an event loop when it is no longer needed.
+
+ The QEventLoopLocker operates on particular objects - either a QCoreApplication
+ instance or a QEventLoop instance.
+
+ This makes it possible to, for example, run a batch of jobs with an event loop
+ and exit that event loop after the last job is finished. That is accomplished
+ by keeping a QEventLoopLocker with each job instance.
+
+ The variant which operates on QCoreApplication makes it possible to finish
+ asynchronously running jobs after the last gui window has been closed. This
+ can be useful for example for running a job which uploads data to a network.
+
+ \sa QEventLoop, QCoreApplication
+*/
+
+/*!
+ Creates an event locker operating on the \p app.
+
+ The application will quit when there are no more QEventLoopLockers operating on it.
+
+ \sa QCoreApplication::quit(), QCoreApplication::isQuitLockEnabled()
+ */
+QEventLoopLocker::QEventLoopLocker()
+ : d_ptr(new QEventLoopLockerPrivate(static_cast<QCoreApplicationPrivate*>(QObjectPrivate::get(QCoreApplication::instance()))))
+{
+
+}
+
+/*!
+ Creates an event locker operating on the \p app.
+
+ This particular QEventLoop will quit when there are no more QEventLoopLockers operating on it.
+
+ \sa QEventLoop::quit()
+ */
+QEventLoopLocker::QEventLoopLocker(QEventLoop *loop)
+ : d_ptr(new QEventLoopLockerPrivate(static_cast<QEventLoopPrivate*>(QObjectPrivate::get(loop))))
+{
+
+}
+
+/*!
+ Destroys this event loop locker object
+ */
+QEventLoopLocker::~QEventLoopLocker()
+{
+ delete d_ptr;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qeventloop.h b/src/corelib/kernel/qeventloop.h
index a76ba0ad93..0e7195d6a7 100644
--- a/src/corelib/kernel/qeventloop.h
+++ b/src/corelib/kernel/qeventloop.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QEventLoopPrivate;
@@ -66,12 +65,9 @@ public:
ExcludeUserInputEvents = 0x01,
ExcludeSocketNotifiers = 0x02,
WaitForMoreEvents = 0x04,
- X11ExcludeTimers = 0x08
-#ifdef QT_DEPRECATED
- , DeferredDeletion = 0x10
-#endif
- , EventLoopExec = 0x20
- , DialogExec = 0x40
+ X11ExcludeTimers = 0x08,
+ EventLoopExec = 0x20,
+ DialogExec = 0x40
};
Q_DECLARE_FLAGS(ProcessEventsFlags, ProcessEventsFlag)
@@ -84,12 +80,29 @@ public:
void wakeUp();
+ bool event(QEvent *event);
+
public Q_SLOTS:
void quit();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QEventLoop::ProcessEventsFlags)
+
+class QEventLoopLockerPrivate;
+
+class Q_CORE_EXPORT QEventLoopLocker
+{
+public:
+ QEventLoopLocker();
+ explicit QEventLoopLocker(QEventLoop *loop);
+ ~QEventLoopLocker();
+
+private:
+ Q_DISABLE_COPY(QEventLoopLocker)
+ QEventLoopLockerPrivate *d_ptr;
+};
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/kernel/qeventloop_p.h b/src/corelib/kernel/qeventloop_p.h
new file mode 100644
index 0000000000..5770ed0076
--- /dev/null
+++ b/src/corelib/kernel/qeventloop_p.h
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** 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.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QEVENTLOOP_P_H
+#define QEVENTLOOP_P_H
+
+#include "qobject_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Core)
+
+class QEventLoopPrivate : public QObjectPrivate
+{
+ Q_DECLARE_PUBLIC(QEventLoop)
+public:
+ inline QEventLoopPrivate()
+ : exit(true), inExec(false), returnCode(-1)
+ { }
+
+ QAtomicInt quitLockRef;
+
+ bool exit, inExec;
+ int returnCode;
+
+ void ref()
+ {
+ quitLockRef.ref();
+ }
+
+ void deref()
+ {
+ if (!quitLockRef.deref() && inExec) {
+ qApp->postEvent(q_ptr, new QEvent(QEvent::Quit));
+ }
+ }
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QEVENTLOOP_P_H
diff --git a/src/corelib/kernel/qfunctions_nacl.cpp b/src/corelib/kernel/qfunctions_nacl.cpp
index 76272154b3..c4aad29142 100644
--- a/src/corelib/kernel/qfunctions_nacl.cpp
+++ b/src/corelib/kernel/qfunctions_nacl.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qfunctions_nacl.h b/src/corelib/kernel/qfunctions_nacl.h
index a2f5d928f0..955a32c5d1 100644
--- a/src/corelib/kernel/qfunctions_nacl.h
+++ b/src/corelib/kernel/qfunctions_nacl.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,7 +56,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
extern "C" {
diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h
index 88686e976a..52d617c732 100644
--- a/src/corelib/kernel/qfunctions_p.h
+++ b/src/corelib/kernel/qfunctions_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qfunctions_vxworks.cpp b/src/corelib/kernel/qfunctions_vxworks.cpp
index c39e6ad458..6d519cf0dd 100644
--- a/src/corelib/kernel/qfunctions_vxworks.cpp
+++ b/src/corelib/kernel/qfunctions_vxworks.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qfunctions_vxworks.h b/src/corelib/kernel/qfunctions_vxworks.h
index 22dc7bcc06..6a29573e66 100644
--- a/src/corelib/kernel/qfunctions_vxworks.h
+++ b/src/corelib/kernel/qfunctions_vxworks.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -65,7 +65,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#ifdef QT_BUILD_CORE_LIB
-QT_MODULE(Core)
#endif
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qfunctions_wince.cpp b/src/corelib/kernel/qfunctions_wince.cpp
index 8fd09679ce..9b9c3553d6 100644
--- a/src/corelib/kernel/qfunctions_wince.cpp
+++ b/src/corelib/kernel/qfunctions_wince.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qfunctions_wince.h b/src/corelib/kernel/qfunctions_wince.h
index d634cba67e..f83dad0dde 100644
--- a/src/corelib/kernel/qfunctions_wince.h
+++ b/src/corelib/kernel/qfunctions_wince.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,7 +60,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#ifdef QT_BUILD_CORE_LIB
-QT_MODULE(Core)
#endif
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qmath.cpp b/src/corelib/kernel/qmath.cpp
index fb5087092c..5c9e2fbba3 100644
--- a/src/corelib/kernel/qmath.cpp
+++ b/src/corelib/kernel/qmath.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h
index 793138a5e0..309564b0f8 100644
--- a/src/corelib/kernel/qmath.h
+++ b/src/corelib/kernel/qmath.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,15 +46,10 @@
#include <QtCore/qglobal.h>
-#ifdef Q_OS_SYMBIAN
-# include <e32math.h>
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#define QT_SINE_TABLE_SIZE 256
@@ -92,130 +87,82 @@ inline qreal qFabs(qreal v)
inline qreal qSin(qreal v)
{
-#ifdef Q_OS_SYMBIAN
- TReal sin_v;
- Math::Sin(sin_v, static_cast<TReal>(v));
- return static_cast<qreal>(sin_v);
-#else
-# ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return sinf(float(v));
- else
-# endif
- return sin(v);
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return sinf(float(v));
+ else
#endif
+ return sin(v);
}
inline qreal qCos(qreal v)
{
-#ifdef Q_OS_SYMBIAN
- TReal cos_v;
- Math::Cos(cos_v, static_cast<TReal>(v));
- return static_cast<qreal>(cos_v);
-#else
-# ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return cosf(float(v));
- else
-# endif
- return cos(v);
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return cosf(float(v));
+ else
#endif
+ return cos(v);
}
inline qreal qTan(qreal v)
{
-#ifdef Q_OS_SYMBIAN
- TReal tan_v;
- Math::Tan(tan_v, static_cast<TReal>(v));
- return static_cast<qreal>(tan_v);
-#else
-# ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return tanf(float(v));
- else
-# endif
- return tan(v);
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return tanf(float(v));
+ else
#endif
+ return tan(v);
}
inline qreal qAcos(qreal v)
{
-#ifdef Q_OS_SYMBIAN
- TReal acos_v;
- Math::ACos(acos_v, static_cast<TReal>(v));
- return static_cast<qreal>(acos_v);
-#else
-# ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return acosf(float(v));
- else
-# endif
- return acos(v);
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return acosf(float(v));
+ else
#endif
+ return acos(v);
}
inline qreal qAsin(qreal v)
{
-#ifdef Q_OS_SYMBIAN
- TReal asin_v;
- Math::ASin(asin_v, static_cast<TReal>(v));
- return static_cast<qreal>(asin_v);
-#else
-# ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return asinf(float(v));
- else
-# endif
- return asin(v);
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return asinf(float(v));
+ else
#endif
+ return asin(v);
}
inline qreal qAtan(qreal v)
{
-#ifdef Q_OS_SYMBIAN
- TReal atan_v;
- Math::ATan(atan_v, static_cast<TReal>(v));
- return static_cast<qreal>(atan_v);
-#else
-# ifdef QT_USE_MATH_H_FLOATS
- if(sizeof(qreal) == sizeof(float))
- return atanf(float(v));
- else
-# endif
- return atan(v);
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return atanf(float(v));
+ else
#endif
+ return atan(v);
}
inline qreal qAtan2(qreal x, qreal y)
{
-#ifdef Q_OS_SYMBIAN
- TReal atan2_v;
- Math::ATan(atan2_v, static_cast<TReal>(x), static_cast<TReal>(y));
- return static_cast<qreal>(atan2_v);
-#else
-# ifdef QT_USE_MATH_H_FLOATS
- if(sizeof(qreal) == sizeof(float))
- return atan2f(float(x), float(y));
- else
-# endif
- return atan2(x, y);
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return atan2f(float(x), float(y));
+ else
#endif
+ return atan2(x, y);
}
inline qreal qSqrt(qreal v)
{
-#ifdef Q_OS_SYMBIAN
- TReal sqrt_v;
- Math::Sqrt(sqrt_v, static_cast<TReal>(v));
- return static_cast<qreal>(sqrt_v);
-#else
-# ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return sqrtf(float(v));
- else
-# endif
- return sqrt(v);
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return sqrtf(float(v));
+ else
#endif
+ return sqrt(v);
}
inline qreal qLn(qreal v)
@@ -230,31 +177,19 @@ inline qreal qLn(qreal v)
inline qreal qExp(qreal v)
{
-#ifdef Q_OS_SYMBIAN
- TReal exp_v;
- Math::Exp(exp_v, static_cast<TReal>(v));
- return static_cast<qreal>(exp_v);
-#else
// only one signature
// exists, exp(double)
return exp(v);
-#endif
}
inline qreal qPow(qreal x, qreal y)
{
-#ifdef Q_OS_SYMBIAN
- TReal pow_v;
- Math::Pow(pow_v, static_cast<TReal>(x), static_cast<TReal>(y));
- return static_cast<qreal>(pow_v);
-#else
-# ifdef QT_USE_MATH_H_FLOATS
- if (sizeof(qreal) == sizeof(float))
- return powf(float(x), float(y));
- else
-# endif
- return pow(x, y);
+#ifdef QT_USE_MATH_H_FLOATS
+ if (sizeof(qreal) == sizeof(float))
+ return powf(float(x), float(y));
+ else
#endif
+ return pow(x, y);
}
#ifndef M_PI
diff --git a/src/corelib/kernel/qmath.qdoc b/src/corelib/kernel/qmath.qdoc
index b2de54ee32..fcc51764b0 100644
--- a/src/corelib/kernel/qmath.qdoc
+++ b/src/corelib/kernel/qmath.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index d7cbab8e3a..400fe54c7f 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -2105,8 +2105,6 @@ QVariant::Type QMetaProperty::type() const
uint flags = mobj->d.data[handle + 2];
uint type = flags >> 24;
- if (type == 0xff) // special value for QVariant
- type = QVariant::LastType;
if (type)
return QVariant::Type(type);
if (isEnumType()) {
@@ -2241,8 +2239,6 @@ QVariant QMetaProperty::read(const QObject *object) const
uint flags = mobj->d.data[handle + 2];
const char *typeName = mobj->d.stringdata + mobj->d.data[handle + 1];
t = (flags >> 24);
- if (t == 0xff) // special value for QVariant
- t = QVariant::LastType;
if (t == QVariant::Invalid)
t = QMetaType::type(typeName);
if (t == QVariant::Invalid)
@@ -2262,7 +2258,7 @@ QVariant QMetaProperty::read(const QObject *object) const
int status = -1;
QVariant value;
void *argv[] = { 0, &value, &status };
- if (t == QVariant::LastType) {
+ if (t == QMetaType::QVariant) {
argv[0] = &value;
} else {
value = QVariant(t, (void*)0);
@@ -2273,7 +2269,7 @@ QVariant QMetaProperty::read(const QObject *object) const
if (status != -1)
return value;
- if (t != QVariant::LastType && argv[0] != value.data())
+ if (t != QMetaType::QVariant && argv[0] != value.data())
// pointer or reference
return QVariant((QVariant::Type)t, argv[0]);
return value;
@@ -2312,8 +2308,6 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
int handle = priv(mobj->d.data)->propertyData + 3*idx;
uint flags = mobj->d.data[handle + 2];
t = flags >> 24;
- if (t == 0xff) // special value for QVariant
- t = QVariant::LastType;
if (t == QVariant::Invalid) {
const char *typeName = mobj->d.stringdata + mobj->d.data[handle + 1];
const char *vtypeName = value.typeName();
@@ -2324,7 +2318,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
}
if (t == QVariant::Invalid)
return false;
- if (t != QVariant::LastType && t != (uint)value.userType() && (t < QMetaType::User && !v.convert((QVariant::Type)t)))
+ if (t != QMetaType::QVariant && t != (uint)value.userType() && (t < QMetaType::User && !v.convert((QVariant::Type)t)))
return false;
}
@@ -2338,7 +2332,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
// interception of property writes.
int flags = 0;
void *argv[] = { 0, &v, &status, &flags };
- if (t == QVariant::LastType)
+ if (t == QMetaType::QVariant)
argv[0] = &v;
else
argv[0] = v.data();
diff --git a/src/corelib/kernel/qmetaobject.h b/src/corelib/kernel/qmetaobject.h
index 61ca373745..650369164c 100644
--- a/src/corelib/kernel/qmetaobject.h
+++ b/src/corelib/kernel/qmetaobject.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
template <typename T> class QList;
diff --git a/src/corelib/kernel/qmetaobject_moc_p.h b/src/corelib/kernel/qmetaobject_moc_p.h
index abfdc442c0..06a5b64978 100644
--- a/src/corelib/kernel/qmetaobject_moc_p.h
+++ b/src/corelib/kernel/qmetaobject_moc_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qmetaobject_p.h b/src/corelib/kernel/qmetaobject_p.h
index 45fb95495c..5fc0555fb5 100644
--- a/src/corelib/kernel/qmetaobject_p.h
+++ b/src/corelib/kernel/qmetaobject_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -109,6 +109,8 @@ class QMutex;
struct QMetaObjectPrivate
{
+ enum { OutputRevision = 6 }; // Used by moc and qmetaobjectbuilder
+
int revision;
int className;
int classInfoCount, classInfoData;
diff --git a/src/corelib/kernel/qmetaobjectbuilder.cpp b/src/corelib/kernel/qmetaobjectbuilder.cpp
index 601d52529f..529ca22107 100644
--- a/src/corelib/kernel/qmetaobjectbuilder.cpp
+++ b/src/corelib/kernel/qmetaobjectbuilder.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,12 +34,18 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qmetaobjectbuilder_p.h"
+#include "qobject_p.h"
+#include "qmetaobject_p.h"
+
+#include <stdlib.h>
+
QT_BEGIN_NAMESPACE
/*!
@@ -78,17 +83,6 @@ uint qvariant_nameToType(const char* name)
if (!name)
return 0;
- if (strcmp(name, "QVariant") == 0)
- return 0xffffffff;
- if (strcmp(name, "QCString") == 0)
- return QMetaType::QByteArray;
- if (strcmp(name, "Q_LLONG") == 0)
- return QMetaType::LongLong;
- if (strcmp(name, "Q_ULLONG") == 0)
- return QMetaType::ULongLong;
- if (strcmp(name, "QIconSet") == 0)
- return QMetaType::QIcon;
-
uint tp = QMetaType::type(name);
return tp < QMetaType::User ? tp : 0;
}
@@ -101,63 +95,6 @@ bool isVariantType(const char* type)
return qvariant_nameToType(type) != 0;
}
-// copied from qmetaobject_p.h
-// do not touch without touching the moc as well
-enum PropertyFlags {
- Invalid = 0x00000000,
- Readable = 0x00000001,
- Writable = 0x00000002,
- Resettable = 0x00000004,
- EnumOrFlag = 0x00000008,
- StdCppSet = 0x00000100,
-// Override = 0x00000200,
- Constant = 0x00000400,
- Final = 0x00000800,
- Designable = 0x00001000,
- ResolveDesignable = 0x00002000,
- Scriptable = 0x00004000,
- ResolveScriptable = 0x00008000,
- Stored = 0x00010000,
- ResolveStored = 0x00020000,
- Editable = 0x00040000,
- ResolveEditable = 0x00080000,
- User = 0x00100000,
- ResolveUser = 0x00200000,
- Notify = 0x00400000,
- Revisioned = 0x00800000
-};
-
-enum MethodFlags {
- AccessPrivate = 0x00,
- AccessProtected = 0x01,
- AccessPublic = 0x02,
- AccessMask = 0x03, //mask
-
- MethodMethod = 0x00,
- MethodSignal = 0x04,
- MethodSlot = 0x08,
- MethodConstructor = 0x0c,
- MethodTypeMask = 0x0c,
-
- MethodCompatibility = 0x10,
- MethodCloned = 0x20,
- MethodScriptable = 0x40,
- MethodRevisioned = 0x80
-};
-
-struct QMetaObjectPrivate
-{
- int revision;
- int className;
- int classInfoCount, classInfoData;
- int methodCount, methodData;
- int propertyCount, propertyData;
- int enumeratorCount, enumeratorData;
- int constructorCount, constructorData;
- int flags;
- int signalCount;
-};
-
static inline const QMetaObjectPrivate *priv(const uint* data)
{ return reinterpret_cast<const QMetaObjectPrivate*>(data); }
// end of copied lines from qmetaobject.cpp
@@ -1199,7 +1136,8 @@ static int buildMetaObject(QMetaObjectBuilderPrivate *d, char *buf,
}
}
if (buf) {
- pmeta->revision = 4;
+ Q_STATIC_ASSERT_X(QMetaObjectPrivate::OutputRevision == 6, "QMetaObjectBuilder should generate the same version as moc");
+ pmeta->revision = QMetaObjectPrivate::OutputRevision;
pmeta->flags = d->flags;
pmeta->className = 0; // Class name is always the first string.
//pmeta->signalCount is handled in the "output method loop" as an optimization.
diff --git a/src/corelib/kernel/qmetaobjectbuilder_p.h b/src/corelib/kernel/qmetaobjectbuilder_p.h
index bf3fd2499c..17b7af0c77 100644
--- a/src/corelib/kernel/qmetaobjectbuilder_p.h
+++ b/src/corelib/kernel/qmetaobjectbuilder_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index 375c7b75bb..50b11e0e98 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -79,40 +79,40 @@ QT_BEGIN_NAMESPACE
namespace {
template<typename T>
-struct TypeDefiniton {
+struct TypeDefinition {
static const bool IsAvailable = true;
};
struct DefinedTypesFilter {
template<typename T>
struct Acceptor {
- static const bool IsAccepted = TypeDefiniton<T>::IsAvailable && QTypeModuleInfo<T>::IsCore;
+ static const bool IsAccepted = TypeDefinition<T>::IsAvailable && QTypeModuleInfo<T>::IsCore;
};
};
// Ignore these types, as incomplete
#ifdef QT_NO_GEOM_VARIANT
-template<> struct TypeDefiniton<QRect> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QRectF> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QSize> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QSizeF> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QLine> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QLineF> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QPoint> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QPointF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QRect> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QRectF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QSize> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QSizeF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QLine> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QLineF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QPoint> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QPointF> { static const bool IsAvailable = false; };
#endif
#ifdef QT_BOOTSTRAPPED
-template<> struct TypeDefiniton<QVariantMap> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QVariantHash> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QVariantList> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QVariant> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QBitArray> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QUrl> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QEasingCurve> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QModelIndex> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QVariantMap> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QVariantHash> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QVariantList> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QVariant> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QBitArray> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QUrl> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QEasingCurve> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QModelIndex> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_REGEXP
-template<> struct TypeDefiniton<QRegExp> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QRegExp> { static const bool IsAvailable = false; };
#endif
} // namespace
@@ -228,14 +228,13 @@ template<> struct TypeDefiniton<QRegExp> { static const bool IsAvailable = false
\value User Base value for user types
- \omitvalue FirstCoreExtType
\omitvalue FirstGuiType
\omitvalue FirstWidgetsType
- \omitvalue LastCoreExtType
\omitvalue LastCoreType
\omitvalue LastGuiType
\omitvalue LastWidgetsType
\omitvalue QReal
+ \omitvalue HighestInternalId
Additional types can be registered using Q_DECLARE_METATYPE().
@@ -362,10 +361,10 @@ const char *QMetaType::typeName(int type)
// In theory it can be filled during compilation time, but for some reason template code
// that is able to do it causes GCC 4.6 to generate additional 3K of executable code. Probably
// it is not worth of it.
- static const char *namesCache[QMetaType::LastCoreExtType + 1];
+ static const char *namesCache[QMetaType::HighestInternalId + 1];
const char *result;
- if (type <= QMetaType::LastCoreExtType && ((result = namesCache[type])))
+ if (type <= QMetaType::HighestInternalId && ((result = namesCache[type])))
return result;
#define QT_METATYPE_TYPEID_TYPENAME_CONVERTER(MetaTypeName, TypeId, RealName) \
@@ -388,7 +387,7 @@ const char *QMetaType::typeName(int type)
}
#undef QT_METATYPE_TYPEID_TYPENAME_CONVERTER
- Q_ASSERT(type <= QMetaType::LastCoreExtType);
+ Q_ASSERT(type <= QMetaType::HighestInternalId);
namesCache[type] = result;
return result;
}
@@ -634,6 +633,7 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data)
case QMetaType::VoidStar:
case QMetaType::QObjectStar:
case QMetaType::QWidgetStar:
+ case QMetaType::QModelIndex:
return false;
case QMetaType::Long:
stream << qlonglong(*static_cast<const long *>(data));
@@ -838,6 +838,7 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
case QMetaType::VoidStar:
case QMetaType::QObjectStar:
case QMetaType::QWidgetStar:
+ case QMetaType::QModelIndex:
return false;
case QMetaType::Long: {
qlonglong l;
@@ -1262,6 +1263,60 @@ void *QMetaType::create(int type, const void *copy)
return creator(copy);
}
+namespace {
+class TypeDestroyer {
+ template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
+ struct DestroyerImpl {
+ static void Destroy(const int /* type */, T *where) { delete where; }
+ };
+ template<typename T>
+ struct DestroyerImpl<T, /* IsAcceptedType = */ false> {
+ static void Destroy(const int type, void *where)
+ {
+ if (QTypeModuleInfo<T>::IsGui) {
+ if (qMetaTypeGuiHelper)
+ qMetaTypeGuiHelper[type - QMetaType::FirstGuiType].deleter(where);
+ return;
+ }
+ if (QTypeModuleInfo<T>::IsWidget) {
+ if (qMetaTypeWidgetsHelper)
+ qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].deleter(where);
+ return;
+ }
+ // This point can be reached only for known types that definition is not available, for example
+ // in bootstrap mode. We have no other choice then ignore it.
+ }
+ };
+public:
+ TypeDestroyer(const int type)
+ : m_type(type)
+ {}
+
+ template<typename T>
+ void delegate(const T *where) { DestroyerImpl<T>::Destroy(m_type, const_cast<T*>(where)); }
+ void delegate(const void *) {}
+ void delegate(const QMetaTypeSwitcher::UnknownType *where) { customTypeDestroyer(m_type, (void*)where); }
+
+private:
+ static void customTypeDestroyer(const int type, void *where)
+ {
+ QMetaType::Destructor deleter;
+ const QVector<QCustomTypeInfo> * const ct = customTypes();
+ {
+ QReadLocker locker(customTypesLock());
+ if (Q_UNLIKELY(type < QMetaType::User || !ct || ct->count() <= type - QMetaType::User))
+ return;
+ deleter = ct->at(type - QMetaType::User).deleter;
+ }
+ if (Q_LIKELY(deleter))
+ deleter(where);
+ }
+
+ const int m_type;
+};
+} // namespace
+
+
/*!
Destroys the \a data, assuming it is of the \a type given.
@@ -1269,173 +1324,8 @@ void *QMetaType::create(int type, const void *copy)
*/
void QMetaType::destroy(int type, void *data)
{
- if (!data)
- return;
- switch(type) {
- case QMetaType::VoidStar:
- case QMetaType::QObjectStar:
- case QMetaType::QWidgetStar:
- delete static_cast<void**>(data);
- break;
- case QMetaType::Long:
- delete static_cast<long*>(data);
- break;
- case QMetaType::Int:
- delete static_cast<int*>(data);
- break;
- case QMetaType::Short:
- delete static_cast<short*>(data);
- break;
- case QMetaType::Char:
- delete static_cast<char*>(data);
- break;
- case QMetaType::ULong:
- delete static_cast<ulong*>(data);
- break;
- case QMetaType::LongLong:
- delete static_cast<qlonglong*>(data);
- break;
- case QMetaType::ULongLong:
- delete static_cast<qulonglong*>(data);
- break;
- case QMetaType::UInt:
- delete static_cast<uint*>(data);
- break;
- case QMetaType::UShort:
- delete static_cast<ushort*>(data);
- break;
- case QMetaType::UChar:
- delete static_cast<uchar*>(data);
- break;
- case QMetaType::Bool:
- delete static_cast<bool*>(data);
- break;
- case QMetaType::Float:
- delete static_cast<float*>(data);
- break;
- case QMetaType::Double:
- delete static_cast<double*>(data);
- break;
- case QMetaType::QChar:
- delete static_cast< NS(QChar)* >(data);
- break;
-#ifndef QT_BOOTSTRAPPED
- case QMetaType::QVariantMap:
- delete static_cast< NS(QVariantMap)* >(data);
- break;
- case QMetaType::QVariantHash:
- delete static_cast< NS(QVariantHash)* >(data);
- break;
- case QMetaType::QVariantList:
- delete static_cast< NS(QVariantList)* >(data);
- break;
- case QMetaType::QVariant:
- delete static_cast< NS(QVariant)* >(data);
- break;
-#endif
- case QMetaType::QByteArray:
- delete static_cast< NS(QByteArray)* >(data);
- break;
- case QMetaType::QString:
- delete static_cast< NS(QString)* >(data);
- break;
- case QMetaType::QStringList:
- delete static_cast< NS(QStringList)* >(data);
- break;
-#ifndef QT_BOOTSTRAPPED
- case QMetaType::QBitArray:
- delete static_cast< NS(QBitArray)* >(data);
- break;
-#endif
- case QMetaType::QDate:
- delete static_cast< NS(QDate)* >(data);
- break;
- case QMetaType::QTime:
- delete static_cast< NS(QTime)* >(data);
- break;
- case QMetaType::QDateTime:
- delete static_cast< NS(QDateTime)* >(data);
- break;
-#ifndef QT_BOOTSTRAPPED
- case QMetaType::QUrl:
- delete static_cast< NS(QUrl)* >(data);
-#endif
- break;
- case QMetaType::QLocale:
- delete static_cast< NS(QLocale)* >(data);
- break;
-#ifndef QT_NO_GEOM_VARIANT
- case QMetaType::QRect:
- delete static_cast< NS(QRect)* >(data);
- break;
- case QMetaType::QRectF:
- delete static_cast< NS(QRectF)* >(data);
- break;
- case QMetaType::QSize:
- delete static_cast< NS(QSize)* >(data);
- break;
- case QMetaType::QSizeF:
- delete static_cast< NS(QSizeF)* >(data);
- break;
- case QMetaType::QLine:
- delete static_cast< NS(QLine)* >(data);
- break;
- case QMetaType::QLineF:
- delete static_cast< NS(QLineF)* >(data);
- break;
- case QMetaType::QPoint:
- delete static_cast< NS(QPoint)* >(data);
- break;
- case QMetaType::QPointF:
- delete static_cast< NS(QPointF)* >(data);
- break;
-#endif
-#ifndef QT_NO_REGEXP
- case QMetaType::QRegExp:
- delete static_cast< NS(QRegExp)* >(data);
- break;
-#endif
-#ifndef QT_BOOTSTRAPPED
- case QMetaType::QEasingCurve:
- delete static_cast< NS(QEasingCurve)* >(data);
- break;
-#endif
- case QMetaType::QUuid:
- delete static_cast< NS(QUuid)* >(data);
- break;
-#ifndef QT_BOOTSTRAPPED
- case QMetaType::QModelIndex:
- delete static_cast< NS(QModelIndex)* >(data);
- break;
-#endif
- case QMetaType::Void:
- break;
- default: {
- const QVector<QCustomTypeInfo> * const ct = customTypes();
- Deleter deleter = 0;
- if (type >= FirstGuiType && type <= LastGuiType) {
- Q_ASSERT(qMetaTypeGuiHelper);
-
- if (!qMetaTypeGuiHelper)
- return;
- deleter = qMetaTypeGuiHelper[type - FirstGuiType].deleter;
- } else if (type >= FirstWidgetsType && type <= LastWidgetsType) {
- Q_ASSERT(qMetaTypeWidgetsHelper);
-
- if (!qMetaTypeWidgetsHelper)
- return;
- deleter = qMetaTypeWidgetsHelper[type - FirstWidgetsType].deleter;
- } else {
- QReadLocker locker(customTypesLock());
- if (type < User || !ct || ct->count() <= type - User)
- break;
- if (ct->at(type - User).typeName.isEmpty())
- break;
- deleter = ct->at(type - User).deleter;
- }
- deleter(data);
- break; }
- }
+ TypeDestroyer deleter(type);
+ QMetaTypeSwitcher::switcher<void>(deleter, type, data);
}
namespace {
@@ -1547,8 +1437,10 @@ class TypeDestructor {
if (!qMetaTypeWidgetsHelper)
return;
dtor = qMetaTypeWidgetsHelper[type - QMetaType::FirstWidgetsType].destructor;
- } else
+ } else {
customTypeDestructor(type, where);
+ return;
+ }
dtor(where);
}
};
@@ -1605,7 +1497,7 @@ namespace {
class SizeOf {
template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
struct SizeOfImpl {
- static int Size(const int) { return sizeof(T); }
+ static int Size(const int) { return QTypeInfo<T>::sizeOf; }
};
template<typename T>
struct SizeOfImpl<T, /* IsAcceptedType = */ false> {
@@ -1631,7 +1523,6 @@ public:
template<typename T>
int delegate(const T*) { return SizeOfImpl<T>::Size(m_type); }
- int delegate(const void*) { return 0; }
int delegate(const QMetaTypeSwitcher::UnknownType*) { return customTypeSizeOf(m_type); }
private:
static int customTypeSizeOf(const int type)
@@ -1670,11 +1561,13 @@ class Flags
template<typename T, bool IsAcceptedType = DefinedTypesFilter::Acceptor<T>::IsAccepted>
struct FlagsImpl
{
- static quint32 Flags(const int)
+ static quint32 Flags(const int type)
{
return (!QTypeInfo<T>::isStatic * QMetaType::MovableType)
| (QTypeInfo<T>::isComplex * QMetaType::NeedsConstruction)
- | (QTypeInfo<T>::isComplex * QMetaType::NeedsDestruction);
+ | (QTypeInfo<T>::isComplex * QMetaType::NeedsDestruction)
+ | (type == QMetaType::QObjectStar ? QMetaType::PointerToQObject : 0)
+ | (type == QMetaType::QWidgetStar ? QMetaType::PointerToQObject : 0);
}
};
template<typename T>
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 843044eee6..0ea9d26394 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,6 +44,7 @@
#include <QtCore/qglobal.h>
#include <QtCore/qatomic.h>
+#include <QtCore/qbytearray.h>
#include <new>
@@ -55,7 +56,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
// F is a tuple: (QMetaType::TypeName, QMetaType::TypeNameID, RealType)
#define QT_FOR_EACH_STATIC_PRIMITIVE_TYPE(F)\
@@ -66,16 +66,16 @@ QT_MODULE(Core)
F(LongLong, 4, qlonglong) \
F(ULongLong, 5, qulonglong) \
F(Double, 6, double) \
- F(Long, 129, long) \
- F(Short, 130, short) \
- F(Char, 131, char) \
- F(ULong, 132, ulong) \
- F(UShort, 133, ushort) \
- F(UChar, 134, uchar) \
- F(Float, 135, float) \
+ F(Long, 32, long) \
+ F(Short, 33, short) \
+ F(Char, 34, char) \
+ F(ULong, 35, ulong) \
+ F(UShort, 36, ushort) \
+ F(UChar, 37, uchar) \
+ F(Float, 38, float) \
#define QT_FOR_EACH_STATIC_PRIMITIVE_POINTER(F)\
- F(VoidStar, 128, void*) \
+ F(VoidStar, 31, void*) \
#define QT_FOR_EACH_STATIC_CORE_CLASS(F)\
F(QChar, 7, QChar) \
@@ -99,12 +99,12 @@ QT_MODULE(Core)
F(QRegExp, 27, QRegExp) \
F(QEasingCurve, 29, QEasingCurve) \
F(QUuid, 30, QUuid) \
- F(QModelIndex, 31, QModelIndex) \
- F(QVariant, 138, QVariant) \
+ F(QVariant, 41, QVariant) \
+ F(QModelIndex, 42, QModelIndex) \
#define QT_FOR_EACH_STATIC_CORE_POINTER(F)\
- F(QObjectStar, 136, QObject*) \
- F(QWidgetStar, 137, QWidget*) \
+ F(QObjectStar, 39, QObject*) \
+ F(QWidgetStar, 40, QWidget*) \
#define QT_FOR_EACH_STATIC_CORE_TEMPLATE(F)\
F(QVariantMap, 8, QVariantMap) \
@@ -189,13 +189,12 @@ public:
LastGuiType = QPolygonF,
FirstWidgetsType = QIcon,
LastWidgetsType = QSizePolicy,
- FirstCoreExtType = VoidStar,
- LastCoreExtType = QVariant,
+ HighestInternalId = LastWidgetsType,
// This logic must match the one in qglobal.h
#if defined(QT_COORD_TYPE)
QReal = 0,
-#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
+#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
QReal = Float,
#else
QReal = Double,
@@ -207,7 +206,8 @@ public:
enum TypeFlag {
NeedsConstruction = 0x1,
NeedsDestruction = 0x2,
- MovableType = 0x4
+ MovableType = 0x4,
+ PointerToQObject = 0x8
};
Q_DECLARE_FLAGS(TypeFlags, TypeFlag)
@@ -315,6 +315,9 @@ struct QMetaTypeId2
static inline int qt_metatype_id() { return QMetaTypeId<T>::qt_metatype_id(); }
};
+class QObject;
+class QWidget;
+
namespace QtPrivate {
template <typename T, bool Defined = QMetaTypeId2<T>::Defined>
struct QMetaTypeIdHelper {
@@ -325,6 +328,49 @@ namespace QtPrivate {
static inline int qt_metatype_id()
{ return -1; }
};
+
+ template<typename T>
+ struct IsPointerToTypeDerivedFromQObject
+ {
+ enum { Value = false };
+ };
+
+ // Specialize to avoid sizeof(void) warning
+ template<>
+ struct IsPointerToTypeDerivedFromQObject<void*>
+ {
+ enum { Value = false };
+ };
+ template<>
+ struct IsPointerToTypeDerivedFromQObject<QObject*>
+ {
+ enum { Value = true };
+ };
+ template<>
+ struct IsPointerToTypeDerivedFromQObject<QWidget*>
+ {
+ enum { Value = true };
+ };
+
+ template<typename T>
+ struct IsPointerToTypeDerivedFromQObject<T*>
+ {
+ typedef qint8 yes_type;
+ typedef qint64 no_type;
+
+#ifndef QT_NO_QOBJECT
+ static yes_type checkType(QObject* );
+#endif
+ static no_type checkType(...);
+ Q_STATIC_ASSERT_X(sizeof(T), "Type argument of Q_DECLARE_METATYPE(T*) must be fully defined");
+ enum { Value = sizeof(checkType(static_cast<T*>(0))) == sizeof(yes_type) };
+ };
+
+ // Function pointers don't derive from QObject
+ template <class Result> struct IsPointerToTypeDerivedFromQObject<Result(*)()> { enum { Value = false }; };
+ template <class Result, class Arg0> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0)> { enum { Value = false }; };
+ template <class Result, class Arg0, class Arg1> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1)> { enum { Value = false }; };
+ template <class Result, class Arg0, class Arg1, class Arg2> struct IsPointerToTypeDerivedFromQObject<Result(*)(Arg0, Arg1, Arg2)> { enum { Value = false }; };
}
template <typename T>
@@ -354,6 +400,8 @@ int qRegisterMetaType(const char *typeName
flags |= QMetaType::NeedsConstruction;
flags |= QMetaType::NeedsDestruction;
}
+ if (QtPrivate::IsPointerToTypeDerivedFromQObject<T>::Value)
+ flags |= QMetaType::PointerToQObject;
return QMetaType::registerType(typeName, reinterpret_cast<QMetaType::Deleter>(dptr),
reinterpret_cast<QMetaType::Creator>(cptr),
@@ -459,15 +507,43 @@ QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_FORWARD_DECLARE_STATIC_TYPES_ITER)
#undef QT_FORWARD_DECLARE_STATIC_TYPES_ITER
-class QWidget;
-class QObject;
template <class T> class QList;
+template <class T> class QLinkedList;
+template <class T> class QVector;
+template <class T> class QQueue;
+template <class T> class QStack;
+template <class T> class QSet;
+template <class T> class QSharedPointer;
template <class T1, class T2> class QMap;
template <class T1, class T2> class QHash;
typedef QList<QVariant> QVariantList;
typedef QMap<QString, QVariant> QVariantMap;
typedef QHash<QString, QVariant> QVariantHash;
+#define Q_DECLARE_METATYPE_TEMPLATE_1ARG(SINGLE_ARG_TEMPLATE) \
+template <typename T> \
+struct QMetaTypeId< SINGLE_ARG_TEMPLATE<T> > \
+{ \
+ enum { \
+ Defined = QMetaTypeId2<T>::Defined \
+ }; \
+ static int qt_metatype_id() \
+ { \
+ static QBasicAtomicInt metatype_id = Q_BASIC_ATOMIC_INITIALIZER(0); \
+ if (!metatype_id.load()) \
+ metatype_id.storeRelease(qRegisterMetaType< SINGLE_ARG_TEMPLATE<T> >( QByteArray(QByteArray(#SINGLE_ARG_TEMPLATE "<") + QMetaType::typeName(qMetaTypeId<T>()) + ">"), \
+ reinterpret_cast< SINGLE_ARG_TEMPLATE<T> *>(quintptr(-1)))); \
+ return metatype_id.loadAcquire(); \
+ } \
+};
+
+Q_DECLARE_METATYPE_TEMPLATE_1ARG(QList)
+Q_DECLARE_METATYPE_TEMPLATE_1ARG(QVector)
+Q_DECLARE_METATYPE_TEMPLATE_1ARG(QQueue)
+Q_DECLARE_METATYPE_TEMPLATE_1ARG(QStack)
+Q_DECLARE_METATYPE_TEMPLATE_1ARG(QSet)
+Q_DECLARE_METATYPE_TEMPLATE_1ARG(QSharedPointer)
+Q_DECLARE_METATYPE_TEMPLATE_1ARG(QLinkedList)
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qmetatype_p.h b/src/corelib/kernel/qmetatype_p.h
index 11139288d1..c292f11764 100644
--- a/src/corelib/kernel/qmetatype_p.h
+++ b/src/corelib/kernel/qmetatype_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -68,8 +68,6 @@ static inline int moduleForType(const int typeId)
return Gui;
if (typeId <= QMetaType::LastWidgetsType)
return Widgets;
- if (typeId <= QMetaType::LastCoreExtType)
- return Core;
return Unknown;
}
}
diff --git a/src/corelib/kernel/qmetatypeswitcher_p.h b/src/corelib/kernel/qmetatypeswitcher_p.h
index d3cf1024c3..c1cccfca63 100644
--- a/src/corelib/kernel/qmetatypeswitcher_p.h
+++ b/src/corelib/kernel/qmetatypeswitcher_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qmimedata.cpp b/src/corelib/kernel/qmimedata.cpp
index c43ef505fb..25e2b3532b 100644
--- a/src/corelib/kernel/qmimedata.cpp
+++ b/src/corelib/kernel/qmimedata.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qmimedata.h b/src/corelib/kernel/qmimedata.h
index 60498b7ab8..1f56ea6eda 100644
--- a/src/corelib/kernel/qmimedata.h
+++ b/src/corelib/kernel/qmimedata.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QUrl;
class QMimeDataPrivate;
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index bebdcac662..4377355486 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -4038,7 +4038,19 @@ QMetaObject::Connection QObject::connectImpl(const QObject *sender, void **signa
}
QObjectPrivate::get(s)->addConnection(signal_index, c.data());
- return QMetaObject::Connection(c.take());
+ QMetaObject::Connection ret(c.take());
+ locker.unlock();
+
+ // reconstruct the signature to call connectNotify
+ const char *sig = senderMetaObject->d.stringdata + senderMetaObject->d.data[
+ reinterpret_cast<const QMetaObjectPrivate*>(senderMetaObject->d.data)->methodData
+ + 5 * (signal_index - signalOffset)];
+ QVarLengthArray<char> signalSignature(qstrlen(sig) + 2);
+ signalSignature.data()[0] = char(QSIGNAL_CODE + '0');
+ strcpy(signalSignature.data() + 1 , sig);
+ s->connectNotify(signalSignature.data());
+
+ return ret;
}
/*!
diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h
index 11f524180c..5f43b52939 100644
--- a/src/corelib/kernel/qobject.h
+++ b/src/corelib/kernel/qobject.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,7 +60,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QEvent;
class QTimerEvent;
@@ -437,7 +436,7 @@ T qFindChild(const QObject *o, const QString &name = QString());
QList<T> qFindChildren(const QObject *oobj, const QString &name = QString());
QList<T> qFindChildren(const QObject *o, const QRegExp &re);
#endif
-#ifdef QT_DEPRECATED
+#if QT_DEPRECATED_SINCE(5, 0)
template<typename T>
inline QT_DEPRECATED T qFindChild(const QObject *o, const QString &name = QString())
{ return o->findChild<T>(name); }
diff --git a/src/corelib/kernel/qobject_impl.h b/src/corelib/kernel/qobject_impl.h
index 44aaa9a218..5adffb708f 100644
--- a/src/corelib/kernel/qobject_impl.h
+++ b/src/corelib/kernel/qobject_impl.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
namespace QtPrivate {
template <typename T> struct RemoveRef { typedef T Type; };
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index dbd2e4fa37..fa1aee8173 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qobjectcleanuphandler.cpp b/src/corelib/kernel/qobjectcleanuphandler.cpp
index 8a0cc2840e..166a90a74f 100644
--- a/src/corelib/kernel/qobjectcleanuphandler.cpp
+++ b/src/corelib/kernel/qobjectcleanuphandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qobjectcleanuphandler.h b/src/corelib/kernel/qobjectcleanuphandler.h
index 5997f0e250..90685090f8 100644
--- a/src/corelib/kernel/qobjectcleanuphandler.h
+++ b/src/corelib/kernel/qobjectcleanuphandler.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QObjectCleanupHandler : public QObject
{
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index dfcc81be03..315619761c 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QByteArray;
@@ -62,6 +61,7 @@ class QString;
// They are used, strictly speaking, only by the moc.
#ifndef Q_MOC_RUN
+#ifndef QT_NO_META_MACROS
# if defined(QT_NO_KEYWORDS)
# define QT_NO_EMIT
# else
@@ -87,6 +87,7 @@ class QString;
#define Q_INVOKABLE
#define Q_SIGNAL
#define Q_SLOT
+#endif // QT_NO_META_MACROS
#ifndef QT_NO_TRANSLATION
# ifndef QT_NO_TEXTCODEC
@@ -151,11 +152,14 @@ private: \
/* tmake ignore Q_OBJECT */
#define Q_OBJECT_FAKE Q_OBJECT
+
+#ifndef QT_NO_META_MACROS
/* tmake ignore Q_GADGET */
#define Q_GADGET \
public: \
static const QMetaObject staticMetaObject; \
private:
+#endif // QT_NO_META_MACROS
#else // Q_MOC_RUN
#define slots slots
@@ -182,6 +186,7 @@ private:
#define Q_SLOT Q_SLOT
#endif //Q_MOC_RUN
+#ifndef QT_NO_META_MACROS
// macro for onaming members
#ifdef METHOD
#undef METHOD
@@ -192,9 +197,11 @@ private:
#ifdef SIGNAL
#undef SIGNAL
#endif
+#endif // QT_NO_META_MACROS
Q_CORE_EXPORT const char *qFlagLocation(const char *method);
+#ifndef QT_NO_META_MACROS
#define QTOSTRING_HELPER(s) #s
#define QTOSTRING(s) QTOSTRING_HELPER(s)
#ifndef QT_NO_DEBUG
@@ -215,6 +222,7 @@ Q_CORE_EXPORT const char *qFlagLocation(const char *method);
#define QMETHOD_CODE 0 // member type codes
#define QSLOT_CODE 1
#define QSIGNAL_CODE 2
+#endif // QT_NO_META_MACROS
#define Q_ARG(type, data) QArgument<type >(#type, data)
#define Q_RETURN_ARG(type, data) QReturnArgument<type >(#type, data)
diff --git a/src/corelib/kernel/qpointer.cpp b/src/corelib/kernel/qpointer.cpp
index 575dad9ed8..936a933d2d 100644
--- a/src/corelib/kernel/qpointer.cpp
+++ b/src/corelib/kernel/qpointer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qpointer.h b/src/corelib/kernel/qpointer.h
index 4c0aebb41d..9b4f8e4332 100644
--- a/src/corelib/kernel/qpointer.h
+++ b/src/corelib/kernel/qpointer.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#if QT_DEPRECATED_SINCE(5,0)
diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp
index c5b1b56747..640dfc0f94 100644
--- a/src/corelib/kernel/qsharedmemory.cpp
+++ b/src/corelib/kernel/qsharedmemory.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,10 +44,10 @@
#include "qsystemsemaphore.h"
#include <qdir.h>
#include <qcryptographichash.h>
-#ifdef Q_OS_SYMBIAN
-#include <e32const.h>
-#endif
#include <qdebug.h>
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+#endif
QT_BEGIN_NAMESPACE
@@ -59,7 +59,6 @@ QT_BEGIN_NAMESPACE
the subset that the win/unix kernel allows.
On Unix this will be a file name
- On Symbian key will be truncated to 80 characters
*/
QString
QSharedMemoryPrivate::makePlatformSafeKey(const QString &key,
@@ -78,8 +77,6 @@ QSharedMemoryPrivate::makePlatformSafeKey(const QString &key,
result.append(QLatin1String(hex));
#ifdef Q_OS_WIN
return result;
-#elif defined(Q_OS_SYMBIAN)
- return result.left(KMaxKernelName);
#else
return QDir::tempPath() + QLatin1Char('/') + result;
#endif
@@ -121,14 +118,6 @@ QSharedMemoryPrivate::makePlatformSafeKey(const QString &key,
process. This means that QSharedMemory should not be used across
multiple threads in the same process in HP-UX.
- \o Symbian: QSharedMemory does not "own" the shared memory segment.
- When all threads or processes that have an instance of QSharedMemory
- attached to a particular shared memory segment have either destroyed
- their instance of QSharedMemory or exited, the Symbian kernel
- releases the shared memory segment automatically.
- Also, access to a shared memory segment cannot be limited to read-only
- in Symbian.
-
\endlist
Remember to lock the shared memory with lock() before reading from
diff --git a/src/corelib/kernel/qsharedmemory.h b/src/corelib/kernel/qsharedmemory.h
index d536e94fa1..e591d886c0 100644
--- a/src/corelib/kernel/qsharedmemory.h
+++ b/src/corelib/kernel/qsharedmemory.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#ifndef QT_NO_SHAREDMEMORY
diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h
index d3d3c023ba..2eb90c2c1a 100644
--- a/src/corelib/kernel/qsharedmemory_p.h
+++ b/src/corelib/kernel/qsharedmemory_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,13 +69,8 @@ namespace QSharedMemoryPrivate
#include "qsystemsemaphore.h"
#include "private/qobject_p.h"
-#ifdef Q_OS_WIN
-#include <qt_windows.h>
-#elif defined(Q_OS_SYMBIAN)
-#include <e32std.h>
-#include <sys/types.h>
-#else
-#include <sys/sem.h>
+#ifndef Q_OS_WIN
+# include <sys/sem.h>
#endif
QT_BEGIN_NAMESPACE
@@ -134,7 +129,7 @@ public:
static QString makePlatformSafeKey(const QString &key,
const QString &prefix = QLatin1String("qipc_sharedmemory_"));
#ifdef Q_OS_WIN
- HANDLE handle();
+ Qt::HANDLE handle();
#else
key_t handle();
#endif
@@ -144,11 +139,7 @@ public:
bool attach(QSharedMemory::AccessMode mode);
bool detach();
-#ifdef Q_OS_SYMBIAN
- void setErrorString(const QString &function, TInt errorCode);
-#else
void setErrorString(const QString &function);
-#endif
#ifndef QT_NO_SYSTEMSEMAPHORE
bool tryLocker(QSharedMemoryLocker *locker, const QString function) {
@@ -163,9 +154,7 @@ public:
private:
#ifdef Q_OS_WIN
- HANDLE hand;
-#elif defined(Q_OS_SYMBIAN)
- RChunk chunk;
+ Qt::HANDLE hand;
#else
key_t unix_key;
#endif
diff --git a/src/corelib/kernel/qsharedmemory_unix.cpp b/src/corelib/kernel/qsharedmemory_unix.cpp
index fd435d7b97..54bd4c6cc7 100644
--- a/src/corelib/kernel/qsharedmemory_unix.cpp
+++ b/src/corelib/kernel/qsharedmemory_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp
index c02ab15c88..c3f8dcf2ff 100644
--- a/src/corelib/kernel/qsharedmemory_win.cpp
+++ b/src/corelib/kernel/qsharedmemory_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,6 +43,7 @@
#include "qsharedmemory_p.h"
#include "qsystemsemaphore.h"
#include <qdebug.h>
+#include <qt_windows.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/kernel/qsignalmapper.cpp b/src/corelib/kernel/qsignalmapper.cpp
index 7bdffd4153..27340020d8 100644
--- a/src/corelib/kernel/qsignalmapper.cpp
+++ b/src/corelib/kernel/qsignalmapper.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qsignalmapper.h b/src/corelib/kernel/qsignalmapper.h
index 04278b491c..f4e7879697 100644
--- a/src/corelib/kernel/qsignalmapper.h
+++ b/src/corelib/kernel/qsignalmapper.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#ifndef QT_NO_SIGNALMAPPER
class QSignalMapperPrivate;
diff --git a/src/corelib/kernel/qsocketnotifier.cpp b/src/corelib/kernel/qsocketnotifier.cpp
index 60970f1cd2..d7689bb7b1 100644
--- a/src/corelib/kernel/qsocketnotifier.cpp
+++ b/src/corelib/kernel/qsocketnotifier.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qsocketnotifier.h b/src/corelib/kernel/qsocketnotifier.h
index 186979db4c..18efa7f770 100644
--- a/src/corelib/kernel/qsocketnotifier.h
+++ b/src/corelib/kernel/qsocketnotifier.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QSocketNotifier : public QObject
{
diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp
index 708eba89a6..74815d9e4e 100644
--- a/src/corelib/kernel/qsystemerror.cpp
+++ b/src/corelib/kernel/qsystemerror.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,7 @@
# endif
#endif
#ifdef Q_OS_WIN
-#include <windows.h>
+# include <qt_windows.h>
#endif
QT_BEGIN_NAMESPACE
@@ -141,76 +141,12 @@ static QString standardLibraryErrorString(int errorCode)
return ret.trimmed();
}
-#ifdef Q_OS_SYMBIAN
-static QString symbianErrorString(int errorCode)
-{
- switch (errorCode) {
- case KErrNotFound:
- return QLatin1String("not found");
- case KErrCancel:
- return QLatin1String("cancelled");
- case KErrNoMemory:
- return QLatin1String("out of memory");
- case KErrNotSupported:
- return QLatin1String("not supported");
- case KErrBadHandle:
- return QLatin1String("bad handle"); //KERN-EXEC 0 panic is more likely
- case KErrAlreadyExists:
- return QLatin1String("already exists");
- case KErrPathNotFound:
- return QLatin1String("path not found");
- case KErrInUse:
- return QLatin1String("in use");
- case KErrNotReady:
- return QLatin1String("not ready (e.g. FS dismounted, network down)");
- case KErrCorrupt:
- return QLatin1String("corrupt");
- case KErrAccessDenied:
- return QLatin1String("access denied");
- case KErrLocked:
- return QLatin1String("locked");
- case KErrWrite:
- return QLatin1String("incomplete write error");
- case KErrDisMounted:
- return QLatin1String("file system dismounted during operation"); //i.e. a forcible dismount was done while we had files open
- case KErrEof:
- return QLatin1String("end of file");
- case KErrDiskFull:
- return QLatin1String("no space in file system");
- case KErrBadName:
- return QLatin1String("invalid filename");
- case KErrTimedOut:
- return QLatin1String("timed out");
- case KErrBadDescriptor:
- return QLatin1String("bad descriptor (passed address on stack to async call?)");
- case KErrAbort:
- return QLatin1String("aborted");
- case KErrTooBig:
- return QLatin1String("too big"); //e.g. trying to open a >2GB file with 32 bit API
- case KErrBadPower:
- return QLatin1String("insufficient power");
- case KErrDirFull:
- return QLatin1String("no space in directory table");
- case KErrHardwareNotAvailable:
- return QLatin1String("hardware not available");
- case KErrSessionClosed:
- return QLatin1String("session closed");
- case KErrPermissionDenied:
- return QLatin1String("permission denied");
- default:
- return QString(QLatin1String("symbian error %1")).arg(errorCode);
- }
-}
-#endif
-
QString QSystemError::toString()
{
switch(errorScope) {
case NativeError:
#if defined (Q_OS_WIN)
return windowsErrorString(errorCode);
-#elif defined (Q_OS_SYMBIAN)
- return symbianErrorString(errorCode);
#else
//unix: fall through as native and standard library are the same
#endif
diff --git a/src/corelib/kernel/qsystemerror_p.h b/src/corelib/kernel/qsystemerror_p.h
index 2a90760197..4ebe2196c2 100644
--- a/src/corelib/kernel/qsystemerror_p.h
+++ b/src/corelib/kernel/qsystemerror_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qsystemsemaphore.cpp b/src/corelib/kernel/qsystemsemaphore.cpp
index 690a4e8b92..d0a67834dd 100644
--- a/src/corelib/kernel/qsystemsemaphore.cpp
+++ b/src/corelib/kernel/qsystemsemaphore.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -123,10 +123,6 @@ QT_BEGIN_NAMESPACE
resource and then exits without releasing it, Unix will release that
resource.
- \o Symbian: QSystemSemaphore behaves the same as Windows semaphores.
- In other words, the operating system owns the semaphore and ignores
- QSystemSemaphore::AccessMode.
-
\endlist
\sa QSharedMemory, QSemaphore
@@ -151,7 +147,7 @@ QT_BEGIN_NAMESPACE
creates a new semaphore for that key and sets its resource count to
\a initialValue.
- In Windows and in Symbian, \a mode is ignored, and the system always tries to
+ In Windows, \a mode is ignored, and the system always tries to
create a semaphore for the specified \a key. If the system does not
already have a semaphore identified as \a key, it creates the
semaphore and sets its resource count to \a initialValue. But if the
@@ -201,7 +197,7 @@ QSystemSemaphore::~QSystemSemaphore()
enable handling the problem in Unix implementations of semaphores
that survive a crash. In Unix, when a semaphore survives a crash, we
need a way to force it to reset its resource count, when the system
- reuses the semaphore. In Windows and in Symbian, where semaphores can't survive a
+ reuses the semaphore. In Windows, where semaphores can't survive a
crash, this enum has no effect.
\value Open If the semaphore already exists, its initial resource
@@ -214,7 +210,7 @@ QSystemSemaphore::~QSystemSemaphore()
This value should be passed to the constructor, when the first
semaphore for a particular key is constructed and you know that if
the semaphore already exists it could only be because of a crash. In
- Windows and in Symbian, where a semaphore can't survive a crash, Create and Open
+ Windows, where a semaphore can't survive a crash, Create and Open
have the same behavior.
*/
@@ -234,7 +230,7 @@ void QSystemSemaphore::setKey(const QString &key, int initialValue, AccessMode m
return;
d->error = NoError;
d->errorString = QString();
-#if !defined(Q_OS_WIN) && !defined(Q_OS_SYMBIAN)
+#if !defined(Q_OS_WIN)
// optimization to not destroy/create the file & semaphore
if (key == d->key && mode == Create && d->createdSemaphore && d->createdFile) {
d->initialValue = initialValue;
diff --git a/src/corelib/kernel/qsystemsemaphore.h b/src/corelib/kernel/qsystemsemaphore.h
index 0cb69d5e7c..63c03ed772 100644
--- a/src/corelib/kernel/qsystemsemaphore.h
+++ b/src/corelib/kernel/qsystemsemaphore.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#ifndef QT_NO_SYSTEMSEMAPHORE
diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h
index 31fd596fd5..527cb312cb 100644
--- a/src/corelib/kernel/qsystemsemaphore_p.h
+++ b/src/corelib/kernel/qsystemsemaphore_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -62,10 +62,6 @@
# include <sys/types.h>
#endif
-#ifdef Q_OS_SYMBIAN
-class RSemaphore;
-#endif
-
QT_BEGIN_NAMESPACE
class QSystemSemaphorePrivate
@@ -80,11 +76,8 @@ public:
}
#ifdef Q_OS_WIN
- HANDLE handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open);
+ Qt::HANDLE handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open);
void setErrorString(const QString &function);
-#elif defined(Q_OS_SYMBIAN)
- int handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open);
- void setErrorString(const QString &function,int err = 0);
#else
key_t handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open);
void setErrorString(const QString &function);
@@ -96,10 +89,8 @@ public:
QString fileName;
int initialValue;
#ifdef Q_OS_WIN
- HANDLE semaphore;
- HANDLE semaphoreLock;
-#elif defined(Q_OS_SYMBIAN)
- RSemaphore semaphore;
+ Qt::HANDLE semaphore;
+ Qt::HANDLE semaphoreLock;
#else
int semaphore;
bool createdFile;
diff --git a/src/corelib/kernel/qsystemsemaphore_unix.cpp b/src/corelib/kernel/qsystemsemaphore_unix.cpp
index cc86e335e5..70c697b693 100644
--- a/src/corelib/kernel/qsystemsemaphore_unix.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp
index aad78459d7..fef53585fe 100644
--- a/src/corelib/kernel/qsystemsemaphore_win.cpp
+++ b/src/corelib/kernel/qsystemsemaphore_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,6 +43,7 @@
#include "qsystemsemaphore_p.h"
#include "qcoreapplication.h"
#include <qdebug.h>
+#include <qt_windows.h>
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp
index 2f9ccdae46..2b07fa99cc 100644
--- a/src/corelib/kernel/qtcore_eval.cpp
+++ b/src/corelib/kernel/qtcore_eval.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,7 +55,6 @@ QT_BEGIN_NAMESPACE
static const char boilerplate_unsuported[] =
"\nQt %1 Evaluation License\n"
"Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).\n"
- "All rights reserved.\n\n"
"This trial version may only be used for evaluation purposes\n"
"and will shut down after 120 minutes.\n"
"Registered to:\n"
@@ -66,7 +65,6 @@ static const char boilerplate_unsuported[] =
static const char boilerplate_supported[] =
"\nQt %1 Evaluation License\n"
"Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).\n"
- "All rights reserved.\n\n"
"This trial version may only be used for evaluation purposes\n"
"Registered to:\n"
" Licensee: %2\n\n"
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index da1cfe91b2..f434df177c 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h
index 6fb32f9bde..eff2a7bfe1 100644
--- a/src/corelib/kernel/qtimer.h
+++ b/src/corelib/kernel/qtimer.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QTimer : public QObject
{
diff --git a/src/corelib/kernel/qtimerinfo_unix.cpp b/src/corelib/kernel/qtimerinfo_unix.cpp
index b89d4ccb30..32e24edcf3 100644
--- a/src/corelib/kernel/qtimerinfo_unix.cpp
+++ b/src/corelib/kernel/qtimerinfo_unix.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qtimerinfo_unix_p.h b/src/corelib/kernel/qtimerinfo_unix_p.h
index 8a057dda60..4bf6b91ea6 100644
--- a/src/corelib/kernel/qtimerinfo_unix_p.h
+++ b/src/corelib/kernel/qtimerinfo_unix_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index aadf3a76e9..a11bcb26c9 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,7 +58,7 @@
#include "qtranslator_p.h"
#include "qlocale.h"
-#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) && !defined(Q_OS_INTEGRITY)
+#if defined(Q_OS_UNIX) && !defined(Q_OS_INTEGRITY)
#define QT_USE_MMAP
#include "private/qcore_unix_p.h"
#endif
@@ -518,7 +518,7 @@ static QString find_translation(const QLocale & locale,
// see http://www.unicode.org/reports/tr35/#LanguageMatching for inspiration
QStringList languages = locale.uiLanguages();
-#if defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_UNIX)
for (int i = languages.size()-1; i >= 0; --i) {
QString lang = languages.at(i);
QString lowerLang = lang.toLower();
diff --git a/src/corelib/kernel/qtranslator.h b/src/corelib/kernel/qtranslator.h
index b1f378a8b5..f52db59201 100644
--- a/src/corelib/kernel/qtranslator.h
+++ b/src/corelib/kernel/qtranslator.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
#ifndef QT_NO_TRANSLATION
diff --git a/src/corelib/kernel/qtranslator_p.h b/src/corelib/kernel/qtranslator_p.h
index 23164ecac6..0d418bc565 100644
--- a/src/corelib/kernel/qtranslator_p.h
+++ b/src/corelib/kernel/qtranslator_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 72229c0e63..cfaf22c146 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -98,33 +98,33 @@ public:
namespace {
template<typename T>
-struct TypeDefiniton {
+struct TypeDefinition {
static const bool IsAvailable = true;
};
// Ignore these types, as incomplete
#ifdef QT_BOOTSTRAPPED
-template<> struct TypeDefiniton<QEasingCurve> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QModelIndex> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QEasingCurve> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QModelIndex> { static const bool IsAvailable = false; };
#endif
#ifdef QT_NO_GEOM_VARIANT
-template<> struct TypeDefiniton<QRect> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QRectF> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QSize> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QSizeF> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QLine> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QLineF> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QPoint> { static const bool IsAvailable = false; };
-template<> struct TypeDefiniton<QPointF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QRect> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QRectF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QSize> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QSizeF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QLine> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QLineF> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QPoint> { static const bool IsAvailable = false; };
+template<> struct TypeDefinition<QPointF> { static const bool IsAvailable = false; };
#endif
struct CoreTypesFilter {
template<typename T>
struct Acceptor {
- static const bool IsAccepted = QTypeModuleInfo<T>::IsCore && TypeDefiniton<T>::IsAvailable;
+ static const bool IsAccepted = QTypeModuleInfo<T>::IsCore && TypeDefinition<T>::IsAvailable;
};
};
-} // annonymous used to hide TypeDefiniton
+} // annonymous used to hide TypeDefinition
namespace { // annonymous used to hide QVariant handlers
@@ -980,6 +980,7 @@ Q_CORE_EXPORT void QVariantPrivate::unregisterHandler(const int /* Modules::Name
*/
/*!
+ \obsolete Use QMetaType::Type instead
\enum QVariant::Type
This enum type defines the types of variable that a QVariant can
@@ -1589,8 +1590,6 @@ const char *QVariant::typeToName(Type typ)
{
if (typ == Invalid)
return 0;
- if (typ == UserType)
- return "UserType";
return QMetaType::typeName(typ);
}
@@ -1607,16 +1606,6 @@ QVariant::Type QVariant::nameToType(const char *name)
{
if (!name || !*name)
return Invalid;
- if (strcmp(name, "Q3CString") == 0)
- return ByteArray;
- if (strcmp(name, "Q_LLONG") == 0)
- return LongLong;
- if (strcmp(name, "Q_ULLONG") == 0)
- return ULongLong;
- if (strcmp(name, "QIconSet") == 0)
- return Icon;
- if (strcmp(name, "UserType") == 0)
- return UserType;
int metaType = QMetaType::type(name);
return metaType <= int(LastGuiType) ? QVariant::Type(metaType) : UserType;
@@ -1624,7 +1613,7 @@ QVariant::Type QVariant::nameToType(const char *name)
#ifndef QT_NO_DATASTREAM
enum { MapFromThreeCount = 36 };
-static const ushort map_from_three[MapFromThreeCount] =
+static const ushort mapIdFromQt3ToCurrent[MapFromThreeCount] =
{
QVariant::Invalid,
QVariant::Map,
@@ -1638,7 +1627,7 @@ static const ushort map_from_three[MapFromThreeCount] =
QVariant::Size,
QVariant::Color,
QVariant::Palette,
- 63, // ColorGroup
+ 0, // ColorGroup
QVariant::Icon,
QVariant::Point,
QVariant::Image,
@@ -1674,26 +1663,45 @@ void QVariant::load(QDataStream &s)
{
clear();
- quint32 u;
- s >> u;
+ quint32 typeId;
+ s >> typeId;
if (s.version() < QDataStream::Qt_4_0) {
- if (u >= MapFromThreeCount)
+ if (typeId >= MapFromThreeCount)
return;
- u = map_from_three[u];
+ typeId = mapIdFromQt3ToCurrent[typeId];
+ } else if (s.version() < QDataStream::Qt_5_0) {
+ if (typeId >= 128 && typeId != QVariant::UserType) {
+ // In Qt4 id == 128 was FirstExtCoreType. In Qt5 ExtCoreTypes set was merged to CoreTypes
+ // by moving all ids down by 97.
+ typeId -= 97;
+ } else if (typeId == 69 /* QIcon */) {
+ // In Qt5 after modularization project this types where moved to a separate module (and ids were downgraded)
+ typeId = QMetaType::QIcon;
+ } else if (typeId == 75 /* QSizePolicy */) {
+ typeId = QMetaType::QSizePolicy;
+ } else if (typeId >= 70) {
+ // and as a result this types recieved lower ids too
+ if (typeId <= 74) { // QImage QPolygon QRegion QBitmap QCursor
+ typeId -=1;
+ } else if (typeId <= 86) { // QKeySequence QPen QTextLength QTextFormat QMatrix QTransform QMatrix4x4 QVector2D QVector3D QVector4D QQuaternion
+ typeId -=2;
+ }
+ }
}
+
qint8 is_null = false;
if (s.version() >= QDataStream::Qt_4_2)
s >> is_null;
- if (u == QVariant::UserType) {
+ if (typeId == QVariant::UserType) {
QByteArray name;
s >> name;
- u = QMetaType::type(name);
- if (!u) {
+ typeId = QMetaType::type(name);
+ if (!typeId) {
s.setStatus(QDataStream::ReadCorruptData);
return;
}
}
- create(static_cast<int>(u), 0);
+ create(static_cast<int>(typeId), 0);
d.is_null = is_null;
if (!isValid()) {
@@ -1719,12 +1727,12 @@ void QVariant::load(QDataStream &s)
*/
void QVariant::save(QDataStream &s) const
{
- quint32 tp = type();
+ quint32 typeId = type();
if (s.version() < QDataStream::Qt_4_0) {
int i;
for (i = MapFromThreeCount - 1; i >= 0; i--) {
- if (map_from_three[i] == tp) {
- tp = i;
+ if (mapIdFromQt3ToCurrent[i] == typeId) {
+ typeId = i;
break;
}
}
@@ -1732,11 +1740,29 @@ void QVariant::save(QDataStream &s) const
s << QVariant();
return;
}
+ } else if (s.version() < QDataStream::Qt_5_0) {
+ if (typeId >= 128 - 97 && typeId <= LastCoreType) {
+ // In Qt4 id == 128 was FirstExtCoreType. In Qt5 ExtCoreTypes set was merged to CoreTypes
+ // by moving all ids down by 97.
+ typeId += 97;
+ } else if (typeId == QMetaType::QIcon) {
+ // In Qt5 after modularization project this types where moved to a separate module (and ids were downgraded)
+ typeId = 69;
+ } else if (typeId == QMetaType::QSizePolicy) {
+ typeId = 75;
+ } else if (typeId >= QMetaType::QImage) {
+ // and as a result this types recieved lower ids too
+ if (typeId <= QMetaType::QCursor) {
+ typeId +=1;
+ } else if (typeId <= QMetaType::QQuaternion) {
+ typeId +=2;
+ }
+ }
}
- s << tp;
+ s << typeId;
if (s.version() >= QDataStream::Qt_4_2)
s << qint8(d.is_null);
- if (tp == QVariant::UserType) {
+ if (typeId == QVariant::UserType) {
s << QMetaType::typeName(userType());
}
@@ -1746,8 +1772,8 @@ void QVariant::save(QDataStream &s) const
}
if (!QMetaType::save(s, d.type, constData())) {
+ qWarning("QVariant::save: unable to save type '%s' (type id: %d).\n", QMetaType::typeName(d.type), d.type);
Q_ASSERT_X(false, "QVariant::save", "Invalid type to save");
- qWarning("QVariant::save: unable to save type %d.", d.type);
}
}
@@ -2410,17 +2436,15 @@ static const quint32 qCanConvertMatrix[QVariant::LastCoreType + 1] =
*/
bool QVariant::canConvert(Type t) const
{
- //we can treat floats as double
- //the reason for not doing it the "proper" way is that QMetaType::Float's value is 135,
- //which can't be handled by qCanConvertMatrix
- //In addition QVariant::Type doesn't have a Float value, so we're using QMetaType::Float
+ // TODO Reimplement this function, currently it works but it is a historical mess.
const uint currentType = ((d.type == QMetaType::Float) ? QVariant::Double : d.type);
if (uint(t) == uint(QMetaType::Float)) t = QVariant::Double;
if (currentType == uint(t))
return true;
- if (currentType > QVariant::LastCoreType || t > QVariant::LastCoreType) {
+ // FIXME It should be LastCoreType intead of Uuid
+ if (currentType > QVariant::Uuid || t > QVariant::Uuid) {
switch (uint(t)) {
case QVariant::Int:
return currentType == QVariant::KeySequence
diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h
index 35c584fa51..07ef4dc41e 100644
--- a/src/corelib/kernel/qvariant.h
+++ b/src/corelib/kernel/qvariant.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class QBitArray;
class QDataStream;
@@ -380,7 +379,7 @@ protected:
#ifndef Q_NO_TEMPLATE_FRIENDS
template<typename T>
friend inline T qvariant_cast(const QVariant &);
-private:
+protected:
#else
public:
#endif
@@ -503,7 +502,7 @@ template<> inline QVariant qvariant_cast<QVariant>(const QVariant &v)
return v;
}
-#ifdef QT_DEPRECATED
+#if QT_DEPRECATED_SINCE(5, 0)
template<typename T>
inline QT_DEPRECATED T qVariantValue(const QVariant &variant)
{ return qvariant_cast<T>(variant); }
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 015ca5b464..7065bcfd6b 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qwineventnotifier.cpp b/src/corelib/kernel/qwineventnotifier.cpp
index e06e1d5b0a..11a2dc83f5 100644
--- a/src/corelib/kernel/qwineventnotifier.cpp
+++ b/src/corelib/kernel/qwineventnotifier.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/corelib/kernel/qwineventnotifier.h b/src/corelib/kernel/qwineventnotifier.h
index 386a640434..b364c68e05 100644
--- a/src/corelib/kernel/qwineventnotifier.h
+++ b/src/corelib/kernel/qwineventnotifier.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Core)
class Q_CORE_EXPORT QWinEventNotifier : public QObject
{