From b44e67e1ca5766daef3e4f7a6dd433ebe0f744d1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 1 Feb 2012 10:19:07 +0100 Subject: Windows: Fix inclusion of - Always use as the last file to be included. - Remove it from some headers, use Qt::HANDLE instead of HANDLE. - Clean up #ifdef, use Q_OS_WIN for Windows/Windows CE. - Add NOMINMAX to qt_windows.h to avoid problems with the min/max macros. - Remove from qplatformdefs.h (VS2005) Change-Id: Ic44e2cb3eafce38e1ad645c3bf85745439398e50 Reviewed-by: Thiago Macieira Reviewed-by: Joerg Bornemann --- mkspecs/win32-msvc2005/qplatformdefs.h | 1 - src/corelib/animation/qabstractanimation_p.h | 4 ---- src/corelib/codecs/qtextcodec.cpp | 7 ++++-- src/corelib/global/qt_windows.h | 1 + src/corelib/io/qfilesystemmetadata_p.h | 9 ++++---- src/corelib/io/qfilesystemwatcher_win.cpp | 7 ++++++ src/corelib/io/qfilesystemwatcher_win_p.h | 15 ++++--------- src/corelib/io/qprocess.h | 2 +- src/corelib/io/qsettings.cpp | 10 ++++----- src/corelib/io/qsettings_p.h | 4 ---- src/corelib/io/qsettings_win.cpp | 2 +- src/corelib/io/qtemporarydir.cpp | 2 +- src/corelib/io/qwindowspipereader_p.h | 4 ++-- src/corelib/kernel/qcoreapplication_win.cpp | 2 +- src/corelib/kernel/qcorecmdlineargs_p.h | 11 ++++----- src/corelib/kernel/qsharedmemory.cpp | 3 +++ src/corelib/kernel/qsharedmemory_p.h | 10 ++++----- src/corelib/kernel/qsharedmemory_win.cpp | 1 + src/corelib/kernel/qsystemerror.cpp | 2 +- src/corelib/kernel/qsystemsemaphore_p.h | 6 ++--- src/corelib/kernel/qsystemsemaphore_win.cpp | 1 + src/corelib/plugin/qlibrary_p.h | 6 ++--- src/corelib/plugin/qlibrary_win.cpp | 2 +- src/corelib/plugin/qsystemlibrary_p.h | 4 ++-- src/corelib/thread/qmutex_p.h | 4 ++-- src/corelib/thread/qmutex_win.cpp | 3 +-- src/corelib/thread/qthread.cpp | 18 --------------- src/corelib/thread/qthread_p.h | 11 ++++----- src/corelib/thread/qwaitcondition_win.cpp | 2 +- src/corelib/tools/qdatetime.cpp | 10 ++++----- src/corelib/tools/qelapsedtimer_win.cpp | 2 +- src/corelib/tools/qlocale.cpp | 8 +++---- src/corelib/tools/qlocale_win.cpp | 4 ++-- src/corelib/tools/qsimd.cpp | 17 +++++++------- src/corelib/tools/qsimd_p.h | 3 --- src/corelib/tools/qstring.cpp | 26 +++++++++------------- src/gui/image/qpixmap_win.cpp | 2 +- src/gui/painting/qpaintengine_raster.cpp | 14 ++++++------ src/gui/text/qfontdatabase.cpp | 5 ----- src/network/kernel/qdnslookup_win.cpp | 2 +- src/network/kernel/qnetworkproxy_win.cpp | 2 +- src/network/ssl/qsslsocket_p.h | 2 +- src/printsupport/kernel/qprintengine_win_p.h | 3 +-- src/widgets/dialogs/qfiledialog.cpp | 25 +++++++++++++++++++-- src/widgets/dialogs/qfiledialog_p.h | 20 +---------------- src/widgets/dialogs/qfilesystemmodel.cpp | 6 ++--- src/widgets/dialogs/qwizard_win_p.h | 2 +- src/widgets/itemviews/qfileiconprovider.cpp | 6 ++--- src/widgets/kernel/qapplication_qpa.cpp | 5 +++++ src/widgets/kernel/qwidget.cpp | 3 --- src/widgets/widgets/qabstractscrollarea.cpp | 4 ++-- src/widgets/widgets/qsizegrip.cpp | 11 +++++---- src/widgets/widgets/qwidgetresizehandler.cpp | 3 --- .../kernel/qhostaddress/tst_qhostaddress.cpp | 3 +++ 54 files changed, 152 insertions(+), 190 deletions(-) diff --git a/mkspecs/win32-msvc2005/qplatformdefs.h b/mkspecs/win32-msvc2005/qplatformdefs.h index 7495ccd8b8..ba0fdb3529 100644 --- a/mkspecs/win32-msvc2005/qplatformdefs.h +++ b/mkspecs/win32-msvc2005/qplatformdefs.h @@ -64,7 +64,6 @@ #include #include #include -#include #define Q_FS_FAT #ifdef QT_LARGEFILE_SUPPORT diff --git a/src/corelib/animation/qabstractanimation_p.h b/src/corelib/animation/qabstractanimation_p.h index e2189572f1..c4d53342c2 100644 --- a/src/corelib/animation/qabstractanimation_p.h +++ b/src/corelib/animation/qabstractanimation_p.h @@ -60,10 +60,6 @@ #include #include -#ifdef Q_OS_WIN -#include -#endif - #ifndef QT_NO_ANIMATION QT_BEGIN_NAMESPACE diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 93f07242af..82e5c9a1c3 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -85,8 +85,11 @@ #include #endif -#if defined(Q_OS_WINCE) -# define QT_NO_SETLOCALE +#ifdef Q_OS_WIN +# include +# if defined(Q_OS_WINCE) +# define QT_NO_SETLOCALE +# endif #endif diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h index 0006324067..f9d2cf8413 100644 --- a/src/corelib/global/qt_windows.h +++ b/src/corelib/global/qt_windows.h @@ -60,6 +60,7 @@ #endif #endif +#define NOMINMAX #include #ifdef _WIN32_WCE diff --git a/src/corelib/io/qfilesystemmetadata_p.h b/src/corelib/io/qfilesystemmetadata_p.h index ea981f0bbc..792ee0e714 100644 --- a/src/corelib/io/qfilesystemmetadata_p.h +++ b/src/corelib/io/qfilesystemmetadata_p.h @@ -59,10 +59,11 @@ #include // Platform-specific includes -#if defined(Q_OS_WIN) -#ifndef IO_REPARSE_TAG_SYMLINK -#define IO_REPARSE_TAG_SYMLINK (0xA000000CL) -#endif +#ifdef Q_OS_WIN +# include +# ifndef IO_REPARSE_TAG_SYMLINK +# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +# endif #endif QT_BEGIN_NAMESPACE diff --git a/src/corelib/io/qfilesystemwatcher_win.cpp b/src/corelib/io/qfilesystemwatcher_win.cpp index 8b84457e67..715e16bc7e 100644 --- a/src/corelib/io/qfilesystemwatcher_win.cpp +++ b/src/corelib/io/qfilesystemwatcher_win.cpp @@ -52,8 +52,15 @@ #include #include +#include + QT_BEGIN_NAMESPACE +QWindowsFileSystemWatcherEngine::Handle::Handle() + : handle(INVALID_HANDLE_VALUE), flags(0u) +{ +} + QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine() { foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) { diff --git a/src/corelib/io/qfilesystemwatcher_win_p.h b/src/corelib/io/qfilesystemwatcher_win_p.h index 84b1dcc693..8daf5a94ad 100644 --- a/src/corelib/io/qfilesystemwatcher_win_p.h +++ b/src/corelib/io/qfilesystemwatcher_win_p.h @@ -57,8 +57,6 @@ #ifndef QT_NO_FILESYSTEMWATCHER -#include - #include #include #include @@ -90,15 +88,10 @@ public: class Handle { public: - HANDLE handle; + Qt::HANDLE handle; uint flags; - Handle() - : handle(INVALID_HANDLE_VALUE), flags(0u) - { } - Handle(const Handle &other) - : handle(other.handle), flags(other.flags) - { } + Handle(); }; class PathInfo { @@ -147,12 +140,12 @@ public: void wakeup(); QMutex mutex; - QVector handles; + QVector handles; int msg; QHash handleForDir; - QHash > pathInfoForHandle; + QHash > pathInfoForHandle; Q_SIGNALS: void fileChanged(const QString &path, bool removed); diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h index f5203fb2ff..1890635eda 100644 --- a/src/corelib/io/qprocess.h +++ b/src/corelib/io/qprocess.h @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_PROCESS -#if (!defined(Q_OS_WIN32) && !defined(Q_OS_WINCE)) || defined(qdoc) +#if !defined(Q_OS_WIN) || defined(qdoc) typedef qint64 Q_PID; #else QT_END_NAMESPACE diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index e9ef01333d..3d2ac329ca 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -68,17 +68,17 @@ #include "qcoreapplication.h" #endif -#ifdef Q_OS_WIN // for homedirpath reading from registry -#include "qt_windows.h" -#include -#endif - #ifdef Q_OS_VXWORKS # include #endif #include +#ifdef Q_OS_WIN // for homedirpath reading from registry +# include +# include +#endif + #ifndef CSIDL_COMMON_APPDATA #define CSIDL_COMMON_APPDATA 0x0023 // All Users\Application Data #endif diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h index e53ca24669..f4f285bae4 100644 --- a/src/corelib/io/qsettings_p.h +++ b/src/corelib/io/qsettings_p.h @@ -64,10 +64,6 @@ #endif #include "private/qscopedpointer_p.h" -#ifdef Q_OS_WIN -#include "QtCore/qt_windows.h" -#endif - QT_BEGIN_NAMESPACE #define QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER diff --git a/src/corelib/io/qsettings_win.cpp b/src/corelib/io/qsettings_win.cpp index f151145297..5ddc1dd1b1 100644 --- a/src/corelib/io/qsettings_win.cpp +++ b/src/corelib/io/qsettings_win.cpp @@ -46,8 +46,8 @@ #include "qsettings_p.h" #include "qvector.h" #include "qmap.h" -#include "qt_windows.h" #include "qdebug.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/corelib/io/qtemporarydir.cpp b/src/corelib/io/qtemporarydir.cpp index fedbb695e8..53a48609e5 100644 --- a/src/corelib/io/qtemporarydir.cpp +++ b/src/corelib/io/qtemporarydir.cpp @@ -53,8 +53,8 @@ #include // mkdtemp #ifdef Q_OS_WIN -#include #include +#include #endif QT_BEGIN_NAMESPACE diff --git a/src/corelib/io/qwindowspipereader_p.h b/src/corelib/io/qwindowspipereader_p.h index d9d9cf9717..6bf950eec1 100644 --- a/src/corelib/io/qwindowspipereader_p.h +++ b/src/corelib/io/qwindowspipereader_p.h @@ -56,10 +56,10 @@ #include #include #include -#include - #include +#include + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index e087174d8b..9a45f28f16 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -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 #include +#include QT_BEGIN_NAMESPACE diff --git a/src/corelib/kernel/qcorecmdlineargs_p.h b/src/corelib/kernel/qcorecmdlineargs_p.h index 70e41ac52a..151818b005 100644 --- a/src/corelib/kernel/qcorecmdlineargs_p.h +++ b/src/corelib/kernel/qcorecmdlineargs_p.h @@ -58,13 +58,11 @@ QT_BEGIN_NAMESPACE -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) +#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_END_INCLUDE_NAMESPACE // template implementation of the parsing algorithm @@ -132,7 +130,6 @@ static QVector 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,7 +150,7 @@ static inline QStringList qCmdLineArgs(int argc, char *argv[]) QString cmdLine = QString::fromWCharArray(GetCommandLine()); return qWinCmdArgs(cmdLine); } -#endif + #else // !Q_OS_WIN static inline QStringList qCmdLineArgs(int argc, char *argv[]) diff --git a/src/corelib/kernel/qsharedmemory.cpp b/src/corelib/kernel/qsharedmemory.cpp index 9ffa3506ac..640dfc0f94 100644 --- a/src/corelib/kernel/qsharedmemory.cpp +++ b/src/corelib/kernel/qsharedmemory.cpp @@ -45,6 +45,9 @@ #include #include #include +#ifdef Q_OS_WIN +# include +#endif QT_BEGIN_NAMESPACE diff --git a/src/corelib/kernel/qsharedmemory_p.h b/src/corelib/kernel/qsharedmemory_p.h index 4fd83fcae6..2eb90c2c1a 100644 --- a/src/corelib/kernel/qsharedmemory_p.h +++ b/src/corelib/kernel/qsharedmemory_p.h @@ -69,10 +69,8 @@ namespace QSharedMemoryPrivate #include "qsystemsemaphore.h" #include "private/qobject_p.h" -#ifdef Q_OS_WIN -#include -#else -#include +#ifndef Q_OS_WIN +# include #endif QT_BEGIN_NAMESPACE @@ -131,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 @@ -156,7 +154,7 @@ public: private: #ifdef Q_OS_WIN - HANDLE hand; + Qt::HANDLE hand; #else key_t unix_key; #endif diff --git a/src/corelib/kernel/qsharedmemory_win.cpp b/src/corelib/kernel/qsharedmemory_win.cpp index 742b701b4f..c3f8dcf2ff 100644 --- a/src/corelib/kernel/qsharedmemory_win.cpp +++ b/src/corelib/kernel/qsharedmemory_win.cpp @@ -43,6 +43,7 @@ #include "qsharedmemory_p.h" #include "qsystemsemaphore.h" #include +#include QT_BEGIN_NAMESPACE diff --git a/src/corelib/kernel/qsystemerror.cpp b/src/corelib/kernel/qsystemerror.cpp index 774c9b975d..74815d9e4e 100644 --- a/src/corelib/kernel/qsystemerror.cpp +++ b/src/corelib/kernel/qsystemerror.cpp @@ -52,7 +52,7 @@ # endif #endif #ifdef Q_OS_WIN -#include +# include #endif QT_BEGIN_NAMESPACE diff --git a/src/corelib/kernel/qsystemsemaphore_p.h b/src/corelib/kernel/qsystemsemaphore_p.h index 10665228ea..527cb312cb 100644 --- a/src/corelib/kernel/qsystemsemaphore_p.h +++ b/src/corelib/kernel/qsystemsemaphore_p.h @@ -76,7 +76,7 @@ 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); #else key_t handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open); @@ -89,8 +89,8 @@ public: QString fileName; int initialValue; #ifdef Q_OS_WIN - HANDLE semaphore; - HANDLE semaphoreLock; + Qt::HANDLE semaphore; + Qt::HANDLE semaphoreLock; #else int semaphore; bool createdFile; diff --git a/src/corelib/kernel/qsystemsemaphore_win.cpp b/src/corelib/kernel/qsystemsemaphore_win.cpp index 6138ff402d..fef53585fe 100644 --- a/src/corelib/kernel/qsystemsemaphore_win.cpp +++ b/src/corelib/kernel/qsystemsemaphore_win.cpp @@ -43,6 +43,7 @@ #include "qsystemsemaphore_p.h" #include "qcoreapplication.h" #include +#include QT_BEGIN_NAMESPACE diff --git a/src/corelib/plugin/qlibrary_p.h b/src/corelib/plugin/qlibrary_p.h index bb9a8fbb91..a5f366070c 100644 --- a/src/corelib/plugin/qlibrary_p.h +++ b/src/corelib/plugin/qlibrary_p.h @@ -53,14 +53,14 @@ // We mean it. // -#ifdef Q_OS_WIN -# include "QtCore/qt_windows.h" -#endif #include "QtCore/qlibrary.h" #include "QtCore/qpointer.h" #include "QtCore/qstringlist.h" #include "QtCore/qplugin.h" #include "QtCore/qsharedpointer.h" +#ifdef Q_OS_WIN +# include "QtCore/qt_windows.h" +#endif #ifndef QT_NO_LIBRARY diff --git a/src/corelib/plugin/qlibrary_win.cpp b/src/corelib/plugin/qlibrary_win.cpp index 091a6715a9..19a8299b7c 100644 --- a/src/corelib/plugin/qlibrary_win.cpp +++ b/src/corelib/plugin/qlibrary_win.cpp @@ -51,7 +51,7 @@ #pragma message("QT_NO_LIBRARY is not supported on Windows") #endif -#include "qt_windows.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/corelib/plugin/qsystemlibrary_p.h b/src/corelib/plugin/qsystemlibrary_p.h index dbcaf47306..2701d2072d 100644 --- a/src/corelib/plugin/qsystemlibrary_p.h +++ b/src/corelib/plugin/qsystemlibrary_p.h @@ -44,8 +44,8 @@ #include #ifdef Q_OS_WIN -#include -#include +# include +# include QT_BEGIN_NAMESPACE diff --git a/src/corelib/thread/qmutex_p.h b/src/corelib/thread/qmutex_p.h index ec6b24b8bc..3cf0938e94 100644 --- a/src/corelib/thread/qmutex_p.h +++ b/src/corelib/thread/qmutex_p.h @@ -118,8 +118,8 @@ public: bool wakeup; pthread_mutex_t mutex; pthread_cond_t cond; -#elif defined(Q_OS_WIN32) || defined(Q_OS_WINCE) - HANDLE event; +#elif defined(Q_OS_WIN) + Qt::HANDLE event; #endif }; #endif //Q_OS_LINUX diff --git a/src/corelib/thread/qmutex_win.cpp b/src/corelib/thread/qmutex_win.cpp index ec08a043be..1fdf97b0d0 100644 --- a/src/corelib/thread/qmutex_win.cpp +++ b/src/corelib/thread/qmutex_win.cpp @@ -39,11 +39,10 @@ ** ****************************************************************************/ -#include - #include "qmutex.h" #include #include "qmutex_p.h" +#include QT_BEGIN_NAMESPACE diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index c4e2b21d4e..be0a98d3b5 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -52,24 +52,6 @@ #include "qthread_p.h" #include "private/qcoreapplication_p.h" -/* -#ifdef Q_OS_WIN32 -# include "qt_windows.h" -#else -# include -# include -# include -# include -*/ -/* -# elif defined(Q_OS_HPUX) -# include -# elif defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_MAC) -# include -# endif -#endif -*/ - QT_BEGIN_NAMESPACE /* diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index e764a3f729..d8374e9805 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -167,16 +167,13 @@ public: #endif // Q_OS_UNIX -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) - HANDLE handle; - unsigned int id; - int waiters; - +#ifdef Q_OS_WIN static unsigned int __stdcall start(void *); static void finish(void *, bool lockAnyway=true); -#endif // Q_OS_WIN32 -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) + Qt::HANDLE handle; + unsigned int id; + int waiters; bool terminationEnabled, terminatePending; # endif QThreadData *data; diff --git a/src/corelib/thread/qwaitcondition_win.cpp b/src/corelib/thread/qwaitcondition_win.cpp index 9060840dbe..3528d6a0ff 100644 --- a/src/corelib/thread/qwaitcondition_win.cpp +++ b/src/corelib/thread/qwaitcondition_win.cpp @@ -45,13 +45,13 @@ #include "qreadwritelock.h" #include "qlist.h" #include "qalgorithms.h" -#include "qt_windows.h" #ifndef QT_NO_THREAD #define Q_MUTEX_T void* #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 97bcd58c40..25851bfe7f 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -48,16 +48,16 @@ #include "qdatetime.h" #include "qregexp.h" #include "qdebug.h" -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) -#include -#endif #ifndef Q_OS_WIN #include #endif #include -#if defined(Q_OS_WINCE) -#include "qfunctions_wince.h" +#ifdef Q_OS_WIN +# include +# ifdef Q_OS_WINCE +# include "qfunctions_wince.h" +# endif #endif //#define QDATETIMEPARSER_DEBUG diff --git a/src/corelib/tools/qelapsedtimer_win.cpp b/src/corelib/tools/qelapsedtimer_win.cpp index aba61f48eb..b1faf22c3f 100644 --- a/src/corelib/tools/qelapsedtimer_win.cpp +++ b/src/corelib/tools/qelapsedtimer_win.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qelapsedtimer.h" -#include +#include typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void); static PtrGetTickCount64 ptrGetTickCount64 = 0; diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp index 7fd44579d5..e09db5d7e4 100644 --- a/src/corelib/tools/qlocale.cpp +++ b/src/corelib/tools/qlocale.cpp @@ -67,12 +67,12 @@ QT_END_NAMESPACE #include "qstringlist.h" #include "qvariant.h" #include "qstringbuilder.h" -#if defined(Q_OS_WIN) -# include "qt_windows.h" -# include -#endif #include "private/qnumeric_p.h" #include "private/qsystemlibrary_p.h" +#ifdef Q_OS_WIN +# include +# include +#endif QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qlocale_win.cpp b/src/corelib/tools/qlocale_win.cpp index ad0eb7d831..cd9fffc7a5 100644 --- a/src/corelib/tools/qlocale_win.cpp +++ b/src/corelib/tools/qlocale_win.cpp @@ -50,8 +50,8 @@ #include "qdebug.h" -#if defined(Q_OS_WIN) -# include "qt_windows.h" +#ifdef Q_OS_WIN +# include # include #endif diff --git a/src/corelib/tools/qsimd.cpp b/src/corelib/tools/qsimd.cpp index b1a321320d..d65dfa35a6 100644 --- a/src/corelib/tools/qsimd.cpp +++ b/src/corelib/tools/qsimd.cpp @@ -43,15 +43,14 @@ #include #include -#if defined(Q_OS_WINCE) -#include -#endif - -#if defined(Q_OS_WIN64) && !defined(Q_CC_GNU) -#include -#endif - -#if defined(Q_OS_LINUX) && defined(__arm__) +#if defined(Q_OS_WIN) +# if defined(Q_OS_WINCE) +# include +# endif +# if defined(Q_OS_WIN64) && !defined(Q_CC_GNU) +# include +# endif +#elif defined(Q_OS_LINUX) && defined(__arm__) #include "private/qcore_unix_p.h" // the kernel header definitions for HWCAP_* diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index d01b25d6c5..47c4a9952b 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -71,9 +71,6 @@ QT_BEGIN_HEADER # include # undef posix_memalign #else -# ifdef Q_CC_MINGW -# include -# endif # include #endif diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index fd9f934571..c285f7a007 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -64,24 +64,26 @@ #include -#if defined(Q_OS_WINCE) -#include -#include -#endif - #include #include #include #include #include -#ifdef truncate -#undef truncate -#endif - #include "qchar.cpp" #include "qstringmatcher.cpp" +#ifdef Q_OS_WIN +# include +# ifdef Q_OS_WINCE +# include +# endif +#endif + +#ifdef truncate +# undef truncate +#endif + #ifndef LLONG_MAX #define LLONG_MAX qint64_C(9223372036854775807) #endif @@ -4710,12 +4712,6 @@ int QString::localeAwareCompare(const QString &other) const return localeAwareCompare_helper(constData(), length(), other.constData(), other.length()); } -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) -QT_END_NAMESPACE -#include "qt_windows.h" -QT_BEGIN_NAMESPACE -#endif - /*! \internal \since 4.5 diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp index e054711094..6b0ec38f53 100644 --- a/src/gui/image/qpixmap_win.cpp +++ b/src/gui/image/qpixmap_win.cpp @@ -44,8 +44,8 @@ #include "qpixmap_raster_p.h" #include -#include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 4a1a1f041f..f2aac442dc 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -71,17 +71,17 @@ // #include "qbezier_p.h" #include "qoutlinemapper_p.h" -#if defined(Q_OS_WIN) -# include +#include + +#ifdef Q_OS_WIN # include # include +# include +#ifdef Q_OS_WIN64 +# include +# endif #endif -#if defined(Q_OS_WIN64) -# include -#endif -#include - QT_BEGIN_NAMESPACE Q_GUI_EXPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 189e111f38..3ef28b8e50 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -552,11 +552,6 @@ public: struct ApplicationFont { QString fileName; QByteArray data; -#if defined(Q_OS_WIN) - HANDLE handle; - bool memoryFont; - QVector signatures; -#endif QStringList families; }; QVector applicationFonts; diff --git a/src/network/kernel/qdnslookup_win.cpp b/src/network/kernel/qdnslookup_win.cpp index 97a82de43c..ba97e64942 100644 --- a/src/network/kernel/qdnslookup_win.cpp +++ b/src/network/kernel/qdnslookup_win.cpp @@ -45,7 +45,7 @@ #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/network/kernel/qnetworkproxy_win.cpp b/src/network/kernel/qnetworkproxy_win.cpp index a4708e1ecc..6969a9effd 100644 --- a/src/network/kernel/qnetworkproxy_win.cpp +++ b/src/network/kernel/qnetworkproxy_win.cpp @@ -47,11 +47,11 @@ #include #include #include +#include #include #include #include -#include /* * Information on the WinHTTP DLL: diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h index ca9d0f6864..44114481df 100644 --- a/src/network/ssl/qsslsocket_p.h +++ b/src/network/ssl/qsslsocket_p.h @@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE typedef OSStatus (*PtrSecTrustSettingsCopyCertificates)(int, CFArrayRef*); typedef OSStatus (*PtrSecTrustCopyAnchorCertificates)(CFArrayRef*); #elif defined(Q_OS_WIN) -#include +#include #include #ifndef HCRYPTPROV_LEGACY #define HCRYPTPROV_LEGACY HCRYPTPROV diff --git a/src/printsupport/kernel/qprintengine_win_p.h b/src/printsupport/kernel/qprintengine_win_p.h index 2962429306..baf8ccefce 100644 --- a/src/printsupport/kernel/qprintengine_win_p.h +++ b/src/printsupport/kernel/qprintengine_win_p.h @@ -55,12 +55,11 @@ #ifndef QT_NO_PRINTER -#include "qt_windows.h" - #include #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index da734c80f0..e5a24075d9 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -45,6 +45,7 @@ #ifndef QT_NO_FILEDIALOG #include "qfiledialog_p.h" +#include "qplatformdialoghelper_qpa.h" #include #include #include @@ -67,11 +68,12 @@ #if defined(Q_OS_WINCE) extern bool qt_priv_ptr_valid; #endif +#endif #if defined(Q_OS_UNIX) #include +#elif defined(Q_OS_WIN) +# include #endif -#endif -#include "qplatformdialoghelper_qpa.h" QT_BEGIN_NAMESPACE @@ -1386,6 +1388,25 @@ QLineEdit *QFileDialogPrivate::lineEdit() const { return (QLineEdit*)qFileDialogUi->fileNameEdit; } +int QFileDialogPrivate::maxNameLength(const QString &path) +{ +#if defined(Q_OS_UNIX) + return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX); +#elif defined(Q_OS_WINCE) + Q_UNUSED(path); + return MAX_PATH; +#elif defined(Q_OS_WIN) + DWORD maxLength; + const QString drive = path.left(3); + if (::GetVolumeInformation(reinterpret_cast(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE) + return -1; + return maxLength; +#else + Q_UNUSED(path); +#endif + return -1; +} + /* Sets the view root index to be the file system model index */ diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h index 12b2b9a755..a66ee757f6 100644 --- a/src/widgets/dialogs/qfiledialog_p.h +++ b/src/widgets/dialogs/qfiledialog_p.h @@ -143,25 +143,7 @@ public: QLineEdit *lineEdit() const; - int maxNameLength(const QString &path) { -#if defined(Q_OS_UNIX) - return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX); -#elif defined(Q_OS_WIN) -#ifndef Q_OS_WINCE - DWORD maxLength; - QString drive = path.left(3); - if (::GetVolumeInformation(reinterpret_cast(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE) - return -1; - return maxLength; -#else - Q_UNUSED(path); - return MAX_PATH; -#endif //Q_OS_WINCE -#else - Q_UNUSED(path); -#endif - return -1; - } + static int maxNameLength(const QString &path); QString basename(const QString &path) const { diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 3d26594a00..7ea4302a56 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -49,10 +49,8 @@ #include #ifdef Q_OS_WIN -#include -#endif -#ifdef Q_OS_WIN32 -#include +# include +# include #endif QT_BEGIN_NAMESPACE diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h index 2d567feab4..80b5fd8241 100644 --- a/src/widgets/dialogs/qwizard_win_p.h +++ b/src/widgets/dialogs/qwizard_win_p.h @@ -56,12 +56,12 @@ #ifndef QT_NO_WIZARD #ifndef QT_NO_STYLE_WINDOWSVISTA -#include #include #include #include #include #include +#include QT_BEGIN_NAMESPACE diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp index 0da942eba0..dd52aebea5 100644 --- a/src/widgets/itemviews/qfileiconprovider.cpp +++ b/src/widgets/itemviews/qfileiconprovider.cpp @@ -46,6 +46,9 @@ #include #include #include +#include +#include + #if defined(Q_OS_WIN) # define _WIN32_IE 0x0500 # include @@ -56,9 +59,6 @@ # include #endif -#include -#include - #if defined(Q_WS_X11) && !defined(Q_NO_STYLE_GTK) # include # include diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp index f17e2e10dd..e3429dc17c 100644 --- a/src/widgets/kernel/qapplication_qpa.cpp +++ b/src/widgets/kernel/qapplication_qpa.cpp @@ -64,6 +64,10 @@ #include "qdesktopwidget_qpa_p.h" #include "qwidgetwindow_qpa_p.h" +#ifdef Q_OS_WIN +# include // for qt_win_display_dc() +#endif + QT_BEGIN_NAMESPACE static QString appName; @@ -398,6 +402,7 @@ void qt_init(QApplicationPrivate *priv, int type) } #ifdef Q_OS_WIN +// #fixme: Remove. static HDC displayDC = 0; // display device context Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display DC diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 9310622a5b..321a374652 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -60,9 +60,6 @@ #ifndef QT_NO_ACCESSIBILITY # include "qaccessible.h" #endif -#if defined(Q_WS_WIN) -# include "qt_windows.h" -#endif #ifdef Q_WS_MAC # include "qt_mac_p.h" # include "qt_cocoa_helpers_mac_p.h" diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp index ba9aa155fc..03ec21680d 100644 --- a/src/widgets/widgets/qabstractscrollarea.cpp +++ b/src/widgets/widgets/qabstractscrollarea.cpp @@ -64,9 +64,9 @@ #include #include #endif -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN # include -# include +# include #endif QT_BEGIN_NAMESPACE diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp index 4d326737ee..145bdf02d4 100644 --- a/src/widgets/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -52,12 +52,6 @@ #include "qdebug.h" #include -#if defined(Q_WS_X11) -#include -#elif defined (Q_OS_WIN) -# include -# include "private/qapplication_p.h" -#endif #ifdef Q_WS_MAC #include #endif @@ -65,6 +59,11 @@ #include #include +#ifdef Q_OS_WIN +# include +# include "private/qapplication_p.h" +#endif + QT_BEGIN_NAMESPACE #if defined (Q_OS_WIN) diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp index 63cf7080cd..aba0ca58c6 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -48,9 +48,6 @@ #include "qcursor.h" #include "qsizegrip.h" #include "qevent.h" -#if defined(Q_WS_WIN) -#include "qt_windows.h" -#endif #include "qdebug.h" #include "private/qlayoutengine_p.h" diff --git a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp index 73919ce4df..d74e1b1e89 100644 --- a/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp +++ b/tests/auto/network/kernel/qhostaddress/tst_qhostaddress.cpp @@ -48,6 +48,9 @@ #include #include #include +#ifdef Q_OS_WIN +# include +#endif class tst_QHostAddress : public QObject { -- cgit v1.2.3