From 53ed4de02278b17708199891f9b56c6e6e04103b Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Fri, 4 Jul 2014 15:24:41 +0300 Subject: winrt: Clean up platform message dialog helper - Remove "Platform" from class name for consistency - Use ComPtr and HRESULT checking where missing - Use UICommand ID class to reduce callback complexity - Use dialog completed callback to fix failed repeated dialog opening These changes have been tested with the QtQuick.Dialogs message dialog example, and all features appear to be working. Note that the WinRT dialog supports a maximum of three buttons, though, and a warning is printed if this number is exceeded. Similarly to Android, the native hooks can be now be disabled by using qputenv("QT_USE_WINRT_NATIVE_DIALOGS", "0"). Task-number: QTBUG-38115 Task-number: QTBUG-39868 Change-Id: I9943c7c11bd640790db68219cefdca1a680e96ec Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrttheme.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/winrt/qwinrttheme.cpp') diff --git a/src/plugins/platforms/winrt/qwinrttheme.cpp b/src/plugins/platforms/winrt/qwinrttheme.cpp index 65ed9440b2..f9c2e21676 100644 --- a/src/plugins/platforms/winrt/qwinrttheme.cpp +++ b/src/plugins/platforms/winrt/qwinrttheme.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include "qwinrttheme.h" -#include "qwinrtplatformmessagedialoghelper.h" +#include "qwinrtmessagedialoghelper.h" #include #include @@ -131,8 +131,11 @@ QWinRTTheme::QWinRTTheme() bool QWinRTTheme::usePlatformNativeDialog(DialogType type) const { + static bool useNativeDialogs = qEnvironmentVariableIsSet("QT_USE_WINRT_NATIVE_DIALOGS") + ? qgetenv("QT_USE_WINRT_NATIVE_DIALOGS").toInt() : true; + if (type == MessageDialog) - return true; + return useNativeDialogs; return false; } @@ -140,7 +143,7 @@ QPlatformDialogHelper *QWinRTTheme::createPlatformDialogHelper(DialogType type) { switch (type) { case MessageDialog: - return new QWinRTPlatformMessageDialogHelper; + return new QWinRTMessageDialogHelper(this); default: break; } -- cgit v1.2.3