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