Review Request: Displaying playing media time in correct format
Mark Gaiser
markg85 at gmail.com
Fri Apr 27 19:43:36 UTC 2012
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/104762/#review13010
-----------------------------------------------------------
Hi Nancy,
I was just playing with time representing stuff using the javascript Date and came up with this very short example that does the exact same :)
onCurrentTimeChanged: {
var dateTimeObject = new Date(0, 0, 0, 0, 0, currentTime, 0)
mediaController.curMediaTime = Qt.formatTime(dateTimeObject, "hh:mm:ss")
}
What i'm doing above is simply initializing the Date object with 0 values and only fill in the seconds. In my test the date object just takes that. Then i'm using Qt.formatTime to format the date object into a nice string. Here is the documentation for both:
Date: http://www.w3schools.com/jsref/jsref_obj_date.asp
Qt.formatTime: http://qt-project.org/doc/qt-4.8/qml-qt.html#formatTime-method (scroll up a little)
You can try and replace the current onCurrentTimeChanged with the example from above, I haven't tested this on your QML file but it should just work.
I hope it works since it seems nicely cleaned up to me. This also makes it a lot easier to change the displayed time format :)
Note: i'm not the author of the mediacenter stuff so someone else should decide if this is ok.
- Mark Gaiser
On April 27, 2012, 5:28 p.m., nancy kumari wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://git.reviewboard.kde.org/r/104762/
> -----------------------------------------------------------
>
> (Updated April 27, 2012, 5:28 p.m.)
>
>
> Review request for Plasma.
>
>
> Description
> -------
>
> Displaying playing media time in correct format. previously when value of hour, minute or second was less than 10, then it was displaying in single digit format(0:13:5). Now it displays in proper format(00:13:05).
>
>
> Diffs
> -----
>
> shells/newshell/package/contents/ui/mediacenter.qml 11423db
>
> Diff: http://git.reviewboard.kde.org/r/104762/diff/
>
>
> Testing
> -------
>
> Working fine.
>
>
> Thanks,
>
> nancy kumari
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20120427/ad2da396/attachment-0001.html>
More information about the Plasma-devel
mailing list