extragear/multimedia/amarok/src/servicebrowser/mp3tunes
Maximilian Kossick
maximilian.kossick at googlemail.com
Fri Jul 11 23:28:33 CEST 2008
you should probably use a QThread directly instead of
ThreadWeaver::Job to be on the safe side. ThreadWeaver only creates a
limited number of threads and reuses them, so your harmony worker
would block one of them completely. I can't test how much concurrency
we really have, and how much of threadweaver's thread pool we actually
use, but if i understood the reasoning behind threadweaver correctly,
it's designed for lots of small work items, and not for a daemon which
(presumably) sleeps most of the time anyway.
max
On Fri, Jul 11, 2008 at 10:21 PM, Casey Link <unnamedrambler at gmail.com> wrote:
> SVN commit 831091 by link:
>
> Prevent mp3tunes from loading on startup if the user has not previously set a
> user/pass. It will now only lazy load if the user has used mp3tunes in the
> past.
>
>
> M +29 -26 Mp3tunesService.cpp
>
>
> --- trunk/extragear/multimedia/amarok/src/servicebrowser/mp3tunes/Mp3tunesService.cpp #831090:831091
> @@ -102,38 +102,41 @@
> setIcon( KIcon( "view-services-mp3tunes-amarok" ) );
> debug() << "Making new Locker Object";
> m_locker = new Mp3tunesLocker( "4895500420" );
> - debug() << "MP3tunes running automated authenticate.";
>
> - authenticate( email, password );
> + if( !email.isEmpty() && !password.isEmpty() )
> + {
> + debug() << "MP3tunes running automated authenticate.";
> + authenticate( email, password );
>
> - if( harmonyEnabled ) {
> - debug() << "Making new Daemon";
> - Mp3tunesConfig config;
> - char* ident = convertToChar( config.identifier() );
> - debug () << "Using identifier: " << ident;
> + if( harmonyEnabled ) {
> + debug() << "Making new Daemon";
> + Mp3tunesConfig config;
> + char* ident = convertToChar( config.identifier() );
> + debug () << "Using identifier: " << ident;
>
> - if( config.pin() == QString() )
> - theDaemon = new Mp3tunesHarmonyDaemon( ident ); //first time harmony login
> - else
> - theDaemon = new Mp3tunesHarmonyDaemon( ident, //they're not harmony virgins
> - convertToChar( config.email() ),
> - convertToChar( config.pin() ) );
> + if( config.pin() == QString() )
> + theDaemon = new Mp3tunesHarmonyDaemon( ident ); //first time harmony login
> + else
> + theDaemon = new Mp3tunesHarmonyDaemon( ident, //they're not harmony virgins
> + convertToChar( config.email() ),
> + convertToChar( config.pin() ) );
>
> - Mp3tunesHarmonizer * harmonizer = new Mp3tunesHarmonizer( theDaemon );
> - connect( theDaemon, SIGNAL( signalDisconnected() ), this, SLOT( harmonyDisconnected() ) );
> - connect( theDaemon, SIGNAL( signalWaitingForEmail() ), this, SLOT( harmonyWaitingForEmail() ) );
> - connect( theDaemon, SIGNAL( signalConnected() ), this, SLOT( harmonyConnected() ) );
> - connect( theDaemon, SIGNAL( signalError( QString ) ), this, SLOT( harmonyError( QString ) ) );
> - connect( theDaemon, SIGNAL( signalDownloadReady( Mp3tunesHarmonyDownload* ) ),
> - this, SLOT( harmonyDownloadReady( Mp3tunesHarmonyDownload* ) ) );
> - connect( theDaemon, SIGNAL( signalDownloadPending( Mp3tunesHarmonyDownload* ) ),
> - this, SLOT( harmonyDownloadPending( Mp3tunesHarmonyDownload* ) ) );
> + Mp3tunesHarmonizer * harmonizer = new Mp3tunesHarmonizer( theDaemon );
> + connect( theDaemon, SIGNAL( signalDisconnected() ), this, SLOT( harmonyDisconnected() ) );
> + connect( theDaemon, SIGNAL( signalWaitingForEmail() ), this, SLOT( harmonyWaitingForEmail() ) );
> + connect( theDaemon, SIGNAL( signalConnected() ), this, SLOT( harmonyConnected() ) );
> + connect( theDaemon, SIGNAL( signalError( QString ) ), this, SLOT( harmonyError( QString ) ) );
> + connect( theDaemon, SIGNAL( signalDownloadReady( Mp3tunesHarmonyDownload* ) ),
> + this, SLOT( harmonyDownloadReady( Mp3tunesHarmonyDownload* ) ) );
> + connect( theDaemon, SIGNAL( signalDownloadPending( Mp3tunesHarmonyDownload* ) ),
> + this, SLOT( harmonyDownloadPending( Mp3tunesHarmonyDownload* ) ) );
>
> - debug() << "running harmonizer.";
> - ThreadWeaver::Weaver::instance()->enqueue( harmonizer );
> + debug() << "running harmonizer.";
> + ThreadWeaver::Weaver::instance()->enqueue( harmonizer );
>
> - //Close your eyes. Cross your legs. Touch middle fingers to thumbs. Extend your arms.
> - //OOOooommmmm
> + //Close your eyes. Cross your legs. Touch middle fingers to thumbs. Extend your arms.
> + //OOOooommmmm
> + }
> }
> }
>
>
More information about the Amarok-devel
mailing list