Commit Graph

216 Commits

Author SHA1 Message Date
Luis Ángel San Martín
f7717f0465 Bump version number 2023-07-16 14:59:40 +02:00
Luis Ángel San Martín
51a4dbf049 Remove deprecated property manga from folder and comic_info 2023-06-10 11:09:55 +02:00
Luis Ángel San Martín
5dac3e1402 Add setting to control dates comparison on updates 2023-06-07 22:41:31 +02:00
Luis Ángel San Martín
68ece533e1 Replace Q_OS_MAC with Q_OS_MACOS 2023-06-04 20:55:11 +02:00
Luis Ángel San Martín
315d2deced Don't use Q_OS_MAC for ui specifics, Y_MAC_UI is the replacement 2023-05-23 18:51:33 +02:00
Luis Ángel San Martín
45af72520b Add setting to control what "recent" is considered. 2023-05-20 17:43:38 +02:00
Luis Ángel San Martín
6a6a239cc7 Add the possibility to show a recently added/updated indicator 2023-05-20 16:17:40 +02:00
Luis Ángel San Martín
880e17acff Display new metadata in the info views 2023-05-16 21:47:59 +02:00
Luis Ángel San Martín
f2bf53ce5b Add new fields to the DB and make then available to be used in the apps 2023-05-12 16:59:23 +02:00
Luis Ángel San Martín
9b196a655a Remove obsolete setting that doesn't have any effect 2023-04-29 08:54:31 +02:00
Luis Ángel San Martín
8f738766ed BUMP version to 9.12 2023-04-23 19:51:48 +02:00
Luis Ángel San Martín
ad4139e017 Don't clear numPages when deleting metadata 2023-01-16 18:14:21 +01:00
Luis Ángel San Martín
49ef617757 Bump version number and what's new 2023-01-07 10:34:34 +01:00
Luis Ángel San Martín
7fed222cb7 Format 2022-12-12 21:53:07 +01:00
Felix Kauselmann
4a59dd6db6 Add support for poppler-qt6
Fixes #352
2022-11-19 20:02:31 +01:00
Felix Kauselmann
be85954b0c Use std::unique_ptr for pdf objects 2022-11-19 20:02:31 +01:00
Felix Kauselmann
0414104067 YACReader: Fix crash when exiting while processing a comic
When quitting YACReader while processing a comic, the comic thread needs
to be properly terminated to avoid segfaults and other possible problems.
2022-11-19 19:27:52 +01:00
Luis Ángel San Martín
3e2bda7cf1 Extract function 2022-10-29 11:07:10 +02:00
Luis Ángel San Martín
b364501a2c Do not use GUI code in non GUI components 2022-10-29 08:57:08 +02:00
Luis Ángel San Martín
150d27c3ad Make import ComicInfo.XML from new comics optional
It is disabled by default.
2022-10-28 23:31:55 +02:00
Luis Ángel San Martín
d22e5eaaa7 Add method to delete metadata from ComicInfo 2022-10-24 18:42:38 +02:00
Luis Ángel San Martín
4b58efc5c7 Use more generic signal 2022-10-23 15:49:27 +02:00
Luis Ángel San Martín
31c4ae6561 More left side bar png to svg assets conversion 2022-10-23 10:43:37 +02:00
Luis Ángel San Martín
c29eb79d88 Add helper function to create pixmaps from assets with the right resolution for hdpi screens 2022-10-22 16:25:42 +02:00
Luis Ángel San Martín
8f1c63fcf0 Move functions 2022-10-22 11:40:16 +02:00
Luis Ángel San Martín
67211154ec Bump version number and what's new 2022-10-15 12:58:52 +02:00
Luis Ángel San Martín
41767958d0 Add full constructor 2022-10-09 11:32:06 +02:00
Luis Ángel San Martín Rodríguez
f6dc6ac232 Bump version to 9.9.2 2022-10-01 08:35:13 +02:00
Luis Ángel San Martín Rodríguez
c31895018a Use points instead of pixels 2022-09-29 22:01:54 +02:00
Luis Ángel San Martín Rodríguez
450d3c18b2 Fix compile error on macos qt6 due to __OBJC_BOOL_IS_BOOL macro 2022-09-12 19:24:56 +02:00
Luis Ángel San Martín
68b3d75c92 BUMP version number 2022-09-04 22:43:57 +02:00
Luis Ángel San Martín
e92a537f95 Fix flow scrolling in macos 2022-09-04 10:05:11 +02:00
Luis Ángel San Martín
5163df977a Fix Folder::operator= 2022-08-31 18:25:36 +02:00
Luis Ángel San Martín
14a7148bfa Purge bookmarks if they get invalid 2022-05-28 12:37:27 +02:00
Luis Ángel San Martín
f70799502b Bump version number 2022-05-28 11:38:58 +02:00
Luis Ángel San Martín
4a59271ebd Initialize manga field to false in Folder 2022-04-13 19:13:58 +02:00
Igor Kushnir
f030a7fb0c Remove deprecated and always disabled alwaysOnTopAction 2022-01-15 18:02:30 +02:00
Luis Ángel San Martín
77c96de0ea Remove unused resources 2022-01-15 15:51:59 +01:00
Luis Ángel San Martín
565bc3a5d0 Replace all uses of devicePixelRatio with devicePixelRatioF 2022-01-14 19:22:50 +01:00
Luis Ángel San Martín
dcb7e6e0c6 Add settings to control the page turn behavior on scroll 2022-01-13 23:04:22 +01:00
Luis Ángel San Martín
d8f224645d Remove YACReader::SearchModifiers
They are no longer used
2021-12-29 14:58:03 +01:00
Igor Kushnir
05b384ed6d Make ConcurrentQueue::waitAll() const
This member function does not affect the logical state of the class.
Making std::condition_variable and std::mutex data members mutable is
idiomatic as these classes are thread-safe synchronization primitives.
2021-12-29 09:36:44 +01:00
Igor Kushnir
72c78d0164 ConcurrentQueue: remove redundant checks
The C++ standard specifies `std::condition_variable::wait(lock, pred)`
as equivalent to `while (!pred()) wait(lock);`. It is implemented
exactly so in libstdc++, libc++ and MSVC.
2021-12-29 09:36:44 +01:00
Igor Kushnir
4cb542c8cc Remove ConcurrentQueue::joinAll()
This function is called only from ~ConcurrentQueue(). joinAll() is not
thread-safe and it cannot be called earlier without introducing a null
state. Moving the function's implementation into the definition of
~ConcurrentQueue() makes the code clearer. Removing joinAll() also
allows to establish and document invariants for two data members.

Assert consistency between jobsLeft and _queue in ~ConcurrentQueue().
2021-12-29 09:36:44 +01:00
Igor Kushnir
61cd245037 Document ConcurrentQueue and de-inline its implementation
ConcurrentQueue is currently used only by two classes and a test, but
modifying concurrent_queue.h requires recompiling 30 source files. None
of the member functions is so lightweight as to make it worth inlining.

An alternative to `@note ConcurrentQueue is unable to execute jobs if
@p threadCount == 0.` is `assert(threadCount != 0);`. But this would
force classes that contain a ConcurrentQueue data member to always start
a thread, even if they detect at runtime that they are never going to
enqueue a job.

Add Job type alias to avoid repeating the type.

Use default member initializers instead of the member initializer list
to make it clear [to the reader of the header] that no data member is
left uninitialized.
2021-12-29 09:36:44 +01:00
Igor Kushnir
2655613543 ConcurrentQueue: simplify the constructor implementation
* threadCount argument: int => std::size_t to avoid implicit casting;
* eliminate temporary empty std::thread objects;
* replace a trivial lambda with a function pointer and its argument;
* get rid of the unused dedicated loop counter.
2021-12-29 09:36:44 +01:00
Igor Kushnir
d026050d49 ConcurrentQueue::jobsLeft: int => std::size_t
This data member's type can be unsigned because its value is never
negative now. Matching std::queue::size_type allows to improve type
safety, get rid of a static_cast and remove two assertions. The only
downside is a slight increase of sizeof(ConcurrentQueue).
2021-12-29 09:36:44 +01:00
Igor Kushnir
d8a6b7f432 ConcurrentQueue: std::move jobs
Moving a std::function can be faster than copying it. Correcting these
normally minor inefficiencies is important here because they occur under
a mutex lock.
2021-12-29 09:36:44 +01:00
Igor Kushnir
d869e1230b ConcurrentQueue::enqueue: increment jobsLeft before adding a job
ConcurrentQueueTest::randomCalls() built in Debug mode often crashes
when concurrent_queue_test.cpp is modified and ConcurrentQueueTest is
launched from Qt Creator so that the test is built and immediately run.
The crash is an assertion failure that occurs most of the time under
the described circumstances at different test data rows:
void YACReader::ConcurrentQueue::finalizeJobs(int): Assertion `jobsLeft >= count' failed.

The assertion fails because ConcurrentQueue::enqueue() adds a job into
the queue first and then increments jobsLeft. If the job is immediately
picked up and executed very fast, ConcurrentQueue::nextJob() can try to
finalize it before enqueue() increments jobsLeft.

Simply reordering the modifications of jobsLeft and _queue in enqueue()
ensures that jobsLeft is always non-negative and eliminates the
assertion failures. Note that ConcurrentQueue::finalizeJobs() is the
only other function that modifies (decreases) jobsLeft. finalizeJobs()
is always called *after* the queue's size is reduced. So the following
invariant is now maintained at all times and documented:
jobsLeft >= _queue.size().
2021-12-29 09:36:44 +01:00
Igor Kushnir
57eb8d0171 ConcurrentQueue::cancelPending: notify _waitVar
This allows to call cancelPending() and waitAll() concurrently with no
additional synchronization. While calling these two functions
concurrently may not be useful often, supporting it costs little in
terms of performance and code complexity. Furthermore, a completely
thread-safe class is easier to document and use correctly.

Optimize job finalization by notifying _waitVar only if jobsLeft is
reduced to 0.

Optimize cancelPending() by not locking jobsLeftMutex when no job is
canceled (if the queue is empty when this function is called).

Add assertions that verify invariants.

The output of ConcurrentQueueTest::randomCalls() reflects the fact that
a caller of waitAll() can be blocked indefinitely when another thread
cancels all queued jobs while no job is being executed. The test output
snippet below omits repetitive information: the
"QINFO  : ConcurrentQueueTest::randomCalls(queue{1}; 2 user thread(s))"
prefix of each line, current thread id and the common hh:mm:ss current
time part (leaving only the millisecond part). Note that thread #1
begins waiting at the 1st line of the snippet. "=> -8" means that total
equals -8 and thus ConcurrentQueue::jobsLeft equals 8. Thread #0 then
cancels all 8 queued jobs, then enqueues and cancels 3 jobs twice, then
momentarily waits 3 times. #1 is not waked until #0 enqueues 8 more jobs
and starts waiting for them too. Once these new 8 jobs are completed,
both #0 and #1 end waiting.

 1. [ms] 311 | #1 begin waiting for 1 thread => -8
 2. [ms] 311 | #0 enqueuing complete.
 3. [ms] 311 | #0 canceled 8 jobs => -8
 4. [ms] 311 | #0 enqueuing 3 jobs...
 5. [ms] 312 | #0 enqueuing complete.
 6. [ms] 312 | #0 canceled 3 jobs => -3
 7. [ms] 312 | #0 enqueuing 3 jobs...
 8. [ms] 312 | #0 enqueuing complete.
 9. [ms] 312 | #0 canceled 3 jobs => -3
10. [ms] 312 | #0 begin waiting for 1 thread => 0
11. [ms] 312 | #0 end waiting for 1 thread => 0
12. [ms] 312 | #0 begin waiting for 1 thread => 0
13. [ms] 312 | #0 end waiting for 1 thread => 0
14. [ms] 312 | #0 begin waiting for 1 thread => 0
15. [ms] 312 | #0 end waiting for 1 thread => 0
16. [ms] 312 | #0 canceled 0 jobs => 0
17. [ms] 312 | #0 canceled 0 jobs => 0
18. [ms] 312 | #0 enqueuing 3 jobs...
19. [ms] 312 | #0 enqueuing complete.
20. [ms] 312 | #0 enqueuing 3 jobs...
21. [ms] 312 | #0 enqueuing complete.
22. [ms] 312 | #0 enqueuing 2 jobs...
23. [ms] 312 | #0 enqueuing complete.
24. [ms] 312 | #0 begin waiting for 1 thread => -8
25. [ms] 312 | [0.1] sleep 0.003 ms...
26. [ms] 312 | [0.1] +1 => -7
27. [ms] 312 | [0.2] sleep 0.003 ms...
28. [ms] 312 | [0.2] +1 => -6
29. [ms] 312 | [0.3] sleep 0.003 ms...
30. [ms] 312 | [0.3] +1 => -5
31. [ms] 312 | [0.1] sleep 0 ms...
32. [ms] 313 | [0.1] +1 => -4
33. [ms] 313 | [0.2] sleep 0.005 ms...
34. [ms] 313 | [0.2] +1 => -3
35. [ms] 313 | [0.3] sleep 0 ms...
36. [ms] 313 | [0.3] +1 => -2
37. [ms] 313 | [0.1] sleep 0.001 ms...
38. [ms] 313 | [0.1] +1 => -1
39. [ms] 313 | [0.2] sleep 0.001 ms...
40. [ms] 313 | [0.2] +1 => 0
41. [ms] 313 | #0 end waiting for 1 thread => 0
42. [ms] 313 | #1 end waiting for 1 thread => 0
2021-12-29 09:36:44 +01:00