refactor
This commit is contained in:
parent
f2758aba25
commit
3342a28895
|
@ -28,17 +28,25 @@ set(_@PROJECT_NAME@_supported_components Core Widgets Quick)
|
|||
|
||||
foreach(_comp ${@PROJECT_NAME@_FIND_COMPONENTS})
|
||||
if(_comp IN_LIST _@PROJECT_NAME@_supported_components)
|
||||
set(__targets_file "${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@${_comp}Targets.cmake")
|
||||
if(EXISTS "${__targets_file}")
|
||||
include("${__targets_file}")
|
||||
set(__target @PROJECT_NAME@::${_comp})
|
||||
if(TARGET ${__target})
|
||||
continue()
|
||||
else()
|
||||
set(@PROJECT_NAME@_FOUND FALSE)
|
||||
set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "Can't find necessary configuration file for @PROJECT_NAME@::${_comp}, please make sure this component is built successfully and installed properly.")
|
||||
break()
|
||||
set(__target_full @PROJECT_NAME@${_comp})
|
||||
set(__targets_file "${CMAKE_CURRENT_LIST_DIR}/${__target_full}Targets.cmake")
|
||||
if(EXISTS "${__targets_file}")
|
||||
include("${__targets_file}")
|
||||
add_library(@PROJECT_NAME@::${__target_full} ALIAS ${__target_full})
|
||||
add_library(${__target} ALIAS ${__target_full})
|
||||
else()
|
||||
set(@PROJECT_NAME@_FOUND FALSE)
|
||||
set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "Can't find necessary configuration file for ${__target}, please make sure this component is built successfully and installed properly.")
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
set(@PROJECT_NAME@_FOUND FALSE)
|
||||
set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "Unknown component: @PROJECT_NAME@::${_comp}.")
|
||||
set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "Unknown component: ${__target}.")
|
||||
break()
|
||||
endif()
|
||||
endforeach()
|
||||
|
|
|
@ -53,8 +53,7 @@ ChromePalettePrivate::ChromePalettePrivate(ChromePalette *q) : QObject(q)
|
|||
return;
|
||||
}
|
||||
q_ptr = q;
|
||||
connect(FramelessManager::instance(),
|
||||
&FramelessManager::systemThemeChanged, this, &ChromePalettePrivate::refresh);
|
||||
connect(FramelessManager::instance(), &FramelessManager::systemThemeChanged, this, &ChromePalettePrivate::refresh);
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcFramelessConfig, "wangwenx190.framelesshelper.core.framelessconfig")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessConfig, "wangwenx190.framelesshelper.core.framelessconfig")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
|
|
@ -58,10 +58,7 @@ struct FramelessQtHelperData
|
|||
bool leftButtonPressed = false;
|
||||
};
|
||||
|
||||
struct FramelessQtHelperInternal
|
||||
{
|
||||
QHash<WId, FramelessQtHelperData> data = {};
|
||||
};
|
||||
using FramelessQtHelperInternal = QHash<WId, FramelessQtHelperData>;
|
||||
|
||||
Q_GLOBAL_STATIC(FramelessQtHelperInternal, g_framelessQtHelperData)
|
||||
|
||||
|
@ -76,8 +73,8 @@ void FramelessHelperQt::addWindow(FramelessParamsConst params)
|
|||
return;
|
||||
}
|
||||
const WId windowId = params->getWindowId();
|
||||
const auto it = g_framelessQtHelperData()->data.constFind(windowId);
|
||||
if (it != g_framelessQtHelperData()->data.constEnd()) {
|
||||
const auto it = g_framelessQtHelperData()->constFind(windowId);
|
||||
if (it != g_framelessQtHelperData()->constEnd()) {
|
||||
return;
|
||||
}
|
||||
FramelessQtHelperData data = {};
|
||||
|
@ -85,7 +82,7 @@ void FramelessHelperQt::addWindow(FramelessParamsConst params)
|
|||
QWindow *window = params->getWindowHandle();
|
||||
// Give it a parent so that it can be automatically deleted by Qt.
|
||||
data.eventFilter = new FramelessHelperQt(window);
|
||||
g_framelessQtHelperData()->data.insert(windowId, data);
|
||||
g_framelessQtHelperData()->insert(windowId, data);
|
||||
const auto shouldApplyFramelessFlag = []() -> bool {
|
||||
#ifdef Q_OS_MACOS
|
||||
return false;
|
||||
|
@ -117,11 +114,11 @@ void FramelessHelperQt::removeWindow(const WId windowId)
|
|||
if (!windowId) {
|
||||
return;
|
||||
}
|
||||
const auto it = g_framelessQtHelperData()->data.constFind(windowId);
|
||||
if (it == g_framelessQtHelperData()->data.constEnd()) {
|
||||
const auto it = g_framelessQtHelperData()->constFind(windowId);
|
||||
if (it == g_framelessQtHelperData()->constEnd()) {
|
||||
return;
|
||||
}
|
||||
g_framelessQtHelperData()->data.erase(it);
|
||||
g_framelessQtHelperData()->erase(it);
|
||||
#ifdef Q_OS_MACOS
|
||||
Utils::removeWindowProxy(windowId);
|
||||
#endif
|
||||
|
@ -165,8 +162,8 @@ bool FramelessHelperQt::eventFilter(QObject *object, QEvent *event)
|
|||
}
|
||||
const auto window = qobject_cast<QWindow *>(object);
|
||||
const WId windowId = window->winId();
|
||||
const auto it = g_framelessQtHelperData()->data.find(windowId);
|
||||
if (it == g_framelessQtHelperData()->data.end()) {
|
||||
const auto it = g_framelessQtHelperData()->find(windowId);
|
||||
if (it == g_framelessQtHelperData()->end()) {
|
||||
return QObject::eventFilter(object, event);
|
||||
}
|
||||
const FramelessQtHelperData &data = it.value();
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcFramelessHelperWin, "wangwenx190.framelesshelper.core.impl.win")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessHelperWin, "wangwenx190.framelesshelper.core.impl.win")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
@ -212,7 +212,10 @@ Q_GLOBAL_STATIC(FramelessWin32HelperInternal, g_framelessWin32HelperData)
|
|||
case SystemButtonType::Close:
|
||||
return HTCLOSE;
|
||||
case SystemButtonType::Unknown:
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_MSVC(4702)
|
||||
Q_UNREACHABLE_RETURN(HTNOWHERE);
|
||||
QT_WARNING_POP
|
||||
}
|
||||
}
|
||||
// Returns "HTTRANSPARENT" to let the mouse event pass through this invisible
|
||||
|
|
|
@ -109,7 +109,7 @@ void framelesshelpercore_initResource()
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcCoreGlobal, "wangwenx190.framelesshelper.core.global")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcCoreGlobal, "wangwenx190.framelesshelper.core.global")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcFramelessManager, "wangwenx190.framelesshelper.core.framelessmanager")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessManager, "wangwenx190.framelesshelper.core.framelessmanager")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcMicaMaterial, "wangwenx190.framelesshelper.core.micamaterial")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcMicaMaterial, "wangwenx190.framelesshelper.core.micamaterial")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
@ -157,16 +157,12 @@ static inline void qt_blurrow(QImage &im, const int line, const int alpha)
|
|||
|
||||
int zR = 0, zG = 0, zB = 0, zA = 0;
|
||||
|
||||
#ifdef Q_CC_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4127) // false alarm.
|
||||
#endif // Q_CC_MSVC
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_MSVC(4127) // false alarm.
|
||||
if (alphaOnly && (im.format() != QImage::Format_Indexed8)) {
|
||||
bptr += alphaIndex;
|
||||
}
|
||||
#ifdef Q_CC_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif // Q_CC_MSVC
|
||||
QT_WARNING_POP
|
||||
|
||||
const int stride = (im.depth() >> 3);
|
||||
const int im_width = im.width();
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcSysApiLoader, "wangwenx190.framelesshelper.core.sysapiloader")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcSysApiLoader, "wangwenx190.framelesshelper.core.sysapiloader")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
@ -71,14 +71,15 @@ static Q_LOGGING_CATEGORY(lcSysApiLoader, "wangwenx190.framelesshelper.core.sysa
|
|||
# define CRITICAL qCCritical(lcSysApiLoader)
|
||||
#endif
|
||||
|
||||
struct SysApiLoaderData
|
||||
{
|
||||
QHash<QString, QFunctionPointer> functionCache = {};
|
||||
};
|
||||
using SysApiLoaderData = QHash<QString, QFunctionPointer>;
|
||||
|
||||
Q_GLOBAL_STATIC(SysApiLoaderData, g_sysApiLoaderData)
|
||||
|
||||
static const bool LoaderDebugFlag = qEnvironmentVariableIntValue("FRAMELESSHELPER_SYSAPILOADER_DEBUG");
|
||||
[[nodiscard]] static inline bool isDebug()
|
||||
{
|
||||
static const bool flag = qEnvironmentVariableIntValue("FRAMELESSHELPER_SYSAPILOADER_DEBUG");
|
||||
return flag;
|
||||
}
|
||||
|
||||
SysApiLoader::SysApiLoader(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
@ -113,11 +114,11 @@ QString SysApiLoader::platformSystemLibraryDirectory()
|
|||
static const auto result = []() -> QString {
|
||||
#ifdef Q_OS_WINDOWS
|
||||
QVarLengthArray<wchar_t, MAX_PATH> buf = {};
|
||||
const UINT len = GetSystemDirectoryW(buf.data(), MAX_PATH);
|
||||
const UINT len = ::GetSystemDirectoryW(buf.data(), MAX_PATH);
|
||||
if (len > MAX_PATH) {
|
||||
// No need to +1 here, GetSystemDirectoryW() will always give us a null terminator.
|
||||
buf.resize(len);
|
||||
GetSystemDirectoryW(buf.data(), len);
|
||||
::GetSystemDirectoryW(buf.data(), len);
|
||||
}
|
||||
return QString::fromWCharArray(buf.constData(), len);
|
||||
#else
|
||||
|
@ -184,16 +185,16 @@ bool SysApiLoader::isAvailable(const QString &library, const QString &function)
|
|||
return false;
|
||||
}
|
||||
const QString key = generateUniqueKey(library, function);
|
||||
const auto it = g_sysApiLoaderData()->functionCache.constFind(key);
|
||||
if (it != g_sysApiLoaderData()->functionCache.constEnd()) {
|
||||
if (LoaderDebugFlag) {
|
||||
const auto it = g_sysApiLoaderData()->constFind(key);
|
||||
if (it != g_sysApiLoaderData()->constEnd()) {
|
||||
if (isDebug()) {
|
||||
DEBUG << Q_FUNC_INFO << "Function cache found:" << key;
|
||||
}
|
||||
return (it.value() != nullptr);
|
||||
} else {
|
||||
const QFunctionPointer symbol = SysApiLoader::resolve(library, function);
|
||||
g_sysApiLoaderData()->functionCache.insert(key, symbol);
|
||||
if (LoaderDebugFlag) {
|
||||
g_sysApiLoaderData()->insert(key, symbol);
|
||||
if (isDebug()) {
|
||||
DEBUG << Q_FUNC_INFO << "New function cache:" << key << (symbol ? "[VALID]" : "[NULL]");
|
||||
}
|
||||
if (symbol) {
|
||||
|
@ -214,14 +215,14 @@ QFunctionPointer SysApiLoader::get(const QString &library, const QString &functi
|
|||
return nullptr;
|
||||
}
|
||||
const QString key = generateUniqueKey(library, function);
|
||||
const auto it = g_sysApiLoaderData()->functionCache.constFind(key);
|
||||
if (it != g_sysApiLoaderData()->functionCache.constEnd()) {
|
||||
if (LoaderDebugFlag) {
|
||||
const auto it = g_sysApiLoaderData()->constFind(key);
|
||||
if (it != g_sysApiLoaderData()->constEnd()) {
|
||||
if (isDebug()) {
|
||||
DEBUG << Q_FUNC_INFO << "Function cache found:" << key;
|
||||
}
|
||||
return it.value();
|
||||
} else {
|
||||
if (LoaderDebugFlag) {
|
||||
if (isDebug()) {
|
||||
DEBUG << Q_FUNC_INFO << "Function cache not found:" << key;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcUtilsCommon, "wangwenx190.framelesshelper.core.utils.common")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsCommon, "wangwenx190.framelesshelper.core.utils.common")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcUtilsLinux, "wangwenx190.framelesshelper.core.utils.linux")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsLinux, "wangwenx190.framelesshelper.core.utils.linux")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
|
|
@ -67,7 +67,7 @@ FRAMELESSHELPER_END_NAMESPACE
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcUtilsMac, "wangwenx190.framelesshelper.core.utils.mac")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsMac, "wangwenx190.framelesshelper.core.utils.mac")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
@ -513,10 +513,7 @@ private:
|
|||
static inline sendEventPtr oldSendEvent = nil;
|
||||
};
|
||||
|
||||
struct MacUtilsData
|
||||
{
|
||||
QHash<WId, NSWindowProxy *> hash = {};
|
||||
};
|
||||
using MacUtilsData = QHash<WId, NSWindowProxy *>;
|
||||
|
||||
Q_GLOBAL_STATIC(MacUtilsData, g_macUtilsData);
|
||||
|
||||
|
@ -536,17 +533,17 @@ Q_GLOBAL_STATIC(MacUtilsData, g_macUtilsData);
|
|||
|
||||
static inline void cleanupProxy()
|
||||
{
|
||||
if (g_macUtilsData()->hash.isEmpty()) {
|
||||
if (g_macUtilsData()->isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (auto &&proxy : std::as_const(g_macUtilsData()->hash)) {
|
||||
for (auto &&proxy : std::as_const(g_macUtilsData())) {
|
||||
Q_ASSERT(proxy);
|
||||
if (!proxy) {
|
||||
continue;
|
||||
}
|
||||
delete proxy;
|
||||
}
|
||||
g_macUtilsData()->hash.clear();
|
||||
g_macUtilsData()->clear();
|
||||
}
|
||||
|
||||
[[nodiscard]] static inline NSWindowProxy *ensureWindowProxy(const WId windowId)
|
||||
|
@ -555,8 +552,8 @@ static inline void cleanupProxy()
|
|||
if (!windowId) {
|
||||
return nil;
|
||||
}
|
||||
auto it = g_macUtilsData()->hash.find(windowId);
|
||||
if (it == g_macUtilsData()->hash.end()) {
|
||||
auto it = g_macUtilsData()->find(windowId);
|
||||
if (it == g_macUtilsData()->end()) {
|
||||
QWindow * const qwindow = Utils::findWindow(windowId);
|
||||
Q_ASSERT(qwindow);
|
||||
if (!qwindow) {
|
||||
|
@ -568,7 +565,7 @@ static inline void cleanupProxy()
|
|||
return nil;
|
||||
}
|
||||
const auto proxy = new NSWindowProxy(qwindow, nswindow);
|
||||
it = g_macUtilsData()->hash.insert(windowId, proxy);
|
||||
it = g_macUtilsData()->insert(windowId, proxy);
|
||||
}
|
||||
static bool cleanerInstalled = false;
|
||||
if (!cleanerInstalled) {
|
||||
|
@ -737,8 +734,8 @@ void Utils::removeWindowProxy(const WId windowId)
|
|||
if (!windowId) {
|
||||
return;
|
||||
}
|
||||
const auto it = g_macUtilsData()->hash.constFind(windowId);
|
||||
if (it == g_macUtilsData()->hash.constEnd()) {
|
||||
const auto it = g_macUtilsData()->constFind(windowId);
|
||||
if (it == g_macUtilsData()->constEnd()) {
|
||||
return;
|
||||
}
|
||||
if (const auto proxy = it.value()) {
|
||||
|
@ -746,7 +743,7 @@ void Utils::removeWindowProxy(const WId windowId)
|
|||
// so no need to do it manually here.
|
||||
delete proxy;
|
||||
}
|
||||
g_macUtilsData()->hash.erase(it);
|
||||
g_macUtilsData()->erase(it);
|
||||
}
|
||||
|
||||
QColor Utils::getFrameBorderColor(const bool active)
|
||||
|
|
|
@ -57,7 +57,7 @@ Q_DECLARE_METATYPE(QMargins)
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcUtilsWin, "wangwenx190.framelesshelper.core.utils.win")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsWin, "wangwenx190.framelesshelper.core.utils.win")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
@ -1675,7 +1675,10 @@ void Utils::setCornerStyleForWindow(const WId windowId, const WindowCornerStyle
|
|||
case WindowCornerStyle::Round:
|
||||
return _DWMWCP_ROUND;
|
||||
}
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_MSVC(4702)
|
||||
Q_UNREACHABLE_RETURN(_DWMWCP_DEFAULT);
|
||||
QT_WARNING_POP
|
||||
}();
|
||||
const HRESULT hr = API_CALL_FUNCTION(dwmapi, DwmSetWindowAttribute,
|
||||
hwnd, _DWMWA_WINDOW_CORNER_PREFERENCE, &wcp, sizeof(wcp));
|
||||
|
@ -1728,7 +1731,10 @@ bool Utils::setBlurBehindWindowEnabled(const WId windowId, const BlurMode mode,
|
|||
}
|
||||
return BlurMode::Windows_Aero;
|
||||
}
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_MSVC(4702)
|
||||
Q_UNREACHABLE_RETURN(BlurMode::Default);
|
||||
QT_WARNING_POP
|
||||
}();
|
||||
if (blurMode == BlurMode::Disable) {
|
||||
bool result = true;
|
||||
|
@ -1834,7 +1840,10 @@ bool Utils::setBlurBehindWindowEnabled(const WId windowId, const BlurMode mode,
|
|||
policy.AccentState = ACCENT_ENABLE_BLURBEHIND;
|
||||
policy.AccentFlags = ACCENT_NONE;
|
||||
} else {
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_MSVC(4702)
|
||||
Q_UNREACHABLE_RETURN(false);
|
||||
QT_WARNING_POP
|
||||
}
|
||||
WINDOWCOMPOSITIONATTRIBDATA wcad;
|
||||
SecureZeroMemory(&wcad, sizeof(wcad));
|
||||
|
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcFramelessQuickHelper, "wangwenx190.framelesshelper.quick.framelessquickhelper")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickHelper, "wangwenx190.framelesshelper.quick.framelessquickhelper")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
@ -83,10 +83,7 @@ struct FramelessQuickHelperData
|
|||
QList<QRect> hitTestVisibleRects = {};
|
||||
};
|
||||
|
||||
struct FramelessQuickHelperInternal
|
||||
{
|
||||
QHash<WId, FramelessQuickHelperData> data = {};
|
||||
};
|
||||
using FramelessQuickHelperInternal = QHash<WId, FramelessQuickHelperData>;
|
||||
|
||||
Q_GLOBAL_STATIC(FramelessQuickHelperInternal, g_framelessQuickHelperData)
|
||||
|
||||
|
@ -249,11 +246,11 @@ void FramelessQuickHelperPrivate::detach()
|
|||
return;
|
||||
}
|
||||
const WId windowId = w->winId();
|
||||
const auto it = g_framelessQuickHelperData()->data.constFind(windowId);
|
||||
if (it == g_framelessQuickHelperData()->data.constEnd()) {
|
||||
const auto it = g_framelessQuickHelperData()->constFind(windowId);
|
||||
if (it == g_framelessQuickHelperData()->constEnd()) {
|
||||
return;
|
||||
}
|
||||
g_framelessQuickHelperData()->data.erase(it);
|
||||
g_framelessQuickHelperData()->erase(it);
|
||||
FramelessManager::instance()->removeWindow(windowId);
|
||||
}
|
||||
|
||||
|
@ -951,9 +948,9 @@ const FramelessQuickHelperData *FramelessQuickHelperPrivate::getWindowData() con
|
|||
return nullptr;
|
||||
}
|
||||
const WId windowId = window->winId();
|
||||
auto it = g_framelessQuickHelperData()->data.find(windowId);
|
||||
if (it == g_framelessQuickHelperData()->data.end()) {
|
||||
it = g_framelessQuickHelperData()->data.insert(windowId, {});
|
||||
auto it = g_framelessQuickHelperData()->find(windowId);
|
||||
if (it == g_framelessQuickHelperData()->end()) {
|
||||
it = g_framelessQuickHelperData()->insert(windowId, {});
|
||||
}
|
||||
return &it.value();
|
||||
}
|
||||
|
@ -967,9 +964,9 @@ FramelessQuickHelperData *FramelessQuickHelperPrivate::getWindowDataMutable() co
|
|||
return nullptr;
|
||||
}
|
||||
const WId windowId = window->winId();
|
||||
auto it = g_framelessQuickHelperData()->data.find(windowId);
|
||||
if (it == g_framelessQuickHelperData()->data.end()) {
|
||||
it = g_framelessQuickHelperData()->data.insert(windowId, {});
|
||||
auto it = g_framelessQuickHelperData()->find(windowId);
|
||||
if (it == g_framelessQuickHelperData()->end()) {
|
||||
it = g_framelessQuickHelperData()->insert(windowId, {});
|
||||
}
|
||||
return &it.value();
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcQuickImageItem, "wangwenx190.framelesshelper.quick.quickimageitem")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickImageItem, "wangwenx190.framelesshelper.quick.quickimageitem")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcQuickStandardTitleBar, "wangwenx190.framelesshelper.quick.quickstandardtitlebar")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickStandardTitleBar, "wangwenx190.framelesshelper.quick.quickstandardtitlebar")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcFramelessWidgetsHelper, "wangwenx190.framelesshelper.widgets.framelesswidgetshelper")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessWidgetsHelper, "wangwenx190.framelesshelper.widgets.framelesswidgetshelper")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
@ -79,10 +79,7 @@ struct FramelessWidgetsHelperData
|
|||
QList<QRect> hitTestVisibleRects = {};
|
||||
};
|
||||
|
||||
struct FramelessWidgetsHelperInternal
|
||||
{
|
||||
QHash<WId, FramelessWidgetsHelperData> data = {};
|
||||
};
|
||||
using FramelessWidgetsHelperInternal = QHash<WId, FramelessWidgetsHelperData>;
|
||||
|
||||
Q_GLOBAL_STATIC(FramelessWidgetsHelperInternal, g_framelessWidgetsHelperData)
|
||||
|
||||
|
@ -605,11 +602,11 @@ void FramelessWidgetsHelperPrivate::detach()
|
|||
return;
|
||||
}
|
||||
const WId windowId = m_window->winId();
|
||||
const auto it = g_framelessWidgetsHelperData()->data.constFind(windowId);
|
||||
if (it == g_framelessWidgetsHelperData()->data.constEnd()) {
|
||||
const auto it = g_framelessWidgetsHelperData()->constFind(windowId);
|
||||
if (it == g_framelessWidgetsHelperData()->constEnd()) {
|
||||
return;
|
||||
}
|
||||
g_framelessWidgetsHelperData()->data.erase(it);
|
||||
g_framelessWidgetsHelperData()->erase(it);
|
||||
FramelessManager::instance()->removeWindow(windowId);
|
||||
m_window = nullptr;
|
||||
emitSignalForAllInstances("windowChanged");
|
||||
|
@ -650,9 +647,9 @@ const FramelessWidgetsHelperData *FramelessWidgetsHelperPrivate::getWindowData()
|
|||
return nullptr;
|
||||
}
|
||||
const WId windowId = m_window->winId();
|
||||
auto it = g_framelessWidgetsHelperData()->data.find(windowId);
|
||||
if (it == g_framelessWidgetsHelperData()->data.end()) {
|
||||
it = g_framelessWidgetsHelperData()->data.insert(windowId, {});
|
||||
auto it = g_framelessWidgetsHelperData()->find(windowId);
|
||||
if (it == g_framelessWidgetsHelperData()->end()) {
|
||||
it = g_framelessWidgetsHelperData()->insert(windowId, {});
|
||||
}
|
||||
return &it.value();
|
||||
}
|
||||
|
@ -664,9 +661,9 @@ FramelessWidgetsHelperData *FramelessWidgetsHelperPrivate::getWindowDataMutable(
|
|||
return nullptr;
|
||||
}
|
||||
const WId windowId = m_window->winId();
|
||||
auto it = g_framelessWidgetsHelperData()->data.find(windowId);
|
||||
if (it == g_framelessWidgetsHelperData()->data.end()) {
|
||||
it = g_framelessWidgetsHelperData()->data.insert(windowId, {});
|
||||
auto it = g_framelessWidgetsHelperData()->find(windowId);
|
||||
if (it == g_framelessWidgetsHelperData()->end()) {
|
||||
it = g_framelessWidgetsHelperData()->insert(windowId, {});
|
||||
}
|
||||
return &it.value();
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
static Q_LOGGING_CATEGORY(lcStandardTitleBar, "wangwenx190.framelesshelper.widgets.standardtitlebar")
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcStandardTitleBar, "wangwenx190.framelesshelper.widgets.standardtitlebar")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
|
|
Loading…
Reference in New Issue