WinRT: Basic global support
Various global changes, primarily preprocessor flow, to support the WinRT platform. Change-Id: I3fa9cf91d5fb24019362e88fcf205e31b4f810b5 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
This commit is contained in:
parent
7e2b238c50
commit
d959c37eaa
@ -123,7 +123,7 @@ for(QT_CURRENT_VERIFY, $$list($$QT_PLUGIN_VERIFY)) {
|
||||
# if the plugin is linked statically there is no need to deploy it
|
||||
DEPLOYMENT_PLUGIN -= $$QT_CURRENT_VERIFY
|
||||
}
|
||||
isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:wince*: {
|
||||
isEqual(QT_CURRENT_VERIFY, DEPLOYMENT_PLUGIN):shared:if(wince*|winrt): {
|
||||
QT_ITEM =
|
||||
debug: QT_ITEM = $${QTPLUG}d4.dll
|
||||
else: QT_ITEM = $${QTPLUG}4.dll
|
||||
|
@ -188,7 +188,7 @@ QT_CPU_FEATURES = $$eval(QT_CPU_FEATURES.$$QT_ARCH)
|
||||
silent:mips_dspr2_assembler.commands = @echo assembling[mips_dspr2] ${QMAKE_FILE_IN} && $$mips_dspr2_assembler.commands
|
||||
QMAKE_EXTRA_COMPILERS += mips_dspr2_assembler
|
||||
}
|
||||
} else:win32-msvc* {
|
||||
} else:win32-msvc*|winrt {
|
||||
sse2 {
|
||||
HEADERS += $$SSE2_HEADERS
|
||||
|
||||
|
@ -159,7 +159,7 @@ QString QWindowsLocalCodec::convertToUnicodeCharByChar(const char *chars, int le
|
||||
state->remainingChars = 0;
|
||||
}
|
||||
const char *mb = mbcs;
|
||||
#ifndef Q_OS_WINCE
|
||||
#if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
const char *next = 0;
|
||||
QString s;
|
||||
while ((next = CharNextExA(CP_ACP, mb, 0)) != mb) {
|
||||
|
@ -1132,6 +1132,21 @@ bool qSharedBuild() Q_DECL_NOTHROW
|
||||
Defined on Windows CE.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro Q_OS_WINRT
|
||||
\relates <QtGlobal>
|
||||
|
||||
Defined for Windows Runtime (Windows Store apps) on Windows 8, Windows RT,
|
||||
and Windows Phone 8.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro Q_OS_WINPHONE
|
||||
\relates <QtGlobal>
|
||||
|
||||
Defined on Windows Phone 8.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\macro Q_OS_CYGWIN
|
||||
\relates <QtGlobal>
|
||||
@ -1715,7 +1730,7 @@ QSysInfo::MacVersion QSysInfo::macVersion()
|
||||
}
|
||||
const QSysInfo::MacVersion QSysInfo::MacintoshVersion = QSysInfo::macVersion();
|
||||
|
||||
#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE)
|
||||
#elif defined(Q_OS_WIN) || defined(Q_OS_CYGWIN) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
|
||||
QT_BEGIN_INCLUDE_NAMESPACE
|
||||
#include "qt_windows.h"
|
||||
@ -1739,6 +1754,9 @@ QSysInfo::WinVersion QSysInfo::windowsVersion()
|
||||
static QSysInfo::WinVersion winver;
|
||||
if (winver)
|
||||
return winver;
|
||||
#ifdef Q_OS_WINRT
|
||||
winver = QSysInfo::WV_WINDOWS8;
|
||||
#else
|
||||
winver = QSysInfo::WV_NT;
|
||||
OSVERSIONINFO osver;
|
||||
osver.dwOSVersionInfoSize = sizeof(osver);
|
||||
@ -1823,6 +1841,7 @@ QSysInfo::WinVersion QSysInfo::windowsVersion()
|
||||
winver = QSysInfo::WV_WINDOWS8;
|
||||
}
|
||||
#endif
|
||||
#endif // !Q_OS_WINRT
|
||||
|
||||
return winver;
|
||||
}
|
||||
|
@ -194,7 +194,7 @@ typedef quint64 qulonglong;
|
||||
#ifndef QT_POINTER_SIZE
|
||||
# if defined(Q_OS_WIN64)
|
||||
# define QT_POINTER_SIZE 8
|
||||
# elif defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
|
||||
# elif defined(Q_OS_WIN32) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
# define QT_POINTER_SIZE 4
|
||||
# elif defined(Q_OS_ANDROID)
|
||||
# define QT_POINTER_SIZE 4 // ### Add auto-detection to Windows configure
|
||||
|
@ -88,7 +88,7 @@ static bool isFatal(QtMsgType msgType)
|
||||
|
||||
// Do we have stderr for QDebug? - Either there is a console or we are running
|
||||
// with redirected stderr.
|
||||
# ifndef Q_OS_WINCE
|
||||
# if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
static inline bool hasStdErr()
|
||||
{
|
||||
if (GetConsoleWindow())
|
||||
@ -98,11 +98,11 @@ static inline bool hasStdErr()
|
||||
return (info.dwFlags & STARTF_USESTDHANDLES) && info.hStdError
|
||||
&& info.hStdError != INVALID_HANDLE_VALUE;
|
||||
}
|
||||
# endif // !Q_OS_WINCE
|
||||
# endif // !Q_OS_WINCE && !Q_OS_WINRT
|
||||
|
||||
bool qWinLogToStderr()
|
||||
{
|
||||
# ifndef Q_OS_WINCE
|
||||
# if !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
static const bool result = hasStdErr();
|
||||
return result;
|
||||
# else
|
||||
@ -168,7 +168,7 @@ static void qEmergencyOut(QtMsgType msgType, const char *msg, va_list ap) Q_DECL
|
||||
{
|
||||
char emergency_buf[256] = { '\0' };
|
||||
emergency_buf[sizeof emergency_buf - 1] = '\0';
|
||||
#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB) && defined(Q_OS_WINCE) \
|
||||
#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB) && (defined(Q_OS_WINCE) || defined(Q_OS_WINRT)) \
|
||||
|| defined(Q_CC_MSVC) && defined(QT_DEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)
|
||||
wchar_t emergency_bufL[sizeof emergency_buf];
|
||||
#endif
|
||||
@ -177,7 +177,7 @@ static void qEmergencyOut(QtMsgType msgType, const char *msg, va_list ap) Q_DECL
|
||||
qvsnprintf(emergency_buf, sizeof emergency_buf - 1, msg, ap);
|
||||
|
||||
#if defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
|
||||
# ifdef Q_OS_WINCE
|
||||
# if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
convert_to_wchar_t_elided(emergency_bufL, sizeof emergency_buf, emergency_buf);
|
||||
OutputDebugStringW(emergency_bufL);
|
||||
# else
|
||||
@ -701,7 +701,7 @@ void QMessagePattern::setPattern(const QString &pattern)
|
||||
else if (inIf)
|
||||
error += QStringLiteral("QT_MESSAGE_PATTERN: missing %{endif}\n");
|
||||
if (!error.isEmpty()) {
|
||||
#if defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
OutputDebugString(reinterpret_cast<const wchar_t*>(error.utf16()));
|
||||
if (0)
|
||||
#elif defined(Q_OS_WIN) && defined(QT_BUILD_CORE_LIB)
|
||||
|
@ -317,7 +317,7 @@
|
||||
# elif defined(__BIG_ENDIAN__) || defined(_big_endian__) || defined(_BIG_ENDIAN)
|
||||
# define Q_BYTE_ORDER Q_BIG_ENDIAN
|
||||
# elif defined(__LITTLE_ENDIAN__) || defined(_little_endian__) || defined(_LITTLE_ENDIAN) \
|
||||
|| defined(_WIN32_WCE) // Windows CE is always little-endian according to MSDN.
|
||||
|| defined(_WIN32_WCE) || defined(WINAPI_FAMILY) // Windows CE is always little-endian according to MSDN.
|
||||
# define Q_BYTE_ORDER Q_LITTLE_ENDIAN
|
||||
# else
|
||||
# error "Unable to determine byte order!"
|
||||
|
@ -58,6 +58,7 @@
|
||||
OS2EMX - XFree86 on OS/2 (not PM)
|
||||
WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008)
|
||||
WINCE - WinCE (Windows CE 5.0)
|
||||
WINRT - WinRT (Windows 8 Runtime)
|
||||
CYGWIN - Cygwin
|
||||
SOLARIS - Sun Solaris
|
||||
HPUX - HP-UX
|
||||
@ -105,12 +106,21 @@
|
||||
# define Q_OS_LINUX
|
||||
#elif defined(__CYGWIN__)
|
||||
# define Q_OS_CYGWIN
|
||||
#elif !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
|
||||
#elif !defined(SAG_COM) && (!defined(WINAPI_FAMILY) || WINAPI_FAMILY==WINAPI_FAMILY_DESKTOP_APP) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__))
|
||||
# define Q_OS_WIN32
|
||||
# define Q_OS_WIN64
|
||||
#elif !defined(SAG_COM) && (defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
|
||||
# if defined(WINCE) || defined(_WIN32_WCE)
|
||||
# define Q_OS_WINCE
|
||||
# elif defined(WINAPI_FAMILY)
|
||||
# if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
|
||||
# define Q_OS_WINPHONE
|
||||
# define Q_OS_WINRT
|
||||
# elif WINAPI_FAMILY==WINAPI_FAMILY_APP
|
||||
# define Q_OS_WINRT
|
||||
# else
|
||||
# define Q_OS_WIN32
|
||||
# endif
|
||||
# else
|
||||
# define Q_OS_WIN32
|
||||
# endif
|
||||
@ -172,7 +182,7 @@
|
||||
# error "Qt has not been ported to this OS - see http://www.qt-project.org/"
|
||||
#endif
|
||||
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_WIN64) || defined(Q_OS_WINCE) || defined(Q_OS_WINRT)
|
||||
# define Q_OS_WIN
|
||||
#endif
|
||||
|
||||
|
@ -2028,7 +2028,7 @@ QString QCoreApplication::applicationFilePath()
|
||||
*/
|
||||
qint64 QCoreApplication::applicationPid()
|
||||
{
|
||||
#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN)
|
||||
return GetCurrentProcessId();
|
||||
#elif defined(Q_OS_VXWORKS)
|
||||
return (pid_t) taskIdCurrent;
|
||||
@ -2079,7 +2079,7 @@ QStringList QCoreApplication::arguments()
|
||||
char ** const av = self->d_func()->argv;
|
||||
list.reserve(ac);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
// On Windows, it is possible to pass Unicode arguments on
|
||||
// the command line. To restore those, we split the command line
|
||||
// and filter out arguments that were deleted by derived application
|
||||
|
@ -56,6 +56,20 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
int appCmdShow = 0;
|
||||
|
||||
#if defined(Q_OS_WINRT)
|
||||
|
||||
Q_CORE_EXPORT QString qAppFileName()
|
||||
{
|
||||
return QFileInfo(QCoreApplication::arguments().first()).filePath();
|
||||
}
|
||||
|
||||
QString QCoreApplicationPrivate::appName() const
|
||||
{
|
||||
return QFileInfo(QCoreApplication::arguments().first()).baseName();
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle
|
||||
{
|
||||
return GetModuleHandle(0);
|
||||
@ -1000,4 +1014,6 @@ QDebug operator<<(QDebug dbg, const MSG &msg)
|
||||
|
||||
#endif // QT_NO_QOBJECT
|
||||
|
||||
#endif // !defined(Q_OS_WINRT)
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -58,7 +58,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
|
||||
|
||||
QT_BEGIN_INCLUDE_NAMESPACE
|
||||
# include "QtCore/qvector.h"
|
||||
@ -149,7 +149,7 @@ static inline QStringList qCmdLineArgs(int argc, char *argv[])
|
||||
return qWinCmdArgs(cmdLine);
|
||||
}
|
||||
|
||||
#else // !Q_OS_WIN
|
||||
#else // Q_OS_WIN && !Q_OS_WINRT
|
||||
|
||||
static inline QStringList qCmdLineArgs(int argc, char *argv[])
|
||||
{
|
||||
@ -159,7 +159,7 @@ static inline QStringList qCmdLineArgs(int argc, char *argv[])
|
||||
return args;
|
||||
}
|
||||
|
||||
#endif // Q_OS_WIN
|
||||
#endif // !Q_OS_WIN || Q_OS_WINRT
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
@ -52,7 +52,7 @@ SOURCES += \
|
||||
image/qiconengineplugin.cpp \
|
||||
|
||||
|
||||
win32: SOURCES += image/qpixmap_win.cpp
|
||||
win32:!winrt: SOURCES += image/qpixmap_win.cpp
|
||||
|
||||
# Built-in image format support
|
||||
HEADERS += \
|
||||
|
@ -907,12 +907,12 @@ static void init_platform(const QString &pluginArgument, const QString &platform
|
||||
keys.join(QStringLiteral(", ")));
|
||||
}
|
||||
fatalMessage += QStringLiteral("Reinstalling the application may fix this problem.");
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
// Windows: Display message box unless it is a console application
|
||||
// or debug build showing an assert box.
|
||||
if (!QLibraryInfo::isDebugBuild() && !GetConsoleWindow())
|
||||
MessageBox(0, (LPCTSTR)fatalMessage.utf16(), (LPCTSTR)(QCoreApplication::applicationName().utf16()), MB_OK | MB_ICONERROR);
|
||||
#endif // Q_OS_WIN && !Q_OS_WINCE
|
||||
#endif // Q_OS_WIN && !Q_OS_WINCE && !Q_OS_WINRT
|
||||
qFatal("%s", qPrintable(fatalMessage));
|
||||
return;
|
||||
}
|
||||
|
@ -158,6 +158,9 @@ static const qreal aliasedCoordinateDelta = 0.5 - 0.015625;
|
||||
|
||||
static inline bool winClearTypeFontsEnabled()
|
||||
{
|
||||
#ifdef Q_OS_WINRT
|
||||
return false;
|
||||
#else // Q_OS_WINRT
|
||||
UINT result = 0;
|
||||
#if !defined(SPI_GETFONTSMOOTHINGTYPE) // MinGW
|
||||
# define SPI_GETFONTSMOOTHINGTYPE 0x200A
|
||||
@ -165,6 +168,7 @@ static inline bool winClearTypeFontsEnabled()
|
||||
#endif
|
||||
SystemParametersInfo(SPI_GETFONTSMOOTHINGTYPE, 0, &result, 0);
|
||||
return result == FE_FONTSMOOTHINGCLEARTYPE;
|
||||
#endif // !Q_OS_WINRT
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -5,4 +5,4 @@ qtHaveModule(network): SUBDIRS += bearer
|
||||
qtHaveModule(gui): SUBDIRS *= imageformats platforms platforminputcontexts platformthemes generic
|
||||
qtHaveModule(widgets): SUBDIRS += accessible
|
||||
|
||||
!wince*:qtHaveModule(widgets): SUBDIRS += printsupport
|
||||
!winrt:!wince*:qtHaveModule(widgets):SUBDIRS += printsupport
|
||||
|
@ -131,7 +131,7 @@ contains(QT_CONFIG, concurrent):SUBDIRS += src_concurrent
|
||||
SUBDIRS += src_opengl
|
||||
src_plugins.depends += src_opengl
|
||||
}
|
||||
!wince* {
|
||||
!wince*:!winrt {
|
||||
SUBDIRS += src_printsupport
|
||||
src_plugins.depends += src_printsupport
|
||||
}
|
||||
|
@ -2079,7 +2079,7 @@ FatalSignalHandler::~FatalSignalHandler()
|
||||
|
||||
} // namespace
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo)
|
||||
{
|
||||
char appName[MAX_PATH];
|
||||
@ -2089,7 +2089,7 @@ static LONG WINAPI windowsFaultHandler(struct _EXCEPTION_POINTERS *exInfo)
|
||||
appName, exInfo->ExceptionRecord->ExceptionCode);
|
||||
return EXCEPTION_EXECUTE_HANDLER;
|
||||
}
|
||||
#endif // Q_OS_WIN) && !Q_OS_WINCE
|
||||
#endif // Q_OS_WIN) && !Q_OS_WINCE && !Q_OS_WINRT
|
||||
|
||||
/*!
|
||||
Executes tests declared in \a testObject. In addition, the private slots
|
||||
@ -2171,7 +2171,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
|
||||
|
||||
qtest_qParseArgs(argc, argv, false);
|
||||
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
|
||||
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) && !defined(Q_OS_WINRT)
|
||||
if (!noCrashHandler) {
|
||||
# ifndef Q_CC_MINGW
|
||||
_CrtSetReportMode(_CRT_ERROR, _CRTDBG_MODE_DEBUG);
|
||||
@ -2179,7 +2179,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
|
||||
SetErrorMode(SetErrorMode(0) | SEM_NOGPFAULTERRORBOX);
|
||||
SetUnhandledExceptionFilter(windowsFaultHandler);
|
||||
} // !noCrashHandler
|
||||
#endif // Q_OS_WIN) && !Q_OS_WINCE
|
||||
#endif // Q_OS_WIN) && !Q_OS_WINCE && !Q_OS_WINRT
|
||||
|
||||
#ifdef QTESTLIB_USE_VALGRIND
|
||||
if (QBenchmarkGlobalData::current->mode() == QBenchmarkGlobalData::CallgrindParentProcess) {
|
||||
@ -2570,7 +2570,9 @@ void QTest::qSleep(int ms)
|
||||
{
|
||||
QTEST_ASSERT(ms > 0);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if defined(Q_OS_WINRT)
|
||||
WaitForSingleObjectEx(GetCurrentThread(), ms, true);
|
||||
#elif defined(Q_OS_WIN)
|
||||
Sleep(uint(ms));
|
||||
#else
|
||||
struct timespec ts = { ms / 1000, (ms % 1000) * 1000 * 1000 };
|
||||
|
Loading…
x
Reference in New Issue
Block a user