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 "Helper/Pimpl.h"
34 
35 class QImage;
36 class CoverLocation;
37 class QStringList;
38 class AsyncWebAccess;
39 
40 
46  public QObject
47 {
48  Q_OBJECT
49  PIMPL(CoverFetchThread)
50 
51 signals:
56  void sig_finished(bool b);
57 
62  void sig_cover_found(const QString& cover_path);
63 
64 
65 public:
67  CoverFetchThread(QObject* parent, const CoverLocation& cl, const int n_covers);
68  virtual ~CoverFetchThread();
69 
75  bool start();
76 
81  bool more();
82 
86  void stop();
87 
88 
89 private:
95  void save_and_emit_image(const QString& filepath,
96  const QImage& img);
97 
98 
99 private slots:
105  void single_image_fetched();
106 
112  void multi_image_fetched();
113 
118  void content_fetched();
119 };
120 
121 #endif /* COVERFETCHTHREAD_H_ */
The CoverFetchThread class, This is not a real QThread class, but behaves like one because of AsyncWe...
Definition: CoverFetchThread.h:45
void stop()
stops the current search
The CoverLocation class.
Definition: CoverLocation.h:37
bool start()
start fetching covers, if the url does not contain "google", a direct link to an image is assumed and...
bool more()
fetch next cover
void sig_finished(bool b)
emitted, when thread has finished
Asynchgronous web access class.
Definition: AsyncWebAccess.h:38
void sig_cover_found(const QString &cover_path)
emitted, when covers has been found