mirror of https://github.com/kiwix/libkiwix.git
Enter Book::getIllustrations()
This commit is contained in:
parent
e2544799a1
commit
eb6a0d6456
|
@ -59,6 +59,8 @@ class Book
|
||||||
mutable std::string data;
|
mutable std::string data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef std::vector<std::shared_ptr<const Illustration>> Illustrations;
|
||||||
|
|
||||||
public: // functions
|
public: // functions
|
||||||
Book();
|
Book();
|
||||||
~Book();
|
~Book();
|
||||||
|
@ -95,6 +97,8 @@ class Book
|
||||||
const std::string& getFaviconUrl() const;
|
const std::string& getFaviconUrl() const;
|
||||||
const std::string& getFaviconMimeType() const;
|
const std::string& getFaviconMimeType() const;
|
||||||
|
|
||||||
|
Illustrations getIllustrations() const;
|
||||||
|
|
||||||
const std::string& getDownloadId() const { return m_downloadId; }
|
const std::string& getDownloadId() const { return m_downloadId; }
|
||||||
|
|
||||||
void setReadOnly(bool readOnly) { m_readOnly = readOnly; }
|
void setReadOnly(bool readOnly) { m_readOnly = readOnly; }
|
||||||
|
@ -142,7 +146,7 @@ class Book
|
||||||
uint64_t m_mediaCount = 0;
|
uint64_t m_mediaCount = 0;
|
||||||
bool m_readOnly = false;
|
bool m_readOnly = false;
|
||||||
uint64_t m_size = 0;
|
uint64_t m_size = 0;
|
||||||
std::vector<std::shared_ptr<const Illustration>> m_illustrations;
|
Illustrations m_illustrations;
|
||||||
|
|
||||||
// Used as the return value of getDefaultIllustration() when no default
|
// Used as the return value of getDefaultIllustration() when no default
|
||||||
// illustration is found in the book
|
// illustration is found in the book
|
||||||
|
|
|
@ -47,6 +47,11 @@ Book::~Book()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Book::Illustrations Book::getIllustrations() const
|
||||||
|
{
|
||||||
|
return m_illustrations;
|
||||||
|
}
|
||||||
|
|
||||||
bool Book::update(const kiwix::Book& other)
|
bool Book::update(const kiwix::Book& other)
|
||||||
{
|
{
|
||||||
if (m_readOnly)
|
if (m_readOnly)
|
||||||
|
|
|
@ -58,10 +58,10 @@ IllustrationInfo getBookIllustrationInfo(const Book& book)
|
||||||
{
|
{
|
||||||
kainjow::mustache::list illustrations;
|
kainjow::mustache::list illustrations;
|
||||||
if ( book.isPathValid() ) {
|
if ( book.isPathValid() ) {
|
||||||
for ( auto illustration_size : zim::Archive(book.getPath()).getIllustrationSizes() ) {
|
for ( const auto& illustration : book.getIllustrations() ) {
|
||||||
illustrations.push_back(kainjow::mustache::object{
|
illustrations.push_back(kainjow::mustache::object{
|
||||||
{"icon_width", to_string(illustration_size)},
|
{"icon_width", to_string(illustration->width)},
|
||||||
{"icon_height", to_string(illustration_size)},
|
{"icon_height", to_string(illustration->height)},
|
||||||
{"icon_scale", "1"},
|
{"icon_scale", "1"},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue