From kde-panel-devel Mon Apr 30 17:57:27 2012 From: "Sinny Kumari" Date: Mon, 30 Apr 2012 17:57:27 +0000 To: kde-panel-devel Subject: Re: Review Request: Displaying playing media time in correct format Message-Id: <20120430175727.424.38685 () vidsolbach ! de> X-MARC-Message: https://marc.info/?l=kde-panel-devel&m=133580878903580 MIME-Version: 1 Content-Type: multipart/mixed; boundary="--===============8600450272752085604==" --===============8600450272752085604== Content-Type: multipart/alternative; boundary="===============0480792079162232392==" --===============0480792079162232392== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable > On April 27, 2012, 7:43 p.m., Mark Gaiser wrote: > > Hi Nancy, > > = > > I was just playing with time representing stuff using the javascript Da= te and came up with this very short example that does the exact same :) > > onCurrentTimeChanged: { > > var dateTimeObject =3D new Date(0, 0, 0, 0, 0, currentTime, 0) > > mediaController.curMediaTime =3D Qt.formatTime(dateTimeObject, "hh:= mm:ss") > > } > > = > > What i'm doing above is simply initializing the Date object with 0 valu= es 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 examp= le from above, I haven't tested this on your QML file but it should just wo= rk. > > 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 shoul= d decide if this is ok. Thanks for the suggestion:) It absolutely works fine. Just little modification in code since current ti= me is in miliseconds onCurrentTimeChanged: { var dateTimeObject =3D new Date(0, 0, 0, 0, 0, 0, currentTime) mediaController.curMediaTime =3D Qt.formatTime(dateTimeObject, "hh:mm:s= s") } Nancy please update the code and upload the updated diff. - Sinny ----------------------------------------------------------- This is an automatically generated e-mail. To reply, visit: http://git.reviewboard.kde.org/r/104762/#review13010 ----------------------------------------------------------- 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 > = > --===============0480792079162232392== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable
This is an automatically generated e-mail. To reply, visit: http://git.revie= wboard.kde.org/r/104762/

On April 27th, 2012, 7:43 p.m., Mark Gaiser= wrote:

Hi Nancy,

I was just playing with time representing stuff using the javascript Date a=
nd came up with this very short example that does the exact same :)
onCurrentTimeChanged: {
    var dateTimeObject =3D new Date(0, 0, 0, 0, 0, currentTime, 0)
    mediaController.curMediaTime =3D Qt.formatTime(dateTimeObject, "hh=
:mm:ss")
}

What i'm doing above is simply initializing the Date object with 0 valu=
es 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 st=
ring. 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-meth=
od (scroll up a little)

You can try and replace the current onCurrentTimeChanged with the example f=
rom above, I haven't tested this on your QML file but it should just wo=
rk.
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 shoul=
d decide if this is ok.
Thanks for =
the suggestion:)
It absolutely works fine. Just little modification in code since current ti=
me is in miliseconds
onCurrentTimeChanged: {
    var dateTimeObject =3D new Date(0, 0, 0, 0, 0, 0, currentTime)
    mediaController.curMediaTime =3D Qt.formatTime(dateTimeObject, "hh=
:mm:ss")
}
Nancy please update the code and upload the updated diff.

- Sinny


On April 27th, 2012, 5:28 p.m., nancy kumari wrote:

Review request for Plasma.
By nancy kumari.

Updated April 27, 2012, 5:28 p.m.

Descripti= on

Displaying playing media time in correct format. previously =
when value of hour, minute or second was less than 10, then it was displayi=
ng in single digit format(0:13:5). Now it displays in proper format(00:13:0=
5).

Testing <= /h1>
Working fine.

Diffs=

  • shells/newshell/package/contents/ui/mediacenter.qml (11423db)

View Diff

--===============0480792079162232392==-- --===============8600450272752085604== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Plasma-devel mailing list Plasma-devel@kde.org https://mail.kde.org/mailman/listinfo/plasma-devel --===============8600450272752085604==--