Sayonara Player
CoverFetchThread.h
1 /* CoverFetchThread.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  * CoverFetchThread.h
24  *
25  * Created on: Jun 28, 2011
26  * Author: Michael Lugmair (Lucio Carreras)
27  */
28 
29 #ifndef COVERFETCHTHREAD_H_
30 #define COVERFETCHTHREAD_H_
31 
32 #include "Utils/Pimpl.h"
33 
34 #include <QObject>
35 #include <functional>
36 
37 class QImage;
38 class AsyncWebAccess;
39 
40 namespace Cover
41 {
42  class Location;
43 
45  public QObject
46  {
47  Q_OBJECT
48  PIMPL(WebCoverFetcher)
49 
50  signals:
51  void sigFinished();
52  void sigCoverFound(int idx);
53 
54  public:
55  WebCoverFetcher() = delete;
56  WebCoverFetcher(QObject* parent, const Cover::Location& coverLocation, const int requestedCovers);
57  virtual ~WebCoverFetcher();
58 
59  bool start();
60  void stop();
61 
62  QString url(int idx) const;
63  QPixmap pixmap(int idx) const;
64 
65  private slots:
66  void imageFetched();
67  void contentFetched();
68 
69  private:
70  bool processNextSearchUrl();
71  bool processNextImageUrl();
72  bool startNextRequest();
73  };
74 }
75 
76 #endif /* COVERFETCHTHREAD_H_ */
Asynchgronous web access class.
Definition: AsyncWebAccess.h:38
Definition: CoverLocation.h:39
Definition: CoverFetchThread.h:46