Made the download updater thread process requests from a queue.
Such a scheme paves the path to performing all download actions
asynchronously by placing them onto the queue (which will eliminate
non-responsiveness of the application when those commands hit the
problem with slow responses from aria2c).
If download info becomes stale (due to slow responses from aria)
the download speed is shown as ---.
Known issues:
- A stale download is refreshed only due to a GUI event (such
as scrolling or mouse hover).
The binary flag DownloadState::paused was replaced with a richer
DownloadState::status but the old logic of distinguishing only
between active and paused downloads still remains.
Before this fix when kiwix-desktop was launched with a paused download
inherited from a previous session, cancelling that download didn't
remove the download files (incomplete .zim and .zim.aria2 files) because
the path of a paused Aria2 download is not available until it is
resumed. Now the path of a book being downloaded is taken from the
library (thanks to the previous commit).
When a book is downloaded via a metalink URL the fake path (with a
".beingdownloadedbykiwix" suffix appended to it) recorded for it in
the library could not in general be used to obtain the real name (and,
hence, path) of the ZIM file. Now the book path is "corrected" as soon
as the file name becomes available.
One subtlety of this refactoring is that
ContentManager::downloadDisappeared() is now NOT called from
updateDownloads() directly/synchronously but is invoked via a signal
and is thus executed in the main thread.
A new class DownloadManager was introduced as a new home for
ContentManagerModel::Downloads, but it is going to grow into a more
serious unit of code that will consolidate most functionality
related to download management.
The change in #1048 prevented opening of blank tab and urls that are no longer valid. Now, we will need to open them as well, as we will need the exact number of tabs to reopen in order to correctly restore current tab index.
Clicking and hovering the description dropdown of zim no longer whites out. Replaced manual drawing with default handling as it is no longer necessary.