PageRenderTime 14ms CodeModel.GetById 2ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/src/libtomahawk/sip/SipPlugin.h

http://github.com/tomahawk-player/tomahawk
C Header | 101 lines | 53 code | 21 blank | 27 comment | 0 complexity | bae75d053ebbed84b7841cf475cdaaae MD5 | raw file
  1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
  2 *
  3 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
  4 *             2011, Dominik Schmidt <dev@dominik-schmidt.de>
  5 *             2010-2011, Leo Franchi <lfranchi@kde.org>
  6 *   Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
  7 *   Copyright 2013, Uwe L. Korn <uwelk@xhochy.com>
  8 *
  9 *   Tomahawk is free software: you can redistribute it and/or modify
 10 *   it under the terms of the GNU General Public License as published by
 11 *   the Free Software Foundation, either version 3 of the License, or
 12 *   (at your option) any later version.
 13 *
 14 *   Tomahawk is distributed in the hope that it will be useful,
 15 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 17 *   GNU General Public License for more details.
 18 *
 19 *   You should have received a copy of the GNU General Public License
 20 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
 21 */
 22
 23#ifndef SIPPLUGIN_H
 24#define SIPPLUGIN_H
 25
 26#include "Typedefs.h"
 27
 28#include <QObject>
 29#include <QMenu>
 30#include <QString>
 31
 32#include "DllMacro.h"
 33
 34class SipInfo;
 35namespace Tomahawk
 36{
 37    namespace Accounts
 38    {
 39        class Account;
 40    }
 41    class PeerInfo;
 42}
 43
 44class DLLEXPORT SipPlugin : public QObject
 45{
 46    Q_OBJECT
 47
 48friend class Tomahawk::PeerInfo;
 49
 50public:
 51    enum AddContactOptions { NoOptions = 0, SendInvite = 1 };
 52
 53    SipPlugin();
 54    explicit SipPlugin( Tomahawk::Accounts::Account* account, QObject* parent = nullptr );
 55    virtual ~SipPlugin();
 56
 57    // plugin id is "pluginfactoryname_someuniqueid".  get it from SipPluginFactory::generateId
 58    QString pluginId() const;
 59
 60    virtual bool isValid() const = 0;
 61    virtual const QString friendlyName() const;
 62    virtual const QString serviceName() const;
 63    virtual QString inviteString() const;
 64    virtual QMenu* menu();
 65    virtual Tomahawk::Accounts::Account* account() const;
 66
 67    // peer infos
 68    virtual const QList< Tomahawk::peerinfo_ptr > peersOnline() const;
 69
 70public slots:
 71    virtual void connectPlugin() = 0;
 72    virtual void disconnectPlugin() = 0;
 73    virtual void checkSettings() = 0;
 74    virtual void configurationChanged() = 0;
 75
 76    virtual bool addContact( const QString& peerId, AddContactOptions options = NoOptions, const QString& msg = QString() ) = 0;
 77
 78    /**
 79     * Send a list of SipInfos to all contacts.
 80     */
 81    virtual void sendSipInfos( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& infos ) = 0;
 82
 83signals:
 84    void peerStatusChanged( const Tomahawk::peerinfo_ptr& );
 85    void dataError( bool );
 86    void inviteSentSuccess( const QString& inviteId );
 87    void inviteSentFailure( const QString& inviteId );
 88
 89    // new data for own source
 90    void avatarReceived ( const QPixmap& avatar );
 91
 92    void addMenu( QMenu* menu );
 93    void removeMenu( QMenu* menu );
 94
 95protected:
 96    void setAllPeersOffline();
 97
 98    Tomahawk::Accounts::Account *m_account;
 99};
100
101#endif