diff --git a/net-im/kaidan/files/patch-src_QrCodeDecoder.cpp b/net-im/kaidan/files/patch-src_QrCodeDecoder.cpp new file mode 100644 index 000000000000..5223f26e47c6 --- /dev/null +++ b/net-im/kaidan/files/patch-src_QrCodeDecoder.cpp @@ -0,0 +1,26 @@ +--- src/QrCodeDecoder.cpp.orig 2023-01-10 10:30:39 UTC ++++ 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 = +@@ -77,7 +81,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(); + } diff --git a/net-im/kaidan/files/patch-src_QrCodeGenerator.cpp b/net-im/kaidan/files/patch-src_QrCodeGenerator.cpp new file mode 100644 index 000000000000..f72eba0b2bdb --- /dev/null +++ b/net-im/kaidan/files/patch-src_QrCodeGenerator.cpp @@ -0,0 +1,25 @@ +--- src/QrCodeGenerator.cpp.orig 2023-01-10 10:34:19 UTC ++++ src/QrCodeGenerator.cpp +@@ -33,6 +33,10 @@ + #include + #include + ++#include ++#define ZXING_VERSION \ ++ QT_VERSION_CHECK(ZXING_VERSION_MAJOR, ZXING_VERSION_MINOR, ZXING_VERSION_PATCH) ++ + #include + #include + +@@ -74,7 +78,11 @@ QImage QrCodeGenerator::generateQrCode(int edgePixelCo + 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) {