Sayonara Player
CoverViewPixmapCache.h
1 #ifndef COVERVIEWPIXMAPCACHE_H
2 #define COVERVIEWPIXMAPCACHE_H
3 
4 #include "Utils/Pimpl.h"
5 #include <QThread>
6 
7 using Hash=QString;
8 class QPixmap;
9 
10 class CoverViewPixmapCache : public QThread
11 {
12  Q_OBJECT
14 
15 signals:
16  void sig_hash_ready(const QString& hash);
17 
18 public:
19  CoverViewPixmapCache(QObject* parent=nullptr);
21 
22  void clear();
23  void set_scaling(int scaling);
24  int scaling();
25 
26  bool has_pixmap(const Hash& hash) const;
27  bool has_scaled_pixmap(const Hash& hash) const;
28  bool is_in_queue(const Hash& hash) const;
29 
30  QPixmap pixmap(const Hash& hash, bool scaled) const;
31  QPixmap scaled_pixmap(const Hash& hash);
32  QPixmap invalid_pixmap() const;
33  void add_pixmap(const Hash& hash, const QPixmap& pm);
34 
35  bool is_outdated(const Hash& hash) const;
36  void set_cache_size(int size_orig, int size_scaled);
37 
38 protected:
39  void run() override;
40 };
41 
42 #endif // COVERVIEWPIXMAPCACHE_H
Definition: CoverViewPixmapCache.h:10