StatusBarNG + service initialization issue

Mark Kretschmann kretschmann at kde.org
Sun Oct 19 20:24:17 CEST 2008


On Sun, Oct 19, 2008 at 7:56 PM, Mark Kretschmann <kretschmann at kde.org> wrote:
> On Sun, Oct 19, 2008 at 7:49 PM, Nikolaj Hald Nielsen
> <nhnfreespirit at gmail.com> wrote:
>>> On a related note, are there any plans to rename the StatusBarNG to
>>> just StatusBar, after we've nuked the old code? I think that would
>>> make sense.
>>
>> That was the plan, but as some of the thread safe stuff has not been
>> ported over, I would like to keep the old stuff around for a little
>> while longer
>
> Btw, thanks to some new features in Qt4, it should be pretty easy to
> do this in a threadsafe way. If you use a connect() with
> Qt::QueuedConnection, the call is automatically relayed over the event
> loop, and then it doesn't matter any more from which thread you call
> the StatusBar.

Let me elaborate this a bit more: We'd still keep the StatusBar API
exactly the same:

The::statusBarNG()->shortMessage( i18n( "Boooyaah!" ) );

But the trick is that in the StatusBar itself we have a SLOT
slotShortMessage( const QString& msg ), connected with
Qt::QueuedConnection, and the StatusBar then does an emit() in
shortMessage() to transfer the QString to slotShortMessage(), which
runs in the GUI thread.

This would be super easy to do, and wouldn't require any changes to the API :)

-- 
Mark Kretschmann
Amarok Developer
www.kde.org - amarok.kde.org


More information about the Amarok-devel mailing list