1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 06:07:37 +02:00

Bit more work

This commit is contained in:
Leo Franchi
2011-11-18 16:56:23 -05:00
parent e3785e50f2
commit eedf940e5f
5 changed files with 14 additions and 14 deletions

View File

@@ -56,10 +56,9 @@ class DLLEXPORT TwitterAccount : public Account
public: public:
TwitterAccount( const QString &accountId ); TwitterAccount( const QString &accountId );
virtual ~TwitterAccount(); virtual ~TwitterAccount();
QIcon icon() const { return QIcon( ":/twitter-icon.png" ); } QIcon icon() const { return QIcon( ":/twitter-icon.png" ); }
bool canSelfAuthenticate() const { return true; }
void authenticate(); void authenticate();
void deauthenticate(); void deauthenticate();
bool isAuthenticated() const { return m_isAuthenticated; } bool isAuthenticated() const { return m_isAuthenticated; }
@@ -82,7 +81,7 @@ signals:
private slots: private slots:
void configDialogAuthedSignalSlot( bool authed ); void configDialogAuthedSignalSlot( bool authed );
void connectAuthVerifyReply( const QTweetUser &user ); void connectAuthVerifyReply( const QTweetUser &user );
private: private:
bool m_isAuthenticated; bool m_isAuthenticated;
QWeakPointer< TomahawkOAuthTwitter > m_twitterAuth; QWeakPointer< TomahawkOAuthTwitter > m_twitterAuth;

View File

@@ -59,7 +59,6 @@ public:
QIcon icon() const { return QIcon( ":/xmpp-icon.png" ); } QIcon icon() const { return QIcon( ":/xmpp-icon.png" ); }
bool canSelfAuthenticate() const { return false; }
void authenticate(); void authenticate();
void deauthenticate(); void deauthenticate();
bool isAuthenticated() const { return m_isAuthenticated; } bool isAuthenticated() const { return m_isAuthenticated; }
@@ -77,7 +76,7 @@ private:
bool m_isAuthenticated; bool m_isAuthenticated;
QWeakPointer< QWidget > m_configWidget; QWeakPointer< QWidget > m_configWidget;
QWeakPointer< XmppSipPlugin > m_xmppSipPlugin; QWeakPointer< XmppSipPlugin > m_xmppSipPlugin;
// for settings access // for settings access
friend class XmppConfigWidget; friend class XmppConfigWidget;

View File

@@ -39,7 +39,7 @@ namespace InfoSystem
{ {
class InfoPlugin; class InfoPlugin;
} }
namespace Accounts namespace Accounts
{ {
@@ -54,8 +54,11 @@ inline QString generateId( const QString &factoryId )
class DLLEXPORT Account : public QObject class DLLEXPORT Account : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
enum AuthErrorCode { AuthError, ConnectionError };
enum ConnectionState { Disconnected, Connecting, Connected, Disconnecting };
explicit Account( const QString &accountId ) explicit Account( const QString &accountId )
: QObject() : QObject()
, m_enabled( false ) , m_enabled( false )
@@ -79,9 +82,9 @@ public:
virtual QIcon icon() const = 0; virtual QIcon icon() const = 0;
virtual bool canSelfAuthenticate() const = 0;
virtual void authenticate() = 0; virtual void authenticate() = 0;
virtual void deauthenticate() = 0; virtual void deauthenticate() = 0;
virtual ConnectionState connectionState() = 0;s
virtual bool isAuthenticated() const = 0; virtual bool isAuthenticated() const = 0;
virtual Tomahawk::InfoSystem::InfoPlugin* infoPlugin() = 0; virtual Tomahawk::InfoSystem::InfoPlugin* infoPlugin() = 0;
@@ -133,6 +136,8 @@ public:
virtual void sync() { QMutexLocker locker( &m_mutex ); syncConfig(); }; virtual void sync() { QMutexLocker locker( &m_mutex ); syncConfig(); };
signals: signals:
void connectionStateChanged( Tomahawk::Accounts::Account::ConnectionState state );
void configurationChanged(); void configurationChanged();
void authenticated( bool ); void authenticated( bool );
@@ -203,4 +208,4 @@ public:
Q_DECLARE_INTERFACE( Tomahawk::Accounts::AccountFactory, "tomahawk.AccountFactory/1.0" ) Q_DECLARE_INTERFACE( Tomahawk::Accounts::AccountFactory, "tomahawk.AccountFactory/1.0" )
#endif #endif

View File

@@ -1,4 +1,4 @@
/* 4/*
Copyright (C) 2011 Leo Franchi <lfranchi@kde.org> Copyright (C) 2011 Leo Franchi <lfranchi@kde.org>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify

View File

@@ -40,9 +40,6 @@ class DLLEXPORT SipPlugin : public QObject
Q_OBJECT Q_OBJECT
public: public:
enum SipErrorCode { AuthError, ConnectionError }; // Placeholder for errors, to be defined
enum ConnectionState { Disconnected, Connecting, Connected, Disconnecting };
SipPlugin(); SipPlugin();
explicit SipPlugin( Tomahawk::Accounts::Account *account, QObject* parent = 0 ); explicit SipPlugin( Tomahawk::Accounts::Account *account, QObject* parent = 0 );
virtual ~SipPlugin(); virtual ~SipPlugin();
@@ -107,7 +104,7 @@ private slots:
protected: protected:
Tomahawk::Accounts::Account *m_account; Tomahawk::Accounts::Account *m_account;
private: private:
QString m_cachedError; QString m_cachedError;
QStringList m_peersOnline; QStringList m_peersOnline;