1331 Commits

Author SHA1 Message Date
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
Veloman Yunkan
99609644d0 Fixed the bug with closing of non-current tab 2024-03-20 19:38:47 +04:00
Veloman Yunkan
4c831f0228 TabBar::setCloseTabButton()
Deduplicated the code responsible for setting up the tab closing button.
2024-03-20 19:38:47 +04:00
Veloman Yunkan
bbceea3d5e KiwixApp::newTab()
It's more natural for the handling of the NewTabAction action to be
set up in `KiwixApp` rather than in `TabBar`.
2024-03-20 19:38:47 +04:00
Veloman Yunkan
837619cb55 TabBar::setNewTabButton() receives the action explicitly 2024-03-20 19:38:47 +04:00
Veloman Yunkan
9aa8cb4286 Made the function name match its semantics 2024-03-20 19:38:47 +04:00
Veloman Yunkan
486fc41ce1 Replaced if statements with conditional expression
Also raised a question in a rewritten comment
2024-03-20 19:38:47 +04:00
Veloman Yunkan
dcc41e2bc2 More concise handling of switch-to-tab#N shortcuts
Obtaining the value of the ALT+[0-9] shortcut from the action objects
would be justified if they were connected to the same (shared) handler.
But since handlers are distinct lambda objects the sought value can be
obtained via a captured variable.
2024-03-20 19:38:47 +04:00
Veloman Yunkan
b39597b501 Extracted TabBar::openOrSwitchToSettingsTab() 2024-03-20 19:38:47 +04:00
Veloman Yunkan
caa6195caa Tidied up TabBar::closeTabsByZimId() 2024-03-20 19:38:47 +04:00
Veloman Yunkan
f62fc3b626 Fully fool-proof TabBar::closeTab()
Made `TabBar::closeTab()` responsible for all the checks so that none of
them have to be performed before calling that function.
2024-03-20 19:38:47 +04:00
Veloman Yunkan
94d95b68ca Closing a tab doesn't change the current tab
Before this change, after a tab was closed its adjacent tab (the next
one or, in the absence of such, the previous one) became active, no
matter which tab was active before that. Now that logic applies only
if the currently active tab is closed.

The function responsible for that logic was removed because its name
was not a good one and its existence was not justified given that it
could be replaced by a oneliner and that it was used only once.
2024-03-12 15:28:47 +04:00
Veloman Yunkan
fb43b4338f Made middle-clicking the library tab a no-op
Before this change, an attempt to close the library tab via a
middle-click - although prevented by a dedicated check - had a
side-effect of switching to the tab next to the library tab.
2024-03-12 14:58:14 +04:00
Veloman Yunkan
693b7b1ea5
Merge pull request #1040 from kiwix/translatewiki
Localisation updates from https://translatewiki.net.
2024-03-09 16:12:28 +04:00
translatewiki.net
ff7e47c843 Localisation updates from https://translatewiki.net. 2024-03-09 16:06:43 +04:00
Matthieu Gautier
bd0f896644
Merge pull request #1049 from kiwix/refactoring 2024-03-08 15:48:19 +01:00
Veloman Yunkan
cb3bc65fcc Simpler ContentManager::getDownloadInfo()
Got rid of unneeded flexibility in ContentManager::getDownloadInfo()
2024-03-07 20:38:47 +04:00
Veloman Yunkan
95290bdf0b Less checks of download functionality availability
The only justified check for the availability of download functionality
is in the initiation of the download action
(`ContentManager::downloadBook()`) - if no download is started then
(assuming otherwise correct code) it should be impossible to pause,
resume or cancel one.
2024-03-07 20:38:47 +04:00
Veloman Yunkan
aa8e4c9650 Extracted getFaviconUrl() & getBookAttribute()
One small difference of getFaviconUrl() from the piece of code it was
created from is that, in case the book doesn't contain an illustration,
an empty string is returned directly rather than via a confusing
default-constructed Illustration object.
2024-03-07 20:38:47 +04:00
Veloman Yunkan
a197a6a907 Extracted getBookTags() 2024-03-07 20:38:47 +04:00
Veloman Yunkan
a0d4ed573d Removed faviconMimeType from ContentManager::getBookInfos()
"faviconMimeType" is not used anywhere but is responsible for some of the
too much clutter in ContentManager::getBookInfos().
2024-03-07 20:38:47 +04:00
Veloman Yunkan
98f4064c26 More readable access to the settings manager 2024-03-07 20:38:47 +04:00
Veloman Yunkan
d196ceb063 Fixed indirect accesses to the library object 2024-03-07 20:38:47 +04:00
Veloman Yunkan
622f9a0ff8 Extracted ContentManagerModel::getThumbnail() 2024-03-07 20:38:47 +04:00
Veloman Yunkan
32f839b192 Renamed ContentManagerModel::{iconMap -> m_iconMap}
... and stopped passing it (as the second parameter) into
ContentManagerModel::createNode().
2024-03-07 19:50:39 +04:00
Matthieu Gautier
75ecdeb03e
Merge pull request #1045 from kiwix/refactoring 2024-03-07 13:56:07 +01:00
Kelson
6c0325456e
Merge pull request #1046 from adamlamar/prepare-qt6
Initial Qt6 support
2024-03-04 08:20:28 +01:00
Adam Lamar
e543bbc446 Clean up print duplication and conditional compilation 2024-03-03 18:57:13 +00:00
Adam Lamar
d842a288f7 Initial Qt6 support 2024-03-01 22:12:06 +00:00
Veloman Yunkan
5d28f8a332 Changed the parameter type 2024-03-01 20:39:43 +04:00
Veloman Yunkan
b434833edc Dropped an obsolete return value 2024-03-01 20:39:43 +04:00
Veloman Yunkan
e0f79bf9f2 More elegant ContentManager::updateDownload() 2024-03-01 20:39:43 +04:00
Veloman Yunkan
defe52a246 ContentManager::removeDownload() 2024-03-01 20:39:43 +04:00
Veloman Yunkan
4153765b7b ContentManagerModel only reads from m_downloads 2024-03-01 20:39:43 +04:00
Veloman Yunkan
6f781a8e0e Got rid of ContentManager::updateDownloadInfo()
... by inlining it into ContentManager::updateDownload()
2024-03-01 20:39:43 +04:00