Move to the new rating structure

This commit is contained in:
Luca Beltrame 2014-10-04 00:03:01 +02:00
parent 25ee41c5e8
commit f22c0b6d94
2 changed files with 14 additions and 17 deletions

View file

@ -37,7 +37,7 @@
namespace Danbooru
{
const QMap<QString, Rating> DanbooruPost::RATING_MAP = initRatingMap();
const QMap<QString, DanbooruPost::Rating> DanbooruPost::RATING_MAP = initRatingMap();
DanbooruPost::DanbooruPost(QVariantMap postData, QPixmap pixmap,
QObject* parent):
@ -76,15 +76,13 @@ DanbooruPost::DanbooruPost(QXmlStreamAttributes& postData, QPixmap pixmap, QObje
DanbooruPost::~DanbooruPost()
{
delete m_pixmap;
m_pixmap = 0;
}
const QMap< QString, Rating > DanbooruPost::initRatingMap()
const QMap< QString, DanbooruPost::Rating > DanbooruPost::initRatingMap()
{
QMap<QString, Rating> map;
QMap<QString, DanbooruPost::Rating> map;
map.insert("s", Safe);
map.insert("q", Questionable);
map.insert("e", Explicit);
@ -100,7 +98,7 @@ bool DanbooruPost::operator==(const Danbooru::DanbooruPost& other)
}
void DanbooruPost::setPixmap(const QPixmap pixmap)
void DanbooruPost::setPixmap(const QPixmap &pixmap)
{
m_pixmap = pixmap;
}
@ -137,7 +135,7 @@ const QUrl DanbooruPost::thumbnailUrl() const
return m_thumbnailUrl;
}
const QPixmap DanbooruPost::pixmap() const
QPixmap DanbooruPost::pixmap() const
{
return m_pixmap;
}
@ -152,7 +150,7 @@ const QUrl DanbooruPost::fileUrl() const
return m_url;
}
const Ratings DanbooruPost::rating() const
const Danbooru::DanbooruPost::Rating DanbooruPost::rating() const
{
return m_rating;
}

View file

@ -45,7 +45,6 @@
#include "danbooru.h"
class QPixmap;
namespace Danbooru {
@ -94,7 +93,7 @@ namespace Danbooru {
private:
const QPixmap m_pixmap;
QPixmap m_pixmap;
// basic features of a post
@ -106,7 +105,7 @@ namespace Danbooru {
QUrl m_url;
QUrl m_thumbnailUrl;
QSet<QString> m_tags;
Ratings m_rating;
DanbooruPost::Rating m_rating;
static const QMap<QString, Rating> RATING_MAP;
@ -193,18 +192,18 @@ namespace Danbooru {
/**
* @return A pointer to the thumbnail's pixmap.
**/
const QPixmap pixmap() const;
QPixmap pixmap() const;
/**
* @return The current post's rating.
**/
const Ratings rating() const;
const Rating rating() const;
/**
* Set the post's pixmap to a specific QPixmap instance's pointer.
*
**/
void setPixmap(const QPixmap pixmap);
void setPixmap(const QPixmap& pixmap);
/**
* @return A string representation of the post.