Review Request: Port the Calculator applet to QML

Mark Gaiser markg85 at gmail.com
Tue Nov 6 16:34:51 UTC 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/107001/#review21491
-----------------------------------------------------------



applets/calculator/package/contents/ui/calculator.qml
<http://git.reviewboard.kde.org/r/107001/#comment16711>

    Should be:
    Item {
        ...
    }



applets/calculator/package/contents/ui/calculator.qml
<http://git.reviewboard.kde.org/r/107001/#comment16712>

    (personal preference) Move the javascript functions to a javascript file.
    
    Then include it like so:
    import "helper.js" as Helper
    
    Then use it like so:
    Helper.functionName()
    
    Again, just my preference. Feel free to ignore it :)



applets/calculator/package/contents/ui/calculator.qml
<http://git.reviewboard.kde.org/r/107001/#comment16713>

    I guess all the string values need to be wrapped in i18nc("C") .. Someone else would need to confirm this since i don't know for sure. This is for all the parts where you use a string.



applets/calculator/package/contents/ui/calculator.qml
<http://git.reviewboard.kde.org/r/107001/#comment16714>

    Again my personal preference, but it cleans up your code. So here it is.
    
    I would put the button in a custom component since you are setting the width and height to the same value every time.
    
    // CustomButton.qml
    PlasmaComponents.Button {
        width: buttonWidth;
        height: buttonHeight;
    }
    
    Then in this case you call:
    CustomButton {
        text: "-"
        onClicked: setOperator("/")
    }
    
    The same for the other buttons. Seems cleaner to me..


Hope that helps. Sorry for the nitpicking :p

- Mark Gaiser


On Nov. 6, 2012, 2:54 a.m., Romário Rios wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/107001/
> -----------------------------------------------------------
> 
> (Updated Nov. 6, 2012, 2:54 a.m.)
> 
> 
> Review request for Plasma.
> 
> 
> Description
> -------
> 
> This diff replaces the C++ Calculator applet by its QMLfied version, which seems to be feature-par with the latter.
> 
> 
> Diffs
> -----
> 
>   applets/calculator/CMakeLists.txt 732145c 
>   applets/calculator/calculator.h f7339be 
>   applets/calculator/calculator.cpp 6bc3ddc 
>   applets/calculator/package/contents/ui/calculator.qml PRE-CREATION 
>   applets/calculator/package/metadata.desktop PRE-CREATION 
>   applets/calculator/plasma-applet-calculator.desktop 0760729 
> 
> Diff: http://git.reviewboard.kde.org/r/107001/diff/
> 
> 
> Testing
> -------
> 
> Tested as both applet and popupapplet, with the Air theme and the Oxygen theme. It seems to work fine.
> 
> 
> Thanks,
> 
> Romário Rios
> 
>

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


More information about the Plasma-devel mailing list