Hello community, here is the log from the commit of package prison-qt5 for openSUSE:Factory checked in at 2018-03-20 21:48:49 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/prison-qt5 (Old) and /work/SRC/openSUSE:Factory/.prison-qt5.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "prison-qt5" Tue Mar 20 21:48:49 2018 rev:16 rq:586870 version:5.44.0 Changes: -------- --- /work/SRC/openSUSE:Factory/prison-qt5/prison-qt5.changes 2018-02-16 21:36:19.013174442 +0100 +++ /work/SRC/openSUSE:Factory/.prison-qt5.new/prison-qt5.changes 2018-03-20 21:48:50.762557689 +0100 @@ -1,0 +2,13 @@ +Mon Mar 12 23:29:43 CET 2018 - lbeltrame@kde.org + +- Update to 5.44.0 + * New feature release + * For more details please see: + * https://www.kde.org/announcements/kde-frameworks-5.44.0.php +- Changes since 5.43.0: + * Update links to dependencies, and mark Android as officially supported + * Make DMTX dependency optional + * Add QML support for Prison + * Set minimum size on 1D barcodes as well + +------------------------------------------------------------------- Old: ---- prison-5.43.0.tar.xz New: ---- prison-5.44.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ prison-qt5.spec ++++++ --- /var/tmp/diff_new_pack.qaKaaY/_old 2018-03-20 21:48:51.826519374 +0100 +++ /var/tmp/diff_new_pack.qaKaaY/_new 2018-03-20 21:48:51.830519230 +0100 @@ -19,13 +19,13 @@ %define sonum 5 %define rname prison %define _libname KF5Prison -%define _tar_path 5.43 +%define _tar_path 5.44 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) %{!?_kf5_bugfix_version: %global _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} Name: prison-qt5 -Version: 5.43.0 +Version: 5.44.0 Release: 0 Summary: Barcode abstraction layer library License: MIT ++++++ prison-5.43.0.tar.xz -> prison-5.44.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/.gitignore new/prison-5.44.0/.gitignore --- old/prison-5.43.0/.gitignore 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/.gitignore 2018-03-03 10:54:09.000000000 +0100 @@ -1 +1,3 @@ *~ +*.qmlc +*.kdev4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/CMakeLists.txt new/prison-5.44.0/CMakeLists.txt --- old/prison-5.43.0/CMakeLists.txt 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/CMakeLists.txt 2018-03-03 10:54:09.000000000 +0100 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.0) -set(KF5_VERSION "5.43.0") # handled by release scripts +set(KF5_VERSION "5.44.0") # handled by release scripts project(prison VERSION ${KF5_VERSION}) # ECM setup include(FeatureSummary) -find_package(ECM 5.43.0 NO_MODULE) +find_package(ECM 5.44.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/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}") @@ -27,10 +27,11 @@ set(REQUIRED_QT_VERSION 5.7.0) find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Core Gui) +find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG OPTIONAL_COMPONENTS Quick) find_package(QRencode) set_package_properties(QRencode PROPERTIES TYPE REQUIRED) find_package(Dmtx) -set_package_properties(Dmtx PROPERTIES TYPE REQUIRED) +set_package_properties(Dmtx PROPERTIES TYPE RECOMMENDED) if (Qt5_POSITION_INDEPENDENT_CODE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/Mainpage.dox new/prison-5.44.0/Mainpage.dox --- old/prison-5.43.0/Mainpage.dox 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/Mainpage.dox 2018-03-03 10:54:09.000000000 +0100 @@ -21,9 +21,9 @@ * %prison isn't as such designed for the latter, it will probably work, but patches implementing barcode * support for such barcodes will not be accepted. A example is <a href="http://en.wikipedia.org/wiki/EZcode">EZCode</a>. * - * %prison is currently using <a href="http://www.libdmtx.org/">libdmtx</a> for generation of <a href="http://en.wikipedia.org/wiki/Datamatrix">DataMatrix</a> barcodes + * %prison is currently using <a href="https://github.com/dmtx/libdmtx">libdmtx</a> for generation of <a href="http://en.wikipedia.org/wiki/Datamatrix">DataMatrix</a> barcodes * - * %prison is currently using <a href="http://fukuchi.org/works/qrencode/index.en.html">libqrencode</a> for generation of <a href="http://en.wikipedia.org/wiki/QR_Code">QRCode</a> barcodes + * %prison is currently using <a href="https://fukuchi.org/works/qrencode/">libqrencode</a> for generation of <a href="http://en.wikipedia.org/wiki/QR_Code">QRCode</a> barcodes * */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/README.md new/prison-5.44.0/README.md --- old/prison-5.43.0/README.md 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/README.md 2018-03-03 10:54:09.000000000 +0100 @@ -23,7 +23,7 @@ patches implementing barcode support for such barcodes will not be accepted. An example is [EZCode](https://en.wikipedia.org/wiki/EZcode). -Prison is currently using [libdmtx](http://libdmtx.sourceforge.net/) for generation of +Prison is currently using [libdmtx](https://github.com/dmtx/libdmtx) for generation of [DataMatrix](https://en.wikipedia.org/wiki/Datamatrix) barcodes and [libqrencode](https://fukuchi.org/works/qrencode/) for generation of [QRCode](https://en.wikipedia.org/wiki/QR_Code) barcodes. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/cmake/FindDmtx.cmake new/prison-5.44.0/cmake/FindDmtx.cmake --- old/prison-5.43.0/cmake/FindDmtx.cmake 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/cmake/FindDmtx.cmake 2018-03-03 10:54:09.000000000 +0100 @@ -76,7 +76,7 @@ include(FeatureSummary) set_package_properties(Dmtx PROPERTIES - URL "http://libdmtx.sourceforge.net/" + URL "https://github.com/dmtx/libdmtx" DESCRIPTION "The Datamatrix library" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/cmake/FindQRencode.cmake new/prison-5.44.0/cmake/FindQRencode.cmake --- old/prison-5.43.0/cmake/FindQRencode.cmake 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/cmake/FindQRencode.cmake 2018-03-03 10:54:09.000000000 +0100 @@ -76,6 +76,6 @@ include(FeatureSummary) set_package_properties(QRencode PROPERTIES - URL "http://megaui.net/fukuchi/works/qrencode/index.en.html/" + URL "https://fukuchi.org/works/qrencode/" DESCRIPTION "The QRencode library" ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/metainfo.yaml new/prison-5.44.0/metainfo.yaml --- old/prison-5.43.0/metainfo.yaml 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/metainfo.yaml 2018-03-03 10:54:09.000000000 +0100 @@ -5,6 +5,7 @@ platforms: - name: Linux - name: FreeBSD + - name: Android portingAid: false deprecated: false release: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/CMakeLists.txt new/prison-5.44.0/src/CMakeLists.txt --- old/prison-5.43.0/src/CMakeLists.txt 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/src/CMakeLists.txt 2018-03-03 10:54:09.000000000 +0100 @@ -1,2 +1,5 @@ add_subdirectory(lib) add_subdirectory(tools) +if(TARGET Qt5::Quick) + add_subdirectory(quick) +endif() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/lib/CMakeLists.txt new/prison-5.44.0/src/lib/CMakeLists.txt --- old/prison-5.43.0/src/lib/CMakeLists.txt 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/src/lib/CMakeLists.txt 2018-03-03 10:54:09.000000000 +0100 @@ -1,4 +1,8 @@ include(CMakePackageConfigHelpers) +if(TARGET Dmtx::Dmtx) + set(HAVE_DMTX 1) +endif() +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config-prison.h.in ${CMAKE_CURRENT_BINARY_DIR}/config-prison.h) set(prison_SRCS abstractbarcode.cpp @@ -6,11 +10,13 @@ bitvector.cpp code39barcode.cpp code93barcode.cpp - datamatrixbarcode.cpp qrcodebarcode.cpp prison.cpp reedsolomon.cpp ) +if(TARGET Dmtx::Dmtx) + list(APPEND prison_SRCS datamatrixbarcode.cpp) +endif() ecm_qt_declare_logging_category(prison_SRCS HEADER prison_debug.h IDENTIFIER Prison::Log CATEGORY_NAME kf5.prison) add_library(KF5Prison ${prison_SRCS}) @@ -26,9 +32,11 @@ PUBLIC Qt5::Gui PRIVATE - Dmtx::Dmtx QRencode::QRencode ) +if(TARGET Dmtx::Dmtx) + target_link_libraries(KF5Prison PRIVATE Dmtx::Dmtx) +endif() set_target_properties(KF5Prison PROPERTIES VERSION ${PRISON_VERSION_STRING} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/lib/code39barcode.cpp new/prison-5.44.0/src/lib/code39barcode.cpp --- old/prison-5.43.0/src/lib/code39barcode.cpp 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/src/lib/code39barcode.cpp 2018-03-03 10:54:09.000000000 +0100 @@ -142,6 +142,7 @@ // then maximize narrow bar width int smallWidth = (w - largeWidth*wide) / narrow; // if the requested size was too small return a null image + setMinimumSize(QSize(2* wide + narrow, 10)); if(largeWidth<2) { return QImage(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/lib/code93barcode.cpp new/prison-5.44.0/src/lib/code93barcode.cpp --- old/prison-5.43.0/src/lib/code93barcode.cpp 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/src/lib/code93barcode.cpp 2018-03-03 10:54:09.000000000 +0100 @@ -291,6 +291,7 @@ // try to fill the requested size const int barWidth = int(size.width() / barcode.size()); + setMinimumSize(QSize(barcode.size(), 10)); if(barWidth < 1 ) { // can't go below 1 pixel return QImage(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/lib/config-prison.h.in new/prison-5.44.0/src/lib/config-prison.h.in --- old/prison-5.43.0/src/lib/config-prison.h.in 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.44.0/src/lib/config-prison.h.in 2018-03-03 10:54:09.000000000 +0100 @@ -0,0 +1,31 @@ +/* + Copyright (c) 2018 Volker Krause <vkrause@kde.org> + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. +*/ + +#ifndef PRISON_CONFIG_H +#define PRISON_CONFIG_H + +#cmakedefine HAVE_DMTX + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/lib/prison.cpp new/prison-5.44.0/src/lib/prison.cpp --- old/prison-5.43.0/src/lib/prison.cpp 2018-02-05 09:12:24.000000000 +0100 +++ new/prison-5.44.0/src/lib/prison.cpp 2018-03-03 10:54:09.000000000 +0100 @@ -24,6 +24,7 @@ */ +#include <config-prison.h> #include "prison.h" #include "aztecbarcode.h" #include "datamatrixbarcode.h" @@ -40,7 +41,11 @@ case Prison::QRCode: return new QRCodeBarcode; case Prison::DataMatrix: +#ifdef HAVE_DMTX return new DataMatrixBarcode; +#else + return nullptr; +#endif case Prison::Aztec: return new AztecBarcode; case Prison::Code39: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/quick/CMakeLists.txt new/prison-5.44.0/src/quick/CMakeLists.txt --- old/prison-5.43.0/src/quick/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.44.0/src/quick/CMakeLists.txt 2018-03-03 10:54:09.000000000 +0100 @@ -0,0 +1,7 @@ +add_library(prisonquickplugin SHARED + barcodequickitem.cpp + prisonquickplugin.cpp +) +target_link_libraries(prisonquickplugin PRIVATE Qt5::Quick KF5::Prison) +install(TARGETS prisonquickplugin DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/prison) +install(FILES qmldir DESTINATION ${KDE_INSTALL_QMLDIR}/org/kde/prison) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/quick/barcodequickitem.cpp new/prison-5.44.0/src/quick/barcodequickitem.cpp --- old/prison-5.43.0/src/quick/barcodequickitem.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.44.0/src/quick/barcodequickitem.cpp 2018-03-03 10:54:09.000000000 +0100 @@ -0,0 +1,147 @@ +/* + Copyright (c) 2018 Volker Krause <vkrause@kde.org> + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "barcodequickitem.h" + +#include <prison/prison.h> + +#include <QDebug> +#include <QPainter> + +using namespace Prison; + +BarcodeQuickItem::BarcodeQuickItem(QQuickItem *parent) + : QQuickPaintedItem(parent) +{ +} + +BarcodeQuickItem::~BarcodeQuickItem() = default; + +QString BarcodeQuickItem::content() const +{ + return m_content; +} + +void BarcodeQuickItem::setContent(const QString& content) +{ + if (m_content == content) + return; + m_content = content; + emit contentChanged(); + updateBarcode(); +} + +BarcodeQuickItem::BarcodeType BarcodeQuickItem::barcodeType() const +{ + return static_cast<BarcodeType>(m_type); +} + +void BarcodeQuickItem::setBarcodeType(BarcodeQuickItem::BarcodeType type) +{ + if (m_type == static_castPrison::BarcodeType(type)) + return; + m_type = static_castPrison::BarcodeType(type); + emit barcodeTypeChanged(); + m_barcode.reset(); + updateBarcode(); +} + +QColor BarcodeQuickItem::foregroundColor() const +{ + return m_fgColor; +} + +void BarcodeQuickItem::setForegroundColor(const QColor &color) +{ + if (m_fgColor == color) + return; + m_fgColor = color; + emit foregroundColorChanged(); + updateBarcode(); +} + +QColor BarcodeQuickItem::backgroundColor() const +{ + return m_bgColor; +} + +void BarcodeQuickItem::setBackgroundColor(const QColor &color) +{ + if (m_bgColor == color) + return; + m_bgColor = color; + emit backgroundColorChanged(); + updateBarcode(); +} + +void BarcodeQuickItem::paint(QPainter* painter) +{ + if (!m_barcode) + return; + + const auto w_max = std::max(implicitWidth(), width()); + const auto h_max = std::max(implicitHeight(), height()); + const auto scale = std::min(w_max / implicitWidth(), h_max / implicitHeight()); + const auto w = scale * implicitWidth(); + const auto h = scale * implicitHeight(); + const auto x = (width() - w) / 2; + const auto y = (height() - h) / 2; + + const auto img = m_barcode->toImage(m_barcode->minimumSize()); + painter->setRenderHint(QPainter::SmoothPixmapTransform, false); + painter->drawImage(QRectF(x, y, w, h), img, img.rect()); +} + +void BarcodeQuickItem::componentComplete() +{ + QQuickPaintedItem::componentComplete(); + updateBarcode(); +} + +void BarcodeQuickItem::updateBarcode() +{ + if (!isComponentComplete()) + return; + + if (m_type == Prison::Null || m_content.isEmpty()) { + m_barcode.reset(); + update(); + return; + } + + if (!m_barcode) + m_barcode.reset(Prison::createBarcode(m_type)); + if (m_barcode) { + m_barcode->setData(m_content); + m_barcode->setForegroundColor(m_fgColor); + m_barcode->setBackgroundColor(m_bgColor); + // minimumSize() is only providing valid results after the first call to toImage()... + m_barcode->toImage(m_barcode->minimumSize()); + setImplicitSize(m_barcode->minimumSize().width(), m_barcode->minimumSize().height()); + } + + update(); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/quick/barcodequickitem.h new/prison-5.44.0/src/quick/barcodequickitem.h --- old/prison-5.43.0/src/quick/barcodequickitem.h 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.44.0/src/quick/barcodequickitem.h 2018-03-03 10:54:09.000000000 +0100 @@ -0,0 +1,94 @@ +/* + Copyright (c) 2018 Volker Krause <vkrause@kde.org> + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#ifndef PRISON_BARCODEQUICKITEM_H +#define PRISON_BARCODEQUICKITEM_H + +#include <prison/prison.h> + +#include <QColor> +#include <QQuickPaintedItem> + +#include <memory> + +namespace Prison { + +class AbstractBarcode; + +class BarcodeQuickItem : public QQuickPaintedItem +{ + Q_OBJECT + Q_PROPERTY(QString content READ content WRITE setContent NOTIFY contentChanged) + Q_PROPERTY(BarcodeType barcodeType READ barcodeType WRITE setBarcodeType NOTIFY barcodeTypeChanged) + Q_PROPERTY(QColor foregroundColor READ foregroundColor WRITE setForegroundColor NOTIFY foregroundColorChanged) + Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged) + +public: + enum BarcodeType { + Null = Prison::Null, + QRCode = Prison::QRCode, + DataMatrix = Prison::DataMatrix, + Aztec = Prison::Aztec, + Code39 = Prison::Code39, + Code93 = Prison::Code93 + }; + Q_ENUM(BarcodeType) + explicit BarcodeQuickItem(QQuickItem *parent = nullptr); + ~BarcodeQuickItem(); + + QString content() const; + void setContent(const QString &data); + + Prison::BarcodeQuickItem::BarcodeType barcodeType() const; + void setBarcodeType(Prison::BarcodeQuickItem::BarcodeType type); + + QColor foregroundColor() const; + void setForegroundColor(const QColor &color); + QColor backgroundColor() const; + void setBackgroundColor(const QColor &color); + + void paint(QPainter *painter) override; + void componentComplete() override; + +Q_SIGNALS: + void contentChanged(); + void barcodeTypeChanged(); + void foregroundColorChanged(); + void backgroundColorChanged(); + +private: + void updateBarcode(); + + QString m_content; + std::unique_ptr<AbstractBarcode> m_barcode; + QColor m_fgColor = Qt::black; + QColor m_bgColor = Qt::white; + Prison::BarcodeType m_type = Prison::Null; +}; + +} + +#endif // PRISON_BARCODEQUICKITEM_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/quick/prisonquickplugin.cpp new/prison-5.44.0/src/quick/prisonquickplugin.cpp --- old/prison-5.43.0/src/quick/prisonquickplugin.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.44.0/src/quick/prisonquickplugin.cpp 2018-03-03 10:54:09.000000000 +0100 @@ -0,0 +1,52 @@ +/* + Copyright (c) 2018 Volker Krause <vkrause@kde.org> + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +*/ + +#include "barcodequickitem.h" + +#include <prison/prison.h> + +#include <QtQml/QQmlExtensionPlugin> + +class PrisonQuickPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.kde.prison") + +public: + PrisonQuickPlugin(QObject *parent = nullptr) + : QQmlExtensionPlugin(parent) + {} + + void registerTypes(const char *uri) override; +}; + + +void PrisonQuickPlugin::registerTypes(const char *uri) +{ + qmlRegisterTypePrison::BarcodeQuickItem(uri, 1, 0, "Barcode"); +} + +#include "prisonquickplugin.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/src/quick/qmldir new/prison-5.44.0/src/quick/qmldir --- old/prison-5.43.0/src/quick/qmldir 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.44.0/src/quick/qmldir 2018-03-03 10:54:09.000000000 +0100 @@ -0,0 +1,2 @@ +module org.kde.prison +plugin prisonquickplugin diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/prison-5.43.0/tests/barcode.qml new/prison-5.44.0/tests/barcode.qml --- old/prison-5.43.0/tests/barcode.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/prison-5.44.0/tests/barcode.qml 2018-03-03 10:54:09.000000000 +0100 @@ -0,0 +1,61 @@ +/* + Copyright (c) 2018 Volker Krause <vkrause@kde.org> + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + +*/ + +import QtQuick 2.0 +import QtQuick.Controls 2.0 +import QtQuick.Layouts 1.0 +import org.kde.prison 1.0 as Prison +Rectangle { + width: 640 + height: 320 + color: "lightsteelblue" + ColumnLayout { + anchors.fill: parent + + RowLayout { + Layout.fillWidth: true + TextField { + id: contentEdit + Layout.fillWidth: true + text: "KF5::Prison - The KDE barcode generation framework." + } + ComboBox { + id: typeCombobox + model: [ "Null", "QRCode", "DataMatrix", "Aztec", "Code39", "Code93" ] + currentIndex: 3 + } + } + + Prison.Barcode { + Layout.fillWidth: true + Layout.fillHeight: true + content: contentEdit.text + barcodeType: typeCombobox.currentIndex +// foregroundColor: "red" +// backgroundColor: "green" + } + } +}