Sayonara Player
CoverLookup.h
1 /* CoverLookup.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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: Michael Lugmair (Lucio Carreras)
27  */
28 
29 #ifndef COVERLOOKUP_H_
30 #define COVERLOOKUP_H_
31 
32 #include "AbstractCoverLookup.h"
33 #include "Utils/Pimpl.h"
34 #include "Utils/CoverUtils.h"
35 
36 #include <QPixmap>
37 #include <QList>
38 
39 namespace Cover
40 {
41  class Location;
42 
47  class Lookup :
48  public LookupBase
49  {
50  Q_OBJECT
51  PIMPL(Lookup)
52 
53  public:
54 
55  Lookup(const Location& cl, int n_covers, QObject* parent);
56  ~Lookup() override;
57 
63  void stop() override;
64 
69  void setUserData(void* data);
70 
75  void* userData();
76 
82 
83  Util::Covers::Source source() const;
84 
85  private:
86 
87  bool fetchFromDatabase();
88  bool fetchFromExtractor();
89  bool fetchFromWWW();
90 
91 
92  bool startExtractor(const Location& cl);
97  bool startNewThread(const Location& cl);
98 
99  bool addNewCover(const QPixmap& pm, bool save);
100 
101  void emitFinished(bool success);
102 
103  public slots:
104  void start();
105 
106  private slots:
111  void coverFound(int idx);
112 
116  void threadFinished(bool);
117 
118  void extractorFinished();
119  };
120 
121 
126  using LookupPtr=std::shared_ptr<Lookup>;
127 
128 }
129 #endif /* COVERLOOKUP_H_ */
Cover::Lookup::pixmaps
QList< QPixmap > pixmaps() const
Get a copy of all pixmaps that where fetched.
Cover::Lookup::userData
void * userData()
Fetch your custom data again.
Cover::Lookup::setUserData
void setUserData(void *data)
Set some custom data you can retrieve later.
QList
Definition: EngineUtils.h:33
Cover::LookupPtr
std::shared_ptr< Lookup > LookupPtr
CoverLookupPtr.
Definition: CoverLookup.h:126
Cover::Lookup
The CoverLookup class.
Definition: CoverLookup.h:49
Cover::Location
The CoverLocation class.
Definition: CoverLocation.h:39
Cover::Lookup::stop
void stop() override
Stop the Cover::FetchThread if running and retrieve the sigFinished signal If no Cover::FetchThread i...
Cover::LookupBase
The CoverLookupInterface class.
Definition: AbstractCoverLookup.h:39