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
37class QImage;
38
39namespace Cover
40{
41 class Location;
42
44 public QObject
45 {
46 Q_OBJECT
47 PIMPL(WebCoverFetcher)
48
49 signals:
50 void sigFinished();
51 void sigCoverFound(int idx);
52
53 public:
54 WebCoverFetcher() = delete;
55 WebCoverFetcher(QObject* parent, const Cover::Location& coverLocation, int requestedCovers);
56 ~WebCoverFetcher() override;
57
58 bool start();
59 void stop();
60
61 [[nodiscard]] QString url(int idx) const;
62 [[nodiscard]] QPixmap pixmap(int idx) const;
63
64 private slots:
65 void imageFetched();
66 void contentFetched();
67
68 private: // NOLINT(readability-redundant-access-specifiers)
69 bool processNextSearchUrl();
70 bool processNextImageUrl();
71 bool startNextRequest();
72 };
73}
74
75#endif /* COVERFETCHTHREAD_H_ */
Definition: CoverLocation.h:39
Definition: CoverFetchThread.h:45