Thumbnailer Qt API
lomiri-thumbnailer-qt.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 3 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
17 */
18#pragma once
19
20#include <QImage>
21#include <QObject>
22#include <QSharedPointer>
23
24class QDBusConnection;
25
26namespace lomiri
27{
28
29namespace thumbnailer
30{
31
32namespace qt
33{
34
35namespace internal
36{
37class ThumbnailerImpl;
38class RequestImpl;
39}
40
47class Q_DECL_EXPORT Request : public QObject
48{
49 Q_OBJECT
50public:
52 Q_DISABLE_COPY(Request)
54
65
72 bool isFinished() const;
73
78 QImage image() const;
79
84 QString errorMessage() const;
85
91 bool isValid() const;
92
106
113 void cancel();
114
121 bool isCancelled() const;
122
123Q_SIGNALS:
127 void finished();
128
129private:
130 QScopedPointer<internal::RequestImpl> p_;
131 explicit Request(internal::RequestImpl* impl) Q_DECL_HIDDEN;
132
133 friend class internal::ThumbnailerImpl;
134};
135
173class Q_DECL_EXPORT Thumbnailer final
174{
175public:
177 Q_DISABLE_COPY(Thumbnailer)
179
190
202 explicit Thumbnailer(QDBusConnection const& connection);
203
211
219 QSharedPointer<Request> getAlbumArt(QString const& artist, QString const& album, QSize const& requestedSize);
220
228 QSharedPointer<Request> getArtistArt(QString const& artist, QString const& album, QSize const& requestedSize);
229
236 QSharedPointer<Request> getThumbnail(QString const& filePath, QSize const& requestedSize);
237
238private:
239 QScopedPointer<internal::ThumbnailerImpl> p_;
240};
241
242} // namespace qt
243
244} // namespace thumbnailer
245
246} // namespace lomiri
Holds a thumbnailer request.
Definition lomiri-thumbnailer-qt.h:48
bool isFinished() const
Returns whether the request has completed.
void finished()
This signal is emitted when the request completes.
void waitForFinished()
Blocks the calling thread until the request completes.
bool isCancelled() const
Returns whether the request was cancelled.
void cancel()
Cancel the thumbnail request.
QString errorMessage() const
Returns the error message for a failed request.
~Request()
Destroys a request.
QImage image() const
Returns the thumbnail.
bool isValid() const
Returns whether the request completed successfully.
Class to obtain thumbnail images for various media types.
Definition lomiri-thumbnailer-qt.h:174
Definition lomiri-thumbnailer-qt.h:27