Don't download the Magnatune catalogue every time.

This commit is contained in:
David Sansome 2010-12-11 15:07:39 +00:00
parent b8a78abe06
commit 19ea38b0a1
2 changed files with 8 additions and 4 deletions

View File

@ -119,9 +119,6 @@ void MagnatuneService::LazyPopulate(RadioItem *item) {
model()->merged_model()->AddSubModel(
model()->index(root_->row, 0, model()->ItemToIndex(item->parent)),
library_sort_model_);
if (total_song_count_ == 0)
ReloadDatabase();
break;
default:
@ -131,6 +128,13 @@ void MagnatuneService::LazyPopulate(RadioItem *item) {
item->lazy_loaded = true;
}
void MagnatuneService::UpdateTotalSongCount(int count) {
total_song_count_ = count;
if (total_song_count_ == 0 && !load_database_task_id_) {
ReloadDatabase();
}
}
void MagnatuneService::ReloadDatabase() {
QNetworkRequest request = QNetworkRequest(QUrl(kDatabaseUrl));
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute,

View File

@ -90,7 +90,7 @@ class MagnatuneService : public RadioService {
void DownloadFinished(const QStringList& albums);
private slots:
void UpdateTotalSongCount(int count) { total_song_count_ = count; }
void UpdateTotalSongCount(int count);
void ReloadDatabase();
void ReloadDatabaseFinished();