parent
4cb9c9c60d
commit
8b6dd746eb
|
@ -410,65 +410,6 @@ enum class WindowCornerStyle
|
||||||
};
|
};
|
||||||
Q_ENUM_NS(WindowCornerStyle)
|
Q_ENUM_NS(WindowCornerStyle)
|
||||||
|
|
||||||
struct VersionNumber
|
|
||||||
{
|
|
||||||
int major = 0;
|
|
||||||
int minor = 0;
|
|
||||||
int patch = 0;
|
|
||||||
int tweak = 0;
|
|
||||||
|
|
||||||
[[nodiscard]] friend constexpr bool operator==(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
|
||||||
{
|
|
||||||
return ((lhs.major == rhs.major) && (lhs.minor == rhs.minor) && (lhs.patch == rhs.patch) && (lhs.tweak == rhs.tweak));
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] friend constexpr bool operator!=(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
|
||||||
{
|
|
||||||
return !operator==(lhs, rhs);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] friend constexpr bool operator>(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
|
||||||
{
|
|
||||||
if (operator==(lhs, rhs)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (lhs.major > rhs.major) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (lhs.major < rhs.major) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (lhs.minor > rhs.minor) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (lhs.minor < rhs.minor) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (lhs.patch > rhs.patch) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (lhs.patch < rhs.patch) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return (lhs.tweak > rhs.tweak);
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] friend constexpr bool operator<(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
|
||||||
{
|
|
||||||
return (operator!=(lhs, rhs) && !operator>(lhs, rhs));
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] friend constexpr bool operator>=(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
|
||||||
{
|
|
||||||
return (operator>(lhs, rhs) || operator==(lhs, rhs));
|
|
||||||
}
|
|
||||||
|
|
||||||
[[nodiscard]] friend constexpr bool operator<=(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
|
||||||
{
|
|
||||||
return (operator<(lhs, rhs) || operator==(lhs, rhs));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
struct VersionInfo
|
struct VersionInfo
|
||||||
{
|
{
|
||||||
int version = 0;
|
int version = 0;
|
||||||
|
@ -486,39 +427,6 @@ struct Dpi
|
||||||
quint32 y = 0;
|
quint32 y = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef Q_OS_WINDOWS
|
|
||||||
[[maybe_unused]] inline constexpr const VersionNumber WindowsVersions[] =
|
|
||||||
{
|
|
||||||
{ 5, 0, 2195}, // Windows 2000
|
|
||||||
{ 5, 1, 2600}, // Windows XP
|
|
||||||
{ 5, 2, 3790}, // Windows XP x64 Edition or Windows Server 2003
|
|
||||||
{ 6, 0, 6000}, // Windows Vista
|
|
||||||
{ 6, 0, 6001}, // Windows Vista with Service Pack 1 or Windows Server 2008
|
|
||||||
{ 6, 0, 6002}, // Windows Vista with Service Pack 2
|
|
||||||
{ 6, 1, 7600}, // Windows 7 or Windows Server 2008 R2
|
|
||||||
{ 6, 1, 7601}, // Windows 7 with Service Pack 1 or Windows Server 2008 R2 with Service Pack 1
|
|
||||||
{ 6, 2, 9200}, // Windows 8 or Windows Server 2012
|
|
||||||
{ 6, 3, 9200}, // Windows 8.1 or Windows Server 2012 R2
|
|
||||||
{ 6, 3, 9600}, // Windows 8.1 with Update 1
|
|
||||||
{10, 0, 10240}, // Windows 10 Version 1507 (TH1)
|
|
||||||
{10, 0, 10586}, // Windows 10 Version 1511 (November Update) (TH2)
|
|
||||||
{10, 0, 14393}, // Windows 10 Version 1607 (Anniversary Update) (RS1) or Windows Server 2016
|
|
||||||
{10, 0, 15063}, // Windows 10 Version 1703 (Creators Update) (RS2)
|
|
||||||
{10, 0, 16299}, // Windows 10 Version 1709 (Fall Creators Update) (RS3)
|
|
||||||
{10, 0, 17134}, // Windows 10 Version 1803 (April 2018 Update) (RS4)
|
|
||||||
{10, 0, 17763}, // Windows 10 Version 1809 (October 2018 Update) (RS5) or Windows Server 2019
|
|
||||||
{10, 0, 18362}, // Windows 10 Version 1903 (May 2019 Update) (19H1)
|
|
||||||
{10, 0, 18363}, // Windows 10 Version 1909 (November 2019 Update) (19H2)
|
|
||||||
{10, 0, 19041}, // Windows 10 Version 2004 (May 2020 Update) (20H1)
|
|
||||||
{10, 0, 19042}, // Windows 10 Version 20H2 (October 2020 Update) (20H2)
|
|
||||||
{10, 0, 19043}, // Windows 10 Version 21H1 (May 2021 Update) (21H1)
|
|
||||||
{10, 0, 19044}, // Windows 10 Version 21H2 (November 2021 Update) (21H2)
|
|
||||||
{10, 0, 19045}, // Windows 10 Version 22H2 (October 2022 Update) (22H2)
|
|
||||||
{10, 0, 22000}, // Windows 11 Version 21H2 (21H2)
|
|
||||||
{10, 0, 22621} // Windows 11 Version 22H2 (October 2022 Update) (22H2)
|
|
||||||
};
|
|
||||||
#endif // Q_OS_WINDOWS
|
|
||||||
|
|
||||||
} // namespace Global
|
} // namespace Global
|
||||||
|
|
||||||
namespace FramelessHelper::Core
|
namespace FramelessHelper::Core
|
||||||
|
@ -534,7 +442,6 @@ FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
FRAMELESSHELPER_CORE_API QDebug operator<<(QDebug, const FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::VersionNumber &);
|
|
||||||
FRAMELESSHELPER_CORE_API QDebug operator<<(QDebug, const FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::VersionInfo &);
|
FRAMELESSHELPER_CORE_API QDebug operator<<(QDebug, const FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::VersionInfo &);
|
||||||
FRAMELESSHELPER_CORE_API QDebug operator<<(QDebug, const FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::Dpi &);
|
FRAMELESSHELPER_CORE_API QDebug operator<<(QDebug, const FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::Dpi &);
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021-2023 by wangwenx190 (Yuhang Zhao)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
|
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
||||||
|
# include <QtCore/qscopeguard.h>
|
||||||
|
#else // (QT_VERSION < QT_VERSION_CHECK(5, 12, 0))
|
||||||
|
|
||||||
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
using ScopeGuardCallback = std::function<void()>;
|
||||||
|
|
||||||
|
class [[nodiscard]] ScopeGuard
|
||||||
|
{
|
||||||
|
Q_DISABLE_COPY(ScopeGuard)
|
||||||
|
|
||||||
|
public:
|
||||||
|
ScopeGuard()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit ScopeGuard(const ScopeGuardCallback &cb)
|
||||||
|
{
|
||||||
|
// For the ctor, we require a non-null function.
|
||||||
|
Q_ASSERT(cb);
|
||||||
|
if (!cb) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_callback = cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
explicit ScopeGuard(ScopeGuardCallback &&cb)
|
||||||
|
{
|
||||||
|
// For the ctor, we require a non-null function.
|
||||||
|
Q_ASSERT(cb);
|
||||||
|
if (!cb) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_callback = std::move(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
ScopeGuard(ScopeGuard &&other) : m_callback(std::move(other.m_callback))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
~ScopeGuard()
|
||||||
|
{
|
||||||
|
if (m_callback) {
|
||||||
|
m_callback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] ScopeGuardCallback callback() const
|
||||||
|
{
|
||||||
|
return m_callback;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setCallback(const ScopeGuardCallback &cb)
|
||||||
|
{
|
||||||
|
// But we allow null functions here.
|
||||||
|
m_callback = cb;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
ScopeGuardCallback m_callback = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
[[nodiscard]] inline ScopeGuard make_guard(ScopeGuardCallback &&cb)
|
||||||
|
{
|
||||||
|
return ScopeGuard(cb);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define qScopeGuard make_guard
|
||||||
|
|
||||||
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
|
|
@ -0,0 +1,129 @@
|
||||||
|
/*
|
||||||
|
* MIT License
|
||||||
|
*
|
||||||
|
* Copyright (C) 2021-2023 by wangwenx190 (Yuhang Zhao)
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
* SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||||
|
|
||||||
|
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
struct VersionNumber
|
||||||
|
{
|
||||||
|
int Major = 0;
|
||||||
|
int Minor = 0;
|
||||||
|
int Patch = 0;
|
||||||
|
int Tweak = 0;
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator==(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
||||||
|
{
|
||||||
|
return ((lhs.Major == rhs.Major) && (lhs.Minor == rhs.Minor) && (lhs.Patch == rhs.Patch) && (lhs.Tweak == rhs.Tweak));
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator!=(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
||||||
|
{
|
||||||
|
return !operator==(lhs, rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator>(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
||||||
|
{
|
||||||
|
if (operator==(lhs, rhs)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (lhs.Major > rhs.Major) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lhs.Major < rhs.Major) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (lhs.Minor > rhs.Minor) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lhs.Minor < rhs.Minor) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (lhs.Patch > rhs.Patch) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (lhs.Patch < rhs.Patch) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return (lhs.Tweak > rhs.Tweak);
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator<(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
||||||
|
{
|
||||||
|
return (operator!=(lhs, rhs) && !operator>(lhs, rhs));
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator>=(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
||||||
|
{
|
||||||
|
return (operator>(lhs, rhs) || operator==(lhs, rhs));
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] friend constexpr bool operator<=(const VersionNumber &lhs, const VersionNumber &rhs) noexcept
|
||||||
|
{
|
||||||
|
return (operator<(lhs, rhs) || operator==(lhs, rhs));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef Q_OS_WINDOWS
|
||||||
|
[[maybe_unused]] inline constexpr const VersionNumber WindowsVersions[] =
|
||||||
|
{
|
||||||
|
{ 5, 0, 2195}, // Windows 2000
|
||||||
|
{ 5, 1, 2600}, // Windows XP
|
||||||
|
{ 5, 2, 3790}, // Windows XP x64 Edition or Windows Server 2003
|
||||||
|
{ 6, 0, 6000}, // Windows Vista
|
||||||
|
{ 6, 0, 6001}, // Windows Vista with Service Pack 1 or Windows Server 2008
|
||||||
|
{ 6, 0, 6002}, // Windows Vista with Service Pack 2
|
||||||
|
{ 6, 1, 7600}, // Windows 7 or Windows Server 2008 R2
|
||||||
|
{ 6, 1, 7601}, // Windows 7 with Service Pack 1 or Windows Server 2008 R2 with Service Pack 1
|
||||||
|
{ 6, 2, 9200}, // Windows 8 or Windows Server 2012
|
||||||
|
{ 6, 3, 9200}, // Windows 8.1 or Windows Server 2012 R2
|
||||||
|
{ 6, 3, 9600}, // Windows 8.1 with Update 1
|
||||||
|
{10, 0, 10240}, // Windows 10 Version 1507 (TH1)
|
||||||
|
{10, 0, 10586}, // Windows 10 Version 1511 (November Update) (TH2)
|
||||||
|
{10, 0, 14393}, // Windows 10 Version 1607 (Anniversary Update) (RS1) or Windows Server 2016
|
||||||
|
{10, 0, 15063}, // Windows 10 Version 1703 (Creators Update) (RS2)
|
||||||
|
{10, 0, 16299}, // Windows 10 Version 1709 (Fall Creators Update) (RS3)
|
||||||
|
{10, 0, 17134}, // Windows 10 Version 1803 (April 2018 Update) (RS4)
|
||||||
|
{10, 0, 17763}, // Windows 10 Version 1809 (October 2018 Update) (RS5) or Windows Server 2019
|
||||||
|
{10, 0, 18362}, // Windows 10 Version 1903 (May 2019 Update) (19H1)
|
||||||
|
{10, 0, 18363}, // Windows 10 Version 1909 (November 2019 Update) (19H2)
|
||||||
|
{10, 0, 19041}, // Windows 10 Version 2004 (May 2020 Update) (20H1)
|
||||||
|
{10, 0, 19042}, // Windows 10 Version 20H2 (October 2020 Update) (20H2)
|
||||||
|
{10, 0, 19043}, // Windows 10 Version 21H1 (May 2021 Update) (21H1)
|
||||||
|
{10, 0, 19044}, // Windows 10 Version 21H2 (November 2021 Update) (21H2)
|
||||||
|
{10, 0, 19045}, // Windows 10 Version 22H2 (October 2022 Update) (22H2)
|
||||||
|
{10, 0, 22000}, // Windows 11 Version 21H2 (21H2)
|
||||||
|
{10, 0, 22621} // Windows 11 Version 22H2 (October 2022 Update) (22H2)
|
||||||
|
};
|
||||||
|
#endif // Q_OS_WINDOWS
|
||||||
|
|
||||||
|
FRAMELESSHELPER_END_NAMESPACE
|
||||||
|
|
||||||
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
FRAMELESSHELPER_CORE_API QDebug operator<<(QDebug, const FRAMELESSHELPER_PREPEND_NAMESPACE(VersionNumber) &);
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
#endif // QT_NO_DEBUG_STREAM
|
|
@ -39,7 +39,9 @@ HEADERS += \
|
||||||
$$CORE_PRIV_INC_DIR/micamaterial_p.h \
|
$$CORE_PRIV_INC_DIR/micamaterial_p.h \
|
||||||
$$CORE_PRIV_INC_DIR/sysapiloader_p.h \
|
$$CORE_PRIV_INC_DIR/sysapiloader_p.h \
|
||||||
$$CORE_PRIV_INC_DIR/windowborderpainter_p.h \
|
$$CORE_PRIV_INC_DIR/windowborderpainter_p.h \
|
||||||
$$CORE_PRIV_INC_DIR/framelesshelpercore_global_p.h
|
$$CORE_PRIV_INC_DIR/framelesshelpercore_global_p.h \
|
||||||
|
$$CORE_PRIV_INC_DIR/versionnumber_p.h \
|
||||||
|
$$CORE_PRIV_INC_DIR/scopeguard_p.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
$$CORE_SRC_DIR/chromepalette.cpp \
|
$$CORE_SRC_DIR/chromepalette.cpp \
|
||||||
|
|
|
@ -84,6 +84,8 @@ set(PRIVATE_HEADERS
|
||||||
${INCLUDE_PREFIX}/private/micamaterial_p.h
|
${INCLUDE_PREFIX}/private/micamaterial_p.h
|
||||||
${INCLUDE_PREFIX}/private/windowborderpainter_p.h
|
${INCLUDE_PREFIX}/private/windowborderpainter_p.h
|
||||||
${INCLUDE_PREFIX}/private/framelesshelpercore_global_p.h
|
${INCLUDE_PREFIX}/private/framelesshelpercore_global_p.h
|
||||||
|
${INCLUDE_PREFIX}/private/versionnumber_p.h
|
||||||
|
${INCLUDE_PREFIX}/private/scopeguard_p.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "framelesshelpercore_global.h"
|
#include "framelesshelpercore_global.h"
|
||||||
#include "framelesshelpercore_global_p.h"
|
#include "framelesshelpercore_global_p.h"
|
||||||
|
#include "versionnumber_p.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include <QtCore/qmutex.h>
|
#include <QtCore/qmutex.h>
|
||||||
#include <QtCore/qiodevice.h>
|
#include <QtCore/qiodevice.h>
|
||||||
|
@ -56,14 +57,14 @@
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
QDebug operator<<(QDebug d, const FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::VersionNumber &ver)
|
QDebug operator<<(QDebug d, const FRAMELESSHELPER_PREPEND_NAMESPACE(VersionNumber) &ver)
|
||||||
{
|
{
|
||||||
const QDebugStateSaver saver(d);
|
const QDebugStateSaver saver(d);
|
||||||
d.nospace().noquote() << "VersionNumber("
|
d.nospace().noquote() << "VersionNumber("
|
||||||
<< ver.major << ", "
|
<< ver.Major << ", "
|
||||||
<< ver.minor << ", "
|
<< ver.Minor << ", "
|
||||||
<< ver.patch << ", "
|
<< ver.Patch << ", "
|
||||||
<< ver.tweak << ')';
|
<< ver.Tweak << ')';
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +73,7 @@ QDebug operator<<(QDebug d, const FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::Ver
|
||||||
const QDebugStateSaver saver(d);
|
const QDebugStateSaver saver(d);
|
||||||
int major = 0, minor = 0, patch = 0, tweak = 0;
|
int major = 0, minor = 0, patch = 0, tweak = 0;
|
||||||
FRAMELESSHELPER_EXTRACT_VERSION(ver.version, major, minor, patch, tweak)
|
FRAMELESSHELPER_EXTRACT_VERSION(ver.version, major, minor, patch, tweak)
|
||||||
const auto ver_num = FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::VersionNumber{major, minor, patch, tweak};
|
const auto ver_num = FRAMELESSHELPER_PREPEND_NAMESPACE(VersionNumber){major, minor, patch, tweak};
|
||||||
d.nospace().noquote() << "VersionInfo("
|
d.nospace().noquote() << "VersionInfo("
|
||||||
<< "version number: " << ver_num << ", "
|
<< "version number: " << ver_num << ", "
|
||||||
<< "version string: " << ver.version_str << ", "
|
<< "version string: " << ver.version_str << ", "
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
#include "../../include/FramelessHelper/Core/private/scopeguard_p.h"
|
|
@ -30,6 +30,8 @@
|
||||||
#include "registrykey_p.h"
|
#include "registrykey_p.h"
|
||||||
#include "winverhelper_p.h"
|
#include "winverhelper_p.h"
|
||||||
#include "framelesshelpercore_global_p.h"
|
#include "framelesshelpercore_global_p.h"
|
||||||
|
#include "versionnumber_p.h"
|
||||||
|
#include "scopeguard_p.h"
|
||||||
#include <QtCore/qmutex.h>
|
#include <QtCore/qmutex.h>
|
||||||
#include <QtCore/qhash.h>
|
#include <QtCore/qhash.h>
|
||||||
#include <QtCore/qloggingcategory.h>
|
#include <QtCore/qloggingcategory.h>
|
||||||
|
@ -283,9 +285,9 @@ struct SYSTEM_METRIC
|
||||||
OSVERSIONINFOEXW osvi;
|
OSVERSIONINFOEXW osvi;
|
||||||
SecureZeroMemory(&osvi, sizeof(osvi));
|
SecureZeroMemory(&osvi, sizeof(osvi));
|
||||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||||
osvi.dwMajorVersion = targetOsVer.major;
|
osvi.dwMajorVersion = targetOsVer.Major;
|
||||||
osvi.dwMinorVersion = targetOsVer.minor;
|
osvi.dwMinorVersion = targetOsVer.Minor;
|
||||||
osvi.dwBuildNumber = targetOsVer.patch;
|
osvi.dwBuildNumber = targetOsVer.Patch;
|
||||||
DWORDLONG dwlConditionMask = 0;
|
DWORDLONG dwlConditionMask = 0;
|
||||||
const auto op = VER_GREATER_EQUAL;
|
const auto op = VER_GREATER_EQUAL;
|
||||||
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
|
VER_SET_CONDITION(dwlConditionMask, VER_MAJORVERSION, op);
|
||||||
|
@ -2361,20 +2363,12 @@ void Utils::bringWindowToFront(const WId windowId)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// And also don't forget to disconnect from it.
|
// And also don't forget to disconnect from it.
|
||||||
// Ideally we would want to use qScopeGuard to do this, but sadly it was introduced
|
volatile const auto cleanup = qScopeGuard([windowThreadProcessId, currentThreadId]() -> void {
|
||||||
// in Qt 5.12 and we still want to support some old Qt versions.
|
if (AttachThreadInput(windowThreadProcessId, currentThreadId, FALSE) == FALSE) {
|
||||||
const struct __Cleanup {
|
|
||||||
const DWORD idAttach = 0;
|
|
||||||
const DWORD idAttachTo = 0;
|
|
||||||
__Cleanup(const DWORD attach, const DWORD attachTo)
|
|
||||||
: idAttach(attach), idAttachTo(attachTo) {}
|
|
||||||
~__Cleanup() {
|
|
||||||
if (AttachThreadInput(idAttach, idAttachTo, FALSE) == FALSE) {
|
|
||||||
WARNING << getSystemErrorMessage(kAttachThreadInput);
|
WARNING << getSystemErrorMessage(kAttachThreadInput);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
} __cleanup(windowThreadProcessId, currentThreadId);
|
Q_UNUSED(cleanup);
|
||||||
Q_UNUSED(__cleanup);
|
|
||||||
// Make our window be the first one in the Z order.
|
// Make our window be the first one in the Z order.
|
||||||
if (BringWindowToTop(hwnd) == FALSE) {
|
if (BringWindowToTop(hwnd) == FALSE) {
|
||||||
WARNING << getSystemErrorMessage(kBringWindowToTop);
|
WARNING << getSystemErrorMessage(kBringWindowToTop);
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
#include "../../include/FramelessHelper/Core/private/versionnumber_p.h"
|
Loading…
Reference in New Issue