Sayonara Player
CoverLookup.h
1 /* CoverLookup.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  * CoverLookup.h
24  *
25  * Created on: Apr 4, 2011
26  * Author: Lucio Carreras
27  */
28 
29 #ifndef COVERLOOKUP_H_
30 #define COVERLOOKUP_H_
31 
32 #include "AbstractCoverLookup.h"
33 #include "Utils/Pimpl.h"
34 
35 #include <QPixmap>
36 #include <QList>
37 
38 namespace Cover
39 {
40  class Location;
41 
46  class Lookup :
47  public LookupBase
48  {
49  Q_OBJECT
50  PIMPL(Lookup)
51 
52 
53  public:
54  Lookup(const Location& cl, int n_covers, QObject* parent);
55  ~Lookup() override;
56 
57 
63  void stop() override;
64 
69  bool is_thread_running() const;
70 
75  void set_user_data(void* data);
76 
81  void* user_data();
82 
87  QList<QPixmap> pixmaps() const;
88 
89  private:
90 
91  bool fetch_from_database();
92  bool fetch_from_audio_source();
93  bool fetch_from_file_system();
94  bool fetch_from_www();
95 
96 
97  bool start_extractor(const Location& cl);
102  bool start_new_thread(const Location& cl);
103 
104  bool add_new_cover(const QPixmap& pm, bool save);
105 
106  void emit_finished(bool success);
107 
108  public slots:
109  void start();
110 
111  private slots:
116  void cover_found(int idx);
117 
121  void thread_finished(bool);
122 
123  void extractor_finished();
124  };
125 
126 
131  using LookupPtr=std::shared_ptr<Lookup>;
132 
133 }
134 #endif /* COVERLOOKUP_H_ */
bool is_thread_running() const
indicates if the Cover::FetchThread is running
The CoverLookup class.
Definition: CoverLookup.h:46
void set_user_data(void *data)
Set some custom data you can retrieve later.
std::shared_ptr< Lookup > LookupPtr
CoverLookupPtr.
Definition: CoverLookup.h:131
QList< QPixmap > pixmaps() const
Get a copy of all pixmaps that where fetched.
The CoverLookupInterface class.
Definition: AbstractCoverLookup.h:37
The CoverLocation class.
Definition: CoverLocation.h:37
void stop() override
Stop the Cover::FetchThread if running and retrieve the sig_finished signal If no Cover::FetchThread ...
void * user_data()
Fetch your custom data again.
Definition: SomaFMStation.h:33
Definition: org_mpris_media_player2_adaptor.h:20