/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. #ifndef SIPPLUGIN_H
  23. #define SIPPLUGIN_H
  24. #include "Typedefs.h"
  25. #include <QObject>
  26. #include <QMenu>
  27. #include <QString>
  28. #include "DllMacro.h"
  29. class SipInfo;
  30. namespace Tomahawk
  31. {
  32. namespace Accounts
  33. {
  34. class Account;
  35. }
  36. class PeerInfo;
  37. }
  38. class DLLEXPORT SipPlugin : public QObject
  39. {
  40. Q_OBJECT
  41. friend class Tomahawk::PeerInfo;
  42. public:
  43. enum AddContactOptions { NoOptions = 0, SendInvite = 1 };
  44. SipPlugin();
  45. explicit SipPlugin( Tomahawk::Accounts::Account* account, QObject* parent = nullptr );
  46. virtual ~SipPlugin();
  47. // plugin id is "pluginfactoryname_someuniqueid". get it from SipPluginFactory::generateId
  48. QString pluginId() const;
  49. virtual bool isValid() const = 0;
  50. virtual const QString friendlyName() const;
  51. virtual const QString serviceName() const;
  52. virtual QString inviteString() const;
  53. virtual QMenu* menu();
  54. virtual Tomahawk::Accounts::Account* account() const;
  55. // peer infos
  56. virtual const QList< Tomahawk::peerinfo_ptr > peersOnline() const;
  57. public slots:
  58. virtual void connectPlugin() = 0;
  59. virtual void disconnectPlugin() = 0;
  60. virtual void checkSettings() = 0;
  61. virtual void configurationChanged() = 0;
  62. virtual bool addContact( const QString& peerId, AddContactOptions options = NoOptions, const QString& msg = QString() ) = 0;
  63. /**
  64. * Send a list of SipInfos to all contacts.
  65. */
  66. virtual void sendSipInfos( const Tomahawk::peerinfo_ptr& receiver, const QList<SipInfo>& infos ) = 0;
  67. signals:
  68. void peerStatusChanged( const Tomahawk::peerinfo_ptr& );
  69. void dataError( bool );
  70. void inviteSentSuccess( const QString& inviteId );
  71. void inviteSentFailure( const QString& inviteId );
  72. // new data for own source
  73. void avatarReceived ( const QPixmap& avatar );
  74. void addMenu( QMenu* menu );
  75. void removeMenu( QMenu* menu );
  76. protected:
  77. void setAllPeersOffline();
  78. Tomahawk::Accounts::Account *m_account;
  79. };
  80. #endif