1181 Commits

Author SHA1 Message Date
Kelson
20f32d03b5
Merge pull request #1061 from ShaopengLin/Issue#967-fix-search-bar-shortcut
Fix #967: Search Bar Key Board Short Cut Performs the same as Mouse Click
2024-04-12 12:59:07 +02:00
ShaopengLin
366ab1d173 SearchBar shortcuts work now
Refactored shortcut to search bar and removed redundant code. Fix #967
2024-04-12 12:48:41 +02:00
Kelson
0b18cc6a32
Merge pull request #1081 from kiwix/kiwix_Downloader_close_may_throw
Handling of exceptions from kiwix::Downloader::close()
2024-04-12 12:48:18 +02:00
Veloman Yunkan
11cdeb9faa Handle exceptions from kiwix::Downloader::close() 2024-04-12 09:31:59 +02:00
Kelson
ccccc80dfe
Merge pull request #1080 from kiwix/fullscreen_keysequence_fix
Fixed the fullscreen keyboard shortcut
2024-04-12 09:27:40 +02:00
Veloman Yunkan
1ccfcadf2b Fixed the fullscreen keyboard shortcut
`Qt::Key_F11` and `QKeySequence::FullScreen` are of different enum types
(`Qt::Key` and `QKeySequence::StandardKey`, respectively) with
overlapping value ranges. Using a standard integral type (int, unsigned,
long, etc) as a common type for them results in the type information
being lost and an ensuing impossibility to take advantage of overloaded
constructors of `QKeySequence`. The simple fix is to use `QKeySequence`
as the common type of the conditional expression.
2024-04-12 09:26:47 +02:00
Kelson
b3b09c47ef
Merge pull request #1064 from sgourdas/feature/fullscreen_scrollbar
Fixed dragging of scrollbar in fullscreen
2024-04-12 09:23:14 +02:00
sgourdas
9639a3f777 Always return false on MainWindow eventFilter 2024-04-12 09:15:22 +02:00
Kelson
2f364ebd89
Merge pull request #1077 from sgourdas/feature/order_headers
Properly order headers
2024-04-12 09:14:09 +02:00
sgourdas
c8f731d015 Properly order header includes 2024-04-12 09:07:40 +02:00
Matthieu Gautier
ae2f4d6cde
Merge pull request #1082 from kiwix/fix_ci_deps 2024-04-11 17:44:09 +02:00
Matthieu Gautier
611fc67e28 Use new name for target_platform in CI 2024-04-11 17:38:24 +02:00
Veloman Yunkan
7f2a0491c6
Merge pull request #1075 from vinurk/fix/reset-view-findinpage
Don't reset the webview on exiting search-in-page
2024-04-08 18:48:29 +04:00
vinurk
aa884b3b3a fixed view reset on findinpage close 2024-04-08 14:57:24 +02:00
Kelson
4c5128415a
Merge pull request #1066 from sgourdas/feature/bookmark_qol
Changing boomark icon to star and adding tooltip
2024-04-07 21:10:05 +02:00
sgourdas
e61ca4b8b4 Fixed bookmark icon size and reversed display 2024-04-07 20:35:06 +02:00
sgourdas
7d94c06810 Changed the icon of bookmarking action to a star
Also:

- Added tooltip for add/remove on reading list
2024-04-07 20:35:06 +02:00
Kelson
7e2012d00d
Merge pull request #1071 from sgourdas/feature/nostrip
Added nostrip to CONFIG to avoid illegal binary strips on WSL
2024-04-07 20:34:41 +02:00
sgourdas
54a3f2596c Use CONFIG nostrip on WSL due to illegal strips 2024-04-07 20:23:58 +02:00
Kelson
9ea2199f31
Merge pull request #1056 from kiwix/translatewiki
Localisation updates from https://translatewiki.net.
2024-04-06 10:21:53 +02:00
translatewiki.net
d3afe4a2f0 Localisation updates from https://translatewiki.net. 2024-04-06 10:21:18 +02:00
Kelson
2794699ece
Merge pull request #1038 from kiwix/download_management_refactoring
Download management fixes and improvements
2024-04-06 10:15:49 +02:00
Veloman Yunkan
54881f7b7b Incomplete downloads are restored on startup
Downloads that were active during the application shutdown automatically
resume.

Known issues:

- For paused downloads the progress information is lost (but is recovered
  when the download is resumed).
2024-04-05 12:22:16 +04:00
Veloman Yunkan
550604b442 Download paused state in UI set by updater thread
Now the downloader paused/active state in UI is set by the updater
thread. This will make it easier to restore downloads after closing
and re-opening kiwix-desktop.
2024-04-05 12:22:16 +04:00
Veloman Yunkan
840ca4c2c3 Re-enabled monitoring of the download directory
New ZIM files discovered in monitored directories are not added to the
library if they are known to be in the process of being downloaded by
kiwix-desktop. That information is recorded in the library as follows.

When a download is started the book is added to the local library with a
fake path that has a special suffix (".beingdownloadedbykiwix") appended
to the path of the ZIM file (previously, a book for which a download
was initiated had only its download id set and the path was added only
upon completion of the download).

Note that the expected path of the ZIM file is derived from the download
directory and the URL rather than obtained via
`kiwix::Download::getPath()` since the latter seems to return an empty
string until the download is actually started (it may stay queued if the
count of active downloads exceeds the queue size), the file is created
and `kiwix::Download::updateStatus()` is called after that which is too
late for our purposes (we want the information about a new download
to appear in the library before directory monitoring detects creation
of the file).

Known issues:

- If kiwix-desktop is closed while a download is still in progress
  (either active or paused) then after reopening the app the information
  about the download state is not shown in the UI and attempting to
  download that file fails. However this problem is present before this
  commit too (though in a slightly different way).
2024-04-05 12:22:16 +04:00
Veloman Yunkan
b141677810 Safer ContentManager::reallyCancelBook()
Before this change `ContentManager::reallyCancelBook()` could throw (and
thus result in a crash) if the confirmation to cancel the download was
timed to perform the actual download cancellation on a completed
download. This change fixes that problem. Besides it also fixes a subtle
issue where `ContentManager::reallyCancelBook()` is called on a
completed download and has the effect of removing the downloaded book
from the local library. I considered preserving that dubious behaviour,
but it couldn't be achieved in a simple and consistent fashion (because
of the two ways an actually completed download can be seen by the
`ContentManager::reallyCancelBook()` function).
2024-04-05 12:22:16 +04:00
Veloman Yunkan
fa418a6aa0 Safer ContentManager::pauseBook() 2024-04-05 12:22:16 +04:00
Veloman Yunkan
52b568d89a Thread-safe ContentManagerModel::Downloads 2024-04-05 12:22:16 +04:00
Veloman Yunkan
c042532a8c ContentManagerModel::Downloads became a class
... only one small step away from being thread-safe
2024-04-05 12:22:16 +04:00
Veloman Yunkan
728a8a44bb Reduced the in-use API of ContentManagerModel::Downloads
... in preparation for converting `ContentManagerModel::Downloads` into
a thread-safe class.
2024-04-05 12:22:16 +04:00
Veloman Yunkan
de296ed548 ContentManager::getDownloadInfo() may throw
The failure of `ContentManager::getDownloadInfo()` is now reported via
an exception instead of a special return value.
2024-04-05 12:22:16 +04:00
Veloman Yunkan
5340bc4b01 ContentManager::updateDownloads() runs in a separate thread 2024-04-05 12:22:16 +04:00
Veloman Yunkan
b6a86918ff ContentManager::updateDownload() became a slot 2024-04-05 12:22:16 +04:00
Veloman Yunkan
32e3c743f7 Preparing to make updateDownload() a slot
... that can be called from a worker thread.
2024-04-05 12:22:16 +04:00
Veloman Yunkan
a1a298af58 Safety measure in eraseBookFilesFromComputer()
My experience is that `kiwix::Download::getPath()` may return an empty
string (at least for a fresh download object and probably before Aria2
actually starts downloading and creates the target file). Passing such
an empty string into `eraseBookFilesFromComputer()` might have
disastrous consequences. Now that function should be safer.
2024-04-05 12:21:12 +04:00
Veloman Yunkan
ef6d7661de Better ContentManager::eraseBookFilesFromComputer()
Note that this change drops the protection against accidentally removing all
files in a book's directory. The risk of a such a destructive operation
is still present if an invalid path is passed into
`eraseBookFilesFromComputer()` but that will be addressed in a separate
commit.
2024-04-05 12:16:08 +04:00
Veloman Yunkan
8969d9ade3 ContentManagerModel::triggerDataUpdateAt() 2024-04-05 12:16:08 +04:00
Veloman Yunkan
c8bd038a89 Got rid of two unused public slots
... by inlining them into the used ones
2024-04-05 12:16:08 +04:00
Veloman Yunkan
8073593384 Dropped an unused parameter 2024-04-05 12:16:08 +04:00
Veloman Yunkan
c6d892a15f De-overloaded ContentManager::cancelBook()
Renamed one of the two overloads of ContentManager::cancelBook() to
reallyCancelBook().
2024-04-05 12:16:08 +04:00
Veloman Yunkan
595973b3bb Enforced ContentManager::removeDownload()'s monopoly
Eliminated an instance of download removal handling where the conceptual
actions of ContentManager::removeDownload() were performed without
calling the latter.
2024-04-05 12:16:08 +04:00
Veloman Yunkan
3c6c155545 Got rid of ContentManagerModel::m_data
Also got rid of `ContentManagerModel::setupNodes()` by expanding it
into `ContentManagerModel::setBooksData()`.
2024-04-05 12:14:53 +04:00
Veloman Yunkan
057f0ba01e A more correct ContentManagerModel::rowCount()
It looks like the previous version of `ContentManagerModel::rowCount()`
was implemented before the expandable description of books was introduced.
Likely, it kept working without leading to observable bugs only due to some
foolproofness in Qt.
2024-04-05 12:14:04 +04:00
Veloman Yunkan
90603190fe Dropped ContentManagerModel::m_downloads
ContentManagerModel is explicitly given access to the list of active downloads
during calls to ContentManagerModel::setBooksData(). This limits by
design the time when the list of downloads can be accessed and
facilitates making it thread-safe.
2024-04-05 11:51:09 +04:00
Veloman Yunkan
ef1b36fd28 Dropped ContentManagerModel::fetchMore() and friends
Since `ContentManagerModel::fetchMore()` doesn't perform any actual
incremental loading of the data, it no longer makes any sense.
2024-04-05 11:50:30 +04:00
Veloman Yunkan
af67a44147 A small simplification 2024-04-05 11:50:06 +04:00
Veloman Yunkan
139613b8a8 Got rid of ContentManagerModel::refreshIcons()
Now book thumbnails are loaded lazily, triggered by the first attempt to
access them.

`ContentManagerModel::refreshIcons()` seems to exist for that reason
(lazy loading of thumbnails) as it was called from
`ContentManagerModel::fetchMore()` however the latter seems to load data
more eagerly than the new implementation.
2024-04-05 11:49:37 +04:00
Veloman Yunkan
6a1fc8a78e ContentManager::refreshIcons() works off RowNode data
This enables the following changes (to be done next):

1. move the thumbnail download initiation into the data access operation.
2. get rid of ContentManagerModel::refreshIcons()
3. get rid of ContentManagerModel::m_data
2024-04-05 11:45:14 +04:00
Veloman Yunkan
f68ae6d2f8 Thumbnail field of RowNode can be data or url
Now the 0'th field of ContentManagerModel's row representation (which is
used for the book thumbnail) can hold either the favicon image data or its
url (before it held only the image data).
2024-04-05 11:44:57 +04:00
Veloman Yunkan
4af4923faa Got rid of faviconUrl in ContentManager::BookInfo
Merged "faviconUrl" entry of `ContentManager::BookInfo` into "favicon".
Now the latter represents either the illustration data (and then it is
of QByteArray type) or the url (in which case it is a QString).
2024-04-05 11:37:46 +04:00