1315 Commits

Author SHA1 Message Date
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
Veloman Yunkan
cf0f408f23 Changed how thumbnails of local books are obtained
Before this change, thumbnails of local books were obtained by
`ContentManagerModel` (via ugly calls to
`KiwixApp::instance()->getLibrary()`). Now that task is
transferred to `ContentManager::updateModel()` - the thumbnail data, if
available, is loaded by `ContentManager::getBookInfos()` and passed to
`ContentManagerModel::setBooksData()` through a new entry `favicon`.
2024-04-05 11:36:00 +04:00
Veloman Yunkan
14d3c8ff04 ContentManager::updateModel()
`ContentManager::getBooksList()` was replaced by
`ContentManager::updateModel()` (which combines the now removed
`ContentManager::getBooksList()` and `ContentManagerModel::setBooksData()`
into a single operation).

Notes:

- The call to `ContentManagerModel::refreshIcons()` could not be
  included in `ContentManager::updateModel()`. A few attempts to do
  so failed for various reasons, but the outcome of those efforts is
  that a better design for thumbnail loading was identified which
  enables dropping the `ContentManagerModel::refreshIcons()` operation.
  That redesign is pursued in the next few commits.
2024-04-05 11:04:03 +04:00
Veloman Yunkan
6c095adf8a ContentManager::download{Cancelled->Disappeared}()
Renamed `ContentManager::downloadCancelled()` to `downloadDisappeared()`
since the situation handled by that function is unrelated to cancelling
a download (in which case it should still be available with a status of
"removed").
2024-04-05 11:04:03 +04:00
Veloman Yunkan
a0d3f5a7b3 !!! Disabled monitoring of the download dir
Monitoring of the download dir interferes with the download lifecycle
management. Here are some of the observed effects:

- As soon as the ZIM file is created in the download directory it
  is added to the library and overwrites the entry created by download
  management logic, thus resetting the download id associated with the book.

- As a result `ContentManager::downloadCompleted()` is never called;
  `ContentManager::downloadCancelled()` is called instead (however, for
  some reason the user-observable effect is as if the download completion
  is normally detected and handled). Looks like this was the main
  culprit behind the false bug report kiwix/libkiwix#1049.

- The icon of the book added a time when the file was not yet a valid
  ZIM file stays invalid.

I am temporarily disabling this functionality so that the work on
download related code is carried out in a clean room environment.
Once it's complete monitoring of the download directory must be
re-enabled but in a way that doesn't confuse the logic of the
download state machine.
2024-04-05 11:04:03 +04:00
Kelson
eb640cbc84
Merge pull request #1051 from kiwix/warnings
Fix warnings and enable Werror
2024-04-04 08:44:59 +02:00
Adam Lamar
fc67c0d76c Fix warnings and enable Werror 2024-04-01 15:46:59 +00:00
Kelson
0205db459d
Merge pull request #1048 from ShaopengLin/Issue#186-remember-tabs-opened
Fix #186: Introduced Tab Restoration on Restart
2024-03-30 10:51:59 +01:00
ShaopengLin
01a66988a0 Add CheckBox in Settings for Tab Reopen Behavior
Added a checkbox in settings where user can define if they want the tab reopening feature to be active. Fix #186
2024-03-30 10:47:13 +01:00
ShaopengLin
3235bdaa84 Add Auto Reopening of Tabs from Previous Session
Users can now restore tabs opened before close in the same order and same url. Fix #186
2024-03-30 10:47:13 +01:00
Kelson
398a4fcbe3
Merge pull request #1068 from sgourdas/feature/fullscreen_shortcut
On undefined fullscreen key sequence, hardcode to F11
2024-03-22 10:23:38 +01:00
Dimitris Sgourdas
95de67c39f
Update code based on code review 2024-03-22 11:05:17 +02:00
sgourdas
da228058b9 Added a condition to check if the fullscreen key sequence is undefined and in that case hardcode it with F11 2024-03-21 19:13:37 +02:00
Matthieu Gautier
d4aacc4827
Merge pull request #1065 from sgourdas/feature/result_count 2024-03-21 10:00:54 +01:00
sgourdas
a01ab015f9 Fixing part of issue #988. Results were never shown in fulltext search. Instead a "No results were found ..." message was shown. 2024-03-21 09:44:31 +01:00
Matthieu Gautier
0a6fd10da2
Merge pull request #1057 from kiwix/tab_closing 2024-03-20 17:48:49 +01:00
Veloman Yunkan
1daefccfbd Restored the tooltip of the tab closing button
Notes:

- The `getAction()` helper function was introduced in order to keep the
  line length within the 80 chars limit and was applied to other usages
  of `KiwixApp::getAction()` too.

- The tooltip includes the keyboard shortcut which closes only the
  current tab but the tooltip is the same for all the tabs.
2024-03-20 19:38:47 +04:00