Only load covers when item shown

This commit is contained in:
craig
2012-04-03 20:54:50 +00:00
committed by craig
parent 6711333790
commit 8143ccb1ef
3 changed files with 18 additions and 18 deletions

View File

@@ -2288,7 +2288,7 @@ void MainWindow::currentTabChanged(int index)
if (PAGE_LIBRARY==index) {
libraryPage->controlActions();
} else {
AlbumsModel::self()->getCovers();
// AlbumsModel::self()->getCovers();
albumsPage->controlActions();
}
break;

View File

@@ -129,7 +129,7 @@ void AlbumsModel::setCoverSize(MusicLibraryItemAlbum::CoverSize size)
AlbumsModel::AlbumsModel(QObject *parent)
: QAbstractItemModel(parent)
, enabled(false)
, coversRequested(false)
// , coversRequested(false)
{
}
@@ -464,19 +464,19 @@ void AlbumsModel::update(const MusicLibraryItemRoot *root)
}
}
void AlbumsModel::getCovers()
{
if (!enabled || coversRequested || items.isEmpty()) {
return;
}
coversRequested=true;
foreach (AlbumItem *a, items) {
if (!a->isSingleTracks && !a->coverRequested) {
a->getCover(false);
}
}
}
// void AlbumsModel::getCovers()
// {
// if (!enabled || coversRequested || items.isEmpty()) {
// return;
// }
//
// coversRequested=true;
// foreach (AlbumItem *a, items) {
// if (!a->isSingleTracks && !a->coverRequested) {
// a->getCover(false);
// }
// }
// }
void AlbumsModel::setCover(const QString &artist, const QString &album, const QImage &img, const QString &file)
{
@@ -504,7 +504,7 @@ void AlbumsModel::clear()
qDeleteAll(items);
items.clear();
endResetModel();
coversRequested=false;
// coversRequested=false;
}
void AlbumsModel::setEnabled(bool e)

View File

@@ -117,7 +117,7 @@ public:
void setEnabled(bool e);
int albumSort() const;
void setAlbumSort(int s);
void getCovers();
// void getCovers();
public Q_SLOTS:
void setCover(const QString &artist, const QString &album, const QImage &img, const QString &file);
@@ -125,7 +125,7 @@ public Q_SLOTS:
private:
bool enabled;
bool coversRequested;
// bool coversRequested;
mutable QList<AlbumItem *> items;
};