[PATCH] Cache returned KIconLoader pixmaps in 4.5.2

Torgny Nyblom kde at nyblom.org
Mon Sep 13 11:02:35 BST 2010


On Mon, 13 Sep 2010 11:36:15 +0200
Matthias Fuchs <mat69 at gmx.net> wrote:

> I just realised that I sent an outdated patch, here is a newer one.
[...] 
> @@ -756,26 +757,9 @@
>  QString KIconLoaderPrivate::makeCacheKey(const QString &name,
> KIconLoader::Group group, const QStringList &overlays, int size, int
> state) const {
> -    // The KSharedDataCache is shared so add some namespacing.
> -    QString key;
> -
> -    if (group == KIconLoader::User) {
> -        key = QLatin1String("$kicou_");
> -    }
> -    else {
> -        key = QLatin1String("$kico_");
> -    }
> -
> -    key.append(QString("%1_%2_%3").arg(name).arg(size).arg(overlays.join("_")));
> -
> -    if (group >= 0) {
> -        key.append(mpEffect.fingerprint(group, state));
> -    }
> -    else {
> -        key.append(QLatin1String("noeffect"));
> -    }
> -
> -    return key;
> +    return (group == KIconLoader::User ? QLatin1Literal("$kicou_") : QLatin1Literal("$kico_")) %
> +           name % QLatin1Char('_') % QString::number(size) % QLatin1Char('_') % overlays.join("_") %
> +           (group >= 0 ? mpEffect.fingerprint(group, state) : QString("noeffect"));//QString here, since ternary operator does not
> support different classes
>  }
>  QImage KIconLoaderPrivate::createIconImage(const QString &path, int size)

Sorry but do you really think this makes the code more readable?

/Regards
Torgny




More information about the kde-core-devel mailing list