lomiri-thumbnailer-qt.h
Go to the documentation of this file.
/*
* Copyright (C) 2015 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Xavi Garcia <xavi.garcia.mena@canonical.com>
*/
#pragma once
#include <QImage>
#include <QObject>
#include <QSharedPointer>
class QDBusConnection;
namespace lomiri
{
namespace thumbnailer
{
namespace qt
{
namespace internal
{
class ThumbnailerImpl;
class RequestImpl;
}
class Q_DECL_EXPORT Request : public QObject
{
Q_OBJECT
public:
Q_DISABLE_COPY(Request)
~Request();
bool isFinished() const;
QImage image() const;
QString errorMessage() const;
bool isValid() const;
void waitForFinished();
void cancel();
bool isCancelled() const;
Q_SIGNALS:
void finished();
private:
QScopedPointer<internal::RequestImpl> p_;
explicit Request(internal::RequestImpl* impl) Q_DECL_HIDDEN;
friend class internal::ThumbnailerImpl;
};
class Q_DECL_EXPORT Thumbnailer final
{
public:
Q_DISABLE_COPY(Thumbnailer)
Thumbnailer();
explicit Thumbnailer(QDBusConnection const& connection);
~Thumbnailer();
QSharedPointer<Request> getAlbumArt(QString const& artist, QString const& album, QSize const& requestedSize);
QSharedPointer<Request> getArtistArt(QString const& artist, QString const& album, QSize const& requestedSize);
QSharedPointer<Request> getThumbnail(QString const& filePath, QSize const& requestedSize);
private:
QScopedPointer<internal::ThumbnailerImpl> p_;
};
} // namespace qt
} // namespace thumbnailer
} // namespace lomiri
lomiri::thumbnailer::qt::Request
Holds a thumbnailer request.
Definition lomiri-thumbnailer-qt.h:48
lomiri::thumbnailer::qt::Request::isFinished
bool isFinished() const
Returns whether the request has completed.
lomiri::thumbnailer::qt::Request::finished
void finished()
This signal is emitted when the request completes.
lomiri::thumbnailer::qt::Request::waitForFinished
void waitForFinished()
Blocks the calling thread until the request completes.
lomiri::thumbnailer::qt::Request::isCancelled
bool isCancelled() const
Returns whether the request was cancelled.
lomiri::thumbnailer::qt::Request::cancel
void cancel()
Cancel the thumbnail request.
lomiri::thumbnailer::qt::Request::errorMessage
QString errorMessage() const
Returns the error message for a failed request.
lomiri::thumbnailer::qt::Request::~Request
~Request()
Destroys a request.
lomiri::thumbnailer::qt::Request::image
QImage image() const
Returns the thumbnail.
lomiri::thumbnailer::qt::Request::isValid
bool isValid() const
Returns whether the request completed successfully.
lomiri::thumbnailer::qt::Thumbnailer::getAlbumArt
QSharedPointer< Request > getAlbumArt(QString const &artist, QString const &album, QSize const &requestedSize)
Retrieves a thumbnail for an album cover from the remote image server.
lomiri::thumbnailer::qt::Thumbnailer::Thumbnailer
Thumbnailer()
Constructs a thumbnailer instance.
lomiri::thumbnailer::qt::Thumbnailer::getThumbnail
QSharedPointer< Request > getThumbnail(QString const &filePath, QSize const &requestedSize)
Extracts a thumbnail from a media file.
lomiri::thumbnailer::qt::Thumbnailer::getArtistArt
QSharedPointer< Request > getArtistArt(QString const &artist, QString const &album, QSize const &requestedSize)
Retrieves a thumbnail for an artist from the remote image server.
lomiri::thumbnailer::qt
Definition lomiri-thumbnailer-qt.h:33
lomiri::thumbnailer
Definition lomiri-thumbnailer-qt.h:30
lomiri
Definition lomiri-thumbnailer-qt.h:27