mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 21:57:41 +02:00
Port zeroconf plugin
This commit is contained in:
@@ -198,8 +198,8 @@ IF(GLOOX_FOUND)
|
|||||||
SET( tomahawkHeaders ${tomahawkHeaders} xmppbot/xmppbot.h )
|
SET( tomahawkHeaders ${tomahawkHeaders} xmppbot/xmppbot.h )
|
||||||
SET( tomahawkSources ${tomahawkSources} xmppbot/xmppbot.cpp )
|
SET( tomahawkSources ${tomahawkSources} xmppbot/xmppbot.cpp )
|
||||||
ENDIF(GLOOX_FOUND)
|
ENDIF(GLOOX_FOUND)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY( accounts )
|
ADD_SUBDIRECTORY( accounts )
|
||||||
ADD_SUBDIRECTORY( sip )
|
|
||||||
|
|
||||||
IF(QCA2_FOUND)
|
IF(QCA2_FOUND)
|
||||||
INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} )
|
INCLUDE_DIRECTORIES( ${QCA2_INCLUDE_DIR} )
|
||||||
|
@@ -7,4 +7,4 @@ IF( QTWEETLIB_FOUND AND BUILD_GUI )
|
|||||||
#ADD_SUBDIRECTORY( twitter )
|
#ADD_SUBDIRECTORY( twitter )
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
#ADD_SUBDIRECTORY( zeroconf )
|
ADD_SUBDIRECTORY( zeroconf )
|
@@ -162,6 +162,10 @@ TwitterAccount::connectAuthVerifyReply( const QTweetUser &user )
|
|||||||
emit nowAuthenticated( m_twitterAuth, user );
|
emit nowAuthenticated( m_twitterAuth, user );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
QIcon
|
||||||
|
TwitterAccount::icon() const {
|
||||||
|
return QIcon( ":/twitter-icon.png" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -58,7 +58,7 @@ public:
|
|||||||
TwitterAccount( const QString &accountId );
|
TwitterAccount( const QString &accountId );
|
||||||
virtual ~TwitterAccount();
|
virtual ~TwitterAccount();
|
||||||
|
|
||||||
QIcon icon() const { return QIcon( ":/twitter-icon.png" ); }
|
QIcon icon() const;
|
||||||
|
|
||||||
void authenticate();
|
void authenticate();
|
||||||
void deauthenticate();
|
void deauthenticate();
|
||||||
@@ -82,6 +82,7 @@ private slots:
|
|||||||
void connectAuthVerifyReply( const QTweetUser &user );
|
void connectAuthVerifyReply( const QTweetUser &user );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
QIcon m_icon;
|
||||||
bool m_isAuthenticated;
|
bool m_isAuthenticated;
|
||||||
QWeakPointer< TomahawkOAuthTwitter > m_twitterAuth;
|
QWeakPointer< TomahawkOAuthTwitter > m_twitterAuth;
|
||||||
QWeakPointer< TwitterConfigWidget > m_configWidget;
|
QWeakPointer< TwitterConfigWidget > m_configWidget;
|
||||||
|
@@ -8,11 +8,13 @@ add_definitions( -DSIPDLLEXPORT_PRO )
|
|||||||
|
|
||||||
set( zeroconfSources
|
set( zeroconfSources
|
||||||
zeroconf.cpp
|
zeroconf.cpp
|
||||||
|
zeroconfaccount.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set( zeroconfHeaders
|
set( zeroconfHeaders
|
||||||
zeroconf.h
|
zeroconf.h
|
||||||
tomahawkzeroconf.h
|
tomahawkzeroconf.h
|
||||||
|
zeroconfaccount.h
|
||||||
)
|
)
|
||||||
|
|
||||||
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
|
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
|
||||||
@@ -22,7 +24,7 @@ include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
|
|||||||
qt4_wrap_ui( UI_SRCS configwidget.ui )
|
qt4_wrap_ui( UI_SRCS configwidget.ui )
|
||||||
qt4_add_resources( RC_SRCS "resources.qrc" )
|
qt4_add_resources( RC_SRCS "resources.qrc" )
|
||||||
qt4_wrap_cpp( zeroconfMoc ${zeroconfHeaders} )
|
qt4_wrap_cpp( zeroconfMoc ${zeroconfHeaders} )
|
||||||
add_library( tomahawk_sipzeroconf SHARED ${zeroconfSources} ${zeroconfMoc} ${RC_SRCS} ${UI_SRCS} )
|
add_library( tomahawk_account_zeroconf SHARED ${zeroconfSources} ${zeroconfMoc} ${RC_SRCS} ${UI_SRCS} )
|
||||||
|
|
||||||
IF( WIN32 )
|
IF( WIN32 )
|
||||||
SET( OS_SPECIFIC_LINK_LIBRARIES
|
SET( OS_SPECIFIC_LINK_LIBRARIES
|
||||||
@@ -32,7 +34,7 @@ SET( OS_SPECIFIC_LINK_LIBRARIES
|
|||||||
)
|
)
|
||||||
ENDIF( WIN32 )
|
ENDIF( WIN32 )
|
||||||
|
|
||||||
target_link_libraries( tomahawk_sipzeroconf
|
target_link_libraries( tomahawk_account_zeroconf
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
${OS_SPECIFIC_LINK_LIBRARIES}
|
||||||
${TOMAHAWK_LIBRARIES}
|
${TOMAHAWK_LIBRARIES}
|
||||||
@@ -42,4 +44,4 @@ IF( APPLE )
|
|||||||
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
|
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
|
||||||
ENDIF( APPLE )
|
ENDIF( APPLE )
|
||||||
|
|
||||||
install( TARGETS tomahawk_sipzeroconf DESTINATION lib${LIB_SUFFIX} )
|
install( TARGETS tomahawk_account_zeroconf DESTINATION lib${LIB_SUFFIX} )
|
@@ -31,9 +31,7 @@
|
|||||||
#include "database/database.h"
|
#include "database/database.h"
|
||||||
#include "network/servent.h"
|
#include "network/servent.h"
|
||||||
|
|
||||||
#include "../sipdllmacro.h"
|
class Node : public QObject
|
||||||
|
|
||||||
class SIPDLLEXPORT Node : public QObject
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@@ -71,7 +69,7 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SIPDLLEXPORT TomahawkZeroconf : public QObject
|
class TomahawkZeroconf : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -24,20 +25,15 @@
|
|||||||
|
|
||||||
#include "tomahawksettings.h"
|
#include "tomahawksettings.h"
|
||||||
#include "utils/logger.h"
|
#include "utils/logger.h"
|
||||||
|
#include "zeroconfaccount.h"
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
using namespace Accounts;
|
||||||
|
|
||||||
SipPlugin*
|
ZeroconfPlugin::ZeroconfPlugin ( ZeroconfAccount* parent )
|
||||||
ZeroconfFactory::createPlugin( const QString& pluginId )
|
: SipPlugin( parent )
|
||||||
{
|
|
||||||
return new ZeroconfPlugin( pluginId.isEmpty() ? generateId() : pluginId );
|
|
||||||
}
|
|
||||||
|
|
||||||
ZeroconfPlugin::ZeroconfPlugin() : SipPlugin( "") {}
|
|
||||||
|
|
||||||
ZeroconfPlugin::ZeroconfPlugin ( const QString& pluginId )
|
|
||||||
: SipPlugin( pluginId )
|
|
||||||
, m_zeroconf( 0 )
|
, m_zeroconf( 0 )
|
||||||
, m_state( Disconnected )
|
, m_state( Account::Disconnected )
|
||||||
, m_cachedNodes()
|
, m_cachedNodes()
|
||||||
{
|
{
|
||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
@@ -66,21 +62,14 @@ ZeroconfPlugin::friendlyName() const
|
|||||||
return QString( MYNAME );
|
return QString( MYNAME );
|
||||||
}
|
}
|
||||||
|
|
||||||
SipPlugin::ConnectionState
|
Account::ConnectionState
|
||||||
ZeroconfPlugin::connectionState() const
|
ZeroconfPlugin::connectionState() const
|
||||||
{
|
{
|
||||||
return m_state;
|
return m_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef ENABLE_HEADLESS
|
|
||||||
QIcon
|
|
||||||
ZeroconfFactory::icon() const
|
|
||||||
{
|
|
||||||
return QIcon( ":/zeroconf-icon.png" );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool
|
void
|
||||||
ZeroconfPlugin::connectPlugin()
|
ZeroconfPlugin::connectPlugin()
|
||||||
{
|
{
|
||||||
delete m_zeroconf;
|
delete m_zeroconf;
|
||||||
@@ -89,7 +78,7 @@ ZeroconfPlugin::connectPlugin()
|
|||||||
SLOT( lanHostFound( QString, int, QString, QString ) ) );
|
SLOT( lanHostFound( QString, int, QString, QString ) ) );
|
||||||
|
|
||||||
advertise();
|
advertise();
|
||||||
m_state = Connected;
|
m_state = Account::Connected;
|
||||||
|
|
||||||
foreach( const QStringList& nodeSet, m_cachedNodes )
|
foreach( const QStringList& nodeSet, m_cachedNodes )
|
||||||
{
|
{
|
||||||
@@ -99,15 +88,13 @@ ZeroconfPlugin::connectPlugin()
|
|||||||
m_cachedNodes.clear();
|
m_cachedNodes.clear();
|
||||||
|
|
||||||
m_advertisementTimer.start();
|
m_advertisementTimer.start();
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ZeroconfPlugin::disconnectPlugin()
|
ZeroconfPlugin::disconnectPlugin()
|
||||||
{
|
{
|
||||||
m_advertisementTimer.stop();
|
m_advertisementTimer.stop();
|
||||||
m_state = Disconnected;
|
m_state = Account::Disconnected;
|
||||||
|
|
||||||
delete m_zeroconf;
|
delete m_zeroconf;
|
||||||
m_zeroconf = 0;
|
m_zeroconf = 0;
|
||||||
@@ -118,7 +105,7 @@ ZeroconfPlugin::disconnectPlugin()
|
|||||||
QIcon
|
QIcon
|
||||||
ZeroconfPlugin::icon() const
|
ZeroconfPlugin::icon() const
|
||||||
{
|
{
|
||||||
return QIcon( ":/zeroconf-icon.png" );
|
return account()->icon();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -138,7 +125,7 @@ ZeroconfPlugin::lanHostFound( const QString& host, int port, const QString& name
|
|||||||
|
|
||||||
qDebug() << "Found LAN host:" << host << port << nodeid;
|
qDebug() << "Found LAN host:" << host << port << nodeid;
|
||||||
|
|
||||||
if ( m_state != Connected )
|
if ( m_state != Account::Connected )
|
||||||
{
|
{
|
||||||
qDebug() << "Not online, so not connecting.";
|
qDebug() << "Not online, so not connecting.";
|
||||||
QStringList nodeSet;
|
QStringList nodeSet;
|
||||||
@@ -153,5 +140,3 @@ ZeroconfPlugin::lanHostFound( const QString& host, int port, const QString& name
|
|||||||
qDebug() << "Already connected to" << host;
|
qDebug() << "Already connected to" << host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Q_EXPORT_PLUGIN2( sipfactory, ZeroconfFactory )
|
|
@@ -1,6 +1,7 @@
|
|||||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
*
|
*
|
||||||
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
|
||||||
|
* Copyright 2011, Leo Franchi <lfranchi@kde.org>
|
||||||
*
|
*
|
||||||
* Tomahawk is free software: you can redistribute it and/or modify
|
* Tomahawk is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,55 +21,45 @@
|
|||||||
#define ZEROCONF_H
|
#define ZEROCONF_H
|
||||||
|
|
||||||
#include "sip/SipPlugin.h"
|
#include "sip/SipPlugin.h"
|
||||||
|
#include "accounts/Account.h"
|
||||||
#include "tomahawkzeroconf.h"
|
#include "tomahawkzeroconf.h"
|
||||||
|
|
||||||
#include "../sipdllmacro.h"
|
#include "../accountdllmacro.h"
|
||||||
|
|
||||||
#include <QtCore/QTimer>
|
#include <QtCore/QTimer>
|
||||||
|
|
||||||
#define MYNAME "Local Network"
|
#define MYNAME "Local Network"
|
||||||
|
|
||||||
class SIPDLLEXPORT ZeroconfFactory : public SipPluginFactory
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
namespace Accounts
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
|
||||||
Q_INTERFACES( SipPluginFactory )
|
|
||||||
public:
|
|
||||||
ZeroconfFactory() {}
|
|
||||||
virtual ~ZeroconfFactory() {}
|
|
||||||
|
|
||||||
virtual QString factoryId() const { return "sipzeroconf"; }
|
class ZeroconfAccount;
|
||||||
virtual QString prettyName() const { return "Local Network"; }
|
|
||||||
virtual bool isUnique() const { return true; }
|
|
||||||
#ifndef ENABLE_HEADLESS
|
|
||||||
virtual QIcon icon() const;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
virtual SipPlugin* createPlugin ( const QString& pluginId = QString() );
|
class ACCOUNTDLLEXPORT ZeroconfPlugin : public SipPlugin
|
||||||
};
|
|
||||||
|
|
||||||
class SIPDLLEXPORT ZeroconfPlugin : public SipPlugin
|
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ZeroconfPlugin();
|
ZeroconfPlugin( ZeroconfAccount* acc );
|
||||||
ZeroconfPlugin( const QString& pluginId );
|
|
||||||
|
|
||||||
virtual ~ZeroconfPlugin();
|
virtual ~ZeroconfPlugin();
|
||||||
|
|
||||||
virtual const QString name() const;
|
virtual const QString name() const;
|
||||||
virtual const QString friendlyName() const;
|
virtual const QString friendlyName() const;
|
||||||
virtual const QString accountName() const;
|
virtual const QString accountName() const;
|
||||||
virtual ConnectionState connectionState() const;
|
virtual Account::ConnectionState connectionState() const;
|
||||||
virtual bool isValid() const { return true; }
|
virtual bool isValid() const { return true; }
|
||||||
#ifndef ENABLE_HEADLESS
|
#ifndef ENABLE_HEADLESS
|
||||||
virtual QIcon icon() const;
|
virtual QIcon icon() const;
|
||||||
#endif
|
#endif
|
||||||
virtual void checkSettings() {}
|
virtual void checkSettings() {}
|
||||||
|
virtual void configurationChanged() {}
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual bool connectPlugin();
|
void connectPlugin();
|
||||||
void disconnectPlugin();
|
void disconnectPlugin();
|
||||||
|
|
||||||
void advertise();
|
void advertise();
|
||||||
@@ -82,9 +73,12 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TomahawkZeroconf* m_zeroconf;
|
TomahawkZeroconf* m_zeroconf;
|
||||||
ConnectionState m_state;
|
Account::ConnectionState m_state;
|
||||||
QVector<QStringList> m_cachedNodes;
|
QVector<QStringList> m_cachedNodes;
|
||||||
QTimer m_advertisementTimer;
|
QTimer m_advertisementTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
126
src/accounts/zeroconf/zeroconfaccount.cpp
Normal file
126
src/accounts/zeroconf/zeroconfaccount.cpp
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2011, Leo Franchi <lfranchi@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "zeroconfaccount.h"
|
||||||
|
|
||||||
|
#include "sip/SipPlugin.h"
|
||||||
|
#include "zeroconf.h"
|
||||||
|
|
||||||
|
#include <QtCore/QtPlugin>
|
||||||
|
|
||||||
|
using namespace Tomahawk;
|
||||||
|
using namespace Accounts;
|
||||||
|
|
||||||
|
QIcon* s_icon = 0;
|
||||||
|
|
||||||
|
ZeroconfFactory::ZeroconfFactory()
|
||||||
|
{
|
||||||
|
#ifndef ENABLE_HEADLESS
|
||||||
|
if ( s_icon == 0 )
|
||||||
|
s_icon = new QIcon( ":/zeroconf-icon.png" );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ZeroconfFactory::~ZeroconfFactory()
|
||||||
|
{
|
||||||
|
if ( s_icon )
|
||||||
|
{
|
||||||
|
delete s_icon;
|
||||||
|
s_icon = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Account*
|
||||||
|
ZeroconfFactory::createAccount( const QString& pluginId )
|
||||||
|
{
|
||||||
|
return new ZeroconfAccount( pluginId.isEmpty() ? generateId( factoryId() ) : pluginId );
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon
|
||||||
|
ZeroconfFactory::icon() const
|
||||||
|
{
|
||||||
|
return *s_icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ZeroconfAccount::ZeroconfAccount( const QString& accountId )
|
||||||
|
: Account( accountId )
|
||||||
|
{
|
||||||
|
setAccountServiceName( "Local Network" );
|
||||||
|
setAccountFriendlyName( "Local Network" );
|
||||||
|
}
|
||||||
|
|
||||||
|
ZeroconfAccount::~ZeroconfAccount()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QIcon
|
||||||
|
ZeroconfAccount::icon() const
|
||||||
|
{
|
||||||
|
return *s_icon;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ZeroconfAccount::authenticate()
|
||||||
|
{
|
||||||
|
if ( !isAuthenticated() )
|
||||||
|
static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->connectPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ZeroconfAccount::deauthenticate()
|
||||||
|
{
|
||||||
|
if ( isAuthenticated() )
|
||||||
|
static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->disconnectPlugin();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
ZeroconfAccount::isAuthenticated() const
|
||||||
|
{
|
||||||
|
return connectionState() == Connected;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Account::ConnectionState
|
||||||
|
ZeroconfAccount::connectionState() const
|
||||||
|
{
|
||||||
|
if ( m_sipPlugin.isNull() )
|
||||||
|
return Disconnected;
|
||||||
|
|
||||||
|
// TODO can we get called before sipPlugin()?
|
||||||
|
return static_cast< ZeroconfPlugin* >( m_sipPlugin.data() )->connectionState();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SipPlugin*
|
||||||
|
ZeroconfAccount::sipPlugin()
|
||||||
|
{
|
||||||
|
if ( m_sipPlugin.isNull() )
|
||||||
|
m_sipPlugin = QWeakPointer< SipPlugin >( new ZeroconfPlugin( this ) );
|
||||||
|
|
||||||
|
return m_sipPlugin.data();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Q_EXPORT_PLUGIN2( Tomahawk::Accounts::AccountFactory, Tomahawk::Accounts::ZeroconfFactory )
|
78
src/accounts/zeroconf/zeroconfaccount.h
Normal file
78
src/accounts/zeroconf/zeroconfaccount.h
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||||
|
*
|
||||||
|
* Copyright 2011, Leo Franchi <lfranchi@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 ZEROCONF_ACCOUNTS_H
|
||||||
|
#define ZEROCONF_ACCOUNTS_H
|
||||||
|
|
||||||
|
#include "accounts/Account.h"
|
||||||
|
#include "../accountdllmacro.h"
|
||||||
|
|
||||||
|
class SipPlugin;
|
||||||
|
|
||||||
|
namespace Tomahawk
|
||||||
|
{
|
||||||
|
namespace Accounts
|
||||||
|
{
|
||||||
|
|
||||||
|
class ACCOUNTDLLEXPORT ZeroconfFactory : public AccountFactory
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
Q_INTERFACES( Tomahawk::Accounts::AccountFactory )
|
||||||
|
public:
|
||||||
|
ZeroconfFactory();
|
||||||
|
virtual ~ZeroconfFactory();
|
||||||
|
|
||||||
|
virtual QString factoryId() const { return "zeroconfaccount"; }
|
||||||
|
virtual QString prettyName() const { return "Local Network"; }
|
||||||
|
virtual bool isUnique() const { return true; }
|
||||||
|
#ifndef ENABLE_HEADLESS
|
||||||
|
virtual QIcon icon() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
virtual Account* createAccount ( const QString& pluginId = QString() );
|
||||||
|
};
|
||||||
|
|
||||||
|
class ACCOUNTDLLEXPORT ZeroconfAccount : public Account
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
ZeroconfAccount( const QString &accountId );
|
||||||
|
virtual ~ZeroconfAccount();
|
||||||
|
|
||||||
|
QIcon icon() const;
|
||||||
|
|
||||||
|
void authenticate();
|
||||||
|
void deauthenticate();
|
||||||
|
bool isAuthenticated() const;
|
||||||
|
ConnectionState connectionState() const;
|
||||||
|
|
||||||
|
Tomahawk::InfoSystem::InfoPlugin* infoPlugin() { return 0; }
|
||||||
|
SipPlugin* sipPlugin();
|
||||||
|
|
||||||
|
QWidget* configurationWidget() { return 0; }
|
||||||
|
QWidget* aclWidget() { return 0; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
QWeakPointer< SipPlugin > m_sipPlugin;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
@@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
<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 "ui_configwidget.h"
|
|
||||||
|
|
||||||
#include "utils/tomahawkutilsgui.h"
|
|
||||||
|
|
||||||
#include <QtPlugin>
|
|
||||||
#include <QInputDialog>
|
|
||||||
|
|
||||||
|
|
||||||
SipPlugin*
|
|
||||||
GoogleWrapperFactory::createPlugin( const QString& pluginId )
|
|
||||||
{
|
|
||||||
return new GoogleWrapper( pluginId.isEmpty() ? generateId() : pluginId );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QIcon
|
|
||||||
GoogleWrapperFactory::icon() const
|
|
||||||
{
|
|
||||||
return QIcon( ":/gmail-logo.png" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GoogleWrapper::GoogleWrapper ( const QString& pluginID )
|
|
||||||
: JabberPlugin ( pluginID )
|
|
||||||
{
|
|
||||||
m_ui->headerLabel->setText( tr( "Configure this Google Account" ) );
|
|
||||||
m_ui->emailLabel->setText( tr( "Google Address" ) );
|
|
||||||
m_ui->jabberBlurb->setText( tr( "Enter your Google login to connect with your friends using Tomahawk!" ) );
|
|
||||||
m_ui->logoLabel->setPixmap( QPixmap( ":/gmail-logo.png" ) );
|
|
||||||
m_ui->jabberServer->setText( "talk.google.com" );
|
|
||||||
m_ui->jabberPort->setValue( 5222 );
|
|
||||||
m_ui->groupBoxJabberAdvanced->hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QIcon
|
|
||||||
GoogleWrapper::icon() const
|
|
||||||
{
|
|
||||||
return QIcon( ":/gmail-logo.png" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QString
|
|
||||||
GoogleWrapper::defaultSuffix() const
|
|
||||||
{
|
|
||||||
return "@gmail.com";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
GoogleWrapper::showAddFriendDialog()
|
|
||||||
{
|
|
||||||
bool ok;
|
|
||||||
QString id = QInputDialog::getText( TomahawkUtils::tomahawkWindow(), tr( "Add Friend" ),
|
|
||||||
tr( "Enter Google Address:" ), QLineEdit::Normal, "", &ok ).trimmed();
|
|
||||||
if ( !ok )
|
|
||||||
return;
|
|
||||||
|
|
||||||
qDebug() << "Attempting to add google contact to roster:" << id;
|
|
||||||
addContact( id );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef GOOGLE_WRAPPER
|
|
||||||
Q_EXPORT_PLUGIN2( sipfactory, GoogleWrapperFactory )
|
|
||||||
#endif
|
|
@@ -1,86 +0,0 @@
|
|||||||
project( tomahawk )
|
|
||||||
|
|
||||||
include( ${QT_USE_FILE} )
|
|
||||||
add_definitions( ${QT_DEFINITIONS} )
|
|
||||||
add_definitions( -DQT_PLUGIN )
|
|
||||||
add_definitions( -DQT_SHARED )
|
|
||||||
add_definitions( -DSIPDLLEXPORT_PRO )
|
|
||||||
|
|
||||||
<<<<<<< HEAD:src/sip/xmpp/CMakeLists.txt
|
|
||||||
set( xmppSipSources
|
|
||||||
xmppsip.cpp
|
|
||||||
tomahawkxmppmessage.cpp
|
|
||||||
tomahawkxmppmessagefactory.cpp
|
|
||||||
=======
|
|
||||||
set( jabberSources
|
|
||||||
jabber.cpp
|
|
||||||
tomahawksipmessage.cpp
|
|
||||||
tomahawksipmessagefactory.cpp
|
|
||||||
)
|
|
||||||
set( jabberSourcesGui
|
|
||||||
>>>>>>> origin/master:src/sip/jabber/CMakeLists.txt
|
|
||||||
avatarmanager.cpp
|
|
||||||
xmlconsole.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
<<<<<<< HEAD:src/sip/xmpp/CMakeLists.txt
|
|
||||||
set( xmppSipHeaders
|
|
||||||
xmppsip.h
|
|
||||||
=======
|
|
||||||
set( jabberHeaders
|
|
||||||
jabber.h
|
|
||||||
)
|
|
||||||
set( jabberHeadersGui
|
|
||||||
>>>>>>> origin/master:src/sip/jabber/CMakeLists.txt
|
|
||||||
avatarmanager.h
|
|
||||||
xmlconsole.h
|
|
||||||
)
|
|
||||||
|
|
||||||
set( xmppSipUI
|
|
||||||
xmlconsole.ui
|
|
||||||
)
|
|
||||||
|
|
||||||
if(BUILD_GUI)
|
|
||||||
list(APPEND jabberSources ${jabberSourcesGui})
|
|
||||||
list(APPEND jabberHeaders ${jabberHeadersGui})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
include_directories( . ${CMAKE_CURRENT_BINARY_DIR} ..
|
|
||||||
${QT_INCLUDE_DIR}
|
|
||||||
${LIBJREEN_INCLUDE_DIR}
|
|
||||||
)
|
|
||||||
|
|
||||||
qt4_wrap_ui( xmppSipUI_H ${xmppSipUI} )
|
|
||||||
qt4_wrap_cpp( xmppSipMoc ${xmppSipHeaders} )
|
|
||||||
add_library( tomahawk_sip_xmpp SHARED ${xmppSipSources} ${xmppSipMoc} ${xmppSipUI_H} ${RC_SRCS} )
|
|
||||||
|
|
||||||
IF( WIN32 )
|
|
||||||
SET( OS_SPECIFIC_LINK_LIBRARIES
|
|
||||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
|
||||||
"secur32.dll"
|
|
||||||
"crypt32.dll"
|
|
||||||
${TOMAHAWK_LIBRARIES}
|
|
||||||
)
|
|
||||||
ENDIF( WIN32 )
|
|
||||||
|
|
||||||
target_link_libraries( tomahawk_sip_xmpp
|
|
||||||
${QT_LIBRARIES}
|
|
||||||
${LIBJREEN_LIBRARY}
|
|
||||||
${OS_SPECIFIC_LINK_LIBRARIES}
|
|
||||||
tomahawklib
|
|
||||||
)
|
|
||||||
|
|
||||||
IF( APPLE )
|
|
||||||
# SET( CMAKE_SHARED_LINKER_FLAGS ${CMAKE_SHARED_LINKER_FLAGS} "-undefined dynamic_lookup" )
|
|
||||||
ENDIF( APPLE )
|
|
||||||
|
|
||||||
install( TARGETS tomahawk_sip_xmpp DESTINATION lib${LIB_SUFFIX} )
|
|
||||||
|
|
||||||
<<<<<<< HEAD:src/sip/xmpp/CMakeLists.txt
|
|
||||||
|
|
||||||
#add_subdirectory(googlewrapper)
|
|
||||||
=======
|
|
||||||
if(BUILD_GUI)
|
|
||||||
add_subdirectory(googlewrapper)
|
|
||||||
endif()
|
|
||||||
>>>>>>> origin/master:src/sip/jabber/CMakeLists.txt
|
|
Reference in New Issue
Block a user