lomiri::thumbnailer::qt::Thumbnailer Class Referencefinal

Class to obtain thumbnail images for various media types. More...

`#include <lomiri/thumbnailer/qt/lomiri-thumbnailer-qt.h>`

## Public Member Functions

| Thumbnailer ()
| Constructs a thumbnailer instance.
| Thumbnailer (QDBusConnection const &connection)
| Constructs a thumbnailer instance, using the supplied DBus connection.
| ~Thumbnailer ()
| Destroys a thumbnailer instance.
QSharedPointer< Request > | getAlbumArt (QString const &artist, QString const &album, QSize const &requestedSize)
| Retrieves a thumbnail for an album cover from the remote image server.
QSharedPointer< Request > | getArtistArt (QString const &artist, QString const &album, QSize const &requestedSize)
| Retrieves a thumbnail for an artist from the remote image server.
QSharedPointer< Request > | getThumbnail (QString const &filePath, QSize const &requestedSize)
| Extracts a thumbnail from a media file.

## Detailed Description

Class to obtain thumbnail images for various media types.

Class Thumbnailer provides thumbnail images for local media (image, audio, and video) files, as well as album covers and artist images for many musicians and bands.

Most common image formats, such as PNG, JPEG, BMP, and so on, are recognized. For streaming media, the recognized formats depend on the installed GStreamer codecs.

For local media files, thumbnails are extracted directly from the file. (For audio files, this requires the file to contain embedded artwork.) For album covers and artist images, artwork is downloaded from a remote image server (dash.ubuntu.com) that maintains a large database of albums and musicians.

The requested size for a thumbnail specifies a bounding box (in pixels) of type QSize to which the thumbnail will be scaled. (The aspect ratio of the original image is preserved.)

The returned thumbnails never exceed max-thumbnail-size (usually 1920, see thumbnailer-settings(7)) in their larger dimension, even if a larger size is requested.

- Passing QSize(0,n) or QSize(n,0) defines a bounding box of n pixels in one dimension, and unconstrained size in the other dimension (subject to the max-thumbnail-size limit).
- Passing QSize(0,0) requests a thumbnail that fits into a square bounding box of max-thumbnail-size.
- Sizes with one or both dimensions ≥ max-thumbnail-size) are clamped to max-thumbnail-size pixels.
- Sizes with one or both dimensions < 0 return an error.

Original images are never scaled up, so the returned thumbnail may be smaller than its requested size.

All methods are asynchronous and are guaranteed not to block.

The return value is a shared pointer to a Request instance that provides access to the scaled thumbnail (or an error message).

## Constructor & Destructor Documentation

## Thumbnailer() [1/2]

lomiri::thumbnailer::qt::Thumbnailer::Thumbnailer | ( |  | ) |

Constructs a thumbnailer instance.

A default-constructed Thumbnailer instance communicates with the thumbnailer service via the session bus.

Warning
  Instantiation and finalization of Thumbnailer instances are expensive operations. Do not needlessly destroy a Thumbnailer only to re-create it again later.

## Thumbnailer() [2/2]

lomiri::thumbnailer::qt::Thumbnailer::Thumbnailer | ( | QDBusConnection const & | connection | ) |

explicit

Constructs a thumbnailer instance, using the supplied DBus connection.

Instead of connecting to the session bus, this constructor uses the supplied DBus connection to contact the thumbnailer service.

Parameters

  connection | The DBus connection via which to send requests.

Warning
  Instantiation and finalization of Thumbnailer instances are expensive operations. Do not needlessly destroy a Thumbnailer only to re-create it again later.

## ~Thumbnailer()

lomiri::thumbnailer::qt::Thumbnailer::~Thumbnailer | ( |  | ) |

Destroys a thumbnailer instance.

Warning
  You must keep the Thumbnailer instance alive for as long as Request instances created by that Thumbnailer instance exist.

## Member Function Documentation

## getAlbumArt()

QSharedPointer< Request > lomiri::thumbnailer::qt::Thumbnailer::getAlbumArt | ( | QString const & | artist,
|  | QString const & | album,
|  | QSize const & | requestedSize )

Retrieves a thumbnail for an album cover from the remote image server.

Parameters

  artist | The name of the artist.
  album | The name of the album.
  requestedSize | The bounding box for the thumbnail.

Returns
  A QSharedPointer to a lomiri::thumbnailer::qt::Request holding the request state.

## getArtistArt()

QSharedPointer< Request > lomiri::thumbnailer::qt::Thumbnailer::getArtistArt | ( | QString const & | artist,
|  | QString const & | album,
|  | QSize const & | requestedSize )

Retrieves a thumbnail for an artist from the remote image server.

Parameters

  artist | The name of the artist.
  album | The name of the album.
  requestedSize | The bounding box for the thumbnail.

Returns
  A QSharedPointer to a lomiri::thumbnailer::qt::Request holding the request state.

## getThumbnail()

QSharedPointer< Request > lomiri::thumbnailer::qt::Thumbnailer::getThumbnail | ( | QString const & | filePath,
|  | QSize const & | requestedSize )

Extracts a thumbnail from a media file.

Parameters

  filePath | The path to the file to extract the thumbnail from.
  requestedSize | The bounding box for the thumbnail.

Returns
  A QSharedPointer to a lomiri::thumbnailer::qt::Request holding the request state.

The documentation for this class was generated from the following file:

- /build/lomiri-thumbnailer-QhFTRL/lomiri-thumbnailer-3.1.2/include/lomiri/thumbnailer/qt/lomiri-thumbnailer-qt.h