1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-08 10:02:29 +02:00

add a google wrapper around the jreen jabber plugin

This commit is contained in:
Leo Franchi 2011-04-27 17:55:50 -04:00
parent 8d777ff6a9
commit e673c01d3c
11 changed files with 142 additions and 21 deletions

View File

@ -1,5 +1,5 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* 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();
}

View File

@ -1,5 +1,5 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* 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;

View File

@ -51,3 +51,6 @@ IF( APPLE )
ENDIF( APPLE )
install( TARGETS tomahawk_sipjabber DESTINATION lib${LIB_SUFFIX} )
add_subdirectory(googlewrapper)

View File

@ -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} )

View File

@ -0,0 +1,37 @@
/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 2011 Leo Franchi <leo.franchi@kdab.com>
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 <http://www.gnu.org/licenses/>.
*/
#include "googlewrapper.h"
#include <QtPlugin>
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

View File

@ -0,0 +1,49 @@
/*
Copyright (C) 2011 Leo Franchi <leo.franchi@kdab.com>
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 <http://www.gnu.org/licenses/>.
*/
#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

View File

@ -291,5 +291,6 @@ JabberPlugin::connectionState() const
return m_state;
}
#ifndef GOOGLE_WRAPPER
Q_EXPORT_PLUGIN2( sipfactory, JabberFactory )
#endif

View File

@ -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 );
};

View File

@ -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() );
};

View File

@ -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

View File

@ -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() );
};