Book::Illustration got dimensions

This commit is contained in:
Veloman Yunkan 2021-10-31 17:02:42 +04:00
parent 5263f6880c
commit f4bc3c8ced
2 changed files with 8 additions and 2 deletions

View File

@ -48,6 +48,8 @@ class Book
{ {
friend class Book; friend class Book;
public: public:
uint16_t width = 48;
uint16_t height = 48;
std::string mimeType; std::string mimeType;
std::string url; std::string url;

View File

@ -226,8 +226,12 @@ void Book::setPath(const std::string& path)
const Book::Illustration& Book::getDefaultIllustration() const const Book::Illustration& Book::getDefaultIllustration() const
{ {
assert(m_illustrations.size() == 1); for ( const auto& ilPtr : m_illustrations ) {
return *m_illustrations.front(); if (ilPtr->width == 48 && ilPtr->height == 48) {
return *ilPtr;
}
}
throw std::runtime_error("No default illustration");
} }
Book::Illustration& Book::getMutableDefaultIllustration() Book::Illustration& Book::getMutableDefaultIllustration()