1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-21 00:09:47 +01: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()
{
if ( !isAuthenticated() )
static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->connectPlugin();
sipPlugin()->connectPlugin();
}
@ -94,7 +94,7 @@ void
ZeroconfAccount::deauthenticate()
{
if ( isAuthenticated() )
static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->disconnectPlugin();
sipPlugin()->disconnectPlugin();
}
@ -112,7 +112,7 @@ ZeroconfAccount::connectionState() const
return Disconnected;
// 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()
{
if ( m_sipPlugin.isNull() )
m_sipPlugin = QWeakPointer< SipPlugin >( new ZeroconfPlugin( this ) );
m_sipPlugin = QWeakPointer< ZeroconfPlugin >( new ZeroconfPlugin( this ) );
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
#define ZEROCONF_ACCOUNTS_H
#include "Zeroconf.h"
#include "accounts/Account.h"
#include "../AccountDllMacro.h"
@ -71,7 +72,7 @@ public:
QWidget* aclWidget() { return 0; }
private:
QWeakPointer< SipPlugin > m_sipPlugin;
QWeakPointer< ZeroconfPlugin > m_sipPlugin;
};
}