Review Request 124380: Make System Tray use a ProxyModel rather than three independent ones

Mark Gaiser markg85 at gmail.com
Sat Jul 18 18:30:20 UTC 2015


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/124380/#review82617
-----------------------------------------------------------



applets/systemtray/plugin/tasksproxymodel.cpp (lines 29 - 30)
<https://git.reviewboard.kde.org/r/124380/#comment56970>

    Ahh, a signal -> signal mapping.
    That is - as far as i know - not possible in the new signal/slot syntax which is probably why you used a lambda.
    
    You could use the old signal/slot syntax which does allow signal -> signal mapping:
    QObject::connect(obj, SINGAL(), otherObj, SIGNAL());



applets/systemtray/plugin/tasksproxymodel.cpp (lines 51 - 55)
<https://git.reviewboard.kde.org/r/124380/#comment56969>

    Does this have to be a lambda for every signal? Can't you use a function pointer to invalidateFilter?
    
    It might not be possible because the invalidateFilter function is a protected member... not sure though, you'd have to try that.



applets/systemtray/plugin/tasksproxymodel.cpp (lines 79 - 109)
<https://git.reviewboard.kde.org/r/124380/#comment56968>

    I think you can simplfy this function greatly.
    
    The default return is false.
    Then you have 5! other places that return false as well. With the default being false, you don't have to check other false conditions. All you have to check for is the cases that will be true, which would be:
    
    if (m_host->showAllItems() && m_category == Category::ShownTasksCategory) {
        return true;
    }
    
    and then obviously check for the cases that could be true or false (aka, your last if / else if statement.


+1 for using a proxy instead of 3 different models.

- Mark Gaiser


On jul 18, 2015, 3:56 p.m., Kai Uwe Broulik wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/124380/
> -----------------------------------------------------------
> 
> (Updated jul 18, 2015, 3:56 p.m.)
> 
> 
> Review request for Plasma.
> 
> 
> Bugs: 347554
>     https://bugs.kde.org/show_bug.cgi?id=347554
> 
> 
> Repository: plasma-workspace
> 
> 
> Description
> -------
> 
> This makes System Tray use the all tasks model with a proxy model that filters shown or hidden tasks. This way we don't need to keep three different models in sync which has shown to often break, especially when item status change. Makes the code significantly easier to understand.
> 
> One thing I noticed is that there doesn't seem to be a way for a plasmoid to specify a category, so when I uncheck "Miscellaneous", all items but KMix (which is in the hardware category) disappear. Since we're moving away from most SNI apps to plasmoids, it would make sense to allow an applet so specify a category (either through Plasmoid attached object or in the desktop file (or we do a mapping from the PluginInfo-Categories to sys tray categories))
> 
> Edit: Tried the PluginInfo-Categories mapping but it doesn't really fit. Eg. Battery is "System information" but should show up in the Hardware category or systray, likewise for Device NOtifier, and many other systray applets.
> 
> 
> Diffs
> -----
> 
>   applets/systemtray/package/contents/ui/CompactRepresentation.qml 3cf774c 
>   applets/systemtray/package/contents/ui/ExpandedRepresentation.qml 04de968 
>   applets/systemtray/package/contents/ui/main.qml 34b9e4d 
>   applets/systemtray/plugin/CMakeLists.txt 9e85a7a 
>   applets/systemtray/plugin/host.h adb2c64 
>   applets/systemtray/plugin/host.cpp 6d68a43 
>   applets/systemtray/plugin/systemtrayplugin.cpp 2c97056 
>   applets/systemtray/plugin/tasksproxymodel.h PRE-CREATION 
>   applets/systemtray/plugin/tasksproxymodel.cpp PRE-CREATION 
> 
> Diff: https://git.reviewboard.kde.org/r/124380/diff/
> 
> 
> Testing
> -------
> 
> - Checking and unchecking "show all items" works
> - Forcing various items shown/hidden works
> - An item changing its state (eg. new notification, goes from passive to active) works
> - Both lists (compact and expanded) look fine
> - Arrow properly appears/disappears depending on how many inactive items there are
> 
> Touchpad kcm no longer messes up my systray. Looks like the same bug mediacontroller exposed, where the applet was briefly active during initialization and then went passive, getting the models ouf of sync.
> 
> 
> Thanks,
> 
> Kai Uwe Broulik
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20150718/e8809cb3/attachment-0001.html>


More information about the Plasma-devel mailing list