1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-05 08:32:42 +02:00

Do some work towards tomahawk headless

This commit is contained in:
Dominik Schmidt 2011-11-11 03:43:42 +01:00
parent f9b5bda925
commit f216a0fe82
10 changed files with 94 additions and 46 deletions

View File

@ -12,6 +12,29 @@ add_definitions( ${QT_DEFINITIONS} )
add_definitions( -DQT_SHARED )
add_definitions( -DDLLEXPORT_PRO )
set( libGuiHeaders
viewpage.h
viewmanager.h
playlist/topbar/topbar.h
playlist/topbar/clearbutton.h
playlist/topbar/searchlineedit.h
playlist/topbar/lineedit.h
playlist/topbar/lineedit_p.h
playlist/topbar/searchbutton.h
)
set( libGuiSources
viewpage.cpp
viewmanager.cpp
playlist/topbar/topbar.cpp
playlist/topbar/clearbutton.cpp
playlist/topbar/searchlineedit.cpp
playlist/topbar/lineedit.cpp
playlist/topbar/searchbutton.cpp
)
set( libSources
tomahawksettings.cpp
sourcelist.cpp
@ -28,8 +51,6 @@ set( libSources
result.cpp
source.cpp
sourceplaylistinterface.cpp
viewpage.cpp
viewmanager.cpp
globalactionmanager.cpp
contextmenu.cpp
dropjob.cpp
@ -148,11 +169,6 @@ set( libSources
playlist/PlaylistUpdaterInterface.cpp
playlist/XspfUpdater.cpp
playlist/topbar/topbar.cpp
playlist/topbar/clearbutton.cpp
playlist/topbar/searchlineedit.cpp
playlist/topbar/lineedit.cpp
playlist/topbar/searchbutton.cpp
playlist/dynamic/DynamicPlaylist.cpp
playlist/dynamic/DynamicControl.cpp
@ -256,11 +272,9 @@ set( libHeaders
result.h
source.h
sourceplaylistinterface.h
viewmanager.h
globalactionmanager.h
contextmenu.h
dropjob.h
AtticaManager.h
LatchManager.h
artist.h
@ -388,13 +402,6 @@ set( libHeaders
playlist/PlaylistUpdaterInterface.h
playlist/XspfUpdater.h
playlist/topbar/topbar.h
playlist/topbar/clearbutton.h
playlist/topbar/searchlineedit.h
playlist/topbar/lineedit.h
playlist/topbar/lineedit_p.h
playlist/topbar/searchbutton.h
playlist/dynamic/DynamicPlaylist.h
playlist/dynamic/DynamicControl.h
playlist/dynamic/GeneratorInterface.h
@ -469,8 +476,6 @@ set( libHeaders
)
set( libHeaders_NoMOC
viewpage.h
infosystem/infoplugins/unix/imageconverter.h
playlist/dynamic/GeneratorInterface.h
@ -517,8 +522,8 @@ IF(QCA2_FOUND)
ENDIF(QCA2_FOUND)
IF(LIBATTICA_FOUND)
SET( libSources ${libSources} AtticaManager.cpp )
SET( libHeaders ${libHeaders} AtticaManager.h )
SET( libGuiSources ${libGuiSources} AtticaManager.cpp )
SET( libGuiHeaders ${libGuiHeaders} AtticaManager.h )
INCLUDE_DIRECTORIES( ${LIBATTICA_INCLUDE_DIR} )
ENDIF(LIBATTICA_FOUND)
@ -591,12 +596,17 @@ IF(LIBLASTFM_FOUND)
SET(LINK_LIBRARIES ${LINK_LIBRARIES} tomahawk_lastfm2 )
ENDIF(LIBLASTFM_FOUND)
IF(BUILD_GUI)
LIST(APPEND libSources ${libGuiSources} )
LIST(APPEND libHeaders ${libGuiHeaders} )
ENDIF()
qt4_wrap_ui( libUI_H ${libUI} )
qt4_wrap_cpp( libMoc ${libHeaders} )
qt4_wrap_cpp( libMoc ${libHeaders} ${libGuiHeaders} )
SET( libSources ${libSources} ${libUI_H} ${libHeaders_NoMOC} )
ADD_LIBRARY( tomahawklib SHARED ${libSources} ${libMoc} )
ADD_LIBRARY( tomahawklib SHARED ${libGuiSources} ${libSources} ${libMoc} )
IF(QCA2_FOUND)
SET(LINK_LIBRARIES ${LINK_LIBRARIES} ${QCA2_LIBRARIES} )

View File

@ -18,8 +18,10 @@
#include "globalactionmanager.h"
#include <QApplication>
#include <QClipboard>
#ifndef ENABLE_HEADLESS
#include <QClipboard>
#endif
#include <QMimeData>
#include <QUrl>
#include <QtNetwork/QNetworkAccessManager>
@ -31,13 +33,10 @@
#include "album.h"
#include "sourcelist.h"
#include "pipeline.h"
#include "viewmanager.h"
#include "tomahawksettings.h"
#include "audio/audioengine.h"
#include "database/localcollection.h"
#include "playlist/dynamic/GeneratorInterface.h"
#include "playlist/topbar/topbar.h"
#include "playlist/playlistview.h"
#include "echonest/Playlist.h"
@ -50,7 +49,15 @@
#include "utils/spotifyparser.h"
#include "utils/shortenedlinkparser.h"
#include "utils/rdioparser.h"
#include "widgets/searchwidget.h"
#ifndef ENABLE_HEADLESS
#include <QApplication>
#include "widgets/searchwidget.h"
#include "viewmanager.h"
#include "playlist/topbar/topbar.h"
#include "playlist/playlistview.h"
#endif
GlobalActionManager* GlobalActionManager::s_instance = 0;

View File

@ -20,7 +20,6 @@
#define PLAYLISTINTERFACE_H
#include <QModelIndex>
#include <QWidget>
#include "typedefs.h"
#include "dllmacro.h"

View File

@ -18,21 +18,26 @@
#include "resolver.h"
#include <QWidget>
#include <QtUiTools/QUiLoader>
#include <QMetaProperty>
#include <QBuffer>
#include <QDir>
#include <QIcon>
#include "utils/logger.h"
#ifndef ENABLE_HEADLESS
#include <QIcon>
#include <QWidget>
#endif
#include <QUiLoader>
Tomahawk::ExternalResolver::ErrorState
Tomahawk::ExternalResolver::error() const
{
return NoError;
}
#ifndef ENABLE_HEADLESS
QVariant
Tomahawk::ExternalResolver::configMsgFromWidget( QWidget* w )
{
@ -45,7 +50,7 @@ Tomahawk::ExternalResolver::configMsgFromWidget( QWidget* w )
// qDebug() << "Generated widget variant:" << widgetMap;
return widgetMap;
}
#endif
void
Tomahawk::ExternalResolver::addChildProperties( QObject* widget, QVariantMap& m )

View File

@ -24,7 +24,6 @@
#include "utils/tomahawkutils.h"
#include "config.h"
#include <QApplication>
#include <QDir>
#include <QFile>
#include <QThread>

View File

@ -24,9 +24,13 @@
#include <QObject>
#include <QHash>
#include <QPixmap>
#include <QString>
#ifndef ENABLE_HEADLESS
#include <QPixmap>
#endif
class DLLEXPORT SipHandler : public QObject
{
Q_OBJECT

View File

@ -24,9 +24,12 @@
#include <QObject>
#include <QString>
#include <QMenu>
#include <QNetworkProxy>
#ifndef ENABLE_HEADLESS
#include <QMenu>
#endif
#include "dllmacro.h"
class SipPlugin;
@ -42,8 +45,12 @@ public:
virtual QString prettyName() const = 0;
// internal name
virtual QString factoryId() const = 0;
#ifndef ENABLE_HEADLESS
// if the user can create multiple
virtual QIcon icon() const { return QIcon(); }
#endif
virtual bool isUnique() const { return false; }
virtual SipPlugin* createPlugin( const QString& pluginId = QString() ) = 0;
@ -73,8 +80,10 @@ public:
virtual const QString accountName() const = 0;
virtual ConnectionState connectionState() const = 0;
virtual QString errorMessage() const;
#ifndef ENABLE_HEADLESS
virtual QMenu* menu();
virtual QWidget* configWidget();
#endif
virtual void saveConfig() {} // called when the widget has been edited
virtual QIcon icon() const;
@ -110,9 +119,10 @@ signals:
// new data for other sources;
void avatarReceived ( const QString& from, const QPixmap& avatar);
#ifndef ENABLE_HEADLESS
void addMenu( QMenu* menu );
void removeMenu( QMenu* menu );
#endif
void dataError( bool );

View File

@ -18,7 +18,7 @@
#include "tomahawksettings.h"
#ifndef TOMAHAWK_HEADLESS
#ifndef ENABLE_HEADLESS
#include <QDesktopServices>
#include "settingsdialog.h"
#endif
@ -37,7 +37,7 @@ using namespace Tomahawk;
TomahawkSettings* TomahawkSettings::s_instance = 0;
#ifndef ENABLE_HEADLESS
inline QDataStream& operator<<(QDataStream& out, const AtticaManager::StateHash& states)
{
out << VERSION;
@ -69,6 +69,7 @@ inline QDataStream& operator>>(QDataStream& in, AtticaManager::StateHash& states
}
return in;
}
#endif
TomahawkSettings*
TomahawkSettings::instance()
@ -104,8 +105,11 @@ TomahawkSettings::TomahawkSettings( QObject* parent )
setValue( "configversion", VERSION );
}
#ifndef ENABLE_HEADLESS
qRegisterMetaType< AtticaManager::StateHash >( "AtticaManager::StateHash" );
qRegisterMetaTypeStreamOperators<AtticaManager::StateHash>("AtticaManager::StateHash");
#endif
}
@ -257,7 +261,7 @@ TomahawkSettings::scannerPaths()
{
QString musicLocation;
#ifndef TOMAHAWK_HEADLESS
#ifndef ENABLE_HEADLESS
musicLocation = QDesktopServices::storageLocation( QDesktopServices::MusicLocation );
#endif
@ -905,6 +909,7 @@ TomahawkSettings::setEnabledScriptResolvers( const QStringList& resolvers )
setValue( "script/loadedresolvers", resolvers );
}
#ifndef ENABLE_HEADLESS
void
TomahawkSettings::setAtticaResolverState( const QString& resolver, AtticaManager::ResolverState state )
{
@ -937,6 +942,7 @@ TomahawkSettings::removeAtticaResolverState ( const QString& resolver )
resolvers.remove( resolver );
setValue( "script/atticaresolverstates", QVariant::fromValue< AtticaManager::StateHash >( resolvers ) );
}
#endif
QString
TomahawkSettings::scriptDefaultPath() const

View File

@ -19,15 +19,16 @@
#ifndef TOMAHAWK_SETTINGS_H
#define TOMAHAWK_SETTINGS_H
#include <QSettings>
#ifndef ENABLE_HEADLESS
#include "AtticaManager.h"
#endif
#include "dllmacro.h"
#include "AtticaManager.h"
#include "playlist.h"
#include <QSettings>
#include <QtNetwork/QNetworkProxy>
#include "dllmacro.h"
/**
* Convenience wrapper around QSettings for tomahawk-specific config
*/
@ -187,11 +188,13 @@ public:
QStringList enabledScriptResolvers() const;
void setEnabledScriptResolvers( const QStringList& resolvers );
#ifndef ENABLE_HEADLESS
AtticaManager::StateHash atticaResolverStates() const;
void setAtticaResolverStates( const AtticaManager::StateHash states );
void setAtticaResolverState( const QString& resolver, AtticaManager::ResolverState state );
void removeAtticaResolverState( const QString& resolver );
#endif
QString scriptDefaultPath() const;
void setScriptDefaultPath( const QString& path );
@ -211,7 +214,7 @@ public:
};
PrivateListeningMode privateListeningMode() const;
void setPrivateListeningMode( PrivateListeningMode mode );
signals:
void changed();
void recentlyPlayedPlaylistAdded( const Tomahawk::playlist_ptr& playlist );
@ -223,6 +226,8 @@ private:
static TomahawkSettings* s_instance;
};
#ifndef ENABLE_HEADLESS
Q_DECLARE_METATYPE(AtticaManager::StateHash);
#endif
#endif

View File

@ -26,7 +26,10 @@
#include <QtNetwork/QNetworkProxy>
#include <QtCore/QStringList>
#include <QtCore/QRect>
#include <QPalette>
#ifndef ENABLE_HEADLESS
#include <QPalette>
#endif
#define RESPATH ":/data/"