diff --git a/libimageviewer/CMakeLists.txt b/libimageviewer/CMakeLists.txt index cbda88a4..c0513115 100644 --- a/libimageviewer/CMakeLists.txt +++ b/libimageviewer/CMakeLists.txt @@ -4,6 +4,21 @@ cmake_minimum_required(VERSION 3.10) # 设置工程名字 project(libimageviewer VERSION 0.1.0) +# 检查dtkwidget版本 +execute_process(COMMAND dpkg -s libdtkwidget-dev + COMMAND grep Version + TIMEOUT 5 + OUTPUT_VARIABLE DWIDGET_VERSION_STR) +string(REPLACE "Version: " "" DWIDGET_VERSION_STR ${DWIDGET_VERSION_STR}) +message(STATUS "BUILD DTKWidget VERSION ${DWIDGET_VERSION_STR}") + +if (${DWIDGET_VERSION_STR} VERSION_LESS "5.6.9-1") + message(STATUS "Use specific dtk watermakr, Version < 5.6.9-1") + add_definitions(-DUSE_SPECIFIC_DTK_WATERMARK) +else() + message(STATUS "Use master dtk watermakr, Version >= 5.6.9-1") +endif() + set(CMAKE_CXX_STANDARD 14) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON) diff --git a/libimageviewer/service/permissionconfig.cpp b/libimageviewer/service/permissionconfig.cpp index 3622b421..6eb62b70 100644 --- a/libimageviewer/service/permissionconfig.cpp +++ b/libimageviewer/service/permissionconfig.cpp @@ -724,7 +724,8 @@ WaterMarkData PermissionConfig::convertAdapterWaterMarkData(const PermissionConf // DTKWidget 主线和定制线的水印接口不同,通过版本进行区分 // 主线水印接口在 5.6.9 之后引入. // 因此,判断定制线:存在水印接口宏 DTKWIDGET_CLASS_DWaterMarkHelper ,版本低于 5.6.9 -#if DTK_VERSION < DTK_VERSION_CHECK(5, 6, 9, 0) + // 由于DTKCore 和 DTKWidget 版本可能不一致,调整使用安装dev包版本识别 +#ifdef USE_SPECIFIC_DTK_WATERMARK data.type = AdapterWaterMarkData::Text == adptData.type ? WaterMarkType::Text : WaterMarkType::Image; data.layout = AdapterWaterMarkData::Center == adptData.layout ? WaterMarkLayout::Center : WaterMarkLayout::Tiled; data.scaleFactor = adptData.scaleFactor;