[PATCH] Cache returned KIconLoader pixmaps in 4.5.2

Matthias Fuchs mat69 at gmx.net
Wed Sep 15 08:45:44 BST 2010


Am Montag 13 September 2010, 12:02:35 schrieb Torgny Nyblom:
> 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?

That's not what I wrote.

Though Ingo is right to make it into more lines, looks a lot nicer when my 
packed stuff.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 230 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20100915/24fb2b09/attachment.sig>


More information about the kde-core-devel mailing list