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)
53  ~Request();
55 
62  bool isFinished() const;
63 
68  QImage image() const;
69 
74  QString errorMessage() const;
75 
81  bool isValid() const;
82 
88  void waitForFinished();
89 
96  void cancel();
97 
98 Q_SIGNALS:
102  void finished();
103 
104 private:
105  QScopedPointer<internal::RequestImpl> p_;
106  explicit Request(internal::RequestImpl* impl) Q_DECL_HIDDEN;
107 
108  friend class internal::ThumbnailerImpl;
109 };
110 
141 class Q_DECL_EXPORT Thumbnailer final
142 {
143 public:
145  Q_DISABLE_COPY(Thumbnailer)
147 
154  Thumbnailer();
155 
164  explicit Thumbnailer(QDBusConnection const& connection);
165 
167  ~Thumbnailer();
169 
177  QSharedPointer<Request> getAlbumArt(QString const& artist, QString const& album, QSize const& requestedSize);
178 
186  QSharedPointer<Request> getArtistArt(QString const& artist, QString const& album, QSize const& requestedSize);
187 
194  QSharedPointer<Request> getThumbnail(QString const& filePath, QSize const& requestedSize);
195 
196 private:
197  QScopedPointer<internal::ThumbnailerImpl> p_;
198 };
199 
200 } // namespace qt
201 
202 } // namespace thumbnailer
203 
204 } // namespace unity
Class to obtain thumbnail images for various media types.
Definition: thumbnailer-qt.h:141
Definition: thumbnailer-qt.h:26
Holds a thumbnailer request.
Definition: thumbnailer-qt.h:47