The commit "Moved download deregistration to ContentManager" introduced
a bug - completed downloads were not properly deregistered.
Note that a simpler fix by adding a single `m_downloads.remove(bookId);`
line in `ContentManager::downloadCompleted()` didn't work (which means
that that function is not always called upon download completion). I am
not going to investigate that issue now, hoping that it will be
automatically resolved once the redesign of download management is
finished.
Now there is a single timer in ContentManager shared by all pending downloads.
Temporarily, all active downloads are updated on every firing of the
timer and this happens in the main thread. This will be changed later.
The main objective of this change is to get rid of the timer in
DownloadState so that it can be converted to a dumb struct set by
ContentManager.
In theory, a book recorded in a local library may have only its url defined
(and no path to a ZIM file). Such a book qualifies as downloadable too.
That's why the call to `ContentManager::getRemoteOrLocalBook()` (which
may return a "local" book) perfectly makes sense in
`ContentManager::downloadBook()`.
However, it doesn't then make sense to raise an error if the returned
book turns out to be a "local" one. It would be more logical to request
only for a remote book and report an error if that operation fails.
ContentManagerModel depends on the current view settings (filters) much
more than ContentManager does. Since the download state (the set of
active and/or paused downloads and their progress info) is independent
of the view settings it is more natural for ContentManager to own it.
Since the content manager model may be updated (e.g. by applying a
filter) while the thumbnails/favicons are still being loaded it is
better to use a model invariant id for the thumbnails.
When using a debug server (enabled by the environment variables
KIWIX_CATALOG_HOST and KIWIX_CATALOG_PORT) the URLs of the favicons
must be composed correspondingly.