1407 Commits

Author SHA1 Message Date
Veloman Yunkan
354a4d1f8a Directory monitoring works via file names instead of paths
- ContentManager::m_knownZimFiles[dirPath] now stores filenames (rather
  than full paths) of known ZIM files in directory at dirPath.

- Library::getLibraryZimsFromDir() returns a set of file names (rather
  than paths)

Note that the change of the semantics of ContentManager::m_knownZimFiles
has been carried out via the change in the value of the second argument
of ContentManager::setMonitorDirZims():

1. In KiwixApp::setupDirectoryMonitoring() the latter is fed with the
   output of (the now changed) Library::getLibraryZimsFromDir()

2. In ContentManager::updateLibraryFromDir() all variables representing
   a set of files now contain filenames only (note that
   ContentManager::handleNewZimFiles() returns just a subset of its second
   parameter) and therefore produce a set of filenames.
2024-09-07 07:37:21 +00:00
Veloman Yunkan
743400fa1a Problematic ZIM files keep being monitored
Before this change, once a ZIM file was detected in a monitored
directory it could slip into the known ZIM file list even if it was
a partially downloaded ZIM file that failed to be added to the library.
This happens when another valid/healthy ZIM file is added to the
monitored directory or a known ZIM file is removed from it (the bad
ZIM file is included in the update triggered by the other ZIM file).

Now ZIM files that failed to be added to the library are NOT inserted
in the list of known ZIM files and thus will be reevaluated for every
change in the monitored directory. Thus a file being downloaded by an
external tool will eventually be successfully added to the library
(since updates to the file should trigger an update to the directory due
to the changed modification time of the file).

This however may result in excessive CPU usage in the following
scenario. Suppose that there are a number of partially downloaded files.
Only one of them is being downloaded, while the others are paused. Every
time the next chunk of data is written to that active file, directory
monitoring will try to add *all of* those partial ZIM files.

There are two optimizations against such waste of CPU cycles:

1. Only try to add those files that had their modification
   time changed since the previous attempt.

2. Debounce the updates (react to updates, for example, at most once per
   second).

Those optimizations will come next.
2024-09-07 07:37:21 +00:00
Veloman Yunkan
fc7570a49c Renamed a few vars in ContentManager::updateLibraryFromDir() 2024-09-07 07:37:21 +00:00
Veloman Yunkan
d5d5987fc1 ContentManager::handleNewZimFiles() 2024-09-07 07:37:21 +00:00
Veloman Yunkan
af18f5826c fixup! ContentManager::handleDisappearedZimFiles() 2024-09-07 07:37:21 +00:00
Veloman Yunkan
c912fe9d34 ContentManager::handleDisappearedZimFiles() 2024-09-07 07:37:21 +00:00
Veloman Yunkan
40f00901e1 More debugging info from directory monitoring 2024-09-07 07:37:21 +00:00
Veloman Yunkan
1ea6ffd20a fixup! Introduced DBGOUT() 2024-09-07 07:37:21 +00:00
Veloman Yunkan
b30cbd9c0b Introduced DBGOUT()
Converted commented out debugging statements to calls of the new
DBGOUT() macro.
2024-09-07 07:37:21 +00:00
Kelson
6fee1ebabc
Merge pull request #1191 from kiwix/Issue#972-category-translation-porting
Remove old version category session data on startup
2024-09-03 11:21:08 +00:00
ShaopengLin
e2ca5d63c2 Remove old version category session data on startup
Saved category pairs seperated by '|' is from old version
2024-09-03 11:20:51 +00:00
Kelson
84b72e5aff
Merge pull request #1192 from kiwix/require-libkiwix-14
Requires libkiwix14+
2024-09-02 09:32:51 +00:00
Emmanuel Engelhart
67ba3d059d
Requires libkiwix14+ 2024-09-01 16:07:09 +02:00
Kelson
2af64e2c4f
Merge pull request #1188 from kiwix/issue1148
Pre-download check for largest supported file size
2024-08-30 11:58:24 +00:00
Veloman Yunkan
49c668d57c Pre-download check for largest supported file size 2024-08-30 11:51:16 +00:00
Kelson
1eb926cfd2
Merge pull request #1175 from kiwix/Issue#972-translate-categories
Implemented Category Translation
2024-08-30 11:47:48 +00:00
ShaopengLin
5f1feebf54 Removed Category i18n 2024-08-30 11:32:57 +00:00
ShaopengLin
cb701b8f86 Add Category Translation
Translations come from libkiwix
2024-08-30 11:32:57 +00:00
ShaopengLin
ebe3112e6a Session stores Category Keys
Storing filter pairs is redundant.
2024-08-30 11:32:57 +00:00
ShaopengLin
617609eee4 Make public KiwixChoiceBox typedef
Public interfaces uses this typedef.
2024-08-30 11:32:57 +00:00
ShaopengLin
f973041ac8 Fix Inconsistent ChoiceBox parsing
setSelection parses two SelectionList differently
2024-08-30 11:32:57 +00:00
Kelson
0c7b60c80c
Merge pull request #1134 from kiwix/Issue#77-implement-save-page
Implemented Save  Page
2024-08-30 11:02:47 +00:00
ShaopengLin
7fcd6b5256 Added Save Page to context menu 2024-08-30 10:41:24 +00:00
ShaopengLin
fc029c7fe3 Sanitizes file name suggestion
Convert reserved chars to '_' before parsing
2024-08-30 10:41:24 +00:00
ShaopengLin
3988067dde Save As remember previous save path
Document folder is default.
2024-08-30 10:41:24 +00:00
ShaopengLin
6ff4dff484 Add support to save page
Page saved as either pdf or file based on content
2024-08-30 10:41:24 +00:00
ShaopengLin
8877214d2b Enhance urlschemehandler archive entry retrieval
Retrieval function now includes parsing of path. Prepares future change.
2024-08-30 10:41:24 +00:00
Kelson
063b27b2a1
Merge pull request #1190 from kiwix/fix-win-ci-dependency
Use fix Windows CI image
2024-08-30 07:41:07 +00:00
Emmanuel Engelhart
43b93636bd
Use fix Windows CI image 2024-08-30 09:33:46 +02:00
Matthieu Gautier
02c7d77025
Merge pull request #1184 from kiwix/fix_static_linking
[CI] Compile on Windows
2024-08-22 22:04:37 +02:00
Matthieu Gautier
76d5e4c336 Use last version of github actions 2024-08-22 15:08:07 +02:00
Matthieu Gautier
87c7449262 [CI] Build kiwix-desktop on Windows 2024-08-22 15:08:07 +02:00
Matthieu Gautier
55b058d10e Fix static linking on Windows
On Windows, static libraries are using "foo.lib" naming.
On Unix, they are in the form of "libfoo.a"
On Windows, "foo.lib" can also the definition of symbols in a foo.dll.
So you can link to "foo.lib", whatever you are doing static or dynamic linking and you are good.
However, meson is always creating static library as "libfoo.a"
'to avoid a potential name clash with shared libraries which also generate import libraries with a lib suffix.' [1]
On top of that, qmake is replacing all `-lfoo` in LIBS by `foo.lib` (on Windows).
So at the end, we try to link with `foo.lib` but we have `libfoo.a`
Solution could be :
- Rename `libfoo.a` to `foo.lib`, but it would mean modify deps libraries on the FS
- Don't use LIBS and directly set QMAKE_LFLAGS but we would have to handle different command line option format
  between g++/clang and msvc
- Update meson build system of each projet to explicitly set the library naming.
- Replace `-lfoo` with absolute path to static library. This is what meson is doing internally and what
  we are doing here

Any `-lfoo` is replace with absolute path to static library (`libfoo.a`) if we found one.
Else, it is keep unchanged.

[1] https://mesonbuild.com/Reference-manual_functions.html#library_name_suffix
2024-08-22 10:53:33 +02:00
Kelson
57dc50f25a
Merge pull request #1169 from kiwix/feature/data-directory
Migrate getDataDirectory from libkiwix to kiwix-desktop
2024-08-21 23:51:10 +02:00
sgourdas
9f4d229da6 Migrate getDataDirectory from libkiwix 2024-08-21 23:50:53 +02:00
Matthieu Gautier
61f460261a
Merge pull request #1183 from kiwix/fix_msg_box_lib 2024-08-21 11:07:51 +02:00
Matthieu Gautier
adb948756b Link with User32 library on Windows 2024-08-21 10:40:48 +02:00
Kelson
2306ddc1ee
Merge pull request #1174 from kiwix/handling_of_invalid_zim_files
Handling of invalid ZIM files
2024-08-19 16:00:03 +02:00
Veloman Yunkan
26d3891fa1 Code deduplication in error page generation 2024-08-19 17:26:05 +04:00
Veloman Yunkan
9d6705f580 Set encoding of error pages to UTF-8 2024-08-19 17:26:05 +04:00
Veloman Yunkan
3875a97df2 Consistent capitalization of "ZIM" in i18n files 2024-08-19 17:25:55 +04:00
Veloman Yunkan
920b34a9fd Handling of invalid ZIM files
When trying to display resources from an invalid ZIM file that fail to
be retrieved due to problems with the ZIM data, now an HTML error
page is returned instead. Note that the resource being accessed
may in fact be an image, a CSS or a javascript file and the user may not see
the error (though the appearance of the webpage trying to load and use
that resource will be affected to various degrees).
2024-08-19 17:21:13 +04:00
Matthieu Gautier
4b939e4097
Merge pull request #1182 from kiwix/fix_msg_box 2024-08-19 14:40:42 +02:00
Matthieu Gautier
1854bbabea Fix variable names. 2024-08-19 13:41:24 +02:00
Matthieu Gautier
250c2ce8c6
Merge pull request #1180 from kiwix/feature/disable-sandbox 2024-08-19 11:43:54 +02:00
sgourdas
ce6cf305c0 Implement popup box for sandbox disable 2024-08-19 12:17:47 +03:00
Kelson
89298378fd
Merge pull request #1178 from kiwix/feature/disable-sandbox
Option to disable sandbox on Windows network drive
2024-08-16 04:45:03 +00:00
sgourdas
26f610c830 Option to disable sandbox on Windows network drive 2024-08-16 00:04:07 +03:00
Matthieu Gautier
32f0ee581e
Merge pull request #1176 from kiwix/fix_drive_variable 2024-08-15 13:57:19 +02:00
Matthieu Gautier
14d07e300e Remove debug printing of the drive letter.
On top of this, it was a typo: `driverLetter` doesn't exist.
2024-08-15 10:55:13 +02:00