1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

* Made ZeroConfAccount less bug prone.

This commit is contained in:
Lucas Lira Gomes
2012-05-29 19:39:21 -03:00
parent 5f385753c3
commit 2a5d061dee
2 changed files with 7 additions and 6 deletions

View File

@@ -86,7 +86,7 @@ void
ZeroconfAccount::authenticate() ZeroconfAccount::authenticate()
{ {
if ( !isAuthenticated() ) if ( !isAuthenticated() )
static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->connectPlugin(); sipPlugin()->connectPlugin();
} }
@@ -94,7 +94,7 @@ void
ZeroconfAccount::deauthenticate() ZeroconfAccount::deauthenticate()
{ {
if ( isAuthenticated() ) if ( isAuthenticated() )
static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->disconnectPlugin(); sipPlugin()->disconnectPlugin();
} }
@@ -112,7 +112,7 @@ ZeroconfAccount::connectionState() const
return Disconnected; return Disconnected;
// TODO can we get called before sipPlugin()? // TODO can we get called before sipPlugin()?
return static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->connectionState(); return m_sipPlugin.data()->connectionState();
} }
@@ -120,10 +120,10 @@ SipPlugin*
ZeroconfAccount::sipPlugin() ZeroconfAccount::sipPlugin()
{ {
if ( m_sipPlugin.isNull() ) if ( m_sipPlugin.isNull() )
m_sipPlugin = QWeakPointer< SipPlugin >( new ZeroconfPlugin( this ) ); m_sipPlugin = QWeakPointer< ZeroconfPlugin >( new ZeroconfPlugin( this ) );
return m_sipPlugin.data(); return m_sipPlugin.data();
} }
Q_EXPORT_PLUGIN2( Tomahawk::Accounts::AccountFactory, Tomahawk::Accounts::ZeroconfFactory ) Q_EXPORT_PLUGIN2( Tomahawk::Accounts::AccountFactory, Tomahawk::Accounts::ZeroconfFactory )

View File

@@ -19,6 +19,7 @@
#ifndef ZEROCONF_ACCOUNTS_H #ifndef ZEROCONF_ACCOUNTS_H
#define ZEROCONF_ACCOUNTS_H #define ZEROCONF_ACCOUNTS_H
#include "Zeroconf.h"
#include "accounts/Account.h" #include "accounts/Account.h"
#include "../AccountDllMacro.h" #include "../AccountDllMacro.h"
@@ -71,7 +72,7 @@ public:
QWidget* aclWidget() { return 0; } QWidget* aclWidget() { return 0; }
private: private:
QWeakPointer< SipPlugin > m_sipPlugin; QWeakPointer< ZeroconfPlugin > m_sipPlugin;
}; };
} }