Tasks model: don't load 4 icon sizes to then just use one.
ClosedPublic

Authored by dfaure on Jun 13 2016, 10:40 AM.

Diff Detail

Repository
R120 Plasma Workspace
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
dfaure updated this revision to Diff 4385.Jun 13 2016, 10:40 AM
dfaure retitled this revision from to Tasks model: don't load 4 icon sizes to then just use one..
dfaure updated this object.
dfaure edited the test plan for this revision. (Show Details)
dfaure added a reviewer: hein.
Restricted Application added a project: Plasma. · View Herald TranscriptJun 13 2016, 10:40 AM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik added inline comments.
libtaskmanager/xwindowtasksmodel.cpp
662 ↗(On Diff #4385)

Can't you make a property where the applet tells it the size it likes to have, similar to what you do with the drag pixmap size?

dfaure added inline comments.Jun 13 2016, 10:56 AM
libtaskmanager/xwindowtasksmodel.cpp
662 ↗(On Diff #4385)

No clue, this "fixme" was already there, I'm only optimizing for speed. I'll let Eike reply to this.

hein requested changes to this revision.Jun 13 2016, 11:03 AM
hein edited edge metadata.
hein added inline comments.
libtaskmanager/xwindowtasksmodel.cpp
662 ↗(On Diff #4385)

64 is the value from the old lib. Improving this is on my todo, but it's not a regression and I don't have time for it under the current schedule.

665 ↗(On Diff #4385)

Why not use the one from line 654?

This revision now requires changes to proceed.Jun 13 2016, 11:03 AM
dfaure added inline comments.Jun 13 2016, 12:03 PM
libtaskmanager/xwindowtasksmodel.cpp
665 ↗(On Diff #4385)

Oops, didn't see it. I'll adjust the patch.

However this makes me wonder, given this code

if (!data.icon.name().isEmpty()) {
    return data.url;
}

do I still need to handle the case where data.icon is set (non-null, but no name either, i.e. not from a theme, can this happen?)

hein added inline comments.Jun 13 2016, 12:55 PM
libtaskmanager/xwindowtasksmodel.cpp
665 ↗(On Diff #4385)

Not in XWindowsTasksModel. The way it works is that Private::windowUrl() builds an URL for the window from window/process metadata using a heuristic, then TaskTools::appDataFromUrl() gets app data from it. appDataFromUrl() can set a QIcon without a name in two cases: When it's passed a fallback QIcon to use which lacks a name, and when it reads a pixmap from the URL's query string. The URLs produced by windowUrl() have no query string with an icon yet (obviously), and don't call appDataFromUrl() with a fallback icon (since the fallback is the window icon pixmap). tl;dr: No you don't need to handle that case.

dfaure updated this revision to Diff 4400.Jun 13 2016, 2:00 PM
dfaure edited edge metadata.

Simplify as suggested

hein accepted this revision.Jun 13 2016, 4:27 PM
hein edited edge metadata.
This revision is now accepted and ready to land.Jun 13 2016, 4:27 PM
dfaure closed this revision.Jun 13 2016, 4:49 PM