1321 Commits

Author SHA1 Message Date
sgourdas
ca3f730963 Make app_icon.ico correctly scalable 2024-07-27 21:57:25 +03:00
Kelson
3a7c9c5d0d
Merge pull request #1138 from kiwix/feature/home-button
Added home button
2024-07-23 15:37:29 +02:00
sgourdas
76bb8228ee openHomePage code to standalone function 2024-07-23 15:37:14 +02:00
sgourdas
a7c19105f9 random.svg style alignment 2024-07-23 15:37:14 +02:00
sgourdas
c959fd0ccf Home button toolbar addition 2024-07-23 15:37:14 +02:00
sgourdas
1969fac0a4 code cleanup with auxiliary local variables 2024-07-23 15:37:14 +02:00
Kelson
68a7f4be8b
Merge pull request #1139 from kiwix/feature/monitor-dir-copy
Settings monitor path QOL improvements
2024-07-19 13:15:33 +02:00
sgourdas
84874cddc6 code tidying 2024-07-19 13:15:00 +02:00
sgourdas
1f7795112b Monitor path setting QOL improvements 2024-07-19 13:15:00 +02:00
Kelson
3ee2537baf
Merge pull request #1118 from kiwix/robust_download_management
Asynchronous execution of download actions
2024-07-19 11:33:52 +02:00
Veloman Yunkan
2a1d53f0b0 Safer ContentManager::downloadDisappeared() 2024-07-19 07:12:43 +02:00
Veloman Yunkan
8e4e394f99 Encapsulated kiwix::Downloader in DownloadManager 2024-07-19 07:12:43 +02:00
Veloman Yunkan
373b0140a2 Taking advantage of kiwix/libkiwix#1097 2024-07-19 07:12:43 +02:00
Veloman Yunkan
b5b089f9a6 2-stage asynchronous starting of a download 2024-07-19 07:12:43 +02:00
Veloman Yunkan
07d8aff798 Enter DownloadManager::error() signal
Preparing to handle errors originating in the (future) asynchronous
execution of `ContentManager::startDownload()`.
2024-07-19 07:12:43 +02:00
Veloman Yunkan
426f13a915 Extracted ContentManager::startDownload()
Extracted from ContentManager::downloadBook() the part that should be
executed asynchronously into a new function
`ContentManager::startDownload()`.
2024-07-19 07:12:43 +02:00
Veloman Yunkan
e00f023599 DownloadManager::checkThatBookCanBeDownloaded()
Separated checks that can be performed early (independent of aria2c
services). When the download initiation is converted to a 2-stage
procedure (similar to how it was done for pausing/resuming/cancelling
a download) those checks better be performed synchronously in the main
thread.
2024-07-19 07:12:43 +02:00
Veloman Yunkan
b753a47fbc Got rid of a ContentManager::downloadBook() overload 2024-07-19 07:12:43 +02:00
Veloman Yunkan
d0a8f2519b 2-stage asynchronous cancelling of downloads 2024-07-19 07:12:43 +02:00
Veloman Yunkan
262428e637 Slow download updates don't erase pending actions
... provided that download actions are inserted into the queue *before* existing
update requests.
2024-07-19 07:12:43 +02:00
Veloman Yunkan
3c04e055bf Download user actions have priority over updates 2024-07-19 07:12:43 +02:00
Veloman Yunkan
462fe8e9b4 Fixed indentation
During the previous commit indentation of some lines was preserved
in order to minimize the diff. Now it is fixed.
2024-07-19 07:12:43 +02:00
Veloman Yunkan
0235d0bafa 2-stage pausing/resuming of downloads
Pausing a download now changes its state to PAUSE_REQUESTED and the
pause request is enqueued for asynchronous execution. Similarly,
resuming a download changes its state to RESUME_REQUESTED and the resume
request is enqueued for asynchronous execution.

In the PAUSE_REQUESTED and RESUME_REQUESTED states download actions
are disabled.

Known issues:
 - The PAUSE_REQUESTED state may be incorrectly restored to DOWNLOADING
   if at the time of pausing an earlier UPDATE request for the same
   download preceded it in the queue or was being executed. After
   the response to the said UPDATE request is received it results
   in the DownloadState being reset to the previous state. But after
   the pause request is processed a subsequent UPDATE request will
   change the state to PAUSED. In GUI this looks as follows (assuming
   slow responses from aria2c, allowing to observe the events in slow
   motion):

   1. Pause button is pressed
   2. Pause button and download progress info (the textual one) disappear
   3. Pause button and download progress info (the textual one) re-appear
   4. Download switches to paused state without any further user actions

   A similar problem exists for resuming the download.

   The solution is to convert the request queue to a priority queue
   where download actions are given precedence over update actions.
   However this will not eliminate the problem completely since a
   pause/resume action may be issued while an update request is being
   processed by aria2c (the likelyhood of which greatly increases if
   aria is mostly stuck struggling with slow storage). The latter
   case will be addressed by tracking the timestamps of the requests
   and ignoring the download status from those update requests that
   were issued before the user action requests.
2024-07-19 07:12:43 +02:00
Veloman Yunkan
ce2fbbf7fc Made DownloadState::status private 2024-07-19 07:12:43 +02:00
Veloman Yunkan
cbdb4b0404 Async execution of download pause/resume actions 2024-07-19 07:12:43 +02:00
Veloman Yunkan
9defd359a6 Download updater thread works via a queue
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).
2024-07-19 07:12:43 +02:00
Veloman Yunkan
03c45e814b DownloadManager::updateDownload(bookId) 2024-07-19 07:12:43 +02:00
Veloman Yunkan
abd3ed5225 ContentManagerView is updated once per second 2024-07-19 07:12:43 +02:00
Veloman Yunkan
018d913955 Tracking of update time in DownloadState
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).
2024-07-19 07:12:43 +02:00
Veloman Yunkan
e86324d242 Enter DownloadState::Status
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.
2024-07-19 07:12:43 +02:00
Veloman Yunkan
e42a83dae6 Simplified checking of the click location 2024-07-19 07:12:43 +02:00
Veloman Yunkan
17f3692669 Moved error detection to DownloadManager 2024-07-19 07:12:43 +02:00
Veloman Yunkan
cdd5353859 ContentManagerError -> KiwixAppError
Also introduced `showErrorBox()`
2024-07-19 07:12:43 +02:00
Veloman Yunkan
c7295fbc05 Moved code across ContentManager::downloadBook() overloads 2024-07-19 07:12:43 +02:00
Veloman Yunkan
b43607a919 Got rid of ContentManager::downloadStarted() 2024-07-19 07:12:43 +02:00
Veloman Yunkan
4f6b0f1bab ContentManagerModel::{removeDownload -> setDownloadState}() 2024-07-19 07:12:43 +02:00
Veloman Yunkan
a7fb85b8b0 Got rid of unjustified code 2024-07-19 07:12:43 +02:00
Veloman Yunkan
04a6d6c05a Moved the check for availability of downloading functionality 2024-07-19 07:12:43 +02:00
Veloman Yunkan
f8a140404e Got rid of ContentManager::startDownload() 2024-07-19 07:12:43 +02:00
Veloman Yunkan
6bbbe7dafc Made DownloadManager::mp_downloader private 2024-07-19 07:12:43 +02:00
Veloman Yunkan
fffe7586b4 Moved DownloadManager code across .cpp files 2024-07-19 07:12:43 +02:00
Veloman Yunkan
8fbb867270 DownloadManager::startDownloadUpdaterThread()
Moved the download updater thread from ContentManager to
DownloadManager.
2024-07-19 07:12:43 +02:00
Veloman Yunkan
e5f4a4b55f Made DownloadManager::m_downloads private 2024-07-19 07:12:43 +02:00
Veloman Yunkan
efddb36fef Made DownloadManager::Downloads private 2024-07-19 07:12:43 +02:00
Veloman Yunkan
e6c2effa0f DownloadManager::getDownloadState() 2024-07-19 07:12:43 +02:00
Veloman Yunkan
be017b7e2c DownloadManager::removeDownload() 2024-07-19 07:12:43 +02:00
Veloman Yunkan
88eb29f791 DownloadManager::cancelDownload() 2024-07-19 07:12:43 +02:00
Veloman Yunkan
28c52e7884 Fixed cancellation of a paused download after app restart
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).
2024-07-19 07:12:43 +02:00
Veloman Yunkan
77ee3a2936 Library maintains "correct" paths of books being downloaded
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.
2024-07-19 07:12:43 +02:00
Veloman Yunkan
b5e3c30d46 DownloadManager::startDownload() 2024-07-19 07:12:43 +02:00