mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 15:29:42 +01:00
ifdefs--: split TomahawkSettings
This commit is contained in:
parent
3d0421b0a6
commit
584fc8a1b6
@ -19,7 +19,7 @@
|
||||
#include "AtticaManager.h"
|
||||
|
||||
#include "utils/tomahawkutils.h"
|
||||
#include "tomahawksettings.h"
|
||||
#include "TomahawkSettingsGui.h"
|
||||
#include "pipeline.h"
|
||||
|
||||
#include <attica/downloaditem.h>
|
||||
@ -167,7 +167,7 @@ AtticaManager::uploadRating( const Content& c )
|
||||
}
|
||||
}
|
||||
|
||||
TomahawkSettings::instance()->setAtticaResolverStates( m_resolverStates );
|
||||
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates );
|
||||
|
||||
PostJob* job = m_resolverProvider.voteForContent( c.id(), (uint)c.rating() );
|
||||
connect( job, SIGNAL( finished( Attica::BaseJob* ) ), job, SLOT( deleteLater() ) );
|
||||
@ -204,7 +204,7 @@ AtticaManager::resolversList( BaseJob* j )
|
||||
ListJob< Content >* job = static_cast< ListJob< Content >* >( j );
|
||||
|
||||
m_resolvers = job->itemList();
|
||||
m_resolverStates = TomahawkSettings::instance()->atticaResolverStates();
|
||||
m_resolverStates = TomahawkSettingsGui::instanceGui()->atticaResolverStates();
|
||||
|
||||
// load icon cache from disk, and fetch any we are missing
|
||||
loadPixmapsFromCache();
|
||||
@ -418,7 +418,7 @@ AtticaManager::payloadFetched()
|
||||
// Do the install / add to tomahawk
|
||||
Tomahawk::Pipeline::instance()->addScriptResolver( resolverPath, true );
|
||||
m_resolverStates[ resolverId ].state = Installed;
|
||||
TomahawkSettings::instance()->setAtticaResolverStates( m_resolverStates );
|
||||
TomahawkSettingsGui::instanceGui()->setAtticaResolverStates( m_resolverStates );
|
||||
emit resolverInstalled( resolverId );
|
||||
emit resolverStateChanged( resolverId );
|
||||
}
|
||||
@ -514,7 +514,7 @@ AtticaManager::uninstallResolver( const QString& pathToResolver )
|
||||
if ( resolver.id() == atticaId ) // this is the one
|
||||
{
|
||||
m_resolverStates[ atticaId ].state = Uninstalled;
|
||||
TomahawkSettings::instance()->setAtticaResolverState( atticaId, Uninstalled );
|
||||
TomahawkSettingsGui::instanceGui()->setAtticaResolverState( atticaId, Uninstalled );
|
||||
|
||||
doResolverRemove( atticaId );
|
||||
}
|
||||
@ -532,7 +532,7 @@ AtticaManager::uninstallResolver( const Content& resolver )
|
||||
emit resolverStateChanged( resolver.id() );
|
||||
|
||||
m_resolverStates[ resolver.id() ].state = Uninstalled;
|
||||
TomahawkSettings::instance()->setAtticaResolverState( resolver.id(), Uninstalled );
|
||||
TomahawkSettingsGui::instanceGui()->setAtticaResolverState( resolver.id(), Uninstalled );
|
||||
}
|
||||
|
||||
Tomahawk::Pipeline::instance()->removeScriptResolver( pathFromId( resolver.id() ) );
|
||||
|
@ -13,11 +13,15 @@ add_definitions( -DQT_SHARED )
|
||||
add_definitions( -DDLLEXPORT_PRO )
|
||||
|
||||
set( libGuiSources
|
||||
actioncollection.cpp
|
||||
|
||||
contextmenu.cpp
|
||||
dropjob.cpp
|
||||
globalactionmanager.cpp
|
||||
viewpage.cpp
|
||||
viewmanager.cpp
|
||||
LatchManager.cpp
|
||||
TomahawkSettingsGui.cpp
|
||||
|
||||
context/ContextPage.cpp
|
||||
context/ContextWidget.cpp
|
||||
@ -35,15 +39,6 @@ set( libGuiSources
|
||||
|
||||
infobar/infobar.cpp
|
||||
|
||||
infosystem/infoplugins/generic/echonestplugin.cpp
|
||||
infosystem/infoplugins/generic/lastfmplugin.cpp
|
||||
infosystem/infoplugins/generic/chartsplugin.cpp
|
||||
infosystem/infoplugins/generic/spotifyPlugin.cpp
|
||||
infosystem/infoplugins/generic/hypemPlugin.cpp
|
||||
infosystem/infoplugins/generic/musixmatchplugin.cpp
|
||||
infosystem/infoplugins/generic/musicbrainzPlugin.cpp
|
||||
infosystem/infoplugins/generic/RoviPlugin.cpp
|
||||
|
||||
playlist/treemodel.cpp
|
||||
playlist/treeproxymodel.cpp
|
||||
playlist/treeheader.cpp
|
||||
@ -138,11 +133,15 @@ set( libGuiSources
|
||||
)
|
||||
|
||||
set( libGuiHeaders
|
||||
actioncollection.h
|
||||
|
||||
contextmenu.h
|
||||
dropjob.h
|
||||
viewpage.h
|
||||
viewmanager.h
|
||||
globalactionmanager.h
|
||||
LatchManager.h
|
||||
TomahawkSettingsGui.h
|
||||
|
||||
context/ContextPage.h
|
||||
context/ContextWidget.h
|
||||
@ -153,15 +152,6 @@ set( libGuiHeaders
|
||||
|
||||
infobar/infobar.h
|
||||
|
||||
infosystem/infoplugins/generic/echonestplugin.h
|
||||
infosystem/infoplugins/generic/lastfmplugin.h
|
||||
infosystem/infoplugins/generic/chartsplugin.h
|
||||
infosystem/infoplugins/generic/spotifyPlugin.h
|
||||
infosystem/infoplugins/generic/hypemPlugin.h
|
||||
infosystem/infoplugins/generic/musixmatchplugin.h
|
||||
infosystem/infoplugins/generic/musicbrainzPlugin.h
|
||||
infosystem/infoplugins/generic/RoviPlugin.h
|
||||
|
||||
playlist/topbar/topbar.h
|
||||
playlist/topbar/clearbutton.h
|
||||
playlist/topbar/searchlineedit.h
|
||||
@ -275,7 +265,6 @@ set( libSources
|
||||
pipeline.cpp
|
||||
|
||||
aclsystem.cpp
|
||||
actioncollection.cpp
|
||||
artist.cpp
|
||||
album.cpp
|
||||
collection.cpp
|
||||
@ -286,7 +275,6 @@ set( libSources
|
||||
source.cpp
|
||||
sourceplaylistinterface.cpp
|
||||
playlistinterface.cpp
|
||||
LatchManager.cpp
|
||||
|
||||
EchonestCatalogSynchronizer.cpp
|
||||
|
||||
@ -353,6 +341,15 @@ set( libSources
|
||||
infosystem/infosystemcache.cpp
|
||||
infosystem/infosystemworker.cpp
|
||||
|
||||
infosystem/infoplugins/generic/echonestplugin.cpp
|
||||
infosystem/infoplugins/generic/lastfmplugin.cpp
|
||||
infosystem/infoplugins/generic/chartsplugin.cpp
|
||||
infosystem/infoplugins/generic/spotifyPlugin.cpp
|
||||
infosystem/infoplugins/generic/hypemPlugin.cpp
|
||||
infosystem/infoplugins/generic/musixmatchplugin.cpp
|
||||
infosystem/infoplugins/generic/musicbrainzPlugin.cpp
|
||||
infosystem/infoplugins/generic/RoviPlugin.cpp
|
||||
|
||||
network/bufferiodevice.cpp
|
||||
network/msgprocessor.cpp
|
||||
network/streamconnection.cpp
|
||||
@ -391,14 +388,12 @@ set( libHeaders
|
||||
functimeout.h
|
||||
|
||||
aclsystem.h
|
||||
actioncollection.h
|
||||
collection.h
|
||||
query.h
|
||||
resolver.h
|
||||
result.h
|
||||
source.h
|
||||
sourceplaylistinterface.h
|
||||
LatchManager.h
|
||||
|
||||
artist.h
|
||||
album.h
|
||||
@ -468,6 +463,15 @@ set( libHeaders
|
||||
infosystem/infosystemworker.h
|
||||
infosystem/infosystemcache.h
|
||||
|
||||
infosystem/infoplugins/generic/echonestplugin.h
|
||||
infosystem/infoplugins/generic/lastfmplugin.h
|
||||
infosystem/infoplugins/generic/chartsplugin.h
|
||||
infosystem/infoplugins/generic/spotifyPlugin.h
|
||||
infosystem/infoplugins/generic/hypemPlugin.h
|
||||
infosystem/infoplugins/generic/musixmatchplugin.h
|
||||
infosystem/infoplugins/generic/musicbrainzPlugin.h
|
||||
infosystem/infoplugins/generic/RoviPlugin.h
|
||||
|
||||
network/bufferiodevice.h
|
||||
network/msgprocessor.h
|
||||
network/remotecollection.h
|
||||
@ -543,14 +547,14 @@ IF(LIBATTICA_FOUND)
|
||||
ENDIF(LIBATTICA_FOUND)
|
||||
|
||||
IF( UNIX AND NOT APPLE )
|
||||
SET( libGuiSources ${libGuiSources}
|
||||
LIST(APPEND libGuiSources
|
||||
infosystem/infoplugins/unix/mprispluginrootadaptor.cpp
|
||||
infosystem/infoplugins/unix/mprispluginplayeradaptor.cpp
|
||||
infosystem/infoplugins/unix/mprisplugin.cpp
|
||||
infosystem/infoplugins/unix/fdonotifyplugin.cpp
|
||||
infosystem/infoplugins/unix/imageconverter.cpp )
|
||||
|
||||
SET( libGuiHeaders ${libGuiHeaders}
|
||||
LIST(APPEND libGuiHeaders
|
||||
infosystem/infoplugins/unix/mprispluginrootadaptor.h
|
||||
infosystem/infoplugins/unix/mprispluginplayeradaptor.h
|
||||
infosystem/infoplugins/unix/mprisplugin.h
|
||||
|
@ -18,11 +18,6 @@
|
||||
|
||||
#include "tomahawksettings.h"
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include <QDesktopServices>
|
||||
#include "settingsdialog.h"
|
||||
#endif
|
||||
|
||||
#include <QDir>
|
||||
|
||||
#include "sip/SipHandler.h"
|
||||
@ -40,40 +35,6 @@ using namespace Tomahawk;
|
||||
|
||||
TomahawkSettings* TomahawkSettings::s_instance = 0;
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
inline QDataStream& operator<<(QDataStream& out, const AtticaManager::StateHash& states)
|
||||
{
|
||||
out << VERSION;
|
||||
out << (quint32)states.count();
|
||||
foreach( const QString& key, states.keys() )
|
||||
{
|
||||
AtticaManager::Resolver resolver = states[ key ];
|
||||
out << key << resolver.version << resolver.scriptPath << (qint32)resolver.state << resolver.userRating;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
inline QDataStream& operator>>(QDataStream& in, AtticaManager::StateHash& states)
|
||||
{
|
||||
quint32 count = 0, version = 0;
|
||||
in >> version;
|
||||
in >> count;
|
||||
for ( uint i = 0; i < count; i++ )
|
||||
{
|
||||
QString key, version, scriptPath;
|
||||
qint32 state, userRating;
|
||||
in >> key;
|
||||
in >> version;
|
||||
in >> scriptPath;
|
||||
in >> state;
|
||||
in >> userRating;
|
||||
states[ key ] = AtticaManager::Resolver( version, scriptPath, userRating, (AtticaManager::ResolverState)state );
|
||||
}
|
||||
return in;
|
||||
}
|
||||
#endif
|
||||
|
||||
TomahawkSettings*
|
||||
TomahawkSettings::instance()
|
||||
{
|
||||
@ -108,11 +69,6 @@ TomahawkSettings::TomahawkSettings( QObject* parent )
|
||||
setValue( "configversion", VERSION );
|
||||
}
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
qRegisterMetaType< AtticaManager::StateHash >( "AtticaManager::StateHash" );
|
||||
qRegisterMetaTypeStreamOperators<AtticaManager::StateHash>("AtticaManager::StateHash");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -264,12 +220,12 @@ TomahawkSettings::infoSystemCacheVersion() const
|
||||
|
||||
|
||||
QStringList
|
||||
TomahawkSettings::scannerPaths()
|
||||
TomahawkSettings::scannerPaths() const
|
||||
{
|
||||
QString musicLocation;
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
musicLocation = QDesktopServices::storageLocation( QDesktopServices::MusicLocation );
|
||||
#if defined(Q_WS_X11)
|
||||
musicLocation = QDir::homePath() + QLatin1String("/Music");
|
||||
#endif
|
||||
|
||||
return value( "scanner/paths", musicLocation ).toStringList();
|
||||
@ -916,40 +872,6 @@ TomahawkSettings::setEnabledScriptResolvers( const QStringList& resolvers )
|
||||
setValue( "script/loadedresolvers", resolvers );
|
||||
}
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
void
|
||||
TomahawkSettings::setAtticaResolverState( const QString& resolver, AtticaManager::ResolverState state )
|
||||
{
|
||||
AtticaManager::StateHash resolvers = value( "script/atticaresolverstates" ).value< AtticaManager::StateHash >();
|
||||
AtticaManager::Resolver r = resolvers.value( resolver );
|
||||
r.state = state;
|
||||
resolvers.insert( resolver, r );
|
||||
setValue( "script/atticaresolverstates", QVariant::fromValue< AtticaManager::StateHash >( resolvers ) );
|
||||
|
||||
sync();
|
||||
}
|
||||
|
||||
AtticaManager::StateHash
|
||||
TomahawkSettings::atticaResolverStates() const
|
||||
{
|
||||
return value( "script/atticaresolverstates" ).value< AtticaManager::StateHash >();
|
||||
}
|
||||
|
||||
void
|
||||
TomahawkSettings::setAtticaResolverStates( const AtticaManager::StateHash states )
|
||||
{
|
||||
setValue( "script/atticaresolverstates", QVariant::fromValue< AtticaManager::StateHash >( states ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TomahawkSettings::removeAtticaResolverState ( const QString& resolver )
|
||||
{
|
||||
AtticaManager::StateHash resolvers = value( "script/atticaresolverstates" ).value< AtticaManager::StateHash >();
|
||||
resolvers.remove( resolver );
|
||||
setValue( "script/atticaresolverstates", QVariant::fromValue< AtticaManager::StateHash >( resolvers ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
QString
|
||||
TomahawkSettings::scriptDefaultPath() const
|
||||
|
@ -19,10 +19,6 @@
|
||||
#ifndef TOMAHAWK_SETTINGS_H
|
||||
#define TOMAHAWK_SETTINGS_H
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
#include "AtticaManager.h"
|
||||
#endif
|
||||
|
||||
#include "playlist.h"
|
||||
|
||||
#include <QSettings>
|
||||
@ -45,7 +41,7 @@ public:
|
||||
void applyChanges() { emit changed(); }
|
||||
|
||||
/// General settings
|
||||
QStringList scannerPaths(); /// QDesktopServices::MusicLocation by default
|
||||
virtual QStringList scannerPaths() const; /// QDesktopServices::MusicLocation in TomahawkSettingsGui
|
||||
void setScannerPaths( const QStringList& paths );
|
||||
bool hasScannerPaths() const;
|
||||
uint scannerTime() const;
|
||||
@ -188,13 +184,6 @@ 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 );
|
||||
@ -229,8 +218,5 @@ private:
|
||||
static TomahawkSettings* s_instance;
|
||||
};
|
||||
|
||||
#ifndef ENABLE_HEADLESS
|
||||
Q_DECLARE_METATYPE(AtticaManager::StateHash);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "resolver.h"
|
||||
#include "pipeline.h"
|
||||
#include "config.h"
|
||||
|
||||
#include "AtticaManager.h"
|
||||
#include "utils/logger.h"
|
||||
|
||||
ResolversModel::ResolversModel( QObject* parent )
|
||||
|
@ -74,6 +74,7 @@
|
||||
#include "actioncollection.h"
|
||||
#include <QtGui/QMessageBox>
|
||||
#include "widgets/HeaderLabel.h"
|
||||
#include <TomahawkSettingsGui.h>
|
||||
#endif
|
||||
|
||||
// should go to a plugin actually
|
||||
@ -157,8 +158,14 @@ TomahawkApp::init()
|
||||
TomahawkUtils::setHeaderHeight( fm.height() + 8 );
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_HEADLESS
|
||||
new TomahawkSettings( this );
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
#else
|
||||
new TomahawkSettingsGui( this );
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
#endif
|
||||
|
||||
|
||||
tDebug( LOGINFO ) << "Setting NAM.";
|
||||
// Cause the creation of the nam, but don't need to address it directly, so prevent warning
|
||||
|
Loading…
x
Reference in New Issue
Block a user