mirror of
https://github.com/kiwix/kiwix-desktop.git
synced 2025-09-24 04:32:15 -04:00
Fixed thumbnail display for books being downloaded
This commit is contained in:
parent
423f3e8d02
commit
e12715e6c4
@ -394,18 +394,25 @@ QVariant getBookAttribute(const kiwix::Book& b, const QString& a)
|
|||||||
|
|
||||||
ContentManager::BookInfo ContentManager::getBookInfos(QString id, const QStringList &keys)
|
ContentManager::BookInfo ContentManager::getBookInfos(QString id, const QStringList &keys)
|
||||||
{
|
{
|
||||||
BookInfo values;
|
const kiwix::Book* b = nullptr;
|
||||||
const kiwix::Book* b = [=]()->const kiwix::Book* {
|
try {
|
||||||
try {
|
b = &mp_library->getBookById(id);
|
||||||
return &mp_library->getBookById(id);
|
if ( ! b->getDownloadId().empty() ) {
|
||||||
} catch (...) {
|
// The book is still being downloaded and has been entered into the
|
||||||
try {
|
// local library for technical reasons only. Get the book info from
|
||||||
QMutexLocker locker(&remoteLibraryLocker);
|
// the remote library.
|
||||||
return &mp_remoteLibrary->getBookById(id.toStdString());
|
b = nullptr;
|
||||||
} catch(...) { return nullptr; }
|
|
||||||
}
|
}
|
||||||
}();
|
} catch (...) {}
|
||||||
|
|
||||||
|
if ( !b ) {
|
||||||
|
try {
|
||||||
|
QMutexLocker locker(&remoteLibraryLocker);
|
||||||
|
b = &mp_remoteLibrary->getBookById(id.toStdString());
|
||||||
|
} catch(...) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
BookInfo values;
|
||||||
for(auto& key: keys){
|
for(auto& key: keys){
|
||||||
values.insert(key, b ? getBookAttribute(*b, key) : "");
|
values.insert(key, b ? getBookAttribute(*b, key) : "");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user