There are 3 possible strategies: QIcon, QImage and SVG. This change moves logic of each of these strategies into separate class.
Details
- Reviewers
broulik apol davidedmundson - Group Reviewers
Plasma Frameworks - Commits
- R242:5a3fb570feda: [PlasmaCore.IconItem] Refactor source handling for different types
Should behave exactly the same
Diff Detail
- Repository
- R242 Plasma Framework (Library)
- Branch
- master
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 25784 Build 25802: arc lint + arc unit
Splitting into multiple classes seems like a good idea, but "strategy"? Seems like an odd choice of name to me.
src/declarativeimports/core/iconitem.cpp | ||
---|---|---|
58 | Is this class necessary? I feel like this class's behaviour should be what its parent does without a child implementation. | |
58 | Also, "Stategy" instead of "Strategy" | |
80 | Seems unused. |
Yeah, I totally agree, it is really confusing now. I'm bad at creating class names :)
I wanted to extract source handling (logic, internal state) to separate classes. "Handler" is overused, maybe something like this:
IconItemSource (or AbstractIconItemSource, or AbstractSource), then:
QImageSource (or QImageIconItemSource)
QIconSource (or QIconIconItemSource)
SvgSource (or SvgIconItemSource)
What do you think?
src/declarativeimports/core/iconitem.cpp | ||
---|---|---|
40 | does it have to be a QObject? it doesn't have properties, signals or invokables.. qobject is an expensive class so if you don't have to use oits features is better to avoid |
Note there's a unit test for IconItem worth running if you haven't already.
The refactor in general makes sense - it's a lot cleaner.
Though I'm not sure what our super long term KF6 plan for IconItem is, it'll definitely be changing quite a bit.
I've checked that already, these test were really useful!
The refactor in general makes sense - it's a lot cleaner.
Though I'm not sure what our super long term KF6 plan for IconItem is, it'll definitely be changing quite a bit.
If there is no harm now, then it should be easier to change it in the future :)
src/declarativeimports/core/iconitem.cpp | ||
---|---|---|
40 | There is one use of connect in SvgSource but I can change the implementation. |