Review Request: Port the Calculator applet to QML

Romário Rios luizromario at gmail.com
Tue Nov 6 23:25:10 UTC 2012



> On Nov. 6, 2012, 4:34 p.m., Mark Gaiser wrote:
> > applets/calculator/package/contents/ui/calculator.qml, lines 235-240
> > <http://git.reviewboard.kde.org/r/107001/diff/4/?file=93822#file93822line235>
> >
> >     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..
> 
> Romário Rios wrote:
>     A repeater seems simpler to me in this case.
> 
> Mark Gaiser wrote:
>     Well, he tried (in the mailing list) and a repeater gets a bit tricky when you want different components. Most of them are buttons, but there are a few empty placeholders as well. How do you suggest to do that in a repeater?
>     
>     What he can do is repeat till the placeholders and continue manually from there. Even then he gets into trouble with the text and onClicked stuff.
> 
> Mark Gaiser wrote:
>     .. ignore my comment above :p

Well, anyway, this is work for later IMO. It's this way because the original C++ applet created its buttons just like this (it didn't use a for loop or created a different class for the button).


> On Nov. 6, 2012, 4:34 p.m., Mark Gaiser wrote:
> > applets/calculator/package/contents/ui/calculator.qml, line 231
> > <http://git.reviewboard.kde.org/r/107001/diff/4/?file=93822#file93822line231>
> >
> >     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.

Every string displayed to the user you mean.

Anyway, is this necessary for the numbers?


- Romário


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


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/7a0089c8/attachment.html>


More information about the Plasma-devel mailing list