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
4 changes: 2 additions & 2 deletions .github/workflows/dtkgui-archlinux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
qt5-base qt5-tools qt5-wayland qt5-svg qt5-imageformats \
extra-cmake-modules \
gtest \
librsvg libraw \
librsvg \
libqt5xdg \
icu uchardet dbus spdlog gsettings-qt \
dtkcommon dtklog \
Expand All @@ -46,7 +46,7 @@ jobs:
qt6-base qt6-tools qt6-wayland qt6-svg qt6-imageformats \
extra-cmake-modules \
gtest \
librsvg libraw \
librsvg \
libqtxdg \
icu uchardet dbus spdlog \
dtkcommon dtk6log \
Expand Down
6 changes: 1 addition & 5 deletions archlinux/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ pkgdesc='Deepin Toolkit, gui module for DDE look and feel'
arch=('x86_64' 'aarch64')
url="https://github.com/linuxdeepin/dtkgui"
license=('LGPL3')
depends=('dtkcore-git' 'dtkcommon-git' 'qt5-svg' 'libqtxdg' 'freeimage' 'librsvg' 'qt5-wayland')
# INFO: you can disable freeimage not to support RAW images
# Then set DTK_DISABLE_EX_IMAGE_FORMAT=OFF
depends=('dtkcore-git' 'dtkcommon-git' 'qt5-svg' 'libqtxdg' 'librsvg' 'qt5-wayland')
makedepends=('git' 'qt5-tools' 'gtest' 'gmock' 'ninja' 'cmake' 'doxygen' 'extra-cmake-modules')
conflicts=('dtkgui')
provides=('dtkgui')
Expand All @@ -30,8 +28,6 @@ build() {
-DCMAKE_INSTALL_PREFIX=/usr \
-DDTK5=ON
ninja
# INFO: Another cmake option is DTK_DISABLE_EX_IMAGE_FORMAT
# If you not want to support RAW images, set it to off
}

package() {
Expand Down
2 changes: 0 additions & 2 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ Build-Depends: debhelper-compat (= 12),
libgmock-dev,
libdtkcommon-dev,
librsvg2-dev,
libfreeimage-dev,
libraw-dev,
treeland-protocols (>>0.5.8),
extra-cmake-modules,
libdtkdata,
Expand Down
10 changes: 6 additions & 4 deletions docs/src/dimagehandler.zh_CN.dox
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,17 @@ dimagehandler.h 提供图像处理类 DImageHandler
取得图片数据,通过 `DImageHandler::thumbnail` 取得图片缩略图。设置文件路径将不会立即加载图片,
将在需要图片数据时读取,当不需要缓存数据时,可通过 `DImageHandler::clearCache` 清除缓存数据。

@warning 该类已废弃,将在后续版本中移除。请使用 QImageReader/QImageWriter
或其它图像处理库代替。拓展图片格式支持默认已关闭。

@note 拓展的图片格式依赖 FreeImage 和 LibRaw 公共库,DImageHandler 通过动态加载的方式解析公共库接口。
可通过 DImageHandler::supportFormats() 获取当前支持的图片格式类型。

## 编译
支持拓展的图片格式,编译时会判断环境是否存在依赖包,安装 libfreeimage-dev 及 libraw-dev ,
设置编译选项 DTK_DISABLE_EX_IMAGE_FORMAT=OFF 后将开启拓展图片格式支持。
拓展的图片格式依赖 FreeImage 和 LibRaw 公共库,DImageHandler 通过动态加载的方式解析公共库接口。

不同包构建环境默认策略不同,在 **debian** 和 **linglong** 构建环境默认依赖 libfreeimage-dev 及 libraw-dev ,
支持拓展图片格式,其它环境需手动安装
自 6.7.50 起,编译选项 DTK_DISABLE_EX_IMAGE_FORMAT 默认开启,即默认 **** 启用拓展图片格式。
如需启用,需安装 libfreeimage-dev 及 libraw-dev ,并显式设置编译选项 DTK_DISABLE_EX_IMAGE_FORMAT=OFF

## image-handler 工具示例
可在程序根目录 ./tools/image-handler 中查看 image-handler 工具项目。
Expand Down
3 changes: 2 additions & 1 deletion dtkgui.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Set build option
option(DTK_DISABLE_LIBXDG "Disable libxdg" OFF)
option(DTK_DISABLE_LIBRSVG "Disable librsvg" OFF)
option(DTK_DISABLE_EX_IMAGE_FORMAT "Disable libraw and freeimage" OFF)
# DImageHandler is deprecated, disable libraw and freeimage by default.
option(DTK_DISABLE_EX_IMAGE_FORMAT "Disable libraw and freeimage" ON)

set(CMAKE_CXX_STANDARD 17)

Expand Down
15 changes: 13 additions & 2 deletions include/util/dimagehandler.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

Expand All @@ -14,7 +14,18 @@
DGUI_BEGIN_NAMESPACE

class DImageHandlerPrivate;
class DImageHandler : public QObject, public DTK_CORE_NAMESPACE::DObject

/*!
* \brief The DImageHandler class provides image reading, saving, rotating and
* filtering operations.
*
* \deprecated This class is deprecated and will be removed in the future.
* The extended image formats support based on FreeImage and LibRaw is
* disabled by default. Please use QImageReader/QImageWriter or other
* image libraries instead.
*/
class D_DECL_DEPRECATED_X("DImageHandler is deprecated, please use QImageReader/QImageWriter or other image libraries instead.")
DImageHandler : public QObject, public DTK_CORE_NAMESPACE::DObject
{
Q_OBJECT

Expand Down
1 change: 0 additions & 1 deletion linglong.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ depends:
- id: gsettings-qt/0.3.1.1
- id: dtkcore/5.6.0.2
- id: libqtxdg/3.6.0.1
- id: freeimage/3.18.0

source:
kind: local
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ if(NOT DTK_DISABLE_EX_IMAGE_FORMAT AND EX_IMAGE_FORMAT_LIBS_FOUND)
)
endif()

# DImageHandler is deprecated but still built for API/ABI compatibility,
# so ignore deprecation warnings when building internal targets.
target_compile_definitions(${LIB_NAME} PRIVATE D_IGNORE_DEPRECATIONS)

if(NOT DTK_DISABLE_LIBXDG)
target_link_libraries(${LIB_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}XdgIconLoader
Expand Down
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ add_executable(${BIN_NAME}
add_dependencies(${BIN_NAME} ${test-plugin})

target_compile_options(${BIN_NAME} PRIVATE -fno-access-control)
target_compile_definitions(${BIN_NAME} PRIVATE D_IGNORE_DEPRECATIONS)

if (CMAKE_BUILD_TYPE STREQUAL "Debug")
target_compile_options(${BIN_NAME} PRIVATE -fsanitize=address)
Expand Down
4 changes: 4 additions & 0 deletions tools/image-handler/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ add_executable(${TARGET_NAME}
main.cpp
)

# DImageHandler is deprecated but still used by this tool,
# so ignore deprecation warnings when building it.
target_compile_definitions(${TARGET_NAME} PRIVATE D_IGNORE_DEPRECATIONS)

target_link_libraries(${TARGET_NAME} PRIVATE
Qt${QT_VERSION_MAJOR}::Gui
${LIB_NAME}
Expand Down
Loading