diff --git a/src/sip/jabber/jabber.cpp b/src/sip/jabber/jabber.cpp index dab22ac5b..2c061f37d 100644 --- a/src/sip/jabber/jabber.cpp +++ b/src/sip/jabber/jabber.cpp @@ -1,5 +1,5 @@ /* === This file is part of Tomahawk Player - === - * + * * Copyright 2010-2011, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify @@ -42,21 +42,21 @@ JabberPlugin::setProxy( QNetworkProxy* proxy ) const QString -JabberPlugin::name() +JabberPlugin::name() const { return QString( MYNAME ); } const QString -JabberPlugin::friendlyName() +JabberPlugin::friendlyName() const { return QString( "Jabber" ); } const QString -JabberPlugin::accountName() +JabberPlugin::accountName() const { return TomahawkSettings::instance()->jabberUsername(); } diff --git a/src/sip/jabber/jabber.h b/src/sip/jabber/jabber.h index b3d868896..53e264c24 100644 --- a/src/sip/jabber/jabber.h +++ b/src/sip/jabber/jabber.h @@ -1,5 +1,5 @@ /* === This file is part of Tomahawk Player - === - * + * * Copyright 2010-2011, Christian Muehlhaeuser * * Tomahawk is free software: you can redistribute it and/or modify @@ -37,10 +37,10 @@ public: virtual ~JabberPlugin() { delete p; } //FIXME: Make this more correct - virtual bool isValid() { return true; } - virtual const QString name(); - virtual const QString friendlyName(); - virtual const QString accountName(); + virtual bool isValid() const { return true; } + virtual const QString name() const; + virtual const QString friendlyName() const; + virtual const QString accountName() const; virtual QMenu* menu(); void setProxy( QNetworkProxy* proxy ); @@ -51,7 +51,7 @@ public slots: void disconnectPlugin() { onDisconnected(); - + if ( p ) p->disconnect(); @@ -84,7 +84,7 @@ private slots: void showAddFriendDialog(); void onConnected(); void onDisconnected(); - + private: Jabber_p* p; QMenu* m_menu; diff --git a/src/sip/jreen/CMakeLists.txt b/src/sip/jreen/CMakeLists.txt index e0aa1b0d0..cc7527852 100644 --- a/src/sip/jreen/CMakeLists.txt +++ b/src/sip/jreen/CMakeLists.txt @@ -51,3 +51,6 @@ IF( APPLE ) ENDIF( APPLE ) install( TARGETS tomahawk_sipjabber DESTINATION lib${LIB_SUFFIX} ) + + +add_subdirectory(googlewrapper) \ No newline at end of file diff --git a/src/sip/jreen/googlewrapper/CMakeLists.txt b/src/sip/jreen/googlewrapper/CMakeLists.txt new file mode 100644 index 000000000..db72c22ff --- /dev/null +++ b/src/sip/jreen/googlewrapper/CMakeLists.txt @@ -0,0 +1,31 @@ + +# fake google plugin + +set( googleHeaders + ../jabber.h + ../tomahawksipmessage.h + ../tomahawksipmessagefactory.h + ../avatarmanager.h + googlewrapper.h ) + +set( googleSources + ../jabber.cpp + ../jabber_p.cpp + ../tomahawksipmessage.cpp + ../tomahawksipmessagefactory.cpp + ../avatarmanager.cpp + googlewrapper.cpp ) + +add_definitions(-DGOOGLE_WRAPPER) + +qt4_wrap_cpp( googleMoc googlewrapper.h ) +add_library( tomahawk_sipgoogle SHARED ${googleSources} ${googleMoc} ${jabberMoc} ) + +target_link_libraries( tomahawk_sipgoogle + ${QT_LIBRARIES} + ${LIBJREEN_LIBRARY} + ${OS_SPECIFIC_LINK_LIBRARIES} + tomahawklib +) + +install( TARGETS tomahawk_sipgoogle DESTINATION lib${LIB_SUFFIX} ) diff --git a/src/sip/jreen/googlewrapper/googlewrapper.cpp b/src/sip/jreen/googlewrapper/googlewrapper.cpp new file mode 100644 index 000000000..9c1b506b7 --- /dev/null +++ b/src/sip/jreen/googlewrapper/googlewrapper.cpp @@ -0,0 +1,37 @@ +/* + + Copyright (C) 2011 Leo Franchi + + This program 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. + + This program 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 this program. If not, see . +*/ + + +#include "googlewrapper.h" +#include + +SipPlugin* +GoogleWrapperFactory::createPlugin( const QString& pluginId ) +{ + return new GoogleWrapper( pluginId.isEmpty() ? generateId() : pluginId ); +} + +GoogleWrapper::GoogleWrapper ( const QString& pluginID ) + : JabberPlugin ( pluginID ) +{ + +} + +#ifdef GOOGLE_WRAPPER +Q_EXPORT_PLUGIN2( sipfactory, GoogleWrapperFactory ) +#endif diff --git a/src/sip/jreen/googlewrapper/googlewrapper.h b/src/sip/jreen/googlewrapper/googlewrapper.h new file mode 100644 index 000000000..922e9664c --- /dev/null +++ b/src/sip/jreen/googlewrapper/googlewrapper.h @@ -0,0 +1,49 @@ +/* + Copyright (C) 2011 Leo Franchi + + This program 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. + + This program 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 this program. If not, see . +*/ + + +#ifndef GOOGLEWRAPPER_H +#define GOOGLEWRAPPER_H + +#include "sip/jreen/jabber.h" + +class SIPDLLEXPORT GoogleWrapperFactory : public SipPluginFactory +{ + Q_OBJECT + Q_INTERFACES( SipPluginFactory ) + +public: + GoogleWrapperFactory() {} + virtual ~GoogleWrapperFactory() {} + + virtual QString prettyName() const { return "GMail"; } + virtual QString factoryId() const { return "sipgoogle"; } + virtual SipPlugin* createPlugin( const QString& pluginId ); +}; + +class SIPDLLEXPORT GoogleWrapper : public JabberPlugin +{ + Q_OBJECT +public: + GoogleWrapper( const QString& pluginID ); + virtual ~GoogleWrapper() {} + + virtual const QString name() const { return QString( "GMail" ); } + virtual const QString friendlyName() const { return "GMail Friends"; } +}; + +#endif // GOOGLEWRAPPER_H diff --git a/src/sip/jreen/jabber.cpp b/src/sip/jreen/jabber.cpp index 18c99a1a4..8440be6a0 100644 --- a/src/sip/jreen/jabber.cpp +++ b/src/sip/jreen/jabber.cpp @@ -291,5 +291,6 @@ JabberPlugin::connectionState() const return m_state; } - +#ifndef GOOGLE_WRAPPER Q_EXPORT_PLUGIN2( sipfactory, JabberFactory ) +#endif \ No newline at end of file diff --git a/src/sip/jreen/jabber.h b/src/sip/jreen/jabber.h index d4c653062..f64e4abfa 100644 --- a/src/sip/jreen/jabber.h +++ b/src/sip/jreen/jabber.h @@ -36,8 +36,8 @@ public: JabberFactory() {} virtual ~JabberFactory() {} - virtual QString prettyName() { return "Jabber"; } - virtual QString factoryId() { return "sipjabber"; } + virtual QString prettyName() const { return "Jabber"; } + virtual QString factoryId() const { return "sipjabber"; } virtual SipPlugin* createPlugin( const QString& pluginId ); }; diff --git a/src/sip/twitter/twitter.h b/src/sip/twitter/twitter.h index 8b1f795dc..1ca2fa14b 100644 --- a/src/sip/twitter/twitter.h +++ b/src/sip/twitter/twitter.h @@ -49,8 +49,8 @@ public: TwitterFactory() {} virtual ~TwitterFactory() {} - virtual QString prettyName() { return "Twitter"; } - virtual QString factoryId() { return "siptwitter"; } + virtual QString prettyName() const { return "Twitter"; } + virtual QString factoryId() const { return "siptwitter"; } virtual SipPlugin* createPlugin( const QString& pluginId = QString() ); }; diff --git a/src/sip/zeroconf/zeroconf.cpp b/src/sip/zeroconf/zeroconf.cpp index bad8d9e22..124223126 100644 --- a/src/sip/zeroconf/zeroconf.cpp +++ b/src/sip/zeroconf/zeroconf.cpp @@ -37,13 +37,13 @@ ZeroconfPlugin::name() const const QString ZeroconfPlugin::accountName() const { - return QString(); + return QString( MYNAME ); } const QString ZeroconfPlugin::friendlyName() const { - return QString( "Zeroconf" ); + return QString( MYNAME ); } SipPlugin::ConnectionState diff --git a/src/sip/zeroconf/zeroconf.h b/src/sip/zeroconf/zeroconf.h index da74d3f40..d524591cd 100644 --- a/src/sip/zeroconf/zeroconf.h +++ b/src/sip/zeroconf/zeroconf.h @@ -24,7 +24,7 @@ #include "../sipdllmacro.h" -#define MYNAME "Local Netwrok" +#define MYNAME "Local Network" class SIPDLLEXPORT ZeroconfFactory : public SipPluginFactory { @@ -34,8 +34,8 @@ public: ZeroconfFactory() {} virtual ~ZeroconfFactory() {} - virtual QString factoryId() { return "sipzeroconf"; } - virtual QString prettyName() { return "Local Network"; } + virtual QString factoryId() const { return "sipzeroconf"; } + virtual QString prettyName() const { return "Local Network"; } virtual SipPlugin* createPlugin ( const QString& pluginId = QString() ); };