1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-01 18:04:05 +02:00

Remove ENABLE_HEADLESS completely

This commit is contained in:
Uwe L. Korn
2014-07-21 09:30:38 +01:00
parent 3ee8df563f
commit bd2b0d2f76
41 changed files with 27 additions and 222 deletions

View File

@@ -114,13 +114,7 @@ INCLUDE( TomahawkCPack.cmake )
INCLUDE( MacroOptionalFindPackage ) INCLUDE( MacroOptionalFindPackage )
INCLUDE( MacroLogFeature ) INCLUDE( MacroLogFeature )
# headless mode message( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} ***" )
if( NOT BUILD_GUI )
add_definitions( -DENABLE_HEADLESS )
message( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} in HEADLESS mode ***" )
else()
message( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} full GUI version ***" )
endif()
if( NOT BUILD_WITH_QT4 ) if( NOT BUILD_WITH_QT4 )
find_package(Qt5Core QUIET) find_package(Qt5Core QUIET)

View File

@@ -46,10 +46,8 @@ const QString c_accessTokenServer("https://auth.hatchet.is/v1");
HatchetAccountFactory::HatchetAccountFactory() HatchetAccountFactory::HatchetAccountFactory()
{ {
#ifndef ENABLE_HEADLESS
if ( s_icon == 0 ) if ( s_icon == 0 )
s_icon = new QPixmap( ":/hatchet-account/hatchet-icon-512x512.png" ); s_icon = new QPixmap( ":/hatchet-account/hatchet-icon-512x512.png" );
#endif
} }

View File

@@ -122,13 +122,11 @@ ZeroconfPlugin::disconnectPlugin()
} }
#ifndef ENABLE_HEADLESS
QIcon QIcon
ZeroconfPlugin::icon() const ZeroconfPlugin::icon() const
{ {
return account()->icon(); return account()->icon();
} }
#endif
void void

View File

@@ -51,9 +51,7 @@ public:
virtual const QString serviceName() const; virtual const QString serviceName() const;
virtual Account::ConnectionState connectionState() const; virtual Account::ConnectionState connectionState() const;
virtual bool isValid() const { return true; } virtual bool isValid() const { return true; }
#ifndef ENABLE_HEADLESS
virtual QIcon icon() const; virtual QIcon icon() const;
#endif
virtual void checkSettings() {} virtual void checkSettings() {}
virtual void configurationChanged() {} virtual void configurationChanged() {}

View File

@@ -29,10 +29,8 @@ QPixmap* s_icon = 0;
ZeroconfFactory::ZeroconfFactory() ZeroconfFactory::ZeroconfFactory()
{ {
#ifndef ENABLE_HEADLESS
if ( s_icon == 0 ) if ( s_icon == 0 )
s_icon = new QPixmap( ":/zeroconf-account/zeroconf-icon.png" ); s_icon = new QPixmap( ":/zeroconf-account/zeroconf-icon.png" );
#endif
} }

View File

@@ -46,9 +46,7 @@ public:
QString description() const { return tr( "Automatically connect to Tomahawks on the local network" ); } QString description() const { return tr( "Automatically connect to Tomahawks on the local network" ); }
virtual bool isUnique() const { return true; } virtual bool isUnique() const { return true; }
AccountTypes types() const { return AccountTypes( SipType ); }; AccountTypes types() const { return AccountTypes( SipType ); };
#ifndef ENABLE_HEADLESS
virtual QPixmap icon() const; virtual QPixmap icon() const;
#endif
virtual Account* createAccount ( const QString& pluginId = QString() ); virtual Account* createAccount ( const QString& pluginId = QString() );

View File

@@ -895,14 +895,12 @@ DropJob::onTracksAdded( const QList<Tomahawk::query_ptr>& tracksList )
{ {
tDebug() << Q_FUNC_INFO << tracksList.count(); tDebug() << Q_FUNC_INFO << tracksList.count();
#ifndef ENABLE_HEADLESS
/* if ( results.isEmpty() ) /* if ( results.isEmpty() )
{ {
const QString which = album.isEmpty() ? "artist" : "album"; const QString which = album.isEmpty() ? "artist" : "album";
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "No tracks found for given %1" ).arg( which ), 5 ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "No tracks found for given %1" ).arg( which ), 5 ) );
}*/ }*/
#endif
if ( !m_dropJob.isEmpty() ) if ( !m_dropJob.isEmpty() )
{ {
@@ -1005,10 +1003,8 @@ DropJob::getArtist( const QString &artist, Tomahawk::ModelMode mode )
connect( artistPtr.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ), connect( artistPtr.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) ); SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
#ifndef ENABLE_HEADLESS
m_dropJob << new DropJobNotifier( QPixmap( RESPATH "images/album-icon.png" ), Album ); m_dropJob << new DropJobNotifier( QPixmap( RESPATH "images/album-icon.png" ), Album );
JobStatusView::instance()->model()->addJob( m_dropJob.last() ); JobStatusView::instance()->model()->addJob( m_dropJob.last() );
#endif
m_queryCount++; m_queryCount++;
} }
@@ -1037,10 +1033,8 @@ DropJob::getAlbum( const QString& artist, const QString& album )
connect( albumPtr.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ), connect( albumPtr.data(), SIGNAL( tracksAdded( QList<Tomahawk::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) ); SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
#ifndef ENABLE_HEADLESS
m_dropJob << new DropJobNotifier( QPixmap( RESPATH "images/album-icon.png" ), Album ); m_dropJob << new DropJobNotifier( QPixmap( RESPATH "images/album-icon.png" ), Album );
JobStatusView::instance()->model()->addJob( m_dropJob.last() ); JobStatusView::instance()->model()->addJob( m_dropJob.last() );
#endif
m_queryCount++; m_queryCount++;
} }

View File

@@ -173,8 +173,6 @@ GlobalActionManager::openUrl( const QString& url )
} }
#ifndef ENABLE_HEADLESS
QString QString
GlobalActionManager::copyPlaylistToClipboard( const dynplaylist_ptr& playlist ) GlobalActionManager::copyPlaylistToClipboard( const dynplaylist_ptr& playlist )
{ {
@@ -1276,8 +1274,6 @@ GlobalActionManager::openSpotifyLink( const QString& link )
return true; return true;
} }
#endif
QString QString
GlobalActionManager::hostname() const GlobalActionManager::hostname() const

View File

@@ -48,8 +48,6 @@ public:
public slots: public slots:
#ifndef ENABLE_HEADLESS
/** /**
* Try to open a URL as Playlist/Album/Artist/Track * Try to open a URL as Playlist/Album/Artist/Track
*/ */
@@ -74,13 +72,11 @@ public slots:
void handleOpenTracks( const QList< Tomahawk::query_ptr >& queries ); void handleOpenTracks( const QList< Tomahawk::query_ptr >& queries );
void handlePlayTrack( const Tomahawk::query_ptr& qry ); void handlePlayTrack( const Tomahawk::query_ptr& qry );
#endif
private slots: private slots:
void informationForUrl( const QString& url, const QSharedPointer<QObject>& information ); void informationForUrl( const QString& url, const QSharedPointer<QObject>& information );
void copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& callbackObj ); void copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& callbackObj );
#ifndef ENABLE_HEADLESS
void showPlaylist(); void showPlaylist();
void playlistCreatedToShow( const Tomahawk::playlist_ptr& pl ); void playlistCreatedToShow( const Tomahawk::playlist_ptr& pl );
@@ -90,13 +86,11 @@ private slots:
void playOrQueueNow( const Tomahawk::query_ptr& ); void playOrQueueNow( const Tomahawk::query_ptr& );
void playNow( const Tomahawk::query_ptr& ); void playNow( const Tomahawk::query_ptr& );
#endif
private: private:
explicit GlobalActionManager( QObject* parent = 0 ); explicit GlobalActionManager( QObject* parent = 0 );
/// handle opening of urls /// handle opening of urls
#ifndef ENABLE_HEADLESS
bool handlePlaylistCommand( const QUrl& url ); bool handlePlaylistCommand( const QUrl& url );
bool handleViewCommand( const QUrl& url ); bool handleViewCommand( const QUrl& url );
bool handleStationCommand( const QUrl& url ); bool handleStationCommand( const QUrl& url );
@@ -108,7 +102,6 @@ private:
bool playSpotify( const QUrl& url ); bool playSpotify( const QUrl& url );
bool queueSpotify( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems ); bool queueSpotify( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems );
#endif
bool handleCollectionCommand( const QUrl& url ); bool handleCollectionCommand( const QUrl& url );
bool handlePlayCommand( const QUrl& url ); bool handlePlayCommand( const QUrl& url );

View File

@@ -643,7 +643,6 @@ Track::composerPtr() const
} }
#ifndef ENABLE_HEADLESS
QPixmap QPixmap
Track::cover( const QSize& size, bool forceLoad ) const Track::cover( const QSize& size, bool forceLoad ) const
{ {
@@ -673,8 +672,6 @@ Track::coverLoaded() const
return d->artistPtr->coverLoaded(); return d->artistPtr->coverLoaded();
} }
#endif
QList<Tomahawk::query_ptr> QList<Tomahawk::query_ptr>
Track::similarTracks() const Track::similarTracks() const

View File

@@ -86,9 +86,7 @@ public:
Tomahawk::album_ptr albumPtr() const; Tomahawk::album_ptr albumPtr() const;
Tomahawk::artist_ptr composerPtr() const; Tomahawk::artist_ptr composerPtr() const;
#ifndef ENABLE_HEADLESS
QPixmap cover( const QSize& size, bool forceLoad = true ) const; QPixmap cover( const QSize& size, bool forceLoad = true ) const;
#endif
bool coverLoaded() const; bool coverLoaded() const;
void setLoved( bool loved, bool postToInfoSystem = true ); void setLoved( bool loved, bool postToInfoSystem = true );

View File

@@ -67,8 +67,6 @@ Account::~Account()
} }
#ifndef ENABLE_HEADLESS
AccountConfigWidget* AccountConfigWidget*
Account::configurationWidget() Account::configurationWidget()
{ {
@@ -89,8 +87,6 @@ Account::icon() const
return QPixmap(); return QPixmap();
} }
#endif
void void
Account::authenticate() Account::authenticate()

View File

@@ -95,12 +95,11 @@ public:
/** /**
* Configuration widgets can have a "dataError( bool )" signal to enable/disable the OK button in their wrapper dialogs. * Configuration widgets can have a "dataError( bool )" signal to enable/disable the OK button in their wrapper dialogs.
*/ */
#ifndef ENABLE_HEADLESS
virtual AccountConfigWidget* configurationWidget() = 0; virtual AccountConfigWidget* configurationWidget() = 0;
virtual QWidget* aboutWidget() { return 0; } virtual QWidget* aboutWidget() { return 0; }
virtual QWidget* aclWidget() = 0; virtual QWidget* aclWidget() = 0;
virtual QPixmap icon() const = 0; virtual QPixmap icon() const = 0;
#endif
virtual QString description() const { return QString(); } virtual QString description() const { return QString(); }
virtual QString author() const { return QString(); } virtual QString author() const { return QString(); }
virtual QString version() const { return QString(); } virtual QString version() const { return QString(); }

View File

@@ -26,9 +26,7 @@
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#ifndef ENABLE_HEADLESS
#include <QMessageBox> #include <QMessageBox>
#endif
#include <attica/content.h> #include <attica/content.h>
@@ -551,7 +549,7 @@ AccountModel::setData( const QModelIndex& index, const QVariant& value, int role
else if( state == Qt::Unchecked ) else if( state == Qt::Unchecked )
AccountManager::instance()->disableAccount( acct ); AccountManager::instance()->disableAccount( acct );
#if defined(Q_OS_LINUX) && !defined(ENABLE_HEADLESS) #if defined(Q_OS_LINUX)
if ( acct->preventEnabling() ) if ( acct->preventEnabling() )
{ {
// Can't install from attica yet on linux, so show a warning if the user tries to turn it on. // Can't install from attica yet on linux, so show a warning if the user tries to turn it on.

View File

@@ -21,6 +21,9 @@
#include "accounts/AccountManager.h" #include "accounts/AccountManager.h"
#include "infosystem/InfoSystem.h" #include "infosystem/InfoSystem.h"
#include "jobview/JobStatusView.h"
#include "jobview/JobStatusModel.h"
#include "jobview/ErrorStatusMessage.h"
#include "playlist/PlaylistUpdaterInterface.h" #include "playlist/PlaylistUpdaterInterface.h"
#include "resolvers/ScriptResolver.h" #include "resolvers/ScriptResolver.h"
#include "utils/Closure.h" #include "utils/Closure.h"
@@ -39,12 +42,6 @@
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
#include "Track.h" #include "Track.h"
#ifndef ENABLE_HEADLESS
#include "jobview/JobStatusView.h"
#include "jobview/JobStatusModel.h"
#include "jobview/ErrorStatusMessage.h"
#endif
#include <QAction> #include <QAction>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDir> #include <QDir>
@@ -1036,10 +1033,8 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg
if ( msg.value( "isDebugMsg" ).toBool() ) if ( msg.value( "isDebugMsg" ).toBool() )
tDebug( LOGVERBOSE ) << "SpotifyResolverError: " << error; tDebug( LOGVERBOSE ) << "SpotifyResolverError: " << error;
#ifndef ENABLE_HEADLESS
else else
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( QString( "Spotify: %1" ).arg( error ) ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( QString( "Spotify: %1" ).arg( error ) ) );
#endif
} }
else if ( msgType == "userChanged" ) else if ( msgType == "userChanged" )
{ {

View File

@@ -32,9 +32,7 @@
using namespace Tomahawk; using namespace Tomahawk;
using namespace Accounts; using namespace Accounts;
#ifndef ENABLE_HEADLESS
QPixmap* SpotifyPlaylistUpdater::s_typePixmap = 0; QPixmap* SpotifyPlaylistUpdater::s_typePixmap = 0;
#endif
Tomahawk::PlaylistUpdaterInterface* Tomahawk::PlaylistUpdaterInterface*
SpotifyUpdaterFactory::create( const Tomahawk::playlist_ptr& pl, const QVariantHash &settings ) SpotifyUpdaterFactory::create( const Tomahawk::playlist_ptr& pl, const QVariantHash &settings )
@@ -206,7 +204,6 @@ SpotifyPlaylistUpdater::type() const
} }
#ifndef ENABLE_HEADLESS
QPixmap QPixmap
SpotifyPlaylistUpdater::typeIcon() const SpotifyPlaylistUpdater::typeIcon() const
{ {
@@ -221,7 +218,6 @@ SpotifyPlaylistUpdater::typeIcon() const
return *s_typePixmap; return *s_typePixmap;
} }
#endif
void void

View File

@@ -48,10 +48,8 @@ public:
virtual QString type() const; virtual QString type() const;
virtual void updateNow() {} virtual void updateNow() {}
#ifndef ENABLE_HEADLESS
virtual QWidget* configurationWidget() const { return 0; } virtual QWidget* configurationWidget() const { return 0; }
virtual QPixmap typeIcon() const; virtual QPixmap typeIcon() const;
#endif
bool sync() const; bool sync() const;
void setSync( bool sync ); void setSync( bool sync );
@@ -127,9 +125,7 @@ private:
int m_subscribers; int m_subscribers;
QQueue<_detail::Closure*> m_queuedOps; QQueue<_detail::Closure*> m_queuedOps;
#ifndef ENABLE_HEADLESS
static QPixmap* s_typePixmap; static QPixmap* s_typePixmap;
#endif
}; };

View File

@@ -591,7 +591,6 @@ AudioEngine::sendNowPlayingNotification( const Tomahawk::InfoSystem::InfoType ty
if ( d->currentTrack.isNull() ) if ( d->currentTrack.isNull() )
return; return;
#ifndef ENABLE_HEADLESS
if ( d->currentTrack->track()->coverLoaded() ) if ( d->currentTrack->track()->coverLoaded() )
{ {
onNowPlayingInfoReady( type ); onNowPlayingInfoReady( type );
@@ -601,7 +600,6 @@ AudioEngine::sendNowPlayingNotification( const Tomahawk::InfoSystem::InfoType ty
NewClosure( d->currentTrack->track().data(), SIGNAL( coverChanged() ), const_cast< AudioEngine* >( this ), SLOT( sendNowPlayingNotification( const Tomahawk::InfoSystem::InfoType ) ), type ); NewClosure( d->currentTrack->track().data(), SIGNAL( coverChanged() ), const_cast< AudioEngine* >( this ), SLOT( sendNowPlayingNotification( const Tomahawk::InfoSystem::InfoType ) ), type );
d->currentTrack->track()->cover( QSize( 0, 0 ), true ); d->currentTrack->track()->cover( QSize( 0, 0 ), true );
} }
#endif
} }
@@ -616,7 +614,6 @@ AudioEngine::onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type )
QVariantMap playInfo; QVariantMap playInfo;
#ifndef ENABLE_HEADLESS
QImage cover; QImage cover;
cover = d->currentTrack->track()->cover( QSize( 0, 0 ) ).toImage(); cover = d->currentTrack->track()->cover( QSize( 0, 0 ) ).toImage();
if ( !cover.isNull() ) if ( !cover.isNull() )
@@ -643,7 +640,6 @@ AudioEngine::onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type )
} }
else else
tDebug() << Q_FUNC_INFO << "Cover from query is null!"; tDebug() << Q_FUNC_INFO << "Cover from query is null!";
#endif
Tomahawk::InfoSystem::InfoStringHash trackInfo; Tomahawk::InfoSystem::InfoStringHash trackInfo;
trackInfo["title"] = d->currentTrack->track()->track(); trackInfo["title"] = d->currentTrack->track()->track();

View File

@@ -22,16 +22,13 @@
#include <QSqlRecord> #include <QSqlRecord>
#include "DatabaseImpl.h" #include "DatabaseImpl.h"
#include "fuzzyindex/DatabaseFuzzyIndex.h"
#include "Source.h" #include "Source.h"
#include "TomahawkSqlQuery.h" #include "TomahawkSqlQuery.h"
#include "fuzzyindex/DatabaseFuzzyIndex.h"
#include "jobview/IndexingJobItem.h" #include "jobview/IndexingJobItem.h"
#include "jobview/JobStatusView.h"
#ifndef ENABLE_HEADLESS #include "jobview/JobStatusModel.h"
#include "jobview/JobStatusView.h"
#include "jobview/JobStatusModel.h"
#endif
#include "utils/Logger.h" #include "utils/Logger.h"
namespace Tomahawk namespace Tomahawk

View File

@@ -25,11 +25,9 @@
#include "PlaylistEntry.h" #include "PlaylistEntry.h"
#include "SourceList.h" #include "SourceList.h"
#include "ViewManager.h"
#include <TomahawkSettings.h> #include <TomahawkSettings.h>
#ifndef ENABLE_HEADLESS
#include "ViewManager.h"
#endif
using namespace Tomahawk; using namespace Tomahawk;

View File

@@ -18,11 +18,7 @@
*/ */
#include <QtDebug> #include <QtDebug>
#include <QDesktopServices>
#ifndef ENABLE_HEADLESS
#include <QDesktopServices>
#endif
#include "InfoSystemCache.h" #include "InfoSystemCache.h"
#include "TomahawkSettings.h" #include "TomahawkSettings.h"

View File

@@ -26,12 +26,9 @@
#include "JobStatusDelegate.h" #include "JobStatusDelegate.h"
#include "utils/Logger.h" #include "utils/Logger.h"
#include "Source.h" #include "Source.h"
#ifndef ENABLE_HEADLESS
#include "PipelineStatusItem.h" #include "PipelineStatusItem.h"
#include "TransferStatusItem.h" #include "TransferStatusItem.h"
#include "LatchedStatusItem.h" #include "LatchedStatusItem.h"
#endif
#include <QHeaderView> #include <QHeaderView>
#include <QVBoxLayout> #include <QVBoxLayout>
@@ -95,11 +92,9 @@ JobStatusView::JobStatusView( AnimatedSplitter* parent )
m_view->setAttribute( Qt::WA_MacShowFocusRect, 0 ); m_view->setAttribute( Qt::WA_MacShowFocusRect, 0 );
m_view->setUniformItemSizes( false ); m_view->setUniformItemSizes( false );
#ifndef ENABLE_HEADLESS
new PipelineStatusManager( this ); new PipelineStatusManager( this );
new TransferStatusManager( this ); new TransferStatusManager( this );
new LatchedStatusManager( this ); new LatchedStatusManager( this );
#endif
setMouseTracking( true ); setMouseTracking( true );
m_view->setMouseTracking( true ); m_view->setMouseTracking( true );

View File

@@ -24,11 +24,6 @@
#include "JobStatusModel.h" #include "JobStatusModel.h"
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#ifndef ENABLE_HEADLESS
#include "JobStatusModel.h"
#include "JobStatusView.h"
#endif
LatchedStatusItem::LatchedStatusItem( const Tomahawk::source_ptr& from, const Tomahawk::source_ptr& to, LatchedStatusManager* parent ) LatchedStatusItem::LatchedStatusItem( const Tomahawk::source_ptr& from, const Tomahawk::source_ptr& to, LatchedStatusManager* parent )
: JobStatusItem() : JobStatusItem()
, m_from( from ) , m_from( from )
@@ -80,11 +75,9 @@ LatchedStatusManager::latchedOn( const Tomahawk::source_ptr& from, const Tomahaw
if ( to->isLocal() ) if ( to->isLocal() )
{ {
#ifndef ENABLE_HEADLESS
LatchedStatusItem* item = new LatchedStatusItem( from, to, this ); LatchedStatusItem* item = new LatchedStatusItem( from, to, this );
m_jobs[ from->nodeId() ] = item; m_jobs[ from->nodeId() ] = item;
JobStatusView::instance()->model()->addJob( item ); JobStatusView::instance()->model()->addJob( item );
#endif
connect( from.data(), SIGNAL( offline() ), this, SLOT( sourceOffline() ), Qt::UniqueConnection ); connect( from.data(), SIGNAL( offline() ), this, SLOT( sourceOffline() ), Qt::UniqueConnection );
} }

View File

@@ -22,15 +22,12 @@
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "JobStatusModel.h"
#include "JobStatusView.h"
#include "Pipeline.h" #include "Pipeline.h"
#include "Source.h" #include "Source.h"
#include "Track.h" #include "Track.h"
#ifndef ENABLE_HEADLESS
#include "JobStatusModel.h"
#include "JobStatusView.h"
#endif
PipelineStatusItem::PipelineStatusItem( const Tomahawk::query_ptr& q ) PipelineStatusItem::PipelineStatusItem( const Tomahawk::query_ptr& q )
: JobStatusItem() : JobStatusItem()
@@ -103,12 +100,10 @@ PipelineStatusManager::resolving( const Tomahawk::query_ptr& p )
{ {
Q_UNUSED( p ); Q_UNUSED( p );
#ifndef ENABLE_HEADLESS
if ( m_curItem.isNull() ) if ( m_curItem.isNull() )
{ {
// No current query item and we're resolving something, so show it // No current query item and we're resolving something, so show it
m_curItem = QPointer< PipelineStatusItem >( new PipelineStatusItem( p ) ); m_curItem = QPointer< PipelineStatusItem >( new PipelineStatusItem( p ) );
JobStatusView::instance()->model()->addJob( m_curItem.data() ); JobStatusView::instance()->model()->addJob( m_curItem.data() );
} }
#endif
} }

View File

@@ -24,14 +24,12 @@
#include "utils/TomahawkUtilsGui.h" #include "utils/TomahawkUtilsGui.h"
#include "Artist.h" #include "Artist.h"
#include "JobStatusModel.h"
#include "JobStatusView.h"
#include "Result.h" #include "Result.h"
#include "Source.h" #include "Source.h"
#include "Track.h" #include "Track.h"
#ifndef ENABLE_HEADLESS
#include "JobStatusModel.h"
#include "JobStatusView.h"
#endif
// Forward Declarations breaking QSharedPointer // Forward Declarations breaking QSharedPointer
#if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 ) #if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 )
@@ -119,9 +117,7 @@ TransferStatusManager::TransferStatusManager( QObject* parent )
void void
TransferStatusManager::streamRegistered( StreamConnection* sc ) TransferStatusManager::streamRegistered( StreamConnection* sc )
{ {
#ifndef ENABLE_HEADLESS
JobStatusView::instance()->model()->addJob( new TransferStatusItem( this, sc ) ); JobStatusView::instance()->model()->addJob( new TransferStatusItem( this, sc ) );
#endif
} }

View File

@@ -26,10 +26,7 @@
#include <QTimer> #include <QTimer>
#include <QMutex> #include <QMutex>
#include <QPair> #include <QPair>
#ifndef ENABLE_HEADLESS
#include <QPixmap> #include <QPixmap>
#endif
namespace Tomahawk namespace Tomahawk
{ {
@@ -60,14 +57,12 @@ public:
// What type you are. If you add a new updater, add the creation code as well. // What type you are. If you add a new updater, add the creation code as well.
virtual QString type() const = 0; virtual QString type() const = 0;
#ifndef ENABLE_HEADLESS
// Small widget to show in playlist header that configures the updater // Small widget to show in playlist header that configures the updater
virtual QWidget* configurationWidget() const = 0; virtual QWidget* configurationWidget() const = 0;
// Small overlay over playlist icon in the sidebar to indicate that it has this updater type // Small overlay over playlist icon in the sidebar to indicate that it has this updater type
// Should be around 16x16 or something // Should be around 16x16 or something
virtual QPixmap typeIcon() const { return QPixmap(); } virtual QPixmap typeIcon() const { return QPixmap(); }
#endif
void remove(); void remove();

View File

@@ -27,11 +27,9 @@
#include "PlaylistEntry.h" #include "PlaylistEntry.h"
#include "Source.h" #include "Source.h"
#include <QCheckBox>
#include <QTimer> #include <QTimer>
#ifndef ENABLE_HEADLESS
#include <QCheckBox>
#endif
using namespace Tomahawk; using namespace Tomahawk;
@@ -58,7 +56,6 @@ XspfUpdater::XspfUpdater( const playlist_ptr& pl, int interval, bool autoUpdate,
connect( m_timer, SIGNAL( timeout() ), this, SLOT( updateNow() ) ); connect( m_timer, SIGNAL( timeout() ), this, SLOT( updateNow() ) );
#ifndef ENABLE_HEADLESS
m_toggleCheckbox = new QCheckBox( ); m_toggleCheckbox = new QCheckBox( );
m_toggleCheckbox->setText( tr( "Automatically update from XSPF" ) ); m_toggleCheckbox->setText( tr( "Automatically update from XSPF" ) );
m_toggleCheckbox->setLayoutDirection( Qt::RightToLeft ); m_toggleCheckbox->setLayoutDirection( Qt::RightToLeft );
@@ -66,7 +63,6 @@ XspfUpdater::XspfUpdater( const playlist_ptr& pl, int interval, bool autoUpdate,
m_toggleCheckbox->hide(); m_toggleCheckbox->hide();
connect( m_toggleCheckbox, SIGNAL( toggled( bool ) ), this, SLOT( setAutoUpdate( bool ) ) ); connect( m_toggleCheckbox, SIGNAL( toggled( bool ) ), this, SLOT( setAutoUpdate( bool ) ) );
#endif
QVariantHash s = settings(); QVariantHash s = settings();
s[ "autoupdate" ] = m_autoUpdate; s[ "autoupdate" ] = m_autoUpdate;
@@ -84,16 +80,12 @@ XspfUpdater::~XspfUpdater()
} }
#ifndef ENABLE_HEADLESS
QWidget* QWidget*
XspfUpdater::configurationWidget() const XspfUpdater::configurationWidget() const
{ {
return m_toggleCheckbox; return m_toggleCheckbox;
} }
#endif
void void
XspfUpdater::updateNow() XspfUpdater::updateNow()

View File

@@ -39,9 +39,7 @@ public:
virtual QString type() const { return "xspf"; } virtual QString type() const { return "xspf"; }
#ifndef ENABLE_HEADLESS
virtual QWidget* configurationWidget() const; virtual QWidget* configurationWidget() const;
#endif
bool autoUpdate() const { return m_autoUpdate; } bool autoUpdate() const { return m_autoUpdate; }
@@ -64,9 +62,7 @@ private:
bool m_autoUpdate; bool m_autoUpdate;
QString m_url; QString m_url;
#ifndef ENABLE_HEADLESS
QCheckBox* m_toggleCheckbox; QCheckBox* m_toggleCheckbox;
#endif
}; };
class DLLEXPORT XspfUpdaterFactory : public PlaylistUpdaterFactory class DLLEXPORT XspfUpdaterFactory : public PlaylistUpdaterFactory

View File

@@ -64,16 +64,12 @@ SipPlugin::inviteString() const
} }
#ifndef ENABLE_HEADLESS
QMenu* QMenu*
SipPlugin::menu() SipPlugin::menu()
{ {
return 0; return 0;
} }
#endif
Tomahawk::Accounts::Account* Tomahawk::Accounts::Account*
SipPlugin::account() const SipPlugin::account() const

View File

@@ -26,12 +26,9 @@
#include "Typedefs.h" #include "Typedefs.h"
#include <QObject> #include <QObject>
#include <QMenu>
#include <QString> #include <QString>
#ifndef ENABLE_HEADLESS
#include <QMenu>
#endif
#include "DllMacro.h" #include "DllMacro.h"
class SipInfo; class SipInfo;
@@ -64,9 +61,7 @@ public:
virtual const QString friendlyName() const; virtual const QString friendlyName() const;
virtual const QString serviceName() const; virtual const QString serviceName() const;
virtual QString inviteString() const; virtual QString inviteString() const;
#ifndef ENABLE_HEADLESS
virtual QMenu* menu(); virtual QMenu* menu();
#endif
virtual Tomahawk::Accounts::Account* account() const; virtual Tomahawk::Accounts::Account* account() const;
// peer infos // peer infos
@@ -91,13 +86,11 @@ signals:
void inviteSentSuccess( const QString& inviteId ); void inviteSentSuccess( const QString& inviteId );
void inviteSentFailure( const QString& inviteId ); void inviteSentFailure( const QString& inviteId );
#ifndef ENABLE_HEADLESS
// new data for own source // new data for own source
void avatarReceived ( const QPixmap& avatar ); void avatarReceived ( const QPixmap& avatar );
void addMenu( QMenu* menu ); void addMenu( QMenu* menu );
void removeMenu( QMenu* menu ); void removeMenu( QMenu* menu );
#endif
protected: protected:
void setAllPeersOffline(); void setAllPeersOffline();

View File

@@ -136,10 +136,8 @@ GroovesharkParser::lookupGroovesharkPlaylist( const QString& linkRaw )
NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->post( QNetworkRequest( url ), data ) ); NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->post( QNetworkRequest( url ), data ) );
connect( reply, SIGNAL( finished() ), SLOT( groovesharkLookupFinished() ) ); connect( reply, SIGNAL( finished() ), SLOT( groovesharkLookupFinished() ) );
#ifndef ENABLE_HEADLESS
m_browseJob = new DropJobNotifier( pixmap(), "Grooveshark", type, reply ); m_browseJob = new DropJobNotifier( pixmap(), "Grooveshark", type, reply );
JobStatusView::instance()->model()->addJob( m_browseJob ); JobStatusView::instance()->model()->addJob( m_browseJob );
#endif
m_queries.insert( reply ); m_queries.insert( reply );
} }
@@ -153,10 +151,8 @@ GroovesharkParser::lookupGroovesharkTrack( const QString& track )
NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( QUrl( track ) ) ) ); NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( QUrl( track ) ) ) );
connect( reply, SIGNAL( finished() ), SLOT( trackPageFetchFinished() ) ); connect( reply, SIGNAL( finished() ), SLOT( trackPageFetchFinished() ) );
#ifndef ENABLE_HEADLESS
m_browseJob = new DropJobNotifier( pixmap(), "Grooveshark", DropJob::Track, reply ); m_browseJob = new DropJobNotifier( pixmap(), "Grooveshark", DropJob::Track, reply );
JobStatusView::instance()->model()->addJob( m_browseJob ); JobStatusView::instance()->model()->addJob( m_browseJob );
#endif
m_queries << reply; m_queries << reply;
} }
@@ -239,9 +235,7 @@ GroovesharkParser::groovesharkLookupFinished()
} }
else else
{ {
#ifndef ENABLE_HEADLESS
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Error fetching Grooveshark information from the network!" ) ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Error fetching Grooveshark information from the network!" ) ) );
#endif
tLog() << "Error in network request to grooveshark for track decoding:" << r->reply()->errorString(); tLog() << "Error in network request to grooveshark for track decoding:" << r->reply()->errorString();
} }

View File

@@ -116,10 +116,8 @@ ItunesParser::lookupItunesUri( const QString& link )
NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ) ); NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ) );
connect( reply, SIGNAL( finished() ), SLOT( itunesResponseLookupFinished() ) ); connect( reply, SIGNAL( finished() ), SLOT( itunesResponseLookupFinished() ) );
#ifndef ENABLE_HEADLESS
DropJobNotifier* j = new DropJobNotifier( pixmap(), QString( "Itunes" ), type, reply ); DropJobNotifier* j = new DropJobNotifier( pixmap(), QString( "Itunes" ), type, reply );
JobStatusView::instance()->model()->addJob( j ); JobStatusView::instance()->model()->addJob( j );
#endif
m_queries.insert( reply ); m_queries.insert( reply );
} }
@@ -180,9 +178,7 @@ ItunesParser::itunesResponseLookupFinished()
} }
else else
{ {
#ifndef ENABLE_HEADLESS
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Error fetching iTunes information from the network!" ) ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Error fetching iTunes information from the network!" ) ) );
#endif
tLog() << "Error in network request to Itunes for track decoding:" << r->reply()->errorString(); tLog() << "Error in network request to Itunes for track decoding:" << r->reply()->errorString();
} }

View File

@@ -88,10 +88,8 @@ ShortenedLinkParser::lookupUrl( const QString& url )
m_queries.insert( reply ); m_queries.insert( reply );
#ifndef ENABLE_HEADLESS
m_expandJob = new DropJobNotifier( pixmap(), "shortened", DropJob::Track, reply ); m_expandJob = new DropJobNotifier( pixmap(), "shortened", DropJob::Track, reply );
JobStatusView::instance()->model()->addJob( m_expandJob ); JobStatusView::instance()->model()->addJob( m_expandJob );
#endif
} }
@@ -101,10 +99,8 @@ ShortenedLinkParser::lookupFinished( const QUrl& url )
NetworkReply* r = qobject_cast< NetworkReply* >( sender() ); NetworkReply* r = qobject_cast< NetworkReply* >( sender() );
Q_ASSERT( r ); Q_ASSERT( r );
#ifndef ENABLE_HEADLESS
if ( r->reply()->error() != QNetworkReply::NoError ) if ( r->reply()->error() != QNetworkReply::NoError )
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Network error parsing shortened link!" ) ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "Network error parsing shortened link!" ) ) );
#endif
tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Got an un-shortened url:" << r->reply()->url().toString(); tLog( LOGVERBOSE ) << Q_FUNC_INFO << "Got an un-shortened url:" << r->reply()->url().toString();
m_links << url.toString(); m_links << url.toString();
@@ -127,12 +123,8 @@ ShortenedLinkParser::checkFinished()
} }
#ifndef ENABLE_HEADLESS
QPixmap QPixmap
ShortenedLinkParser::pixmap() ShortenedLinkParser::pixmap()
{ {
return TomahawkUtils::defaultPixmap( TomahawkUtils::Add ); return TomahawkUtils::defaultPixmap( TomahawkUtils::Add );
} }
#endif

View File

@@ -24,13 +24,10 @@
#include "Typedefs.h" #include "Typedefs.h"
#include <QObject> #include <QObject>
#include <QPixmap>
#include <QSet> #include <QSet>
#include <QStringList> #include <QStringList>
#ifndef ENABLE_HEADLESS
#include <QPixmap>
#endif
class NetworkReply; class NetworkReply;
namespace Tomahawk namespace Tomahawk
@@ -64,9 +61,7 @@ private:
void lookupUrl( const QString& url ); void lookupUrl( const QString& url );
void checkFinished(); void checkFinished();
#ifndef ENABLE_HEADLESS
static QPixmap pixmap(); static QPixmap pixmap();
#endif
QStringList m_links; QStringList m_links;
QSet< NetworkReply* > m_queries; QSet< NetworkReply* > m_queries;

View File

@@ -181,10 +181,8 @@ SpotifyParser::lookupSpotifyBrowse( const QString& link )
NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ) ); NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ) );
connect( reply, SIGNAL( finished() ), SLOT( spotifyBrowseFinished() ) ); connect( reply, SIGNAL( finished() ), SLOT( spotifyBrowseFinished() ) );
#ifndef ENABLE_HEADLESS
m_browseJob = new DropJobNotifier( pixmap(), "Spotify", type, reply ); m_browseJob = new DropJobNotifier( pixmap(), "Spotify", type, reply );
JobStatusView::instance()->model()->addJob( m_browseJob ); JobStatusView::instance()->model()->addJob( m_browseJob );
#endif
m_queries.insert( reply ); m_queries.insert( reply );
} }
@@ -210,10 +208,8 @@ SpotifyParser::lookupTrack( const QString& link )
NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ) ); NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ) );
connect( reply, SIGNAL( finished() ), SLOT( spotifyTrackLookupFinished() ) ); connect( reply, SIGNAL( finished() ), SLOT( spotifyTrackLookupFinished() ) );
#ifndef ENABLE_HEADLESS
DropJobNotifier* j = new DropJobNotifier( pixmap(), QString( "Spotify" ), DropJob::Track, reply ); DropJobNotifier* j = new DropJobNotifier( pixmap(), QString( "Spotify" ), DropJob::Track, reply );
JobStatusView::instance()->model()->addJob( j ); JobStatusView::instance()->model()->addJob( j );
#endif
m_queries.insert( reply ); m_queries.insert( reply );
} }

View File

@@ -20,12 +20,9 @@
#include "XspfLoader.h" #include "XspfLoader.h"
#ifndef ENABLE_HEADLESS
#include "jobview/JobStatusView.h" #include "jobview/JobStatusView.h"
#include "jobview/JobStatusModel.h" #include "jobview/JobStatusModel.h"
#include "jobview/ErrorStatusMessage.h" #include "jobview/ErrorStatusMessage.h"
#endif
#include "playlist/XspfUpdater.h" #include "playlist/XspfUpdater.h"
#include "utils/NetworkReply.h" #include "utils/NetworkReply.h"
#include "utils/TomahawkUtils.h" #include "utils/TomahawkUtils.h"
@@ -173,13 +170,11 @@ void
XSPFLoader::reportError() XSPFLoader::reportError()
{ {
emit error( FetchError ); emit error( FetchError );
#ifndef ENABLE_HEADLESS
const QString errorMsg = errorToString( FetchError ); const QString errorMsg = errorToString( FetchError );
if ( !m_errorTitle.isEmpty() ) if ( !m_errorTitle.isEmpty() )
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( QString( "%1: %2" ).arg( m_errorTitle ).arg( errorMsg ) ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( QString( "%1: %2" ).arg( m_errorTitle ).arg( errorMsg ) ) );
else else
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( errorMsg ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( errorMsg ) );
#endif
deleteLater(); deleteLater();
} }

View File

@@ -24,14 +24,11 @@
#include "TomahawkApp.h" #include "TomahawkApp.h"
#include "Source.h" #include "Source.h"
#ifndef ENABLE_HEADLESS #include "accounts/AccountManager.h"
#include "accounts/AccountManager.h" #include "accounts/Account.h"
#include "accounts/Account.h" #include "jobview/AclJobItem.h"
#include "jobview/AclJobItem.h" #include "jobview/JobStatusView.h"
#include "jobview/JobStatusView.h" #include "jobview/JobStatusModel.h"
#include "jobview/JobStatusModel.h"
#endif
#include "utils/Logger.h" #include "utils/Logger.h"
#include <QThread> #include <QThread>
@@ -63,7 +60,6 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username,
return Tomahawk::ACLStatus::NotFound; return Tomahawk::ACLStatus::NotFound;
} }
#ifndef ENABLE_HEADLESS
if ( Tomahawk::Accounts::AccountManager::instance() ) if ( Tomahawk::Accounts::AccountManager::instance() )
{ {
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking account friendly names against" << username; tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Checking account friendly names against" << username;
@@ -82,7 +78,6 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username,
} }
} }
} }
#endif
bool found = false; bool found = false;
QMutableListIterator< ACLRegistry::User > i( m_cache ); QMutableListIterator< ACLRegistry::User > i( m_cache );
@@ -127,9 +122,7 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username,
user.knownAccountIds.append( username ); user.knownAccountIds.append( username );
if ( globalType != Tomahawk::ACLStatus::NotFound ) if ( globalType != Tomahawk::ACLStatus::NotFound )
user.acl = globalType; user.acl = globalType;
#ifdef ENABLE_HEADLESS
user.acl = Tomahawk::ACLStatus::Stream;
#else
if ( !TomahawkUtils::headless() ) if ( !TomahawkUtils::headless() )
{ {
getUserDecision( user, username ); getUserDecision( user, username );
@@ -137,7 +130,7 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username,
} }
else else
user.acl = Tomahawk::ACLStatus::Stream; user.acl = Tomahawk::ACLStatus::Stream;
#endif
m_cache.append( user ); m_cache.append( user );
save(); save();
emit aclResult( dbid, username, user.acl ); emit aclResult( dbid, username, user.acl );
@@ -145,7 +138,6 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username,
} }
#ifndef ENABLE_HEADLESS
void void
ACLRegistryImpl::getUserDecision( ACLRegistry::User user, const QString &username ) ACLRegistryImpl::getUserDecision( ACLRegistry::User user, const QString &username )
{ {
@@ -224,7 +216,6 @@ ACLRegistryImpl::queueNextJob()
} }
} }
} }
#endif
void void

View File

@@ -60,13 +60,11 @@ protected:
virtual void load(); virtual void load();
virtual void save(); virtual void save();
#ifndef ENABLE_HEADLESS
void getUserDecision( ACLRegistry::User user, const QString &username ); void getUserDecision( ACLRegistry::User user, const QString &username );
private slots: private slots:
void userDecision( ACLRegistry::User user ); void userDecision( ACLRegistry::User user );
void queueNextJob(); void queueNextJob();
#endif
private: private:
QQueue< ACLJobItem* > m_jobQueue; QQueue< ACLJobItem* > m_jobQueue;

View File

@@ -91,10 +91,6 @@
#include "linux/GnomeShortcutHandler.h" #include "linux/GnomeShortcutHandler.h"
#endif #endif
#ifndef ENABLE_HEADLESS
#include <QMessageBox>
#endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
#include "mac/MacShortcutHandler.h" #include "mac/MacShortcutHandler.h"
@@ -105,6 +101,7 @@
#include <QDir> #include <QDir>
#include <QMetaType> #include <QMetaType>
#include <QTime> #include <QTime>
#include <QMessageBox>
#include <QNetworkReply> #include <QNetworkReply>
#include <QFile> #include <QFile>
#include <QFileInfo> #include <QFileInfo>
@@ -143,9 +140,7 @@ using namespace Tomahawk;
TomahawkApp::TomahawkApp( int& argc, char *argv[] ) TomahawkApp::TomahawkApp( int& argc, char *argv[] )
: TOMAHAWK_APPLICATION( argc, argv ) : TOMAHAWK_APPLICATION( argc, argv )
#ifndef ENABLE_HEADLESS
, m_mainwindow( 0 ) , m_mainwindow( 0 )
#endif
, m_splashWidget( 0 ) , m_splashWidget( 0 )
, m_headless( false ) , m_headless( false )
{ {
@@ -174,9 +169,7 @@ TomahawkApp::init()
tLog() << "Starting Tomahawk..."; tLog() << "Starting Tomahawk...";
#ifdef ENABLE_HEADLESS
m_headless = true; m_headless = true;
#else
m_headless = arguments().contains( "--headless" ); m_headless = arguments().contains( "--headless" );
setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) ); setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) );
setQuitOnLastWindowClosed( false ); setQuitOnLastWindowClosed( false );
@@ -199,7 +192,6 @@ TomahawkApp::init()
tDebug() << "Font height:" << QFontMetrics( f ).height(); tDebug() << "Font height:" << QFontMetrics( f ).height();
#endif #endif
TomahawkUtils::setDefaultFontSize( f.pointSize() ); TomahawkUtils::setDefaultFontSize( f.pointSize() );
#endif
TomahawkUtils::setHeadless( m_headless ); TomahawkUtils::setHeadless( m_headless );
new ACLRegistryImpl( this ); new ACLRegistryImpl( this );
@@ -302,10 +294,8 @@ TomahawkApp::~TomahawkApp()
delete Tomahawk::Accounts::AccountManager::instance(); delete Tomahawk::Accounts::AccountManager::instance();
#ifndef ENABLE_HEADLESS
delete AtticaManager::instance(); delete AtticaManager::instance();
delete m_mainwindow; delete m_mainwindow;
#endif
// Main Window uses the AudioEngine, so delete it later. // Main Window uses the AudioEngine, so delete it later.
if ( !m_audioEngine.isNull() ) if ( !m_audioEngine.isNull() )
@@ -364,13 +354,11 @@ TomahawkApp::printHelp()
} }
#ifndef ENABLE_HEADLESS
AudioControls* AudioControls*
TomahawkApp::audioControls() TomahawkApp::audioControls()
{ {
return m_mainwindow->audioControls(); return m_mainwindow->audioControls();
} }
#endif
void void
@@ -615,7 +603,6 @@ TomahawkApp::onInfoSystemReady()
TomahawkSettings* s = TomahawkSettings::instance(); TomahawkSettings* s = TomahawkSettings::instance();
Echonest::Config::instance()->setNetworkAccessManager( Tomahawk::Utils::nam() ); Echonest::Config::instance()->setNetworkAccessManager( Tomahawk::Utils::nam() );
#ifndef ENABLE_HEADLESS
EchonestGenerator::setupCatalogs(); EchonestGenerator::setupCatalogs();
if ( !m_headless ) if ( !m_headless )
@@ -629,17 +616,14 @@ TomahawkApp::onInfoSystemReady()
m_mainwindow->show(); m_mainwindow->show();
} }
} }
#endif
tDebug() << "Init Local Collection."; tDebug() << "Init Local Collection.";
initLocalCollection(); initLocalCollection();
tDebug() << "Init Pipeline."; tDebug() << "Init Pipeline.";
initPipeline(); initPipeline();
#ifndef ENABLE_HEADLESS
// load remote list of resolvers able to be installed // load remote list of resolvers able to be installed
AtticaManager::instance(); AtticaManager::instance();
#endif
if ( arguments().contains( "--http" ) || TomahawkSettings::instance()->value( "network/http", true ).toBool() ) if ( arguments().contains( "--http" ) || TomahawkSettings::instance()->value( "network/http", true ).toBool() )
{ {
@@ -647,12 +631,10 @@ TomahawkApp::onInfoSystemReady()
} }
connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( initHTTP() ) ); connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( initHTTP() ) );
#ifndef ENABLE_HEADLESS
if ( !s->hasScannerPaths() ) if ( !s->hasScannerPaths() )
{ {
m_mainwindow->showSettingsDialog(); m_mainwindow->showSettingsDialog();
} }
#endif
#ifdef LIBLASTFM_FOUND #ifdef LIBLASTFM_FOUND
tDebug() << "Init Scrobbler."; tDebug() << "Init Scrobbler.";
@@ -679,14 +661,12 @@ TomahawkApp::onInfoSystemReady()
QApplication::setWheelScrollLines( qt_settings.value( "wheelScrollLines", QApplication::wheelScrollLines() ).toInt() ); QApplication::setWheelScrollLines( qt_settings.value( "wheelScrollLines", QApplication::wheelScrollLines() ).toInt() );
} }
#ifndef ENABLE_HEADLESS
// Make sure to init GAM in the gui thread // Make sure to init GAM in the gui thread
GlobalActionManager::instance(); GlobalActionManager::instance();
// check if our spotify playlist api server is up and running, and enable spotify playlist drops if so // check if our spotify playlist api server is up and running, and enable spotify playlist drops if so
QNetworkReply* r = Tomahawk::Utils::nam()->get( QNetworkRequest( QUrl( SPOTIFY_PLAYLIST_API_URL "/pong" ) ) ); QNetworkReply* r = Tomahawk::Utils::nam()->get( QNetworkRequest( QUrl( SPOTIFY_PLAYLIST_API_URL "/pong" ) ) );
connect( r, SIGNAL( finished() ), this, SLOT( spotifyApiCheckFinished() ) ); connect( r, SIGNAL( finished() ), this, SLOT( spotifyApiCheckFinished() ) );
#endif
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
// Make sure to do this after main window is inited // Make sure to do this after main window is inited
@@ -768,21 +748,17 @@ TomahawkApp::ipDetectionFailed( QNetworkReply::NetworkError error, QString error
void void
TomahawkApp::spotifyApiCheckFinished() TomahawkApp::spotifyApiCheckFinished()
{ {
#ifndef ENABLE_HEADLESS
QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() );
Q_ASSERT( reply ); Q_ASSERT( reply );
DropJob::setCanParseSpotifyPlaylists( !reply->error() ); DropJob::setCanParseSpotifyPlaylists( !reply->error() );
#endif
} }
void void
TomahawkApp::activate() TomahawkApp::activate()
{ {
#ifndef ENABLE_HEADLESS
TomahawkUtils::bringToFront(); TomahawkUtils::bringToFront();
#endif
} }

View File

@@ -68,9 +68,7 @@ namespace Tomahawk
#include "Scrobbler.h" #include "Scrobbler.h"
#endif #endif
#ifndef TOMAHAWK_HEADLESS
class TomahawkWindow; class TomahawkWindow;
#endif
// this also acts as a a container for important top-level objects // this also acts as a a container for important top-level objects
@@ -87,10 +85,8 @@ public:
void init(); void init();
static TomahawkApp* instance(); static TomahawkApp* instance();
#ifndef ENABLE_HEADLESS
AudioControls* audioControls(); AudioControls* audioControls();
TomahawkWindow* mainWindow() const; TomahawkWindow* mainWindow() const;
#endif
// PlatformInterface // PlatformInterface
virtual bool loadUrl( const QString& url ); virtual bool loadUrl( const QString& url );
@@ -150,9 +146,7 @@ private:
Scrobbler* m_scrobbler; Scrobbler* m_scrobbler;
#endif #endif
#ifndef TOMAHAWK_HEADLESS
TomahawkWindow* m_mainwindow; TomahawkWindow* m_mainwindow;
#endif
QPointer<PlaydarApi> playdarApi; QPointer<PlaydarApi> playdarApi;
SplashWidget* m_splashWidget; SplashWidget* m_splashWidget;

View File

@@ -1176,9 +1176,7 @@ TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ )
tLog() << msg; tLog() << msg;
#ifndef ENABLE_HEADLESS
JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( msg, 15 ) ); JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( msg, 15 ) );
#endif
if ( m_audioRetryCounter < 3 ) if ( m_audioRetryCounter < 3 )
AudioEngine::instance()->play(); AudioEngine::instance()->play();