mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-20 15:59:42 +01:00
Clean up after ourselves
This commit is contained in:
parent
434acf21a4
commit
9aa6e2a338
@ -34,6 +34,7 @@
|
||||
#include "sourcelist.h"
|
||||
|
||||
#include "utils/logger.h"
|
||||
#include "PlaylistUpdaterInterface.h"
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@ -254,6 +255,9 @@ Playlist::reportDeleted( const Tomahawk::playlist_ptr& self )
|
||||
m_deleted = true;
|
||||
m_source->collection()->deletePlaylist( self );
|
||||
|
||||
if ( m_updater )
|
||||
m_updater->remove();
|
||||
|
||||
emit deleted( self );
|
||||
}
|
||||
|
||||
|
@ -80,6 +80,18 @@ PlaylistUpdaterInterface::doSave()
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
PlaylistUpdaterInterface::remove()
|
||||
{
|
||||
TomahawkSettings* s = TomahawkSettings::instance();
|
||||
const QString key = QString( "playlistupdaters/%1" ).arg( m_playlist->guid() );
|
||||
removeFromSettings( key );
|
||||
s->remove( QString( "%1/type" ).arg( key ) );
|
||||
s->remove( QString( "%1/autoupdate" ).arg( key ) );
|
||||
s->remove( QString( "%1/interval" ).arg( key ) );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistUpdaterInterface::setAutoUpdate( bool autoUpdate )
|
||||
{
|
||||
|
@ -49,6 +49,8 @@ public:
|
||||
void setInterval( int intervalMsecs ) ;
|
||||
int intervalMsecs() const { return m_timer->interval(); }
|
||||
|
||||
void remove();
|
||||
|
||||
playlist_ptr playlist() const { return m_playlist; }
|
||||
|
||||
/// If you want to try to load a updater from the settings. Returns a valid
|
||||
@ -64,6 +66,7 @@ private slots:
|
||||
protected:
|
||||
virtual void loadFromSettings( const QString& group ) = 0;
|
||||
virtual void saveToSettings( const QString& group ) const = 0;
|
||||
virtual void removeFromSettings( const QString& group ) const = 0;
|
||||
|
||||
private:
|
||||
QTimer* m_timer;
|
||||
|
@ -82,3 +82,9 @@ XspfUpdater::loadFromSettings( const QString& group )
|
||||
{
|
||||
m_url = TomahawkSettings::instance()->value( QString( "%1/xspfurl" ).arg( group ) ).toString();
|
||||
}
|
||||
|
||||
void
|
||||
XspfUpdater::removeFromSettings( const QString& group ) const
|
||||
{
|
||||
TomahawkSettings::instance()->remove( QString( "%1/xspfurl" ).arg( group ) );
|
||||
}
|
||||
|
@ -42,6 +42,7 @@ public slots:
|
||||
protected:
|
||||
void loadFromSettings( const QString& group );
|
||||
void saveToSettings( const QString& group ) const;
|
||||
virtual void removeFromSettings(const QString& group) const;
|
||||
|
||||
private slots:
|
||||
void playlistLoaded();
|
||||
|
Loading…
x
Reference in New Issue
Block a user