Review Request 127864: Remove second list storing duplicate data

Mark Gaiser markg85 at gmail.com
Sun May 8 10:49:20 UTC 2016


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




Modules/energy/batterymodel.cpp (lines 33 - 36)
<https://git.reviewboard.kde.org/r/127864/#comment64626>

    just:
    m_batteries = Solid::Device::listFromType(Solid::DeviceInterface::Battery);
    
    ? or am i missing something?



Modules/energy/batterymodel.cpp (line 39)
<https://git.reviewboard.kde.org/r/127864/#comment64625>

    same comment here as below. find_if might be cleaner in these cases.



Modules/energy/batterymodel.cpp (line 56)
<https://git.reviewboard.kde.org/r/127864/#comment64623>

    i=0
    i = 0 (spaces, nitpick)
    
    However, in this block (where you just want to find 1 element and be done with the loop) you might be better of using std:find_if here:
    
    auto result = std::find_if(m_batteries.constBegin(), m_batteries.constEnd() [&udi](const Solid::Device &dev){ return dev.udi() == udi});
    
    if (result == nullptr) {
        return;
    } else {
        int index = std::distance(m_batteries.constBegin(), result);
        ... the other code ...
    }
    
    ^^ not tested. But i think you get the point.



Modules/energy/batterymodel.cpp (line 70)
<https://git.reviewboard.kde.org/r/127864/#comment64624>

    Don't forget to remove that line (m_batteriesUdi is removed.. how can this even ocmpile?)!


- Mark Gaiser


On mei 7, 2016, 8:22 p.m., David Edmundson wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/127864/
> -----------------------------------------------------------
> 
> (Updated mei 7, 2016, 8:22 p.m.)
> 
> 
> Review request for Plasma.
> 
> 
> Repository: kinfocenter
> 
> 
> Description
> -------
> 
> Remove second list storing duplicate data
> 
> 
> Diffs
> -----
> 
>   Modules/energy/batterymodel.h c319d197b7cab1bed67151db65193bc5bcb24e2b 
>   Modules/energy/batterymodel.cpp 7eade5498eda18ee0cfccddec70d5900c4eb2c96 
> 
> Diff: https://git.reviewboard.kde.org/r/127864/diff/
> 
> 
> Testing
> -------
> 
> 
> Thanks,
> 
> David Edmundson
> 
>

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


More information about the Plasma-devel mailing list