[SailfishDevel] QML Timer stops running
Thomas Tanghus
thomas at tanghus.net
Fri Jan 17 22:23:25 UTC 2014
I case you're interested I've written a QML plugin including libiphb
(my first attempt was rejected from harbour because I linked dynamically)
that has the same properties and methods as the Timer component.
In lack of a better name, I named it Insomniac ;)
It's still part of my timer app[1], but I plan to factor it out, clean-up
code and document it eventually.
An example of it's use can be seen in my main QML file[2].
It's based on libalignedtimer[3], but I've removed any platform specific
code to keep it lean.
I only got it in a working state in the wee hours this morning, so it's by
no means documented and I have to sort out license issues, credits etc.
If you follow the harbour naming scheme it should be an almost drop-in
replacement; all you have to do is change the module name in qmldir and
the PROJECT variable in insomniac.pro.
[1] https://github.com/tanghus/kitchen-timer-qml/tree/master/src/insomniac
[2] https://github.com/tanghus/kitchen-timer-qml/blob/v0.1.2-2/qml/harbour-kitchentimer.qml#L119
[3] https://github.com/lpotter/libalignedtimer
Thomas
On Thursday 16 January 2014 23:24 Jens Persson wrote:
> So, I switched my shutdown logic to qml timers and they work just fine when
> the gstreamer pipeline is in paused state. And I got a bit curious so I
> also tested with the qml multimedia plugin and it worked just fine too. So
> basically all you need is one line (and one import) to make timers work in
> qml:
>
> Audio { source: "file.mp3" }
>
> That's it. I don't know which way is the best but I know which is the
> laziest. Just throw in a few cool sounds to complement the obnoxious
> beeper. :)
>
> Greets Jens
>
> On Tue, Jan 14, 2014 at 12:32 PM, Thomas Tanghus <thomas at tanghus.net> wrote:
> > That's an interesting approach :) I just might try that if it doesn't pass
> > QA.
> >
> > On Tuesday 14 January 2014 07:28 Jens Persson wrote:
> > > Ok, did some fast checking now. Yes you were right, QTimer doesn't work,
> > > singleShot or not. :( But ... it works for my app because it plays audio
> > > and it works even if the gstreamer pipeline is in paused state. My app
> >
> > uses
> >
> > > gstreamer directly but you can try some other (easier) way, I think
> >
> > there's
> >
> > > quite a few of them. Just load an audio file and set it to paused state
> >
> > and
> >
> > > timers will hopefully work just fine. Hopefully you will make it to the
> > > harbour this way. :)
--
Med venlig hilsen / Best Regards
Thomas Tanghus
More information about the Devel
mailing list