Skip to content

Commit

Permalink
fix: Update version check with dpkg
Browse files Browse the repository at this point in the history
DTKCore和DTKWidget版本不一定一致,
调整版本判断方式,改为检测libdtkwidget-dev包版本
低于5.6.9认为使用定制接口

Log: 修复部分分支构建问题
Change-Id: I3f824cd69f441a37418727f03554897cca5497f6
  • Loading branch information
rb-union committed May 6, 2024
1 parent ec074fc commit 1745ae8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
15 changes: 15 additions & 0 deletions libimageviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion libimageviewer/service/permissionconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1745ae8

Please sign in to comment.