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 
50 class AlbumCoverFetchThread : public QThread
51 {
52  Q_OBJECT
54 
55  public:
56  using Hash=QString;
61 
62  signals:
63  void sig_next();
64 
65  protected:
66  void run() override;
67 
68  public:
69  explicit AlbumCoverFetchThread(QObject* parent=nullptr);
70  ~AlbumCoverFetchThread() override;
71 
77  void add_album(const Album& album);
78 
79  bool check_album(const QString& hash);
80 
81  int lookups_ready() const;
82  int queued_hashes() const;
83  int unprocessed_hashes() const;
84 
85 
86  HashLocationPair take_current_lookup();
87 
88 
92  void pause();
93  void stop();
94  void resume();
95  void clear();
96  void done(const Hash& hash);
97 
98  static Hash get_hash(const Album& album);
99 };
100 
101 #endif // ALBUMCOVERFETCHTHREAD_H
void add_album(const Album &album)
add_data Add a new album request
Definition: typedefs.h:31
This class organizes requests for new Covers for the AlbumCoverView. When looking for covers...
Definition: AlbumCoverFetchThread.h:50
The Album class.
Definition: Album.h:39
Definition: SomaFMStation.h:33
void pause()
stop Stop the thread
Definition: org_mpris_media_player2_adaptor.h:20