@@ -62,22 +62,22 @@ namespace QWK {
6262 inline bool IsWindows1122H2OrGreater_Real () {
6363 RTL_OSVERSIONINFOW rovi = GetRealOSVersion ();
6464 return (rovi.dwMajorVersion > 10 ) ||
65- (rovi.dwMajorVersion == 10 && (rovi. dwMinorVersion > 0 ||
66- rovi.dwBuildNumber >= 22621 ));
65+ (rovi.dwMajorVersion == 10 &&
66+ (rovi. dwMinorVersion > 0 || rovi.dwBuildNumber >= 22621 ));
6767 }
6868
6969 inline bool IsWindows11OrGreater_Real () {
7070 RTL_OSVERSIONINFOW rovi = GetRealOSVersion ();
7171 return (rovi.dwMajorVersion > 10 ) ||
72- (rovi.dwMajorVersion == 10 && (rovi. dwMinorVersion > 0 ||
73- rovi.dwBuildNumber >= 22000 ));
72+ (rovi.dwMajorVersion == 10 &&
73+ (rovi. dwMinorVersion > 0 || rovi.dwBuildNumber >= 22000 ));
7474 }
7575
7676 inline bool IsWindows1020H1OrGreater_Real () {
7777 RTL_OSVERSIONINFOW rovi = GetRealOSVersion ();
7878 return (rovi.dwMajorVersion > 10 ) ||
79- (rovi.dwMajorVersion == 10 && (rovi. dwMinorVersion > 0 ||
80- rovi.dwBuildNumber >= 19041 ));
79+ (rovi.dwMajorVersion == 10 &&
80+ (rovi. dwMinorVersion > 0 || rovi.dwBuildNumber >= 19041 ));
8181 }
8282
8383 inline bool IsWindows102004OrGreater_Real () {
@@ -87,8 +87,8 @@ namespace QWK {
8787 inline bool IsWindows101903OrGreater_Real () {
8888 RTL_OSVERSIONINFOW rovi = GetRealOSVersion ();
8989 return (rovi.dwMajorVersion > 10 ) ||
90- (rovi.dwMajorVersion == 10 && (rovi. dwMinorVersion > 0 ||
91- rovi.dwBuildNumber >= 18362 ));
90+ (rovi.dwMajorVersion == 10 &&
91+ (rovi. dwMinorVersion > 0 || rovi.dwBuildNumber >= 18362 ));
9292 }
9393
9494 inline bool IsWindows1019H1OrGreater_Real () {
@@ -98,8 +98,8 @@ namespace QWK {
9898 inline bool IsWindows101809OrGreater_Real () {
9999 RTL_OSVERSIONINFOW rovi = GetRealOSVersion ();
100100 return (rovi.dwMajorVersion > 10 ) ||
101- (rovi.dwMajorVersion == 10 && (rovi. dwMinorVersion > 0 ||
102- rovi.dwBuildNumber >= 17763 ));
101+ (rovi.dwMajorVersion == 10 &&
102+ (rovi. dwMinorVersion > 0 || rovi.dwBuildNumber >= 17763 ));
103103 }
104104
105105 inline bool IsWindows10RS5OrGreater_Real () {
@@ -147,9 +147,6 @@ namespace QWK {
147147 QString stringValue (QStringView subKey) const ;
148148 QPair<DWORD, bool > dwordValue (QStringView subKey) const ;
149149
150- template <typename T>
151- std::optional<T> value (QStringView subKey) const ;
152-
153150 private:
154151 HKEY m_key;
155152
@@ -159,34 +156,26 @@ namespace QWK {
159156 inline bool WindowsRegistryKey::isValid () const {
160157 return m_key != nullptr ;
161158 }
162-
163- template <>
164- inline std::optional<DWORD> WindowsRegistryKey::value (QStringView subKey) const {
165- const auto dv = dwordValue (subKey);
166- if (!dv.second ) {
167- return {};
168- }
169- return dv.first ;
170- }
171159#elif QT_VERSION < QT_VERSION_CHECK(6, 8, 1)
160+ using WindowsRegistryKey = QWinRegistryKey;
161+ #else
172162 class WindowsRegistryKey : public QWinRegistryKey {
173163 public:
174- WindowsRegistryKey (HKEY parentHandle, QStringView subKey, REGSAM permissions = KEY_READ, REGSAM access = 0 );
164+ WindowsRegistryKey (HKEY parentHandle, QStringView subKey, REGSAM permissions = KEY_READ,
165+ REGSAM access = 0 )
166+ : QWinRegistryKey(parentHandle, subKey, permissions, access) {
167+ }
175168
176- template <typename T>
177- std::optional<T> value (QStringView subKey) const ;
169+ inline QPair<DWORD, bool > dwordValue (QStringView subKey) const ;
178170 };
179171
180- template <>
181- inline std::optional<DWORD> WindowsRegistryKey::value (QStringView subKey) const {
182- const auto dv = dwordValue (subKey);
183- if (!dv.second ) {
184- return {};
172+ inline QPair<DWORD, bool > WindowsRegistryKey::dwordValue (QStringView subKey) const {
173+ const auto val = value<DWORD>(subKey);
174+ if (!val) {
175+ return {0 , false };
185176 }
186- return dv. first ;
177+ return {val. value (), true } ;
187178 }
188- #else
189- using WindowsRegistryKey = QWinRegistryKey;
190179#endif
191180
192181 //
0 commit comments