Remove superfluous clang preprocessor check for cpp/winrt

The cpp/winrt configure test fails if clang is being used so there is no
need to explicitly check for the compiler.

Change-Id: Ifb2cb792cf3ea2d2ff09be6e47d741f09aec765f
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Oliver Wolff 2022-08-26 10:09:15 +02:00 committed by Tor Arne Vestbø
parent d7ea07c8c1
commit 0988ad8521
5 changed files with 19 additions and 24 deletions

View File

@ -19,7 +19,7 @@
# include <time.h> # include <time.h>
#endif #endif
#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) #if QT_CONFIG(cpp_winrt)
# include <winrt/base.h> # include <winrt/base.h>
// Workaround for Windows SDK bug. // Workaround for Windows SDK bug.
// See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47 // See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47
@ -31,7 +31,7 @@ namespace winrt::impl
# include <winrt/Windows.Foundation.h> # include <winrt/Windows.Foundation.h>
# include <winrt/Windows.Foundation.Collections.h> # include <winrt/Windows.Foundation.Collections.h>
# include <winrt/Windows.System.UserProfile.h> # include <winrt/Windows.System.UserProfile.h>
#endif // QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) #endif // QT_CONFIG(cpp_winrt)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -661,7 +661,7 @@ QVariant QSystemLocalePrivate::toCurrencyString(const QSystemLocale::CurrencyToS
QVariant QSystemLocalePrivate::uiLanguages() QVariant QSystemLocalePrivate::uiLanguages()
{ {
QStringList result; QStringList result;
#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) #if QT_CONFIG(cpp_winrt)
using namespace winrt; using namespace winrt;
using namespace Windows::System::UserProfile; using namespace Windows::System::UserProfile;
auto languages = GlobalizationPreferences::Languages(); auto languages = GlobalizationPreferences::Languages();
@ -669,7 +669,7 @@ QVariant QSystemLocalePrivate::uiLanguages()
result << QString::fromStdString(winrt::to_string(lang)); result << QString::fromStdString(winrt::to_string(lang));
if (!result.isEmpty()) if (!result.isEmpty())
return result; // else just fall back to WIN32 API implementation return result; // else just fall back to WIN32 API implementation
#endif // QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) #endif // QT_CONFIG(cpp_winrt)
// mingw and clang still have to use Win32 API // mingw and clang still have to use Win32 API
unsigned long cnt = 0; unsigned long cnt = 0;
QVarLengthArray<wchar_t, 64> buf(64); QVarLengthArray<wchar_t, 64> buf(64);

View File

@ -3,7 +3,7 @@
#include "qnetworklistmanagerevents.h" #include "qnetworklistmanagerevents.h"
#ifdef SUPPORTS_WINRT #if QT_CONFIG(cpp_winrt)
#include <winrt/base.h> #include <winrt/base.h>
// Workaround for Windows SDK bug. // Workaround for Windows SDK bug.
// See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47 // See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47
@ -14,7 +14,7 @@ namespace winrt::impl
} }
#include <winrt/Windows.Networking.Connectivity.h> #include <winrt/Windows.Networking.Connectivity.h>
#endif #endif // QT_CONFIG(cpp_winrt)
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -99,7 +99,7 @@ bool QNetworkListManagerEvents::start()
else else
emit connectivityChanged(connectivity); emit connectivityChanged(connectivity);
#ifdef SUPPORTS_WINRT #if QT_CONFIG(cpp_winrt)
using namespace winrt::Windows::Networking::Connectivity; using namespace winrt::Windows::Networking::Connectivity;
// Register for changes in the network and store a token to unregister later: // Register for changes in the network and store a token to unregister later:
token = NetworkInformation::NetworkStatusChanged( token = NetworkInformation::NetworkStatusChanged(
@ -125,7 +125,7 @@ bool QNetworkListManagerEvents::stop()
} }
cookie = 0; cookie = 0;
#ifdef SUPPORTS_WINRT #if QT_CONFIG(cpp_winrt)
using namespace winrt::Windows::Networking::Connectivity; using namespace winrt::Windows::Networking::Connectivity;
// Pass the token we stored earlier to unregister: // Pass the token we stored earlier to unregister:
NetworkInformation::NetworkStatusChanged(token); NetworkInformation::NetworkStatusChanged(token);
@ -172,7 +172,7 @@ bool QNetworkListManagerEvents::checkBehindCaptivePortal()
return false; return false;
} }
#ifdef SUPPORTS_WINRT #if QT_CONFIG(cpp_winrt)
namespace { namespace {
using namespace winrt::Windows::Networking::Connectivity; using namespace winrt::Windows::Networking::Connectivity;
// NB: this isn't part of "network list manager", but sadly NLM doesn't have an // NB: this isn't part of "network list manager", but sadly NLM doesn't have an
@ -223,6 +223,6 @@ void QNetworkListManagerEvents::emitWinRTUpdates()
emit transportMediumChanged(getTransportMedium(profile)); emit transportMediumChanged(getTransportMedium(profile));
emit isMeteredChanged(getMetered(profile)); emit isMeteredChanged(getMetered(profile));
} }
#endif #endif // QT_CONFIG(cpp_winrt)
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -15,11 +15,7 @@
#include <wrl/wrappers/corewrappers.h> #include <wrl/wrappers/corewrappers.h>
#include <comdef.h> #include <comdef.h>
#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) #if QT_CONFIG(cpp_winrt)
#define SUPPORTS_WINRT 1
#endif
#ifdef SUPPORTS_WINRT
#include <winrt/base.h> #include <winrt/base.h>
#endif #endif
@ -69,7 +65,7 @@ private:
ComPtr<INetworkListManager> networkListManager = nullptr; ComPtr<INetworkListManager> networkListManager = nullptr;
ComPtr<IConnectionPoint> connectionPoint = nullptr; ComPtr<IConnectionPoint> connectionPoint = nullptr;
#ifdef SUPPORTS_WINRT #if QT_CONFIG(cpp_winrt)
void emitWinRTUpdates(); void emitWinRTUpdates();
winrt::event_token token; winrt::event_token token;

View File

@ -68,7 +68,7 @@ public:
{ {
return QNetworkInformation::Features(QNetworkInformation::Feature::Reachability return QNetworkInformation::Features(QNetworkInformation::Feature::Reachability
| QNetworkInformation::Feature::CaptivePortal | QNetworkInformation::Feature::CaptivePortal
#ifdef SUPPORTS_WINRT #if QT_CONFIG(cpp_winrt)
| QNetworkInformation::Feature::TransportMedium | QNetworkInformation::Feature::TransportMedium
#endif #endif
); );

View File

@ -46,7 +46,7 @@
#include <algorithm> #include <algorithm>
#if QT_CONFIG(cpp_winrt) && !defined(Q_CC_CLANG) #if QT_CONFIG(cpp_winrt)
# include <winrt/base.h> # include <winrt/base.h>
// Workaround for Windows SDK bug. // Workaround for Windows SDK bug.
// See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47 // See https://github.com/microsoft/Windows.UI.Composition-Win32-Samples/issues/47
@ -56,8 +56,7 @@ namespace winrt::impl
auto wait_for(Async const& async, Windows::Foundation::TimeSpan const& timeout); auto wait_for(Async const& async, Windows::Foundation::TimeSpan const& timeout);
} }
# include <winrt/Windows.UI.ViewManagement.h> # include <winrt/Windows.UI.ViewManagement.h>
# define HAS_UISETTINGS 1 #endif // QT_CONFIG(cpp_winrt)
#endif
#if defined(__IImageList_INTERFACE_DEFINED__) && defined(__IID_DEFINED__) #if defined(__IImageList_INTERFACE_DEFINED__) && defined(__IID_DEFINED__)
# define USE_IIMAGELIST # define USE_IIMAGELIST
@ -111,7 +110,7 @@ static inline QColor getSysColor(int index)
return COLORREFToQColor(GetSysColor(index)); return COLORREFToQColor(GetSysColor(index));
} }
#if defined(HAS_UISETTINGS) #if QT_CONFIG(cpp_winrt)
static constexpr QColor getSysColor(winrt::Windows::UI::Color &&color) static constexpr QColor getSysColor(winrt::Windows::UI::Color &&color)
{ {
return QColor(color.R, color.G, color.B, color.A); return QColor(color.R, color.G, color.B, color.A);
@ -261,7 +260,7 @@ static void populateLightSystemBasePalette(QPalette &result)
QColor textColor = getSysColor(COLOR_WINDOWTEXT); QColor textColor = getSysColor(COLOR_WINDOWTEXT);
QColor accent = getSysColor(COLOR_HIGHLIGHT); QColor accent = getSysColor(COLOR_HIGHLIGHT);
#if defined(HAS_UISETTINGS) #if QT_CONFIG(cpp_winrt)
if (QWindowsIntegration::instance()->darkModeHandling().testFlag(QWindowsApplication::DarkModeStyle)) { if (QWindowsIntegration::instance()->darkModeHandling().testFlag(QWindowsApplication::DarkModeStyle)) {
using namespace winrt::Windows::UI::ViewManagement; using namespace winrt::Windows::UI::ViewManagement;
const auto settings = UISettings(); const auto settings = UISettings();
@ -304,7 +303,7 @@ static void populateLightSystemBasePalette(QPalette &result)
static void populateDarkSystemBasePalette(QPalette &result) static void populateDarkSystemBasePalette(QPalette &result)
{ {
#if defined(HAS_UISETTINGS) #if QT_CONFIG(cpp_winrt)
using namespace winrt::Windows::UI::ViewManagement; using namespace winrt::Windows::UI::ViewManagement;
const auto settings = UISettings(); const auto settings = UISettings();
@ -593,7 +592,7 @@ void QWindowsTheme::refreshPalettes()
m_palettes[MenuPalette] = new QPalette(menuPalette(*m_palettes[SystemPalette], light)); m_palettes[MenuPalette] = new QPalette(menuPalette(*m_palettes[SystemPalette], light));
m_palettes[MenuBarPalette] = menuBarPalette(*m_palettes[MenuPalette], light); m_palettes[MenuBarPalette] = menuBarPalette(*m_palettes[MenuPalette], light);
if (!light) { if (!light) {
#if defined(HAS_UISETTINGS) #if QT_CONFIG(cpp_winrt)
using namespace winrt::Windows::UI::ViewManagement; using namespace winrt::Windows::UI::ViewManagement;
const auto settings = UISettings(); const auto settings = UISettings();
const QColor accent = getSysColor(settings.GetColorValue(UIColorType::Accent)); const QColor accent = getSysColor(settings.GetColorValue(UIColorType::Accent));