#include <mediaartinfo.h>
Public Member Functions | |
const QString & | type () const |
Returns type of particular media art. | |
const QUrl & | potentialPath () const |
Returns potential path of image with media art. | |
bool | exists () const |
Checks if media art exists. | |
bool | remove () const |
Remove the content of media art. | |
Info (const QString &b=QString(), const QString &c=QString(), const QString &type=QString()) | |
Constructs basic media art object. | |
Info (const MediaArt::Info &src) | |
Creates new MediaArt::Info object which is a copy of src. | |
~Info () | |
Destructs media art object. | |
bool | setMediaArtImage (const QUrl &source, bool overwrite=false) const |
Sets the content of media art image. | |
bool | setMediaArtImage (const QPixmap &source, bool overwrite=false) const |
Sets the content of media art image. | |
Static Public Attributes | |
static const QString | Type |
Type of undefined media arts. | |
Protected Member Functions | |
void | updatePath () |
Builds a proper potential path. | |
Static Protected Member Functions | |
static QString | md5 (const QString &src) |
Function which calculates MD5 of the string. | |
static QString | stripInvalidEntities (const QString &src) |
Cleans up the string from invalid entities. | |
Protected Attributes | |
QString | _b |
Private field for media art description - 1st part. | |
QString | _c |
Private field for media art description - 2nd part. | |
QString | _d |
Private field for media art description - 3rd part. | |
QString | _type |
Type of media art. | |
QUrl | _path |
Potential path to image with media art content. | |
Friends | |
uint | qHash (MediaArt::Info const &mai) |
Hashing function for MediaArt::Info objects. | |
QDebug | operator<< (QDebug dbg, const MediaArt::Info &mai) |
Simple operator to prints out MediaArt::Info objects. |
Every resource (file, web page, internet radio) can have some additional data attached. For example for album You can have an album cover or image of the CD. For video file You can have a DVD cover or producer's logo. All of those are called Media Arts. It some kind of art connected with particular media source.
There are lots of media arts types: album art, artist art, podcast art, radio art, track art etc. You can even create Your own type of media art. In Thumbnailer library we are supporting only those mentioned above. Supporting means we have some special version of MediaArt::Info class which make it easier to work with particular media art type. So You can use:
MediaArt::Album - for ablum arts
MediaArt::Artist - for artist arts
MediaArt::Track - for track arts
MediaArt::Radio - for radio arts
MediaArt::Podcast - for podcast arts
See specified subclass documentation to check how to use it. Supporting DOES NOT mean that You will always get something for that type of media art. The content of media art cache depends on much more components (mainly tracker, but also every other application which will put something into the cache - see setMediaArtImage()).
MediaArt::Info (base) class allows You to represent every kind of media art and to check if there is such a media art available:
MediaArt::Info album = MediaArt::Album("Queen", "Greatest Hits vol.1"); if(album.exists()) { // here we know that there is a media art of type album for artist Queen // and album "Greatest Hits vol.1". You can get the media art from Url: doSomethingWithMediaArtFromURL(album.potentialPath()); }
MediaArt::Info podcast = MediaArt::Podcast("Funky House Londondstyle"); if(!podcast.exists()) { // here we know that there is NO media art of type album for that podcast. // Lets put there some own data, e.g. image downloaded with the podcast podcast.setMediaArtImage(qpixmapWithMediaArtGotFromTheServer); }
MediaArt::Info podcast = MediaArt::Podcast("Funky House Londondstyle"); // proper URL to the media art file is... QUrl mediaArtUrl = podcast.potentialPath(); // .. so file should be placed here: QString pathToMediaArt = mediaArtUrl.path();
MediaArt::Info podcast = MediaArt::Podcast("Funky House Londondstyle"); podcast.remove() // from now on there is no media art with type podcast for "Funky House Londonstyle".
MediaArt::Info::Info | ( | const QString & | b = QString() , |
|
const QString & | c = QString() , |
|||
const QString & | type = QString() | |||
) |
Constructs basic media art object.
You should NOT use that constructor in Your code. You should work with dedicated classes for particular types of media arts!
b | 1st part of media art description | |
c | 2st part of media art description | |
type | type of media art |
static QString MediaArt::Info::md5 | ( | const QString & | src | ) | [static, protected] |
Function which calculates MD5 of the string.
src | string for which we want to get the checksum |
static QString MediaArt::Info::stripInvalidEntities | ( | const QString & | src | ) | [static, protected] |
Cleans up the string from invalid entities.
Specification
src | string to be cleanuped |
void MediaArt::Info::updatePath | ( | ) | [protected] |
Builds a proper potential path.
If you are building Your own type of media art it is possible that You need to overwritte that method in order to build proper potential path.
Reimplemented in MediaArt::Track.
const QString& MediaArt::Info::type | ( | ) | const |
Returns type of particular media art.
const QUrl& MediaArt::Info::potentialPath | ( | ) | const |
Returns potential path of image with media art.
bool MediaArt::Info::exists | ( | ) | const |
Checks if media art exists.
bool MediaArt::Info::remove | ( | ) | const |
Remove the content of media art.
bool MediaArt::Info::setMediaArtImage | ( | const QUrl & | source, | |
bool | overwrite = false | |||
) | const |
Sets the content of media art image.
At some cases You will have some image that You will know that it is a media art for some particular media. You should put then that image into the media arts cache, so other application (and even You later) can received it by MediaArt::Info API.
source | url to the file which should become the content of that media art | |
overwrite | false mean that if there is already some content it will not be overwritten. true will force to do that - old content will be deleted and replaced with the source. |
bool MediaArt::Info::setMediaArtImage | ( | const QPixmap & | source, | |
bool | overwrite = false | |||
) | const |
Sets the content of media art image.
At some cases You will have some image that You will know that it is a media art for some particular media. You should put then that image into the media arts cache, so other application (and even You later) can received it by MediaArt::Info API.
source | pixmap with image which should become the content of that media art | |
overwrite | false mean that if there is already some content it will not be overwritten. true will force to do that - old content will be deleted and replaced with the source. |