Sayonara Player
Public Types | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Library::AlbumCoverFetchThread Class Reference

This class organizes requests for new Covers for the AlbumCoverView. When looking for covers, not all requests should be fired simultaneously, so there should be a buffer assuring that covers are found one by one. Albums are organized by hashes, each album has a CoverLocation. A new request is added to the queue by calling add_data(). A new request is handled BEFORE old requests. The thread is locked until the done() function is called. The thread emits the signal sig_next(). The cover location and the hash which should be processed next can be fetched by current_hash() and current_cover_location(). More...

#include <AlbumCoverFetchThread.h>

Inheritance diagram for Library::AlbumCoverFetchThread:

Public Types

using Hash = QString
 
using HashAlbumPair = QPair< Hash, Album >
 
using HashAlbumList = QList< HashAlbumPair >
 
using HashLocationPair = QPair< Hash, Cover::Location >
 
using HashLocationList = QList< HashLocationPair >
 

Signals

void sig_next ()
 

Public Member Functions

 AlbumCoverFetchThread (QObject *parent=nullptr)
 
void add_album (const Album &album)
 add_data Add a new album request More...
 
bool check_album (const QString &hash)
 
int lookups_ready () const
 
int queued_hashes () const
 
int unprocessed_hashes () const
 
HashLocationPair take_current_lookup ()
 
void pause ()
 stop Stop the thread
 
void stop ()
 
void resume ()
 
void clear ()
 
void done (const Hash &hash)
 

Static Public Member Functions

static Hash get_hash (const Album &album)
 

Protected Member Functions

void run () override
 

Detailed Description

This class organizes requests for new Covers for the AlbumCoverView. When looking for covers, not all requests should be fired simultaneously, so there should be a buffer assuring that covers are found one by one. Albums are organized by hashes, each album has a CoverLocation. A new request is added to the queue by calling add_data(). A new request is handled BEFORE old requests. The thread is locked until the done() function is called. The thread emits the signal sig_next(). The cover location and the hash which should be processed next can be fetched by current_hash() and current_cover_location().

Member Function Documentation

◆ add_album()

void Library::AlbumCoverFetchThread::add_album ( const Album album)

add_data Add a new album request

Parameters
hashhashed album info
clCover Location of the album