From 9f5215302cc0df28ba77066f0da1031f56534826 Mon Sep 17 00:00:00 2001 From: Leo Franchi Date: Fri, 30 Mar 2012 14:32:01 -0400 Subject: [PATCH] various updater fixes --- src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp | 2 -- src/libtomahawk/playlist/XspfUpdater.cpp | 7 +++++++ src/libtomahawk/utils/xspfloader.cpp | 6 +++++- src/libtomahawk/utils/xspfloader.h | 3 ++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp b/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp index da7e2f75d..c057ceb59 100644 --- a/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp +++ b/src/libtomahawk/playlist/PlaylistUpdaterInterface.cpp @@ -64,8 +64,6 @@ PlaylistUpdaterInterface::PlaylistUpdaterInterface( const playlist_ptr& pl ) connect( m_timer, SIGNAL( timeout() ), this, SLOT( updateNow() ) ); QTimer::singleShot( 0, this, SLOT( doSave() ) ); - - setAutoUpdate( m_autoUpdate ); } PlaylistUpdaterInterface::PlaylistUpdaterInterface( const playlist_ptr& pl, int interval, bool autoUpdate ) diff --git a/src/libtomahawk/playlist/XspfUpdater.cpp b/src/libtomahawk/playlist/XspfUpdater.cpp index 2eb1d7a1e..d00991d20 100644 --- a/src/libtomahawk/playlist/XspfUpdater.cpp +++ b/src/libtomahawk/playlist/XspfUpdater.cpp @@ -55,8 +55,15 @@ XspfUpdater::~XspfUpdater() void XspfUpdater::updateNow() { + if ( m_url.isEmpty() ) + { + qWarning() << "XspfUpdater not updating because we have an empty url..."; + return; + } + XSPFLoader* l = new XSPFLoader( false, false ); l->setAutoResolveTracks( false ); + l->setErrorTitle( playlist()->title() ); l->load( m_url ); connect( l, SIGNAL( tracks( QList ) ), this, SLOT( playlistLoaded( QList ) ) ); } diff --git a/src/libtomahawk/utils/xspfloader.cpp b/src/libtomahawk/utils/xspfloader.cpp index 9fd0c7369..f9a70851b 100644 --- a/src/libtomahawk/utils/xspfloader.cpp +++ b/src/libtomahawk/utils/xspfloader.cpp @@ -122,7 +122,11 @@ XSPFLoader::reportError() { emit error( FetchError ); #ifndef ENABLE_HEADLESS - JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( errorToString( FetchError) ) ); + const QString errorMsg = errorToString( FetchError); + if ( !m_errorTitle.isEmpty() ) + JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( QString( "%1: %2" ).arg( m_errorTitle ).arg( errorMsg ) ) ); + else + JobStatusView::instance()->model()->addJob( new ErrorStatusMessage( errorMsg ) ); #endif deleteLater(); } diff --git a/src/libtomahawk/utils/xspfloader.h b/src/libtomahawk/utils/xspfloader.h index e4e912618..7369a51b8 100644 --- a/src/libtomahawk/utils/xspfloader.h +++ b/src/libtomahawk/utils/xspfloader.h @@ -49,6 +49,7 @@ public: void setOverrideTitle( const QString& newTitle ); void setAutoResolveTracks( bool autoResolve ) { m_autoResolve = autoResolve; } void setAutoDelete( bool autoDelete ) { m_autoDelete = autoDelete; } + void setErrorTitle( const QString& error ) { m_errorTitle = error; } static QString errorToString( XSPFErrorCode error ); @@ -73,7 +74,7 @@ private: bool m_autoCreate, m_autoUpdate, m_autoResolve, m_autoDelete; QString m_NS,m_overrideTitle; QList< Tomahawk::query_ptr > m_entries; - QString m_title, m_info, m_creator; + QString m_title, m_info, m_creator, m_errorTitle; QUrl m_url; QByteArray m_body;