Move to the new rating structure
This commit is contained in:
parent
25ee41c5e8
commit
f22c0b6d94
2 changed files with 14 additions and 17 deletions
|
@ -37,7 +37,7 @@
|
||||||
namespace Danbooru
|
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,
|
DanbooruPost::DanbooruPost(QVariantMap postData, QPixmap pixmap,
|
||||||
QObject* parent):
|
QObject* parent):
|
||||||
|
@ -76,15 +76,13 @@ DanbooruPost::DanbooruPost(QXmlStreamAttributes& postData, QPixmap pixmap, QObje
|
||||||
|
|
||||||
DanbooruPost::~DanbooruPost()
|
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("s", Safe);
|
||||||
map.insert("q", Questionable);
|
map.insert("q", Questionable);
|
||||||
map.insert("e", Explicit);
|
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;
|
m_pixmap = pixmap;
|
||||||
}
|
}
|
||||||
|
@ -137,7 +135,7 @@ const QUrl DanbooruPost::thumbnailUrl() const
|
||||||
return m_thumbnailUrl;
|
return m_thumbnailUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QPixmap DanbooruPost::pixmap() const
|
QPixmap DanbooruPost::pixmap() const
|
||||||
{
|
{
|
||||||
return m_pixmap;
|
return m_pixmap;
|
||||||
}
|
}
|
||||||
|
@ -152,7 +150,7 @@ const QUrl DanbooruPost::fileUrl() const
|
||||||
return m_url;
|
return m_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Ratings DanbooruPost::rating() const
|
const Danbooru::DanbooruPost::Rating DanbooruPost::rating() const
|
||||||
{
|
{
|
||||||
return m_rating;
|
return m_rating;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,6 @@
|
||||||
|
|
||||||
#include "danbooru.h"
|
#include "danbooru.h"
|
||||||
|
|
||||||
class QPixmap;
|
|
||||||
|
|
||||||
namespace Danbooru {
|
namespace Danbooru {
|
||||||
|
|
||||||
|
@ -78,7 +77,7 @@ namespace Danbooru {
|
||||||
Q_PROPERTY(QUrl thumbnailUrl READ thumbnailUrl)
|
Q_PROPERTY(QUrl thumbnailUrl READ thumbnailUrl)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Ratings for a Danbooru item
|
* @brief Ratings for a Danbooru item
|
||||||
*
|
*
|
||||||
|
@ -91,10 +90,10 @@ namespace Danbooru {
|
||||||
Explicit = 4 /**< Explicit material **/
|
Explicit = 4 /**< Explicit material **/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
const QPixmap m_pixmap;
|
QPixmap m_pixmap;
|
||||||
|
|
||||||
// basic features of a post
|
// basic features of a post
|
||||||
|
|
||||||
|
@ -106,7 +105,7 @@ namespace Danbooru {
|
||||||
QUrl m_url;
|
QUrl m_url;
|
||||||
QUrl m_thumbnailUrl;
|
QUrl m_thumbnailUrl;
|
||||||
QSet<QString> m_tags;
|
QSet<QString> m_tags;
|
||||||
Ratings m_rating;
|
DanbooruPost::Rating m_rating;
|
||||||
|
|
||||||
static const QMap<QString, Rating> RATING_MAP;
|
static const QMap<QString, Rating> RATING_MAP;
|
||||||
|
|
||||||
|
@ -193,18 +192,18 @@ namespace Danbooru {
|
||||||
/**
|
/**
|
||||||
* @return A pointer to the thumbnail's pixmap.
|
* @return A pointer to the thumbnail's pixmap.
|
||||||
**/
|
**/
|
||||||
const QPixmap pixmap() const;
|
QPixmap pixmap() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The current post's rating.
|
* @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.
|
* 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.
|
* @return A string representation of the post.
|
||||||
|
@ -213,7 +212,7 @@ namespace Danbooru {
|
||||||
const QString toString();
|
const QString toString();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_FLAGS(Ratings, DanbooruPost::Rating)
|
Q_DECLARE_FLAGS(Ratings, DanbooruPost::Rating)
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(Ratings)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(Ratings)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue