Accepting request 1063958 from KDE:Extra

- Add patches to fix build with ZXing >= 2.0:
  * 0001-QrCodeDecoder-Replace-deprecated-BarcodeFormat-QR_CO.patch
  * 0001-QrCodeGenerator-Replace-deprecated-BarcodeFormat-QR_.patch
  * 0001-Support-ZXing-2.0.patch

OBS-URL: https://build.opensuse.org/request/show/1063958
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kaidan?expand=0&rev=2
This commit is contained in:
Dominique Leuenberger 2023-02-09 15:23:21 +00:00 committed by Git OBS Bridge
commit f166d73719
5 changed files with 115 additions and 2 deletions

View File

@ -0,0 +1,29 @@
From 9a2f88779064b46ae097a354c97d657901f47d01 Mon Sep 17 00:00:00 2001
From: Melvin Keskin <melvo@olomono.de>
Date: Fri, 18 Feb 2022 10:48:46 +0100
Subject: [PATCH] QrCodeDecoder: Replace deprecated 'BarcodeFormat::QR_CODE'
with 'BarcodeFormat::QRCode'
---
src/QrCodeDecoder.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/QrCodeDecoder.cpp b/src/QrCodeDecoder.cpp
index a84978f..a7b0cf5 100644
--- a/src/QrCodeDecoder.cpp
+++ b/src/QrCodeDecoder.cpp
@@ -60,7 +60,11 @@ void QrCodeDecoder::decodeImage(const QImage &image)
{
// Advise the decoder to check for QR codes and to try decoding rotated versions of the image.
#if ZXING_VERSION >= QT_VERSION_CHECK(1, 1, 0)
+# if ZXING_VERSION >= QT_VERSION_CHECK(1, 1, 1)
+ const auto decodeHints = DecodeHints().setFormats(BarcodeFormat::QRCode);
+# else
const auto decodeHints = DecodeHints().setFormats(BarcodeFormat::QR_CODE);
+# endif
const auto result = ReadBarcode({image.bits(), image.width(), image.height(), ZXing::ImageFormat::Lum, image.bytesPerLine()}, decodeHints);
#else
const auto decodeHints =
--
2.39.1

View File

@ -0,0 +1,40 @@
From dc41a3f3850308d5204134ae08e66f20a58195f9 Mon Sep 17 00:00:00 2001
From: Melvin Keskin <melvo@olomono.de>
Date: Sun, 13 Mar 2022 13:03:16 +0100
Subject: [PATCH] QrCodeGenerator: Replace deprecated 'BarcodeFormat::QR_CODE'
with 'BarcodeFormat::QRCode'
---
src/QrCodeGenerator.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/QrCodeGenerator.cpp b/src/QrCodeGenerator.cpp
index b9c8743..1338308 100644
--- a/src/QrCodeGenerator.cpp
+++ b/src/QrCodeGenerator.cpp
@@ -33,6 +33,10 @@
#include <QImage>
#include <QRgb>
+#include <ZXing/ZXVersion.h>
+#define ZXING_VERSION \
+ QT_VERSION_CHECK(ZXING_VERSION_MAJOR, ZXING_VERSION_MINOR, ZXING_VERSION_PATCH)
+
#include <ZXing/BarcodeFormat.h>
#include <ZXing/MultiFormatWriter.h>
@@ -74,7 +78,11 @@ QImage QrCodeGenerator::generateBareJidQrCode(int edgePixelCount, const QString
QImage QrCodeGenerator::generateQrCode(int edgePixelCount, const QString &text)
{
try {
+#if ZXING_VERSION >= QT_VERSION_CHECK(1, 1, 1)
+ ZXing::MultiFormatWriter writer(ZXing::BarcodeFormat::QRCode);
+#else
ZXing::MultiFormatWriter writer(ZXing::BarcodeFormat::QR_CODE);
+#endif
const ZXing::BitMatrix &bitMatrix = writer.encode(text.toStdWString(), edgePixelCount, edgePixelCount);
return toImage(bitMatrix);
} catch (const std::invalid_argument &e) {
--
2.39.1

View File

@ -0,0 +1,31 @@
From c92fe3125c08e61b454b41f151b435a6a9e6da4b Mon Sep 17 00:00:00 2001
From: Volker Krause <vkrause@kde.org>
Date: Wed, 4 Jan 2023 17:28:31 +0100
Subject: [PATCH] Support ZXing 2.0
An alternative approach going forward might be replacing the entire direct
ZXing use and video stream processing by KF::Prison. Avoids duplicated
maintenance, but adds a new dependency.
---
src/QrCodeDecoder.cpp | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/QrCodeDecoder.cpp b/src/QrCodeDecoder.cpp
index a7b0cf5..86d1e7b 100644
--- a/src/QrCodeDecoder.cpp
+++ b/src/QrCodeDecoder.cpp
@@ -90,7 +90,11 @@ void QrCodeDecoder::decodeImage(const QImage &image)
// If a QR code could be found and decoded, emit a signal with the decoded string.
// Otherwise, emit a signal for failed decoding.
if (result.isValid())
+#if ZXING_VERSION < QT_VERSION_CHECK(2, 0, 0)
emit decodingSucceeded(QString::fromStdString(TextUtfEncoding::ToUtf8(result.text())));
+#else
+ emit decodingSucceeded(QString::fromStdString(result.text()));
+#endif
else
emit decodingFailed();
}
--
2.39.1

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Feb 9 08:09:58 UTC 2023 - Christophe Marin <christophe@krop.fr>
- Add patches to fix build with ZXing >= 2.0:
* 0001-QrCodeDecoder-Replace-deprecated-BarcodeFormat-QR_CO.patch
* 0001-QrCodeGenerator-Replace-deprecated-BarcodeFormat-QR_.patch
* 0001-Support-ZXing-2.0.patch
-------------------------------------------------------------------
Fri Oct 1 16:00:38 UTC 2021 - Enrico Belleri <idesmi@protonmail.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package kaidan
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -21,11 +21,16 @@ Version: 0.8.0
Release: 0
Summary: A XMPP client based on KDE Framework
License: GPL-3.0-or-later AND SUSE-GPL-3.0+-with-openssl-exception AND MIT AND AML AND CC-BY-SA-4.0
Group: Productivity/Networking/Instant Messenger
URL: https://www.kaidan.im
Source0: https://download.kde.org/unstable/%{name}/%{version}/%{name}-%{version}.tar.xz
Source1: https://download.kde.org/unstable/%{name}/%{version}/%{name}-%{version}.tar.xz.sig
Source2: kaidan.keyring
# PATCH-FIX-UPSTREAM
Patch0: 0001-QrCodeDecoder-Replace-deprecated-BarcodeFormat-QR_CO.patch
# PATCH-FIX-UPSTREAM
Patch1: 0001-QrCodeGenerator-Replace-deprecated-BarcodeFormat-QR_.patch
# PATCH-FIX-UPSTREAM
Patch2: 0001-Support-ZXing-2.0.patch
BuildRequires: cmake >= 3.3
BuildRequires: extra-cmake-modules >= 5.40.0
BuildRequires: update-desktop-files