Sayonara Player
CoverFetchThread.h
1 /* CoverFetchThread.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  * CoverFetchThread.h
24  *
25  * Created on: Jun 28, 2011
26  * Author: Lucio Carreras
27  */
28 
29 #ifndef COVERFETCHTHREAD_H_
30 #define COVERFETCHTHREAD_H_
31 
32 #include <QObject>
33 #include "Utils/Pimpl.h"
34 
35 class QImage;
36 class AsyncWebAccess;
37 
38 namespace Cover
39 {
40  class Location;
41 
42 
47  class FetchThread :
48  public QObject
49  {
50  Q_OBJECT
51  PIMPL(FetchThread)
52 
53  signals:
58  void sig_finished(bool b);
59 
64  void sig_cover_found(int idx);
65 
66 
67  public:
68  FetchThread()=delete;
69  FetchThread(QObject* parent, const Cover::Location& cl, const int n_covers);
70  virtual ~FetchThread();
71 
77  bool start();
78 
83  bool fetch_next_cover();
84 
88  void stop();
89 
94  QString url(int idx) const;
95  QPixmap pixmap(int idx) const;
96  int found_images() const;
97 
98 
99  private slots:
105  void single_image_fetched();
106 
112  void multi_image_fetched();
113 
118  void content_fetched();
119 
120  private:
121  void emit_finished(bool success);
122  };
123 }
124 
125 #endif /* COVERFETCHTHREAD_H_ */
The CoverFetchThread class, This is not a real QThread class, but behaves like one because of AsyncWe...
Definition: CoverFetchThread.h:47
void sig_finished(bool b)
emitted, when thread has finished
void stop()
stops the current search
The CoverLocation class.
Definition: CoverLocation.h:42
bool start()
start fetching covers, if the url does not contain "google", a direct link to an image is assumed and...
QString url(int idx) const
Google, Amazon, Last.Fm.
Asynchgronous web access class.
Definition: AsyncWebAccess.h:35
bool fetch_next_cover()
fetch next cover
void sig_cover_found(int idx)
emitted, when covers has been found