1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-13 20:39:57 +01: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( 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)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -895,14 +895,12 @@ DropJob::onTracksAdded( const QList<Tomahawk::query_ptr>& 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::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
#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::query_ptr>, Tomahawk::ModelMode, Tomahawk::collection_ptr ) ),
SLOT( onTracksAdded( QList<Tomahawk::query_ptr> ) ) );
#ifndef ENABLE_HEADLESS
m_dropJob << new DropJobNotifier( QPixmap( RESPATH "images/album-icon.png" ), Album );
JobStatusView::instance()->model()->addJob( m_dropJob.last() );
#endif
m_queryCount++;
}

View File

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

View File

@ -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<QObject>& 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 );

View File

@ -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<Tomahawk::query_ptr>
Track::similarTracks() const

View File

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

View File

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

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.
*/
#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(); }

View File

@ -26,9 +26,7 @@
#include "TomahawkSettings.h"
#include "utils/Logger.h"
#ifndef ENABLE_HEADLESS
#include <QMessageBox>
#endif
#include <attica/content.h>
@ -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.

View File

@ -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 <QAction>
#include <QCoreApplication>
#include <QDir>
@ -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" )
{

View File

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

View File

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

View File

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

View File

@ -22,16 +22,13 @@
#include <QSqlRecord>
#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

View File

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

View File

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

View File

@ -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 <QHeaderView>
#include <QVBoxLayout>
@ -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 );

View File

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

View File

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

View File

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

View File

@ -26,10 +26,7 @@
#include <QTimer>
#include <QMutex>
#include <QPair>
#ifndef ENABLE_HEADLESS
#include <QPixmap>
#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();

View File

@ -27,11 +27,9 @@
#include "PlaylistEntry.h"
#include "Source.h"
#include <QCheckBox>
#include <QTimer>
#ifndef ENABLE_HEADLESS
#include <QCheckBox>
#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()

View File

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

View File

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

View File

@ -26,12 +26,9 @@
#include "Typedefs.h"
#include <QObject>
#include <QMenu>
#include <QString>
#ifndef ENABLE_HEADLESS
#include <QMenu>
#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();

View File

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

View File

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

View File

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

View File

@ -24,13 +24,10 @@
#include "Typedefs.h"
#include <QObject>
#include <QPixmap>
#include <QSet>
#include <QStringList>
#ifndef ENABLE_HEADLESS
#include <QPixmap>
#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;

View File

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

View File

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

View File

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

View File

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

View File

@ -91,10 +91,6 @@
#include "linux/GnomeShortcutHandler.h"
#endif
#ifndef ENABLE_HEADLESS
#include <QMessageBox>
#endif
#ifdef Q_OS_MAC
#include "mac/MacShortcutHandler.h"
@ -105,6 +101,7 @@
#include <QDir>
#include <QMetaType>
#include <QTime>
#include <QMessageBox>
#include <QNetworkReply>
#include <QFile>
#include <QFileInfo>
@ -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
}

View File

@ -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> playdarApi;
SplashWidget* m_splashWidget;

View File

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