Sayonara Player
AlbumCoverFetchThread.h
1 /* AlbumCoverFetchThread.h */
2 
3 /* Copyright (C) 2011-2019 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef ALBUMCOVERFETCHTHREAD_H
24 #define ALBUMCOVERFETCHTHREAD_H
25 
26 #include "Utils/Pimpl.h"
27 
28 #include <QThread>
29 #include <QModelIndex>
30 
31 namespace Cover
32 {
33  class Location;
34  class Lookup;
35 }
36 
37 namespace Library
38 {
51  class AlbumCoverFetchThread : public QThread
52  {
53  Q_OBJECT
55 
56  public:
57  using Hash=QString;
62 
63  signals:
64  void sig_next();
65 
66  protected:
67  void run() override;
68 
69  public:
70  explicit AlbumCoverFetchThread(QObject* parent=nullptr);
71  ~AlbumCoverFetchThread() override;
72 
78  void add_album(const Album& album);
79 
80  bool check_album(const QString& hash);
81 
82  int lookups_ready() const;
83  int queued_hashes() const;
84  int unprocessed_hashes() const;
85 
86 
87  HashLocationPair take_current_lookup();
88 
89 
93  void pause();
94  void stop();
95  void resume();
96  void clear();
97  void done(const Hash& hash);
98 
99  static Hash get_hash(const Album& album);
100  };
101 }
102 
103 #endif // ALBUMCOVERFETCHTHREAD_H
QPair
Definition: typedefs.h:32
Album
The Album class.
Definition: Album.h:39
QList
Definition: EngineUtils.h:33
Library::AlbumCoverFetchThread::add_album
void add_album(const Album &album)
add_data Add a new album request
Library::AlbumCoverFetchThread::pause
void pause()
stop Stop the thread
Library::AlbumCoverFetchThread
This class organizes requests for new Covers for the AlbumCoverView. When looking for covers,...
Definition: AlbumCoverFetchThread.h:51
Library
An interface class needed when implementing a library plugin.
Definition: LocalLibraryWatcher.h:32