/usr/include/libtomahawk/accounts/AccountManager.h is in libtomahawk-dev 0.8.4+dfsg1-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
* Copyright 2013, Teo Mrnjavac <teo@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Tomahawk is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ACCOUNTMANAGER_H
#define ACCOUNTMANAGER_H
#include <QFlags>
#include <QObject>
#include "Typedefs.h"
#include "DllMacro.h"
#include "infosystem/InfoSystem.h"
#include "Account.h"
namespace Tomahawk
{
namespace Accounts
{
class CredentialsManager;
class DLLEXPORT AccountManager : public QObject
{
Q_OBJECT
public:
enum DisconnectReason {
Disconnected,
Disabled
};
static AccountManager* instance();
explicit AccountManager( QObject *parent );
virtual ~AccountManager();
void loadFromConfig();
void initSIP(); //only call this after isReadyForSip returns true
void enableAccount( Account* account );
void disableAccount( Account* account );
QList< AccountFactory* > factories() const { return m_accountFactories.values(); }
bool hasPluginWithFactory( const QString& factory ) const;
AccountFactory* factoryForAccount( Account* account ) const;
void addAccount( Account* account );
void hookupAndEnable( Account* account, bool startup = false ); /// Hook up signals and start the plugin
void removeAccount( Account* account );
QList< Account* > accounts() const { return m_accounts; }
QList< Account* > accounts( Tomahawk::Accounts::AccountType type ) const { return m_accountsByAccountType[ type ]; }
QList< Account* > accountsFromFactory( Tomahawk::Accounts::AccountFactory* factory ) const;
/**
* Returns a new Account for a certain path on disk. This will go through all on-disk resolver account providers
* to find the most specific account that matches this.
*
* The fallback is ResolverAccount, which handles our generic external script resolvers.
*/
Account* accountFromPath( const QString& path );
/**
* Registers an account factory as being able to "handle" resolvers on disk. When accountFromPath is called
* AccountManager will go through all registered account factories in order until it finds one that can handle the path.
* This is searched in LIFO order.
*/
void registerAccountFactoryForFilesystem( AccountFactory* factory );
void addAccountFactory( AccountFactory* factory );
Account* zeroconfAccount() const;
bool isConnected() const { return m_connected; } //for use by TomahawkApp during startup
bool isReadyForSip() const { return m_readyForSip; } //for use by TomahawkApp during startup
bool isReady() const { return m_completelyReady; }
CredentialsManager* credentialsManager() const { return m_creds; }
ConfigStorage* configStorageForAccount( const QString& accountId );
ConfigStorage* localConfigStorage();
public slots:
void connectAll();
void disconnectAll();
void toggleAccountsConnected();
signals:
void readyForFactories(); //this happens first, right before loading accounts from config
void readyForSip(); //then this, so TomahawkApp can call initSIP if Servent is ready
void ready(); //finally, when everything is done
void added( Tomahawk::Accounts::Account* );
void removed( Tomahawk::Accounts::Account* );
void connected( Tomahawk::Accounts::Account* );
void disconnected( Tomahawk::Accounts::Account*, Tomahawk::Accounts::AccountManager::DisconnectReason );
void authError( Tomahawk::Accounts::Account* );
void stateChanged( Account* p, Accounts::Account::ConnectionState state );
private slots:
void init();
void onStateChanged( Tomahawk::Accounts::Account::ConnectionState state );
void onError( int code, const QString& msg );
void finishLoadingFromConfig( const QString& cs );
void onSettingsChanged();
private:
void loadPluginFactories();
QString factoryFromId( const QString& accountId ) const;
Account* loadPlugin( const QString& accountId );
void hookupAccount( Account* ) const;
CredentialsManager* m_creds;
QList< Account* > m_accounts;
QList< Account* > m_enabledAccounts;
QList< Account* > m_connectedAccounts;
bool m_connected;
bool m_readyForSip;
bool m_completelyReady;
QHash< AccountType, QList< Account* > > m_accountsByAccountType;
QHash< QString, AccountFactory* > m_accountFactories;
QList< AccountFactory* > m_factoriesForFilesytem;
QHash< QString, ConfigStorage* > m_configStorageById;
QSet< QString > m_configStorageLoading;
static AccountManager* s_instance;
};
}
}
#endif
|