Use real url for icon in the contentManager instead of data url.

The update of book info are made somehow sync. (They are async, but
somehow, the view update hangout).

Getting the favicon content is pretty long and it seems that the view
(and getting remote content) take a long time.

By using a real url, QWebViewEngine handle everything nicely and it speed
up everything.
This commit is contained in:
Matthieu Gautier 2018-11-13 18:16:12 +01:00
parent a98ea49cac
commit 4cbf001de4
2 changed files with 4 additions and 2 deletions

View File

@ -20,7 +20,7 @@ function createDict(keys, values) {
}
return d;
}
const BOOK_KEYS = ["id", "name", "path", "url", "size", "description", "title", "tags", "date", "favicon", "faviconMimeType", "downloadId"];
const BOOK_KEYS = ["id", "name", "path", "url", "size", "description", "title", "tags", "date", "faviconUrl", "faviconMimeType", "downloadId"];
function addBook(values) {
var b = createDict(BOOK_KEYS, values);
if (b.downloadId && !downloadUpdaters.hasOwnProperty(b.id)) {
@ -189,7 +189,8 @@ button {
<details v-for="book in books" class="book">
<summary class="tablerow">
<span class="tablecell cell0">
<img v-bind:src="'data:image/png;base64,' + book.favicon"/>
<img v-if="book.faviconUrl" v-bind:src="'http://' + book.faviconUrl" />
<img v-else-if="book.faviconMimeType" v-bind:src="'zim://' + book.id + '.favicon.meta'" />
</span>
<span class="tablecell cell1">
{{ book.title }}

View File

@ -68,6 +68,7 @@ QStringList ContentManager::getBookInfos(QString id, const QStringList &keys)
ADD_V("origId", getOrigId);
ADD_V("faviconMimeType", getFaviconMimeType);
ADD_V("downloadId", getDownloadId);
ADD_V("faviconUrl", getFaviconUrl);
if (key == "favicon") {
auto s = b.getFavicon();
values.append(QByteArray::fromStdString(s).toBase64());