From 9c34047d800009e35aad49a737b0dbf507f90b23 Mon Sep 17 00:00:00 2001 From: Dominik Schmidt Date: Fri, 22 Oct 2010 01:41:14 +0800 Subject: [PATCH] Make headless mode compile again. --- include/tomahawk/tomahawkapp.h | 2 +- src/CMakeLists.txt | 6 ++++-- src/tomahawkapp.cpp | 10 ++++++---- src/tomahawksettings.cpp | 14 ++++++++++++-- 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/include/tomahawk/tomahawkapp.h b/include/tomahawk/tomahawkapp.h index cfaa6ad34..d60f8a5b7 100644 --- a/include/tomahawk/tomahawkapp.h +++ b/include/tomahawk/tomahawkapp.h @@ -12,7 +12,6 @@ #include #include #include -#include #include "QxtHttpServerConnector" #include "QxtHttpSessionManager" @@ -37,6 +36,7 @@ class TomahawkSettings; class AudioEngine; class TomahawkWindow; class PlaylistManager; +#include #ifndef NO_LIBLASTFM #include diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9fd9a2e24..3e42426c9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -75,7 +75,6 @@ SET( tomahawkSources ${tomahawkSources} web/api_v1.cpp - widgetdragfilter.cpp tomahawksettings.cpp tomahawkapp.cpp main.cpp @@ -118,6 +117,8 @@ SET( tomahawkSourcesGui ${tomahawkSourcesGui} audiocontrols.cpp settingsdialog.cpp proxystyle.cpp + + widgetdragfilter.cpp ) SET( tomahawkHeaders ${tomahawkHeaders} @@ -180,7 +181,6 @@ SET( tomahawkHeaders ${tomahawkHeaders} servent.h scriptresolver.h tomahawksettings.h - widgetdragfilter.h web/api_v1.h ) @@ -224,6 +224,8 @@ SET( tomahawkHeadersGui ${tomahawkHeadersGui} tomahawkwindow.h audiocontrols.h settingsdialog.h + + widgetdragfilter.h ) SET( tomahawkUI ${tomahawkUI} diff --git a/src/tomahawkapp.cpp b/src/tomahawkapp.cpp index b9f0c7fcc..408daa7b1 100644 --- a/src/tomahawkapp.cpp +++ b/src/tomahawkapp.cpp @@ -4,7 +4,6 @@ #include #include #include -#include #include #include "tomahawk/collection.h" @@ -19,11 +18,12 @@ #include "controlconnection.h" #include "tomahawkzeroconf.h" -#include "settingsdialog.h" #ifndef TOMAHAWK_HEADLESS #include "audioengine.h" #include "tomahawkwindow.h" + #include "settingsdialog.h" + #include #endif #include @@ -150,10 +150,10 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] ) #else m_nam = new QNetworkAccessManager; #endif - m_mainwindow = new TomahawkWindow(); m_mainwindow->show(); connect( m_mainwindow, SIGNAL( settingsChanged() ), SIGNAL( settingsChanged() ) ); + } #endif @@ -179,11 +179,13 @@ TomahawkApp::TomahawkApp( int& argc, char *argv[] ) SLOT( lanHostFound( const QString&, int, const QString&, const QString& ) ) ); m_zeroconf->advertise(); } - + + #ifndef TOMAHAWK_HEADLESS if ( !m_settings->hasScannerPath() ) { m_mainwindow->showSettingsDialog(); } + #endif } diff --git a/src/tomahawksettings.cpp b/src/tomahawksettings.cpp index 5509d06b4..e9c00143a 100644 --- a/src/tomahawksettings.cpp +++ b/src/tomahawksettings.cpp @@ -1,14 +1,19 @@ #include "tomahawksettings.h" -#include "settingsdialog.h" + +#ifdef TOMAHAWK_HEADLESS + #include "settingsdialog.h" + #include +#endif #include #include -#include + TomahawkSettings::TomahawkSettings( QObject* parent ) : QSettings( parent ) { + #ifdef TOMAHAWK_HEADLESS if( !contains( "configversion") ) { setValue( "configversion", SettingsDialog::VERSION ); @@ -22,6 +27,7 @@ TomahawkSettings::TomahawkSettings( QObject* parent ) // insert upgrade code here as required setValue( "configversion", SettingsDialog::VERSION ); } + #endif } TomahawkSettings::~TomahawkSettings() @@ -31,7 +37,11 @@ TomahawkSettings::~TomahawkSettings() QString TomahawkSettings::scannerPath() const { + #ifdef TOMAHAWK_HEADLESS return value( "scannerpath", QDesktopServices::storageLocation( QDesktopServices::MusicLocation ) ).toString(); + #else + return value( "scannerpath", "" ).toString(); + #endif } void TomahawkSettings::setScannerPath(const QString& path)