ksnip: build with kImageAnnotator-qt5
This commit is contained in:
parent
7061f0a8da
commit
e2bfae24c2
107
srcpkgs/ksnip/patches/76f4b381.patch
Normal file
107
srcpkgs/ksnip/patches/76f4b381.patch
Normal file
@ -0,0 +1,107 @@
|
||||
From 76f4b381971eead6ff31b8bf3bb64bb5717469c3 Mon Sep 17 00:00:00 2001
|
||||
From: Damir Porobic <damir_porobic@live.com>
|
||||
Date: Thu, 22 Feb 2024 12:18:14 +0100
|
||||
Subject: [PATCH] Fix build against kImageAnnotator and kColorPicker that use
|
||||
qt5 and qt6
|
||||
|
||||
---
|
||||
CMakeLists.txt | 18 +++++++++++++-----
|
||||
src/CMakeLists.txt | 2 +-
|
||||
src/gui/operations/CopyAsDataUriOperation.cpp | 9 ++++-----
|
||||
tests/CMakeLists.txt | 2 +-
|
||||
4 files changed, 19 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 2613ac42..f8088dd7 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -44,6 +44,14 @@ endif ()
|
||||
set(QT_COMPONENTS Core Widgets Network Xml PrintSupport DBus Svg)
|
||||
set(QT_MIN_VERSION 5.9.4)
|
||||
|
||||
+option(BUILD_WITH_QT6 "Build against Qt6" OFF)
|
||||
+
|
||||
+if (BUILD_WITH_QT6)
|
||||
+ set(QT_MAJOR_VERSION 6)
|
||||
+else()
|
||||
+ set(QT_MAJOR_VERSION 5)
|
||||
+endif()
|
||||
+
|
||||
if (UNIX AND NOT APPLE)
|
||||
list(APPEND QT_COMPONENTS Concurrent)
|
||||
endif()
|
||||
@@ -58,13 +66,13 @@ if (BUILD_TESTS)
|
||||
list(APPEND QT_COMPONENTS Test)
|
||||
endif()
|
||||
|
||||
-find_package(Qt5 ${QT_MIN_VERSION} REQUIRED ${QT_COMPONENTS})
|
||||
+find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED ${QT_COMPONENTS})
|
||||
|
||||
-set(KIMAGEANNOTATOR_MIN_VERSION 0.6.1)
|
||||
-find_package(kImageAnnotator ${KIMAGEANNOTATOR_MIN_VERSION} REQUIRED)
|
||||
+set(KIMAGEANNOTATOR_MIN_VERSION 0.7.0)
|
||||
+find_package(kImageAnnotator-Qt${QT_MAJOR_VERSION} ${KIMAGEANNOTATOR_MIN_VERSION} REQUIRED)
|
||||
|
||||
-set(KCOLORPICKER_MIN_VERSION 0.2.0)
|
||||
-find_package(kColorPicker ${KCOLORPICKER_MIN_VERSION} REQUIRED)
|
||||
+set(KCOLORPICKER_MIN_VERSION 0.3.0)
|
||||
+find_package(kColorPicker-Qt${QT_MAJOR_VERSION} ${KCOLORPICKER_MIN_VERSION} REQUIRED)
|
||||
|
||||
set(BASEPATH "${CMAKE_SOURCE_DIR}")
|
||||
include_directories("${BASEPATH}")
|
||||
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
||||
index e60d4bba..5a637411 100644
|
||||
--- a/src/CMakeLists.txt
|
||||
+++ b/src/CMakeLists.txt
|
||||
@@ -293,7 +293,7 @@ elseif (UNIX)
|
||||
elseif (WIN32)
|
||||
list(APPEND DEPENDENCY_LIBRARIES
|
||||
Qt5::WinExtras
|
||||
- kImageAnnotator
|
||||
+ kImageAnnotator::kImageAnnotator
|
||||
kColorPicker
|
||||
Dwmapi
|
||||
)
|
||||
diff --git a/src/gui/operations/CopyAsDataUriOperation.cpp b/src/gui/operations/CopyAsDataUriOperation.cpp
|
||||
index 7c9b6eef..100aa4fd 100644
|
||||
--- a/src/gui/operations/CopyAsDataUriOperation.cpp
|
||||
+++ b/src/gui/operations/CopyAsDataUriOperation.cpp
|
||||
@@ -34,14 +34,13 @@ CopyAsDataUriOperation::CopyAsDataUriOperation(
|
||||
bool CopyAsDataUriOperation::execute()
|
||||
{
|
||||
QByteArray byteArray;
|
||||
-
|
||||
QBuffer buffer(&byteArray);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
- auto saved = mImage.save(&buffer, "PNG");
|
||||
+ auto isSaved = mImage.save(&buffer, mConfig->saveFormat().toLatin1());
|
||||
buffer.close();
|
||||
|
||||
- if (saved) {
|
||||
- QByteArray output = "data:image/png;base64,";
|
||||
+ if (isSaved) {
|
||||
+ QByteArray output = "data:image/" + mConfig->saveFormat().toLatin1() +";base64,";
|
||||
output.append(byteArray.toBase64());
|
||||
mClipboardService->setText(output);
|
||||
notifySuccess();
|
||||
@@ -49,7 +48,7 @@ bool CopyAsDataUriOperation::execute()
|
||||
notifyFailure();
|
||||
}
|
||||
|
||||
- return saved;
|
||||
+ return isSaved;
|
||||
}
|
||||
|
||||
void CopyAsDataUriOperation::notifyFailure() const
|
||||
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
|
||||
index f4a49ffd..da19ce93 100644
|
||||
--- a/tests/CMakeLists.txt
|
||||
+++ b/tests/CMakeLists.txt
|
||||
@@ -73,6 +73,6 @@ endif ()
|
||||
foreach (UnitTest ${UNITTEST_SRC})
|
||||
get_filename_component(UnitTestName ${UnitTest} NAME_WE)
|
||||
add_executable(${UnitTestName} ${UnitTest} ${TESTUTILS_SRC})
|
||||
- target_link_libraries(${UnitTestName} KSNIP_STATIC GTest::gmock Qt5::Test)
|
||||
+ target_link_libraries(${UnitTestName} KSNIP_STATIC GTest::gmock Qt${QT_MAJOR_VERSION}::Test)
|
||||
add_test(${UnitTestName} ${UnitTestName})
|
||||
endforeach (UnitTest)
|
@ -1,11 +1,11 @@
|
||||
# Template file for 'ksnip'
|
||||
pkgname=ksnip
|
||||
version=1.10.1
|
||||
revision=1
|
||||
revision=2
|
||||
build_style=cmake
|
||||
hostmakedepends="extra-cmake-modules qt5-qmake qt5-host-tools"
|
||||
makedepends="qt5-x11extras-devel qt5-tools-devel libXfixes-devel
|
||||
qt5-svg-devel kImageAnnotator-devel kColorPicker-devel"
|
||||
qt5-svg-devel kImageAnnotator-qt5-devel kColorPicker-qt5-devel"
|
||||
short_desc="Qt based cross-platform screenshot tool with annotation features"
|
||||
maintainer="John <me@johnnynator.dev>"
|
||||
license="GPL-3.0-or-later"
|
||||
|
Loading…
x
Reference in New Issue
Block a user