New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emblem For (Encrypted) Volume Icons #42
Conversation
I may miss something... |
@palinek |
@palinek |
OK... I see, I'm missing a lot 😄 |
@palinek |
GLib may give emblems to volume icons but drawing emblems was not possible because there is no size hint in PlacesModelItem (see #41 (comment)). This PR simply gets the required icon size from PlacesView (through PlacesModel) and draws the GIcon emblem. In my opinion, the hard task of hacking XdgIcon is an overkill for such a simple job -- we don't need emblems in other places (for now).
10f74fd
to
aafc4e0
Compare
@palinek |
@tsujan Thank you for all of the hard work. Reading others' code, understanding it correctly, and trying to enhance its features is never an easy task. Good job so far!
Then it's done. No need to spread the emblem code everywhere. In the future if the GIcon/Fm::Icon stuff is changed, nothing outside these classes will be affected as they are well-encapsulated. |
@PCMan |
@tsujan To sum up. Your code works, which is good and I appreciate your effort. However, adding view information in data model is against the Qt MVC design pattern. Your code is good, but the problem is where to add it.There are many places that you can hack to make it work, but it's better to add it at the right place so we only need to do it once and no further refactoring is needed in the future. |
@tsujan Two views with different icon sizes can share the same data model and that's why you should not set icon size on the data model. Though we don't do this in the program at the moment, it's not good API design and might break in the future. |
@PCMan |
@tsujan OK, I'll merge your PR first and do the required refactor later before the next release. It's not about attitude. It's about design patterns. Your contribution is always welcomed, but I cannot agree with you on this one. Mixing view stuff with the data model is against the purpose of model/view separation and should generally be avoided. |
@PCMan |
@tsujan Merged and did some refactor.
Thanks for the contribution. Now the places icon and file icons both support emblems. |
Works as intended. |
GLib may give emblems to volume icons but drawing emblems was not possible because there is no size hint in PlacesModelItem (see #41 (comment)). This PR simply gets the required icon size from PlacesView (through PlacesModel) and draws the GIcon emblem.
In my opinion, the hard task of hacking XdgIcon is an overkill for such a simple job -- we don't need emblems in other places (for now).