Windows: Fix inclusion of <windows.h>

- Always use <qt_windows.h> 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 <windows.h> from qplatformdefs.h (VS2005)

Change-Id: Ic44e2cb3eafce38e1ad645c3bf85745439398e50
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
This commit is contained in:
Friedemann Kleint 2012-02-01 10:19:07 +01:00 committed by Qt by Nokia
parent 9fa4e51dbb
commit b44e67e1ca
54 changed files with 152 additions and 190 deletions

View File

@ -64,7 +64,6 @@
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <stdlib.h> #include <stdlib.h>
#include <windows.h>
#define Q_FS_FAT #define Q_FS_FAT
#ifdef QT_LARGEFILE_SUPPORT #ifdef QT_LARGEFILE_SUPPORT

View File

@ -60,10 +60,6 @@
#include <private/qobject_p.h> #include <private/qobject_p.h>
#include <qabstractanimation.h> #include <qabstractanimation.h>
#ifdef Q_OS_WIN
#include <qt_windows.h>
#endif
#ifndef QT_NO_ANIMATION #ifndef QT_NO_ANIMATION
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -85,8 +85,11 @@
#include <langinfo.h> #include <langinfo.h>
#endif #endif
#if defined(Q_OS_WINCE) #ifdef Q_OS_WIN
# include <qt_windows.h>
# if defined(Q_OS_WINCE)
# define QT_NO_SETLOCALE # define QT_NO_SETLOCALE
# endif
#endif #endif

View File

@ -60,6 +60,7 @@
#endif #endif
#endif #endif
#define NOMINMAX
#include <windows.h> #include <windows.h>
#ifdef _WIN32_WCE #ifdef _WIN32_WCE

View File

@ -59,10 +59,11 @@
#include <QtCore/qabstractfileengine.h> #include <QtCore/qabstractfileengine.h>
// Platform-specific includes // Platform-specific includes
#if defined(Q_OS_WIN) #ifdef Q_OS_WIN
#ifndef IO_REPARSE_TAG_SYMLINK # include <QtCore/qt_windows.h>
#define IO_REPARSE_TAG_SYMLINK (0xA000000CL) # ifndef IO_REPARSE_TAG_SYMLINK
#endif # define IO_REPARSE_TAG_SYMLINK (0xA000000CL)
# endif
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -52,8 +52,15 @@
#include <qdir.h> #include <qdir.h>
#include <qtextstream.h> #include <qtextstream.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
QWindowsFileSystemWatcherEngine::Handle::Handle()
: handle(INVALID_HANDLE_VALUE), flags(0u)
{
}
QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine() QWindowsFileSystemWatcherEngine::~QWindowsFileSystemWatcherEngine()
{ {
foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) { foreach(QWindowsFileSystemWatcherEngineThread *thread, threads) {

View File

@ -57,8 +57,6 @@
#ifndef QT_NO_FILESYSTEMWATCHER #ifndef QT_NO_FILESYSTEMWATCHER
#include <qt_windows.h>
#include <QtCore/qdatetime.h> #include <QtCore/qdatetime.h>
#include <QtCore/qthread.h> #include <QtCore/qthread.h>
#include <QtCore/qfile.h> #include <QtCore/qfile.h>
@ -90,15 +88,10 @@ public:
class Handle class Handle
{ {
public: public:
HANDLE handle; Qt::HANDLE handle;
uint flags; uint flags;
Handle() Handle();
: handle(INVALID_HANDLE_VALUE), flags(0u)
{ }
Handle(const Handle &other)
: handle(other.handle), flags(other.flags)
{ }
}; };
class PathInfo { class PathInfo {
@ -147,12 +140,12 @@ public:
void wakeup(); void wakeup();
QMutex mutex; QMutex mutex;
QVector<HANDLE> handles; QVector<Qt::HANDLE> handles;
int msg; int msg;
QHash<QString, QWindowsFileSystemWatcherEngine::Handle> handleForDir; QHash<QString, QWindowsFileSystemWatcherEngine::Handle> handleForDir;
QHash<HANDLE, QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> > pathInfoForHandle; QHash<Qt::HANDLE, QHash<QString, QWindowsFileSystemWatcherEngine::PathInfo> > pathInfoForHandle;
Q_SIGNALS: Q_SIGNALS:
void fileChanged(const QString &path, bool removed); void fileChanged(const QString &path, bool removed);

View File

@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_PROCESS #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; typedef qint64 Q_PID;
#else #else
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -68,17 +68,17 @@
#include "qcoreapplication.h" #include "qcoreapplication.h"
#endif #endif
#ifdef Q_OS_WIN // for homedirpath reading from registry
#include "qt_windows.h"
#include <private/qsystemlibrary_p.h>
#endif
#ifdef Q_OS_VXWORKS #ifdef Q_OS_VXWORKS
# include <ioLib.h> # include <ioLib.h>
#endif #endif
#include <stdlib.h> #include <stdlib.h>
#ifdef Q_OS_WIN // for homedirpath reading from registry
# include <private/qsystemlibrary_p.h>
# include <qt_windows.h>
#endif
#ifndef CSIDL_COMMON_APPDATA #ifndef CSIDL_COMMON_APPDATA
#define CSIDL_COMMON_APPDATA 0x0023 // All Users\Application Data #define CSIDL_COMMON_APPDATA 0x0023 // All Users\Application Data
#endif #endif

View File

@ -64,10 +64,6 @@
#endif #endif
#include "private/qscopedpointer_p.h" #include "private/qscopedpointer_p.h"
#ifdef Q_OS_WIN
#include "QtCore/qt_windows.h"
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#define QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER #define QT_QSETTINGS_ALWAYS_CASE_SENSITIVE_AND_FORGET_ORIGINAL_KEY_ORDER

View File

@ -46,8 +46,8 @@
#include "qsettings_p.h" #include "qsettings_p.h"
#include "qvector.h" #include "qvector.h"
#include "qmap.h" #include "qmap.h"
#include "qt_windows.h"
#include "qdebug.h" #include "qdebug.h"
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -53,8 +53,8 @@
#include <stdlib.h> // mkdtemp #include <stdlib.h> // mkdtemp
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <windows.h>
#include <private/qfsfileengine_p.h> #include <private/qfsfileengine_p.h>
#include <qt_windows.h>
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -56,10 +56,10 @@
#include <qbytearray.h> #include <qbytearray.h>
#include <qobject.h> #include <qobject.h>
#include <qtimer.h> #include <qtimer.h>
#include <qt_windows.h>
#include <private/qringbuffer_p.h> #include <private/qringbuffer_p.h>
#include <qt_windows.h>
QT_BEGIN_HEADER QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -42,13 +42,13 @@
#include "qcoreapplication.h" #include "qcoreapplication.h"
#include "qcoreapplication_p.h" #include "qcoreapplication_p.h"
#include "qstringlist.h" #include "qstringlist.h"
#include "qt_windows.h"
#include "qvector.h" #include "qvector.h"
#include "qmutex.h" #include "qmutex.h"
#include "qfileinfo.h" #include "qfileinfo.h"
#include "qcorecmdlineargs_p.h" #include "qcorecmdlineargs_p.h"
#include <private/qthread_p.h> #include <private/qthread_p.h>
#include <ctype.h> #include <ctype.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -58,13 +58,11 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) #ifdef Q_OS_WIN
QT_BEGIN_INCLUDE_NAMESPACE QT_BEGIN_INCLUDE_NAMESPACE
#include "QtCore/qvector.h" # include "QtCore/qvector.h"
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) # include <qt_windows.h>
# include "qt_windows.h"
#endif
QT_END_INCLUDE_NAMESPACE QT_END_INCLUDE_NAMESPACE
// template implementation of the parsing algorithm // template implementation of the parsing algorithm
@ -132,7 +130,6 @@ static QVector<Char*> qWinCmdLine(Char *cmdParam, int length, int &argc)
return argv; return argv;
} }
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
static inline QStringList qWinCmdArgs(QString cmdLine) // not const-ref: this might be modified static inline QStringList qWinCmdArgs(QString cmdLine) // not const-ref: this might be modified
{ {
QStringList args; QStringList args;
@ -153,7 +150,7 @@ static inline QStringList qCmdLineArgs(int argc, char *argv[])
QString cmdLine = QString::fromWCharArray(GetCommandLine()); QString cmdLine = QString::fromWCharArray(GetCommandLine());
return qWinCmdArgs(cmdLine); return qWinCmdArgs(cmdLine);
} }
#endif
#else // !Q_OS_WIN #else // !Q_OS_WIN
static inline QStringList qCmdLineArgs(int argc, char *argv[]) static inline QStringList qCmdLineArgs(int argc, char *argv[])

View File

@ -45,6 +45,9 @@
#include <qdir.h> #include <qdir.h>
#include <qcryptographichash.h> #include <qcryptographichash.h>
#include <qdebug.h> #include <qdebug.h>
#ifdef Q_OS_WIN
# include <qt_windows.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -69,10 +69,8 @@ namespace QSharedMemoryPrivate
#include "qsystemsemaphore.h" #include "qsystemsemaphore.h"
#include "private/qobject_p.h" #include "private/qobject_p.h"
#ifdef Q_OS_WIN #ifndef Q_OS_WIN
#include <qt_windows.h> # include <sys/sem.h>
#else
#include <sys/sem.h>
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -131,7 +129,7 @@ public:
static QString makePlatformSafeKey(const QString &key, static QString makePlatformSafeKey(const QString &key,
const QString &prefix = QLatin1String("qipc_sharedmemory_")); const QString &prefix = QLatin1String("qipc_sharedmemory_"));
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
HANDLE handle(); Qt::HANDLE handle();
#else #else
key_t handle(); key_t handle();
#endif #endif
@ -156,7 +154,7 @@ public:
private: private:
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
HANDLE hand; Qt::HANDLE hand;
#else #else
key_t unix_key; key_t unix_key;
#endif #endif

View File

@ -43,6 +43,7 @@
#include "qsharedmemory_p.h" #include "qsharedmemory_p.h"
#include "qsystemsemaphore.h" #include "qsystemsemaphore.h"
#include <qdebug.h> #include <qdebug.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -52,7 +52,7 @@
# endif # endif
#endif #endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <windows.h> # include <qt_windows.h>
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -76,7 +76,7 @@ public:
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
HANDLE handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open); Qt::HANDLE handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open);
void setErrorString(const QString &function); void setErrorString(const QString &function);
#else #else
key_t handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open); key_t handle(QSystemSemaphore::AccessMode mode = QSystemSemaphore::Open);
@ -89,8 +89,8 @@ public:
QString fileName; QString fileName;
int initialValue; int initialValue;
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
HANDLE semaphore; Qt::HANDLE semaphore;
HANDLE semaphoreLock; Qt::HANDLE semaphoreLock;
#else #else
int semaphore; int semaphore;
bool createdFile; bool createdFile;

View File

@ -43,6 +43,7 @@
#include "qsystemsemaphore_p.h" #include "qsystemsemaphore_p.h"
#include "qcoreapplication.h" #include "qcoreapplication.h"
#include <qdebug.h> #include <qdebug.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -53,14 +53,14 @@
// We mean it. // We mean it.
// //
#ifdef Q_OS_WIN
# include "QtCore/qt_windows.h"
#endif
#include "QtCore/qlibrary.h" #include "QtCore/qlibrary.h"
#include "QtCore/qpointer.h" #include "QtCore/qpointer.h"
#include "QtCore/qstringlist.h" #include "QtCore/qstringlist.h"
#include "QtCore/qplugin.h" #include "QtCore/qplugin.h"
#include "QtCore/qsharedpointer.h" #include "QtCore/qsharedpointer.h"
#ifdef Q_OS_WIN
# include "QtCore/qt_windows.h"
#endif
#ifndef QT_NO_LIBRARY #ifndef QT_NO_LIBRARY

View File

@ -51,7 +51,7 @@
#pragma message("QT_NO_LIBRARY is not supported on Windows") #pragma message("QT_NO_LIBRARY is not supported on Windows")
#endif #endif
#include "qt_windows.h" #include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -44,8 +44,8 @@
#include <QtCore/qglobal.h> #include <QtCore/qglobal.h>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <qt_windows.h> # include <QtCore/qstring.h>
#include <QtCore/qstring.h> # include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -118,8 +118,8 @@ public:
bool wakeup; bool wakeup;
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cond; pthread_cond_t cond;
#elif defined(Q_OS_WIN32) || defined(Q_OS_WINCE) #elif defined(Q_OS_WIN)
HANDLE event; Qt::HANDLE event;
#endif #endif
}; };
#endif //Q_OS_LINUX #endif //Q_OS_LINUX

View File

@ -39,11 +39,10 @@
** **
****************************************************************************/ ****************************************************************************/
#include <qt_windows.h>
#include "qmutex.h" #include "qmutex.h"
#include <qatomic.h> #include <qatomic.h>
#include "qmutex_p.h" #include "qmutex_p.h"
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -52,24 +52,6 @@
#include "qthread_p.h" #include "qthread_p.h"
#include "private/qcoreapplication_p.h" #include "private/qcoreapplication_p.h"
/*
#ifdef Q_OS_WIN32
# include "qt_windows.h"
#else
# include <unistd.h>
# include <netinet/in.h>
# include <sys/utsname.h>
# include <sys/socket.h>
*/
/*
# elif defined(Q_OS_HPUX)
# include <sys/pstat.h>
# elif defined(Q_OS_FREEBSD) || defined(Q_OS_OPENBSD) || defined(Q_OS_MAC)
# include <sys/sysctl.h>
# endif
#endif
*/
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
/* /*

View File

@ -167,16 +167,13 @@ public:
#endif // Q_OS_UNIX #endif // Q_OS_UNIX
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) #ifdef Q_OS_WIN
HANDLE handle;
unsigned int id;
int waiters;
static unsigned int __stdcall start(void *); static unsigned int __stdcall start(void *);
static void finish(void *, bool lockAnyway=true); 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; bool terminationEnabled, terminatePending;
# endif # endif
QThreadData *data; QThreadData *data;

View File

@ -45,13 +45,13 @@
#include "qreadwritelock.h" #include "qreadwritelock.h"
#include "qlist.h" #include "qlist.h"
#include "qalgorithms.h" #include "qalgorithms.h"
#include "qt_windows.h"
#ifndef QT_NO_THREAD #ifndef QT_NO_THREAD
#define Q_MUTEX_T void* #define Q_MUTEX_T void*
#include <private/qmutex_p.h> #include <private/qmutex_p.h>
#include <private/qreadwritelock_p.h> #include <private/qreadwritelock_p.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -48,16 +48,16 @@
#include "qdatetime.h" #include "qdatetime.h"
#include "qregexp.h" #include "qregexp.h"
#include "qdebug.h" #include "qdebug.h"
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
#include <qt_windows.h>
#endif
#ifndef Q_OS_WIN #ifndef Q_OS_WIN
#include <locale.h> #include <locale.h>
#endif #endif
#include <time.h> #include <time.h>
#if defined(Q_OS_WINCE) #ifdef Q_OS_WIN
#include "qfunctions_wince.h" # include <qt_windows.h>
# ifdef Q_OS_WINCE
# include "qfunctions_wince.h"
# endif
#endif #endif
//#define QDATETIMEPARSER_DEBUG //#define QDATETIMEPARSER_DEBUG

View File

@ -40,7 +40,7 @@
****************************************************************************/ ****************************************************************************/
#include "qelapsedtimer.h" #include "qelapsedtimer.h"
#include <windows.h> #include <qt_windows.h>
typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void); typedef ULONGLONG (WINAPI *PtrGetTickCount64)(void);
static PtrGetTickCount64 ptrGetTickCount64 = 0; static PtrGetTickCount64 ptrGetTickCount64 = 0;

View File

@ -67,12 +67,12 @@ QT_END_NAMESPACE
#include "qstringlist.h" #include "qstringlist.h"
#include "qvariant.h" #include "qvariant.h"
#include "qstringbuilder.h" #include "qstringbuilder.h"
#if defined(Q_OS_WIN)
# include "qt_windows.h"
# include <time.h>
#endif
#include "private/qnumeric_p.h" #include "private/qnumeric_p.h"
#include "private/qsystemlibrary_p.h" #include "private/qsystemlibrary_p.h"
#ifdef Q_OS_WIN
# include <qt_windows.h>
# include <time.h>
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -50,8 +50,8 @@
#include "qdebug.h" #include "qdebug.h"
#if defined(Q_OS_WIN) #ifdef Q_OS_WIN
# include "qt_windows.h" # include <qt_windows.h>
# include <time.h> # include <time.h>
#endif #endif

View File

@ -43,15 +43,14 @@
#include <QByteArray> #include <QByteArray>
#include <stdio.h> #include <stdio.h>
#if defined(Q_OS_WINCE) #if defined(Q_OS_WIN)
#include <windows.h> # if defined(Q_OS_WINCE)
#endif # include <qt_windows.h>
# endif
#if defined(Q_OS_WIN64) && !defined(Q_CC_GNU) # if defined(Q_OS_WIN64) && !defined(Q_CC_GNU)
#include <intrin.h> # include <intrin.h>
#endif # endif
#elif defined(Q_OS_LINUX) && defined(__arm__)
#if defined(Q_OS_LINUX) && defined(__arm__)
#include "private/qcore_unix_p.h" #include "private/qcore_unix_p.h"
// the kernel header definitions for HWCAP_* // the kernel header definitions for HWCAP_*

View File

@ -71,9 +71,6 @@ QT_BEGIN_HEADER
# include <emmintrin.h> # include <emmintrin.h>
# undef posix_memalign # undef posix_memalign
#else #else
# ifdef Q_CC_MINGW
# include <windows.h>
# endif
# include <emmintrin.h> # include <emmintrin.h>
#endif #endif

View File

@ -64,24 +64,26 @@
#include <private/qfunctions_p.h> #include <private/qfunctions_p.h>
#if defined(Q_OS_WINCE)
#include <windows.h>
#include <winnls.h>
#endif
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#ifdef truncate
#undef truncate
#endif
#include "qchar.cpp" #include "qchar.cpp"
#include "qstringmatcher.cpp" #include "qstringmatcher.cpp"
#ifdef Q_OS_WIN
# include <qt_windows.h>
# ifdef Q_OS_WINCE
# include <winnls.h>
# endif
#endif
#ifdef truncate
# undef truncate
#endif
#ifndef LLONG_MAX #ifndef LLONG_MAX
#define LLONG_MAX qint64_C(9223372036854775807) #define LLONG_MAX qint64_C(9223372036854775807)
#endif #endif
@ -4710,12 +4712,6 @@ int QString::localeAwareCompare(const QString &other) const
return localeAwareCompare_helper(constData(), length(), other.constData(), other.length()); 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 \internal
\since 4.5 \since 4.5

View File

@ -44,8 +44,8 @@
#include "qpixmap_raster_p.h" #include "qpixmap_raster_p.h"
#include <qglobal.h> #include <qglobal.h>
#include <qt_windows.h>
#include <QScopedArrayPointer> #include <QScopedArrayPointer>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -71,16 +71,16 @@
// #include "qbezier_p.h" // #include "qbezier_p.h"
#include "qoutlinemapper_p.h" #include "qoutlinemapper_p.h"
#if defined(Q_OS_WIN) #include <limits.h>
# include <qt_windows.h>
#ifdef Q_OS_WIN
# include <qvarlengtharray.h> # include <qvarlengtharray.h>
# include <private/qfontengine_p.h> # include <private/qfontengine_p.h>
#endif # include <qt_windows.h>
#ifdef Q_OS_WIN64
#if defined(Q_OS_WIN64)
# include <malloc.h> # include <malloc.h>
# endif
#endif #endif
#include <limits.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -552,11 +552,6 @@ public:
struct ApplicationFont { struct ApplicationFont {
QString fileName; QString fileName;
QByteArray data; QByteArray data;
#if defined(Q_OS_WIN)
HANDLE handle;
bool memoryFont;
QVector<FONTSIGNATURE> signatures;
#endif
QStringList families; QStringList families;
}; };
QVector<ApplicationFont> applicationFonts; QVector<ApplicationFont> applicationFonts;

View File

@ -45,7 +45,7 @@
#include <private/qmutexpool_p.h> #include <private/qmutexpool_p.h>
#include <private/qsystemlibrary_p.h> #include <private/qsystemlibrary_p.h>
#include <windows.h> #include <qt_windows.h>
#include <windns.h> #include <windns.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -47,11 +47,11 @@
#include <qstringlist.h> #include <qstringlist.h>
#include <qregexp.h> #include <qregexp.h>
#include <qurl.h> #include <qurl.h>
#include <private/qsystemlibrary_p.h>
#include <string.h> #include <string.h>
#include <qt_windows.h> #include <qt_windows.h>
#include <wininet.h> #include <wininet.h>
#include <private/qsystemlibrary_p.h>
/* /*
* Information on the WinHTTP DLL: * Information on the WinHTTP DLL:

View File

@ -73,7 +73,7 @@ QT_BEGIN_NAMESPACE
typedef OSStatus (*PtrSecTrustSettingsCopyCertificates)(int, CFArrayRef*); typedef OSStatus (*PtrSecTrustSettingsCopyCertificates)(int, CFArrayRef*);
typedef OSStatus (*PtrSecTrustCopyAnchorCertificates)(CFArrayRef*); typedef OSStatus (*PtrSecTrustCopyAnchorCertificates)(CFArrayRef*);
#elif defined(Q_OS_WIN) #elif defined(Q_OS_WIN)
#include <windows.h> #include <QtCore/qt_windows.h>
#include <wincrypt.h> #include <wincrypt.h>
#ifndef HCRYPTPROV_LEGACY #ifndef HCRYPTPROV_LEGACY
#define HCRYPTPROV_LEGACY HCRYPTPROV #define HCRYPTPROV_LEGACY HCRYPTPROV

View File

@ -55,12 +55,11 @@
#ifndef QT_NO_PRINTER #ifndef QT_NO_PRINTER
#include "qt_windows.h"
#include <QtGui/qpaintengine.h> #include <QtGui/qpaintengine.h>
#include <QtPrintSupport/QPrintEngine> #include <QtPrintSupport/QPrintEngine>
#include <QtPrintSupport/QPrinter> #include <QtPrintSupport/QPrinter>
#include <private/qpaintengine_alpha_p.h> #include <private/qpaintengine_alpha_p.h>
#include <QtCore/qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -45,6 +45,7 @@
#ifndef QT_NO_FILEDIALOG #ifndef QT_NO_FILEDIALOG
#include "qfiledialog_p.h" #include "qfiledialog_p.h"
#include "qplatformdialoghelper_qpa.h"
#include <private/qguiapplication_p.h> #include <private/qguiapplication_p.h>
#include <qfontmetrics.h> #include <qfontmetrics.h>
#include <qaction.h> #include <qaction.h>
@ -67,11 +68,12 @@
#if defined(Q_OS_WINCE) #if defined(Q_OS_WINCE)
extern bool qt_priv_ptr_valid; extern bool qt_priv_ptr_valid;
#endif #endif
#endif
#if defined(Q_OS_UNIX) #if defined(Q_OS_UNIX)
#include <pwd.h> #include <pwd.h>
#elif defined(Q_OS_WIN)
# include <QtCore/qt_windows.h>
#endif #endif
#endif
#include "qplatformdialoghelper_qpa.h"
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -1386,6 +1388,25 @@ QLineEdit *QFileDialogPrivate::lineEdit() const {
return (QLineEdit*)qFileDialogUi->fileNameEdit; 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<const wchar_t *>(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 Sets the view root index to be the file system model index
*/ */

View File

@ -143,25 +143,7 @@ public:
QLineEdit *lineEdit() const; QLineEdit *lineEdit() const;
int maxNameLength(const QString &path) { static 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<const wchar_t *>(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;
}
QString basename(const QString &path) const QString basename(const QString &path) const
{ {

View File

@ -49,10 +49,8 @@
#include <qapplication.h> #include <qapplication.h>
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <qt_windows.h> # include <QtCore/QVarLengthArray>
#endif # include <qt_windows.h>
#ifdef Q_OS_WIN32
#include <QtCore/QVarLengthArray>
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -56,12 +56,12 @@
#ifndef QT_NO_WIZARD #ifndef QT_NO_WIZARD
#ifndef QT_NO_STYLE_WINDOWSVISTA #ifndef QT_NO_STYLE_WINDOWSVISTA
#include <qt_windows.h>
#include <qobject.h> #include <qobject.h>
#include <qwidget.h> #include <qwidget.h>
#include <qabstractbutton.h> #include <qabstractbutton.h>
#include <QtWidgets/private/qwidget_p.h> #include <QtWidgets/private/qwidget_p.h>
#include <QtWidgets/private/qstylehelper_p.h> #include <QtWidgets/private/qstylehelper_p.h>
#include <qt_windows.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -46,6 +46,9 @@
#include <qapplication.h> #include <qapplication.h>
#include <qdir.h> #include <qdir.h>
#include <qpixmapcache.h> #include <qpixmapcache.h>
#include <private/qfunctions_p.h>
#include <private/qguiplatformplugin_p.h>
#if defined(Q_OS_WIN) #if defined(Q_OS_WIN)
# define _WIN32_IE 0x0500 # define _WIN32_IE 0x0500
# include <qt_windows.h> # include <qt_windows.h>
@ -56,9 +59,6 @@
# include <private/qt_cocoa_helpers_mac_p.h> # include <private/qt_cocoa_helpers_mac_p.h>
#endif #endif
#include <private/qfunctions_p.h>
#include <private/qguiplatformplugin_p.h>
#if defined(Q_WS_X11) && !defined(Q_NO_STYLE_GTK) #if defined(Q_WS_X11) && !defined(Q_NO_STYLE_GTK)
# include <private/qgtkstyle_p.h> # include <private/qgtkstyle_p.h>
# include <private/qt_x11_p.h> # include <private/qt_x11_p.h>

View File

@ -64,6 +64,10 @@
#include "qdesktopwidget_qpa_p.h" #include "qdesktopwidget_qpa_p.h"
#include "qwidgetwindow_qpa_p.h" #include "qwidgetwindow_qpa_p.h"
#ifdef Q_OS_WIN
# include <QtCore/qt_windows.h> // for qt_win_display_dc()
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
static QString appName; static QString appName;
@ -398,6 +402,7 @@ void qt_init(QApplicationPrivate *priv, int type)
} }
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
// #fixme: Remove.
static HDC displayDC = 0; // display device context static HDC displayDC = 0; // display device context
Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display DC Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display DC

View File

@ -60,9 +60,6 @@
#ifndef QT_NO_ACCESSIBILITY #ifndef QT_NO_ACCESSIBILITY
# include "qaccessible.h" # include "qaccessible.h"
#endif #endif
#if defined(Q_WS_WIN)
# include "qt_windows.h"
#endif
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
# include "qt_mac_p.h" # include "qt_mac_p.h"
# include "qt_cocoa_helpers_mac_p.h" # include "qt_cocoa_helpers_mac_p.h"

View File

@ -64,9 +64,9 @@
#include <private/qt_mac_p.h> #include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h> #include <private/qt_cocoa_helpers_mac_p.h>
#endif #endif
#ifdef Q_WS_WIN #ifdef Q_OS_WIN
# include <qlibrary.h> # include <qlibrary.h>
# include <windows.h> # include <qt_windows.h>
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE

View File

@ -52,12 +52,6 @@
#include "qdebug.h" #include "qdebug.h"
#include <QDesktopWidget> #include <QDesktopWidget>
#if defined(Q_WS_X11)
#include <private/qt_x11_p.h>
#elif defined (Q_OS_WIN)
# include <QtCore/qt_windows.h>
# include "private/qapplication_p.h"
#endif
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
#include <private/qt_mac_p.h> #include <private/qt_mac_p.h>
#endif #endif
@ -65,6 +59,11 @@
#include <private/qwidget_p.h> #include <private/qwidget_p.h>
#include <QtWidgets/qabstractscrollarea.h> #include <QtWidgets/qabstractscrollarea.h>
#ifdef Q_OS_WIN
# include <QtCore/qt_windows.h>
# include "private/qapplication_p.h"
#endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
#if defined (Q_OS_WIN) #if defined (Q_OS_WIN)

View File

@ -48,9 +48,6 @@
#include "qcursor.h" #include "qcursor.h"
#include "qsizegrip.h" #include "qsizegrip.h"
#include "qevent.h" #include "qevent.h"
#if defined(Q_WS_WIN)
#include "qt_windows.h"
#endif
#include "qdebug.h" #include "qdebug.h"
#include "private/qlayoutengine_p.h" #include "private/qlayoutengine_p.h"

View File

@ -48,6 +48,9 @@
#include <qhash.h> #include <qhash.h>
#include <qbytearray.h> #include <qbytearray.h>
#include <qdatastream.h> #include <qdatastream.h>
#ifdef Q_OS_WIN
# include <qt_windows.h>
#endif
class tst_QHostAddress : public QObject class tst_QHostAddress : public QObject
{ {