Only load covers when item shown
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user