Thumbnailer Qt API
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 
24 class QDBusConnection;
25 
26 namespace unity
27 {
28 
29 namespace thumbnailer
30 {
31 
32 namespace qt
33 {
34 
35 namespace internal
36 {
37 class ThumbnailerImpl;
38 class RequestImpl;
39 }
40 
47 class Q_DECL_EXPORT Request : public QObject
48 {
49  Q_OBJECT
50 public:
52  Q_DISABLE_COPY(Request)
54 
64  ~Request();
65 
72  bool isFinished() const;
73 
78  QImage image() const;
79 
84  QString errorMessage() const;
85 
91  bool isValid() const;
92 
105  void waitForFinished();
106 
113  void cancel();
114 
121  bool isCancelled() const;
122 
123 Q_SIGNALS:
127  void finished();
128 
129 private:
130  QScopedPointer<internal::RequestImpl> p_;
131  explicit Request(internal::RequestImpl* impl) Q_DECL_HIDDEN;
132 
133  friend class internal::ThumbnailerImpl;
134 };
135 
173 class Q_DECL_EXPORT Thumbnailer final
174 {
175 public:
177  Q_DISABLE_COPY(Thumbnailer)
179 
189  Thumbnailer();
190 
202  explicit Thumbnailer(QDBusConnection const& connection);
203 
210  ~Thumbnailer();
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 
238 private:
239  QScopedPointer<internal::ThumbnailerImpl> p_;
240 };
241 
242 } // namespace qt
243 
244 } // namespace thumbnailer
245 
246 } // namespace unity
Class to obtain thumbnail images for various media types.
Definition: thumbnailer-qt.h:173
Definition: thumbnailer-qt.h:26
Holds a thumbnailer request.
Definition: thumbnailer-qt.h:47