mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-08 23:26:40 +02:00
fixes
This commit is contained in:
@@ -32,7 +32,7 @@ QPixmap* SpotifyPlaylistUpdater::s_typePixmap = 0;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Tomahawk::PlaylistUpdaterInterface*
|
Tomahawk::PlaylistUpdaterInterface*
|
||||||
SpotifyUpdaterFactory::create( const Tomahawk::playlist_ptr& pl, const QString &key )
|
SpotifyUpdaterFactory::create( const Tomahawk::playlist_ptr& pl, const QVariantHash &settings )
|
||||||
{
|
{
|
||||||
if ( !m_account )
|
if ( !m_account )
|
||||||
{
|
{
|
||||||
@@ -54,9 +54,9 @@ SpotifyUpdaterFactory::create( const Tomahawk::playlist_ptr& pl, const QString &
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Register the updater with the account
|
// Register the updater with the account
|
||||||
const QString spotifyId = TomahawkSettings::instance()->value( QString( "%1/spotifyId" ).arg( key ) ).toString();
|
const QString spotifyId = settings.value( "spotifyId" ).toString();
|
||||||
const QString latestRev = TomahawkSettings::instance()->value( QString( "%1/latestrev" ).arg( key ) ).toString();
|
const QString latestRev = settings.value( "%1/latestrev" ).toString();
|
||||||
const bool sync = TomahawkSettings::instance()->value( QString( "%1/sync" ).arg( key ) ).toBool();
|
const bool sync = settings.value( "%1/sync" ).toBool();
|
||||||
|
|
||||||
Q_ASSERT( !spotifyId.isEmpty() );
|
Q_ASSERT( !spotifyId.isEmpty() );
|
||||||
SpotifyPlaylistUpdater* updater = new SpotifyPlaylistUpdater( m_account.data(), latestRev, spotifyId, pl );
|
SpotifyPlaylistUpdater* updater = new SpotifyPlaylistUpdater( m_account.data(), latestRev, spotifyId, pl );
|
||||||
@@ -89,6 +89,8 @@ SpotifyPlaylistUpdater::init()
|
|||||||
connect( playlist().data(), SIGNAL( renamed( QString, QString ) ), this, SLOT( tomahawkPlaylistRenamed( QString, QString ) ) );
|
connect( playlist().data(), SIGNAL( renamed( QString, QString ) ), this, SLOT( tomahawkPlaylistRenamed( QString, QString ) ) );
|
||||||
connect( playlist().data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistRevisionLoaded() ), Qt::QueuedConnection ); // Queued so that in Playlist.cpp:443 we let the playlist clear its own queue first
|
connect( playlist().data(), SIGNAL( revisionLoaded( Tomahawk::PlaylistRevision ) ), this, SLOT( playlistRevisionLoaded() ), Qt::QueuedConnection ); // Queued so that in Playlist.cpp:443 we let the playlist clear its own queue first
|
||||||
// TODO reorders in a playlist
|
// TODO reorders in a playlist
|
||||||
|
|
||||||
|
saveToSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -122,12 +124,8 @@ SpotifyPlaylistUpdater::remove( bool askToDeletePlaylist )
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SpotifyPlaylistUpdater::removeFromSettings( const QString& group ) const
|
SpotifyPlaylistUpdater::aboutToDelete()
|
||||||
{
|
{
|
||||||
TomahawkSettings::instance()->remove( QString( "%1/latestrev" ).arg( group ) );
|
|
||||||
TomahawkSettings::instance()->remove( QString( "%1/sync" ).arg( group ) );
|
|
||||||
TomahawkSettings::instance()->remove( QString( "%1/spotifyId" ).arg( group ) );
|
|
||||||
|
|
||||||
if ( m_sync )
|
if ( m_sync )
|
||||||
{
|
{
|
||||||
if ( QThread::currentThread() != QApplication::instance()->thread() )
|
if ( QThread::currentThread() != QApplication::instance()->thread() )
|
||||||
@@ -173,11 +171,15 @@ SpotifyPlaylistUpdater::playlistRevisionLoaded()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SpotifyPlaylistUpdater::saveToSettings( const QString& group ) const
|
SpotifyPlaylistUpdater::saveToSettings()
|
||||||
{
|
{
|
||||||
TomahawkSettings::instance()->setValue( QString( "%1/latestrev" ).arg( group ), m_latestRev );
|
QVariantHash s = settings();
|
||||||
TomahawkSettings::instance()->setValue( QString( "%1/sync" ).arg( group ), m_sync );
|
|
||||||
TomahawkSettings::instance()->setValue( QString( "%1/spotifyId" ).arg( group ), m_spotifyId );
|
s[ "latestrev" ] = m_latestRev;
|
||||||
|
s[ "sync" ] = m_sync;
|
||||||
|
s[ "spotifyId" ] = m_spotifyId;
|
||||||
|
|
||||||
|
saveSettings( s );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -214,6 +216,7 @@ SpotifyPlaylistUpdater::setSync( bool sync )
|
|||||||
|
|
||||||
m_sync = sync;
|
m_sync = sync;
|
||||||
|
|
||||||
|
saveToSettings();
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -543,6 +546,9 @@ SpotifyPlaylistUpdater::onTracksInsertedReturn( const QString& msgType, const QV
|
|||||||
if ( changed.size() > 0 )
|
if ( changed.size() > 0 )
|
||||||
playlist()->updateEntries( uuid(), playlist()->currentrevision(), changed );
|
playlist()->updateEntries( uuid(), playlist()->currentrevision(), changed );
|
||||||
|
|
||||||
|
// Update with latest rev when/if we use it
|
||||||
|
// saveToSettings();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -67,9 +67,9 @@ public slots:
|
|||||||
void tomahawkTracksRemoved( const QList<Tomahawk::query_ptr>& );
|
void tomahawkTracksRemoved( const QList<Tomahawk::query_ptr>& );
|
||||||
void tomahawkTracksMoved( const QList<Tomahawk::plentry_ptr>& ,int );
|
void tomahawkTracksMoved( const QList<Tomahawk::plentry_ptr>& ,int );
|
||||||
void tomahawkPlaylistRenamed( const QString&, const QString& );
|
void tomahawkPlaylistRenamed( const QString&, const QString& );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void removeFromSettings(const QString& group) const;
|
void aboutToDelete();
|
||||||
virtual void saveToSettings(const QString& group) const;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
// SpotifyResolver message handlers, all take msgtype, msg as argument
|
// SpotifyResolver message handlers, all take msgtype, msg as argument
|
||||||
@@ -82,6 +82,8 @@ private slots:
|
|||||||
void playlistRevisionLoaded();
|
void playlistRevisionLoaded();
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
|
void saveToSettings();
|
||||||
|
|
||||||
/// Finds the nearest spotify id from pos to the beginning of the playlist
|
/// Finds the nearest spotify id from pos to the beginning of the playlist
|
||||||
QString nearestSpotifyTrack( const QList< Tomahawk::plentry_ptr >& entries, int pos );
|
QString nearestSpotifyTrack( const QList< Tomahawk::plentry_ptr >& entries, int pos );
|
||||||
QVariantList plentryToVariant( const QList< Tomahawk::plentry_ptr >& entries );
|
QVariantList plentryToVariant( const QList< Tomahawk::plentry_ptr >& entries );
|
||||||
@@ -109,7 +111,7 @@ class SpotifyUpdaterFactory : public Tomahawk::PlaylistUpdaterFactory
|
|||||||
public:
|
public:
|
||||||
SpotifyUpdaterFactory() {}
|
SpotifyUpdaterFactory() {}
|
||||||
|
|
||||||
virtual Tomahawk::PlaylistUpdaterInterface* create( const Tomahawk::playlist_ptr& pl, const QString& key );
|
virtual Tomahawk::PlaylistUpdaterInterface* create( const Tomahawk::playlist_ptr& pl, const QVariantHash& settings );
|
||||||
virtual QString type() const { return "spotify"; }
|
virtual QString type() const { return "spotify"; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@@ -45,7 +45,7 @@ operator<<(QDataStream& out, const PlaylistUpdaterInterface::SerializedUpdaters&
|
|||||||
foreach( const QString& key, updaters.keys() )
|
foreach( const QString& key, updaters.keys() )
|
||||||
{
|
{
|
||||||
PlaylistUpdaterInterface::SerializedUpdater updater = updaters[ key ];
|
PlaylistUpdaterInterface::SerializedUpdater updater = updaters[ key ];
|
||||||
out << key << updater.type << updater.sync << updater.customData;
|
out << key << updater.type << updater.customData;
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@@ -66,9 +66,8 @@ operator>>(QDataStream& in, PlaylistUpdaterInterface::SerializedUpdaters& update
|
|||||||
qint32 state, userRating;
|
qint32 state, userRating;
|
||||||
in >> key;
|
in >> key;
|
||||||
in >> type;
|
in >> type;
|
||||||
in >> sync;
|
|
||||||
in >> customData;
|
in >> customData;
|
||||||
updaters[ key ] = PlaylistUpdaterInterface::SerializedUpdater( type, sync, customData );
|
updaters[ key ] = PlaylistUpdaterInterface::SerializedUpdater( type, customData );
|
||||||
}
|
}
|
||||||
|
|
||||||
return in;
|
return in;
|
||||||
@@ -1219,3 +1218,26 @@ TomahawkSettings::setImportXspfPath( const QString& path )
|
|||||||
{
|
{
|
||||||
setValue( "importXspfPath", path );
|
setValue( "importXspfPath", path );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
PlaylistUpdaterInterface::SerializedUpdaters
|
||||||
|
TomahawkSettings::playlistUpdaters() const
|
||||||
|
{
|
||||||
|
return value( "playlistupdaters" ).value< PlaylistUpdaterInterface::SerializedUpdaters >();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkSettings::setPlaylistUpdaters( const PlaylistUpdaterInterface::SerializedUpdaters& updaters )
|
||||||
|
{
|
||||||
|
setValue( "playlistupdaters", QVariant::fromValue< PlaylistUpdaterInterface::SerializedUpdaters >( updaters ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
TomahawkSettings::registerCustomSettingsHandlers()
|
||||||
|
{
|
||||||
|
qRegisterMetaType< Tomahawk::PlaylistUpdaterInterface::SerializedUpdater >( "Tomahawk::PlaylistUpdaterInterface::SerializedUpdater" );
|
||||||
|
qRegisterMetaType< Tomahawk::PlaylistUpdaterInterface::SerializedUpdaters >( "Tomahawk::PlaylistUpdaterInterface::SerializedUpdaters" );
|
||||||
|
qRegisterMetaTypeStreamOperators< Tomahawk::PlaylistUpdaterInterface::SerializedUpdaters >( "Tomahawk::PlaylistUpdaterInterface::SerializedUpdaters" );
|
||||||
|
}
|
||||||
|
@@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
#include "Playlist.h"
|
#include "Playlist.h"
|
||||||
|
|
||||||
|
#include "playlist/PlaylistUpdaterInterface.h"
|
||||||
|
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QtNetwork/QNetworkProxy>
|
#include <QtNetwork/QNetworkProxy>
|
||||||
|
|
||||||
@@ -201,6 +203,9 @@ public:
|
|||||||
void setImportXspfPath( const QString& path );
|
void setImportXspfPath( const QString& path );
|
||||||
QString importXspfPath() const;
|
QString importXspfPath() const;
|
||||||
|
|
||||||
|
Tomahawk::PlaylistUpdaterInterface::SerializedUpdaters playlistUpdaters() const;
|
||||||
|
void setPlaylistUpdaters( const Tomahawk::PlaylistUpdaterInterface::SerializedUpdaters& updaters );
|
||||||
|
|
||||||
static void registerCustomSettingsHandlers();
|
static void registerCustomSettingsHandlers();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@@ -35,21 +35,22 @@ PlaylistUpdaterInterface*
|
|||||||
PlaylistUpdaterInterface::loadForPlaylist( const playlist_ptr& pl )
|
PlaylistUpdaterInterface::loadForPlaylist( const playlist_ptr& pl )
|
||||||
{
|
{
|
||||||
TomahawkSettings* s = TomahawkSettings::instance();
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
const QString key = QString( "playlistupdaters/%1" ).arg( pl->guid() );
|
|
||||||
if ( s->contains( QString( "%1/type" ).arg( key ) ) )
|
const SerializedUpdaters updaters = s->playlistUpdaters();
|
||||||
|
if ( updaters.contains( pl->guid() ) )
|
||||||
{
|
{
|
||||||
// Ok, we have one we can try to load
|
// Ok, we have one we can try to load
|
||||||
const QString type = s->value( QString( "%1/type" ).arg( key ) ).toString();
|
|
||||||
PlaylistUpdaterInterface* updater = 0;
|
PlaylistUpdaterInterface* updater = 0;
|
||||||
|
const SerializedUpdater info = updaters[ pl->guid() ];
|
||||||
|
|
||||||
if ( !s_factories.contains( type ) )
|
if ( !s_factories.contains( info.type ) )
|
||||||
{
|
{
|
||||||
Q_ASSERT( false );
|
Q_ASSERT( false );
|
||||||
// You forgot to register your new updater type with the factory....
|
// You forgot to register your new updater type with the factory....
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
updater = s_factories[ type ]->create( pl, key );
|
updater = s_factories[ info.type ]->create( pl, info.customData );
|
||||||
return updater;
|
return updater;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,13 +73,19 @@ PlaylistUpdaterInterface::PlaylistUpdaterInterface( const playlist_ptr& pl )
|
|||||||
void
|
void
|
||||||
PlaylistUpdaterInterface::save()
|
PlaylistUpdaterInterface::save()
|
||||||
{
|
{
|
||||||
|
if ( m_playlist.isNull() )
|
||||||
|
return;
|
||||||
|
|
||||||
TomahawkSettings* s = TomahawkSettings::instance();
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
const QString key = QString( "playlistupdaters/%1" ).arg( m_playlist->guid() );
|
|
||||||
if ( !s->contains( QString( "%1/type" ).arg( key ) ) )
|
SerializedUpdaters updaters = s->playlistUpdaters();
|
||||||
{
|
|
||||||
s->setValue( QString( "%1/type" ).arg( key ), type() );
|
SerializedUpdater updater = updaters.value( m_playlist ->guid() );
|
||||||
}
|
updater.type = type();
|
||||||
saveToSettings( key );
|
updater.customData = m_extraData;
|
||||||
|
updaters[ m_playlist->guid() ] = updater;
|
||||||
|
|
||||||
|
s->setPlaylistUpdaters( updaters );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -88,9 +95,27 @@ PlaylistUpdaterInterface::remove()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
TomahawkSettings* s = TomahawkSettings::instance();
|
TomahawkSettings* s = TomahawkSettings::instance();
|
||||||
const QString key = QString( "playlistupdaters/%1" ).arg( m_playlist->guid() );
|
|
||||||
removeFromSettings( key );
|
SerializedUpdaters updaters = s->playlistUpdaters();
|
||||||
s->remove( QString( "%1/type" ).arg( key ) );
|
if ( updaters.remove( m_playlist->guid() ) )
|
||||||
|
s->setPlaylistUpdaters( updaters );
|
||||||
|
|
||||||
|
aboutToDelete();
|
||||||
|
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QVariantHash
|
||||||
|
PlaylistUpdaterInterface::settings() const
|
||||||
|
{
|
||||||
|
return m_extraData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistUpdaterInterface::saveSettings( const QVariantHash& settings )
|
||||||
|
{
|
||||||
|
m_extraData = settings;
|
||||||
|
save();
|
||||||
|
}
|
||||||
|
@@ -46,10 +46,10 @@ public:
|
|||||||
// used when loading/saving from settings
|
// used when loading/saving from settings
|
||||||
struct SerializedUpdater {
|
struct SerializedUpdater {
|
||||||
QString type;
|
QString type;
|
||||||
bool sync;
|
|
||||||
QVariantHash customData;
|
QVariantHash customData;
|
||||||
|
|
||||||
SerializedUpdater( const QString& t, bool s, const QVariantHash cd ) : type( t ), sync( s ), customData( cd ) {}
|
SerializedUpdater( const QString& t, const QVariantHash cd ) : type( t ), customData( cd ) {}
|
||||||
|
SerializedUpdater() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef QHash< QString, SerializedUpdater > SerializedUpdaters;
|
typedef QHash< QString, SerializedUpdater > SerializedUpdaters;
|
||||||
@@ -89,11 +89,14 @@ public slots:
|
|||||||
void save();
|
void save();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void saveToSettings( const QString& group ) const = 0;
|
virtual void aboutToDelete() {}
|
||||||
virtual void removeFromSettings( const QString& group ) const = 0;
|
|
||||||
|
QVariantHash settings() const;
|
||||||
|
void saveSettings( const QVariantHash& settings );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
playlist_ptr m_playlist;
|
playlist_ptr m_playlist;
|
||||||
|
QVariantHash m_extraData;
|
||||||
|
|
||||||
static QMap< QString, PlaylistUpdaterFactory* > s_factories;
|
static QMap< QString, PlaylistUpdaterFactory* > s_factories;
|
||||||
};
|
};
|
||||||
@@ -106,9 +109,12 @@ public:
|
|||||||
virtual ~PlaylistUpdaterFactory() {}
|
virtual ~PlaylistUpdaterFactory() {}
|
||||||
|
|
||||||
virtual QString type() const = 0;
|
virtual QString type() const = 0;
|
||||||
virtual PlaylistUpdaterInterface* create( const playlist_ptr&, const QString& settingsKey ) = 0;
|
virtual PlaylistUpdaterInterface* create( const playlist_ptr&, const QVariantHash& settings ) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE( Tomahawk::PlaylistUpdaterInterface::SerializedUpdater );
|
||||||
|
Q_DECLARE_METATYPE( Tomahawk::PlaylistUpdaterInterface::SerializedUpdaters );
|
||||||
|
|
||||||
#endif // PLAYLISTUPDATERINTERFACE_H
|
#endif // PLAYLISTUPDATERINTERFACE_H
|
||||||
|
@@ -20,7 +20,6 @@
|
|||||||
|
|
||||||
#include "Playlist.h"
|
#include "Playlist.h"
|
||||||
#include "utils/XspfLoader.h"
|
#include "utils/XspfLoader.h"
|
||||||
#include "TomahawkSettings.h"
|
|
||||||
#include "Pipeline.h"
|
#include "Pipeline.h"
|
||||||
#include "utils/TomahawkUtils.h"
|
#include "utils/TomahawkUtils.h"
|
||||||
|
|
||||||
@@ -33,11 +32,11 @@
|
|||||||
using namespace Tomahawk;
|
using namespace Tomahawk;
|
||||||
|
|
||||||
PlaylistUpdaterInterface*
|
PlaylistUpdaterInterface*
|
||||||
XspfUpdaterFactory::create( const playlist_ptr &pl, const QString& settingsKey )
|
XspfUpdaterFactory::create( const playlist_ptr &pl, const QVariantHash& settings )
|
||||||
{
|
{
|
||||||
const bool autoUpdate = TomahawkSettings::instance()->value( QString( "%1/autoupdate" ).arg( settingsKey ) ).toBool();
|
const bool autoUpdate = settings.value( "autoupdate" ).toBool();
|
||||||
const int interval = TomahawkSettings::instance()->value( QString( "%1/interval" ).arg( settingsKey ) ).toInt();
|
const int interval = settings.value( "interval" ).toInt();
|
||||||
const QString url = TomahawkSettings::instance()->value( QString( "%1/xspfurl" ).arg( settingsKey ) ).toString();
|
const QString url = settings.value( "xspfurl" ).toString();
|
||||||
|
|
||||||
XspfUpdater* updater = new XspfUpdater( pl, interval, autoUpdate, url );
|
XspfUpdater* updater = new XspfUpdater( pl, interval, autoUpdate, url );
|
||||||
|
|
||||||
@@ -113,24 +112,6 @@ XspfUpdater::playlistLoaded( const QList<Tomahawk::query_ptr>& newEntries )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
XspfUpdater::saveToSettings( const QString& group ) const
|
|
||||||
{
|
|
||||||
TomahawkSettings::instance()->setValue( QString( "%1/autoupdate" ).arg( group ), m_autoUpdate );
|
|
||||||
TomahawkSettings::instance()->setValue( QString( "%1/interval" ).arg( group ), m_timer->interval() );
|
|
||||||
TomahawkSettings::instance()->setValue( QString( "%1/xspfurl" ).arg( group ), m_url );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
XspfUpdater::removeFromSettings( const QString& group ) const
|
|
||||||
{
|
|
||||||
TomahawkSettings::instance()->remove( QString( "%1/autoupdate" ).arg( group ) );
|
|
||||||
TomahawkSettings::instance()->remove( QString( "%1/interval" ).arg( group ) );
|
|
||||||
TomahawkSettings::instance()->remove( QString( "%1/xspfurl" ).arg( group ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
XspfUpdater::setAutoUpdate( bool autoUpdate )
|
XspfUpdater::setAutoUpdate( bool autoUpdate )
|
||||||
{
|
{
|
||||||
@@ -141,8 +122,9 @@ XspfUpdater::setAutoUpdate( bool autoUpdate )
|
|||||||
else
|
else
|
||||||
m_timer->stop();
|
m_timer->stop();
|
||||||
|
|
||||||
const QString key = QString( "playlistupdaters/%1/autoupdate" ).arg( playlist()->guid() );
|
QVariantHash s = settings();
|
||||||
TomahawkSettings::instance()->setValue( key, m_autoUpdate );
|
s[ "autoupdate" ] = m_autoUpdate;
|
||||||
|
saveSettings( s );
|
||||||
|
|
||||||
// Update immediately as well
|
// Update immediately as well
|
||||||
if ( m_autoUpdate )
|
if ( m_autoUpdate )
|
||||||
@@ -152,8 +134,9 @@ XspfUpdater::setAutoUpdate( bool autoUpdate )
|
|||||||
void
|
void
|
||||||
XspfUpdater::setInterval( int intervalMsecs )
|
XspfUpdater::setInterval( int intervalMsecs )
|
||||||
{
|
{
|
||||||
const QString key = QString( "playlistupdaters/%1/interval" ).arg( playlist()->guid() );
|
QVariantHash s = settings();
|
||||||
TomahawkSettings::instance()->setValue( key, intervalMsecs );
|
s[ "interval" ] = intervalMsecs;
|
||||||
|
saveSettings( s );
|
||||||
|
|
||||||
if ( !m_timer )
|
if ( !m_timer )
|
||||||
m_timer = new QTimer( this );
|
m_timer = new QTimer( this );
|
||||||
|
@@ -52,10 +52,6 @@ public slots:
|
|||||||
void updateNow();
|
void updateNow();
|
||||||
void setAutoUpdate( bool autoUpdate );
|
void setAutoUpdate( bool autoUpdate );
|
||||||
|
|
||||||
protected:
|
|
||||||
void saveToSettings( const QString& group ) const;
|
|
||||||
void removeFromSettings(const QString& group) const;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void playlistLoaded( const QList<Tomahawk::query_ptr> & );
|
void playlistLoaded( const QList<Tomahawk::query_ptr> & );
|
||||||
|
|
||||||
@@ -75,7 +71,7 @@ public:
|
|||||||
XspfUpdaterFactory() {}
|
XspfUpdaterFactory() {}
|
||||||
|
|
||||||
virtual QString type() const { return "xspf"; }
|
virtual QString type() const { return "xspf"; }
|
||||||
virtual PlaylistUpdaterInterface* create( const playlist_ptr& pl, const QString& settingsKey );
|
virtual PlaylistUpdaterInterface* create( const playlist_ptr& pl, const QVariantHash& settings );
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user