Sayonara Player
CoverFetchThread.h
1 /* CoverFetchThread.h */
2 
3 /* Copyright (C) 2011-2017 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 QStringList;
37 class AsyncWebAccess;
38 
39 namespace Cover
40 {
41  class Location;
42 
43 
48  class FetchThread :
49  public QObject
50  {
51  Q_OBJECT
52  PIMPL(FetchThread)
53 
54  signals:
59  void sig_finished(bool b);
60 
65  void sig_cover_found(const QString& cover_path);
66 
67 
68  public:
69  FetchThread();
70  FetchThread(QObject* parent, const Cover::Location& cl, const int n_covers);
71  virtual ~FetchThread();
72 
78  bool start();
79 
84  bool more();
85 
89  void stop();
90 
91 
92  private:
98  void save_and_emit_image(const QString& filepath,
99  const QImage& img);
100 
101 
102  private slots:
108  void single_image_fetched();
109 
115  void multi_image_fetched();
116 
121  void content_fetched();
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:48
void sig_cover_found(const QString &cover_path)
emitted, when covers has been found
void sig_finished(bool b)
emitted, when thread has finished
void stop()
stops the current search
The CoverLocation class.
Definition: CoverLocation.h:41
bool more()
fetch next cover
bool start()
start fetching covers, if the url does not contain "google", a direct link to an image is assumed and...
Asynchgronous web access class.
Definition: AsyncWebAccess.h:38
Definition: SomaFMStation.h:33