From 456011d100f73093ba110e4ca6bd543afa9feea8 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Sun, 27 Nov 2011 19:02:14 +0000 Subject: [PATCH] Don't show the "Retrieving Grooveshark playlists" task forever if the user has no playlists. --- src/internet/groovesharkservice.cpp | 10 +++++++--- src/translations/translations.pot | 30 ++++++++++++++--------------- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/internet/groovesharkservice.cpp b/src/internet/groovesharkservice.cpp index 2b6e5bf9f..dd07c6df2 100644 --- a/src/internet/groovesharkservice.cpp +++ b/src/internet/groovesharkservice.cpp @@ -597,16 +597,20 @@ void GroovesharkService::UserPlaylistsRetrieved() { QVariantMap result = ExtractResult(reply); QVariantList playlists = result["playlists"].toList(); - QVariantList::iterator it; - for (it = playlists.begin(); it != playlists.end(); ++it) { + + foreach (const QVariant& playlist_variant, playlists) { // Get playlist info - QVariantMap playlist = (*it).toMap(); + QVariantMap playlist = playlist_variant.toMap(); int playlist_id = playlist["PlaylistID"].toInt(); QString playlist_name = playlist["PlaylistName"].toString(); // Request playlist's songs RefreshPlaylist(playlist_id, playlist_name); } + + if (playlists.isEmpty()) { + model()->task_manager()->SetTaskFinished(task_playlists_id_); + } } void GroovesharkService::PlaylistSongsRetrieved() { diff --git a/src/translations/translations.pot b/src/translations/translations.pot index 04f0ebc69..36e6b6ebf 100644 --- a/src/translations/translations.pot +++ b/src/translations/translations.pot @@ -424,11 +424,11 @@ msgstr "" msgid "Add stream..." msgstr "" -#: internet/groovesharkservice.cpp:905 +#: internet/groovesharkservice.cpp:909 msgid "Add to Grooveshark favorites" msgstr "" -#: internet/groovesharkservice.cpp:911 +#: internet/groovesharkservice.cpp:915 msgid "Add to Grooveshark playlists" msgstr "" @@ -474,7 +474,7 @@ msgstr "" msgid "Added within three months" msgstr "" -#: internet/groovesharkservice.cpp:1103 +#: internet/groovesharkservice.cpp:1107 msgid "Adding song to favorites" msgstr "" @@ -633,7 +633,7 @@ msgstr "" msgid "Are you sure you want to delete the \"%1\" preset?" msgstr "" -#: internet/groovesharkservice.cpp:1075 +#: internet/groovesharkservice.cpp:1079 msgid "Are you sure you want to delete this playlist?" msgstr "" @@ -1045,7 +1045,7 @@ msgstr "" msgid "Convert any music that the device can't play" msgstr "" -#: internet/groovesharkservice.cpp:958 +#: internet/groovesharkservice.cpp:962 msgid "Copy to clipboard" msgstr "" @@ -1125,7 +1125,7 @@ msgstr "" msgid "Covers from %1" msgstr "" -#: internet/groovesharkservice.cpp:488 internet/groovesharkservice.cpp:1027 +#: internet/groovesharkservice.cpp:488 internet/groovesharkservice.cpp:1031 msgid "Create a new Grooveshark playlist" msgstr "" @@ -1265,7 +1265,7 @@ msgstr "" msgid "Delay between visualizations" msgstr "" -#: internet/groovesharkservice.cpp:491 internet/groovesharkservice.cpp:1074 +#: internet/groovesharkservice.cpp:491 internet/groovesharkservice.cpp:1078 msgid "Delete Grooveshark playlist" msgstr "" @@ -1880,11 +1880,11 @@ msgstr "" msgid "Genre" msgstr "" -#: internet/groovesharkservice.cpp:922 +#: internet/groovesharkservice.cpp:926 msgid "Get an URL to share this Grooveshark song" msgstr "" -#: internet/groovesharkservice.cpp:701 +#: internet/groovesharkservice.cpp:705 msgid "Getting Grooveshark popular songs" msgstr "" @@ -1934,7 +1934,7 @@ msgstr "" msgid "Grooveshark login error" msgstr "" -#: internet/groovesharkservice.cpp:954 +#: internet/groovesharkservice.cpp:958 msgid "Grooveshark song's URL" msgstr "" @@ -2602,7 +2602,7 @@ msgstr "" msgid "My Recommendations" msgstr "" -#: internet/groovesharkservice.cpp:1028 ui/equalizer.cpp:172 +#: internet/groovesharkservice.cpp:1032 ui/equalizer.cpp:172 #: ../bin/src/ui_deviceproperties.h:369 #: ../bin/src/ui_magnatunedownloaddialog.h:135 #: ../bin/src/ui_wizardfinishpage.h:84 @@ -3223,7 +3223,7 @@ msgstr "" msgid "Remove playlist" msgstr "" -#: internet/groovesharkservice.cpp:1161 +#: internet/groovesharkservice.cpp:1165 msgid "Removing song from favorites" msgstr "" @@ -3301,7 +3301,7 @@ msgstr "" msgid "Results" msgstr "" -#: internet/groovesharkservice.cpp:672 +#: internet/groovesharkservice.cpp:676 msgid "Retrieving Grooveshark favorites songs" msgstr "" @@ -3383,7 +3383,7 @@ msgid "Search" msgstr "" #: internet/groovesharksearchplaylisttype.cpp:32 -#: internet/groovesharkservice.cpp:840 +#: internet/groovesharkservice.cpp:844 msgid "Search Grooveshark" msgstr "" @@ -4143,7 +4143,7 @@ msgstr "" msgid "Unset cover" msgstr "" -#: internet/groovesharkservice.cpp:982 +#: internet/groovesharkservice.cpp:986 msgid "Update Grooveshark playlist" msgstr ""