Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package prison-qt5 for openSUSE:Factory checked in at 2023-06-11 19:53:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/prison-qt5 (Old) and /work/SRC/openSUSE:Factory/.prison-qt5.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "prison-qt5" Sun Jun 11 19:53:52 2023 rev:82 rq:1091963 version:5.107.0 Changes: -------- --- /work/SRC/openSUSE:Factory/prison-qt5/prison-qt5.changes 2023-05-14 16:33:45.891789930 +0200 +++ /work/SRC/openSUSE:Factory/.prison-qt5.new.15902/prison-qt5.changes 2023-06-11 19:56:41.199668580 +0200 @@ -1,0 +2,11 @@ +Mon Jun 5 07:44:14 UTC 2023 - Christophe Marin <christo...@krop.fr> + +- Update to 5.107.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/frameworks/5/5.107.0 +- Changes since 5.106.0: + * Add EAN13 support + * Factor out code for interfacing with ZXing for barcode generation + +------------------------------------------------------------------- Old: ---- prison-5.106.0.tar.xz prison-5.106.0.tar.xz.sig New: ---- prison-5.107.0.tar.xz prison-5.107.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ prison-qt5.spec ++++++ --- /var/tmp/diff_new_pack.sX87JN/_old 2023-06-11 19:56:41.775672053 +0200 +++ /var/tmp/diff_new_pack.sX87JN/_new 2023-06-11 19:56:41.779672078 +0200 @@ -27,7 +27,7 @@ # Only needed for the package signature condition %bcond_without released Name: prison-qt5 -Version: 5.106.0 +Version: 5.107.0 Release: 0 Summary: Barcode abstraction layer library License: MIT ++++++ prison-5.106.0.tar.xz -> prison-5.107.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/CMakeLists.txt new/prison-5.107.0/CMakeLists.txt --- old/prison-5.106.0/CMakeLists.txt 2023-05-06 11:32:02.000000000 +0200 +++ new/prison-5.107.0/CMakeLists.txt 2023-06-03 11:52:49.000000000 +0200 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.16) -set(KF_VERSION "5.106.0") # handled by release scripts +set(KF_VERSION "5.107.0") # handled by release scripts project(prison VERSION ${KF_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.106.0 NO_MODULE) +find_package(ECM 5.107.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${ECM_MODULE_PATH}") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/README.md new/prison-5.107.0/README.md --- old/prison-5.106.0/README.md 2023-05-06 11:32:02.000000000 +0200 +++ new/prison-5.107.0/README.md 2023-06-03 11:52:49.000000000 +0200 @@ -12,8 +12,9 @@ - Aztec - Code39 - Code93 -- Code128 -- PDF417 +- [Code128](https://en.wikipedia.org/wiki/Code_128) +- [PDF417](https://en.wikipedia.org/wiki/PDF417) (ISO/IEC 15438) +- [EAN13](https://en.wikipedia.org/wiki/International_Article_Number) Prison currently ships the org.kde.prison.Barcode QML element that can be used to render barcodes in QML code. @@ -33,7 +34,7 @@ [libqrencode](https://fukuchi.org/works/qrencode/) for generation of [QRCode](https://en.wikipedia.org/wiki/QR_Code) barcodes and [ZXing](https://github.com/nu-book/zxing-cpp) for generating -[PDF417](https://en.wikipedia.org/wiki/PDF417) barcodes. +[EAN13 and PDF417](https://en.wikipedia.org/wiki/PDF417) barcodes. # Prison Scanner diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/autotests/CMakeLists.txt new/prison-5.107.0/autotests/CMakeLists.txt --- old/prison-5.106.0/autotests/CMakeLists.txt 2023-05-06 11:32:02.000000000 +0200 +++ new/prison-5.107.0/autotests/CMakeLists.txt 2023-06-03 11:52:49.000000000 +0200 @@ -34,3 +34,8 @@ ecm_add_test(datamatrixtest.cpp datamatrix/datamatrix.qrc TEST_NAME prison-datamatrixtest LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::Prison) endif() ecm_add_test(qrtest.cpp qr/qr.qrc TEST_NAME prison-qrtest LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test KF5::Prison) + +if (TARGET ZXing::ZXing) + ecm_add_test(zxingutiltest.cpp ${PROJECT_SOURCE_DIR}/src/lib/zxingutil.cpp TEST_NAME prison-zxingutiltest LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test ZXing::ZXing KF5::Prison) + kde_source_files_enable_exceptions(${PROJECT_SOURCE_DIR}/src/lib/zxingutil.cpp ) +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/autotests/zxingutiltest.cpp new/prison-5.107.0/autotests/zxingutiltest.cpp --- old/prison-5.106.0/autotests/zxingutiltest.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.107.0/autotests/zxingutiltest.cpp 2023-06-03 11:52:49.000000000 +0200 @@ -0,0 +1,39 @@ +/* + SPDX-FileCopyrightText: 2017 Volker Krause <vkra...@kde.org> + + SPDX-License-Identifier: MIT +*/ + +#include "../src/lib/zxingutil_p.h" + +#include <QDebug> +#include <QObject> +#include <QTest> + +using namespace Prison; + +class ZXingUtilTest : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void testToStdWString() + { + auto w = ZXingUtil::toStdWString(QStringLiteral("KDE")); + QCOMPARE(w.size(), 3); + QCOMPARE(w[0], 'K'); + + w = ZXingUtil::toStdWString(QByteArray("KDE")); + QCOMPARE(w.size(), 3); + QCOMPARE(w[0], 'K'); + + w = ZXingUtil::toStdWString(QByteArray("\x80\x00\x7f", 3)); + QCOMPARE(w.size(), 3); + QCOMPARE(w[0], 0x80); + QCOMPARE(w[1], 0x00); + QCOMPARE(w[2], 0x7f); + } +}; + +QTEST_APPLESS_MAIN(ZXingUtilTest) + +#include "zxingutiltest.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/src/lib/CMakeLists.txt new/prison-5.107.0/src/lib/CMakeLists.txt --- old/prison-5.106.0/src/lib/CMakeLists.txt 2023-05-06 11:32:02.000000000 +0200 +++ new/prison-5.107.0/src/lib/CMakeLists.txt 2023-06-03 11:52:49.000000000 +0200 @@ -42,9 +42,17 @@ target_sources(KF5Prison PRIVATE datamatrixbarcode.cpp datamatrixbarcode.h) endif() if(TARGET ZXing::ZXing) - target_sources(KF5Prison PRIVATE pdf417barcode.cpp pdf417barcode.h) + target_sources(KF5Prison PRIVATE + pdf417barcode.cpp + pdf417barcode.h + zxingutil.cpp + ) endif() -kde_source_files_enable_exceptions(pdf417barcode.cpp) +kde_source_files_enable_exceptions( + pdf417barcode.cpp + prison.cpp + zxingutil.cpp +) ecm_qt_declare_logging_category(KF5Prison HEADER prison_debug.h diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/src/lib/pdf417barcode.cpp new/prison-5.107.0/src/lib/pdf417barcode.cpp --- old/prison-5.106.0/src/lib/pdf417barcode.cpp 2023-05-06 11:32:02.000000000 +0200 +++ new/prison-5.107.0/src/lib/pdf417barcode.cpp 2023-06-03 11:52:49.000000000 +0200 @@ -5,6 +5,7 @@ */ #include "pdf417barcode.h" +#include "zxingutil_p.h" #include <ZXing/BitMatrix.h> #include <ZXing/MultiFormatWriter.h> @@ -46,15 +47,7 @@ } // aspect ratio 4 is hard-coded in ZXing const auto matrix = writer.encode(input, 4, 1); - - QImage image(matrix.width(), matrix.height(), QImage::Format_ARGB32); - for (int y = 0; y < matrix.height(); ++y) { - for (int x = 0; x < matrix.width(); ++x) { - image.setPixel(x, y, matrix.get(x, y) ? foregroundColor().rgb() : backgroundColor().rgb()); - } - } - - return image; + return ZXingUtil::toImage(matrix, foregroundColor(), backgroundColor()); } catch (const std::invalid_argument &e) { }; // input too large return {}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/src/lib/prison.cpp new/prison-5.107.0/src/lib/prison.cpp --- old/prison-5.106.0/src/lib/prison.cpp 2023-05-06 11:32:02.000000000 +0200 +++ new/prison-5.107.0/src/lib/prison.cpp 2023-06-03 11:52:49.000000000 +0200 @@ -5,6 +5,8 @@ */ #include "prison.h" +#include <config-prison.h> + #include "aztecbarcode.h" #include "code128barcode.h" #include "code39barcode.h" @@ -12,7 +14,9 @@ #include "datamatrixbarcode.h" #include "pdf417barcode.h" #include "qrcodebarcode.h" -#include <config-prison.h> +#if HAVE_ZXING +#include "zxingonedbarcode_p.h" +#endif Prison::AbstractBarcode *Prison::createBarcode(BarcodeType type) { @@ -38,6 +42,8 @@ #if HAVE_ZXING case Prison::PDF417: return new Pdf417Barcode; + case Prison::EAN13: + return new ZXingOneDBarcode<ZXing::BarcodeFormat::EAN13>; #endif } return nullptr; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/src/lib/prison.h new/prison-5.107.0/src/lib/prison.h --- old/prison-5.106.0/src/lib/prison.h 2023-05-06 11:32:02.000000000 +0200 +++ new/prison-5.107.0/src/lib/prison.h 2023-06-03 11:52:49.000000000 +0200 @@ -37,6 +37,8 @@ Code128, /** PDF417 barcode */ PDF417, + /** EAN13 barcode */ + EAN13, }; /** * Factory method to create a barcode of a given type. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/src/lib/zxingonedbarcode_p.h new/prison-5.107.0/src/lib/zxingonedbarcode_p.h --- old/prison-5.106.0/src/lib/zxingonedbarcode_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.107.0/src/lib/zxingonedbarcode_p.h 2023-06-03 11:52:49.000000000 +0200 @@ -0,0 +1,46 @@ +/* + SPDX-FileCopyrightText: 2023 Volker Krause <vkra...@kde.org> + SPDX-License-Identifier: MIT +*/ + +#ifndef PRISON_ZXINGONEDBARCODE_H +#define PRISON_ZXINGONEDBARCODE_H + +#include "abstractbarcode.h" +#include "zxingutil_p.h" + +#include <QVariant> + +#include <ZXing/BitMatrix.h> +#include <ZXing/MultiFormatWriter.h> + +#include <stdexcept> + +namespace Prison +{ +/** Generic support for ZXing 1D barcodes. */ +template<ZXing::BarcodeFormat Format> +class ZXingOneDBarcode : public AbstractBarcode +{ +public: + explicit inline ZXingOneDBarcode() + : AbstractBarcode(AbstractBarcode::OneDimension) + { + } + +protected: + inline QImage paintImage(const QSizeF &) override + { + try { + ZXing::MultiFormatWriter writer(Format); + const auto matrix = writer.encode(ZXingUtil::toStdWString(data().isEmpty() ? QVariant(byteArrayData()) : QVariant(data())), 1, 1); + return ZXingUtil::toImage(matrix, foregroundColor(), backgroundColor()); + } catch (const std::invalid_argument &e) { + }; // input too large or incompatible + return {}; + } +}; + +} + +#endif // PRISON_PDF417BARCODE_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/src/lib/zxingutil.cpp new/prison-5.107.0/src/lib/zxingutil.cpp --- old/prison-5.106.0/src/lib/zxingutil.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.107.0/src/lib/zxingutil.cpp 2023-06-03 11:52:49.000000000 +0200 @@ -0,0 +1,45 @@ +/* + SPDX-FileCopyrightText: 2021 Volker Krause <vkra...@kde.org> + SPDX-License-Identifier: MIT +*/ + +#include "zxingutil_p.h" + +#include <QImage> +#include <QVariant> + +#include <ZXing/BitMatrix.h> + +using namespace Prison; + +std::wstring ZXingUtil::toStdWString(const QVariant &data) +{ + if (data.userType() == QMetaType::QString) { + return data.toString().toStdWString(); + } + if (data.userType() == QMetaType::QByteArray) { + const auto b = data.toByteArray(); + std::wstring ws; + ws.reserve(b.size()); + // ensure we explicitly copy unsigned bytes here, ie. each byte ends up in the least significant byte of + // the std::wstring. If we end up converting to a signed value inbetween, values > 127 end up negative and + // will be wrongly represented in the std::wstring + for (uint8_t c : b) { + ws.push_back(c); + } + return ws; + } + + return {}; +} + +QImage ZXingUtil::toImage(const ZXing::BitMatrix &matrix, const QColor &foreground, const QColor &background) +{ + QImage image(matrix.width(), matrix.height(), QImage::Format_ARGB32); + for (int y = 0; y < matrix.height(); ++y) { + for (int x = 0; x < matrix.width(); ++x) { + image.setPixel(x, y, matrix.get(x, y) ? foreground.rgb() : background.rgb()); + } + } + return image; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/src/lib/zxingutil_p.h new/prison-5.107.0/src/lib/zxingutil_p.h --- old/prison-5.106.0/src/lib/zxingutil_p.h 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.107.0/src/lib/zxingutil_p.h 2023-06-03 11:52:49.000000000 +0200 @@ -0,0 +1,36 @@ +/* + SPDX-FileCopyrightText: 2021 Volker Krause <vkra...@kde.org> + SPDX-License-Identifier: MIT +*/ + +#ifndef PRISON_ZXINGUTILS_P_H +#define PRISON_ZXINGUTILS_P_H + +#include <string> + +namespace ZXing +{ +class BitMatrix; +} + +class QColor; +class QImage; +class QVariant; + +namespace Prison +{ +/** Utilities for interfacing with ZXing. */ +namespace ZXingUtil +{ +/** Convert barcode content (string or byte array) to the input + * format expected by ZXing. + */ +std::wstring toStdWString(const QVariant &data); + +/** Convert the bitmatrix output of ZXing to a QImage. */ +QImage toImage(const ZXing::BitMatrix &matrix, const QColor &foreground, const QColor &background); +} + +} + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/src/quick/barcodequickitem.h new/prison-5.107.0/src/quick/barcodequickitem.h --- old/prison-5.106.0/src/quick/barcodequickitem.h 2023-05-06 11:32:02.000000000 +0200 +++ new/prison-5.107.0/src/quick/barcodequickitem.h 2023-06-03 11:52:49.000000000 +0200 @@ -47,6 +47,7 @@ Code93 = Prison::Code93, Code128 = Prison::Code128, PDF417 = Prison::PDF417, + EAN13 = Prison::EAN13, }; Q_ENUM(BarcodeType) explicit BarcodeQuickItem(QQuickItem *parent = nullptr); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.106.0/tests/barcode.qml new/prison-5.107.0/tests/barcode.qml --- old/prison-5.106.0/tests/barcode.qml 2023-05-06 11:32:02.000000000 +0200 +++ new/prison-5.107.0/tests/barcode.qml 2023-06-03 11:52:49.000000000 +0200 @@ -24,7 +24,7 @@ } ComboBox { id: typeCombobox - model: [ "Null", "QRCode", "DataMatrix", "Aztec", "Code39", "Code93", "Code128", "PDF417" ] + model: [ "Null", "QRCode", "DataMatrix", "Aztec", "Code39", "Code93", "Code128", "PDF417", "EAN13" ] currentIndex: 3 } }