Properly create KPixmapSequence
ClosedPublic

Authored by elvisangelaccio on Sep 26 2017, 5:12 PM.

Details

Summary

The KPixmapSequence constructor needs the full path of the icon, so the
current code doesn't work and generates a "Invalid pixmap specified"
warning at runtime. By using KIconLoader we can fix this issue.

Test Plan

Search something and reach the end of document to make the animation start.

Diff Detail

Repository
R223 Okular
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
Restricted Application added a project: Okular. · View Herald TranscriptSep 26 2017, 5:12 PM
Restricted Application added a subscriber: Okular. · View Herald Transcript
aacid accepted this revision.Sep 26 2017, 8:20 PM
aacid added a subscriber: aacid.

Whoever decided to change from iconName to fullpath deserves some punishment for having a class constructor that has exactly signature but behaves totally different.

every single instance is broken
https://lxr.kde.org/source/frameworks/kpeople/src/widgets/mergedialog.cpp#0082
https://lxr.kde.org/source/frameworks/knewstuff/src/uploaddialog.cpp#0147
https://lxr.kde.org/source/calligra/krita/libs/ui/widgets/kis_cie_tongue_widget.cpp#0162
https://lxr.kde.org/source/extragear/base/nepomuk-webminer/src/lib/ui/fetcherdialog.cpp#0140

meh, i'll forget this to make my life better.

This revision is now accepted and ready to land.Sep 26 2017, 8:20 PM
In D7996#149273, @aacid wrote:

Whoever decided to change from iconName to fullpath deserves some punishment for having a class constructor that has exactly signature but behaves totally different.

every single instance is broken
https://lxr.kde.org/source/frameworks/kpeople/src/widgets/mergedialog.cpp#0082
https://lxr.kde.org/source/frameworks/knewstuff/src/uploaddialog.cpp#0147
https://lxr.kde.org/source/calligra/krita/libs/ui/widgets/kis_cie_tongue_widget.cpp#0162
https://lxr.kde.org/source/extragear/base/nepomuk-webminer/src/lib/ui/fetcherdialog.cpp#0140

meh, i'll forget this to make my life better.

I had a look, kdelibs has

KPixmapSequence::KPixmapSequence(const QString &xdgIconName, int size)
        : d(new Private)
{
    d->loadSequence(QPixmap(KIconLoader::global()->iconPath(xdgIconName, -size)), QSize(size, size));
}

while kwidgetaddons has

KPixmapSequence::KPixmapSequence(const QString &fullPath, int size)
    : d(new Private)
{
    d->loadSequence(QPixmap(fullPath), QSize(size, size));
}

The weird thing is that I can't find the change with git blame. Shouldn't we just restore the old implementation?

The weird thing is that I can't find the change with git blame. Shouldn't we just restore the old implementation?

Ah no, we can't since KIconLoader is tier3...

This revision was automatically updated to reflect the committed changes.