Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions dtkgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Set build option
option(DTK_DISABLE_LIBXDG "Disable libxdg" OFF)
find_package(Qt${QT_VERSION_MAJOR}XdgIconLoader)
if (NOT Qt${QT_VERSION_MAJOR}XdgIconLoader_FOUND)
message(WARNING " XdgIconLoader Not Found, DISABLE LIBXDG !")
set (DTK_DISABLE_LIBXDG ON)
endif()
option(DTK_DISABLE_LIBRSVG "Disable librsvg" OFF)
option(DTK_DISABLE_EX_IMAGE_FORMAT "Disable libraw and freeimage" OFF)

Expand Down Expand Up @@ -120,6 +115,15 @@ find_package(Dtk${DTK_VERSION_MAJOR} REQUIRED Core)
find_package(DtkBuildHelper REQUIRED)
pkg_check_modules(librsvg REQUIRED IMPORTED_TARGET librsvg-2.0)

# Only use libxdg under Qt5
if(NOT DTK_DISABLE_LIBXDG AND ${QT_VERSION_MAJOR} STREQUAL "5")
find_package(Qt5XdgIconLoader REQUIRED)
if (NOT Qt5XdgIconLoader_FOUND)
message(WARNING " XdgIconLoader Not Found, DISABLE LIBXDG !")
set (DTK_DISABLE_LIBXDG ON)
endif()
endif()

# Check optional image handler dependencies.
find_package(FreeImage)
pkg_check_modules(libraw IMPORTED_TARGET libraw)
Expand Down
7 changes: 6 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
if("${QT_VERSION_MAJOR}" STREQUAL "6")
find_package(Qt6 REQUIRED COMPONENTS Core Widgets WaylandClient)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets WaylandClient)

if (${Qt6Core_VERSION} VERSION_GREATER_EQUAL "6.10.0")
set(QT_NO_PRIVATE_MODULE_WARNING ON)
find_package(Qt6 REQUIRED COMPONENTS CorePrivate GuiPrivate WaylandClientPrivate)
endif()
else()
find_package(Qt5 REQUIRED COMPONENTS WaylandClient XkbCommonSupport)
endif()
Expand Down
29 changes: 17 additions & 12 deletions src/kernel/dguiapplicationhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,12 @@ void DGuiApplicationHelperPrivate::notifyAppThemeChanged()

void DGuiApplicationHelperPrivate::notifyAppThemeChangedByEvent()
{
// https://github.com/qt/qtbase/commit/68a9c5fe513e147e4cffd29b50a4714813df411e
#if QT_VERSION >= QT_VERSION_CHECK(6, 10, 0)
QWindowSystemInterfacePrivate::ThemeChangeEvent event;
#else
QWindowSystemInterfacePrivate::ThemeChangeEvent event(nullptr);
#endif
// 此事件会促使QGuiApplication重新从QPlatformTheme中获取系统级别的QPalette.
// 而在deepin平台下, 系统级别的QPalette来源自 \a applicationPalette()
QGuiApplicationPrivate::processThemeChanged(&event);
Expand Down Expand Up @@ -509,42 +514,42 @@ DGuiApplicationHelper::SizeMode DGuiApplicationHelperPrivate::fetchSizeMode(bool
/*!
\enum DGuiApplicationHelper::ColorType
DGuiApplicationHelper::ColorType 定义了主题类型.

\var DGuiApplicationHelper::ColorType DGuiApplicationHelper::UnknownType
未知主题(浅色主题或深色主题)

\var DGuiApplicationHelper::ColorType DGuiApplicationHelper::LightType
浅色主题

\var DGuiApplicationHelper::ColorType DGuiApplicationHelper::DarkType
深色主题
*/

/*!
\enum DGuiApplicationHelper::Attribute
DGuiApplicationHelper::Attribute 定义了功能属性

\var DGuiApplicationHelper::Attribute DGuiApplicationHelper::UseInactiveColorGroup
如果开启,当窗口处于Inactive状态时就会使用QPalette::Inactive的颜色,否则窗口将没有任何颜色变化。

\var DGuiApplicationHelper::Attribute DGuiApplicationHelper::ColorCompositing
是否采用半透明样式的调色板。

\var DGuiApplicationHelper::Attribute DGuiApplicationHelper::ReadOnlyLimit
区分只读枚举。

\var DGuiApplicationHelper::Attribute DGuiApplicationHelper::IsDeepinPlatformTheme
获取当前是否使用deepin的platformtheme插件,platformtheme插件可以为Qt程序提供特定的控件样式,默认使用chameleon主题。

\var DGuiApplicationHelper::Attribute DGuiApplicationHelper::IsDXcbPlatform
获取当前使用的是不是dtk的xcb窗口插件,dxcb插件提供了窗口圆角和阴影功能。

\var DGuiApplicationHelper::Attribute DGuiApplicationHelper::IsXWindowPlatform
获取当前是否运行在X11环境中。

\var DGuiApplicationHelper::Attribute DGuiApplicationHelper::IsTableEnvironment
获取当前是否运行在deepin平板环境中,检测XDG_CURRENT_DESKTOP环境变量是不是tablet结尾。

\var DGuiApplicationHelper::Attribute DGuiApplicationHelper::IsDeepinEnvironment
获取当前是否运行在deepin桌面环境中,检测XDG_CURRENT_DESKTOP环境变量是不是deepin。
*/
Expand Down Expand Up @@ -1723,7 +1728,7 @@ bool DGuiApplicationHelper::loadTranslator(const QString &fileName, const QList<
if (locale.language() != QLocale::English) // English does not need translation
localeNames << locale.name();
}

if (!localeNames.isEmpty()) {
qWarning() << fileName << "can not find qm files for locales" << localeNames;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ if("${QT_VERSION_MAJOR}" STREQUAL "6")
qt6_generate_wayland_protocol_client_sources(${PROJECT_NAME} FILES
${TREELAND_PROTOCOLS_DATA_DIR}/treeland-personalization-manager-v1.xml
)

if (${Qt6Core_VERSION} VERSION_GREATER_EQUAL "6.10.0")
set(QT_NO_PRIVATE_MODULE_WARNING ON)
find_package(Qt6 REQUIRED COMPONENTS GuiPrivate CorePrivate WaylandClientPrivate)
endif()
else()
# ECM setup
include(FeatureSummary)
Expand Down
13 changes: 10 additions & 3 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
set(BIN_NAME ut-DtkGui)

find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets Test)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Widgets DBus Network Test)
if ("${QT_VERSION_MAJOR}" STREQUAL "6")
if (${Qt6Core_VERSION} VERSION_GREATER_EQUAL "6.10.0")
set(QT_NO_PRIVATE_MODULE_WARNING ON)
find_package(Qt6 REQUIRED COMPONENTS CorePrivate GuiPrivate WaylandClientPrivate)
endif()
endif()

find_package(GTest REQUIRED)

file(GLOB test_SRC
Expand Down Expand Up @@ -44,15 +51,15 @@ target_link_libraries(${BIN_NAME} PRIVATE
m
)

if(NOT DTK_DISABLE_EX_IMAGE_FORMAT AND EX_IMAGE_FORMAT_LIBS_FOUND)
if(NOT DTK_DISABLE_EX_IMAGE_FORMAT AND EX_IMAGE_FORMAT_LIBS_FOUND)
target_link_libraries(${BIN_NAME} PRIVATE
PkgConfig::libraw
FreeImage::FreeImage
)
endif()

if(NOT DTK_DISABLE_LIBXDG)
target_link_libraries(${BIN_NAME} PRIVATE
target_link_libraries(${BIN_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}XdgIconLoader
)
endif()
Expand Down
Loading