From bd2b0d2f76073536ee8ca8bdf1406800188502d7 Mon Sep 17 00:00:00 2001 From: "Uwe L. Korn" Date: Mon, 21 Jul 2014 09:30:38 +0100 Subject: [PATCH] Remove ENABLE_HEADLESS completely --- CMakeLists.txt | 8 +----- .../hatchet/account/HatchetAccount.cpp | 2 -- src/accounts/zeroconf/Zeroconf.cpp | 2 -- src/accounts/zeroconf/Zeroconf.h | 2 -- src/accounts/zeroconf/ZeroconfAccount.cpp | 2 -- src/accounts/zeroconf/ZeroconfAccount.h | 2 -- src/libtomahawk/DropJob.cpp | 6 ----- src/libtomahawk/GlobalActionManager.cpp | 4 --- src/libtomahawk/GlobalActionManager.h | 7 ----- src/libtomahawk/Track.cpp | 3 --- src/libtomahawk/Track.h | 2 -- src/libtomahawk/accounts/Account.cpp | 4 --- src/libtomahawk/accounts/Account.h | 3 +-- src/libtomahawk/accounts/AccountModel.cpp | 4 +-- .../accounts/spotify/SpotifyAccount.cpp | 11 +++----- .../spotify/SpotifyPlaylistUpdater.cpp | 4 --- .../accounts/spotify/SpotifyPlaylistUpdater.h | 4 --- src/libtomahawk/audio/AudioEngine.cpp | 4 --- .../DatabaseCommand_UpdateSearchIndex.cpp | 11 +++----- src/libtomahawk/database/LocalCollection.cpp | 4 +-- .../infosystem/InfoSystemCache.cpp | 6 +---- src/libtomahawk/jobview/JobStatusView.cpp | 5 ---- src/libtomahawk/jobview/LatchedStatusItem.cpp | 7 ----- .../jobview/PipelineStatusItem.cpp | 9 ++----- .../jobview/TransferStatusItem.cpp | 8 ++---- .../playlist/PlaylistUpdaterInterface.h | 5 ---- src/libtomahawk/playlist/XspfUpdater.cpp | 10 +------ src/libtomahawk/playlist/XspfUpdater.h | 4 --- src/libtomahawk/sip/SipPlugin.cpp | 4 --- src/libtomahawk/sip/SipPlugin.h | 9 +------ src/libtomahawk/utils/GroovesharkParser.cpp | 6 ----- src/libtomahawk/utils/ItunesParser.cpp | 4 --- src/libtomahawk/utils/ShortenedLinkParser.cpp | 8 ------ src/libtomahawk/utils/ShortenedLinkParser.h | 7 +---- src/libtomahawk/utils/SpotifyParser.cpp | 4 --- src/libtomahawk/utils/XspfLoader.cpp | 5 ---- src/tomahawk/AclRegistryImpl.cpp | 23 +++++----------- src/tomahawk/AclRegistryImpl.h | 2 -- src/tomahawk/TomahawkApp.cpp | 26 +------------------ src/tomahawk/TomahawkApp.h | 6 ----- src/tomahawk/TomahawkWindow.cpp | 2 -- 41 files changed, 27 insertions(+), 222 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 27ed872cf..ea3010e04 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,13 +114,7 @@ INCLUDE( TomahawkCPack.cmake ) INCLUDE( MacroOptionalFindPackage ) INCLUDE( MacroLogFeature ) -# headless mode -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() +message( STATUS "Building Tomahawk ${TOMAHAWK_VERSION} ***" ) if( NOT BUILD_WITH_QT4 ) find_package(Qt5Core QUIET) diff --git a/src/accounts/hatchet/account/HatchetAccount.cpp b/src/accounts/hatchet/account/HatchetAccount.cpp index 1372ba3b0..894958d9c 100644 --- a/src/accounts/hatchet/account/HatchetAccount.cpp +++ b/src/accounts/hatchet/account/HatchetAccount.cpp @@ -46,10 +46,8 @@ const QString c_accessTokenServer("https://auth.hatchet.is/v1"); HatchetAccountFactory::HatchetAccountFactory() { -#ifndef ENABLE_HEADLESS if ( s_icon == 0 ) s_icon = new QPixmap( ":/hatchet-account/hatchet-icon-512x512.png" ); -#endif } diff --git a/src/accounts/zeroconf/Zeroconf.cpp b/src/accounts/zeroconf/Zeroconf.cpp index 579b7528f..feaf885fb 100644 --- a/src/accounts/zeroconf/Zeroconf.cpp +++ b/src/accounts/zeroconf/Zeroconf.cpp @@ -122,13 +122,11 @@ ZeroconfPlugin::disconnectPlugin() } -#ifndef ENABLE_HEADLESS QIcon ZeroconfPlugin::icon() const { return account()->icon(); } -#endif void diff --git a/src/accounts/zeroconf/Zeroconf.h b/src/accounts/zeroconf/Zeroconf.h index af8d955f5..94eda0060 100644 --- a/src/accounts/zeroconf/Zeroconf.h +++ b/src/accounts/zeroconf/Zeroconf.h @@ -51,9 +51,7 @@ public: virtual const QString serviceName() const; virtual Account::ConnectionState connectionState() const; virtual bool isValid() const { return true; } -#ifndef ENABLE_HEADLESS virtual QIcon icon() const; -#endif virtual void checkSettings() {} virtual void configurationChanged() {} diff --git a/src/accounts/zeroconf/ZeroconfAccount.cpp b/src/accounts/zeroconf/ZeroconfAccount.cpp index f1be3b71f..e40003b3b 100644 --- a/src/accounts/zeroconf/ZeroconfAccount.cpp +++ b/src/accounts/zeroconf/ZeroconfAccount.cpp @@ -29,10 +29,8 @@ QPixmap* s_icon = 0; ZeroconfFactory::ZeroconfFactory() { -#ifndef ENABLE_HEADLESS if ( s_icon == 0 ) s_icon = new QPixmap( ":/zeroconf-account/zeroconf-icon.png" ); -#endif } diff --git a/src/accounts/zeroconf/ZeroconfAccount.h b/src/accounts/zeroconf/ZeroconfAccount.h index f110b6ec9..59a14e07d 100644 --- a/src/accounts/zeroconf/ZeroconfAccount.h +++ b/src/accounts/zeroconf/ZeroconfAccount.h @@ -46,9 +46,7 @@ public: QString description() const { return tr( "Automatically connect to Tomahawks on the local network" ); } virtual bool isUnique() const { return true; } AccountTypes types() const { return AccountTypes( SipType ); }; -#ifndef ENABLE_HEADLESS virtual QPixmap icon() const; -#endif virtual Account* createAccount ( const QString& pluginId = QString() ); diff --git a/src/libtomahawk/DropJob.cpp b/src/libtomahawk/DropJob.cpp index 48c344041..05b25a32e 100644 --- a/src/libtomahawk/DropJob.cpp +++ b/src/libtomahawk/DropJob.cpp @@ -895,14 +895,12 @@ DropJob::onTracksAdded( const QList& tracksList ) { tDebug() << Q_FUNC_INFO << tracksList.count(); -#ifndef ENABLE_HEADLESS /* if ( results.isEmpty() ) { const QString which = album.isEmpty() ? "artist" : "album"; JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( tr( "No tracks found for given %1" ).arg( which ), 5 ) ); }*/ -#endif if ( !m_dropJob.isEmpty() ) { @@ -1005,10 +1003,8 @@ DropJob::getArtist( const QString &artist, Tomahawk::ModelMode mode ) connect( artistPtr.data(), SIGNAL( tracksAdded( QList, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ), SLOT( onTracksAdded( QList ) ) ); -#ifndef ENABLE_HEADLESS m_dropJob << new DropJobNotifier( QPixmap( RESPATH "images/album-icon.png" ), Album ); JobStatusView::instance()->model()->addJob( m_dropJob.last() ); -#endif m_queryCount++; } @@ -1037,10 +1033,8 @@ DropJob::getAlbum( const QString& artist, const QString& album ) connect( albumPtr.data(), SIGNAL( tracksAdded( QList, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ), SLOT( onTracksAdded( QList ) ) ); -#ifndef ENABLE_HEADLESS m_dropJob << new DropJobNotifier( QPixmap( RESPATH "images/album-icon.png" ), Album ); JobStatusView::instance()->model()->addJob( m_dropJob.last() ); -#endif m_queryCount++; } diff --git a/src/libtomahawk/GlobalActionManager.cpp b/src/libtomahawk/GlobalActionManager.cpp index 5ce32cf6e..8efca639d 100644 --- a/src/libtomahawk/GlobalActionManager.cpp +++ b/src/libtomahawk/GlobalActionManager.cpp @@ -173,8 +173,6 @@ GlobalActionManager::openUrl( const QString& url ) } -#ifndef ENABLE_HEADLESS - QString GlobalActionManager::copyPlaylistToClipboard( const dynplaylist_ptr& playlist ) { @@ -1276,8 +1274,6 @@ GlobalActionManager::openSpotifyLink( const QString& link ) return true; } -#endif - QString GlobalActionManager::hostname() const diff --git a/src/libtomahawk/GlobalActionManager.h b/src/libtomahawk/GlobalActionManager.h index 0fb7a548a..e09fb1cf9 100644 --- a/src/libtomahawk/GlobalActionManager.h +++ b/src/libtomahawk/GlobalActionManager.h @@ -48,8 +48,6 @@ public: public slots: -#ifndef ENABLE_HEADLESS - /** * 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 handlePlayTrack( const Tomahawk::query_ptr& qry ); -#endif private slots: void informationForUrl( const QString& url, const QSharedPointer& information ); void copyToClipboardReady( const QUrl& longUrl, const QUrl& shortUrl, const QVariant& callbackObj ); -#ifndef ENABLE_HEADLESS void showPlaylist(); void playlistCreatedToShow( const Tomahawk::playlist_ptr& pl ); @@ -90,13 +86,11 @@ private slots: void playOrQueueNow( const Tomahawk::query_ptr& ); void playNow( const Tomahawk::query_ptr& ); -#endif private: explicit GlobalActionManager( QObject* parent = 0 ); /// handle opening of urls -#ifndef ENABLE_HEADLESS bool handlePlaylistCommand( const QUrl& url ); bool handleViewCommand( const QUrl& url ); bool handleStationCommand( const QUrl& url ); @@ -108,7 +102,6 @@ private: bool playSpotify( const QUrl& url ); bool queueSpotify( const QStringList& parts, const QList< QPair< QString, QString > >& queryItems ); -#endif bool handleCollectionCommand( const QUrl& url ); bool handlePlayCommand( const QUrl& url ); diff --git a/src/libtomahawk/Track.cpp b/src/libtomahawk/Track.cpp index 687b7449d..7e9e768b5 100644 --- a/src/libtomahawk/Track.cpp +++ b/src/libtomahawk/Track.cpp @@ -643,7 +643,6 @@ Track::composerPtr() const } -#ifndef ENABLE_HEADLESS QPixmap Track::cover( const QSize& size, bool forceLoad ) const { @@ -673,8 +672,6 @@ Track::coverLoaded() const return d->artistPtr->coverLoaded(); } -#endif - QList Track::similarTracks() const diff --git a/src/libtomahawk/Track.h b/src/libtomahawk/Track.h index e838593df..cbdfdbd47 100644 --- a/src/libtomahawk/Track.h +++ b/src/libtomahawk/Track.h @@ -86,9 +86,7 @@ public: Tomahawk::album_ptr albumPtr() const; Tomahawk::artist_ptr composerPtr() const; -#ifndef ENABLE_HEADLESS QPixmap cover( const QSize& size, bool forceLoad = true ) const; -#endif bool coverLoaded() const; void setLoved( bool loved, bool postToInfoSystem = true ); diff --git a/src/libtomahawk/accounts/Account.cpp b/src/libtomahawk/accounts/Account.cpp index bd4969aaf..3377f7885 100644 --- a/src/libtomahawk/accounts/Account.cpp +++ b/src/libtomahawk/accounts/Account.cpp @@ -67,8 +67,6 @@ Account::~Account() } -#ifndef ENABLE_HEADLESS - AccountConfigWidget* Account::configurationWidget() { @@ -89,8 +87,6 @@ Account::icon() const return QPixmap(); } -#endif - void Account::authenticate() diff --git a/src/libtomahawk/accounts/Account.h b/src/libtomahawk/accounts/Account.h index b51e0fc78..067baf35a 100644 --- a/src/libtomahawk/accounts/Account.h +++ b/src/libtomahawk/accounts/Account.h @@ -95,12 +95,11 @@ public: /** * 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 QWidget* aboutWidget() { return 0; } virtual QWidget* aclWidget() = 0; virtual QPixmap icon() const = 0; -#endif + virtual QString description() const { return QString(); } virtual QString author() const { return QString(); } virtual QString version() const { return QString(); } diff --git a/src/libtomahawk/accounts/AccountModel.cpp b/src/libtomahawk/accounts/AccountModel.cpp index ff36e0b6b..c77abbe32 100644 --- a/src/libtomahawk/accounts/AccountModel.cpp +++ b/src/libtomahawk/accounts/AccountModel.cpp @@ -26,9 +26,7 @@ #include "TomahawkSettings.h" #include "utils/Logger.h" -#ifndef ENABLE_HEADLESS #include -#endif #include @@ -551,7 +549,7 @@ AccountModel::setData( const QModelIndex& index, const QVariant& value, int role else if( state == Qt::Unchecked ) AccountManager::instance()->disableAccount( acct ); -#if defined(Q_OS_LINUX) && !defined(ENABLE_HEADLESS) +#if defined(Q_OS_LINUX) if ( acct->preventEnabling() ) { // Can't install from attica yet on linux, so show a warning if the user tries to turn it on. diff --git a/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp b/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp index 968d7ee6b..5efaa1b52 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp +++ b/src/libtomahawk/accounts/spotify/SpotifyAccount.cpp @@ -21,6 +21,9 @@ #include "accounts/AccountManager.h" #include "infosystem/InfoSystem.h" +#include "jobview/JobStatusView.h" +#include "jobview/JobStatusModel.h" +#include "jobview/ErrorStatusMessage.h" #include "playlist/PlaylistUpdaterInterface.h" #include "resolvers/ScriptResolver.h" #include "utils/Closure.h" @@ -39,12 +42,6 @@ #include "TomahawkSettings.h" #include "Track.h" -#ifndef ENABLE_HEADLESS -#include "jobview/JobStatusView.h" -#include "jobview/JobStatusModel.h" -#include "jobview/ErrorStatusMessage.h" -#endif - #include #include #include @@ -1036,10 +1033,8 @@ SpotifyAccount::resolverMessage( const QString &msgType, const QVariantMap &msg if ( msg.value( "isDebugMsg" ).toBool() ) tDebug( LOGVERBOSE ) << "SpotifyResolverError: " << error; -#ifndef ENABLE_HEADLESS else JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( QString( "Spotify: %1" ).arg( error ) ) ); -#endif } else if ( msgType == "userChanged" ) { diff --git a/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.cpp b/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.cpp index cc31d814e..3f31c70ff 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.cpp +++ b/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.cpp @@ -32,9 +32,7 @@ using namespace Tomahawk; using namespace Accounts; -#ifndef ENABLE_HEADLESS QPixmap* SpotifyPlaylistUpdater::s_typePixmap = 0; -#endif Tomahawk::PlaylistUpdaterInterface* SpotifyUpdaterFactory::create( const Tomahawk::playlist_ptr& pl, const QVariantHash &settings ) @@ -206,7 +204,6 @@ SpotifyPlaylistUpdater::type() const } -#ifndef ENABLE_HEADLESS QPixmap SpotifyPlaylistUpdater::typeIcon() const { @@ -221,7 +218,6 @@ SpotifyPlaylistUpdater::typeIcon() const return *s_typePixmap; } -#endif void diff --git a/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.h b/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.h index 1a566f7af..620cfde61 100644 --- a/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.h +++ b/src/libtomahawk/accounts/spotify/SpotifyPlaylistUpdater.h @@ -48,10 +48,8 @@ public: virtual QString type() const; virtual void updateNow() {} -#ifndef ENABLE_HEADLESS virtual QWidget* configurationWidget() const { return 0; } virtual QPixmap typeIcon() const; -#endif bool sync() const; void setSync( bool sync ); @@ -127,9 +125,7 @@ private: int m_subscribers; QQueue<_detail::Closure*> m_queuedOps; -#ifndef ENABLE_HEADLESS static QPixmap* s_typePixmap; -#endif }; diff --git a/src/libtomahawk/audio/AudioEngine.cpp b/src/libtomahawk/audio/AudioEngine.cpp index 2b7c81868..a54469459 100644 --- a/src/libtomahawk/audio/AudioEngine.cpp +++ b/src/libtomahawk/audio/AudioEngine.cpp @@ -591,7 +591,6 @@ AudioEngine::sendNowPlayingNotification( const Tomahawk::InfoSystem::InfoType ty if ( d->currentTrack.isNull() ) return; -#ifndef ENABLE_HEADLESS if ( d->currentTrack->track()->coverLoaded() ) { 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 ); d->currentTrack->track()->cover( QSize( 0, 0 ), true ); } -#endif } @@ -616,7 +614,6 @@ AudioEngine::onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type ) QVariantMap playInfo; -#ifndef ENABLE_HEADLESS QImage cover; cover = d->currentTrack->track()->cover( QSize( 0, 0 ) ).toImage(); if ( !cover.isNull() ) @@ -643,7 +640,6 @@ AudioEngine::onNowPlayingInfoReady( const Tomahawk::InfoSystem::InfoType type ) } else tDebug() << Q_FUNC_INFO << "Cover from query is null!"; -#endif Tomahawk::InfoSystem::InfoStringHash trackInfo; trackInfo["title"] = d->currentTrack->track()->track(); diff --git a/src/libtomahawk/database/DatabaseCommand_UpdateSearchIndex.cpp b/src/libtomahawk/database/DatabaseCommand_UpdateSearchIndex.cpp index 276705c62..24db225d8 100644 --- a/src/libtomahawk/database/DatabaseCommand_UpdateSearchIndex.cpp +++ b/src/libtomahawk/database/DatabaseCommand_UpdateSearchIndex.cpp @@ -22,16 +22,13 @@ #include #include "DatabaseImpl.h" -#include "fuzzyindex/DatabaseFuzzyIndex.h" #include "Source.h" #include "TomahawkSqlQuery.h" + +#include "fuzzyindex/DatabaseFuzzyIndex.h" #include "jobview/IndexingJobItem.h" - -#ifndef ENABLE_HEADLESS - #include "jobview/JobStatusView.h" - #include "jobview/JobStatusModel.h" -#endif - +#include "jobview/JobStatusView.h" +#include "jobview/JobStatusModel.h" #include "utils/Logger.h" namespace Tomahawk diff --git a/src/libtomahawk/database/LocalCollection.cpp b/src/libtomahawk/database/LocalCollection.cpp index 31da1c6cf..6e3a3a5b1 100644 --- a/src/libtomahawk/database/LocalCollection.cpp +++ b/src/libtomahawk/database/LocalCollection.cpp @@ -25,11 +25,9 @@ #include "PlaylistEntry.h" #include "SourceList.h" +#include "ViewManager.h" #include -#ifndef ENABLE_HEADLESS - #include "ViewManager.h" -#endif using namespace Tomahawk; diff --git a/src/libtomahawk/infosystem/InfoSystemCache.cpp b/src/libtomahawk/infosystem/InfoSystemCache.cpp index 58607ef02..3749ae7ec 100644 --- a/src/libtomahawk/infosystem/InfoSystemCache.cpp +++ b/src/libtomahawk/infosystem/InfoSystemCache.cpp @@ -18,11 +18,7 @@ */ #include - - -#ifndef ENABLE_HEADLESS - #include -#endif +#include #include "InfoSystemCache.h" #include "TomahawkSettings.h" diff --git a/src/libtomahawk/jobview/JobStatusView.cpp b/src/libtomahawk/jobview/JobStatusView.cpp index e188fe81d..ec69988f3 100644 --- a/src/libtomahawk/jobview/JobStatusView.cpp +++ b/src/libtomahawk/jobview/JobStatusView.cpp @@ -26,12 +26,9 @@ #include "JobStatusDelegate.h" #include "utils/Logger.h" #include "Source.h" - -#ifndef ENABLE_HEADLESS #include "PipelineStatusItem.h" #include "TransferStatusItem.h" #include "LatchedStatusItem.h" -#endif #include #include @@ -95,11 +92,9 @@ JobStatusView::JobStatusView( AnimatedSplitter* parent ) m_view->setAttribute( Qt::WA_MacShowFocusRect, 0 ); m_view->setUniformItemSizes( false ); -#ifndef ENABLE_HEADLESS new PipelineStatusManager( this ); new TransferStatusManager( this ); new LatchedStatusManager( this ); -#endif setMouseTracking( true ); m_view->setMouseTracking( true ); diff --git a/src/libtomahawk/jobview/LatchedStatusItem.cpp b/src/libtomahawk/jobview/LatchedStatusItem.cpp index b30ed4457..ebeccd196 100644 --- a/src/libtomahawk/jobview/LatchedStatusItem.cpp +++ b/src/libtomahawk/jobview/LatchedStatusItem.cpp @@ -24,11 +24,6 @@ #include "JobStatusModel.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 ) : JobStatusItem() , m_from( from ) @@ -80,11 +75,9 @@ LatchedStatusManager::latchedOn( const Tomahawk::source_ptr& from, const Tomahaw if ( to->isLocal() ) { -#ifndef ENABLE_HEADLESS LatchedStatusItem* item = new LatchedStatusItem( from, to, this ); m_jobs[ from->nodeId() ] = item; JobStatusView::instance()->model()->addJob( item ); -#endif connect( from.data(), SIGNAL( offline() ), this, SLOT( sourceOffline() ), Qt::UniqueConnection ); } diff --git a/src/libtomahawk/jobview/PipelineStatusItem.cpp b/src/libtomahawk/jobview/PipelineStatusItem.cpp index e823a8a65..085234535 100644 --- a/src/libtomahawk/jobview/PipelineStatusItem.cpp +++ b/src/libtomahawk/jobview/PipelineStatusItem.cpp @@ -22,15 +22,12 @@ #include "utils/TomahawkUtilsGui.h" +#include "JobStatusModel.h" +#include "JobStatusView.h" #include "Pipeline.h" #include "Source.h" #include "Track.h" -#ifndef ENABLE_HEADLESS -#include "JobStatusModel.h" -#include "JobStatusView.h" -#endif - PipelineStatusItem::PipelineStatusItem( const Tomahawk::query_ptr& q ) : JobStatusItem() @@ -103,12 +100,10 @@ PipelineStatusManager::resolving( const Tomahawk::query_ptr& p ) { Q_UNUSED( p ); -#ifndef ENABLE_HEADLESS if ( m_curItem.isNull() ) { // No current query item and we're resolving something, so show it m_curItem = QPointer< PipelineStatusItem >( new PipelineStatusItem( p ) ); JobStatusView::instance()->model()->addJob( m_curItem.data() ); } -#endif } diff --git a/src/libtomahawk/jobview/TransferStatusItem.cpp b/src/libtomahawk/jobview/TransferStatusItem.cpp index bc794697b..8ffc20dac 100644 --- a/src/libtomahawk/jobview/TransferStatusItem.cpp +++ b/src/libtomahawk/jobview/TransferStatusItem.cpp @@ -24,14 +24,12 @@ #include "utils/TomahawkUtilsGui.h" #include "Artist.h" +#include "JobStatusModel.h" +#include "JobStatusView.h" #include "Result.h" #include "Source.h" #include "Track.h" -#ifndef ENABLE_HEADLESS - #include "JobStatusModel.h" - #include "JobStatusView.h" -#endif // Forward Declarations breaking QSharedPointer #if QT_VERSION < QT_VERSION_CHECK( 5, 0, 0 ) @@ -119,9 +117,7 @@ TransferStatusManager::TransferStatusManager( QObject* parent ) void TransferStatusManager::streamRegistered( StreamConnection* sc ) { -#ifndef ENABLE_HEADLESS JobStatusView::instance()->model()->addJob( new TransferStatusItem( this, sc ) ); -#endif } diff --git a/src/libtomahawk/playlist/PlaylistUpdaterInterface.h b/src/libtomahawk/playlist/PlaylistUpdaterInterface.h index 53a2fe2ad..3104a485d 100644 --- a/src/libtomahawk/playlist/PlaylistUpdaterInterface.h +++ b/src/libtomahawk/playlist/PlaylistUpdaterInterface.h @@ -26,10 +26,7 @@ #include #include #include - -#ifndef ENABLE_HEADLESS #include -#endif namespace Tomahawk { @@ -60,14 +57,12 @@ public: // What type you are. If you add a new updater, add the creation code as well. virtual QString type() const = 0; -#ifndef ENABLE_HEADLESS // Small widget to show in playlist header that configures the updater virtual QWidget* configurationWidget() const = 0; // Small overlay over playlist icon in the sidebar to indicate that it has this updater type // Should be around 16x16 or something virtual QPixmap typeIcon() const { return QPixmap(); } -#endif void remove(); diff --git a/src/libtomahawk/playlist/XspfUpdater.cpp b/src/libtomahawk/playlist/XspfUpdater.cpp index 01a63b986..c4be8967e 100644 --- a/src/libtomahawk/playlist/XspfUpdater.cpp +++ b/src/libtomahawk/playlist/XspfUpdater.cpp @@ -27,11 +27,9 @@ #include "PlaylistEntry.h" #include "Source.h" +#include #include -#ifndef ENABLE_HEADLESS -#include -#endif 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() ) ); -#ifndef ENABLE_HEADLESS m_toggleCheckbox = new QCheckBox( ); m_toggleCheckbox->setText( tr( "Automatically update from XSPF" ) ); m_toggleCheckbox->setLayoutDirection( Qt::RightToLeft ); @@ -66,7 +63,6 @@ XspfUpdater::XspfUpdater( const playlist_ptr& pl, int interval, bool autoUpdate, m_toggleCheckbox->hide(); connect( m_toggleCheckbox, SIGNAL( toggled( bool ) ), this, SLOT( setAutoUpdate( bool ) ) ); -#endif QVariantHash s = settings(); s[ "autoupdate" ] = m_autoUpdate; @@ -84,16 +80,12 @@ XspfUpdater::~XspfUpdater() } -#ifndef ENABLE_HEADLESS - QWidget* XspfUpdater::configurationWidget() const { return m_toggleCheckbox; } -#endif - void XspfUpdater::updateNow() diff --git a/src/libtomahawk/playlist/XspfUpdater.h b/src/libtomahawk/playlist/XspfUpdater.h index ad862f6e2..8c6247b81 100644 --- a/src/libtomahawk/playlist/XspfUpdater.h +++ b/src/libtomahawk/playlist/XspfUpdater.h @@ -39,9 +39,7 @@ public: virtual QString type() const { return "xspf"; } -#ifndef ENABLE_HEADLESS virtual QWidget* configurationWidget() const; -#endif bool autoUpdate() const { return m_autoUpdate; } @@ -64,9 +62,7 @@ private: bool m_autoUpdate; QString m_url; -#ifndef ENABLE_HEADLESS QCheckBox* m_toggleCheckbox; -#endif }; class DLLEXPORT XspfUpdaterFactory : public PlaylistUpdaterFactory diff --git a/src/libtomahawk/sip/SipPlugin.cpp b/src/libtomahawk/sip/SipPlugin.cpp index cc74cf456..1d61eb23a 100644 --- a/src/libtomahawk/sip/SipPlugin.cpp +++ b/src/libtomahawk/sip/SipPlugin.cpp @@ -64,16 +64,12 @@ SipPlugin::inviteString() const } -#ifndef ENABLE_HEADLESS - QMenu* SipPlugin::menu() { return 0; } -#endif - Tomahawk::Accounts::Account* SipPlugin::account() const diff --git a/src/libtomahawk/sip/SipPlugin.h b/src/libtomahawk/sip/SipPlugin.h index bf7d48510..7190cf599 100644 --- a/src/libtomahawk/sip/SipPlugin.h +++ b/src/libtomahawk/sip/SipPlugin.h @@ -26,12 +26,9 @@ #include "Typedefs.h" #include +#include #include -#ifndef ENABLE_HEADLESS - #include -#endif - #include "DllMacro.h" class SipInfo; @@ -64,9 +61,7 @@ public: virtual const QString friendlyName() const; virtual const QString serviceName() const; virtual QString inviteString() const; -#ifndef ENABLE_HEADLESS virtual QMenu* menu(); -#endif virtual Tomahawk::Accounts::Account* account() const; // peer infos @@ -91,13 +86,11 @@ signals: void inviteSentSuccess( const QString& inviteId ); void inviteSentFailure( const QString& inviteId ); -#ifndef ENABLE_HEADLESS // new data for own source void avatarReceived ( const QPixmap& avatar ); void addMenu( QMenu* menu ); void removeMenu( QMenu* menu ); -#endif protected: void setAllPeersOffline(); diff --git a/src/libtomahawk/utils/GroovesharkParser.cpp b/src/libtomahawk/utils/GroovesharkParser.cpp index 6a44ae9c3..03ce3ec4b 100644 --- a/src/libtomahawk/utils/GroovesharkParser.cpp +++ b/src/libtomahawk/utils/GroovesharkParser.cpp @@ -136,10 +136,8 @@ GroovesharkParser::lookupGroovesharkPlaylist( const QString& linkRaw ) NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->post( QNetworkRequest( url ), data ) ); connect( reply, SIGNAL( finished() ), SLOT( groovesharkLookupFinished() ) ); -#ifndef ENABLE_HEADLESS m_browseJob = new DropJobNotifier( pixmap(), "Grooveshark", type, reply ); JobStatusView::instance()->model()->addJob( m_browseJob ); -#endif m_queries.insert( reply ); } @@ -153,10 +151,8 @@ GroovesharkParser::lookupGroovesharkTrack( const QString& track ) NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( QUrl( track ) ) ) ); connect( reply, SIGNAL( finished() ), SLOT( trackPageFetchFinished() ) ); -#ifndef ENABLE_HEADLESS m_browseJob = new DropJobNotifier( pixmap(), "Grooveshark", DropJob::Track, reply ); JobStatusView::instance()->model()->addJob( m_browseJob ); -#endif m_queries << reply; } @@ -239,9 +235,7 @@ GroovesharkParser::groovesharkLookupFinished() } else { -#ifndef ENABLE_HEADLESS 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(); } diff --git a/src/libtomahawk/utils/ItunesParser.cpp b/src/libtomahawk/utils/ItunesParser.cpp index 3bfb33d84..31b4d94bb 100644 --- a/src/libtomahawk/utils/ItunesParser.cpp +++ b/src/libtomahawk/utils/ItunesParser.cpp @@ -116,10 +116,8 @@ ItunesParser::lookupItunesUri( const QString& link ) NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ) ); connect( reply, SIGNAL( finished() ), SLOT( itunesResponseLookupFinished() ) ); -#ifndef ENABLE_HEADLESS DropJobNotifier* j = new DropJobNotifier( pixmap(), QString( "Itunes" ), type, reply ); JobStatusView::instance()->model()->addJob( j ); -#endif m_queries.insert( reply ); } @@ -180,9 +178,7 @@ ItunesParser::itunesResponseLookupFinished() } else { -#ifndef ENABLE_HEADLESS 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(); } diff --git a/src/libtomahawk/utils/ShortenedLinkParser.cpp b/src/libtomahawk/utils/ShortenedLinkParser.cpp index fc7404f31..4f048ae94 100644 --- a/src/libtomahawk/utils/ShortenedLinkParser.cpp +++ b/src/libtomahawk/utils/ShortenedLinkParser.cpp @@ -88,10 +88,8 @@ ShortenedLinkParser::lookupUrl( const QString& url ) m_queries.insert( reply ); -#ifndef ENABLE_HEADLESS m_expandJob = new DropJobNotifier( pixmap(), "shortened", DropJob::Track, reply ); JobStatusView::instance()->model()->addJob( m_expandJob ); -#endif } @@ -101,10 +99,8 @@ ShortenedLinkParser::lookupFinished( const QUrl& url ) NetworkReply* r = qobject_cast< NetworkReply* >( sender() ); Q_ASSERT( r ); -#ifndef ENABLE_HEADLESS if ( r->reply()->error() != QNetworkReply::NoError ) 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(); m_links << url.toString(); @@ -127,12 +123,8 @@ ShortenedLinkParser::checkFinished() } -#ifndef ENABLE_HEADLESS - QPixmap ShortenedLinkParser::pixmap() { return TomahawkUtils::defaultPixmap( TomahawkUtils::Add ); } - -#endif diff --git a/src/libtomahawk/utils/ShortenedLinkParser.h b/src/libtomahawk/utils/ShortenedLinkParser.h index 69e855b89..b02e6884e 100644 --- a/src/libtomahawk/utils/ShortenedLinkParser.h +++ b/src/libtomahawk/utils/ShortenedLinkParser.h @@ -24,13 +24,10 @@ #include "Typedefs.h" #include +#include #include #include -#ifndef ENABLE_HEADLESS - #include -#endif - class NetworkReply; namespace Tomahawk @@ -64,9 +61,7 @@ private: void lookupUrl( const QString& url ); void checkFinished(); -#ifndef ENABLE_HEADLESS static QPixmap pixmap(); -#endif QStringList m_links; QSet< NetworkReply* > m_queries; diff --git a/src/libtomahawk/utils/SpotifyParser.cpp b/src/libtomahawk/utils/SpotifyParser.cpp index 4d5286337..0e6fcc059 100644 --- a/src/libtomahawk/utils/SpotifyParser.cpp +++ b/src/libtomahawk/utils/SpotifyParser.cpp @@ -181,10 +181,8 @@ SpotifyParser::lookupSpotifyBrowse( const QString& link ) NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ) ); connect( reply, SIGNAL( finished() ), SLOT( spotifyBrowseFinished() ) ); -#ifndef ENABLE_HEADLESS m_browseJob = new DropJobNotifier( pixmap(), "Spotify", type, reply ); JobStatusView::instance()->model()->addJob( m_browseJob ); -#endif m_queries.insert( reply ); } @@ -210,10 +208,8 @@ SpotifyParser::lookupTrack( const QString& link ) NetworkReply* reply = new NetworkReply( Tomahawk::Utils::nam()->get( QNetworkRequest( url ) ) ); connect( reply, SIGNAL( finished() ), SLOT( spotifyTrackLookupFinished() ) ); -#ifndef ENABLE_HEADLESS DropJobNotifier* j = new DropJobNotifier( pixmap(), QString( "Spotify" ), DropJob::Track, reply ); JobStatusView::instance()->model()->addJob( j ); -#endif m_queries.insert( reply ); } diff --git a/src/libtomahawk/utils/XspfLoader.cpp b/src/libtomahawk/utils/XspfLoader.cpp index aaff93313..f5caf351f 100644 --- a/src/libtomahawk/utils/XspfLoader.cpp +++ b/src/libtomahawk/utils/XspfLoader.cpp @@ -20,12 +20,9 @@ #include "XspfLoader.h" -#ifndef ENABLE_HEADLESS #include "jobview/JobStatusView.h" #include "jobview/JobStatusModel.h" #include "jobview/ErrorStatusMessage.h" -#endif - #include "playlist/XspfUpdater.h" #include "utils/NetworkReply.h" #include "utils/TomahawkUtils.h" @@ -173,13 +170,11 @@ void XSPFLoader::reportError() { emit error( FetchError ); -#ifndef ENABLE_HEADLESS const QString errorMsg = errorToString( FetchError ); if ( !m_errorTitle.isEmpty() ) JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( QString( "%1: %2" ).arg( m_errorTitle ).arg( errorMsg ) ) ); else JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( errorMsg ) ); -#endif deleteLater(); } diff --git a/src/tomahawk/AclRegistryImpl.cpp b/src/tomahawk/AclRegistryImpl.cpp index 8b95241f5..9a633ccbe 100644 --- a/src/tomahawk/AclRegistryImpl.cpp +++ b/src/tomahawk/AclRegistryImpl.cpp @@ -24,14 +24,11 @@ #include "TomahawkApp.h" #include "Source.h" -#ifndef ENABLE_HEADLESS - #include "accounts/AccountManager.h" - #include "accounts/Account.h" - #include "jobview/AclJobItem.h" - #include "jobview/JobStatusView.h" - #include "jobview/JobStatusModel.h" -#endif - +#include "accounts/AccountManager.h" +#include "accounts/Account.h" +#include "jobview/AclJobItem.h" +#include "jobview/JobStatusView.h" +#include "jobview/JobStatusModel.h" #include "utils/Logger.h" #include @@ -63,7 +60,6 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, return Tomahawk::ACLStatus::NotFound; } -#ifndef ENABLE_HEADLESS if ( Tomahawk::Accounts::AccountManager::instance() ) { 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; QMutableListIterator< ACLRegistry::User > i( m_cache ); @@ -127,9 +122,7 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, user.knownAccountIds.append( username ); if ( globalType != Tomahawk::ACLStatus::NotFound ) user.acl = globalType; -#ifdef ENABLE_HEADLESS - user.acl = Tomahawk::ACLStatus::Stream; -#else + if ( !TomahawkUtils::headless() ) { getUserDecision( user, username ); @@ -137,7 +130,7 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, } else user.acl = Tomahawk::ACLStatus::Stream; -#endif + m_cache.append( user ); save(); emit aclResult( dbid, username, user.acl ); @@ -145,7 +138,6 @@ ACLRegistryImpl::isAuthorizedUser( const QString& dbid, const QString &username, } -#ifndef ENABLE_HEADLESS void ACLRegistryImpl::getUserDecision( ACLRegistry::User user, const QString &username ) { @@ -224,7 +216,6 @@ ACLRegistryImpl::queueNextJob() } } } -#endif void diff --git a/src/tomahawk/AclRegistryImpl.h b/src/tomahawk/AclRegistryImpl.h index dfe4ca633..f080fec69 100644 --- a/src/tomahawk/AclRegistryImpl.h +++ b/src/tomahawk/AclRegistryImpl.h @@ -60,13 +60,11 @@ protected: virtual void load(); virtual void save(); -#ifndef ENABLE_HEADLESS void getUserDecision( ACLRegistry::User user, const QString &username ); private slots: void userDecision( ACLRegistry::User user ); void queueNextJob(); -#endif private: QQueue< ACLJobItem* > m_jobQueue; diff --git a/src/tomahawk/TomahawkApp.cpp b/src/tomahawk/TomahawkApp.cpp index 61477fecb..5bbdbd784 100644 --- a/src/tomahawk/TomahawkApp.cpp +++ b/src/tomahawk/TomahawkApp.cpp @@ -91,10 +91,6 @@ #include "linux/GnomeShortcutHandler.h" #endif -#ifndef ENABLE_HEADLESS - #include -#endif - #ifdef Q_OS_MAC #include "mac/MacShortcutHandler.h" @@ -105,6 +101,7 @@ #include #include #include +#include #include #include #include @@ -143,9 +140,7 @@ using namespace Tomahawk; TomahawkApp::TomahawkApp( int& argc, char *argv[] ) : TOMAHAWK_APPLICATION( argc, argv ) -#ifndef ENABLE_HEADLESS , m_mainwindow( 0 ) -#endif , m_splashWidget( 0 ) , m_headless( false ) { @@ -174,9 +169,7 @@ TomahawkApp::init() tLog() << "Starting Tomahawk..."; -#ifdef ENABLE_HEADLESS m_headless = true; -#else m_headless = arguments().contains( "--headless" ); setWindowIcon( QIcon( RESPATH "icons/tomahawk-icon-128x128.png" ) ); setQuitOnLastWindowClosed( false ); @@ -199,7 +192,6 @@ TomahawkApp::init() tDebug() << "Font height:" << QFontMetrics( f ).height(); #endif TomahawkUtils::setDefaultFontSize( f.pointSize() ); -#endif TomahawkUtils::setHeadless( m_headless ); new ACLRegistryImpl( this ); @@ -302,10 +294,8 @@ TomahawkApp::~TomahawkApp() delete Tomahawk::Accounts::AccountManager::instance(); -#ifndef ENABLE_HEADLESS delete AtticaManager::instance(); delete m_mainwindow; -#endif // Main Window uses the AudioEngine, so delete it later. if ( !m_audioEngine.isNull() ) @@ -364,13 +354,11 @@ TomahawkApp::printHelp() } -#ifndef ENABLE_HEADLESS AudioControls* TomahawkApp::audioControls() { return m_mainwindow->audioControls(); } -#endif void @@ -615,7 +603,6 @@ TomahawkApp::onInfoSystemReady() TomahawkSettings* s = TomahawkSettings::instance(); Echonest::Config::instance()->setNetworkAccessManager( Tomahawk::Utils::nam() ); -#ifndef ENABLE_HEADLESS EchonestGenerator::setupCatalogs(); if ( !m_headless ) @@ -629,17 +616,14 @@ TomahawkApp::onInfoSystemReady() m_mainwindow->show(); } } -#endif tDebug() << "Init Local Collection."; initLocalCollection(); tDebug() << "Init Pipeline."; initPipeline(); -#ifndef ENABLE_HEADLESS // load remote list of resolvers able to be installed AtticaManager::instance(); -#endif if ( arguments().contains( "--http" ) || TomahawkSettings::instance()->value( "network/http", true ).toBool() ) { @@ -647,12 +631,10 @@ TomahawkApp::onInfoSystemReady() } connect( TomahawkSettings::instance(), SIGNAL( changed() ), SLOT( initHTTP() ) ); -#ifndef ENABLE_HEADLESS if ( !s->hasScannerPaths() ) { m_mainwindow->showSettingsDialog(); } -#endif #ifdef LIBLASTFM_FOUND tDebug() << "Init Scrobbler."; @@ -679,14 +661,12 @@ TomahawkApp::onInfoSystemReady() QApplication::setWheelScrollLines( qt_settings.value( "wheelScrollLines", QApplication::wheelScrollLines() ).toInt() ); } -#ifndef ENABLE_HEADLESS // Make sure to init GAM in the gui thread GlobalActionManager::instance(); // 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" ) ) ); connect( r, SIGNAL( finished() ), this, SLOT( spotifyApiCheckFinished() ) ); -#endif #ifdef Q_OS_MAC // Make sure to do this after main window is inited @@ -768,21 +748,17 @@ TomahawkApp::ipDetectionFailed( QNetworkReply::NetworkError error, QString error void TomahawkApp::spotifyApiCheckFinished() { -#ifndef ENABLE_HEADLESS QNetworkReply* reply = qobject_cast< QNetworkReply* >( sender() ); Q_ASSERT( reply ); DropJob::setCanParseSpotifyPlaylists( !reply->error() ); -#endif } void TomahawkApp::activate() { -#ifndef ENABLE_HEADLESS TomahawkUtils::bringToFront(); -#endif } diff --git a/src/tomahawk/TomahawkApp.h b/src/tomahawk/TomahawkApp.h index e7e7f69f1..0660a9c53 100644 --- a/src/tomahawk/TomahawkApp.h +++ b/src/tomahawk/TomahawkApp.h @@ -68,9 +68,7 @@ namespace Tomahawk #include "Scrobbler.h" #endif -#ifndef TOMAHAWK_HEADLESS class TomahawkWindow; -#endif // this also acts as a a container for important top-level objects @@ -87,10 +85,8 @@ public: void init(); static TomahawkApp* instance(); -#ifndef ENABLE_HEADLESS AudioControls* audioControls(); TomahawkWindow* mainWindow() const; -#endif // PlatformInterface virtual bool loadUrl( const QString& url ); @@ -150,9 +146,7 @@ private: Scrobbler* m_scrobbler; #endif -#ifndef TOMAHAWK_HEADLESS TomahawkWindow* m_mainwindow; -#endif QPointer playdarApi; SplashWidget* m_splashWidget; diff --git a/src/tomahawk/TomahawkWindow.cpp b/src/tomahawk/TomahawkWindow.cpp index 360dde7af..804050b1f 100644 --- a/src/tomahawk/TomahawkWindow.cpp +++ b/src/tomahawk/TomahawkWindow.cpp @@ -1176,9 +1176,7 @@ TomahawkWindow::onAudioEngineError( AudioEngine::AudioErrorCode /* error */ ) tLog() << msg; -#ifndef ENABLE_HEADLESS JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( msg, 15 ) ); -#endif if ( m_audioRetryCounter < 3 ) AudioEngine::instance()->play();