large refactor
This commit is contained in:
parent
2db829884d
commit
6abb636a19
|
@ -55,6 +55,20 @@ option(FRAMELESSHELPER_EXAMPLES_STANDALONE "Build the demo projects as standalon
|
|||
cmake_dependent_option(FRAMELESSHELPER_ENABLE_UNIVERSAL_BUILD "macOS only: build universal library/example for Mac." ON APPLE OFF)
|
||||
option(FRAMELESSHELPER_FORCE_LTO "Force enable LTO/LTCG even when building static libraries." OFF)
|
||||
option(FRAMELESSHELPER_REPRODUCIBLE_OUTPUT "Don't update the build commit and date dynamically." ON)
|
||||
option(FRAMELESSHELPER_NO_WINDOW "Disable the pre-defined FramelessWindow wrapper class." OFF)
|
||||
option(FRAMELESSHELPER_NO_TITLEBAR "Disable the pre-defined StandardTitleBar control." OFF)
|
||||
option(FRAMELESSHELPER_NO_TRANSLATION "Don't bundle the I18N translations into the library." OFF)
|
||||
option(FRAMELESSHELPER_NO_MICA_MATERIAL "Disable the cross-platform homemade Mica Material." OFF)
|
||||
option(FRAMELESSHELPER_NO_BORDER_PAINTER "Disable the cross-platform window frame border painter." OFF)
|
||||
option(FRAMELESSHELPER_NO_SYSTEM_BUTTON "Disable the pre-defined StandardSystemButton control." OFF)
|
||||
|
||||
set(PROJECT_VERSION_HEX "0x00000000")
|
||||
math(EXPR PROJECT_VERSION_HEX "((${PROJECT_VERSION_MAJOR} & 0xff) << 24) | ((${PROJECT_VERSION_MINOR} & 0xff) << 16) | ((${PROJECT_VERSION_PATCH} & 0xff) << 8)" OUTPUT_FORMAT HEXADECIMAL)
|
||||
|
||||
set(FRAMELESSHELPER_64BIT_POSTFIX "")
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(FRAMELESSHELPER_64BIT_POSTFIX "64")
|
||||
endif()
|
||||
|
||||
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Gui)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui)
|
||||
|
@ -80,7 +94,7 @@ if(FRAMELESSHELPER_ENABLE_VCLTL AND NOT MSVC)
|
|||
message(WARNING "VC-LTL is only available for the MSVC toolchain.")
|
||||
endif()
|
||||
|
||||
set(__extra_flags)
|
||||
set(__extra_flags "")
|
||||
if(NOT FRAMELESSHELPER_BUILD_STATIC)
|
||||
list(APPEND __extra_flags ENABLE_LTO)
|
||||
endif()
|
||||
|
@ -130,7 +144,7 @@ if(MSVC)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
set(__extra_flags)
|
||||
set(__extra_flags "")
|
||||
if(FRAMELESSHELPER_NO_INSTALL)
|
||||
list(APPEND __extra_flags NO_INSTALL)
|
||||
endif()
|
||||
|
@ -158,7 +172,7 @@ if(FRAMELESSHELPER_BUILD_EXAMPLES)
|
|||
add_subdirectory(examples)
|
||||
endif()
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_INSTALL)
|
||||
if(WIN32 AND NOT FRAMELESSHELPER_NO_INSTALL)
|
||||
install(FILES "msbuild/FramelessHelper.props" DESTINATION ".")
|
||||
endif()
|
||||
|
||||
|
@ -234,5 +248,11 @@ if(NOT FRAMELESSHELPER_NO_SUMMARY)
|
|||
message("[macOS]: Build universal library/example: ${FRAMELESSHELPER_ENABLE_UNIVERSAL_BUILD}")
|
||||
message("Force enable LTO: ${FRAMELESSHELPER_FORCE_LTO}")
|
||||
message("Make output reproducible: ${FRAMELESSHELPER_REPRODUCIBLE_OUTPUT}")
|
||||
message("Disable the FramelessWindow class (to reduce file size): ${FRAMELESSHELPER_NO_WINDOW}")
|
||||
message("Disable the StandardTitleBar class (to reduce file size): ${FRAMELESSHELPER_NO_TITLEBAR}")
|
||||
message("Don't embed the I18N resources (to reduce file size): ${FRAMELESSHELPER_NO_TRANSLATION}")
|
||||
message("Disable the MicaMaterial class (to reduce file size): ${FRAMELESSHELPER_NO_MICA_MATERIAL}")
|
||||
message("Disable the WindowBorderPainter class (to reduce file size): ${FRAMELESSHELPER_NO_BORDER_PAINTER}")
|
||||
message("Disable the StandardSystemButton class (to reduce file size): ${FRAMELESSHELPER_NO_SYSTEM_BUTTON}")
|
||||
message("-----------------------------------------------------------------")
|
||||
endif()
|
||||
|
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
|||
Subproject commit 7215bd692b7a62f307c7dffbe200554a12aabbf4
|
||||
Subproject commit a0d72f177e9a919c1f273b67d0456a052020781a
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class ChromePalettePrivate;
|
||||
|
@ -33,6 +35,7 @@ class ChromePalettePrivate;
|
|||
class FRAMELESSHELPER_CORE_API ChromePalette : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PRIVATE(ChromePalette)
|
||||
Q_DISABLE_COPY_MOVE(ChromePalette)
|
||||
|
||||
|
@ -123,3 +126,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,6 +33,7 @@ struct SystemParameters;
|
|||
class FRAMELESSHELPER_CORE_API FramelessHelperQt : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(FramelessHelperQt)
|
||||
|
||||
public:
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||
#include <QtCore/qabstractnativeeventfilter.h>
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
struct SystemParameters;
|
||||
|
@ -46,3 +48,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include "framelesshelper.config"
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qmath.h>
|
||||
#include <QtCore/qpoint.h>
|
||||
|
@ -165,6 +166,41 @@ QT_END_NAMESPACE
|
|||
} while (false)
|
||||
#endif
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUOTE
|
||||
# define FRAMELESSHELPER_QUOTE(x) #x
|
||||
#endif
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUOTE2
|
||||
# define FRAMELESSHELPER_QUOTE2(x) FRAMELESSHELPER_QUOTE(x)
|
||||
#endif
|
||||
|
||||
#ifndef FRAMELESSHELPER_CONCAT
|
||||
# define FRAMELESSHELPER_CONCAT(a, b) a##b
|
||||
#endif
|
||||
|
||||
#ifndef FRAMELESSHELPER_CONCAT2
|
||||
# define FRAMELESSHELPER_CONCAT2(a, b) FRAMELESSHELPER_CONCAT(a, b)
|
||||
#endif
|
||||
|
||||
/*
|
||||
The FRAMELESSHELPER_CONFIG macro implements a safe compile time check for features of FramelessHelper.
|
||||
Features can be in three states:
|
||||
0 or undefined: This will lead to a compile error when testing for it
|
||||
-1: The feature is not available
|
||||
1: The feature is available
|
||||
*/
|
||||
#ifndef FRAMELESSHELPER_CONFIG
|
||||
# define FRAMELESSHELPER_CONFIG(feature) ((1 / FRAMELESSHELPER_FEATURE_##feature) == 1)
|
||||
#endif
|
||||
|
||||
#ifndef FRAMELESSHELPER_REQUIRE_CONFIG
|
||||
# define FRAMELESSHELPER_REQUIRE_CONFIG(feature) static_assert(FRAMELESSHELPER_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " is not available!")
|
||||
#endif
|
||||
|
||||
#ifndef FRAMELESSHELPER_CLASS_INFO
|
||||
# define FRAMELESSHELPER_CLASS_INFO Q_CLASSINFO("__FRAMELESSHELPER__", FRAMELESSHELPER_QUOTE2(__FRAMELESSHELPER__))
|
||||
#endif
|
||||
|
||||
#ifndef FRAMELESSHELPER_BYTEARRAY_CONSTANT2
|
||||
# define FRAMELESSHELPER_BYTEARRAY_CONSTANT2(name, ba) \
|
||||
[[maybe_unused]] static constexpr const auto k##name = FRAMELESSHELPER_BYTEARRAY(ba);
|
||||
|
@ -217,11 +253,12 @@ QT_END_NAMESPACE
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
// Call this function in your main() function if you are using FramelessHelper as a static library,
|
||||
// it can make sure the resources bundled in the static library are correctly initialized.
|
||||
// NOTE: This function is intentionally not inside any namespaces.
|
||||
FRAMELESSHELPER_CORE_API void framelesshelpercore_initResource();
|
||||
FRAMELESSHELPER_CORE_API void FramelessHelperCoreInitResource();
|
||||
inline void framelesshelpercore_initResource() { FramelessHelperCoreInitResource(); }
|
||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
@ -474,17 +511,43 @@ struct Dpi
|
|||
{
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
[[nodiscard]] friend constexpr bool operator>(const Dpi &lhs, const Dpi &rhs) noexcept
|
||||
{
|
||||
return ((lhs.x * lhs.y) > (rhs.x * rhs.y));
|
||||
}
|
||||
|
||||
[[nodiscard]] friend constexpr bool operator>=(const Dpi &lhs, const Dpi &rhs) noexcept
|
||||
{
|
||||
return (operator>(lhs, rhs) || operator==(lhs, rhs));
|
||||
}
|
||||
|
||||
[[nodiscard]] friend constexpr bool operator<(const Dpi &lhs, const Dpi &rhs) noexcept
|
||||
{
|
||||
return (operator!=(lhs, rhs) && !operator>(lhs, rhs));
|
||||
}
|
||||
|
||||
[[nodiscard]] friend constexpr bool operator<=(const Dpi &lhs, const Dpi &rhs) noexcept
|
||||
{
|
||||
return (operator<(lhs, rhs) || operator==(lhs, rhs));
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Global
|
||||
|
||||
FRAMELESSHELPER_CORE_API void FramelessHelperCoreInitialize();
|
||||
FRAMELESSHELPER_CORE_API void FramelessHelperCoreUninitialize();
|
||||
[[nodiscard]] FRAMELESSHELPER_CORE_API Global::VersionInfo FramelessHelperVersion();
|
||||
FRAMELESSHELPER_CORE_API void FramelessHelperEnableThemeAware();
|
||||
FRAMELESSHELPER_CORE_API void FramelessHelperPrintLogo();
|
||||
|
||||
namespace FramelessHelper::Core
|
||||
{
|
||||
FRAMELESSHELPER_CORE_API void initialize();
|
||||
FRAMELESSHELPER_CORE_API void uninitialize();
|
||||
[[nodiscard]] FRAMELESSHELPER_CORE_API Global::VersionInfo version();
|
||||
FRAMELESSHELPER_CORE_API void setApplicationOSThemeAware();
|
||||
FRAMELESSHELPER_CORE_API void outputLogo();
|
||||
inline void initialize() { FramelessHelperCoreInitialize(); }
|
||||
inline void uninitialize() { FramelessHelperCoreUninitialize(); }
|
||||
[[nodiscard]] inline Global::VersionInfo version() { return FramelessHelperVersion(); }
|
||||
inline void setApplicationOSThemeAware() { FramelessHelperEnableThemeAware(); }
|
||||
inline void outputLogo() { FramelessHelperPrintLogo(); }
|
||||
} // namespace FramelessHelper::Core
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -34,6 +34,7 @@ class FramelessManagerPrivate;
|
|||
class FRAMELESSHELPER_CORE_API FramelessManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PRIVATE(FramelessManager)
|
||||
Q_DISABLE_COPY_MOVE(FramelessManager)
|
||||
Q_PROPERTY(Global::SystemTheme systemTheme READ systemTheme WRITE setOverrideTheme NOTIFY systemThemeChanged FINAL)
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class MicaMaterialPrivate;
|
||||
|
@ -33,6 +35,7 @@ class MicaMaterialPrivate;
|
|||
class FRAMELESSHELPER_CORE_API MicaMaterial : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(MicaMaterial)
|
||||
Q_DECLARE_PRIVATE(MicaMaterial)
|
||||
|
||||
|
@ -83,3 +86,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||
#include <optional>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class ChromePalette;
|
||||
|
@ -34,6 +36,7 @@ class ChromePalette;
|
|||
class FRAMELESSHELPER_CORE_API ChromePalettePrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(ChromePalette)
|
||||
Q_DISABLE_COPY_MOVE(ChromePalettePrivate)
|
||||
|
||||
|
@ -72,3 +75,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -31,6 +31,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
|||
class FRAMELESSHELPER_CORE_API FramelessConfig : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(FramelessConfig)
|
||||
|
||||
public:
|
||||
|
|
|
@ -33,9 +33,6 @@ QT_END_NAMESPACE
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
using InitializeHookCallback = std::function<void()>;
|
||||
using UninitializeHookCallback = std::function<void()>;
|
||||
|
||||
using GetWindowFlagsCallback = std::function<Qt::WindowFlags()>;
|
||||
using SetWindowFlagsCallback = std::function<void(const Qt::WindowFlags)>;
|
||||
using GetWindowSizeCallback = std::function<QSize()>;
|
||||
|
@ -102,9 +99,6 @@ using FramelessParamsConst = const SystemParameters *;
|
|||
using FramelessParamsRef = SystemParameters &;
|
||||
using FramelessParamsConstRef = const SystemParameters &;
|
||||
|
||||
FRAMELESSHELPER_CORE_API void registerInitializeHook(const InitializeHookCallback &cb);
|
||||
FRAMELESSHELPER_CORE_API void registerUninitializeHook(const UninitializeHookCallback &cb);
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#define DECLARE_SIZE_COMPARE_OPERATORS(Type1, Type2) \
|
||||
|
|
|
@ -36,6 +36,7 @@ class FramelessManager;
|
|||
class FRAMELESSHELPER_CORE_API FramelessManagerPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(FramelessManager)
|
||||
Q_DISABLE_COPY_MOVE(FramelessManagerPrivate)
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||
#include <QtGui/qbrush.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class MicaMaterial;
|
||||
|
@ -34,6 +36,7 @@ class MicaMaterial;
|
|||
class FRAMELESSHELPER_CORE_API MicaMaterialPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(MicaMaterialPrivate)
|
||||
Q_DECLARE_PUBLIC(MicaMaterial)
|
||||
|
||||
|
@ -69,3 +72,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <QtCore/qvariant.h>
|
||||
#include <optional>
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
#ifndef REGISTRYKEY_FORCE_QSETTINGS
|
||||
# define REGISTRYKEY_FORCE_QSETTINGS (0)
|
||||
#endif // REGISTRYKEY_FORCE_QSETTINGS
|
||||
|
@ -58,6 +60,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
|||
class FRAMELESSHELPER_CORE_API RegistryKey : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(RegistryKey)
|
||||
|
||||
public:
|
||||
|
@ -91,3 +94,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
|
|
@ -31,6 +31,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
|||
class FRAMELESSHELPER_CORE_API SysApiLoader : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(SysApiLoader)
|
||||
|
||||
public:
|
||||
|
@ -86,7 +87,7 @@ FRAMELESSHELPER_END_NAMESPACE
|
|||
# define API_NT_AVAILABLE(func) API_AVAILABLE(ntdll, func)
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
# define API_XLIB_AVAILABLE(func) API_AVAILABLE(libX11, func)
|
||||
# define API_XCB_AVAILABLE(func) API_AVAILABLE(libxcb, func)
|
||||
# define API_GTK_AVAILABLE(func) API_AVAILABLE(libgtk, func)
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||
#include <optional>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class WindowBorderPainter;
|
||||
|
@ -34,6 +36,7 @@ class WindowBorderPainter;
|
|||
class FRAMELESSHELPER_CORE_API WindowBorderPainterPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(WindowBorderPainter)
|
||||
Q_DISABLE_COPY_MOVE(WindowBorderPainterPrivate)
|
||||
|
||||
|
@ -52,3 +55,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
namespace WindowsVersionHelper
|
||||
|
@ -68,3 +70,5 @@ DECL(1122H2)
|
|||
} // namespace WindowsVersionHelper
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
|
|
@ -25,11 +25,11 @@
|
|||
#pragma once
|
||||
|
||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||
#ifdef Q_OS_LINUX
|
||||
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
# include <FramelessHelper/Core/framelesshelper_linux.h>
|
||||
#endif // Q_OS_LINUX
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QScreen;
|
||||
QT_END_NAMESPACE
|
||||
|
@ -155,7 +155,7 @@ FRAMELESSHELPER_CORE_API void moveWindowToDesktopCenter(
|
|||
FRAMELESSHELPER_CORE_API void printWin32Message(void *msg);
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
[[nodiscard]] FRAMELESSHELPER_CORE_API QScreen *x11_findScreenForVirtualDesktop
|
||||
(const int virtualDesktopNumber);
|
||||
[[nodiscard]] FRAMELESSHELPER_CORE_API x11_return_type x11_appRootWindow(const int screen);
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <FramelessHelper/Core/framelesshelpercore_global.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class WindowBorderPainterPrivate;
|
||||
|
@ -33,6 +35,7 @@ class WindowBorderPainterPrivate;
|
|||
class FRAMELESSHELPER_CORE_API WindowBorderPainter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(WindowBorderPainter)
|
||||
Q_DECLARE_PRIVATE(WindowBorderPainter)
|
||||
|
||||
|
@ -80,3 +83,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
#include "quickimageitem.h"
|
|
@ -77,9 +77,14 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
|||
[[maybe_unused]] inline constexpr const int FRAMELESSHELPER_QUICK_VERSION_MAJOR = 1;
|
||||
[[maybe_unused]] inline constexpr const int FRAMELESSHELPER_QUICK_VERSION_MINOR = 0;
|
||||
|
||||
FRAMELESSHELPER_QUICK_API void FramelessHelperQuickInitialize();
|
||||
FRAMELESSHELPER_QUICK_API void FramelessHelperQuickUninitialize();
|
||||
FRAMELESSHELPER_QUICK_API void FramelessHelperQuickRegisterTypes(QQmlEngine *);
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API QuickGlobal : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(QuickGlobal)
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(FramelessHelperConstants)
|
||||
|
@ -148,8 +153,8 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QuickGlobal::WindowEdges)
|
|||
|
||||
namespace FramelessHelper::Quick
|
||||
{
|
||||
FRAMELESSHELPER_QUICK_API void initialize();
|
||||
FRAMELESSHELPER_QUICK_API void uninitialize();
|
||||
inline void initialize() { FramelessHelperQuickInitialize(); }
|
||||
inline void uninitialize() { FramelessHelperQuickUninitialize(); }
|
||||
} // namespace FramelessHelper::Quick
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -30,13 +30,18 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessQuickHelperPrivate;
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
class QuickMicaMaterial;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
class QuickWindowBorder;
|
||||
#endif
|
||||
class FramelessQuickHelperPrivate;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API FramelessQuickHelper : public QQuickItem
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(FramelessHelper)
|
||||
#endif
|
||||
|
@ -63,8 +68,12 @@ public:
|
|||
Q_NODISCARD bool isBlurBehindWindowEnabled() const;
|
||||
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
Q_NODISCARD QuickMicaMaterial *micaMaterial() const;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
Q_NODISCARD QuickWindowBorder *windowBorder() const;
|
||||
#endif
|
||||
|
||||
Q_NODISCARD bool isReady() const;
|
||||
void waitForReady();
|
||||
|
|
|
@ -34,7 +34,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
|||
|
||||
namespace FramelessHelper::Quick
|
||||
{
|
||||
FRAMELESSHELPER_QUICK_API void registerTypes(QQmlEngine *engine);
|
||||
inline void registerTypes(QQmlEngine *engine) { FramelessHelperQuickRegisterTypes(engine); }
|
||||
} // namespace FramelessHelper::Quick
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -36,6 +36,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
|||
class FRAMELESSHELPER_QUICK_API FramelessQuickUtils : public QObject, public QQmlParserStatus
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(FramelessQuickUtils)
|
||||
Q_INTERFACES(QQmlParserStatus)
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
|
|
|
@ -24,9 +24,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||
|
||||
#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
@ -36,6 +37,7 @@ class FramelessQuickApplicationWindowPrivate;
|
|||
class FRAMELESSHELPER_QUICK_API FramelessQuickApplicationWindow : public QQuickApplicationWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(FramelessApplicationWindow)
|
||||
#endif
|
||||
|
@ -82,4 +84,4 @@ private:
|
|||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -24,19 +24,23 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||
|
||||
#include <QtQuick/qquickwindow.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessQuickApplicationWindow;
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
class QuickWindowBorder;
|
||||
#endif
|
||||
class FramelessQuickApplicationWindow;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API FramelessQuickApplicationWindowPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(FramelessQuickApplicationWindow)
|
||||
Q_DISABLE_COPY_MOVE(FramelessQuickApplicationWindowPrivate)
|
||||
|
||||
|
@ -48,10 +52,12 @@ public:
|
|||
Q_NODISCARD static const FramelessQuickApplicationWindowPrivate *get(const FramelessQuickApplicationWindow *pub);
|
||||
|
||||
FramelessQuickApplicationWindow *q_ptr = nullptr;
|
||||
QuickWindowBorder *windowBorder = nullptr;
|
||||
QQuickWindow::Visibility savedVisibility = QQuickWindow::Windowed;
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
QuickWindowBorder *windowBorder = nullptr;
|
||||
#endif
|
||||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -33,14 +33,19 @@ QT_END_NAMESPACE
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessQuickHelper;
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
class QuickMicaMaterial;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
class QuickWindowBorder;
|
||||
#endif
|
||||
class FramelessQuickHelper;
|
||||
struct FramelessQuickHelperData;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API FramelessQuickHelperPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(FramelessQuickHelper)
|
||||
Q_DISABLE_COPY_MOVE(FramelessQuickHelperPrivate)
|
||||
|
||||
|
@ -59,8 +64,12 @@ public:
|
|||
void setProperty(const char *name, const QVariant &value);
|
||||
Q_NODISCARD QVariant getProperty(const char *name, const QVariant &defaultValue = {});
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
Q_NODISCARD QuickMicaMaterial *findOrCreateMicaMaterial() const;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
Q_NODISCARD QuickWindowBorder *findOrCreateWindowBorder() const;
|
||||
#endif
|
||||
|
||||
Q_NODISCARD static FramelessQuickHelper *findOrCreateFramelessHelper(QObject *object);
|
||||
|
||||
|
|
|
@ -24,9 +24,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window))
|
||||
|
||||
#include <QtQuick/private/qquickwindowmodule_p.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
@ -36,6 +37,7 @@ class FramelessQuickWindowPrivate;
|
|||
class FRAMELESSHELPER_QUICK_API FramelessQuickWindow : public QQuickWindowQmlImpl
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(FramelessWindow)
|
||||
#endif
|
||||
|
@ -82,4 +84,4 @@ private:
|
|||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -24,19 +24,23 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window))
|
||||
|
||||
#include <QtQuick/qquickwindow.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessQuickWindow;
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
class QuickWindowBorder;
|
||||
#endif
|
||||
class FramelessQuickWindow;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API FramelessQuickWindowPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(FramelessQuickWindow)
|
||||
Q_DISABLE_COPY_MOVE(FramelessQuickWindowPrivate)
|
||||
|
||||
|
@ -48,10 +52,12 @@ public:
|
|||
Q_NODISCARD static const FramelessQuickWindowPrivate *get(const FramelessQuickWindow *pub);
|
||||
|
||||
FramelessQuickWindow *q_ptr = nullptr;
|
||||
QuickWindowBorder *windowBorder = nullptr;
|
||||
QQuickWindow::Visibility savedVisibility = QQuickWindow::Windowed;
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
QuickWindowBorder *windowBorder = nullptr;
|
||||
#endif
|
||||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -26,24 +26,38 @@
|
|||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
#include <QtCore/qvariant.h>
|
||||
#include <QtQuick/qquickpainteditem.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class QuickImageItem;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API QuickImageItemPrivate : public QObject
|
||||
class FRAMELESSHELPER_QUICK_API QuickImageItem : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DISABLE_COPY_MOVE(QuickImageItemPrivate)
|
||||
Q_DECLARE_PUBLIC(QuickImageItem)
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(ImageItem)
|
||||
#endif
|
||||
Q_DISABLE_COPY_MOVE(QuickImageItem)
|
||||
|
||||
Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
|
||||
|
||||
public:
|
||||
explicit QuickImageItemPrivate(QuickImageItem *q);
|
||||
~QuickImageItemPrivate() override;
|
||||
explicit QuickImageItem(QQuickItem *parent = nullptr);
|
||||
~QuickImageItem() override;
|
||||
|
||||
Q_NODISCARD static QuickImageItemPrivate *get(QuickImageItem *q);
|
||||
Q_NODISCARD static const QuickImageItemPrivate *get(const QuickImageItem *q);
|
||||
void paint(QPainter *painter) override;
|
||||
|
||||
Q_NODISCARD QVariant source() const;
|
||||
void setSource(const QVariant &value);
|
||||
|
||||
Q_SIGNALS:
|
||||
void sourceChanged();
|
||||
|
||||
protected:
|
||||
void classBegin() override;
|
||||
void componentComplete() override;
|
||||
|
||||
private:
|
||||
void fromUrl(const QUrl &value, QPainter *painter) const;
|
||||
void fromString(const QString &value, QPainter *painter) const;
|
||||
void fromImage(const QImage &value, QPainter *painter) const;
|
||||
|
@ -51,8 +65,8 @@ public:
|
|||
void fromIcon(const QIcon &value, QPainter *painter) const;
|
||||
Q_NODISCARD QRectF paintArea() const;
|
||||
|
||||
QuickImageItem *q_ptr = nullptr;
|
||||
QVariant source = {};
|
||||
private:
|
||||
QVariant m_source = {};
|
||||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class MicaMaterial;
|
||||
|
@ -34,6 +36,7 @@ class QuickMicaMaterial;
|
|||
class FRAMELESSHELPER_QUICK_API QuickMicaMaterialPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(QuickMicaMaterialPrivate)
|
||||
Q_DECLARE_PUBLIC(QuickMicaMaterial)
|
||||
|
||||
|
@ -56,3 +59,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(system_button) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||
|
||||
#include <QtQuickTemplates2/private/qquickbutton_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
@ -40,6 +40,7 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
|||
class FRAMELESSHELPER_QUICK_API QuickStandardSystemButton : public QQuickButton
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(StandardSystemButton)
|
||||
#endif
|
||||
|
@ -51,7 +52,7 @@ class FRAMELESSHELPER_QUICK_API QuickStandardSystemButton : public QQuickButton
|
|||
Q_PROPERTY(QColor normalColor READ normalColor WRITE setNormalColor NOTIFY normalColorChanged FINAL)
|
||||
Q_PROPERTY(QColor activeForegroundColor READ activeForegroundColor WRITE setActiveForegroundColor NOTIFY activeForegroundColorChanged FINAL)
|
||||
Q_PROPERTY(QColor inactiveForegroundColor READ inactiveForegroundColor WRITE setInactiveForegroundColor NOTIFY inactiveForegroundColorChanged FINAL)
|
||||
Q_PROPERTY(qreal iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged FINAL)
|
||||
Q_PROPERTY(qreal glyphSize READ glyphSize WRITE setGlyphSize NOTIFY glyphChanged FINAL)
|
||||
|
||||
public:
|
||||
explicit QuickStandardSystemButton(QQuickItem *parent = nullptr);
|
||||
|
@ -65,7 +66,7 @@ public:
|
|||
Q_NODISCARD QColor pressColor() const;
|
||||
Q_NODISCARD QColor activeForegroundColor() const;
|
||||
Q_NODISCARD QColor inactiveForegroundColor() const;
|
||||
Q_NODISCARD qreal iconSize() const;
|
||||
Q_NODISCARD qreal glyphSize() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateColor();
|
||||
|
@ -76,7 +77,7 @@ public Q_SLOTS:
|
|||
void setPressColor(const QColor &value);
|
||||
void setActiveForegroundColor(const QColor &value);
|
||||
void setInactiveForegroundColor(const QColor &value);
|
||||
void setIconSize(const qreal value);
|
||||
void setGlyphSize(const qreal value);
|
||||
|
||||
protected:
|
||||
void classBegin() override;
|
||||
|
@ -93,7 +94,7 @@ Q_SIGNALS:
|
|||
void pressColorChanged();
|
||||
void activeForegroundColorChanged();
|
||||
void inactiveForegroundColorChanged();
|
||||
void iconSizeChanged();
|
||||
void glyphSizeChanged();
|
||||
|
||||
private:
|
||||
QQuickText *m_contentItem = nullptr;
|
||||
|
@ -108,6 +109,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -24,12 +24,14 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(titlebar) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||
|
||||
#include <FramelessHelper/Quick/quickchromepalette.h>
|
||||
#include <FramelessHelper/Quick/private/quickstandardsystembutton_p.h>
|
||||
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||
# include <FramelessHelper/Quick/private/quickstandardsystembutton_p.h>
|
||||
#endif
|
||||
#include <QtQuick/private/qquickrectangle_p.h>
|
||||
#include <QtQuickTemplates2/private/qquicklabel_p.h>
|
||||
|
||||
|
@ -44,13 +46,14 @@ class QuickImageItem;
|
|||
class FRAMELESSHELPER_QUICK_API QuickStandardTitleBar : public QQuickRectangle
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(StandardTitleBar)
|
||||
#endif // QML_NAMED_ELEMENT
|
||||
Q_DISABLE_COPY_MOVE(QuickStandardTitleBar)
|
||||
Q_PROPERTY(Qt::Alignment titleLabelAlignment READ titleLabelAlignment WRITE setTitleLabelAlignment NOTIFY titleLabelAlignmentChanged FINAL)
|
||||
Q_PROPERTY(QQuickLabel* titleLabel READ titleLabel CONSTANT FINAL)
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
Q_PROPERTY(QuickStandardSystemButton* minimizeButton READ minimizeButton CONSTANT FINAL)
|
||||
Q_PROPERTY(QuickStandardSystemButton* maximizeButton READ maximizeButton CONSTANT FINAL)
|
||||
Q_PROPERTY(QuickStandardSystemButton* closeButton READ closeButton CONSTANT FINAL)
|
||||
|
@ -70,7 +73,7 @@ public:
|
|||
void setTitleLabelAlignment(const Qt::Alignment value);
|
||||
|
||||
Q_NODISCARD QQuickLabel *titleLabel() const;
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
Q_NODISCARD QuickStandardSystemButton *minimizeButton() const;
|
||||
Q_NODISCARD QuickStandardSystemButton *maximizeButton() const;
|
||||
Q_NODISCARD QuickStandardSystemButton *closeButton() const;
|
||||
|
@ -130,7 +133,7 @@ private:
|
|||
Qt::Alignment m_labelAlignment = {};
|
||||
QuickImageItem *m_windowIcon = nullptr;
|
||||
QQuickLabel *m_windowTitleLabel = nullptr;
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
QQuickRow *m_systemButtonsRow = nullptr;
|
||||
QuickStandardSystemButton *m_minimizeButton = nullptr;
|
||||
QuickStandardSystemButton *m_maximizeButton = nullptr;
|
||||
|
@ -146,6 +149,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class QuickWindowBorder;
|
||||
|
@ -34,6 +36,7 @@ class WindowBorderPainter;
|
|||
class FRAMELESSHELPER_QUICK_API QuickWindowBorderPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(QuickWindowBorderPrivate)
|
||||
Q_DECLARE_PUBLIC(QuickWindowBorder)
|
||||
|
||||
|
@ -56,3 +59,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,11 +28,14 @@
|
|||
#include <FramelessHelper/Core/chromepalette.h>
|
||||
#include <QtQml/qqmlparserstatus.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API QuickChromePalette : public ChromePalette, public QQmlParserStatus
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
#ifdef QML_ANONYMOUS
|
||||
QML_ANONYMOUS
|
||||
#endif
|
||||
|
@ -49,3 +52,5 @@ protected:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
#include <QtQuick/qquickpainteditem.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class QuickMicaMaterialPrivate;
|
||||
|
@ -34,6 +36,7 @@ class QuickMicaMaterialPrivate;
|
|||
class FRAMELESSHELPER_QUICK_API QuickMicaMaterial : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(MicaMaterial)
|
||||
#endif
|
||||
|
@ -84,3 +87,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
#include <QtQuick/qquickpainteditem.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class QuickWindowBorderPrivate;
|
||||
|
@ -34,6 +36,7 @@ class QuickWindowBorderPrivate;
|
|||
class FRAMELESSHELPER_QUICK_API QuickWindowBorder : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(WindowBorder)
|
||||
#endif
|
||||
|
@ -89,3 +92,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||
#include <QtWidgets/qdialog.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessDialogPrivate;
|
||||
|
@ -34,6 +36,7 @@ class FramelessDialogPrivate;
|
|||
class FRAMELESSHELPER_WIDGETS_API FramelessDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PRIVATE(FramelessDialog)
|
||||
Q_DISABLE_COPY_MOVE(FramelessDialog)
|
||||
|
||||
|
@ -46,3 +49,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -40,10 +40,13 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
FRAMELESSHELPER_WIDGETS_API void FramelessHelperWidgetsInitialize();
|
||||
FRAMELESSHELPER_WIDGETS_API void FramelessHelperWidgetsUninitialize();
|
||||
|
||||
namespace FramelessHelper::Widgets
|
||||
{
|
||||
FRAMELESSHELPER_WIDGETS_API void initialize();
|
||||
FRAMELESSHELPER_WIDGETS_API void uninitialize();
|
||||
inline void initialize() { FramelessHelperWidgetsInitialize(); }
|
||||
inline void uninitialize() { FramelessHelperWidgetsUninitialize(); }
|
||||
} // namespace FramelessHelper::Widgets
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||
#include <QtWidgets/qmainwindow.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessMainWindowPrivate;
|
||||
|
@ -34,6 +36,7 @@ class FramelessMainWindowPrivate;
|
|||
class FRAMELESSHELPER_WIDGETS_API FramelessMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PRIVATE(FramelessMainWindow)
|
||||
Q_DISABLE_COPY_MOVE(FramelessMainWindow)
|
||||
Q_PROPERTY(bool hidden READ isHidden NOTIFY hiddenChanged FINAL)
|
||||
|
@ -61,3 +64,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessWidgetPrivate;
|
||||
|
@ -34,6 +36,7 @@ class FramelessWidgetPrivate;
|
|||
class FRAMELESSHELPER_WIDGETS_API FramelessWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PRIVATE(FramelessWidget)
|
||||
Q_DISABLE_COPY_MOVE(FramelessWidget)
|
||||
Q_PROPERTY(bool hidden READ isHidden NOTIFY hiddenChanged FINAL)
|
||||
|
@ -61,3 +64,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,13 +29,18 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessWidgetsHelperPrivate;
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
class MicaMaterial;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
class WindowBorderPainter;
|
||||
#endif
|
||||
class FramelessWidgetsHelperPrivate;
|
||||
|
||||
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PRIVATE(FramelessWidgetsHelper)
|
||||
Q_DISABLE_COPY_MOVE(FramelessWidgetsHelper)
|
||||
Q_PROPERTY(QWidget* titleBarWidget READ titleBarWidget WRITE setTitleBarWidget NOTIFY titleBarWidgetChanged FINAL)
|
||||
|
@ -56,8 +61,12 @@ public:
|
|||
Q_NODISCARD QWidget *window() const;
|
||||
Q_NODISCARD bool isContentExtendedIntoTitleBar() const;
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
Q_NODISCARD MicaMaterial *micaMaterial() const;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
Q_NODISCARD WindowBorderPainter *windowBorder() const;
|
||||
#endif
|
||||
|
||||
Q_NODISCARD bool isReady() const;
|
||||
void waitForReady();
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessDialog;
|
||||
|
@ -34,6 +36,7 @@ class WidgetsSharedHelper;
|
|||
class FRAMELESSHELPER_WIDGETS_API FramelessDialogPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(FramelessDialog)
|
||||
Q_DISABLE_COPY_MOVE(FramelessDialogPrivate)
|
||||
|
||||
|
@ -49,3 +52,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessMainWindow;
|
||||
|
@ -34,6 +36,7 @@ class WidgetsSharedHelper;
|
|||
class FRAMELESSHELPER_WIDGETS_API FramelessMainWindowPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(FramelessMainWindow)
|
||||
Q_DISABLE_COPY_MOVE(FramelessMainWindowPrivate)
|
||||
|
||||
|
@ -50,3 +53,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
|
||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class FramelessWidget;
|
||||
|
@ -34,6 +36,7 @@ class WidgetsSharedHelper;
|
|||
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(FramelessWidget)
|
||||
Q_DISABLE_COPY_MOVE(FramelessWidgetPrivate)
|
||||
|
||||
|
@ -50,3 +53,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,15 +30,20 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
class MicaMaterial;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
class WindowBorderPainter;
|
||||
#endif
|
||||
class FramelessWidgetsHelper;
|
||||
struct FramelessWidgetsHelperData;
|
||||
class WidgetsSharedHelper;
|
||||
class MicaMaterial;
|
||||
class WindowBorderPainter;
|
||||
|
||||
class FRAMELESSHELPER_WIDGETS_API FramelessWidgetsHelperPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(FramelessWidgetsHelper)
|
||||
Q_DISABLE_COPY_MOVE(FramelessWidgetsHelperPrivate)
|
||||
|
||||
|
@ -57,8 +62,12 @@ public:
|
|||
void setProperty(const char *name, const QVariant &value);
|
||||
Q_NODISCARD QVariant getProperty(const char *name, const QVariant &defaultValue = {});
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
Q_NODISCARD MicaMaterial *getMicaMaterialIfAny() const;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
Q_NODISCARD WindowBorderPainter *getWindowBorderIfAny() const;
|
||||
#endif
|
||||
|
||||
Q_NODISCARD static WidgetsSharedHelper *findOrCreateSharedHelper(QWidget *window);
|
||||
Q_NODISCARD static FramelessWidgetsHelper *findOrCreateFramelessHelper(QObject *object);
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||
#include <optional>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class StandardSystemButton;
|
||||
|
@ -34,6 +36,7 @@ class StandardSystemButton;
|
|||
class FRAMELESSHELPER_WIDGETS_API StandardSystemButtonPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(StandardSystemButton)
|
||||
Q_DISABLE_COPY_MOVE(StandardSystemButtonPrivate)
|
||||
|
||||
|
@ -59,3 +62,5 @@ public:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,15 +32,20 @@ QT_BEGIN_NAMESPACE
|
|||
class QMouseEvent;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class StandardTitleBar;
|
||||
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||
class StandardSystemButton;
|
||||
#endif
|
||||
class ChromePalette;
|
||||
class StandardTitleBar;
|
||||
|
||||
class FRAMELESSHELPER_WIDGETS_API StandardTitleBarPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PUBLIC(StandardTitleBar)
|
||||
Q_DISABLE_COPY_MOVE(StandardTitleBarPrivate)
|
||||
|
||||
|
@ -75,11 +80,11 @@ public:
|
|||
void initialize();
|
||||
|
||||
StandardTitleBar *q_ptr = nullptr;
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
StandardSystemButton *minimizeButton = nullptr;
|
||||
StandardSystemButton *maximizeButton = nullptr;
|
||||
StandardSystemButton *closeButton = nullptr;
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
QPointer<QWidget> window = nullptr;
|
||||
bool extended = false;
|
||||
Qt::Alignment labelAlignment = {};
|
||||
|
@ -96,3 +101,5 @@ protected:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -29,14 +29,21 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
class MicaMaterial;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
class WindowBorderPainter;
|
||||
#endif
|
||||
|
||||
class FRAMELESSHELPER_WIDGETS_API WidgetsSharedHelper : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(WidgetsSharedHelper)
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
Q_PROPERTY(bool micaEnabled READ isMicaEnabled WRITE setMicaEnabled NOTIFY micaEnabledChanged FINAL)
|
||||
#endif
|
||||
|
||||
public:
|
||||
explicit WidgetsSharedHelper(QObject *parent = nullptr);
|
||||
|
@ -44,11 +51,14 @@ public:
|
|||
|
||||
void setup(QWidget *widget);
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
Q_NODISCARD bool isMicaEnabled() const;
|
||||
void setMicaEnabled(const bool value);
|
||||
|
||||
Q_NODISCARD MicaMaterial *rawMicaMaterial() const;
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
Q_NODISCARD WindowBorderPainter *rawWindowBorder() const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
Q_NODISCARD bool eventFilter(QObject *object, QEvent *event) override;
|
||||
|
@ -58,24 +68,34 @@ private Q_SLOTS:
|
|||
void handleScreenChanged(QScreen *screen);
|
||||
|
||||
private:
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
void repaintMica();
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
void repaintBorder();
|
||||
#endif
|
||||
void emitCustomWindowStateSignals();
|
||||
|
||||
Q_SIGNALS:
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
void micaEnabledChanged();
|
||||
#endif
|
||||
|
||||
private:
|
||||
QPointer<QWidget> m_targetWidget;
|
||||
QPointer<QScreen> m_screen;
|
||||
qreal m_screenDpr = qreal(0);
|
||||
QMetaObject::Connection m_screenDpiChangeConnection = {};
|
||||
QMetaObject::Connection m_screenChangeConnection = {};
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
bool m_micaEnabled = false;
|
||||
MicaMaterial *m_micaMaterial = nullptr;
|
||||
QMetaObject::Connection m_micaRedrawConnection = {};
|
||||
qreal m_screenDpr = 0.0;
|
||||
QMetaObject::Connection m_screenDpiChangeConnection = {};
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
WindowBorderPainter *m_borderPainter = nullptr;
|
||||
QMetaObject::Connection m_borderRepaintConnection = {};
|
||||
QMetaObject::Connection m_screenChangeConnection = {};
|
||||
#endif
|
||||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||
#include <QtWidgets/qpushbutton.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
class StandardSystemButtonPrivate;
|
||||
|
@ -34,6 +36,7 @@ class StandardSystemButtonPrivate;
|
|||
class FRAMELESSHELPER_WIDGETS_API StandardSystemButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PRIVATE(StandardSystemButton)
|
||||
Q_DISABLE_COPY_MOVE(StandardSystemButton)
|
||||
Q_PROPERTY(Global::SystemButtonType buttonType READ buttonType WRITE setButtonType NOTIFY buttonTypeChanged FINAL)
|
||||
|
@ -92,3 +95,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -25,8 +25,13 @@
|
|||
#pragma once
|
||||
|
||||
#include <FramelessHelper/Widgets/framelesshelperwidgets_global.h>
|
||||
#include <FramelessHelper/Widgets/standardsystembutton.h>
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
|
||||
#include <FramelessHelper/Core/chromepalette.h>
|
||||
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||
# include <FramelessHelper/Widgets/standardsystembutton.h>
|
||||
#endif
|
||||
#include <QtWidgets/qwidget.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
@ -36,14 +41,15 @@ class StandardTitleBarPrivate;
|
|||
class FRAMELESSHELPER_WIDGETS_API StandardTitleBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DECLARE_PRIVATE(StandardTitleBar)
|
||||
Q_DISABLE_COPY_MOVE(StandardTitleBar)
|
||||
Q_PROPERTY(Qt::Alignment titleLabelAlignment READ titleLabelAlignment WRITE setTitleLabelAlignment NOTIFY titleLabelAlignmentChanged FINAL)
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
Q_PROPERTY(StandardSystemButton* minimizeButton READ minimizeButton CONSTANT FINAL)
|
||||
Q_PROPERTY(StandardSystemButton* maximizeButton READ maximizeButton CONSTANT FINAL)
|
||||
Q_PROPERTY(StandardSystemButton* closeButton READ closeButton CONSTANT FINAL)
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
Q_PROPERTY(bool extended READ isExtended WRITE setExtended NOTIFY extendedChanged FINAL)
|
||||
Q_PROPERTY(bool hideWhenClose READ isHideWhenClose WRITE setHideWhenClose NOTIFY hideWhenCloseChanged FINAL)
|
||||
Q_PROPERTY(ChromePalette* chromePalette READ chromePalette CONSTANT FINAL)
|
||||
|
@ -59,7 +65,7 @@ public:
|
|||
Q_NODISCARD Qt::Alignment titleLabelAlignment() const;
|
||||
void setTitleLabelAlignment(const Qt::Alignment value);
|
||||
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
Q_NODISCARD StandardSystemButton *minimizeButton() const;
|
||||
Q_NODISCARD StandardSystemButton *maximizeButton() const;
|
||||
Q_NODISCARD StandardSystemButton *closeButton() const;
|
||||
|
@ -104,3 +110,5 @@ private:
|
|||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<LibraryPath>$(MSBuildThisFileDirectory)lib64;$(MSBuildThisFileDirectory)lib64\debug;$(MSBuildThisFileDirectory)lib64\release;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>$(MSBuildThisFileDirectory)lib;$(MSBuildThisFileDirectory)lib\debug;$(MSBuildThisFileDirectory)lib\release;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="QtSettings">
|
||||
<QtHeaderSearchPath>$(MSBuildThisFileDirectory)include;$(MSBuildThisFileDirectory)include\FramelessHelper;$(MSBuildThisFileDirectory)include\FramelessHelper\Core;$(MSBuildThisFileDirectory)include\FramelessHelper\Core\private;$(MSBuildThisFileDirectory)include\FramelessHelper\Widgets;$(MSBuildThisFileDirectory)include\FramelessHelper\Widgets\private;$(MSBuildThisFileDirectory)include\FramelessHelper\Quick;$(MSBuildThisFileDirectory)include\FramelessHelper\Quick\private;$(QtHeaderSearchPath)</QtHeaderSearchPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup>
|
||||
<ClCompile>
|
||||
<PreprocessorDefinitions>FRAMELESSHELPER_CORE_STATIC;FRAMELESSHELPER_WIDGETS_STATIC;FRAMELESSHELPER_QUICK_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies Condition="'$(Configuration)'=='Debug'">FramelessHelperCored.lib;FramelessHelperWidgetsd.lib;FramelessHelperQuickd.lib;%(AdditionalDependencies);</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)'=='Release'">FramelessHelperCore.lib;FramelessHelperWidgets.lib;FramelessHelperQuick.lib;%(AdditionalDependencies);</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)'=='Debug'">FramelessHelperCore64d.lib;FramelessHelperWidgets64d.lib;FramelessHelperQuick64d.lib;%(AdditionalDependencies);</AdditionalDependencies>
|
||||
<AdditionalDependencies Condition="'$(Configuration)'=='Release'">FramelessHelperCore64.lib;FramelessHelperWidgets64.lib;FramelessHelperQuick64.lib;%(AdditionalDependencies);</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
</Project>
|
||||
|
|
|
@ -26,6 +26,7 @@ DEPENDPATH += \
|
|||
|
||||
HEADERS += \
|
||||
$$CORE_EXTRA_INC_DIR/framelesshelper.version \
|
||||
$$CORE_EXTRA_INC_DIR/framelesshelper.config \
|
||||
$$CORE_PUB_INC_DIR/chromepalette.h \
|
||||
$$CORE_PUB_INC_DIR/framelesshelper_qt.h \
|
||||
$$CORE_PUB_INC_DIR/framelesshelpercore_global.h \
|
||||
|
|
|
@ -22,44 +22,28 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
// Generated automatically by CMake.
|
||||
// WARNING! DO NOT EDIT THIS FILE MANUALLY!
|
||||
// ALL CHANGES WILL BE LOST AFTER RE-CONFIGURING!
|
||||
// Also please do not include this file directly,
|
||||
// it's designed to be included by FramelessHelper's own headers.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <FramelessHelper/Quick/framelesshelperquick_global.h>
|
||||
#include <QtQuick/qquickpainteditem.h>
|
||||
#ifndef _FRAMELESSHELPER_CONFIG_DEFINED_
|
||||
#define _FRAMELESSHELPER_CONFIG_DEFINED_
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
#define FRAMELESSHELPER_FEATURE_static_build 1
|
||||
#define FRAMELESSHELPER_FEATURE_widgets 1
|
||||
#define FRAMELESSHELPER_FEATURE_quick 1
|
||||
#define FRAMELESSHELPER_FEATURE_debug_output -1
|
||||
#define FRAMELESSHELPER_FEATURE_bundle_resource 1
|
||||
#define FRAMELESSHELPER_FEATURE_private_qt 1
|
||||
#define FRAMELESSHELPER_FEATURE_window 1
|
||||
#define FRAMELESSHELPER_FEATURE_titlebar 1
|
||||
#define FRAMELESSHELPER_FEATURE_translation 1
|
||||
#define FRAMELESSHELPER_FEATURE_mica_material 1
|
||||
#define FRAMELESSHELPER_FEATURE_border_painter 1
|
||||
#define FRAMELESSHELPER_FEATURE_system_button 1
|
||||
|
||||
class QuickImageItemPrivate;
|
||||
|
||||
class FRAMELESSHELPER_QUICK_API QuickImageItem : public QQuickPaintedItem
|
||||
{
|
||||
Q_OBJECT
|
||||
#ifdef QML_NAMED_ELEMENT
|
||||
QML_NAMED_ELEMENT(ImageItem)
|
||||
#endif
|
||||
Q_DISABLE_COPY_MOVE(QuickImageItem)
|
||||
Q_DECLARE_PRIVATE(QuickImageItem)
|
||||
|
||||
Q_PROPERTY(QVariant source READ source WRITE setSource NOTIFY sourceChanged FINAL)
|
||||
|
||||
public:
|
||||
explicit QuickImageItem(QQuickItem *parent = nullptr);
|
||||
~QuickImageItem() override;
|
||||
|
||||
void paint(QPainter *painter) override;
|
||||
|
||||
Q_NODISCARD QVariant source() const;
|
||||
void setSource(const QVariant &value);
|
||||
|
||||
protected:
|
||||
void classBegin() override;
|
||||
void componentComplete() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void sourceChanged();
|
||||
|
||||
private:
|
||||
QScopedPointer<QuickImageItemPrivate> d_ptr;
|
||||
};
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
#endif // _FRAMELESSHELPER_CONFIG_DEFINED_
|
|
@ -41,4 +41,11 @@
|
|||
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMMIT_STR[] = "UNKNOWN";
|
||||
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMPILE_DATETIME_STR[] = "UNKNOWN";
|
||||
|
||||
#define __FRAMELESSHELPER_VERSION_MAJOR__ 2
|
||||
#define __FRAMELESSHELPER_VERSION_MINOR__ 5
|
||||
#define __FRAMELESSHELPER_VERSION_PATCH__ 0
|
||||
//#define __FRAMELESSHELPER_VERSION_TWEAK__ 0
|
||||
#define __FRAMELESSHELPER_VERSION__ 0x02050000
|
||||
#define __FRAMELESSHELPER__ 0x02050000
|
||||
|
||||
#endif // _FRAMELESSHELPER_VERSION_DEFINED_
|
||||
|
|
|
@ -50,6 +50,55 @@ if(UNIX AND NOT APPLE)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
set(FRAMELESSHELPER_FEATURE_static_build "-1")
|
||||
if(FRAMELESSHELPER_BUILD_STATIC)
|
||||
set(FRAMELESSHELPER_FEATURE_static_build "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_widgets "-1")
|
||||
if(FRAMELESSHELPER_BUILD_WIDGETS)
|
||||
set(FRAMELESSHELPER_FEATURE_widgets "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_quick "-1")
|
||||
if(FRAMELESSHELPER_BUILD_QUICK)
|
||||
set(FRAMELESSHELPER_FEATURE_quick "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_debug_output "-1")
|
||||
if(NOT FRAMELESSHELPER_NO_DEBUG_OUTPUT)
|
||||
set(FRAMELESSHELPER_FEATURE_debug_output "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_bundle_resource "-1")
|
||||
if(NOT FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
||||
set(FRAMELESSHELPER_FEATURE_bundle_resource "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_private_qt "-1")
|
||||
if(NOT FRAMELESSHELPER_NO_PRIVATE)
|
||||
set(FRAMELESSHELPER_FEATURE_private_qt "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_window "-1")
|
||||
if(NOT FRAMELESSHELPER_NO_WINDOW)
|
||||
set(FRAMELESSHELPER_FEATURE_window "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_titlebar "-1")
|
||||
if(NOT FRAMELESSHELPER_NO_TITLEBAR)
|
||||
set(FRAMELESSHELPER_FEATURE_titlebar "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_translation "-1")
|
||||
if(NOT FRAMELESSHELPER_NO_TRANSLATION)
|
||||
set(FRAMELESSHELPER_FEATURE_translation "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_mica_material "-1")
|
||||
if(NOT FRAMELESSHELPER_NO_MICA_MATERIAL)
|
||||
set(FRAMELESSHELPER_FEATURE_mica_material "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_border_painter "-1")
|
||||
if(NOT FRAMELESSHELPER_NO_BORDER_PAINTER)
|
||||
set(FRAMELESSHELPER_FEATURE_border_painter "1")
|
||||
endif()
|
||||
set(FRAMELESSHELPER_FEATURE_system_button "-1")
|
||||
if(NOT FRAMELESSHELPER_NO_SYSTEM_BUTTON)
|
||||
set(FRAMELESSHELPER_FEATURE_system_button "1")
|
||||
endif()
|
||||
|
||||
set(SUB_MODULE Core)
|
||||
set(SUB_MODULE_FULL_NAME ${PROJECT_NAME}${SUB_MODULE})
|
||||
set(SUB_MODULE_TARGET ${SUB_MODULE_FULL_NAME})
|
||||
|
@ -59,16 +108,16 @@ set(INCLUDE_PREFIX ../../include/${SUB_MODULE_PATH})
|
|||
|
||||
configure_file(framelesshelper.version.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.version @ONLY)
|
||||
configure_file(framelesshelper.config.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.config @ONLY)
|
||||
|
||||
set(PUBLIC_HEADERS
|
||||
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.version
|
||||
${CMAKE_CURRENT_BINARY_DIR}/framelesshelper.config
|
||||
${INCLUDE_PREFIX}/framelesshelpercore_global.h
|
||||
${INCLUDE_PREFIX}/framelesshelper_qt.h
|
||||
${INCLUDE_PREFIX}/framelessmanager.h
|
||||
${INCLUDE_PREFIX}/utils.h
|
||||
${INCLUDE_PREFIX}/chromepalette.h
|
||||
${INCLUDE_PREFIX}/micamaterial.h
|
||||
${INCLUDE_PREFIX}/windowborderpainter.h
|
||||
)
|
||||
|
||||
set(PUBLIC_HEADERS_ALIAS
|
||||
|
@ -76,18 +125,12 @@ set(PUBLIC_HEADERS_ALIAS
|
|||
${INCLUDE_PREFIX}/FramelessHelper_Qt
|
||||
${INCLUDE_PREFIX}/FramelessManager
|
||||
${INCLUDE_PREFIX}/Utils
|
||||
${INCLUDE_PREFIX}/ChromePalette
|
||||
${INCLUDE_PREFIX}/MicaMaterial
|
||||
${INCLUDE_PREFIX}/WindowBorderPainter
|
||||
)
|
||||
|
||||
set(PRIVATE_HEADERS
|
||||
${INCLUDE_PREFIX}/private/framelessmanager_p.h
|
||||
${INCLUDE_PREFIX}/private/framelessconfig_p.h
|
||||
${INCLUDE_PREFIX}/private/sysapiloader_p.h
|
||||
${INCLUDE_PREFIX}/private/chromepalette_p.h
|
||||
${INCLUDE_PREFIX}/private/micamaterial_p.h
|
||||
${INCLUDE_PREFIX}/private/windowborderpainter_p.h
|
||||
${INCLUDE_PREFIX}/private/framelesshelpercore_global_p.h
|
||||
${INCLUDE_PREFIX}/private/versionnumber_p.h
|
||||
${INCLUDE_PREFIX}/private/scopeguard_p.h
|
||||
|
@ -99,10 +142,7 @@ set(SOURCES
|
|||
framelessmanager.cpp
|
||||
framelessconfig.cpp
|
||||
sysapiloader.cpp
|
||||
chromepalette.cpp
|
||||
framelesshelpercore_global.cpp
|
||||
micamaterial.cpp
|
||||
windowborderpainter.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
|
@ -140,6 +180,27 @@ elseif(UNIX)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_TITLEBAR)
|
||||
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/chromepalette.h)
|
||||
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/ChromePalette)
|
||||
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/chromepalette_p.h)
|
||||
list(APPEND SOURCES chromepalette.cpp)
|
||||
endif()
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_MICA_MATERIAL)
|
||||
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/micamaterial.h)
|
||||
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/MicaMaterial)
|
||||
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/micamaterial_p.h)
|
||||
list(APPEND SOURCES micamaterial.cpp)
|
||||
endif()
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_BORDER_PAINTER)
|
||||
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/windowborderpainter.h)
|
||||
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/WindowBorderPainter)
|
||||
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/windowborderpainter_p.h)
|
||||
list(APPEND SOURCES windowborderpainter.cpp)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
||||
set(__rc_path "${CMAKE_CURRENT_BINARY_DIR}/${SUB_MODULE_FULL_NAME}.rc")
|
||||
if(NOT EXISTS "${__rc_path}")
|
||||
|
@ -172,6 +233,7 @@ add_library(${PROJECT_NAME}::${SUB_MODULE_FULL_NAME} ALIAS ${SUB_MODULE_TARGET})
|
|||
set_target_properties(${SUB_MODULE_TARGET} PROPERTIES
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
||||
OUTPUT_NAME "${SUB_MODULE_TARGET}${FRAMELESSHELPER_64BIT_POSTFIX}"
|
||||
)
|
||||
|
||||
set(__export_targets ${SUB_MODULE_TARGET})
|
||||
|
@ -203,24 +265,6 @@ if(NOT FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_BUILD_STATIC)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_CORE_STATIC)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_NO_DEBUG_OUTPUT)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
||||
FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_NO_PRIVATE)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_CORE_NO_PRIVATE)
|
||||
endif()
|
||||
|
||||
if(DEFINED FRAMELESSHELPER_NAMESPACE)
|
||||
if("x${FRAMELESSHELPER_NAMESPACE}" STREQUAL "x")
|
||||
message(FATAL_ERROR "FRAMELESSHELPER_NAMESPACE can't be empty!")
|
||||
|
|
|
@ -24,24 +24,26 @@
|
|||
|
||||
#include "chromepalette.h"
|
||||
#include "chromepalette_p.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
|
||||
#include "framelessmanager.h"
|
||||
#include "utils.h"
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcChromePalette, "wangwenx190.framelesshelper.core.chromepalette")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcChromePalette)
|
||||
# define DEBUG qCDebug(lcChromePalette)
|
||||
# define WARNING qCWarning(lcChromePalette)
|
||||
# define CRITICAL qCCritical(lcChromePalette)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -428,3 +430,5 @@ void ChromePalette::resetCloseButtonPressColor()
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -33,18 +33,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessConfig, "wangwenx190.framelesshelper.core.framelessconfig")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessConfig)
|
||||
# define DEBUG qCDebug(lcFramelessConfig)
|
||||
# define WARNING qCWarning(lcFramelessConfig)
|
||||
# define CRITICAL qCCritical(lcFramelessConfig)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -81,10 +80,15 @@ struct FramelessConfigData
|
|||
|
||||
Q_GLOBAL_STATIC(FramelessConfigData, g_framelessConfigData)
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
static inline void warnInappropriateOptions()
|
||||
{
|
||||
const FramelessConfig * const cfg = FramelessConfig::instance();
|
||||
#ifndef Q_OS_WINDOWS
|
||||
#ifdef Q_OS_WINDOWS
|
||||
if (cfg->isSet(Option::DisableWindowsSnapLayout)) {
|
||||
WARNING << "Option::DisableWindowsSnapLayout is deprecated and will removed in a future version. It has not effect now.";
|
||||
}
|
||||
#else
|
||||
if (cfg->isSet(Option::UseCrossPlatformQtImplementation)) {
|
||||
WARNING << "Option::UseCrossPlatformQtImplementation is default on non-Windows platforms.";
|
||||
}
|
||||
|
@ -108,6 +112,7 @@ static inline void warnInappropriateOptions()
|
|||
WARNING << "Option::WindowUseRoundCorners has not been implemented yet.";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
FramelessConfig::FramelessConfig(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
@ -143,8 +148,9 @@ void FramelessConfig::reload(const bool force)
|
|||
g_framelessConfigData()->options.at(i) = (envVar || cfgFile);
|
||||
}
|
||||
g_framelessConfigData()->loaded = true;
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
QTimer::singleShot(0, this, [](){ warnInappropriateOptions(); });
|
||||
#endif
|
||||
}
|
||||
|
||||
void FramelessConfig::set(const Option option, const bool on)
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// Generated automatically by CMake.
|
||||
// WARNING! DO NOT EDIT THIS FILE MANUALLY!
|
||||
// ALL CHANGES WILL BE LOST AFTER RE-CONFIGURING!
|
||||
// Also please do not include this file directly,
|
||||
// it's designed to be included by FramelessHelper's own headers.
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef _FRAMELESSHELPER_CONFIG_DEFINED_
|
||||
#define _FRAMELESSHELPER_CONFIG_DEFINED_
|
||||
|
||||
#define FRAMELESSHELPER_FEATURE_static_build @FRAMELESSHELPER_FEATURE_static_build@
|
||||
#define FRAMELESSHELPER_FEATURE_widgets @FRAMELESSHELPER_FEATURE_widgets@
|
||||
#define FRAMELESSHELPER_FEATURE_quick @FRAMELESSHELPER_FEATURE_quick@
|
||||
#define FRAMELESSHELPER_FEATURE_debug_output @FRAMELESSHELPER_FEATURE_debug_output@
|
||||
#define FRAMELESSHELPER_FEATURE_bundle_resource @FRAMELESSHELPER_FEATURE_bundle_resource@
|
||||
#define FRAMELESSHELPER_FEATURE_private_qt @FRAMELESSHELPER_FEATURE_private_qt@
|
||||
#define FRAMELESSHELPER_FEATURE_window @FRAMELESSHELPER_FEATURE_window@
|
||||
#define FRAMELESSHELPER_FEATURE_titlebar @FRAMELESSHELPER_FEATURE_titlebar@
|
||||
#define FRAMELESSHELPER_FEATURE_translation @FRAMELESSHELPER_FEATURE_translation@
|
||||
#define FRAMELESSHELPER_FEATURE_mica_material @FRAMELESSHELPER_FEATURE_mica_material@
|
||||
#define FRAMELESSHELPER_FEATURE_border_painter @FRAMELESSHELPER_FEATURE_border_painter@
|
||||
#define FRAMELESSHELPER_FEATURE_system_button @FRAMELESSHELPER_FEATURE_system_button@
|
||||
|
||||
#endif // _FRAMELESSHELPER_CONFIG_DEFINED_
|
|
@ -41,4 +41,11 @@
|
|||
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMMIT_STR[] = "@PROJECT_VERSION_COMMIT@";
|
||||
[[maybe_unused]] inline constexpr const char FRAMELESSHELPER_COMPILE_DATETIME_STR[] = "@PROJECT_COMPILE_DATETIME@";
|
||||
|
||||
#define __FRAMELESSHELPER_VERSION_MAJOR__ @PROJECT_VERSION_MAJOR@
|
||||
#define __FRAMELESSHELPER_VERSION_MINOR__ @PROJECT_VERSION_MINOR@
|
||||
#define __FRAMELESSHELPER_VERSION_PATCH__ @PROJECT_VERSION_PATCH@
|
||||
//#define __FRAMELESSHELPER_VERSION_TWEAK__ @PROJECT_VERSION_TWEAK@
|
||||
#define __FRAMELESSHELPER_VERSION__ @PROJECT_VERSION_HEX@
|
||||
#define __FRAMELESSHELPER__ @PROJECT_VERSION_HEX@
|
||||
|
||||
#endif // _FRAMELESSHELPER_VERSION_DEFINED_
|
||||
|
|
|
@ -34,18 +34,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessHelperQt, "wangwenx190.framelesshelper.core.impl.qt")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessHelperQt)
|
||||
# define DEBUG qCDebug(lcFramelessHelperQt)
|
||||
# define WARNING qCWarning(lcFramelessHelperQt)
|
||||
# define CRITICAL qCCritical(lcFramelessHelperQt)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -86,9 +85,9 @@ void FramelessHelperQt::addWindow(FramelessParamsConst params)
|
|||
const auto shouldApplyFramelessFlag = []() -> bool {
|
||||
#ifdef Q_OS_MACOS
|
||||
return false;
|
||||
#elif defined(Q_OS_LINUX)
|
||||
#elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
return !Utils::isCustomDecorationSupported();
|
||||
#else // Windows
|
||||
#elif defined(Q_OS_WINDOWS)
|
||||
return true;
|
||||
#endif // Q_OS_MACOS
|
||||
}();
|
||||
|
@ -98,14 +97,14 @@ void FramelessHelperQt::addWindow(FramelessParamsConst params)
|
|||
if (shouldApplyFramelessFlag) {
|
||||
params->setWindowFlags(params->getWindowFlags() | Qt::FramelessWindowHint);
|
||||
} else {
|
||||
#ifdef Q_OS_LINUX
|
||||
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
std::ignore = Utils::tryHideSystemTitleBar(windowId, true);
|
||||
#elif defined(Q_OS_MACOS)
|
||||
Utils::setSystemTitleBarVisible(windowId, false);
|
||||
#endif // Q_OS_LINUX
|
||||
}
|
||||
window->installEventFilter(data.eventFilter);
|
||||
FramelessHelper::Core::setApplicationOSThemeAware();
|
||||
FramelessHelperEnableThemeAware();
|
||||
}
|
||||
|
||||
void FramelessHelperQt::removeWindow(const WId windowId)
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
*/
|
||||
|
||||
#include "framelesshelper_win.h"
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
#include "framelessmanager.h"
|
||||
#include "framelessmanager_p.h"
|
||||
#include "framelessconfig_p.h"
|
||||
|
@ -42,18 +45,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessHelperWin, "wangwenx190.framelesshelper.core.impl.win")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessHelperWin)
|
||||
# define DEBUG qCDebug(lcFramelessHelperWin)
|
||||
# define WARNING qCWarning(lcFramelessHelperWin)
|
||||
# define CRITICAL qCCritical(lcFramelessHelperWin)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -68,7 +70,7 @@ FRAMELESSHELPER_STRING_CONSTANT(GetClientRect)
|
|||
#ifdef Q_PROCESSOR_X86_64
|
||||
FRAMELESSHELPER_STRING_CONSTANT(GetWindowLongPtrW)
|
||||
FRAMELESSHELPER_STRING_CONSTANT(SetWindowLongPtrW)
|
||||
#else // Q_PROCESSOR_X86_64
|
||||
#else // !Q_PROCESSOR_X86_64
|
||||
// WinUser.h defines G/SetClassLongPtr as G/SetClassLong due to the
|
||||
// "Ptr" suffixed APIs are not available on 32-bit platforms, so we
|
||||
// have to add the following workaround. Undefine the macros and then
|
||||
|
@ -90,7 +92,7 @@ FRAMELESSHELPER_STRING_CONSTANT(SetWindowPlacement)
|
|||
|
||||
enum class WindowPart : quint8
|
||||
{
|
||||
NotInterested,
|
||||
Outside,
|
||||
ClientArea,
|
||||
ChromeButton,
|
||||
ResizeBorder,
|
||||
|
@ -172,7 +174,7 @@ Q_GLOBAL_STATIC(FramelessWin32HelperInternal, g_framelessWin32HelperData)
|
|||
default:
|
||||
break;
|
||||
}
|
||||
return WindowPart::NotInterested;
|
||||
return WindowPart::Outside;
|
||||
}
|
||||
|
||||
[[nodiscard]] static inline constexpr bool isTaggedMessage(const WPARAM wParam)
|
||||
|
@ -180,7 +182,7 @@ Q_GLOBAL_STATIC(FramelessWin32HelperInternal, g_framelessWin32HelperData)
|
|||
return (wParam == kMessageTag);
|
||||
}
|
||||
|
||||
[[nodiscard]] static inline bool listenForMouseLeave(const HWND hWnd, const bool nonClient)
|
||||
[[nodiscard]] static inline bool requestForMouseLeaveMessage(const HWND hWnd, const bool nonClient)
|
||||
{
|
||||
Q_ASSERT(hWnd);
|
||||
if (!hWnd) {
|
||||
|
@ -251,7 +253,7 @@ void FramelessHelperWin::addWindow(FramelessParamsConst params)
|
|||
}
|
||||
if (WindowsVersionHelper::isWin10RS1OrGreater()) {
|
||||
// Tell DWM we may need dark theme non-client area (title bar & frame border).
|
||||
FramelessHelper::Core::setApplicationOSThemeAware();
|
||||
FramelessHelperEnableThemeAware();
|
||||
if (WindowsVersionHelper::isWin10RS5OrGreater()) {
|
||||
const bool dark = (FramelessManager::instance()->systemTheme() == SystemTheme::Dark);
|
||||
const auto isWidget = [params]() -> bool {
|
||||
|
@ -312,14 +314,16 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
return false;
|
||||
}
|
||||
const UINT uMsg = msg->message;
|
||||
|
||||
// We should skip these messages otherwise we will get crashes.
|
||||
// WM_QUIT won't be posted to the WindowProc function.
|
||||
switch (uMsg) {
|
||||
case WM_CLOSE:
|
||||
case WM_DESTROY:
|
||||
case WM_NCDESTROY:
|
||||
// undocumented messages
|
||||
case WM_UNREGISTER_WINDOW_SERVICES:
|
||||
// Undocumented messages:
|
||||
case WM_UAHDESTROYWINDOW:
|
||||
case WM_UNREGISTER_WINDOW_SERVICES:
|
||||
return false;
|
||||
default:
|
||||
break;
|
||||
|
@ -353,8 +357,8 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
};
|
||||
#endif // (QT_VERSION < QT_VERSION_CHECK(6, 5, 1))
|
||||
|
||||
const auto emulateClientAreaMessage = [hWnd, uMsg, wParam, lParam](const std::optional<int> overrideMessage = std::nullopt) -> void {
|
||||
auto myMsg = overrideMessage.value_or(uMsg);
|
||||
const auto emulateClientAreaMessage = [hWnd, uMsg, wParam, lParam](const std::optional<int> &overrideMessage = std::nullopt) -> void {
|
||||
const int myMsg = overrideMessage.value_or(uMsg);
|
||||
const auto wparam = [myMsg, wParam]() -> WPARAM {
|
||||
if (myMsg == WM_NCMOUSELEAVE) {
|
||||
return kMessageTag;
|
||||
|
@ -824,9 +828,9 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
// Even if the mouse is inside the chrome button area now, we should still allow the user
|
||||
// to be able to resize the window with the top or right window border, this is also the
|
||||
// normal behavior of a native Win32 window.
|
||||
static constexpr const int kTopBorderSize = 1;
|
||||
const bool isTop = (nativeLocalPos.y <= kTopBorderSize);
|
||||
const bool isRight = (nativeLocalPos.x >= (clientWidth - kTopBorderSize));
|
||||
static constexpr const int kBorderSize = 1;
|
||||
const bool isTop = (nativeLocalPos.y <= kBorderSize);
|
||||
const bool isRight = (nativeLocalPos.x >= (clientWidth - kBorderSize));
|
||||
if (isTop || isRight) {
|
||||
if (isTop && isRight) {
|
||||
*result = HTTOPRIGHT;
|
||||
|
@ -985,11 +989,10 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
case WM_MOUSEMOVE: {
|
||||
const WindowPart previousWindowPart = getHittedWindowPart(data.hitTestResult.first.value_or(HTNOWHERE));
|
||||
const WindowPart currentWindowPart = getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE));
|
||||
if (previousWindowPart == WindowPart::ChromeButton && currentWindowPart == WindowPart::ClientArea) {
|
||||
std::ignore = listenForMouseLeave(hWnd, false);
|
||||
}
|
||||
break;
|
||||
if ((previousWindowPart == WindowPart::ChromeButton) && (currentWindowPart == WindowPart::ClientArea)) {
|
||||
std::ignore = requestForMouseLeaveMessage(hWnd, false);
|
||||
}
|
||||
} break;
|
||||
case WM_NCMOUSEMOVE:
|
||||
case WM_NCLBUTTONDOWN:
|
||||
case WM_NCLBUTTONUP:
|
||||
|
@ -1010,26 +1013,21 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
#endif
|
||||
case WM_NCMOUSEHOVER:
|
||||
case WM_NCMOUSELEAVE: {
|
||||
// For future code readers:
|
||||
// The following code is not workaround anything, it's just try to emulate the original
|
||||
// behavior of a native Win32 window.
|
||||
const WindowPart previousWindowPart = getHittedWindowPart(data.hitTestResult.first.value_or(HTNOWHERE));
|
||||
const WindowPart currentWindowPart = getHittedWindowPart(data.hitTestResult.second.value_or(HTNOWHERE));
|
||||
if (uMsg == WM_NCMOUSELEAVE) {
|
||||
if (previousWindowPart == WindowPart::ChromeButton && currentWindowPart == WindowPart::NotInterested) {
|
||||
if ((previousWindowPart == WindowPart::ChromeButton) && (currentWindowPart == WindowPart::Outside)) {
|
||||
// If current window part is chrome button, it indicates that we must have clicked
|
||||
// the minimize button or maximize button, we also should send the client leave
|
||||
// message to Qt.
|
||||
emulateClientAreaMessage(WM_NCMOUSELEAVE);
|
||||
}
|
||||
|
||||
if (currentWindowPart == WindowPart::NotInterested) {
|
||||
// The mouse is leaving window from non-client area, clear window part caches
|
||||
auto &hitTestResult = muData.hitTestResult;
|
||||
hitTestResult.first.reset();
|
||||
hitTestResult.second.reset();
|
||||
if (currentWindowPart == WindowPart::Outside) {
|
||||
// The mouse is leaving the window from the non-client area, clear window part cache.
|
||||
muData.hitTestResult = {};
|
||||
|
||||
// Notice: we're not going to clear window part caches when the mouse leaves window
|
||||
// Notice: we're not going to clear window part cache when the mouse leaves window
|
||||
// from client area, which means we will get previous window part as HTCLIENT if
|
||||
// the mouse leaves window from client area and enters window from non-client area,
|
||||
// but it has no bad effect.
|
||||
|
@ -1064,9 +1062,9 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
if (currentWindowPart == WindowPart::ChromeButton) {
|
||||
emulateClientAreaMessage();
|
||||
if (uMsg == WM_NCMOUSEMOVE) {
|
||||
*result = ::DefWindowProcW(hWnd, uMsg, wParam, lParam);
|
||||
*result = ::DefWindowProcW(hWnd, WM_NCMOUSEMOVE, wParam, lParam);
|
||||
} else {
|
||||
*result = ((uMsg >= WM_NCXBUTTONDOWN) && (uMsg <= WM_NCXBUTTONDBLCLK)) ? TRUE : FALSE;
|
||||
*result = (((uMsg >= WM_NCXBUTTONDOWN) && (uMsg <= WM_NCXBUTTONDBLCLK)) ? TRUE : FALSE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -1349,3 +1347,5 @@ bool FramelessHelperWin::nativeEventFilter(const QByteArray &eventType, void *me
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
|
|
@ -96,31 +96,30 @@ QDebug operator<<(QDebug d, const FRAMELESSHELPER_PREPEND_NAMESPACE(Global)::Dpi
|
|||
QT_END_NAMESPACE
|
||||
#endif // QT_NO_DEBUG_STREAM
|
||||
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
// The "Q_INIT_RESOURCE()" macro can't be used within a namespace,
|
||||
// so we wrap it into a separate function outside of the namespace and
|
||||
// then call it instead inside the namespace, that's also the recommended
|
||||
// workaround provided by Qt's official documentation.
|
||||
void framelesshelpercore_initResource()
|
||||
void FramelessHelperCoreInitResource()
|
||||
{
|
||||
Q_INIT_RESOURCE(framelesshelpercore);
|
||||
}
|
||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#endif // FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcCoreGlobal, "wangwenx190.framelesshelper.core.global")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcCoreGlobal)
|
||||
# define DEBUG qCDebug(lcCoreGlobal)
|
||||
# define WARNING qCWarning(lcCoreGlobal)
|
||||
# define CRITICAL qCCritical(lcCoreGlobal)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -129,22 +128,7 @@ using namespace Global;
|
|||
static_assert(std::size(WindowsVersions) == (static_cast<int>(WindowsVersion::Latest) + 1));
|
||||
#endif
|
||||
|
||||
void registerInitializeHook(const InitializeHookCallback &cb)
|
||||
{
|
||||
Q_UNUSED(cb);
|
||||
WARNING << "registerInitializeHook: This function is deprecated and will be removed in a future version. Please consider using Qt's official Q_COREAPP_STARTUP_FUNCTION() macro instead.";
|
||||
}
|
||||
|
||||
void registerUninitializeHook(const UninitializeHookCallback &cb)
|
||||
{
|
||||
Q_UNUSED(cb);
|
||||
WARNING << "registerUninitializeHook: This function is deprecated and will be removed in a future version. Please consider using Qt's official qAddPostRoutine() function instead.";
|
||||
}
|
||||
|
||||
namespace FramelessHelper::Core
|
||||
{
|
||||
|
||||
void initialize()
|
||||
void FramelessHelperCoreInitialize()
|
||||
{
|
||||
static bool inited = false;
|
||||
if (inited) {
|
||||
|
@ -152,9 +136,9 @@ void initialize()
|
|||
}
|
||||
inited = true;
|
||||
|
||||
outputLogo();
|
||||
FramelessHelperPrintLogo();
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
// Qt's Wayland experience is not good, so we force the XCB backend here.
|
||||
// TODO: Remove this hack once Qt's Wayland implementation is good enough.
|
||||
// We are setting the preferred QPA backend, so we have to set it early
|
||||
|
@ -199,7 +183,7 @@ void initialize()
|
|||
#endif
|
||||
}
|
||||
|
||||
void uninitialize()
|
||||
void FramelessHelperCoreUninitialize()
|
||||
{
|
||||
static bool uninited = false;
|
||||
if (uninited) {
|
||||
|
@ -208,7 +192,7 @@ void uninitialize()
|
|||
uninited = true;
|
||||
}
|
||||
|
||||
VersionInfo version()
|
||||
VersionInfo FramelessHelperVersion()
|
||||
{
|
||||
static const auto result = []() -> VersionInfo {
|
||||
const auto _compiler = []() -> const char * { return COMPILER_STRING; }();
|
||||
|
@ -220,7 +204,7 @@ VersionInfo version()
|
|||
#endif
|
||||
}();
|
||||
const auto _static = []() -> bool {
|
||||
#ifdef FRAMELESSHELPER_CORE_STATIC
|
||||
#if FRAMELESSHELPER_CONFIG(static_build)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
|
@ -239,7 +223,7 @@ VersionInfo version()
|
|||
return result;
|
||||
}
|
||||
|
||||
void setApplicationOSThemeAware()
|
||||
void FramelessHelperEnableThemeAware()
|
||||
{
|
||||
static bool set = false;
|
||||
if (set) {
|
||||
|
@ -257,7 +241,7 @@ void setApplicationOSThemeAware()
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if ((defined(Q_OS_LINUX) && (QT_VERSION < QT_VERSION_CHECK(6, 4, 0))) || \
|
||||
#if ((defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID) && (QT_VERSION < QT_VERSION_CHECK(6, 4, 0))) || \
|
||||
(defined(Q_OS_MACOS) && (QT_VERSION < QT_VERSION_CHECK(5, 12, 0))))
|
||||
// Linux: Qt 6.4 gained the ability to detect system theme change.
|
||||
// macOS: Qt 5.12.
|
||||
|
@ -265,13 +249,13 @@ void setApplicationOSThemeAware()
|
|||
#endif
|
||||
}
|
||||
|
||||
void outputLogo()
|
||||
void FramelessHelperPrintLogo()
|
||||
{
|
||||
static const bool noLogo = (qEnvironmentVariableIntValue("FRAMELESSHELPER_NO_LOGO") != 0);
|
||||
if (noLogo) {
|
||||
return;
|
||||
}
|
||||
const VersionInfo &ver = version();
|
||||
const VersionInfo ver = FramelessHelperVersion();
|
||||
QString message = {};
|
||||
QTextStream stream(&message, QIODevice::WriteOnly);
|
||||
stream << "FramelessHelper (" << (ver.isStatic ? "static" : "shared")
|
||||
|
@ -282,6 +266,4 @@ void outputLogo()
|
|||
INFO.nospace().noquote() << message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -44,18 +44,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessManager, "wangwenx190.framelesshelper.core.framelessmanager")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessManager)
|
||||
# define DEBUG qCDebug(lcFramelessManager)
|
||||
# define WARNING qCWarning(lcFramelessManager)
|
||||
# define CRITICAL qCCritical(lcFramelessManager)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -66,7 +65,7 @@ Q_GLOBAL_STATIC(FramelessManagerData, g_framelessManagerData)
|
|||
|
||||
static constexpr const int kEventDelayInterval = 1000;
|
||||
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
[[nodiscard]] static inline QString iconFontFamilyName()
|
||||
{
|
||||
static const auto result = []() -> QString {
|
||||
|
@ -82,7 +81,7 @@ static constexpr const int kEventDelayInterval = 1000;
|
|||
}();
|
||||
return result;
|
||||
}
|
||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#endif
|
||||
|
||||
[[nodiscard]] static inline bool usePureQtImplementation()
|
||||
{
|
||||
|
@ -128,7 +127,7 @@ const FramelessManagerPrivate *FramelessManagerPrivate::get(const FramelessManag
|
|||
|
||||
void FramelessManagerPrivate::initializeIconFont()
|
||||
{
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
static bool inited = false;
|
||||
if (inited) {
|
||||
return;
|
||||
|
@ -147,9 +146,7 @@ void FramelessManagerPrivate::initializeIconFont()
|
|||
|
||||
QFont FramelessManagerPrivate::getIconFont()
|
||||
{
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
return {};
|
||||
#else // !FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
static const auto font = []() -> QFont {
|
||||
QFont f = {};
|
||||
f.setFamily(iconFontFamilyName());
|
||||
|
@ -161,7 +158,9 @@ QFont FramelessManagerPrivate::getIconFont()
|
|||
return f;
|
||||
}();
|
||||
return font;
|
||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#else // !FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
return {};
|
||||
#endif // FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
}
|
||||
|
||||
void FramelessManagerPrivate::notifySystemThemeHasChangedOrNot()
|
||||
|
@ -281,7 +280,7 @@ void FramelessManagerPrivate::initialize()
|
|||
// Set a global flag so that people can check whether FramelessHelper is being
|
||||
// used without actually accessing the FramelessHelper interface.
|
||||
static constexpr const char flag[] = "__FRAMELESSHELPER__";
|
||||
const int ver = FramelessHelper::Core::version().version;
|
||||
const int ver = FramelessHelperVersion().version;
|
||||
qputenv(flag, QByteArray::number(ver));
|
||||
qApp->setProperty(flag, ver);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
#include "micamaterial.h"
|
||||
#include "micamaterial_p.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
|
||||
#include "framelessmanager.h"
|
||||
#include "utils.h"
|
||||
#include "framelessconfig_p.h"
|
||||
|
@ -40,24 +43,23 @@
|
|||
#include <QtGui/qpainter.h>
|
||||
#include <QtGui/qscreen.h>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# include <QtGui/private/qmemrotate_p.h>
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcMicaMaterial, "wangwenx190.framelesshelper.core.micamaterial")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcMicaMaterial)
|
||||
# define DEBUG qCDebug(lcMicaMaterial)
|
||||
# define WARNING qCWarning(lcMicaMaterial)
|
||||
# define CRITICAL qCCritical(lcMicaMaterial)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
DECLARE_SIZE_COMPARE_OPERATORS(QSize, QSize)
|
||||
|
@ -88,7 +90,7 @@ struct ImageData
|
|||
|
||||
Q_GLOBAL_STATIC(ImageData, g_imageData)
|
||||
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
template<const int shift>
|
||||
[[nodiscard]] static inline constexpr int qt_static_shift(const int value)
|
||||
{
|
||||
|
@ -429,7 +431,7 @@ static inline void expblur(QImage &img, qreal radius, const bool improvedQuality
|
|||
expblur<12, 10, false>(blurImage, radius, quality, transposed);
|
||||
}
|
||||
}
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif
|
||||
|
||||
/*!
|
||||
Transforms an \a alignment of Qt::AlignLeft or Qt::AlignRight
|
||||
|
@ -485,6 +487,7 @@ static inline void expblur(QImage &img, qreal radius, const bool improvedQuality
|
|||
class WallpaperThread : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(WallpaperThread)
|
||||
|
||||
public:
|
||||
|
@ -576,11 +579,11 @@ protected:
|
|||
painter.setRenderHint(QPainter::Antialiasing, false);
|
||||
painter.setRenderHint(QPainter::TextAntialiasing, false);
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
painter.drawImage(desktopOriginPoint, buffer);
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
qt_blurImage(&painter, buffer, kDefaultBlurRadius, false, false);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
painter.drawImage(desktopOriginPoint, buffer);
|
||||
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
}
|
||||
Q_EMIT imageUpdated();
|
||||
}
|
||||
|
@ -653,7 +656,7 @@ void MicaMaterialPrivate::maybeGenerateBlurredWallpaper(const bool force)
|
|||
|
||||
void MicaMaterialPrivate::updateMaterialBrush()
|
||||
{
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
framelesshelpercore_initResource();
|
||||
static const QImage noiseTexture = QImage(FRAMELESSHELPER_STRING_LITERAL(":/org.wangwenx190.FramelessHelper/resources/images/noise.png"));
|
||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
|
@ -670,7 +673,7 @@ void MicaMaterialPrivate::updateMaterialBrush()
|
|||
const QRect rect = {QPoint(0, 0), micaTexture.size()};
|
||||
painter.fillRect(rect, tintColor);
|
||||
painter.setOpacity(noiseOpacity);
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
painter.fillRect(rect, QBrush(noiseTexture));
|
||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
micaBrush = QBrush(micaTexture);
|
||||
|
@ -964,3 +967,5 @@ void MicaMaterial::paint(QPainter *painter, const QRect &rect, const bool active
|
|||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#include "micamaterial.moc"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#include "framelesshelper_linux.h"
|
||||
#include "sysapiloader_p.h"
|
||||
|
||||
|
@ -509,3 +511,5 @@ QString gtkSettings(const gchar *property)
|
|||
return result;
|
||||
}
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // __linux__
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#if (defined(WIN32) || defined(_WIN32))
|
||||
|
||||
#include "sysapiloader_p.h"
|
||||
#include "winverhelper_p.h"
|
||||
#include "framelesshelper_windows.h"
|
||||
|
@ -499,3 +501,5 @@ _AdjustWindowRectExForDpi2(LPRECT lpRect, const DWORD dwStyle,
|
|||
}
|
||||
return pAdjustWindowRectExForDpi(lpRect, dwStyle, bMenu, dwExStyle, dpi);
|
||||
}
|
||||
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
*/
|
||||
|
||||
#include "registrykey_p.h"
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
#include "framelesshelper_windows.h"
|
||||
#include <array>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
@ -34,18 +37,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcCoreRegistryKey, "wangwenx190.framelesshelper.core.registrykey")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcCoreRegistryKey)
|
||||
# define DEBUG qCDebug(lcCoreRegistryKey)
|
||||
# define WARNING qCWarning(lcCoreRegistryKey)
|
||||
# define CRITICAL qCCritical(lcCoreRegistryKey)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -153,3 +155,5 @@ QVariant RegistryKey::value(const QString &name) const
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
|
|
@ -57,29 +57,30 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcSysApiLoader, "wangwenx190.framelesshelper.core.sysapiloader")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcSysApiLoader)
|
||||
# define DEBUG qCDebug(lcSysApiLoader)
|
||||
# define WARNING qCWarning(lcSysApiLoader)
|
||||
# define CRITICAL qCCritical(lcSysApiLoader)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using SysApiLoaderData = QHash<QString, QFunctionPointer>;
|
||||
|
||||
Q_GLOBAL_STATIC(SysApiLoaderData, g_sysApiLoaderData)
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[nodiscard]] static inline bool isDebug()
|
||||
{
|
||||
static const bool flag = qEnvironmentVariableIntValue("FRAMELESSHELPER_SYSAPILOADER_DEBUG");
|
||||
static const bool flag = (qEnvironmentVariableIntValue("FRAMELESSHELPER_SYSAPILOADER_DEBUG") != 0);
|
||||
return flag;
|
||||
}
|
||||
#endif
|
||||
|
||||
SysApiLoader::SysApiLoader(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
@ -98,7 +99,7 @@ QString SysApiLoader::platformSharedLibrarySuffixName()
|
|||
static const auto result = []() -> QString {
|
||||
#ifdef Q_OS_WINDOWS
|
||||
return FRAMELESSHELPER_STRING_LITERAL(".dll");
|
||||
#elif defined(Q_OS_LINUX)
|
||||
#elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
return FRAMELESSHELPER_STRING_LITERAL(".so");
|
||||
#elif defined(Q_OS_MACOS)
|
||||
return FRAMELESSHELPER_STRING_LITERAL(".dylib");
|
||||
|
@ -187,16 +188,20 @@ bool SysApiLoader::isAvailable(const QString &library, const QString &function)
|
|||
const QString key = generateUniqueKey(library, function);
|
||||
const auto it = g_sysApiLoaderData()->constFind(key);
|
||||
if (it != g_sysApiLoaderData()->constEnd()) {
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
if (isDebug()) {
|
||||
DEBUG << Q_FUNC_INFO << "Function cache found:" << key;
|
||||
}
|
||||
#endif
|
||||
return (it.value() != nullptr);
|
||||
} else {
|
||||
const QFunctionPointer symbol = SysApiLoader::resolve(library, function);
|
||||
g_sysApiLoaderData()->insert(key, symbol);
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
if (isDebug()) {
|
||||
DEBUG << Q_FUNC_INFO << "New function cache:" << key << (symbol ? "[VALID]" : "[NULL]");
|
||||
}
|
||||
#endif
|
||||
if (symbol) {
|
||||
DEBUG << "Successfully loaded" << function << "from" << library;
|
||||
return true;
|
||||
|
@ -217,14 +222,18 @@ QFunctionPointer SysApiLoader::get(const QString &library, const QString &functi
|
|||
const QString key = generateUniqueKey(library, function);
|
||||
const auto it = g_sysApiLoaderData()->constFind(key);
|
||||
if (it != g_sysApiLoaderData()->constEnd()) {
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
if (isDebug()) {
|
||||
DEBUG << Q_FUNC_INFO << "Function cache found:" << key;
|
||||
}
|
||||
#endif
|
||||
return it.value();
|
||||
} else {
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
if (isDebug()) {
|
||||
DEBUG << Q_FUNC_INFO << "Function cache not found:" << key;
|
||||
}
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,36 +36,35 @@
|
|||
#include <QtGui/qpalette.h>
|
||||
#include <QtGui/qsurface.h>
|
||||
#include <QtGui/qsurfaceformat.h>
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# include <QtGui/private/qhighdpiscaling_p.h>
|
||||
# include <QtGui/private/qwindow_p.h>
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||
# include <QtGui/qstylehints.h>
|
||||
#elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && !defined(FRAMELESSHELPER_CORE_NO_PRIVATE))
|
||||
#elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && FRAMELESSHELPER_CONFIG(private_qt))
|
||||
# include <QtGui/qpa/qplatformtheme.h>
|
||||
# include <QtGui/private/qguiapplication_p.h>
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||
#endif // ((QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)) && FRAMELESSHELPER_CONFIG(private_qt))
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsCommon, "wangwenx190.framelesshelper.core.utils.common")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcUtilsCommon)
|
||||
# define DEBUG qCDebug(lcUtilsCommon)
|
||||
# define WARNING qCWarning(lcUtilsCommon)
|
||||
# define CRITICAL qCCritical(lcUtilsCommon)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
struct FONT_ICON
|
||||
{
|
||||
quint32 SegoeUI = 0;
|
||||
|
@ -82,9 +81,9 @@ static constexpr const std::array<FONT_ICON, static_cast<int>(SystemButtonType::
|
|||
FONT_ICON{ 0xE923, 0xE93D },
|
||||
FONT_ICON{ 0xE8BB, 0xE93B }
|
||||
};
|
||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#endif // FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
[[nodiscard]] static inline QPoint getScaleOrigin(const QWindow *window)
|
||||
{
|
||||
Q_ASSERT(window);
|
||||
|
@ -100,7 +99,7 @@ static constexpr const std::array<FONT_ICON, static_cast<int>(SystemButtonType::
|
|||
}
|
||||
return screen->geometry().topLeft();
|
||||
}
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
|
||||
Qt::CursorShape Utils::calculateCursorShape(const QWindow *window, const QPoint &pos)
|
||||
{
|
||||
|
@ -173,9 +172,7 @@ Qt::Edges Utils::calculateWindowEdges(const QWindow *window, const QPoint &pos)
|
|||
|
||||
QString Utils::getSystemButtonGlyph(const SystemButtonType button)
|
||||
{
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
return {};
|
||||
#else // !FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#if FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
const FONT_ICON &icon = g_fontIconsTable.at(static_cast<int>(button));
|
||||
# ifdef Q_OS_WINDOWS
|
||||
// Windows 11: Segoe Fluent Icons (https://docs.microsoft.com/en-us/windows/apps/design/style/segoe-fluent-icons-font)
|
||||
|
@ -188,7 +185,9 @@ QString Utils::getSystemButtonGlyph(const SystemButtonType button)
|
|||
// We always use our own icons on UNIX platforms because Microsoft doesn't allow distributing
|
||||
// the Segoe icon font to other platforms than Windows.
|
||||
return QChar(icon.Fallback);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_BUNDLE_RESOURCE
|
||||
#else // !FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
return {};
|
||||
#endif // FRAMELESSHELPER_CONFIG(bundle_resource)
|
||||
}
|
||||
|
||||
QWindow *Utils::findWindow(const WId windowId)
|
||||
|
@ -294,15 +293,15 @@ bool Utils::shouldAppsUseDarkMode()
|
|||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||
return (QGuiApplication::styleHints()->colorScheme() == Qt::ColorScheme::Dark);
|
||||
#elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && !defined(FRAMELESSHELPER_CORE_NO_PRIVATE))
|
||||
#elif ((QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)) && FRAMELESSHELPER_CONFIG(private_qt))
|
||||
if (const QPlatformTheme * const theme = QGuiApplicationPrivate::platformTheme()) {
|
||||
return (theme->appearance() == QPlatformTheme::Appearance::Dark);
|
||||
}
|
||||
return false;
|
||||
#else // ((QT_VERSION < QT_VERSION_CHECK(6, 2, 1)) || FRAMELESSHELPER_CORE_NO_PRIVATE)
|
||||
#else // ((QT_VERSION < QT_VERSION_CHECK(6, 2, 1)) || !FRAMELESSHELPER_CONFIG(private_qt))
|
||||
# ifdef Q_OS_WINDOWS
|
||||
return shouldAppsUseDarkMode_windows();
|
||||
# elif defined(Q_OS_LINUX)
|
||||
# elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
return shouldAppsUseDarkMode_linux();
|
||||
# elif defined(Q_OS_MACOS)
|
||||
return shouldAppsUseDarkMode_macos();
|
||||
|
@ -319,7 +318,7 @@ qreal Utils::roundScaleFactor(const qreal factor)
|
|||
if (factor < 1) {
|
||||
return 1;
|
||||
}
|
||||
#if (defined(FRAMELESSHELPER_CORE_NO_PRIVATE) || (QT_VERSION < QT_VERSION_CHECK(6, 2, 1)))
|
||||
#if (!FRAMELESSHELPER_CONFIG(private_qt) || (QT_VERSION < QT_VERSION_CHECK(6, 2, 1)))
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
static const auto policy = QGuiApplication::highDpiScaleFactorRoundingPolicy();
|
||||
switch (policy) {
|
||||
|
@ -343,9 +342,9 @@ qreal Utils::roundScaleFactor(const qreal factor)
|
|||
# else // (QT_VERSION < QT_VERSION_CHECK(5, 14, 0))
|
||||
return std::round(factor);
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
|
||||
#else // (!FRAMELESSHELPER_CORE_NO_PRIVATE && (QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)))
|
||||
#else // (FRAMELESSHELPER_CONFIG(private_qt) && (QT_VERSION >= QT_VERSION_CHECK(6, 2, 1)))
|
||||
return QHighDpiScaling::roundScaleFactor(factor);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif
|
||||
}
|
||||
|
||||
int Utils::toNativePixels(const QWindow *window, const int value)
|
||||
|
@ -354,11 +353,11 @@ int Utils::toNativePixels(const QWindow *window, const int value)
|
|||
if (!window) {
|
||||
return 0;
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return std::round(qreal(value) * window->devicePixelRatio());
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::toNativePixels(value, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else
|
||||
return std::round(qreal(value) * window->devicePixelRatio());
|
||||
#endif
|
||||
}
|
||||
|
||||
QPoint Utils::toNativePixels(const QWindow *window, const QPoint &point)
|
||||
|
@ -367,12 +366,12 @@ QPoint Utils::toNativePixels(const QWindow *window, const QPoint &point)
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::toNativePixels(point, window);
|
||||
#else
|
||||
const QPoint origin = getScaleOrigin(window);
|
||||
return QPointF(QPointF(point - origin) * window->devicePixelRatio()).toPoint() + origin;
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return QHighDpi::toNativePixels(point, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif
|
||||
}
|
||||
|
||||
QSize Utils::toNativePixels(const QWindow *window, const QSize &size)
|
||||
|
@ -381,11 +380,11 @@ QSize Utils::toNativePixels(const QWindow *window, const QSize &size)
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return QSizeF(QSizeF(size) * window->devicePixelRatio()).toSize();
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::toNativePixels(size, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else
|
||||
return QSizeF(QSizeF(size) * window->devicePixelRatio()).toSize();
|
||||
#endif
|
||||
}
|
||||
|
||||
QRect Utils::toNativePixels(const QWindow *window, const QRect &rect)
|
||||
|
@ -394,11 +393,11 @@ QRect Utils::toNativePixels(const QWindow *window, const QRect &rect)
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return QRect(toNativePixels(window, rect.topLeft()), toNativePixels(window, rect.size()));
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::toNativePixels(rect, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else
|
||||
return QRect(toNativePixels(window, rect.topLeft()), toNativePixels(window, rect.size()));
|
||||
#endif
|
||||
}
|
||||
|
||||
int Utils::fromNativePixels(const QWindow *window, const int value)
|
||||
|
@ -407,11 +406,11 @@ int Utils::fromNativePixels(const QWindow *window, const int value)
|
|||
if (!window) {
|
||||
return 0;
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return std::round(qreal(value) / window->devicePixelRatio());
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::fromNativePixels(value, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else
|
||||
return std::round(qreal(value) / window->devicePixelRatio());
|
||||
#endif
|
||||
}
|
||||
|
||||
QPoint Utils::fromNativePixels(const QWindow *window, const QPoint &point)
|
||||
|
@ -420,12 +419,12 @@ QPoint Utils::fromNativePixels(const QWindow *window, const QPoint &point)
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::fromNativePixels(point, window);
|
||||
#else
|
||||
const QPoint origin = getScaleOrigin(window);
|
||||
return QPointF(QPointF(point - origin) / window->devicePixelRatio()).toPoint() + origin;
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return QHighDpi::fromNativePixels(point, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif
|
||||
}
|
||||
|
||||
QSize Utils::fromNativePixels(const QWindow *window, const QSize &size)
|
||||
|
@ -434,11 +433,11 @@ QSize Utils::fromNativePixels(const QWindow *window, const QSize &size)
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return QSizeF(QSizeF(size) / window->devicePixelRatio()).toSize();
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::fromNativePixels(size, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else
|
||||
return QSizeF(QSizeF(size) / window->devicePixelRatio()).toSize();
|
||||
#endif
|
||||
}
|
||||
|
||||
QRect Utils::fromNativePixels(const QWindow *window, const QRect &rect)
|
||||
|
@ -447,11 +446,11 @@ QRect Utils::fromNativePixels(const QWindow *window, const QRect &rect)
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return QRect(fromNativePixels(window, rect.topLeft()), fromNativePixels(window, rect.size()));
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::fromNativePixels(rect, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else
|
||||
return QRect(fromNativePixels(window, rect.topLeft()), fromNativePixels(window, rect.size()));
|
||||
#endif
|
||||
}
|
||||
|
||||
QPoint Utils::toNativeLocalPosition(const QWindow *window, const QPoint &point)
|
||||
|
@ -460,11 +459,11 @@ QPoint Utils::toNativeLocalPosition(const QWindow *window, const QPoint &point)
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return QPointF(QPointF(point) * window->devicePixelRatio()).toPoint();
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::toNativeLocalPosition(point, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else
|
||||
return QPointF(QPointF(point) * window->devicePixelRatio()).toPoint();
|
||||
#endif
|
||||
}
|
||||
|
||||
QPoint Utils::toNativeGlobalPosition(const QWindow *window, const QPoint &point)
|
||||
|
@ -473,11 +472,11 @@ QPoint Utils::toNativeGlobalPosition(const QWindow *window, const QPoint &point)
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#if (defined(FRAMELESSHELPER_CORE_NO_PRIVATE) || (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)))
|
||||
#if (!FRAMELESSHELPER_CONFIG(private_qt) || (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)))
|
||||
return toNativePixels(window, point);
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE && QT_VERSION >= 6.0.0
|
||||
#else
|
||||
return QHighDpi::toNativeGlobalPosition(point, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE || QT_VERSION < 6.0.0
|
||||
#endif
|
||||
}
|
||||
|
||||
QPoint Utils::fromNativeLocalPosition(const QWindow *window, const QPoint &point)
|
||||
|
@ -486,11 +485,11 @@ QPoint Utils::fromNativeLocalPosition(const QWindow *window, const QPoint &point
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return QPointF(QPointF(point) / window->devicePixelRatio()).toPoint();
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return QHighDpi::fromNativeLocalPosition(point, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else
|
||||
return QPointF(QPointF(point) / window->devicePixelRatio()).toPoint();
|
||||
#endif
|
||||
}
|
||||
|
||||
QPoint Utils::fromNativeGlobalPosition(const QWindow *window, const QPoint &point)
|
||||
|
@ -499,11 +498,11 @@ QPoint Utils::fromNativeGlobalPosition(const QWindow *window, const QPoint &poin
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#if (defined(FRAMELESSHELPER_CORE_NO_PRIVATE) || (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)))
|
||||
#if (!FRAMELESSHELPER_CONFIG(private_qt) || (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)))
|
||||
return fromNativePixels(window, point);
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE && QT_VERSION >= 6.0.0
|
||||
#else
|
||||
return QHighDpi::fromNativeGlobalPosition(point, window);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE || QT_VERSION < 6.0.0
|
||||
#endif
|
||||
}
|
||||
|
||||
int Utils::horizontalAdvance(const QFontMetrics &fm, const QString &str)
|
||||
|
@ -580,7 +579,7 @@ QColor Utils::getAccentColor()
|
|||
#else // (QT_VERSION < QT_VERSION_CHECK(6, 6, 0))
|
||||
# ifdef Q_OS_WINDOWS
|
||||
return getAccentColor_windows();
|
||||
# elif defined(Q_OS_LINUX)
|
||||
# elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
return getAccentColor_linux();
|
||||
# elif defined(Q_OS_MACOS)
|
||||
return getAccentColor_macos();
|
||||
|
@ -598,11 +597,11 @@ bool Utils::isWindowAccelerated(const QWindow *window)
|
|||
}
|
||||
switch (window->surfaceType()) {
|
||||
case QSurface::RasterGLSurface:
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return true;
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return qt_window_private(const_cast<QWindow *>(window))->compositing;
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
case QSurface::OpenGLSurface:
|
||||
case QSurface::VulkanSurface:
|
||||
case QSurface::MetalSurface:
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
*/
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#if (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
|
||||
#include "framelessconfig_p.h"
|
||||
#include "framelessmanager.h"
|
||||
#include "framelessmanager_p.h"
|
||||
|
@ -33,12 +36,12 @@
|
|||
#include <QtGui/qscreen.h>
|
||||
#include <QtGui/qpalette.h>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# if __has_include(<QtX11Extras/qx11info_x11.h>)
|
||||
# include <QtX11Extras/qx11info_x11.h>
|
||||
# define FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# endif // __has_include(<QtX11Extras/qx11info_x11.h>)
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# include <QtGui/qpa/qplatformnativeinterface.h>
|
||||
# include <QtGui/qpa/qplatformwindow.h>
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
@ -51,22 +54,21 @@
|
|||
# include <QtGui/private/qtx11extras_p.h>
|
||||
# define FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsLinux, "wangwenx190.framelesshelper.core.utils.linux")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcUtilsLinux)
|
||||
# define DEBUG qCDebug(lcUtilsLinux)
|
||||
# define WARNING qCWarning(lcUtilsLinux)
|
||||
# define CRITICAL qCCritical(lcUtilsLinux)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -143,10 +145,7 @@ extern QString gtkSettings(const gchar *);
|
|||
|
||||
QScreen *Utils::x11_findScreenForVirtualDesktop(const int virtualDesktopNumber)
|
||||
{
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
Q_UNUSED(virtualDesktopNumber);
|
||||
return QGuiApplication::primaryScreen();
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
if (virtualDesktopNumber == -1) {
|
||||
return QGuiApplication::primaryScreen();
|
||||
}
|
||||
|
@ -167,7 +166,10 @@ QScreen *Utils::x11_findScreenForVirtualDesktop(const int virtualDesktopNumber)
|
|||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
}
|
||||
return nullptr;
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
Q_UNUSED(virtualDesktopNumber);
|
||||
return QGuiApplication::primaryScreen();
|
||||
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
}
|
||||
|
||||
x11_return_type Utils::x11_appRootWindow(const int screen)
|
||||
|
@ -175,10 +177,7 @@ x11_return_type Utils::x11_appRootWindow(const int screen)
|
|||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
return QX11Info::appRootWindow(screen);
|
||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
Q_UNUSED(screen);
|
||||
return 0;
|
||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
if (!qApp) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -191,7 +190,10 @@ x11_return_type Utils::x11_appRootWindow(const int screen)
|
|||
return 0;
|
||||
}
|
||||
return static_cast<xcb_window_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(krootwindow, scr)));
|
||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
Q_UNUSED(screen);
|
||||
return 0;
|
||||
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
}
|
||||
|
||||
|
@ -200,9 +202,7 @@ int Utils::x11_appScreen()
|
|||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
return QX11Info::appScreen();
|
||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return 0;
|
||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
if (!qApp) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -211,7 +211,9 @@ int Utils::x11_appScreen()
|
|||
return 0;
|
||||
}
|
||||
return reinterpret_cast<qintptr>(native->nativeResourceForIntegration(kx11screen));
|
||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return 0;
|
||||
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
}
|
||||
|
||||
|
@ -220,9 +222,7 @@ x11_return_type Utils::x11_appTime()
|
|||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
return QX11Info::appTime();
|
||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return 0;
|
||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
if (!qApp) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -235,7 +235,9 @@ x11_return_type Utils::x11_appTime()
|
|||
return 0;
|
||||
}
|
||||
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kapptime, screen)));
|
||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return 0;
|
||||
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
}
|
||||
|
||||
|
@ -244,9 +246,7 @@ x11_return_type Utils::x11_appUserTime()
|
|||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
return QX11Info::appUserTime();
|
||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return 0;
|
||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
if (!qApp) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -259,7 +259,9 @@ x11_return_type Utils::x11_appUserTime()
|
|||
return 0;
|
||||
}
|
||||
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kappusertime, screen)));
|
||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return 0;
|
||||
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
}
|
||||
|
||||
|
@ -268,9 +270,7 @@ x11_return_type Utils::x11_getTimestamp()
|
|||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
return QX11Info::getTimestamp();
|
||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return 0;
|
||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
if (!qApp) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -283,7 +283,9 @@ x11_return_type Utils::x11_getTimestamp()
|
|||
return 0;
|
||||
}
|
||||
return static_cast<xcb_timestamp_t>(reinterpret_cast<quintptr>(native->nativeResourceForScreen(kgettimestamp, screen)));
|
||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return 0;
|
||||
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
}
|
||||
|
||||
|
@ -292,9 +294,7 @@ QByteArray Utils::x11_nextStartupId()
|
|||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
return QX11Info::nextStartupId();
|
||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return {};
|
||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
if (!qApp) {
|
||||
return {};
|
||||
}
|
||||
|
@ -303,7 +303,9 @@ QByteArray Utils::x11_nextStartupId()
|
|||
return {};
|
||||
}
|
||||
return static_cast<char *>(native->nativeResourceForIntegration(kstartupid));
|
||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return {};
|
||||
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
}
|
||||
|
||||
|
@ -312,9 +314,7 @@ Display *Utils::x11_display()
|
|||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
return QX11Info::display();
|
||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return nullptr;
|
||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
if (!qApp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -332,7 +332,9 @@ Display *Utils::x11_display()
|
|||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||
return reinterpret_cast<Display *>(native->nativeResourceForIntegration(kdisplay));
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return nullptr;
|
||||
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
}
|
||||
|
||||
|
@ -341,9 +343,7 @@ xcb_connection_t *Utils::x11_connection()
|
|||
#ifdef FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
return QX11Info::connection();
|
||||
#else // !FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
# ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
return nullptr;
|
||||
# else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
if (!qApp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -361,7 +361,9 @@ xcb_connection_t *Utils::x11_connection()
|
|||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
|
||||
return reinterpret_cast<xcb_connection_t *>(native->nativeResourceForIntegration(kconnection));
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 2, 0))
|
||||
# endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
# else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return nullptr;
|
||||
# endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
#endif // FRAMELESSHELPER_HAS_X11EXTRAS
|
||||
}
|
||||
|
||||
|
@ -993,3 +995,5 @@ bool Utils::setPlatformPropertiesForWindow(QWindow *window, const QVariantHash &
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // Q_OS_LINUX
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
*/
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
|
||||
#include "framelessmanager.h"
|
||||
#include "framelessmanager_p.h"
|
||||
#include "framelessconfig_p.h"
|
||||
|
@ -67,18 +70,17 @@ FRAMELESSHELPER_END_NAMESPACE
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsMac, "wangwenx190.framelesshelper.core.utils.mac")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcUtilsMac)
|
||||
# define DEBUG qCDebug(lcUtilsMac)
|
||||
# define WARNING qCWarning(lcUtilsMac)
|
||||
# define CRITICAL qCCritical(lcUtilsMac)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -221,6 +223,7 @@ private:
|
|||
class NSWindowProxy : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
FRAMELESSHELPER_CLASS_INFO
|
||||
Q_DISABLE_COPY_MOVE(NSWindowProxy)
|
||||
|
||||
public:
|
||||
|
@ -758,3 +761,5 @@ QColor Utils::getFrameBorderColor(const bool active)
|
|||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#include "utils_mac.moc"
|
||||
|
||||
#endif // Q_OS_MACOS
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
*/
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
#include "framelesshelper_windows.h"
|
||||
#include "framelessmanager.h"
|
||||
#include "framelessconfig_p.h"
|
||||
|
@ -39,7 +42,7 @@
|
|||
#include <QtCore/qtextstream.h>
|
||||
#include <QtGui/qwindow.h>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# include <QtCore/private/qsystemerror_p.h>
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# include <QtGui/private/qguiapplication_p.h>
|
||||
|
@ -50,7 +53,7 @@
|
|||
# else // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# include <QtGui/qpa/qplatformwindow_p.h>
|
||||
# endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif
|
||||
#include <d2d1.h>
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
|
@ -59,18 +62,17 @@ Q_DECLARE_METATYPE(QMargins)
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcUtilsWin, "wangwenx190.framelesshelper.core.utils.win")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcUtilsWin)
|
||||
# define DEBUG qCDebug(lcUtilsWin)
|
||||
# define WARNING qCWarning(lcUtilsWin)
|
||||
# define CRITICAL qCCritical(lcUtilsWin)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -108,7 +110,7 @@ FRAMELESSHELPER_STRING_CONSTANT(SystemParametersInfoW)
|
|||
FRAMELESSHELPER_STRING_CONSTANT(SetClassLongPtrW)
|
||||
FRAMELESSHELPER_STRING_CONSTANT(GetWindowLongPtrW)
|
||||
FRAMELESSHELPER_STRING_CONSTANT(SetWindowLongPtrW)
|
||||
#else // Q_PROCESSOR_X86_64
|
||||
#else // !Q_PROCESSOR_X86_64
|
||||
// WinUser.h defines G/SetClassLongPtr as G/SetClassLong due to the
|
||||
// "Ptr" suffixed APIs are not available on 32-bit platforms, so we
|
||||
// have to add the following workaround. Undefine the macros and then
|
||||
|
@ -778,7 +780,10 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
|
|||
if (code == ERROR_SUCCESS) {
|
||||
return kSuccessMessageText;
|
||||
}
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
const QString errorText = QSystemError::windowsString(code);
|
||||
return kErrorMessageTemplate.arg(function, QString::number(code), errorText);
|
||||
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
LPWSTR buf = nullptr;
|
||||
if (::FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
|
||||
nullptr, code, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), reinterpret_cast<LPWSTR>(&buf), 0, nullptr) == 0) {
|
||||
|
@ -788,10 +793,7 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
|
|||
::LocalFree(buf);
|
||||
buf = nullptr;
|
||||
return kErrorMessageTemplate.arg(function, QString::number(code), errorText);
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
const QString errorText = QSystemError::windowsString(code);
|
||||
return kErrorMessageTemplate.arg(function, QString::number(code), errorText);
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
}
|
||||
|
||||
[[nodiscard]] static inline QString getSystemErrorMessageImpl(const QString &function, const HRESULT hr)
|
||||
|
@ -907,11 +909,13 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
|
|||
}
|
||||
}
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[nodiscard]] static inline bool isWin32MessageDebuggingEnabled()
|
||||
{
|
||||
static const bool result = (qEnvironmentVariableIntValue("FRAMELESSHELPER_ENABLE_WIN32_MESSAGE_DEBUGGING") != 0);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
[[nodiscard]] static inline QByteArray qtNativeEventType()
|
||||
{
|
||||
|
@ -965,6 +969,7 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
|
|||
if (!hWnd) {
|
||||
return 0;
|
||||
}
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
if (isWin32MessageDebuggingEnabled()) {
|
||||
MSG message;
|
||||
SecureZeroMemory(&message, sizeof(message));
|
||||
|
@ -975,6 +980,7 @@ static constexpr const std::array<Win32Message, 333> g_win32MessageMap =
|
|||
// The time and pt members are not used.
|
||||
Utils::printWin32Message(&message);
|
||||
}
|
||||
#endif
|
||||
const auto windowId = reinterpret_cast<WId>(hWnd);
|
||||
const auto it = g_win32UtilsData()->data.constFind(windowId);
|
||||
if (it == g_win32UtilsData()->data.constEnd()) {
|
||||
|
@ -1231,7 +1237,7 @@ bool Utils::updateInternalWindowFrameMargins(QWindow *window, const bool enable)
|
|||
}();
|
||||
const QVariant marginsVar = QVariant::fromValue(margins);
|
||||
window->setProperty(kQtWindowCustomMarginsVar, marginsVar);
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
if (QPlatformWindow *platformWindow = window->handle()) {
|
||||
if (const auto ni = QGuiApplication::platformNativeInterface()) {
|
||||
|
@ -1252,7 +1258,7 @@ bool Utils::updateInternalWindowFrameMargins(QWindow *window, const bool enable)
|
|||
return false;
|
||||
}
|
||||
# endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
return triggerFrameChange(windowId);
|
||||
}
|
||||
|
||||
|
@ -2215,7 +2221,7 @@ bool Utils::shouldAppsUseDarkMode_windows()
|
|||
if (!WindowsVersionHelper::isWin10RS1OrGreater() || isHighContrastModeEnabled()) {
|
||||
return false;
|
||||
}
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
if (const auto app = qApp->nativeInterface<QNativeInterface::Private::QWindowsApplication>()) {
|
||||
return app->isDarkMode();
|
||||
|
@ -2232,7 +2238,7 @@ bool Utils::shouldAppsUseDarkMode_windows()
|
|||
// Qt gained the ability to detect the system dark mode setting only since 5.15.
|
||||
// We should detect it ourself on versions below that.
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
// Starting from Windows 10 1903, "ShouldAppsUseDarkMode()" (exported by UXTHEME.DLL,
|
||||
// ordinal number 132) always return "TRUE" (actually, a random non-zero number at
|
||||
// runtime), so we can't use it due to this unreliability. In this case, we just simply
|
||||
|
@ -2598,10 +2604,7 @@ bool Utils::hideOriginalTitleBarElements(const WId windowId, const bool disable)
|
|||
|
||||
bool Utils::setQtDarkModeAwareEnabled(const bool enable)
|
||||
{
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
Q_UNUSED(enable);
|
||||
return true;
|
||||
#else // !FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
// We'll call QPA functions, so we have to ensure that the QGuiApplication
|
||||
// instance has already been created and initialized, because the platform
|
||||
|
@ -2625,9 +2628,9 @@ bool Utils::setQtDarkModeAwareEnabled(const bool enable)
|
|||
// There's no global dark theme for Qt Quick applications, so setting this
|
||||
// flag has no effect for pure Qt Quick applications.
|
||||
return {App::DarkModeWindowFrames | App::DarkModeStyle};
|
||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 5, 0))
|
||||
// Don't try to use the broken dark theme for Qt Widgets applications.
|
||||
// For Qt Quick applications this is also enough. There's no global dark
|
||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 5, 0)) \
|
||||
// Don't try to use the broken dark theme for Qt Widgets applications. \
|
||||
// For Qt Quick applications this is also enough. There's no global dark \
|
||||
// theme for them anyway.
|
||||
return {App::DarkModeWindowFrames};
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
|
||||
|
@ -2641,7 +2644,10 @@ bool Utils::setQtDarkModeAwareEnabled(const bool enable)
|
|||
Q_UNUSED(enable);
|
||||
return true;
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#else // !FRAMELESSHELPER_CONFIG(private_qt)
|
||||
Q_UNUSED(enable);
|
||||
return true;
|
||||
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
}
|
||||
|
||||
bool Utils::registerThemeChangeNotification()
|
||||
|
@ -3071,6 +3077,12 @@ quint64 Utils::getKeyState()
|
|||
if (get(VK_RBUTTON)) {
|
||||
result |= (buttonSwapped ? MK_LBUTTON : MK_RBUTTON);
|
||||
}
|
||||
if (get(VK_SHIFT)) {
|
||||
result |= MK_SHIFT;
|
||||
}
|
||||
if (get(VK_CONTROL)) {
|
||||
result |= MK_CONTROL;
|
||||
}
|
||||
if (get(VK_MBUTTON)) {
|
||||
result |= MK_MBUTTON;
|
||||
}
|
||||
|
@ -3192,7 +3204,7 @@ QMargins Utils::getWindowCustomFrameMargins(const QWindow *window)
|
|||
if (!window) {
|
||||
return {};
|
||||
}
|
||||
#ifndef FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
if (QPlatformWindow *platformWindow = window->handle()) {
|
||||
if (const auto ni = QGuiApplication::platformNativeInterface()) {
|
||||
|
@ -3213,7 +3225,7 @@ QMargins Utils::getWindowCustomFrameMargins(const QWindow *window)
|
|||
WARNING << "Failed to retrieve the platform window.";
|
||||
}
|
||||
# endif // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
#endif // FRAMELESSHELPER_CORE_NO_PRIVATE
|
||||
#endif // FRAMELESSHELPER_CONFIG(private_qt)
|
||||
const QVariant marginsVar = window->property(kQtWindowCustomMarginsVar);
|
||||
if (marginsVar.isValid() && !marginsVar.isNull()) {
|
||||
return qvariant_cast<QMargins>(marginsVar);
|
||||
|
@ -3247,7 +3259,7 @@ void Utils::printWin32Message(void *msgPtr)
|
|||
const LPARAM lParam = msg->lParam;
|
||||
const QString messageCodeHex = FRAMELESSHELPER_STRING_LITERAL("0x") + QString::number(uMsg, 16).toUpper().rightJustified(4, u'0');
|
||||
QString text = {};
|
||||
QTextStream stream(&text);
|
||||
QTextStream stream(&text, QIODevice::WriteOnly);
|
||||
stream << "Windows message received: window handle: " << hwnd2str(hWnd) << ", message: ";
|
||||
if (uMsg >= WM_APP) {
|
||||
const UINT diff = (uMsg - WM_APP);
|
||||
|
@ -3312,3 +3324,5 @@ void Utils::printWin32Message(void *msgPtr)
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
#include "windowborderpainter.h"
|
||||
#include "windowborderpainter_p.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
|
||||
#include "utils.h"
|
||||
#include "framelessmanager.h"
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
@ -34,18 +37,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcWindowBorderPainter, "wangwenx190.framelesshelper.core.windowborderpainter")
|
||||
|
||||
#ifdef FRAMELESSHELPER_CORE_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcWindowBorderPainter)
|
||||
# define DEBUG qCDebug(lcWindowBorderPainter)
|
||||
# define WARNING qCWarning(lcWindowBorderPainter)
|
||||
# define CRITICAL qCCritical(lcWindowBorderPainter)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -116,9 +118,13 @@ QColor WindowBorderPainter::inactiveColor() const
|
|||
|
||||
int WindowBorderPainter::nativeThickness() const
|
||||
{
|
||||
#ifdef Q_OS_WINDOWS
|
||||
// Qt will scale it to the appropriate value for us automatically,
|
||||
// based on the current system DPI and scale factor rounding policy.
|
||||
return kDefaultWindowFrameBorderThickness;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
WindowEdges WindowBorderPainter::nativeEdges() const
|
||||
|
@ -254,3 +260,5 @@ void WindowBorderPainter::setInactiveColor(const QColor &value)
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
*/
|
||||
|
||||
#include "winverhelper_p.h"
|
||||
|
||||
#ifdef Q_OS_WINDOWS
|
||||
|
||||
#include "utils.h"
|
||||
#include <array>
|
||||
|
||||
|
@ -148,3 +151,5 @@ IMPL(1122H2, 11_22H2)
|
|||
#undef IMPL
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
|
|
@ -41,10 +41,6 @@ set(PUBLIC_HEADERS
|
|||
${INCLUDE_PREFIX}/framelessquickmodule.h
|
||||
${INCLUDE_PREFIX}/framelessquickhelper.h
|
||||
${INCLUDE_PREFIX}/framelessquickutils.h
|
||||
${INCLUDE_PREFIX}/quickchromepalette.h
|
||||
${INCLUDE_PREFIX}/quickmicamaterial.h
|
||||
${INCLUDE_PREFIX}/quickimageitem.h
|
||||
${INCLUDE_PREFIX}/quickwindowborder.h
|
||||
)
|
||||
|
||||
set(PUBLIC_HEADERS_ALIAS
|
||||
|
@ -52,39 +48,55 @@ set(PUBLIC_HEADERS_ALIAS
|
|||
${INCLUDE_PREFIX}/FramelessQuickModule
|
||||
${INCLUDE_PREFIX}/FramelessQuickHelper
|
||||
${INCLUDE_PREFIX}/FramelessQuickUtils
|
||||
${INCLUDE_PREFIX}/QuickChromePalette
|
||||
${INCLUDE_PREFIX}/QuickMicaMaterial
|
||||
${INCLUDE_PREFIX}/QuickImageItem
|
||||
${INCLUDE_PREFIX}/QuickWindowBorder
|
||||
)
|
||||
|
||||
set(PRIVATE_HEADERS
|
||||
${INCLUDE_PREFIX}/private/quickstandardsystembutton_p.h
|
||||
${INCLUDE_PREFIX}/private/quickstandardtitlebar_p.h
|
||||
${INCLUDE_PREFIX}/private/framelessquickhelper_p.h
|
||||
${INCLUDE_PREFIX}/private/quickimageitem_p.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
framelessquickutils.cpp
|
||||
framelessquickhelper.cpp
|
||||
framelesshelperquick_global.cpp
|
||||
quickimageitem.cpp
|
||||
)
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_SYSTEM_BUTTON)
|
||||
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/quickstandardsystembutton_p.h)
|
||||
list(APPEND SOURCES quickstandardsystembutton.cpp)
|
||||
endif()
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_TITLEBAR)
|
||||
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/quickchromepalette.h)
|
||||
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/QuickChromePalette)
|
||||
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/quickstandardtitlebar_p.h)
|
||||
list(APPEND SOURCES quickchromepalette.cpp quickstandardtitlebar.cpp)
|
||||
endif()
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_WINDOW)
|
||||
list(APPEND PRIVATE_HEADERS
|
||||
${INCLUDE_PREFIX}/private/framelessquickwindow_p.h
|
||||
${INCLUDE_PREFIX}/private/framelessquickwindow_p_p.h
|
||||
${INCLUDE_PREFIX}/private/framelessquickapplicationwindow_p.h
|
||||
${INCLUDE_PREFIX}/private/framelessquickapplicationwindow_p_p.h
|
||||
${INCLUDE_PREFIX}/private/quickmicamaterial_p.h
|
||||
${INCLUDE_PREFIX}/private/quickimageitem_p.h
|
||||
${INCLUDE_PREFIX}/private/quickwindowborder_p.h
|
||||
)
|
||||
)
|
||||
list(APPEND SOURCES framelessquickwindow.cpp framelessquickapplicationwindow.cpp)
|
||||
endif()
|
||||
|
||||
set(SOURCES
|
||||
quickstandardsystembutton.cpp
|
||||
quickstandardtitlebar.cpp
|
||||
framelessquickutils.cpp
|
||||
framelessquickmodule.cpp
|
||||
framelessquickwindow.cpp
|
||||
framelessquickapplicationwindow.cpp
|
||||
framelessquickhelper.cpp
|
||||
quickchromepalette.cpp
|
||||
framelesshelperquick_global.cpp
|
||||
quickmicamaterial.cpp
|
||||
quickimageitem.cpp
|
||||
quickwindowborder.cpp
|
||||
)
|
||||
if(NOT FRAMELESSHELPER_NO_MICA_MATERIAL)
|
||||
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/quickmicamaterial.h)
|
||||
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/QuickMicaMaterial)
|
||||
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/quickmicamaterial_p.h)
|
||||
list(APPEND SOURCES quickmicamaterial.cpp)
|
||||
endif()
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_BORDER_PAINTER)
|
||||
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/quickwindowborder.h)
|
||||
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/QuickWindowBorder)
|
||||
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/quickwindowborder_p.h)
|
||||
list(APPEND SOURCES quickwindowborder.cpp)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
||||
set(__rc_path "${CMAKE_CURRENT_BINARY_DIR}/${SUB_MODULE_FULL_NAME}.rc")
|
||||
|
@ -118,6 +130,7 @@ add_library(${PROJECT_NAME}::${SUB_MODULE_FULL_NAME} ALIAS ${SUB_MODULE_TARGET})
|
|||
set_target_properties(${SUB_MODULE_TARGET} PROPERTIES
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
||||
OUTPUT_NAME "${SUB_MODULE_TARGET}${FRAMELESSHELPER_64BIT_POSTFIX}"
|
||||
)
|
||||
|
||||
set(__export_targets ${SUB_MODULE_TARGET})
|
||||
|
@ -138,8 +151,8 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
|||
VERSION "1.0"
|
||||
OUTPUT_DIRECTORY "${__import_base_dir}/org/wangwenx190/${PROJECT_NAME}"
|
||||
RESOURCE_PREFIX "/"
|
||||
TYPEINFO "plugins.qmltypes" # This is the type info file name since at least Qt5, some tools won't recognize other names.
|
||||
#NO_RESOURCE_TARGET_PATH # Can't be used for non-executables.
|
||||
TYPEINFO "plugins.qmltypes" # This is the default type info file name since at least Qt5, some tools won't recognize other names.
|
||||
#NO_RESOURCE_TARGET_PATH # Can't be used for non-executable targets.
|
||||
OUTPUT_TARGETS __qml_targets
|
||||
IMPORTS
|
||||
QtQml/auto
|
||||
|
@ -213,31 +226,6 @@ if(QT_VERSION VERSION_GREATER_EQUAL "6.3")
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_BUILD_STATIC)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_QUICK_STATIC)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_NO_DEBUG_OUTPUT)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
||||
FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_QUICK_NO_BUNDLE_RESOURCE)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_NO_PRIVATE)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_QUICK_NO_PRIVATE)
|
||||
endif()
|
||||
|
||||
if(DEFINED FRAMELESSHELPER_NAMESPACE)
|
||||
if("x${FRAMELESSHELPER_NAMESPACE}" STREQUAL "x")
|
||||
message(FATAL_ERROR "FRAMELESSHELPER_NAMESPACE can't be empty!")
|
||||
endif()
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_NAMESPACE=${FRAMELESSHELPER_NAMESPACE})
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
||||
FRAMELESSHELPER_QUICK_LIBRARY
|
||||
)
|
||||
|
@ -254,7 +242,7 @@ else()
|
|||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${SUB_MODULE_TARGET} PUBLIC
|
||||
target_link_libraries(${SUB_MODULE_TARGET} PRIVATE
|
||||
${PROJECT_NAME}::Core
|
||||
)
|
||||
|
||||
|
|
|
@ -23,24 +23,65 @@
|
|||
*/
|
||||
|
||||
#include "framelesshelperquick_global.h"
|
||||
#include "framelessquickhelper.h"
|
||||
#include "framelessquickutils.h"
|
||||
#include "quickimageitem_p.h"
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
# include "quickchromepalette.h"
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
# include "quickmicamaterial.h"
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
# include "quickwindowborder.h"
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# if FRAMELESSHELPER_CONFIG(window)
|
||||
# include "framelessquickwindow_p.h"
|
||||
# endif
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# if FRAMELESSHELPER_CONFIG(window)
|
||||
# include "framelessquickapplicationwindow_p.h"
|
||||
# endif
|
||||
# if FRAMELESSHELPER_CONFIG(system_button)
|
||||
# include "quickstandardsystembutton_p.h"
|
||||
# endif
|
||||
# if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
# include "quickstandardtitlebar_p.h"
|
||||
# endif
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#endif
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
||||
#define REG_META_TYPE(Type) qRegisterMetaType<Type>(#Type)
|
||||
#ifndef QUICK_URI_SHORT
|
||||
# define QUICK_URI_SHORT FRAMELESSHELPER_QUICK_URI, FRAMELESSHELPER_QUICK_VERSION_MAJOR
|
||||
#endif
|
||||
|
||||
#ifndef QUICK_URI_FULL
|
||||
# define QUICK_URI_FULL QUICK_URI_SHORT, FRAMELESSHELPER_QUICK_VERSION_MINOR
|
||||
#endif
|
||||
|
||||
#ifndef QUICK_URI_EXPAND
|
||||
# define QUICK_URI_EXPAND(name) QUICK_URI_FULL, name
|
||||
#endif
|
||||
|
||||
#ifndef REG_META_TYPE
|
||||
# define REG_META_TYPE(Type) qRegisterMetaType<Type>(#Type)
|
||||
#endif
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickGlobal, "wangwenx190.framelesshelper.quick.global")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcQuickGlobal)
|
||||
# define DEBUG qCDebug(lcQuickGlobal)
|
||||
# define WARNING qCWarning(lcQuickGlobal)
|
||||
# define CRITICAL qCCritical(lcQuickGlobal)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
QuickGlobal::QuickGlobal(QObject *parent) : QObject(parent)
|
||||
|
@ -49,10 +90,7 @@ QuickGlobal::QuickGlobal(QObject *parent) : QObject(parent)
|
|||
|
||||
QuickGlobal::~QuickGlobal() = default;
|
||||
|
||||
namespace FramelessHelper::Quick
|
||||
{
|
||||
|
||||
void initialize()
|
||||
void FramelessHelperQuickInitialize()
|
||||
{
|
||||
static bool inited = false;
|
||||
if (inited) {
|
||||
|
@ -60,7 +98,7 @@ void initialize()
|
|||
}
|
||||
inited = true;
|
||||
|
||||
FramelessHelper::Core::initialize();
|
||||
FramelessHelperCoreInitialize();
|
||||
|
||||
// Registering meta types only causes troubles in Qt6.
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
|
@ -72,7 +110,7 @@ void initialize()
|
|||
#endif
|
||||
}
|
||||
|
||||
void uninitialize()
|
||||
void FramelessHelperQuickUninitialize()
|
||||
{
|
||||
static bool uninited = false;
|
||||
if (uninited) {
|
||||
|
@ -82,9 +120,80 @@ void uninitialize()
|
|||
|
||||
// ### TODO: The Quick module-specific uninitialization.
|
||||
|
||||
FramelessHelper::Core::uninitialize();
|
||||
FramelessHelperCoreUninitialize();
|
||||
}
|
||||
|
||||
void FramelessHelperQuickRegisterTypes(QQmlEngine *engine)
|
||||
{
|
||||
Q_ASSERT(engine);
|
||||
if (!engine) {
|
||||
return;
|
||||
}
|
||||
|
||||
// In most cases we don't need to register the QML types for multiple times.
|
||||
static bool reg = false;
|
||||
if (reg) {
|
||||
return;
|
||||
}
|
||||
reg = true;
|
||||
|
||||
// @uri org.wangwenx190.FramelessHelper
|
||||
qmlRegisterUncreatableType<QuickGlobal>(QUICK_URI_FULL, "FramelessHelperConstants",
|
||||
FRAMELESSHELPER_STRING_LITERAL("The FramelessHelperConstants namespace is not creatable, you can only use it to access it's enums."));
|
||||
|
||||
qmlRegisterSingletonType<FramelessQuickUtils>(QUICK_URI_EXPAND("FramelessUtils"),
|
||||
[](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
return new FramelessQuickUtils;
|
||||
});
|
||||
|
||||
qmlRegisterType<FramelessQuickHelper>(QUICK_URI_EXPAND("FramelessHelper"));
|
||||
qmlRegisterType<QuickImageItem>(QUICK_URI_EXPAND("ImageItem"));
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
qmlRegisterAnonymousType<QuickChromePalette>(QUICK_URI_SHORT);
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
qmlRegisterType<QuickMicaMaterial>(QUICK_URI_EXPAND("MicaMaterial"));
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
qmlRegisterType<QuickWindowBorder>(QUICK_URI_EXPAND("WindowBorder"));
|
||||
#endif
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window))
|
||||
qmlRegisterType<FramelessQuickWindow>(QUICK_URI_EXPAND("FramelessWindow"));
|
||||
#else
|
||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("FramelessWindow"),
|
||||
FRAMELESSHELPER_STRING_LITERAL("FramelessWindow is not available."));
|
||||
#endif
|
||||
|
||||
#if ((QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) && FRAMELESSHELPER_CONFIG(private_qt))
|
||||
# if FRAMELESSHELPER_CONFIG(window)
|
||||
qmlRegisterType<FramelessQuickApplicationWindow>(QUICK_URI_EXPAND("FramelessApplicationWindow"));
|
||||
# endif
|
||||
# if FRAMELESSHELPER_CONFIG(system_button)
|
||||
qmlRegisterType<QuickStandardSystemButton>(QUICK_URI_EXPAND("StandardSystemButton"));
|
||||
# endif
|
||||
# if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
qmlRegisterType<QuickStandardTitleBar>(QUICK_URI_EXPAND("StandardTitleBar"));
|
||||
# endif
|
||||
#else
|
||||
# if FRAMELESSHELPER_CONFIG(window)
|
||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("FramelessApplicationWindow"),
|
||||
FRAMELESSHELPER_STRING_LITERAL("FramelessApplicationWindow is not available."));
|
||||
# endif
|
||||
# if FRAMELESSHELPER_CONFIG(system_button)
|
||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("StandardSystemButton"),
|
||||
FRAMELESSHELPER_STRING_LITERAL("StandardSystemButton is not available."));
|
||||
# endif
|
||||
# if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("StandardTitleBar"),
|
||||
FRAMELESSHELPER_STRING_LITERAL("StandardTitleBar is not available."));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
qmlRegisterModule(QUICK_URI_FULL);
|
||||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -22,12 +22,15 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include "framelessquickapplicationwindow_p.h"
|
||||
#include "framelessquickapplicationwindow_p_p.h"
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||
|
||||
#include "framelessquickhelper.h"
|
||||
#include "quickwindowborder.h"
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
# include "quickwindowborder.h"
|
||||
#endif
|
||||
#ifdef Q_OS_WINDOWS
|
||||
# include <FramelessHelper/Core/framelesshelper_windows.h>
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
@ -36,18 +39,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickApplicationWindow, "wangwenx190.framelesshelper.quick.framelessquickapplicationwindow")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessQuickApplicationWindow)
|
||||
# define DEBUG qCDebug(lcFramelessQuickApplicationWindow)
|
||||
# define WARNING qCWarning(lcFramelessQuickApplicationWindow)
|
||||
# define CRITICAL qCCritical(lcFramelessQuickApplicationWindow)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -86,12 +88,14 @@ FramelessQuickApplicationWindow::FramelessQuickApplicationWindow(QWindow *parent
|
|||
{
|
||||
QQuickItem * const rootItem = contentItem();
|
||||
FramelessQuickHelper::get(rootItem)->extendsContentIntoTitleBar();
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
Q_D(FramelessQuickApplicationWindow);
|
||||
d->windowBorder = new QuickWindowBorder;
|
||||
d->windowBorder->setParent(rootItem);
|
||||
d->windowBorder->setParentItem(rootItem);
|
||||
d->windowBorder->setZ(999); // Make sure it always stays on the top.
|
||||
QQuickItemPrivate::get(d->windowBorder)->anchors()->setFill(rootItem);
|
||||
#endif
|
||||
connect(this, &FramelessQuickApplicationWindow::visibilityChanged, this, [this](){
|
||||
Q_EMIT hiddenChanged();
|
||||
Q_EMIT normalChanged();
|
||||
|
@ -179,4 +183,4 @@ void FramelessQuickApplicationWindow::componentComplete()
|
|||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -24,8 +24,12 @@
|
|||
|
||||
#include "framelessquickhelper.h"
|
||||
#include "framelessquickhelper_p.h"
|
||||
#include "quickmicamaterial.h"
|
||||
#include "quickwindowborder.h"
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
# include "quickmicamaterial.h"
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
# include "quickwindowborder.h"
|
||||
#endif
|
||||
#include <FramelessHelper/Core/framelessmanager.h>
|
||||
#include <FramelessHelper/Core/utils.h>
|
||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||
|
@ -38,14 +42,14 @@
|
|||
#include <QtCore/qloggingcategory.h>
|
||||
#include <QtGui/qcursor.h>
|
||||
#include <QtGui/qguiapplication.h>
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# include <QtGui/qpa/qplatformwindow.h> // For QWINDOWSIZE_MAX
|
||||
# else // (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
# include <QtGui/private/qwindow_p.h> // For QWINDOWSIZE_MAX
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# include <QtQuick/private/qquickitem_p.h>
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
||||
#ifndef QWINDOWSIZE_MAX
|
||||
# define QWINDOWSIZE_MAX ((1 << 24) - 1)
|
||||
|
@ -53,18 +57,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickHelper, "wangwenx190.framelesshelper.quick.framelessquickhelper")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessQuickHelper)
|
||||
# define DEBUG qCDebug(lcFramelessQuickHelper)
|
||||
# define WARNING qCWarning(lcFramelessQuickHelper)
|
||||
# define CRITICAL qCCritical(lcFramelessQuickHelper)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -265,6 +268,7 @@ QVariant FramelessQuickHelperPrivate::getProperty(const char *name, const QVaria
|
|||
return ((value.isValid() && !value.isNull()) ? value : defaultValue);
|
||||
}
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
QuickMicaMaterial *FramelessQuickHelperPrivate::findOrCreateMicaMaterial() const
|
||||
{
|
||||
Q_Q(const FramelessQuickHelper);
|
||||
|
@ -283,12 +287,14 @@ QuickMicaMaterial *FramelessQuickHelperPrivate::findOrCreateMicaMaterial() const
|
|||
item->setParent(rootItem);
|
||||
item->setParentItem(rootItem);
|
||||
item->setZ(-999); // Make sure it always stays on the bottom.
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
QQuickItemPrivate::get(item)->anchors()->setFill(rootItem);
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
return item;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
QuickWindowBorder *FramelessQuickHelperPrivate::findOrCreateWindowBorder() const
|
||||
{
|
||||
Q_Q(const FramelessQuickHelper);
|
||||
|
@ -307,11 +313,12 @@ QuickWindowBorder *FramelessQuickHelperPrivate::findOrCreateWindowBorder() const
|
|||
item->setParent(rootItem);
|
||||
item->setParentItem(rootItem);
|
||||
item->setZ(999); // Make sure it always stays on the top.
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
QQuickItemPrivate::get(item)->anchors()->setFill(rootItem);
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
return item;
|
||||
}
|
||||
#endif
|
||||
|
||||
FramelessQuickHelper *FramelessQuickHelperPrivate::findOrCreateFramelessHelper(QObject *object)
|
||||
{
|
||||
|
@ -634,17 +641,21 @@ FramelessQuickHelper *FramelessQuickHelper::qmlAttachedProperties(QObject *paren
|
|||
return get(parentObject);
|
||||
}
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
QuickMicaMaterial *FramelessQuickHelper::micaMaterial() const
|
||||
{
|
||||
Q_D(const FramelessQuickHelper);
|
||||
return d->findOrCreateMicaMaterial();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
QuickWindowBorder *FramelessQuickHelper::windowBorder() const
|
||||
{
|
||||
Q_D(const FramelessQuickHelper);
|
||||
return d->findOrCreateWindowBorder();
|
||||
}
|
||||
#endif
|
||||
|
||||
void FramelessQuickHelper::setHitTestVisible(QQuickItem *item, const bool visible)
|
||||
{
|
||||
|
@ -790,7 +801,7 @@ void FramelessQuickHelper::showSystemMenu(const QPoint &pos)
|
|||
#ifdef Q_OS_WINDOWS
|
||||
Q_D(FramelessQuickHelper);
|
||||
std::ignore = Utils::showSystemMenu(windowId, nativePos, false, &d->getWindowData()->params);
|
||||
#elif defined(Q_OS_LINUX)
|
||||
#elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
Utils::openSystemMenu(windowId, nativePos);
|
||||
#else
|
||||
Q_UNUSED(windowId);
|
||||
|
@ -932,7 +943,9 @@ void FramelessQuickHelper::setBlurBehindWindowEnabled(const bool value)
|
|||
}
|
||||
} else {
|
||||
d->blurBehindWindowEnabled = value;
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
micaMaterial()->setVisible(d->blurBehindWindowEnabled);
|
||||
#endif
|
||||
d->emitSignalForAllInstances("blurBehindWindowEnabledChanged");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,125 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "framelessquickmodule.h"
|
||||
#include "framelessquickhelper.h"
|
||||
#include "framelessquickutils.h"
|
||||
#include "quickchromepalette.h"
|
||||
#include "quickmicamaterial.h"
|
||||
#include "quickimageitem.h"
|
||||
#include "quickwindowborder.h"
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
# include "framelessquickwindow_p.h"
|
||||
# if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
# include "framelessquickapplicationwindow_p.h"
|
||||
# include "quickstandardsystembutton_p.h"
|
||||
# include "quickstandardtitlebar_p.h"
|
||||
# endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
||||
#ifndef QUICK_URI_SHORT
|
||||
# define QUICK_URI_SHORT FRAMELESSHELPER_QUICK_URI, FRAMELESSHELPER_QUICK_VERSION_MAJOR
|
||||
#endif
|
||||
|
||||
#ifndef QUICK_URI_FULL
|
||||
# define QUICK_URI_FULL QUICK_URI_SHORT, FRAMELESSHELPER_QUICK_VERSION_MINOR
|
||||
#endif
|
||||
|
||||
#ifndef QUICK_URI_EXPAND
|
||||
# define QUICK_URI_EXPAND(name) QUICK_URI_FULL, name
|
||||
#endif
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickModule, "wangwenx190.framelesshelper.quick.quickmodule")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcQuickModule)
|
||||
# define DEBUG qCDebug(lcQuickModule)
|
||||
# define WARNING qCWarning(lcQuickModule)
|
||||
# define CRITICAL qCCritical(lcQuickModule)
|
||||
#endif
|
||||
|
||||
void FramelessHelper::Quick::registerTypes(QQmlEngine *engine)
|
||||
{
|
||||
Q_ASSERT(engine);
|
||||
if (!engine) {
|
||||
return;
|
||||
}
|
||||
|
||||
// In most cases we don't need to register the QML types for multiple times.
|
||||
static bool reg = false;
|
||||
if (reg) {
|
||||
return;
|
||||
}
|
||||
reg = true;
|
||||
|
||||
// @uri org.wangwenx190.FramelessHelper
|
||||
qmlRegisterUncreatableType<QuickGlobal>(QUICK_URI_FULL, "FramelessHelperConstants",
|
||||
FRAMELESSHELPER_STRING_LITERAL("The FramelessHelperConstants namespace is not creatable, you can only use it to access it's enums."));
|
||||
|
||||
qmlRegisterSingletonType<FramelessQuickUtils>(QUICK_URI_EXPAND("FramelessUtils"),
|
||||
[](QQmlEngine *engine, QJSEngine *scriptEngine) -> QObject * {
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
return new FramelessQuickUtils;
|
||||
});
|
||||
|
||||
qmlRegisterAnonymousType<QuickChromePalette>(QUICK_URI_SHORT);
|
||||
|
||||
qmlRegisterType<FramelessQuickHelper>(QUICK_URI_EXPAND("FramelessHelper"));
|
||||
qmlRegisterType<QuickMicaMaterial>(QUICK_URI_EXPAND("MicaMaterial"));
|
||||
qmlRegisterType<QuickImageItem>(QUICK_URI_EXPAND("ImageItem"));
|
||||
qmlRegisterType<QuickWindowBorder>(QUICK_URI_EXPAND("WindowBorder"));
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("FramelessWindow"),
|
||||
FRAMELESSHELPER_STRING_LITERAL("FramelessWindow is not available."));
|
||||
#else // !FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
qmlRegisterType<FramelessQuickWindow>(QUICK_URI_EXPAND("FramelessWindow"));
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#if ((QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) && !defined(FRAMELESSHELPER_QUICK_NO_PRIVATE))
|
||||
qmlRegisterType<FramelessQuickApplicationWindow>(QUICK_URI_EXPAND("FramelessApplicationWindow"));
|
||||
qmlRegisterType<QuickStandardSystemButton>(QUICK_URI_EXPAND("StandardSystemButton"));
|
||||
qmlRegisterType<QuickStandardTitleBar>(QUICK_URI_EXPAND("StandardTitleBar"));
|
||||
#else // ((QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) || FRAMELESSHELPER_QUICK_NO_PRIVATE)
|
||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("FramelessApplicationWindow"),
|
||||
FRAMELESSHELPER_STRING_LITERAL("FramelessApplicationWindow is not available."));
|
||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("StandardSystemButton"),
|
||||
FRAMELESSHELPER_STRING_LITERAL("StandardSystemButton is not available."));
|
||||
qmlRegisterTypeNotAvailable(QUICK_URI_EXPAND("StandardTitleBar"),
|
||||
FRAMELESSHELPER_STRING_LITERAL("StandardTitleBar is not available."));
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
qmlRegisterModule(QUICK_URI_FULL);
|
||||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
|
@ -32,18 +32,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickUtils, "wangwenx190.framelesshelper.quick.framelessquickutils")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessQuickUtils)
|
||||
# define DEBUG qCDebug(lcFramelessQuickUtils)
|
||||
# define WARNING qCWarning(lcFramelessQuickUtils)
|
||||
# define CRITICAL qCCritical(lcFramelessQuickUtils)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
|
|
@ -22,12 +22,15 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include "framelessquickwindow_p.h"
|
||||
#include "framelessquickwindow_p_p.h"
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(window))
|
||||
|
||||
#include "framelessquickhelper.h"
|
||||
#include "quickwindowborder.h"
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
# include "quickwindowborder.h"
|
||||
#endif
|
||||
#ifdef Q_OS_WINDOWS
|
||||
# include <FramelessHelper/Core/framelesshelper_windows.h>
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
@ -36,18 +39,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessQuickWindow, "wangwenx190.framelesshelper.quick.framelessquickwindow")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessQuickWindow)
|
||||
# define DEBUG qCDebug(lcFramelessQuickWindow)
|
||||
# define WARNING qCWarning(lcFramelessQuickWindow)
|
||||
# define CRITICAL qCCritical(lcFramelessQuickWindow)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -86,12 +88,14 @@ FramelessQuickWindow::FramelessQuickWindow(QWindow *parent)
|
|||
{
|
||||
QQuickItem * const rootItem = contentItem();
|
||||
FramelessQuickHelper::get(rootItem)->extendsContentIntoTitleBar();
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
Q_D(FramelessQuickWindow);
|
||||
d->windowBorder = new QuickWindowBorder;
|
||||
d->windowBorder->setParent(rootItem);
|
||||
d->windowBorder->setParentItem(rootItem);
|
||||
d->windowBorder->setZ(999); // Make sure it always stays on the top.
|
||||
QQuickItemPrivate::get(d->windowBorder)->anchors()->setFill(rootItem);
|
||||
#endif
|
||||
connect(this, &FramelessQuickWindow::visibilityChanged, this, [this](){
|
||||
Q_EMIT hiddenChanged();
|
||||
Q_EMIT normalChanged();
|
||||
|
@ -179,4 +183,4 @@ void FramelessQuickWindow::componentComplete()
|
|||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -23,22 +23,24 @@
|
|||
*/
|
||||
|
||||
#include "quickchromepalette.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickChromePalette, "wangwenx190.framelesshelper.quick.quickchromepalette")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcQuickChromePalette)
|
||||
# define DEBUG qCDebug(lcQuickChromePalette)
|
||||
# define WARNING qCWarning(lcQuickChromePalette)
|
||||
# define CRITICAL qCCritical(lcQuickChromePalette)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
QuickChromePalette::QuickChromePalette(QObject *parent) : ChromePalette(parent)
|
||||
|
@ -56,3 +58,5 @@ void QuickChromePalette::componentComplete()
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "quickimageitem.h"
|
||||
#include "quickimageitem_p.h"
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
#include <QtGui/qpainter.h>
|
||||
|
@ -32,18 +31,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickImageItem, "wangwenx190.framelesshelper.quick.quickimageitem")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcQuickImageItem)
|
||||
# define DEBUG qCDebug(lcQuickImageItem)
|
||||
# define WARNING qCWarning(lcQuickImageItem)
|
||||
# define CRITICAL qCCritical(lcQuickImageItem)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -53,36 +51,72 @@ FRAMELESSHELPER_STRING_CONSTANT2(FileSystemPrefix, ":")
|
|||
FRAMELESSHELPER_STRING_CONSTANT2(UrlPrefix, ":///")
|
||||
FRAMELESSHELPER_STRING_CONSTANT2(FilePathPrefix, ":/")
|
||||
|
||||
QuickImageItemPrivate::QuickImageItemPrivate(QuickImageItem *q) : QObject(q)
|
||||
QuickImageItem::QuickImageItem(QQuickItem *parent) : QQuickPaintedItem(parent)
|
||||
{
|
||||
Q_ASSERT(q);
|
||||
if (!q) {
|
||||
setAntialiasing(true);
|
||||
setSmooth(true);
|
||||
setMipmap(true);
|
||||
setClip(true);
|
||||
}
|
||||
|
||||
QuickImageItem::~QuickImageItem() = default;
|
||||
|
||||
void QuickImageItem::paint(QPainter *painter)
|
||||
{
|
||||
Q_ASSERT(painter);
|
||||
if (!painter) {
|
||||
return;
|
||||
}
|
||||
q_ptr = q;
|
||||
}
|
||||
|
||||
QuickImageItemPrivate::~QuickImageItemPrivate() = default;
|
||||
|
||||
QuickImageItemPrivate *QuickImageItemPrivate::get(QuickImageItem *q)
|
||||
{
|
||||
Q_ASSERT(q);
|
||||
if (!q) {
|
||||
return nullptr;
|
||||
if (!m_source.isValid() || m_source.isNull()) {
|
||||
return;
|
||||
}
|
||||
return q->d_func();
|
||||
}
|
||||
|
||||
const QuickImageItemPrivate *QuickImageItemPrivate::get(const QuickImageItem *q)
|
||||
{
|
||||
Q_ASSERT(q);
|
||||
if (!q) {
|
||||
return nullptr;
|
||||
painter->save();
|
||||
painter->setRenderHints(QPainter::Antialiasing |
|
||||
QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
|
||||
switch (m_source.userType()) {
|
||||
case QMetaType::QUrl:
|
||||
fromUrl(m_source.toUrl(), painter);
|
||||
break;
|
||||
case QMetaType::QString:
|
||||
fromString(m_source.toString(), painter);
|
||||
break;
|
||||
case QMetaType::QImage:
|
||||
fromImage(qvariant_cast<QImage>(m_source), painter);
|
||||
break;
|
||||
case QMetaType::QPixmap:
|
||||
fromPixmap(qvariant_cast<QPixmap>(m_source), painter);
|
||||
break;
|
||||
case QMetaType::QIcon:
|
||||
fromIcon(qvariant_cast<QIcon>(m_source), painter);
|
||||
break;
|
||||
default:
|
||||
WARNING << "Unsupported type:" << m_source.typeName();
|
||||
break;
|
||||
}
|
||||
return q->d_func();
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
void QuickImageItemPrivate::fromUrl(const QUrl &value, QPainter *painter) const
|
||||
QVariant QuickImageItem::source() const
|
||||
{
|
||||
return m_source;
|
||||
}
|
||||
|
||||
void QuickImageItem::setSource(const QVariant &value)
|
||||
{
|
||||
Q_ASSERT(value.isValid());
|
||||
Q_ASSERT(!value.isNull());
|
||||
if (!value.isValid() || value.isNull()) {
|
||||
return;
|
||||
}
|
||||
if (m_source == value) {
|
||||
return;
|
||||
}
|
||||
m_source = value;
|
||||
update();
|
||||
Q_EMIT sourceChanged();
|
||||
}
|
||||
|
||||
void QuickImageItem::fromUrl(const QUrl &value, QPainter *painter) const
|
||||
{
|
||||
Q_ASSERT(value.isValid());
|
||||
Q_ASSERT(painter);
|
||||
|
@ -92,7 +126,7 @@ void QuickImageItemPrivate::fromUrl(const QUrl &value, QPainter *painter) const
|
|||
fromString((value.isLocalFile() ? value.toLocalFile() : value.toString()), painter);
|
||||
}
|
||||
|
||||
void QuickImageItemPrivate::fromString(const QString &value, QPainter *painter) const
|
||||
void QuickImageItem::fromString(const QString &value, QPainter *painter) const
|
||||
{
|
||||
Q_ASSERT(!value.isEmpty());
|
||||
Q_ASSERT(painter);
|
||||
|
@ -114,7 +148,7 @@ void QuickImageItemPrivate::fromString(const QString &value, QPainter *painter)
|
|||
}()), painter);
|
||||
}
|
||||
|
||||
void QuickImageItemPrivate::fromImage(const QImage &value, QPainter *painter) const
|
||||
void QuickImageItem::fromImage(const QImage &value, QPainter *painter) const
|
||||
{
|
||||
Q_ASSERT(!value.isNull());
|
||||
Q_ASSERT(painter);
|
||||
|
@ -124,7 +158,7 @@ void QuickImageItemPrivate::fromImage(const QImage &value, QPainter *painter) co
|
|||
fromPixmap(QPixmap::fromImage(value), painter);
|
||||
}
|
||||
|
||||
void QuickImageItemPrivate::fromPixmap(const QPixmap &value, QPainter *painter) const
|
||||
void QuickImageItem::fromPixmap(const QPixmap &value, QPainter *painter) const
|
||||
{
|
||||
Q_ASSERT(!value.isNull());
|
||||
Q_ASSERT(painter);
|
||||
|
@ -136,7 +170,7 @@ void QuickImageItemPrivate::fromPixmap(const QPixmap &value, QPainter *painter)
|
|||
painter->drawPixmap(paintRect.topLeft(), (value.size() == paintSize ? value : value.scaled(paintSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)));
|
||||
}
|
||||
|
||||
void QuickImageItemPrivate::fromIcon(const QIcon &value, QPainter *painter) const
|
||||
void QuickImageItem::fromIcon(const QIcon &value, QPainter *painter) const
|
||||
{
|
||||
Q_ASSERT(!value.isNull());
|
||||
Q_ASSERT(painter);
|
||||
|
@ -146,84 +180,14 @@ void QuickImageItemPrivate::fromIcon(const QIcon &value, QPainter *painter) cons
|
|||
fromPixmap(value.pixmap(paintArea().size().toSize()), painter);
|
||||
}
|
||||
|
||||
QRectF QuickImageItemPrivate::paintArea() const
|
||||
QRectF QuickImageItem::paintArea() const
|
||||
{
|
||||
Q_Q(const QuickImageItem);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
|
||||
const QSizeF size = q->size();
|
||||
const QSizeF s = size();
|
||||
#else
|
||||
const QSizeF size = {q->width(), q->height()};
|
||||
const QSizeF s = {width(), height()};
|
||||
#endif
|
||||
return {QPointF(0, 0), size};
|
||||
}
|
||||
|
||||
QuickImageItem::QuickImageItem(QQuickItem *parent)
|
||||
: QQuickPaintedItem(parent), d_ptr(new QuickImageItemPrivate(this))
|
||||
{
|
||||
setAntialiasing(true);
|
||||
setSmooth(true);
|
||||
setMipmap(true);
|
||||
setClip(true);
|
||||
}
|
||||
|
||||
QuickImageItem::~QuickImageItem() = default;
|
||||
|
||||
void QuickImageItem::paint(QPainter *painter)
|
||||
{
|
||||
Q_ASSERT(painter);
|
||||
if (!painter) {
|
||||
return;
|
||||
}
|
||||
Q_D(QuickImageItem);
|
||||
if (!d->source.isValid() || d->source.isNull()) {
|
||||
return;
|
||||
}
|
||||
painter->save();
|
||||
painter->setRenderHints(QPainter::Antialiasing |
|
||||
QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
|
||||
switch (d->source.userType()) {
|
||||
case QMetaType::QUrl:
|
||||
d->fromUrl(d->source.toUrl(), painter);
|
||||
break;
|
||||
case QMetaType::QString:
|
||||
d->fromString(d->source.toString(), painter);
|
||||
break;
|
||||
case QMetaType::QImage:
|
||||
d->fromImage(qvariant_cast<QImage>(d->source), painter);
|
||||
break;
|
||||
case QMetaType::QPixmap:
|
||||
d->fromPixmap(qvariant_cast<QPixmap>(d->source), painter);
|
||||
break;
|
||||
case QMetaType::QIcon:
|
||||
d->fromIcon(qvariant_cast<QIcon>(d->source), painter);
|
||||
break;
|
||||
default:
|
||||
WARNING << "Unsupported type:" << d->source.typeName();
|
||||
break;
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QVariant QuickImageItem::source() const
|
||||
{
|
||||
Q_D(const QuickImageItem);
|
||||
return d->source;
|
||||
}
|
||||
|
||||
void QuickImageItem::setSource(const QVariant &value)
|
||||
{
|
||||
Q_ASSERT(value.isValid());
|
||||
Q_ASSERT(!value.isNull());
|
||||
if (!value.isValid() || value.isNull()) {
|
||||
return;
|
||||
}
|
||||
Q_D(QuickImageItem);
|
||||
if (d->source == value) {
|
||||
return;
|
||||
}
|
||||
d->source = value;
|
||||
update();
|
||||
Q_EMIT sourceChanged();
|
||||
return {QPointF(0, 0), s};
|
||||
}
|
||||
|
||||
void QuickImageItem::classBegin()
|
||||
|
|
|
@ -24,28 +24,30 @@
|
|||
|
||||
#include "quickmicamaterial.h"
|
||||
#include "quickmicamaterial_p.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
|
||||
#include <FramelessHelper/Core/micamaterial.h>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
#include <QtQuick/qquickwindow.h>
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# include <QtQuick/private/qquickitem_p.h>
|
||||
# include <QtQuick/private/qquickanchors_p.h>
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickMicaMaterial, "wangwenx190.framelesshelper.quick.quickmicamaterial")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcQuickMicaMaterial)
|
||||
# define DEBUG qCDebug(lcQuickMicaMaterial)
|
||||
# define WARNING qCWarning(lcQuickMicaMaterial)
|
||||
# define CRITICAL qCCritical(lcQuickMicaMaterial)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -121,7 +123,7 @@ void QuickMicaMaterialPrivate::rebindWindow()
|
|||
QQuickItem * const rootItem = window->contentItem();
|
||||
q->setParent(rootItem);
|
||||
q->setParentItem(rootItem);
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
QQuickItemPrivate::get(q)->anchors()->setFill(rootItem);
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
q->setZ(-999); // Make sure we always stays on the bottom most place.
|
||||
|
@ -255,3 +257,5 @@ void QuickMicaMaterial::componentComplete()
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,10 +22,10 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include "quickstandardsystembutton_p.h"
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(system_button) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||
|
||||
#include <FramelessHelper/Core/private/framelessmanager_p.h>
|
||||
#include <FramelessHelper/Core/utils.h>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
@ -38,18 +38,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickStandardSystemButton, "wangwenx190.framelesshelper.quick.quickstandardsystembutton")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcQuickStandardSystemButton)
|
||||
# define DEBUG qCDebug(lcQuickStandardSystemButton)
|
||||
# define WARNING qCWarning(lcQuickStandardSystemButton)
|
||||
# define CRITICAL qCCritical(lcQuickStandardSystemButton)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -101,7 +100,7 @@ QColor QuickStandardSystemButton::inactiveForegroundColor() const
|
|||
return m_inactiveForegroundColor;
|
||||
}
|
||||
|
||||
qreal QuickStandardSystemButton::iconSize() const
|
||||
qreal QuickStandardSystemButton::glyphSize() const
|
||||
{
|
||||
if (!m_contentItem) {
|
||||
return -1;
|
||||
|
@ -217,19 +216,19 @@ void QuickStandardSystemButton::setInactiveForegroundColor(const QColor &value)
|
|||
Q_EMIT inactiveForegroundColorChanged();
|
||||
}
|
||||
|
||||
void QuickStandardSystemButton::setIconSize(const qreal value)
|
||||
void QuickStandardSystemButton::setGlyphSize(const qreal value)
|
||||
{
|
||||
Q_ASSERT(value > 0);
|
||||
if (qFuzzyIsNull(value) || (value < 0)) {
|
||||
return;
|
||||
}
|
||||
if (qFuzzyCompare(iconSize(), value)) {
|
||||
if (qFuzzyCompare(glyphSize(), value)) {
|
||||
return;
|
||||
}
|
||||
QFont font = m_contentItem->font();
|
||||
font.setPointSizeF(value);
|
||||
m_contentItem->setFont(font);
|
||||
Q_EMIT iconSizeChanged();
|
||||
Q_EMIT glyphSizeChanged();
|
||||
}
|
||||
|
||||
void QuickStandardSystemButton::updateColor()
|
||||
|
@ -302,6 +301,5 @@ void QuickStandardSystemButton::componentComplete()
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -22,14 +22,19 @@
|
|||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
|
||||
#include "quickstandardtitlebar_p.h"
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
#include "quickimageitem.h"
|
||||
|
||||
#if (FRAMELESSHELPER_CONFIG(private_qt) && FRAMELESSHELPER_CONFIG(titlebar) && (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)))
|
||||
|
||||
#include "quickimageitem_p.h"
|
||||
#include "framelessquickhelper.h"
|
||||
#include "quickstandardsystembutton_p.h"
|
||||
#include "framelessquickwindow_p.h"
|
||||
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||
# include "quickstandardsystembutton_p.h"
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
# include "framelessquickwindow_p.h"
|
||||
# include "framelessquickapplicationwindow_p.h"
|
||||
#endif
|
||||
#include <QtCore/qtimer.h>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
#include <QtGui/qevent.h>
|
||||
|
@ -41,18 +46,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickStandardTitleBar, "wangwenx190.framelesshelper.quick.quickstandardtitlebar")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcQuickStandardTitleBar)
|
||||
# define DEBUG qCDebug(lcQuickStandardTitleBar)
|
||||
# define WARNING qCWarning(lcQuickStandardTitleBar)
|
||||
# define CRITICAL qCCritical(lcQuickStandardTitleBar)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -120,7 +124,7 @@ QQuickLabel *QuickStandardTitleBar::titleLabel() const
|
|||
return m_windowTitleLabel;
|
||||
}
|
||||
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
QuickStandardSystemButton *QuickStandardTitleBar::minimizeButton() const
|
||||
{
|
||||
return m_minimizeButton;
|
||||
|
@ -135,7 +139,7 @@ QuickStandardSystemButton *QuickStandardTitleBar::closeButton() const
|
|||
{
|
||||
return m_closeButton;
|
||||
}
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
|
||||
bool QuickStandardTitleBar::isExtended() const
|
||||
{
|
||||
|
@ -240,7 +244,7 @@ void QuickStandardTitleBar::setWindowIcon(const QVariant &value)
|
|||
|
||||
void QuickStandardTitleBar::updateMaximizeButton()
|
||||
{
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
const QQuickWindow * const w = window();
|
||||
if (!w) {
|
||||
return;
|
||||
|
@ -248,7 +252,7 @@ void QuickStandardTitleBar::updateMaximizeButton()
|
|||
const bool max = (w->visibility() == QQuickWindow::Maximized);
|
||||
m_maximizeButton->setButtonType(max ? QuickGlobal::SystemButtonType::Restore : QuickGlobal::SystemButtonType::Maximize);
|
||||
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_maximizeButton))->setText(max ? tr("Restore") : tr("Maximize"));
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
}
|
||||
|
||||
void QuickStandardTitleBar::updateTitleLabelText()
|
||||
|
@ -279,7 +283,7 @@ void QuickStandardTitleBar::updateTitleBarColor()
|
|||
|
||||
void QuickStandardTitleBar::updateChromeButtonColor()
|
||||
{
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
const QQuickWindow * const w = window();
|
||||
if (!w) {
|
||||
return;
|
||||
|
@ -307,7 +311,7 @@ void QuickStandardTitleBar::updateChromeButtonColor()
|
|||
m_closeButton->setHoverColor(m_chromePalette->closeButtonHoverColor());
|
||||
m_closeButton->setPressColor(m_chromePalette->closeButtonPressColor());
|
||||
m_closeButton->updateColor();
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
}
|
||||
|
||||
void QuickStandardTitleBar::clickMinimizeButton()
|
||||
|
@ -316,9 +320,14 @@ void QuickStandardTitleBar::clickMinimizeButton()
|
|||
if (!w) {
|
||||
return;
|
||||
}
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
if (const auto _w = qobject_cast<FramelessQuickWindow *>(w)) {
|
||||
_w->showMinimized2();
|
||||
} else {
|
||||
} else if (const auto _w2 = qobject_cast<FramelessQuickApplicationWindow *>(w)) {
|
||||
_w2->showMinimized2();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
w->setVisibility(QQuickWindow::Minimized);
|
||||
}
|
||||
}
|
||||
|
@ -351,7 +360,7 @@ void QuickStandardTitleBar::clickCloseButton()
|
|||
|
||||
void QuickStandardTitleBar::retranslateUi()
|
||||
{
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_minimizeButton))->setText(tr("Minimize"));
|
||||
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_maximizeButton))->setText([this]() -> QString {
|
||||
if (const QQuickWindow * const w = window()) {
|
||||
|
@ -362,7 +371,7 @@ void QuickStandardTitleBar::retranslateUi()
|
|||
return tr("Maximize");
|
||||
}());
|
||||
qobject_cast<QQuickToolTipAttached *>(qmlAttachedPropertiesObject<QQuickToolTip>(m_closeButton))->setText(tr("Close"));
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
}
|
||||
|
||||
void QuickStandardTitleBar::updateWindowIcon()
|
||||
|
@ -516,7 +525,7 @@ void QuickStandardTitleBar::initialize()
|
|||
connect(m_windowIcon, &QuickImageItem::widthChanged, this, &QuickStandardTitleBar::windowIconSizeChanged);
|
||||
connect(m_windowIcon, &QuickImageItem::heightChanged, this, &QuickStandardTitleBar::windowIconSizeChanged);
|
||||
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
m_systemButtonsRow = new QQuickRow(this);
|
||||
QQuickAnchors * const rowAnchors = QQuickItemPrivate::get(m_systemButtonsRow)->anchors();
|
||||
rowAnchors->setTop(thisPriv->top());
|
||||
|
@ -527,7 +536,7 @@ void QuickStandardTitleBar::initialize()
|
|||
connect(m_maximizeButton, &QuickStandardSystemButton::clicked, this, &QuickStandardTitleBar::clickMaximizeButton);
|
||||
m_closeButton = new QuickStandardSystemButton(QuickGlobal::SystemButtonType::Close, m_systemButtonsRow);
|
||||
connect(m_closeButton, &QuickStandardSystemButton::clicked, this, &QuickStandardTitleBar::clickCloseButton);
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
|
||||
setWindowIconSize(kDefaultWindowIconSize);
|
||||
setWindowIconVisible(false);
|
||||
|
@ -619,6 +628,5 @@ void QuickStandardTitleBar::componentComplete()
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
#endif // (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
|
|
@ -24,27 +24,29 @@
|
|||
|
||||
#include "quickwindowborder.h"
|
||||
#include "quickwindowborder_p.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
|
||||
#include <FramelessHelper/Core/windowborderpainter.h>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
#include <QtQuick/qquickwindow.h>
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
# include <QtQuick/private/qquickitem_p.h>
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcQuickWindowBorder, "wangwenx190.framelesshelper.quick.quickwindowborder")
|
||||
|
||||
#ifdef FRAMELESSHELPER_QUICK_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcQuickWindowBorder)
|
||||
# define DEBUG qCDebug(lcQuickWindowBorder)
|
||||
# define WARNING qCWarning(lcQuickWindowBorder)
|
||||
# define CRITICAL qCCritical(lcQuickWindowBorder)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -159,9 +161,9 @@ void QuickWindowBorderPrivate::rebindWindow()
|
|||
QQuickItem * const rootItem = window->contentItem();
|
||||
q->setParent(rootItem);
|
||||
q->setParentItem(rootItem);
|
||||
#ifndef FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#if FRAMELESSHELPER_CONFIG(private_qt)
|
||||
QQuickItemPrivate::get(q)->anchors()->setFill(rootItem);
|
||||
#endif // FRAMELESSHELPER_QUICK_NO_PRIVATE
|
||||
#endif
|
||||
q->setZ(999); // Make sure we always stays on the top most place.
|
||||
if (activeChangeConnection) {
|
||||
disconnect(activeChangeConnection);
|
||||
|
@ -202,59 +204,54 @@ void QuickWindowBorder::paint(QPainter *painter)
|
|||
qreal QuickWindowBorder::thickness() const
|
||||
{
|
||||
Q_D(const QuickWindowBorder);
|
||||
return ((d->borderPainter == nullptr) ? 0 : d->borderPainter->thickness());
|
||||
return d->borderPainter->thickness();
|
||||
}
|
||||
|
||||
QuickGlobal::WindowEdges QuickWindowBorder::edges() const
|
||||
{
|
||||
Q_D(const QuickWindowBorder);
|
||||
return ((d->borderPainter == nullptr) ? QuickGlobal::WindowEdges()
|
||||
: edgesToQuickEdges(d->borderPainter->edges()));
|
||||
return edgesToQuickEdges(d->borderPainter->edges());
|
||||
}
|
||||
|
||||
QColor QuickWindowBorder::activeColor() const
|
||||
{
|
||||
Q_D(const QuickWindowBorder);
|
||||
return ((d->borderPainter == nullptr) ? QColor() : d->borderPainter->activeColor());
|
||||
return d->borderPainter->activeColor();
|
||||
}
|
||||
|
||||
QColor QuickWindowBorder::inactiveColor() const
|
||||
{
|
||||
Q_D(const QuickWindowBorder);
|
||||
return ((d->borderPainter == nullptr) ? QColor() : d->borderPainter->inactiveColor());
|
||||
return d->borderPainter->inactiveColor();
|
||||
}
|
||||
|
||||
qreal QuickWindowBorder::nativeThickness() const
|
||||
{
|
||||
Q_D(const QuickWindowBorder);
|
||||
return ((d->borderPainter == nullptr) ? 0 : d->borderPainter->nativeThickness());
|
||||
return d->borderPainter->nativeThickness();
|
||||
}
|
||||
|
||||
QuickGlobal::WindowEdges QuickWindowBorder::nativeEdges() const
|
||||
{
|
||||
Q_D(const QuickWindowBorder);
|
||||
return ((d->borderPainter == nullptr) ? QuickGlobal::WindowEdges()
|
||||
: edgesToQuickEdges(d->borderPainter->nativeEdges()));
|
||||
return edgesToQuickEdges(d->borderPainter->nativeEdges());
|
||||
}
|
||||
|
||||
QColor QuickWindowBorder::nativeActiveColor() const
|
||||
{
|
||||
Q_D(const QuickWindowBorder);
|
||||
return ((d->borderPainter == nullptr) ? QColor() : d->borderPainter->nativeActiveColor());
|
||||
return d->borderPainter->nativeActiveColor();
|
||||
}
|
||||
|
||||
QColor QuickWindowBorder::nativeInactiveColor() const
|
||||
{
|
||||
Q_D(const QuickWindowBorder);
|
||||
return ((d->borderPainter == nullptr) ? QColor() : d->borderPainter->nativeInactiveColor());
|
||||
return d->borderPainter->nativeInactiveColor();
|
||||
}
|
||||
|
||||
void QuickWindowBorder::setThickness(const qreal value)
|
||||
{
|
||||
Q_D(QuickWindowBorder);
|
||||
if (!d->borderPainter) {
|
||||
return;
|
||||
}
|
||||
if (qFuzzyCompare(thickness(), value)) {
|
||||
return;
|
||||
}
|
||||
|
@ -264,9 +261,6 @@ void QuickWindowBorder::setThickness(const qreal value)
|
|||
void QuickWindowBorder::setEdges(const QuickGlobal::WindowEdges value)
|
||||
{
|
||||
Q_D(QuickWindowBorder);
|
||||
if (!d->borderPainter) {
|
||||
return;
|
||||
}
|
||||
if (edges() == value) {
|
||||
return;
|
||||
}
|
||||
|
@ -276,9 +270,6 @@ void QuickWindowBorder::setEdges(const QuickGlobal::WindowEdges value)
|
|||
void QuickWindowBorder::setActiveColor(const QColor &value)
|
||||
{
|
||||
Q_D(QuickWindowBorder);
|
||||
if (!d->borderPainter) {
|
||||
return;
|
||||
}
|
||||
if (activeColor() == value) {
|
||||
return;
|
||||
}
|
||||
|
@ -288,9 +279,6 @@ void QuickWindowBorder::setActiveColor(const QColor &value)
|
|||
void QuickWindowBorder::setInactiveColor(const QColor &value)
|
||||
{
|
||||
Q_D(QuickWindowBorder);
|
||||
if (!d->borderPainter) {
|
||||
return;
|
||||
}
|
||||
if (inactiveColor() == value) {
|
||||
return;
|
||||
}
|
||||
|
@ -317,3 +305,5 @@ void QuickWindowBorder::componentComplete()
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -35,45 +35,62 @@ set(INCLUDE_PREFIX ../../include/${SUB_MODULE_PATH})
|
|||
|
||||
set(PUBLIC_HEADERS
|
||||
${INCLUDE_PREFIX}/framelesshelperwidgets_global.h
|
||||
${INCLUDE_PREFIX}/framelesswidget.h
|
||||
${INCLUDE_PREFIX}/framelessmainwindow.h
|
||||
${INCLUDE_PREFIX}/standardsystembutton.h
|
||||
${INCLUDE_PREFIX}/framelesswidgetshelper.h
|
||||
${INCLUDE_PREFIX}/standardtitlebar.h
|
||||
${INCLUDE_PREFIX}/framelessdialog.h
|
||||
)
|
||||
|
||||
set(PUBLIC_HEADERS_ALIAS
|
||||
${INCLUDE_PREFIX}/Global
|
||||
${INCLUDE_PREFIX}/FramelessWidget
|
||||
${INCLUDE_PREFIX}/FramelessMainWindow
|
||||
${INCLUDE_PREFIX}/StandardSystemButton
|
||||
${INCLUDE_PREFIX}/FramelessWidgetsHelper
|
||||
${INCLUDE_PREFIX}/StandardTitleBar
|
||||
${INCLUDE_PREFIX}/FramelessDialog
|
||||
)
|
||||
|
||||
set(PRIVATE_HEADERS
|
||||
${INCLUDE_PREFIX}/private/framelesswidgetshelper_p.h
|
||||
${INCLUDE_PREFIX}/private/standardsystembutton_p.h
|
||||
${INCLUDE_PREFIX}/private/standardtitlebar_p.h
|
||||
${INCLUDE_PREFIX}/private/framelesswidget_p.h
|
||||
${INCLUDE_PREFIX}/private/framelessmainwindow_p.h
|
||||
${INCLUDE_PREFIX}/private/widgetssharedhelper_p.h
|
||||
${INCLUDE_PREFIX}/private/framelessdialog_p.h
|
||||
)
|
||||
|
||||
set(SOURCES
|
||||
framelessmainwindow.cpp
|
||||
framelesswidgetshelper.cpp
|
||||
framelesswidget.cpp
|
||||
standardsystembutton.cpp
|
||||
standardtitlebar.cpp
|
||||
widgetssharedhelper.cpp
|
||||
framelesshelperwidgets_global.cpp
|
||||
framelessdialog.cpp
|
||||
)
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_SYSTEM_BUTTON)
|
||||
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/standardsystembutton.h)
|
||||
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/StandardSystemButton)
|
||||
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/standardsystembutton_p.h)
|
||||
list(APPEND SOURCES standardsystembutton.cpp)
|
||||
endif()
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_TITLEBAR)
|
||||
list(APPEND PUBLIC_HEADERS ${INCLUDE_PREFIX}/standardtitlebar.h)
|
||||
list(APPEND PUBLIC_HEADERS_ALIAS ${INCLUDE_PREFIX}/StandardTitleBar)
|
||||
list(APPEND PRIVATE_HEADERS ${INCLUDE_PREFIX}/private/standardtitlebar_p.h)
|
||||
list(APPEND SOURCES standardtitlebar.cpp)
|
||||
endif()
|
||||
|
||||
if(NOT FRAMELESSHELPER_NO_WINDOW)
|
||||
list(APPEND PUBLIC_HEADERS
|
||||
${INCLUDE_PREFIX}/framelessdialog.h
|
||||
${INCLUDE_PREFIX}/framelesswidget.h
|
||||
${INCLUDE_PREFIX}/framelessmainwindow.h
|
||||
)
|
||||
list(APPEND PUBLIC_HEADERS_ALIAS
|
||||
${INCLUDE_PREFIX}/FramelessDialog
|
||||
${INCLUDE_PREFIX}/FramelessWidget
|
||||
${INCLUDE_PREFIX}/FramelessMainWindow
|
||||
)
|
||||
list(APPEND PRIVATE_HEADERS
|
||||
${INCLUDE_PREFIX}/private/framelessdialog_p.h
|
||||
${INCLUDE_PREFIX}/private/framelesswidget_p.h
|
||||
${INCLUDE_PREFIX}/private/framelessmainwindow_p.h
|
||||
)
|
||||
list(APPEND SOURCES
|
||||
framelessdialog.cpp
|
||||
framelesswidget.cpp
|
||||
framelessmainwindow.cpp
|
||||
)
|
||||
endif()
|
||||
|
||||
if(WIN32 AND NOT FRAMELESSHELPER_BUILD_STATIC)
|
||||
set(__rc_path "${CMAKE_CURRENT_BINARY_DIR}/${SUB_MODULE_FULL_NAME}.rc")
|
||||
if(NOT EXISTS "${__rc_path}")
|
||||
|
@ -106,33 +123,9 @@ add_library(${PROJECT_NAME}::${SUB_MODULE_FULL_NAME} ALIAS ${SUB_MODULE_TARGET})
|
|||
set_target_properties(${SUB_MODULE_TARGET} PROPERTIES
|
||||
VERSION "${PROJECT_VERSION}"
|
||||
SOVERSION "${PROJECT_VERSION_MAJOR}"
|
||||
OUTPUT_NAME "${SUB_MODULE_TARGET}${FRAMELESSHELPER_64BIT_POSTFIX}"
|
||||
)
|
||||
|
||||
if(FRAMELESSHELPER_BUILD_STATIC)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_WIDGETS_STATIC)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_NO_DEBUG_OUTPUT)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
||||
FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_NO_BUNDLE_RESOURCE)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_WIDGETS_NO_BUNDLE_RESOURCE)
|
||||
endif()
|
||||
|
||||
if(FRAMELESSHELPER_NO_PRIVATE)
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_WIDGETS_NO_PRIVATE)
|
||||
endif()
|
||||
|
||||
if(DEFINED FRAMELESSHELPER_NAMESPACE)
|
||||
if("x${FRAMELESSHELPER_NAMESPACE}" STREQUAL "x")
|
||||
message(FATAL_ERROR "FRAMELESSHELPER_NAMESPACE can't be empty!")
|
||||
endif()
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PUBLIC FRAMELESSHELPER_NAMESPACE=${FRAMELESSHELPER_NAMESPACE})
|
||||
endif()
|
||||
|
||||
target_compile_definitions(${SUB_MODULE_TARGET} PRIVATE
|
||||
FRAMELESSHELPER_WIDGETS_LIBRARY
|
||||
)
|
||||
|
@ -141,7 +134,7 @@ target_link_libraries(${SUB_MODULE_TARGET} PRIVATE
|
|||
Qt${QT_VERSION_MAJOR}::Widgets
|
||||
)
|
||||
|
||||
target_link_libraries(${SUB_MODULE_TARGET} PUBLIC
|
||||
target_link_libraries(${SUB_MODULE_TARGET} PRIVATE
|
||||
${PROJECT_NAME}::Core
|
||||
)
|
||||
|
||||
|
|
|
@ -24,24 +24,26 @@
|
|||
|
||||
#include "framelessdialog.h"
|
||||
#include "framelessdialog_p.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
|
||||
#include "framelesswidgetshelper.h"
|
||||
#include "widgetssharedhelper_p.h"
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessDialog, "wangwenx190.framelesshelper.widgets.framelessdialog")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessDialog)
|
||||
# define DEBUG qCDebug(lcFramelessDialog)
|
||||
# define WARNING qCWarning(lcFramelessDialog)
|
||||
# define CRITICAL qCCritical(lcFramelessDialog)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -87,3 +89,5 @@ FramelessDialog::FramelessDialog(QWidget *parent)
|
|||
FramelessDialog::~FramelessDialog() = default;
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,24 +27,20 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcWidgetsGlobal, "wangwenx190.framelesshelper.widgets.global")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcWidgetsGlobal)
|
||||
# define DEBUG qCDebug(lcWidgetsGlobal)
|
||||
# define WARNING qCWarning(lcWidgetsGlobal)
|
||||
# define CRITICAL qCCritical(lcWidgetsGlobal)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
namespace FramelessHelper::Widgets
|
||||
{
|
||||
|
||||
void initialize()
|
||||
void FramelessHelperWidgetsInitialize()
|
||||
{
|
||||
static bool inited = false;
|
||||
if (inited) {
|
||||
|
@ -52,10 +48,10 @@ void initialize()
|
|||
}
|
||||
inited = true;
|
||||
|
||||
FramelessHelper::Core::initialize();
|
||||
FramelessHelperCoreInitialize();
|
||||
}
|
||||
|
||||
void uninitialize()
|
||||
void FramelessHelperWidgetsUninitialize()
|
||||
{
|
||||
static bool uninited = false;
|
||||
if (uninited) {
|
||||
|
@ -65,9 +61,7 @@ void uninitialize()
|
|||
|
||||
// ### TODO: The Widgets module-specific uninitialization.
|
||||
|
||||
FramelessHelper::Core::uninitialize();
|
||||
}
|
||||
|
||||
FramelessHelperCoreUninitialize();
|
||||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
#include "framelessmainwindow.h"
|
||||
#include "framelessmainwindow_p.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
|
||||
#include "framelesswidgetshelper.h"
|
||||
#include "widgetssharedhelper_p.h"
|
||||
#include <FramelessHelper/Core/utils.h>
|
||||
|
@ -31,18 +34,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessMainWindow, "wangwenx190.framelesshelper.widgets.framelessmainwindow")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessMainWindow)
|
||||
# define DEBUG qCDebug(lcFramelessMainWindow)
|
||||
# define WARNING qCWarning(lcFramelessMainWindow)
|
||||
# define CRITICAL qCCritical(lcFramelessMainWindow)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -118,3 +120,5 @@ void FramelessMainWindow::toggleFullScreen()
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
#include "framelesswidget.h"
|
||||
#include "framelesswidget_p.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
|
||||
#include "framelesswidgetshelper.h"
|
||||
#include "widgetssharedhelper_p.h"
|
||||
#include <FramelessHelper/Core/utils.h>
|
||||
|
@ -31,18 +34,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessWidget, "wangwenx190.framelesshelper.widgets.framelesswidget")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessWidget)
|
||||
# define DEBUG qCDebug(lcFramelessWidget)
|
||||
# define WARNING qCWarning(lcFramelessWidget)
|
||||
# define CRITICAL qCCritical(lcFramelessWidget)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -118,3 +120,5 @@ void FramelessWidget::toggleFullScreen()
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,12 +24,14 @@
|
|||
|
||||
#include "framelesswidgetshelper.h"
|
||||
#include "framelesswidgetshelper_p.h"
|
||||
#include "framelesswidget.h"
|
||||
#include "framelesswidget_p.h"
|
||||
#include "framelessmainwindow.h"
|
||||
#include "framelessmainwindow_p.h"
|
||||
#include "framelessdialog.h"
|
||||
#include "framelessdialog_p.h"
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
# include "framelesswidget.h"
|
||||
# include "framelesswidget_p.h"
|
||||
# include "framelessmainwindow.h"
|
||||
# include "framelessmainwindow_p.h"
|
||||
# include "framelessdialog.h"
|
||||
# include "framelessdialog_p.h"
|
||||
#endif
|
||||
#include "widgetssharedhelper_p.h"
|
||||
#include <FramelessHelper/Core/framelessmanager.h>
|
||||
#include <FramelessHelper/Core/utils.h>
|
||||
|
@ -54,18 +56,17 @@ extern Q_WIDGETS_EXPORT QWidget *qt_button_down;
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcFramelessWidgetsHelper, "wangwenx190.framelesshelper.widgets.framelesswidgetshelper")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcFramelessWidgetsHelper)
|
||||
# define DEBUG qCDebug(lcFramelessWidgetsHelper)
|
||||
# define WARNING qCWarning(lcFramelessWidgetsHelper)
|
||||
# define CRITICAL qCCritical(lcFramelessWidgetsHelper)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -241,6 +242,7 @@ QVariant FramelessWidgetsHelperPrivate::getProperty(const char *name, const QVar
|
|||
return ((value.isValid() && !value.isNull()) ? value : defaultValue);
|
||||
}
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
MicaMaterial *FramelessWidgetsHelperPrivate::getMicaMaterialIfAny() const
|
||||
{
|
||||
if (!window) {
|
||||
|
@ -251,7 +253,9 @@ MicaMaterial *FramelessWidgetsHelperPrivate::getMicaMaterialIfAny() const
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
WindowBorderPainter *FramelessWidgetsHelperPrivate::getWindowBorderIfAny() const
|
||||
{
|
||||
if (!window) {
|
||||
|
@ -262,6 +266,7 @@ WindowBorderPainter *FramelessWidgetsHelperPrivate::getWindowBorderIfAny() const
|
|||
}
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
WidgetsSharedHelper *FramelessWidgetsHelperPrivate::findOrCreateSharedHelper(QWidget *window)
|
||||
{
|
||||
|
@ -269,6 +274,7 @@ WidgetsSharedHelper *FramelessWidgetsHelperPrivate::findOrCreateSharedHelper(QWi
|
|||
if (!window) {
|
||||
return nullptr;
|
||||
}
|
||||
#if FRAMELESSHELPER_CONFIG(window)
|
||||
if (const auto widget = qobject_cast<FramelessWidget *>(window)) {
|
||||
if (const auto widgetPriv = FramelessWidgetPrivate::get(widget)) {
|
||||
return widgetPriv->sharedHelper;
|
||||
|
@ -284,6 +290,7 @@ WidgetsSharedHelper *FramelessWidgetsHelperPrivate::findOrCreateSharedHelper(QWi
|
|||
return dialogPriv->sharedHelper;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
QWidget * const topLevelWindow = window->window();
|
||||
WidgetsSharedHelper *helper = topLevelWindow->findChild<WidgetsSharedHelper *>();
|
||||
if (!helper) {
|
||||
|
@ -413,13 +420,16 @@ void FramelessWidgetsHelperPrivate::attach()
|
|||
params.forceChildrenRepaint = [this](const int delay) -> void { repaintAllChildren(delay); };
|
||||
params.resetQtGrabbedControl = []() -> bool {
|
||||
if (qt_button_down) {
|
||||
QMouseEvent e(QEvent::MouseButtonRelease,
|
||||
{-999, -999},
|
||||
static constexpr const auto invalidPos = QPoint{ -99999, -99999 };
|
||||
const auto event = std::make_unique<QMouseEvent>(
|
||||
QEvent::MouseButtonRelease,
|
||||
invalidPos,
|
||||
invalidPos,
|
||||
invalidPos,
|
||||
Qt::LeftButton,
|
||||
Qt::NoButton,
|
||||
QApplication::keyboardModifiers()
|
||||
);
|
||||
QApplication::sendEvent(qt_button_down, &e);
|
||||
QGuiApplication::mouseButtons() ^ Qt::LeftButton,
|
||||
QGuiApplication::keyboardModifiers());
|
||||
QApplication::sendEvent(qt_button_down, event.get());
|
||||
qt_button_down = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
@ -683,7 +693,7 @@ void FramelessWidgetsHelper::showSystemMenu(const QPoint &pos)
|
|||
const QPoint nativePos = Utils::toNativeGlobalPosition(d->window->windowHandle(), pos);
|
||||
#ifdef Q_OS_WINDOWS
|
||||
std::ignore = Utils::showSystemMenu(windowId, nativePos, false, &d->getWindowData()->params);
|
||||
#elif defined(Q_OS_LINUX)
|
||||
#elif (defined(Q_OS_LINUX) && !defined(Q_OS_ANDROID))
|
||||
Utils::openSystemMenu(windowId, nativePos);
|
||||
#else
|
||||
Q_UNUSED(windowId);
|
||||
|
@ -768,17 +778,21 @@ QWidget *FramelessWidgetsHelper::window() const
|
|||
return d->window;
|
||||
}
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
MicaMaterial *FramelessWidgetsHelper::micaMaterial() const
|
||||
{
|
||||
Q_D(const FramelessWidgetsHelper);
|
||||
return d->getMicaMaterialIfAny();
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
WindowBorderPainter *FramelessWidgetsHelper::windowBorder() const
|
||||
{
|
||||
Q_D(const FramelessWidgetsHelper);
|
||||
return d->getWindowBorderIfAny();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool FramelessWidgetsHelper::isWindowFixedSize() const
|
||||
{
|
||||
|
@ -844,7 +858,9 @@ void FramelessWidgetsHelper::setBlurBehindWindowEnabled(const bool enable)
|
|||
} else {
|
||||
if (WidgetsSharedHelper * const helper = d->findOrCreateSharedHelper(d->window)) {
|
||||
d->blurBehindWindowEnabled = enable;
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
helper->setMicaEnabled(d->blurBehindWindowEnabled);
|
||||
#endif
|
||||
d->emitSignalForAllInstances("blurBehindWindowEnabledChanged");
|
||||
} else {
|
||||
DEBUG << "Blur behind window is not supported on current platform.";
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
|
||||
#include "standardsystembutton.h"
|
||||
#include "standardsystembutton_p.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||
|
||||
#include <FramelessHelper/Core/utils.h>
|
||||
#include <FramelessHelper/Core/private/framelessmanager_p.h>
|
||||
#include <QtCore/qloggingcategory.h>
|
||||
|
@ -33,18 +36,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcStandardSystemButton, "wangwenx190.framelesshelper.widgets.standardsystembutton")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcStandardSystemButton)
|
||||
# define DEBUG qCDebug(lcStandardSystemButton)
|
||||
# define WARNING qCWarning(lcStandardSystemButton)
|
||||
# define CRITICAL qCCritical(lcStandardSystemButton)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -344,3 +346,5 @@ void StandardSystemButton::paintEvent(QPaintEvent *event)
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,7 +24,12 @@
|
|||
|
||||
#include "standardtitlebar.h"
|
||||
#include "standardtitlebar_p.h"
|
||||
#include "standardsystembutton.h"
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(titlebar)
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(system_button)
|
||||
# include "standardsystembutton.h"
|
||||
#endif
|
||||
#include "framelesswidgetshelper.h"
|
||||
#include <FramelessHelper/Core/utils.h>
|
||||
#include <QtCore/qcoreevent.h>
|
||||
|
@ -37,18 +42,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcStandardTitleBar, "wangwenx190.framelesshelper.widgets.standardtitlebar")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcStandardTitleBar)
|
||||
# define DEBUG qCDebug(lcStandardTitleBar)
|
||||
# define WARNING qCWarning(lcStandardTitleBar)
|
||||
# define CRITICAL qCCritical(lcStandardTitleBar)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -231,11 +235,11 @@ bool StandardTitleBarPrivate::isInTitleBarIconArea(const QPoint &pos) const
|
|||
|
||||
void StandardTitleBarPrivate::updateMaximizeButton()
|
||||
{
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
const bool max = window->isMaximized();
|
||||
maximizeButton->setButtonType(max ? SystemButtonType::Restore : SystemButtonType::Maximize);
|
||||
maximizeButton->setToolTip(max ? tr("Restore") : tr("Maximize"));
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
}
|
||||
|
||||
void StandardTitleBarPrivate::updateTitleBarColor()
|
||||
|
@ -246,7 +250,7 @@ void StandardTitleBarPrivate::updateTitleBarColor()
|
|||
|
||||
void StandardTitleBarPrivate::updateChromeButtonColor()
|
||||
{
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
const bool active = window->isActiveWindow();
|
||||
const QColor activeForeground = chromePalette->titleBarActiveForegroundColor();
|
||||
const QColor inactiveForeground = chromePalette->titleBarInactiveForegroundColor();
|
||||
|
@ -271,16 +275,16 @@ void StandardTitleBarPrivate::updateChromeButtonColor()
|
|||
closeButton->setHoverColor(chromePalette->closeButtonHoverColor());
|
||||
closeButton->setPressColor(chromePalette->closeButtonPressColor());
|
||||
closeButton->setActive(active);
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
}
|
||||
|
||||
void StandardTitleBarPrivate::retranslateUi()
|
||||
{
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
minimizeButton->setToolTip(tr("Minimize"));
|
||||
maximizeButton->setToolTip(window->isMaximized() ? tr("Restore") : tr("Maximize"));
|
||||
closeButton->setToolTip(tr("Close"));
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
}
|
||||
|
||||
bool StandardTitleBarPrivate::eventFilter(QObject *object, QEvent *event)
|
||||
|
@ -335,7 +339,7 @@ void StandardTitleBarPrivate::initialize()
|
|||
const auto titleBarLayout = new QHBoxLayout(q);
|
||||
titleBarLayout->setSpacing(0);
|
||||
titleBarLayout->setContentsMargins(0, 0, 0, 0);
|
||||
#else // !Q_OS_MACOS
|
||||
#elif FRAMELESSHELPER_CONFIG(system_button)
|
||||
minimizeButton = new StandardSystemButton(SystemButtonType::Minimize, q);
|
||||
connect(minimizeButton, &StandardSystemButton::clicked, window, &QWidget::showMinimized);
|
||||
maximizeButton = new StandardSystemButton(SystemButtonType::Maximize, q);
|
||||
|
@ -374,7 +378,7 @@ void StandardTitleBarPrivate::initialize()
|
|||
titleBarLayout->setContentsMargins(0, 0, 0, 0);
|
||||
titleBarLayout->addStretch();
|
||||
titleBarLayout->addLayout(systemButtonsOuterLayout);
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
retranslateUi();
|
||||
updateTitleBarColor();
|
||||
updateChromeButtonColor();
|
||||
|
@ -395,7 +399,7 @@ StandardTitleBar::StandardTitleBar(QWidget *parent)
|
|||
|
||||
StandardTitleBar::~StandardTitleBar() = default;
|
||||
|
||||
#ifndef Q_OS_MACOS
|
||||
#if (!defined(Q_OS_MACOS) && FRAMELESSHELPER_CONFIG(system_button))
|
||||
StandardSystemButton *StandardTitleBar::minimizeButton() const
|
||||
{
|
||||
Q_D(const StandardTitleBar);
|
||||
|
@ -413,7 +417,7 @@ StandardSystemButton *StandardTitleBar::closeButton() const
|
|||
Q_D(const StandardTitleBar);
|
||||
return d->closeButton;
|
||||
}
|
||||
#endif // Q_OS_MACOS
|
||||
#endif
|
||||
|
||||
void StandardTitleBar::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
|
@ -627,3 +631,5 @@ void StandardTitleBar::setTitleFont(const QFont &value)
|
|||
}
|
||||
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,11 +23,15 @@
|
|||
*/
|
||||
|
||||
#include "widgetssharedhelper_p.h"
|
||||
#include <FramelessHelper/Core/micamaterial.h>
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
# include <FramelessHelper/Core/micamaterial.h>
|
||||
# include <FramelessHelper/Core/private/micamaterial_p.h>
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
# include <FramelessHelper/Core/windowborderpainter.h>
|
||||
#endif
|
||||
#include <FramelessHelper/Core/utils.h>
|
||||
#include <FramelessHelper/Core/windowborderpainter.h>
|
||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||
#include <FramelessHelper/Core/private/micamaterial_p.h>
|
||||
#ifdef Q_OS_WINDOWS
|
||||
# include <FramelessHelper/Core/private/winverhelper_p.h>
|
||||
#endif // Q_OS_WINDOWS
|
||||
|
@ -39,18 +43,17 @@
|
|||
|
||||
FRAMELESSHELPER_BEGIN_NAMESPACE
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(debug_output)
|
||||
[[maybe_unused]] static Q_LOGGING_CATEGORY(lcWidgetsSharedHelper, "wangwenx190.framelesshelper.widgets.widgetssharedhelper")
|
||||
|
||||
#ifdef FRAMELESSHELPER_WIDGETS_NO_DEBUG_OUTPUT
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#else
|
||||
# define INFO qCInfo(lcWidgetsSharedHelper)
|
||||
# define DEBUG qCDebug(lcWidgetsSharedHelper)
|
||||
# define WARNING qCWarning(lcWidgetsSharedHelper)
|
||||
# define CRITICAL qCCritical(lcWidgetsSharedHelper)
|
||||
#else
|
||||
# define INFO QT_NO_QDEBUG_MACRO()
|
||||
# define DEBUG QT_NO_QDEBUG_MACRO()
|
||||
# define WARNING QT_NO_QDEBUG_MACRO()
|
||||
# define CRITICAL QT_NO_QDEBUG_MACRO()
|
||||
#endif
|
||||
|
||||
using namespace Global;
|
||||
|
@ -71,6 +74,7 @@ void WidgetsSharedHelper::setup(QWidget *widget)
|
|||
return;
|
||||
}
|
||||
m_targetWidget = widget;
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
m_borderPainter = new WindowBorderPainter(this);
|
||||
if (m_borderRepaintConnection) {
|
||||
disconnect(m_borderRepaintConnection);
|
||||
|
@ -82,6 +86,8 @@ void WidgetsSharedHelper::setup(QWidget *widget)
|
|||
m_targetWidget->update();
|
||||
}
|
||||
});
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
m_micaMaterial = new MicaMaterial(this);
|
||||
if (m_micaRedrawConnection) {
|
||||
disconnect(m_micaRedrawConnection);
|
||||
|
@ -93,6 +99,7 @@ void WidgetsSharedHelper::setup(QWidget *widget)
|
|||
m_targetWidget->update();
|
||||
}
|
||||
});
|
||||
#endif
|
||||
m_targetWidget->installEventFilter(this);
|
||||
updateContentsMargins();
|
||||
m_targetWidget->update();
|
||||
|
@ -110,6 +117,7 @@ void WidgetsSharedHelper::setup(QWidget *widget)
|
|||
&QWindow::screenChanged, this, &WidgetsSharedHelper::handleScreenChanged);
|
||||
}
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
bool WidgetsSharedHelper::isMicaEnabled() const
|
||||
{
|
||||
return m_micaEnabled;
|
||||
|
@ -131,11 +139,14 @@ MicaMaterial *WidgetsSharedHelper::rawMicaMaterial() const
|
|||
{
|
||||
return m_micaMaterial;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
WindowBorderPainter *WidgetsSharedHelper::rawWindowBorder() const
|
||||
{
|
||||
return m_borderPainter;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool WidgetsSharedHelper::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
|
@ -162,8 +173,12 @@ bool WidgetsSharedHelper::eventFilter(QObject *object, QEvent *event)
|
|||
m_targetWidget->update();
|
||||
break;
|
||||
case QEvent::Paint: {
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
repaintMica();
|
||||
#endif
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
repaintBorder();
|
||||
#endif
|
||||
} break;
|
||||
case QEvent::WindowStateChange:
|
||||
if (event->type() == QEvent::WindowStateChange) {
|
||||
|
@ -173,7 +188,11 @@ bool WidgetsSharedHelper::eventFilter(QObject *object, QEvent *event)
|
|||
break;
|
||||
case QEvent::Move:
|
||||
case QEvent::Resize:
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
if (m_micaEnabled) {
|
||||
m_targetWidget->update();
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -181,24 +200,28 @@ bool WidgetsSharedHelper::eventFilter(QObject *object, QEvent *event)
|
|||
return QObject::eventFilter(object, event);
|
||||
}
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
void WidgetsSharedHelper::repaintMica()
|
||||
{
|
||||
if (!m_micaEnabled || !m_micaMaterial) {
|
||||
if (!m_micaEnabled) {
|
||||
return;
|
||||
}
|
||||
QPainter painter(m_targetWidget);
|
||||
const QRect rect = { m_targetWidget->mapToGlobal(QPoint(0, 0)), m_targetWidget->size() };
|
||||
m_micaMaterial->paint(&painter, rect, m_targetWidget->isActiveWindow());
|
||||
}
|
||||
#endif
|
||||
|
||||
#if FRAMELESSHELPER_CONFIG(border_painter)
|
||||
void WidgetsSharedHelper::repaintBorder()
|
||||
{
|
||||
if ((Utils::windowStatesToWindowState(m_targetWidget->windowState()) != Qt::WindowNoState) || !m_borderPainter) {
|
||||
if (Utils::windowStatesToWindowState(m_targetWidget->windowState()) != Qt::WindowNoState) {
|
||||
return;
|
||||
}
|
||||
QPainter painter(m_targetWidget);
|
||||
m_borderPainter->paint(&painter, m_targetWidget->size(), m_targetWidget->isActiveWindow());
|
||||
}
|
||||
#endif
|
||||
|
||||
void WidgetsSharedHelper::emitCustomWindowStateSignals()
|
||||
{
|
||||
|
@ -244,9 +267,11 @@ void WidgetsSharedHelper::handleScreenChanged(QScreen *screen)
|
|||
return;
|
||||
}
|
||||
m_screenDpr = currentDpr;
|
||||
if (m_micaEnabled && m_micaMaterial) {
|
||||
#if FRAMELESSHELPER_CONFIG(mica_material)
|
||||
if (m_micaEnabled) {
|
||||
MicaMaterialPrivate::get(m_micaMaterial)->maybeGenerateBlurredWallpaper(true);
|
||||
}
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue