Hello community, here is the log from the commit of package kiconthemes for openSUSE:Factory checked in at 2016-05-19 12:07:43 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kiconthemes (Old) and /work/SRC/openSUSE:Factory/.kiconthemes.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kiconthemes" Changes: -------- --- /work/SRC/openSUSE:Factory/kiconthemes/kiconthemes.changes 2016-04-12 19:18:33.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.kiconthemes.new/kiconthemes.changes 2016-05-19 12:07:44.000000000 +0200 @@ -1,0 +2,11 @@ +Sat May 7 18:32:02 UTC 2016 - [email protected] + +- Update to 5.22.0 (boo#980066) + * Use appropriate container for internal pointer array + * Add opportunity to reduce unneeded disk accesses, + introduces KDE-Extensions + * Save some disk accesses + * For more details please see: + https://www.kde.org/announcements/kde-frameworks-5.22.0.php + +------------------------------------------------------------------- Old: ---- kiconthemes-5.21.0.tar.xz New: ---- kiconthemes-5.22.0.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kiconthemes.spec ++++++ --- /var/tmp/diff_new_pack.3mZkmZ/_old 2016-05-19 12:07:45.000000000 +0200 +++ /var/tmp/diff_new_pack.3mZkmZ/_new 2016-05-19 12:07:45.000000000 +0200 @@ -18,9 +18,9 @@ %bcond_without lang %define lname libKF5IconThemes5 -%define _tar_path 5.21 +%define _tar_path 5.22 Name: kiconthemes -Version: 5.21.0 +Version: 5.22.0 Release: 0 %define kf5_version %{version} BuildRequires: cmake >= 2.8.12 ++++++ kiconthemes-5.21.0.tar.xz -> kiconthemes-5.22.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.21.0/CMakeLists.txt new/kiconthemes-5.22.0/CMakeLists.txt --- old/kiconthemes-5.21.0/CMakeLists.txt 2016-04-03 22:54:06.000000000 +0200 +++ new/kiconthemes-5.22.0/CMakeLists.txt 2016-05-07 17:14:57.000000000 +0200 @@ -4,7 +4,7 @@ # ECM setup include(FeatureSummary) -find_package(ECM 5.21.0 NO_MODULE) +find_package(ECM 5.22.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) @@ -20,8 +20,8 @@ include(ECMMarkNonGuiExecutable) include(ECMQtDeclareLoggingCategory) -set(KF5_VERSION "5.21.0") # handled by release scripts -set(KF5_DEP_VERSION "5.21.0") # handled by release scripts +set(KF5_VERSION "5.22.0") # handled by release scripts +set(KF5_DEP_VERSION "5.22.0") # handled by release scripts ecm_setup_version(${KF5_VERSION} VARIABLE_PREFIX KICONTHEMES diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.21.0/autotests/CMakeLists.txt new/kiconthemes-5.22.0/autotests/CMakeLists.txt --- old/kiconthemes-5.21.0/autotests/CMakeLists.txt 2016-04-03 22:54:06.000000000 +0200 +++ new/kiconthemes-5.22.0/autotests/CMakeLists.txt 2016-05-07 17:14:57.000000000 +0200 @@ -14,4 +14,5 @@ kiconthemes_tests( kiconloader_unittest kiconloader_resourcethemetest + kiconloader_benchmark ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.21.0/autotests/kiconloader_benchmark.cpp new/kiconthemes-5.22.0/autotests/kiconloader_benchmark.cpp --- old/kiconthemes-5.21.0/autotests/kiconloader_benchmark.cpp 1970-01-01 01:00:00.000000000 +0100 +++ new/kiconthemes-5.22.0/autotests/kiconloader_benchmark.cpp 2016-05-07 17:14:57.000000000 +0200 @@ -0,0 +1,92 @@ +/* This file is part of the KDE libraries + Copyright 2016 Aleix Pol Gonzalez + + This library 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 of the License, or (at your option) any later version. + + This library 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#include <kiconloader.h> + +#include <QStandardPaths> +#include <QTest> + +class KIconLoader_Benchmark : public QObject +{ + Q_OBJECT +private Q_SLOTS: + void benchmark() { + //icon list I get to load kwrite + static QStringList icons = { + QStringLiteral("accessories-text-editor"), + QStringLiteral("bookmarks"), + QStringLiteral("dialog-close"), + QStringLiteral("edit-cut"), + QStringLiteral("edit-paste"), + QStringLiteral("edit-copy"), + QStringLiteral("document-save"), + QStringLiteral("edit-undo"), + QStringLiteral("edit-redo"), + QStringLiteral("code-context"), + QStringLiteral("document-print"), + QStringLiteral("document-print-preview"), + QStringLiteral("view-refresh"), + QStringLiteral("document-save-as"), + QStringLiteral("preferences-other"), + QStringLiteral("edit-select-all"), + QStringLiteral("zoom-in"), + QStringLiteral("zoom-out"), + QStringLiteral("edit-find"), + QStringLiteral("go-down-search"), + QStringLiteral("go-up-search"), + QStringLiteral("tools-check-spelling"), + QStringLiteral("bookmark-new"), + QStringLiteral("format-indent-more"), + QStringLiteral("format-indent-less"), + QStringLiteral("text-plain"), + QStringLiteral("go-up"), + QStringLiteral("go-down"), + QStringLiteral("dialog-ok"), + QStringLiteral("dialog-cancel"), + QStringLiteral("window-close"), + QStringLiteral("document-new"), + QStringLiteral("document-open"), + QStringLiteral("document-open-recent"), + QStringLiteral("window-new"), + QStringLiteral("application-exit"), + QStringLiteral("show-menu"), + QStringLiteral("configure-shortcuts"), + QStringLiteral("configure-toolbars"), + QStringLiteral("help-contents"), + QStringLiteral("help-contextual"), + QStringLiteral("tools-report-bug"), + QStringLiteral("preferences-desktop-locale"), + QStringLiteral("kde") + }; + + QBENCHMARK { + foreach (const QString &iconName, icons) { + const QIcon icon = QIcon::fromTheme(iconName); + if(icon.isNull()) + QSKIP("missing icons"); + QVERIFY(!icon.pixmap(24, 24).isNull()); + QVERIFY(!icon.pixmap(512, 512).isNull()); + } + } + } +}; + +QTEST_MAIN(KIconLoader_Benchmark) + +#include "kiconloader_benchmark.moc" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.21.0/autotests/kiconloader_unittest.cpp new/kiconthemes-5.22.0/autotests/kiconloader_unittest.cpp --- old/kiconthemes-5.21.0/autotests/kiconloader_unittest.cpp 2016-04-03 22:54:06.000000000 +0200 +++ new/kiconthemes-5.22.0/autotests/kiconloader_unittest.cpp 2016-05-07 17:14:57.000000000 +0200 @@ -21,6 +21,7 @@ #include <QStandardPaths> #include <QTest> +#include <QRegularExpression> #include <QTemporaryDir> #include <kpixmapsequence.h> @@ -31,12 +32,17 @@ class KIconLoader_UnitTest : public QObject { Q_OBJECT +public: + KIconLoader_UnitTest() + : testSizes({ 12, 22, 32, 42, 82, 132, 243 }) + {} private: QDir testDataDir; QDir testIconsDir; QString appName; QDir appDataDir; + const QVector<int> testSizes; private Q_SLOTS: void initTestCase() @@ -93,7 +99,9 @@ QVERIFY(testIconsDir.mkpath(QStringLiteral("breeze/22x22/appsNoContext"))); QVERIFY(testIconsDir.mkpath(QStringLiteral("breeze/22x22/appsNoType"))); QVERIFY(testIconsDir.mkpath(QStringLiteral("breeze/22x22/appsNoContextOrType"))); - QVERIFY(QFile::copy(QStringLiteral(":/breeze.theme"), testIconsDir.filePath(QStringLiteral("breeze/index.theme")))); + + const QString breezeThemeFile = testIconsDir.filePath(QStringLiteral("breeze/index.theme")); + QVERIFY(QFile::copy(QStringLiteral(":/breeze.theme"), breezeThemeFile)); //kde.png is missing, it should fallback to oxygen //QVERIFY(QFile::copy(QStringLiteral(":/test-22x22.png"), testIconsDir.filePath(QStringLiteral("breeze/22x22/apps/kde.png")))); QVERIFY(QFile::copy(QStringLiteral(":/test-22x22.png"), testIconsDir.filePath(QStringLiteral("breeze/22x22/appsNoContext/iconindirectorywithoutcontext.png")))); @@ -107,6 +115,29 @@ QVERIFY(QFile::copy(QStringLiteral(":/test-22x22.png"), testIconsDir.filePath(QStringLiteral("breeze/22x22/mimetypes/x-office-document.png")))); QVERIFY(QFile::copy(QStringLiteral(":/test-22x22.png"), testIconsDir.filePath(QStringLiteral("breeze/22x22/mimetypes/audio-x-generic.png")))); QVERIFY(QFile::copy(QStringLiteral(":/test-22x22.png"), testIconsDir.filePath(QStringLiteral("breeze/22x22/mimetypes/unknown.png")))); + + QVERIFY(QFile::setPermissions(breezeThemeFile, QFileDevice::ReadOwner|QFileDevice::WriteOwner)); + KConfig configFile(breezeThemeFile); + KConfigGroup iconThemeGroup = configFile.group("Icon Theme"); + QVERIFY(iconThemeGroup.isValid()); + QStringList dirs = iconThemeGroup.readEntry("Directories", QStringList()); + Q_FOREACH(int i, testSizes) { + const QString relDir = QStringLiteral("%1x%1/emblems").arg(i); + const QString dir = testIconsDir.filePath(QStringLiteral("breeze/") + relDir); + QVERIFY(QDir().mkpath(dir)); + + QPixmap img(i, i); + img.fill(Qt::red); + QVERIFY(img.save(dir + "/red.png")); + + dirs += relDir; + KConfigGroup dirGroup = configFile.group(relDir); + dirGroup.writeEntry("Size", i); + dirGroup.writeEntry("Context", "Emblems"); + dirGroup.writeEntry("Type", "Fixed"); + } + iconThemeGroup.writeEntry("Directories", dirs); + QVERIFY(configFile.sync()); } void cleanupTestCase() @@ -427,6 +458,31 @@ KPixmapSequence seq = KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), 22); QVERIFY(seq.isValid()); } + + void testAppropriateSizes() { + const KIconLoader iconLoader; + const QRegularExpression rx(QStringLiteral("/(\\d+)x\\d+/")); + for(int i=1; i<testSizes.last()*1.2; i+=3) { + QString path; + QPixmap pix = iconLoader.loadIcon(QStringLiteral("red"), KIconLoader::Desktop, i, KIconLoader::DefaultState, QStringList(), &path); + QVERIFY(!path.isEmpty()); + QVERIFY(!pix.isNull()); + + const QRegularExpressionMatch match = rx.match(path); + QVERIFY(match.isValid()); + + const int foundSize = match.captured(1).toInt(); + int ts = testSizes.last(); + for (int w = 0; w < testSizes.size(); w++) { + const int curr = testSizes[w]; + if (curr >= i) { + ts = curr; + break; + } + } + QVERIFY(ts == foundSize); + } + } }; QTEST_MAIN(KIconLoader_UnitTest) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.21.0/src/kiconengine.h new/kiconthemes-5.22.0/src/kiconengine.h --- old/kiconthemes-5.21.0/src/kiconengine.h 2016-04-03 22:54:06.000000000 +0200 +++ new/kiconthemes-5.22.0/src/kiconengine.h 2016-05-07 17:14:57.000000000 +0200 @@ -32,6 +32,10 @@ * However, it should not be difficult to extend with features such as SVG * rendered icons. * + * Icon themes specifying a KDE-Extensions string list setting, will limit + * themselves to checking these extensions exclusively, in the order specified + * in the setting. + * * @author Hamish Rodda <[email protected]> */ class KICONTHEMES_EXPORT KIconEngine : public QIconEngine // only exported for kdelibs4support's KIcon diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.21.0/src/kiconloader.cpp new/kiconthemes-5.22.0/src/kiconloader.cpp --- old/kiconthemes-5.21.0/src/kiconloader.cpp 2016-04-03 22:54:06.000000000 +0200 +++ new/kiconthemes-5.22.0/src/kiconloader.cpp 2016-05-07 17:14:57.000000000 +0200 @@ -886,58 +886,24 @@ { const_cast<KIconLoaderPrivate *>(this)->initIconThemes(); - QString path; - - const char *const ext[4] = { ".png", ".svgz", ".svg", ".xpm" }; - bool genericFallback = name.endsWith(QLatin1String("-x-generic")); - - // Do two passes through themeNodes. - // - // The first pass looks for an exact match in each themeNode one after the other. - // If one is found and it is an app icon then return that icon. - // - // In the next pass (assuming the first pass failed), it looks for exact matches - // and then generic fallbacks in each themeNode one after the other - // - // The reasoning is that application icons should always match exactly, all other - // icons may fallback. Since we do not know what the context is here when we start - // looking for it, we can only go by the path found. foreach (KIconThemeNode *themeNode, links) { - for (int i = 0; i < 4; i++) { - path = themeNode->theme->iconPath(name + ext[i], size, KIconLoader::MatchExact); - if (!path.isEmpty()) { - return path; - } - - path = themeNode->theme->iconPath(name + ext[i], size, KIconLoader::MatchBest); - if (!path.isEmpty()) { - return path; - } - } - - if (!path.isEmpty() && path.contains(QStringLiteral("/apps/"))) { + const QString path = themeNode->theme->iconPathByName(name, size, KIconLoader::MatchBest); + if (!path.isEmpty()) { return path; } } + bool genericFallback = name.endsWith(QLatin1String("-x-generic")); + QString path; foreach (KIconThemeNode *themeNode, links) { QString currentName = name; while (!currentName.isEmpty()) { //qCDebug(KICONTHEMES) << "Looking up" << currentName; - for (int i = 0; i < 4; i++) { - path = themeNode->theme->iconPath(currentName + ext[i], size, KIconLoader::MatchExact); - if (!path.isEmpty()) { - return path; - } - - path = themeNode->theme->iconPath(currentName + ext[i], size, KIconLoader::MatchBest); - if (!path.isEmpty()) { - return path; - } - } - //qCDebug(KICONTHEMES) << "Looking up" << currentName; + path = themeNode->theme->iconPathByName(currentName, size, KIconLoader::MatchBest); + if (!path.isEmpty()) + return path; if (genericFallback) { // we already tested the base name diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.21.0/src/kicontheme.cpp new/kiconthemes-5.22.0/src/kicontheme.cpp --- old/kiconthemes-5.21.0/src/kicontheme.cpp 2016-04-03 22:54:06.000000000 +0200 +++ new/kiconthemes-5.22.0/src/kicontheme.cpp 2016-05-07 17:14:57.000000000 +0200 @@ -52,7 +52,8 @@ int mDepth; QString mDir, mName, mInternalName, mDesc; QStringList mInherits; - QList<KIconThemeDir *> mDirs; + QStringList mExtensions; + QVector<KIconThemeDir *> mDirs; }; Q_GLOBAL_STATIC(QString, _theme) Q_GLOBAL_STATIC(QStringList, _theme_list) @@ -71,9 +72,9 @@ } QString iconPath(const QString &name) const; QStringList iconList() const; - QString dir() const + QString constructFileName(const QString &file) const { - return mBaseDirThemeDir; + return mBaseDir + mThemeDir + '/' + file; } KIconLoader::Context context() const @@ -108,7 +109,8 @@ int mSize, mMinSize, mMaxSize; int mThreshold; - QString mBaseDirThemeDir; + const QString mBaseDir; + const QString mThemeDir; }; @@ -130,9 +132,9 @@ (name == defaultThemeName() || name == QLatin1String("hicolor") || name == QLatin1String("locolor"))) { const QStringList icnlibs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); for (QStringList::ConstIterator it = icnlibs.constBegin(); it != icnlibs.constEnd(); ++it) { - const QString cDir = *it + '/' + appName + "/icons/" + name; + const QString cDir = *it + '/' + appName + "/icons/" + name + '/'; if (QFile::exists(cDir)) { - themeDirs += cDir + '/'; + themeDirs += cDir; } } @@ -198,6 +200,7 @@ d->hidden = cfg.readEntry("Hidden", false); d->example = cfg.readPathEntry("Example", QString()); d->screenshot = cfg.readPathEntry("ScreenShot", QString()); + d->mExtensions = cfg.readEntry("KDE-Extensions", QStringList{ ".png", ".svgz", ".svg", ".xpm" }); const QStringList dirs = cfg.readPathEntry("Directories", QStringList()); for (QStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it) { @@ -228,13 +231,7 @@ for (int i = 0; i < groups.size(); ++i) { const QString group = groups.at(i); d->mDefSize[i] = cg.readEntry(group + "Default", defDefSizes[i]); - const QList<int> lst = cg.readEntry(group + "Sizes", QList<int>()); - QList<int> exp; - QList<int>::ConstIterator it2; - for (it2 = lst.begin(); it2 != lst.end(); ++it2) { - exp += *it2; - } - d->mSizes[i] = exp; + d->mSizes[i] = cg.readEntry(group + "Sizes", QList<int>()); } } @@ -305,10 +302,9 @@ QList<int> KIconTheme::querySizes(KIconLoader::Group group) const { - QList<int> empty; if ((group < 0) || (group >= KIconLoader::LastGroup)) { qWarning() << "Illegal icon group: " << group; - return empty; + return QList<int>(); } return d->mSizes[group]; } @@ -400,6 +396,16 @@ return false; } +QString KIconTheme::iconPathByName(const QString &iconName, int size, KIconLoader::MatchType match) const +{ + foreach(const QString ¤t, d->mExtensions) { + const QString path = iconPath(iconName + current, size, match); + if (!path.isEmpty()) + return path; + } + return QString(); +} + QString KIconTheme::iconPath(const QString &name, int size, KIconLoader::MatchType match) const { QString path; @@ -524,10 +530,10 @@ Q_FOREACH (const QString &it, icnlibs) { QDir dir(it); - const QStringList lst = dir.entryList(QDir::Dirs); + const QStringList lst = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot); QStringList::ConstIterator it2; for (it2 = lst.begin(); it2 != lst.end(); ++it2) { - if ((*it2 == QLatin1String(".")) || (*it2 == QLatin1String("..")) || (*it2).startsWith(QLatin1String("default."))) { + if ((*it2).startsWith(QLatin1String("default."))) { continue; } if (!QFile::exists(it + QLatin1Char('/') + *it2 + QLatin1String("/index.desktop")) && @@ -603,7 +609,8 @@ , mMinSize(1) // just set the variables to something , mMaxSize(50) // meaningful in case someone calls minSize or maxSize , mThreshold(2) - , mBaseDirThemeDir(basedir + themedir) + , mBaseDir(basedir) + , mThemeDir(themedir) { if (mSize == 0) { return; @@ -639,7 +646,7 @@ } else if (tmp.isEmpty()) { // do nothing. key not required } else { - qWarning() << "Invalid Context=" << tmp << "line for icon theme: " << dir(); + qWarning() << "Invalid Context=" << tmp << "line for icon theme: " << constructFileName(QString()); return; } tmp = config.readEntry(QStringLiteral("Type"), QStringLiteral("Threshold")); @@ -650,7 +657,7 @@ } else if (tmp == QLatin1String("Threshold")) { mType = KIconLoader::Threshold; } else { - qWarning() << "Invalid Type=" << tmp << "line for icon theme: " << dir(); + qWarning() << "Invalid Type=" << tmp << "line for icon theme: " << constructFileName(QString()); return; } if (mType == KIconLoader::Scalable) { @@ -668,8 +675,7 @@ return QString(); } - QString file = dir() + '/' + name; - + const QString file = constructFileName(name); if (QFile::exists(file)) { return KLocalizedString::localizedFilePath(file); } @@ -679,15 +685,16 @@ QStringList KIconThemeDir::iconList() const { - const QDir icondir = dir(); + const QDir icondir = constructFileName(QString()); const QStringList formats = QStringList() << QStringLiteral("*.png") << QStringLiteral("*.svg") << QStringLiteral("*.svgz") << QStringLiteral("*.xpm"); const QStringList lst = icondir.entryList(formats, QDir::Files); QStringList result; + result.reserve(lst.size()); QStringList::ConstIterator it; - for (it = lst.begin(); it != lst.end(); ++it) { - result += dir() + '/' + *it; + foreach(const QString &file, lst) { + result += constructFileName(file); } return result; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kiconthemes-5.21.0/src/kicontheme.h new/kiconthemes-5.22.0/src/kicontheme.h --- old/kiconthemes-5.21.0/src/kicontheme.h 2016-04-03 22:54:06.000000000 +0200 +++ new/kiconthemes-5.22.0/src/kicontheme.h 2016-05-07 17:14:57.000000000 +0200 @@ -163,6 +163,20 @@ QString iconPath(const QString &name, int size, KIconLoader::MatchType match) const; /** + * Lookup an icon in the theme. + * @param name The name of the icon, without extension. + * @param size The desired size of the icon. + * @param match The matching mode. KIconLoader::MatchExact returns an icon + * only if matches exactly. KIconLoader::MatchBest returns the best matching + * icon. + * @return An absolute path to the file of the icon if it's found, QString() otherwise. + * @see KIconLoader::isValid will return true, and false otherwise. + * + * @since 5.22 + */ + QString iconPathByName(const QString &name, int size, KIconLoader::MatchType match) const; + + /** * Returns true if the theme has any icons for the given context. */ bool hasContext(KIconLoader::Context context) const;
