diff --git a/src/accounts/xmpp/sip/XmppSip.cpp b/src/accounts/xmpp/sip/XmppSip.cpp index 58c7c27ce..6156bbb8c 100644 --- a/src/accounts/xmpp/sip/XmppSip.cpp +++ b/src/accounts/xmpp/sip/XmppSip.cpp @@ -52,12 +52,9 @@ #include #include #include - -#ifndef ENABLE_HEADLESS - #include - #include - #include -#endif +#include +#include +#include using namespace Tomahawk; using namespace Accounts; @@ -95,11 +92,9 @@ JreenMessageHandler( QtMsgType type, const char *msg ) XmppSipPlugin::XmppSipPlugin( Account* account ) : SipPlugin( account ) , m_state( Account::Disconnected ) -#ifndef ENABLE_HEADLESS , m_menu( 0 ) , m_xmlConsole( 0 ) , m_pubSubManager( 0 ) -#endif { #if QT_VERSION <= QT_VERSION_CHECK( 5, 0, 0 ) Jreen::Logger::addHandler( JreenMessageHandler ); @@ -121,14 +116,12 @@ XmppSipPlugin::XmppSipPlugin( Account* account ) m_currentResource = QString( "tomahawk%1" ).arg( QString::number( qrand() % 10000 ) ); m_client->setResource( m_currentResource ); -#ifndef ENABLE_HEADLESS // instantiate XmlConsole if ( readXmlConsoleEnabled() ) { m_xmlConsole = new XmlConsole( m_client ); m_xmlConsole->show(); } -#endif // add VCardUpdate extension to own presence m_client->presence().addExtension( new Jreen::VCardUpdate() ); @@ -136,10 +129,8 @@ XmppSipPlugin::XmppSipPlugin( Account* account ) // initaliaze the roster m_roster = new Jreen::SimpleRoster( m_client ); -#ifndef ENABLE_HEADLESS // initialize the AvatarManager m_avatarManager = new AvatarManager( m_client ); -#endif // setup disco m_client->disco()->setSoftwareVersion( "Tomahawk Player", TOMAHAWK_VERSION, TOMAHAWK_SYSTEM ); @@ -167,9 +158,7 @@ XmppSipPlugin::XmppSipPlugin( Account* account ) connect( m_roster, SIGNAL( subscriptionReceived( Jreen::RosterItem::Ptr, Jreen::Presence ) ), SLOT( onSubscriptionReceived( Jreen::RosterItem::Ptr, Jreen::Presence ) ) ); -#ifndef ENABLE_HEADLESS connect( m_avatarManager, SIGNAL( newAvatar( QString ) ), SLOT( onNewAvatar( QString ) ) ); -#endif m_pubSubManager = new Jreen::PubSub::Manager( m_client ); m_pubSubManager->addEntityType< Jreen::Tune >(); @@ -189,9 +178,7 @@ XmppSipPlugin::~XmppSipPlugin() delete m_pubSubManager; delete m_avatarManager; delete m_roster; -#ifndef ENABLE_HEADLESS delete m_xmlConsole; -#endif delete m_client; } @@ -213,13 +200,11 @@ XmppSipPlugin::infoPlugin() } -#ifndef ENABLE_HEADLESS QMenu* XmppSipPlugin::menu() { return m_menu; } -#endif void @@ -495,7 +480,6 @@ XmppSipPlugin::addContact( const QString& jid, AddContactOptions options, const void XmppSipPlugin::showAddFriendDialog() { -#ifndef ENABLE_HEADLESS bool ok; QString id = QInputDialog::getText( TomahawkUtils::tomahawkWindow(), tr( "Add Friend" ), tr( "Enter Xmpp ID:" ), QLineEdit::Normal, "", &ok ).trimmed(); @@ -505,7 +489,6 @@ XmppSipPlugin::showAddFriendDialog() qDebug() << "Attempting to add xmpp contact to roster:" << id; addContact( id, SendInvite ); -#endif } @@ -554,9 +537,7 @@ XmppSipPlugin::defaultSuffix() const void XmppSipPlugin::showXmlConsole() { -#ifndef ENABLE_HEADLESS m_xmlConsole->show(); -#endif } @@ -649,7 +630,6 @@ XmppSipPlugin::setupClientHelper() void XmppSipPlugin::addMenuHelper() { -#ifndef ENABLE_HEADLESS if ( !m_menu ) { m_menu = new QMenu( QString( "%1 (" ).arg( friendlyName() ).append( readUsername() ).append(")" ) ); @@ -665,14 +645,12 @@ XmppSipPlugin::addMenuHelper() emit addMenu( m_menu ); } -#endif } void XmppSipPlugin::removeMenuHelper() { -#ifndef ENABLE_HEADLESS if ( m_menu ) { emit removeMenu( m_menu ); @@ -680,7 +658,6 @@ XmppSipPlugin::removeMenuHelper() delete m_menu; m_menu = 0; } -#endif } @@ -813,7 +790,6 @@ XmppSipPlugin::onSubscriptionReceived( const Jreen::RosterItem::Ptr& item, const return; } -#ifndef ENABLE_HEADLESS // preparing the confirm box for the user QMessageBox *confirmBox = new QMessageBox( QMessageBox::Question, @@ -828,14 +804,12 @@ XmppSipPlugin::onSubscriptionReceived( const Jreen::RosterItem::Ptr& item, const // display the box and wait for the answer confirmBox->open( this, SLOT( onSubscriptionRequestConfirmed( int ) ) ); -#endif } void XmppSipPlugin::onSubscriptionRequestConfirmed( int result ) { -#ifndef ENABLE_HEADLESS qDebug() << Q_FUNC_INFO << result; QList< QMessageBox* > confirmBoxes = m_subscriptionConfirmBoxes.values(); @@ -865,7 +839,6 @@ XmppSipPlugin::onSubscriptionRequestConfirmed( int result ) } m_roster->allowSubscription( jid, allowSubscription == QMessageBox::Yes ); -#endif } @@ -1046,10 +1019,8 @@ XmppSipPlugin::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type pr peersWaitingForSip[fulljid] = peerInfo; peersWaitingForVersionString[fulljid] = peerInfo; -#ifndef ENABLE_HEADLESS if ( !m_avatarManager->avatar( jid.bare() ).isNull() ) onNewAvatar( jid.bare() ); -#endif // request software version Jreen::IQ versionIq( Jreen::IQ::Get, jid ); @@ -1069,8 +1040,6 @@ XmppSipPlugin::handlePeerStatus( const Jreen::JID& jid, Jreen::Presence::Type pr void XmppSipPlugin::onNewAvatar( const QString& jid ) { -#ifndef ENABLE_HEADLESS -// qDebug() << Q_FUNC_INFO << jid; if ( m_state != Account::Connected ) return; @@ -1092,7 +1061,6 @@ XmppSipPlugin::onNewAvatar( const QString& jid ) { PeerInfo::getSelf( this, PeerInfo::AutoCreate )->setAvatar( m_avatarManager->avatar( jid ) ); } -#endif } diff --git a/src/accounts/xmpp/sip/XmppSip.h b/src/accounts/xmpp/sip/XmppSip.h index 82da16446..73da244dd 100644 --- a/src/accounts/xmpp/sip/XmppSip.h +++ b/src/accounts/xmpp/sip/XmppSip.h @@ -27,9 +27,7 @@ #include "AvatarManager.h" -#ifndef ENABLE_HEADLESS - #include "XmlConsole.h" -#endif +#include "XmlConsole.h" #include "accounts/AccountDllMacro.h" #include "accounts/Account.h" @@ -50,10 +48,7 @@ #include #include -#ifndef ENABLE_HEADLESS - #include -#endif - +#include class ACCOUNTDLLEXPORT XmppSipPlugin : public SipPlugin { @@ -71,9 +66,7 @@ public: Tomahawk::InfoSystem::InfoPluginPtr infoPlugin(); -#ifndef ENABLE_HEADLESS virtual QMenu* menu(); -#endif // used by XmppAccount to expose connection state and controls Tomahawk::Accounts::Account::ConnectionState connectionState() const; @@ -146,11 +139,9 @@ private: QHash< Jreen::JID, Jreen::Presence::Type > m_peers; QHash< QString, QString > m_jidsNames; -#ifndef ENABLE_HEADLESS QHash< Jreen::JID, QMessageBox* > m_subscriptionConfirmBoxes; QMenu* m_menu; XmlConsole* m_xmlConsole; -#endif enum IqContext { NoContext, RequestDisco, RequestedDisco, SipMessageSent, RequestedVCard, RequestVersion, RequestedVersion }; AvatarManager* m_avatarManager; diff --git a/src/libtomahawk/Source.cpp b/src/libtomahawk/Source.cpp index 08f15fcd9..dd1d6aaf8 100644 --- a/src/libtomahawk/Source.cpp +++ b/src/libtomahawk/Source.cpp @@ -29,24 +29,19 @@ #include "database/DatabaseCommand_AddSource.h" #include "database/DatabaseCommand_CollectionStats.h" #include "database/DatabaseCommand_LoadAllSources.h" +#include "database/DatabaseCommand_SocialAction.h" #include "database/DatabaseCommand_SourceOffline.h" #include "database/DatabaseCommand_UpdateSearchIndex.h" #include "database/DatabaseImpl.h" #include "database/Database.h" +#include "utils/Logger.h" +#include "sip/PeerInfo.h" +#include "utils/TomahawkCache.h" +#include "utils/TomahawkUtilsGui.h" #include #include -#include "utils/TomahawkCache.h" -#include "database/DatabaseCommand_SocialAction.h" - -#ifndef ENABLE_HEADLESS - #include "utils/TomahawkUtilsGui.h" -#endif - -#include "utils/Logger.h" -#include "sip/PeerInfo.h" - using namespace Tomahawk; @@ -281,7 +276,6 @@ Source::friendlyNamesLessThan( const QString& first, const QString& second ) } -#ifndef ENABLE_HEADLESS QPixmap Source::avatar( TomahawkUtils::ImageMode style, const QSize& size ) { @@ -320,7 +314,6 @@ Source::avatar( TomahawkUtils::ImageMode style, const QSize& size ) return QPixmap(); } -#endif void diff --git a/src/libtomahawk/Source.h b/src/libtomahawk/Source.h index e53b782c8..4c3196f3d 100644 --- a/src/libtomahawk/Source.h +++ b/src/libtomahawk/Source.h @@ -80,9 +80,7 @@ public: QString dbFriendlyName() const; void setDbFriendlyName( const QString& dbFriendlyName ); -#ifndef ENABLE_HEADLESS QPixmap avatar( TomahawkUtils::ImageMode style = TomahawkUtils::Original, const QSize& size = QSize() ); -#endif collection_ptr dbCollection() const; QList< Tomahawk::collection_ptr > collections() const;