Hello community, here is the log from the commit of package kdeclarative for openSUSE:Factory checked in at 2014-11-11 01:09:48 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kdeclarative (Old) and /work/SRC/openSUSE:Factory/.kdeclarative.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kdeclarative" Changes: -------- --- /work/SRC/openSUSE:Factory/kdeclarative/kdeclarative.changes 2014-10-07 16:00:14.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kdeclarative.new/kdeclarative.changes 2014-11-11 01:09:58.000000000 +0100 @@ -1,0 +2,10 @@ +Sun Nov 2 17:47:25 UTC 2014 - hrvoje.sen...@gmail.com + +- Update to 5.4.0 + * Optimize IconItem in QIconItem in memory and speed + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.4.0.php +- Split out libKF5QuickAddons library, and QML components into + separate subpackages + +------------------------------------------------------------------- Old: ---- kdeclarative-5.3.0.tar.xz New: ---- kdeclarative-5.4.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kdeclarative.spec ++++++ --- /var/tmp/diff_new_pack.k5bbi8/_old 2014-11-11 01:10:00.000000000 +0100 +++ /var/tmp/diff_new_pack.k5bbi8/_new 2014-11-11 01:10:00.000000000 +0100 @@ -18,11 +18,11 @@ %define lname libKF5Declarative5 Name: kdeclarative -Version: 5.3.0 +Version: 5.4.0 Release: 0 %define kf5_version %{version} BuildRequires: cmake >= 2.8.12 -BuildRequires: extra-cmake-modules >= 1.3.0 +BuildRequires: extra-cmake-modules >= 1.4.0 BuildRequires: fdupes BuildRequires: kconfig-devel >= %{kf5_version} BuildRequires: kcoreaddons-devel >= %{kf5_version} @@ -43,7 +43,7 @@ License: LGPL-2.1+ Group: System/GUI/KDE Url: http://www.kde.org -Source: http://download.kde.org/stable/frameworks/%{version}/%{name}-%{version}.tar.xz +Source: http://download.kde.org/stable/frameworks/5.4/%{name}-%{version}.tar.xz Source1: baselibs.conf BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -58,12 +58,28 @@ %description -n %lname KDeclarative provides integration of QML and KDE workspaces. +%package -n libKF5QuickAddons5 +Summary: Integration of QML and KDE workspaces +Group: System/GUI/KDE + +%description -n libKF5QuickAddons5 +KDeclarative provides integration of QML and KDE workspaces. + +%package components +Summary: KDeclarative QML components +Group: System/GUI/KDE + +%description components +KDeclarative provides integration of QML and KDE workspaces. + %package devel Summary: Integration of QML and KDE workspaces: Build Environment Group: Development/Libraries/KDE Requires: %lname = %{version} +Requires: %{name}-components = %{version} Requires: extra-cmake-modules Requires: kio-devel >= %{kf5_version} +Requires: libKF5QuickAddons5 = %{version} %description devel KDeclarative provides integration of QML and KDE workspaces. @@ -87,21 +103,36 @@ %postun -n %lname -p /sbin/ldconfig +%post -n libKF5QuickAddons5 -p /sbin/ldconfig + +%postun -n libKF5QuickAddons5 -p /sbin/ldconfig + %files -n %lname-lang -f %{name}5.lang %files -n %lname %defattr(-,root,root) %doc COPYING* README* %{_kf5_libdir}/libKF5Declarative.so.* + +%files -n libKF5QuickAddons5 +%defattr(-,root,root) +%doc COPYING* README* +%{_kf5_libdir}/libKF5QuickAddons.so.* + +%files components +%defattr(-,root,root) +%doc COPYING* README* %{_kf5_libdir}/qt5/qml/ %files devel %defattr(-,root,root) %{_kf5_libdir}/libKF5Declarative.so +%{_kf5_libdir}/libKF5QuickAddons.so %{_kf5_libdir}/cmake/KF5Declarative/ %{_kf5_includedir}/*.h %dir %{_kf5_includedir}/*/ %{_kf5_includedir}/*/ %{_kf5_mkspecsdir}/qt_KDeclarative.pri +%{_kf5_mkspecsdir}/qt_QuickAddons.pri %changelog ++++++ baselibs.conf ++++++ --- /var/tmp/diff_new_pack.k5bbi8/_old 2014-11-11 01:10:00.000000000 +0100 +++ /var/tmp/diff_new_pack.k5bbi8/_new 2014-11-11 01:10:00.000000000 +0100 @@ -1,3 +1,7 @@ libKF5Declarative5 +libKF5QuickAddons5 +kdeclarative-components kdeclarative-devel requires "libKF5Declarative5-<targettype> = <version>" + requires "libKF5QuickAddons5-<targettype> = <version>" + requires "kdeclarative-components-<targettype> = <version>" \ No newline at end of file ++++++ kdeclarative-5.3.0.tar.xz -> kdeclarative-5.4.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/CMakeLists.txt new/kdeclarative-5.4.0/CMakeLists.txt --- old/kdeclarative-5.3.0/CMakeLists.txt 2014-10-04 19:01:10.000000000 +0200 +++ new/kdeclarative-5.4.0/CMakeLists.txt 2014-11-02 13:08:30.000000000 +0100 @@ -3,12 +3,12 @@ project(KDeclarative) # Dependencies -find_package(ECM 1.3.0 REQUIRED NO_MODULE) +find_package(ECM 1.4.0 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) set(REQUIRED_QT_VERSION "5.2.0") -set(KF5_VERSION "5.3.0") # handled by release scripts -set(KF5_DEP_VERSION "5.3.0") # handled by release scripts +set(KF5_VERSION "5.4.0") # handled by release scripts +set(KF5_DEP_VERSION "5.4.0") # handled by release scripts find_package(Qt5 ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED Qml Quick Gui) include(KDEInstallDirs) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/po/fi/kdeclarative5.po new/kdeclarative-5.4.0/po/fi/kdeclarative5.po --- old/kdeclarative-5.3.0/po/fi/kdeclarative5.po 2014-10-04 19:01:10.000000000 +0200 +++ new/kdeclarative-5.4.0/po/fi/kdeclarative5.po 2014-11-02 13:08:30.000000000 +0100 @@ -29,7 +29,7 @@ "POT-Creation-Date: 2014-04-27 20:57+0000\n" "PO-Revision-Date: 2014-04-03 16:45+0300\n" "Last-Translator: Lasse Liehu <lasse.li...@gmail.com>\n" -"Language-Team: Finnish <kde-i18n-...@kde.org>\n" +"Language-Team: Finnish <lokalisoi...@lists.coss.fi>\n" "Language: fi\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/po/it/kdeclarative5.po new/kdeclarative-5.4.0/po/it/kdeclarative5.po --- old/kdeclarative-5.3.0/po/it/kdeclarative5.po 2014-10-04 19:01:10.000000000 +0200 +++ new/kdeclarative-5.4.0/po/it/kdeclarative5.po 2014-11-02 13:08:30.000000000 +0100 @@ -8,7 +8,7 @@ # Luciano Montanaro <mikel...@cirulla.net>, 2007. # Dario Panico <dareus_persarum...@fastwebnet.it>, 2008. # Pino Toscano <toscano.p...@tiscali.it>, 2008. -# Federico Zenith <federico.zen...@member.fsf.org>, 2008, 2012, 2013. +# Federico Zenith <federico.zen...@member.fsf.org>, 2008, 2012, 2013, 2014. # Innocenzo Ventre <innocenzo.ven...@gmail.com>, 2012. # Vincenzo Reale <smart2...@baslug.org>, 2014. msgid "" @@ -16,22 +16,22 @@ "Project-Id-Version: kdelibs4\n" "Report-Msgid-Bugs-To: http://bugs.kde.org\n" "POT-Creation-Date: 2014-04-27 20:57+0000\n" -"PO-Revision-Date: 2014-04-14 21:13+0200\n" -"Last-Translator: Vincenzo Reale <smart2...@baslug.org>\n" +"PO-Revision-Date: 2014-10-09 20:11+0200\n" +"Last-Translator: Federico Zenith <zenith.feder...@gmail.com>\n" "Language-Team: Italian <kde-i18n...@kde.org>\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Lokalize 1.5\n" "Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Lokalize 1.5\n" #: qmlcontrols/kquickcontrols/KeySequenceItem.qml:38 msgid "" "Click on the button, then enter the shortcut like you would in the program.\n" "Example for Ctrl+A: hold the Ctrl key and press A." msgstr "" -"Fai clic sul pulsante, quindi inserisci la scorciatoia come la vorresti nel " +"Fai clic sul pulsante, quindi digita la scorciatoia come la vorresti nel " "programma.\n" "Esempio per Ctrl+A: tieni premuto il tasto Ctrl e premi A." diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/po/nn/kdeclarative5.po new/kdeclarative-5.4.0/po/nn/kdeclarative5.po --- old/kdeclarative-5.3.0/po/nn/kdeclarative5.po 2014-10-04 19:01:10.000000000 +0200 +++ new/kdeclarative-5.4.0/po/nn/kdeclarative5.po 2014-11-02 13:08:30.000000000 +0100 @@ -2,7 +2,7 @@ # # Gaute Hvoslef Kvalnes <ga...@verdsveven.com>, 2003, 2004, 2005, 2006. # HÃ¥vard Korsvoll <korsv...@skulelinux.no>, 2003, 2005. -# Karl Ove Hufthammer <k...@huftis.org>, 2004, 2007, 2008, 2009, 2010, 2011, 2012, 2013. +# Karl Ove Hufthammer <k...@huftis.org>, 2004, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014. # Eirik U. Birkeland <eir...@gmail.com>, 2008, 2009, 2010. msgid "" msgstr "" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/CMakeLists.txt new/kdeclarative-5.4.0/src/CMakeLists.txt --- old/kdeclarative-5.3.0/src/CMakeLists.txt 2014-10-04 19:01:10.000000000 +0200 +++ new/kdeclarative-5.4.0/src/CMakeLists.txt 2014-11-02 13:08:30.000000000 +0100 @@ -2,4 +2,5 @@ add_subdirectory(kdeclarative) endif() -add_subdirectory(qmlcontrols) \ No newline at end of file +add_subdirectory(quickaddons) +add_subdirectory(qmlcontrols) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/qmlcontrols/kquickcontrolsaddons/CMakeLists.txt new/kdeclarative-5.4.0/src/qmlcontrols/kquickcontrolsaddons/CMakeLists.txt --- old/kdeclarative-5.3.0/src/qmlcontrols/kquickcontrolsaddons/CMakeLists.txt 2014-10-04 19:01:10.000000000 +0200 +++ new/kdeclarative-5.4.0/src/qmlcontrols/kquickcontrolsaddons/CMakeLists.txt 2014-11-02 13:08:30.000000000 +0100 @@ -17,7 +17,8 @@ Qt5::Core Qt5::Quick Qt5::Qml - Qt5::Gui) + Qt5::Gui + KF5::QuickAddons) install(TARGETS kquickcontrolsaddonsplugin DESTINATION ${QML_INSTALL_DIR}/org/kde/kquickcontrolsaddons) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/qmlcontrols/kquickcontrolsaddons/mouseeventlistener.cpp new/kdeclarative-5.4.0/src/qmlcontrols/kquickcontrolsaddons/mouseeventlistener.cpp --- old/kdeclarative-5.3.0/src/qmlcontrols/kquickcontrolsaddons/mouseeventlistener.cpp 2014-10-04 19:01:10.000000000 +0200 +++ new/kdeclarative-5.4.0/src/qmlcontrols/kquickcontrolsaddons/mouseeventlistener.cpp 2014-11-02 13:08:30.000000000 +0100 @@ -153,7 +153,12 @@ //FIXME: when a popup window is visible: a click anywhere hides it: but the old qquickitem will continue to think it's under the mouse //doesn't seem to be any good way to properly reset this. //this msolution will still caused a missed click after the popup is gone, but gets the situation unblocked. - if (!isUnderMouse()) { + QPoint viewPosition; + if (window()) { + viewPosition = window()->position(); + } + + if (!QRectF(mapToScene(QPoint(0, 0)) + viewPosition, QSizeF(width(), height())).contains(me->screenPos())) { me->ignore(); return; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/qmlcontrols/kquickcontrolsaddons/qiconitem.cpp new/kdeclarative-5.4.0/src/qmlcontrols/kquickcontrolsaddons/qiconitem.cpp --- old/kdeclarative-5.3.0/src/qmlcontrols/kquickcontrolsaddons/qiconitem.cpp 2014-10-04 19:01:10.000000000 +0200 +++ new/kdeclarative-5.4.0/src/qmlcontrols/kquickcontrolsaddons/qiconitem.cpp 2014-11-02 13:08:30.000000000 +0100 @@ -1,5 +1,6 @@ /* * Copyright 2011 Marco Martin <m...@kde.org> + * Copyright 2014 Aleix Pol Gonzalez <aleix...@blue-systems.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as @@ -19,15 +20,19 @@ #include "qiconitem.h" - +#include <QSGSimpleTextureNode> +#include <qquickwindow.h> #include <QIcon> -#include <QPainter> +#include <quickaddons/imagetexturescache.h> +#include <quickaddons/managedtexturenode.h> +Q_GLOBAL_STATIC(ImageTexturesCache, s_iconImageCache) QIconItem::QIconItem(QQuickItem *parent) - : QQuickPaintedItem(parent), + : QQuickItem(parent), m_smooth(false), - m_state(DefaultState) + m_state(DefaultState), + m_changed(false) { setFlag(ItemHasContents, true); } @@ -46,6 +51,7 @@ } else { m_icon = QIcon(); } + m_changed = true; update(); } @@ -66,6 +72,7 @@ } m_state = state; + m_changed = true; emit stateChanged(state); update(); } @@ -86,6 +93,7 @@ return; } m_smooth = smooth; + m_changed = true; update(); } @@ -94,30 +102,44 @@ return m_smooth; } -void QIconItem::paint(QPainter *painter) +QSGNode* QIconItem::updatePaintNode(QSGNode* node, QQuickItem::UpdatePaintNodeData* /*data*/) { - if (m_icon.isNull()) { - return; - } - //do without painter save, faster and the support can be compiled out - const bool wasAntiAlias = painter->testRenderHint(QPainter::Antialiasing); - const bool wasSmoothTransform = painter->testRenderHint(QPainter::SmoothPixmapTransform); - painter->setRenderHint(QPainter::Antialiasing, m_smooth); - painter->setRenderHint(QPainter::SmoothPixmapTransform, m_smooth); - - if (m_state == ActiveState) { - QPixmap result = m_icon.pixmap(boundingRect().size().toSize(), QIcon::Active); - painter->drawPixmap(0, 0, result); - } else if (m_state == QIconItem::DisabledState) { - QPixmap result = m_icon.pixmap(boundingRect().size().toSize(), QIcon::Disabled); - painter->drawPixmap(0, 0, result); - } else { - m_icon.paint(painter, boundingRect().toRect(), Qt::AlignCenter, QIcon::Normal); + if (m_changed || node == 0) { + m_changed = false; + + ManagedTextureNode* mNode = dynamic_cast<ManagedTextureNode*>(node); + if(!mNode) { + delete node; + mNode = new ManagedTextureNode; + } + + const QSize size(width(), height()); + QIcon::Mode mode; + switch(m_state) { + case DefaultState: + mode = QIcon::Normal; + break; + case ActiveState: + mode = QIcon::Active; + break; + case DisabledState: + mode = QIcon::Disabled; + break; + } + + mNode->setTexture(s_iconImageCache->loadTexture(window(), m_icon.pixmap(size, mode, QIcon::On).toImage())); + mNode->setRect(QRect(QPoint(0,0), size)); + node = mNode; } - painter->setRenderHint(QPainter::Antialiasing, wasAntiAlias); - painter->setRenderHint(QPainter::SmoothPixmapTransform, wasSmoothTransform); + return node; } - -#include "qiconitem.moc" +void QIconItem::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) +{ + if (newGeometry.size() != oldGeometry.size()) { + m_changed = true; + update(); + } + QQuickItem::geometryChanged(newGeometry, oldGeometry); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/qmlcontrols/kquickcontrolsaddons/qiconitem.h new/kdeclarative-5.4.0/src/qmlcontrols/kquickcontrolsaddons/qiconitem.h --- old/kdeclarative-5.3.0/src/qmlcontrols/kquickcontrolsaddons/qiconitem.h 2014-10-04 19:01:10.000000000 +0200 +++ new/kdeclarative-5.4.0/src/qmlcontrols/kquickcontrolsaddons/qiconitem.h 2014-11-02 13:08:30.000000000 +0100 @@ -20,11 +20,10 @@ #define QICONITEM_H #include <QIcon> -#include <QQuickPaintedItem> -#include <QPixmap> +#include <QQuickItem> #include <QVariant> -class QIconItem : public QQuickPaintedItem +class QIconItem : public QQuickItem { Q_OBJECT @@ -59,15 +58,19 @@ void setSmooth(const bool smooth); bool smooth() const; - void paint(QPainter *painter); + virtual QSGNode* updatePaintNode(QSGNode* node, UpdatePaintNodeData* data) Q_DECL_OVERRIDE; Q_SIGNALS: void stateChanged(State state); +protected: + void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) Q_DECL_OVERRIDE; + private: QIcon m_icon; bool m_smooth; State m_state; + bool m_changed; }; #endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/quickaddons/CMakeLists.txt new/kdeclarative-5.4.0/src/quickaddons/CMakeLists.txt --- old/kdeclarative-5.3.0/src/quickaddons/CMakeLists.txt 1970-01-01 01:00:00.000000000 +0100 +++ new/kdeclarative-5.4.0/src/quickaddons/CMakeLists.txt 2014-11-02 13:08:30.000000000 +0100 @@ -0,0 +1,51 @@ +add_library(KF5QuickAddons imagetexturescache.cpp managedtexturenode.cpp) +generate_export_header(KF5QuickAddons EXPORT_FILE_NAME ${CMAKE_CURRENT_BINARY_DIR}/quickaddons_export.h BASE_NAME QuickAddons) +add_library(KF5::QuickAddons ALIAS KF5QuickAddons) + +# Apps must include <QuickAddons/File> or <quickaddons/file.h> +target_include_directories(KF5QuickAddons INTERFACE "$<INSTALL_INTERFACE:${KF5_INCLUDE_INSTALL_DIR}/KDeclarative>") + +target_link_libraries(KF5QuickAddons + PUBLIC + Qt5::Qml + PRIVATE + Qt5::Quick #QQuickImageProvider + KF5::ConfigCore # KCoreConfigSkeleton, in ConfigPropertyMap + KF5::I18n #i18n bindings + KF5::KIOWidgets #KIO::AccessManager + KF5::IconThemes #KIconProvider +) +target_include_directories(KF5QuickAddons PUBLIC "$<BUILD_INTERFACE:${QuickAddons_BINARY_DIR}/../;${CMAKE_CURRENT_BINARY_DIR}/../>") + +set_target_properties(KF5QuickAddons + PROPERTIES VERSION ${KDECLARATIVE_VERSION_STRING} + SOVERSION ${KDECLARATIVE_SOVERSION} + EXPORT_NAME QuickAddons +) + +# Install files +ecm_generate_headers(QuickAddons_CamelCase_HEADERS + HEADER_NAMES + ImageTexturesCache + ManagedTextureNode + + PREFIX QuickAddons + REQUIRED_HEADERS QuickAddons_HEADERS +) +install(FILES ${QuickAddons_CamelCase_HEADERS} DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KDeclarative/QuickAddons COMPONENT Devel) + +install(TARGETS KF5QuickAddons + EXPORT KF5DeclarativeTargets + ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} +) + +install(FILES + ${CMAKE_CURRENT_BINARY_DIR}/quickaddons_export.h + ${QuickAddons_HEADERS} + DESTINATION ${KF5_INCLUDE_INSTALL_DIR}/KDeclarative/quickaddons + COMPONENT Devel +) + +include(ECMGeneratePriFile) +ecm_generate_pri_file(BASE_NAME QuickAddons LIB_NAME KF5QuickAddons DEPS "qml" FILENAME_VAR PRI_FILENAME INCLUDE_INSTALL_DIR ${KF5_INCLUDE_INSTALL_DIR}/QuickAddons) +install(FILES ${PRI_FILENAME} DESTINATION ${ECM_MKSPECS_INSTALL_DIR}) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/quickaddons/imagetexturescache.cpp new/kdeclarative-5.4.0/src/quickaddons/imagetexturescache.cpp --- old/kdeclarative-5.3.0/src/quickaddons/imagetexturescache.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kdeclarative-5.4.0/src/quickaddons/imagetexturescache.cpp 2014-11-02 13:08:30.000000000 +0100 @@ -0,0 +1,57 @@ +/* + * Copyright 2014 Aleix Pol Gonzalez <aleix...@blue-systems.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "imagetexturescache.h" +#include <QQuickWindow> +#include <QSGTexture> +#include <QDebug> + +typedef QHash<qint64, QHash<QWindow*, QWeakPointer<QSGTexture> > > TexturesCache; + +struct ImageTexturesCachePrivate +{ + TexturesCache cache; +}; + +ImageTexturesCache::ImageTexturesCache() + : d(new ImageTexturesCachePrivate) +{ +} + +ImageTexturesCache::~ImageTexturesCache() +{ +} + +QSharedPointer<QSGTexture> ImageTexturesCache::loadTexture(QQuickWindow *window, const QImage &image) +{ + qint64 id = image.cacheKey(); + QSharedPointer<QSGTexture> texture = d->cache.value(id).value(window).toStrongRef(); + if (!texture) { + auto cleanAndDelete = [this, window, id](QSGTexture* texture) { + QHash<QWindow*, QWeakPointer<QSGTexture> >& textures = (d->cache)[id]; + textures.remove(window); + if (textures.isEmpty()) + d->cache.remove(id); + delete texture; + }; + texture = QSharedPointer<QSGTexture>(window->createTextureFromImage(image), cleanAndDelete); + (d->cache)[id][window] = texture.toWeakRef(); + } + return texture; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/quickaddons/imagetexturescache.h new/kdeclarative-5.4.0/src/quickaddons/imagetexturescache.h --- old/kdeclarative-5.3.0/src/quickaddons/imagetexturescache.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kdeclarative-5.4.0/src/quickaddons/imagetexturescache.h 2014-11-02 13:08:30.000000000 +0100 @@ -0,0 +1,59 @@ +/* + * Copyright 2014 Aleix Pol Gonzalez <aleix...@blue-systems.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef IMAGETEXTURESCACHE_H +#define IMAGETEXTURESCACHE_H + +#include <QSharedPointer> +#include "quickaddons_export.h" + +class QImage; +class QQuickWindow; +class QSGTexture; +class ImageTexturesCachePrivate; + +/** + * @short Helps to manage textures by creating images and reference counts them. + * + * Use this class as a factory for textures, when creating them from a QImage + * instance. + * Keeps track of all the created textures in a map between the QImage::cacheKey() and + * the cached texture until it gets de-referenced. + * + * @see ManagedTextureNode + */ +class QUICKADDONS_EXPORT ImageTexturesCache +{ +public: + ImageTexturesCache(); + ~ImageTexturesCache(); + + /** + * @returns the texture for a given @p window and @p image. + * + * If an @p image id is the same as one already provided before, we won't create + * a new texture and we'll copy one previously created. + */ + QSharedPointer<QSGTexture> loadTexture(QQuickWindow *window, const QImage &image); + +private: + QScopedPointer<ImageTexturesCachePrivate> d; +}; + +#endif // IMAGETEXTURESCACHE_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/quickaddons/managedtexturenode.cpp new/kdeclarative-5.4.0/src/quickaddons/managedtexturenode.cpp --- old/kdeclarative-5.3.0/src/quickaddons/managedtexturenode.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kdeclarative-5.4.0/src/quickaddons/managedtexturenode.cpp 2014-11-02 13:08:30.000000000 +0100 @@ -0,0 +1,29 @@ +/* + * Copyright 2014 Aleix Pol Gonzalez <aleix...@blue-systems.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "managedtexturenode.h" + +ManagedTextureNode::ManagedTextureNode() +{} + +void ManagedTextureNode::setTexture(QSharedPointer<QSGTexture> texture) +{ + m_texture = texture; + QSGSimpleTextureNode::setTexture(texture.data()); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/src/quickaddons/managedtexturenode.h new/kdeclarative-5.4.0/src/quickaddons/managedtexturenode.h --- old/kdeclarative-5.3.0/src/quickaddons/managedtexturenode.h 1970-01-01 01:00:00.000000000 +0100 +++ new/kdeclarative-5.4.0/src/quickaddons/managedtexturenode.h 2014-11-02 13:08:30.000000000 +0100 @@ -0,0 +1,55 @@ +/* + * Copyright 2014 Aleix Pol Gonzalez <aleix...@blue-systems.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#ifndef MANAGEDTEXTURENODE_H +#define MANAGEDTEXTURENODE_H + +#include "quickaddons_export.h" +#include <qglobal.h> +#include <QSGSimpleTextureNode> +#include <QSGTexture> +#include <QSharedPointer> + +/** + * @short Node that contains a reference counted texture + * + * Usually when assigning textures within a node, we'll want to delete the + * texture with the node. This class will take a shared texture and display it + * within the node. + * + * It's especially interesting to use this class together with the ImageTexturesCache + * that will offer us shareable textures and cache them transparently, when asking + * it to create the texture. + * + * @see ImageTexturesCache + */ + +class QUICKADDONS_EXPORT ManagedTextureNode : public QSGSimpleTextureNode +{ +Q_DISABLE_COPY(ManagedTextureNode) +public: + ManagedTextureNode(); + + void setTexture(QSharedPointer<QSGTexture> texture); + +private: + QSharedPointer<QSGTexture> m_texture; +}; + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/tests/qiconitem_resize.qml new/kdeclarative-5.4.0/tests/qiconitem_resize.qml --- old/kdeclarative-5.3.0/tests/qiconitem_resize.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kdeclarative-5.4.0/tests/qiconitem_resize.qml 2014-11-02 13:08:30.000000000 +0100 @@ -0,0 +1,27 @@ +import org.kde.kquickcontrolsaddons 2.0 +import QtQuick 2.2 +import QtQuick.Controls 1.3 +import QtQuick.Layouts 1.1 + + +Rectangle { + color: "white" + width: 400 + height: 400 + + QIconItem { + id: anIcon + icon: "rating" + width: 8 + height: 8 + } + + Button { + anchors.bottom: parent.bottom + text: "Resize" + onClicked: { + anIcon.width += 4 + anIcon.height += 4 + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kdeclarative-5.3.0/tests/qiconitem_test.qml new/kdeclarative-5.4.0/tests/qiconitem_test.qml --- old/kdeclarative-5.3.0/tests/qiconitem_test.qml 1970-01-01 01:00:00.000000000 +0100 +++ new/kdeclarative-5.4.0/tests/qiconitem_test.qml 2014-11-02 13:08:30.000000000 +0100 @@ -0,0 +1,15 @@ +import org.kde.kquickcontrolsaddons 2.0 +import QtQuick 2.2 + +GridView { + width: 300 + cellWidth: 16 + cellHeight: 16 + + model: 50000 + delegate: QIconItem { + width: 16 + height: 16 + icon: "rating" + } +} -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org