Commit Graph

685 Commits

Author SHA1 Message Date
Luis Ángel San Martín
e799513fb4 Reset the grid current index when the grid content changes
`model` object doesn't really change so we can't use `onModelChanged` in QML to reset the index.
2021-05-16 08:57:18 +02:00
Ruoh-Shoei LIN
dbe1da58dc Update Simplified Chinese GUI translation for YACReader &
YACReaderLibrary
2021-05-09 11:55:52 +02:00
Luis Ángel San Martín
c3a99b19a5 Fix library creation on 9.8.0 by adding missing manga field to folder 2021-05-08 15:21:30 +02:00
Luis Ángel San Martín
5f3824ff3c Fix order when getting next/previous remote comics
This sorting matches what the remote browser uses.
2021-04-30 09:53:35 +02:00
Luis Ángel San Martín
b8ad99fcaa Exract struct to reuse it 2021-04-30 09:52:31 +02:00
Luis Ángel San Martín
811c3fcfe4 Add function to get comics from a folder properly sorted 2021-04-30 09:52:10 +02:00
Luis Ángel San Martín
b447226bc1 Avoid indexes out of range when processing v1 updated session data 2021-04-10 09:51:14 +02:00
Luis Ángel San Martín
58a74a0c03
Merge pull request #216 from vedgy/update-toolbar-title-on-history-navigation
Library: update toolbar title on history navigation
2021-03-14 16:28:33 +01:00
Luis Ángel San Martín
84c43e456e
Merge pull request #209 from vedgy/add-focus-shortcuts
Add focus shortcuts
2021-03-13 17:09:46 +01:00
Luis Ángel San Martín
06814d066a
Merge pull request #200 from vedgy/rename-processor-class-typo
Fix a typo in ComicQueryResultProcessor class name
2021-03-13 15:54:22 +01:00
Igor Kushnir
288b9cbec6 ComicsView's derived classes: use explicit, nullptr, override 2021-03-13 15:33:38 +02:00
Igor Kushnir
fc57378a85 Remove unused sizeHint() from GridComicsView and ComicsViewTransition
QWidget::sizeHint() is const-qualified, so Clang warns that non-const
sizeHint() member functions merely hide the virtual function of the base
class.

664dac3401 and
9f53ae6efc introduced these member
functions in 2014 without const qualifiers. QWidget::sizeHint() was
const-qualified even in Qt 3. Since these member functions have never
had any effect, they should be removed rather than const-qualified to
preserve the long-standing behaviors of the two classes.

Add a TODO for a similar but less straightforward issue with
PropertiesDialog::sizeHint().
2021-03-13 15:33:34 +02:00
Igor Kushnir
8a54100804 Library: allow configuring a shortcut to focus comics view
Focusing the current comics view allows to use keyboard arrow keys to
choose among the visible comics.

The shortcut for this new action should not be a single character
without modifiers because it won't work when the search line has focus.

The Qt::FocusReason parameter in ComicsView::focusComicsNavigation()
allows to reuse this function for other keyboard navigation features.
For instance the search line can transfer focus to comics navigation
when the user presses Return or Enter key. In this case
Qt::OtherFocusReason can be used (an application-specific reason).
2021-03-13 15:08:33 +02:00
Igor Kushnir
81e40dabec Library: add a shortcut to focus search line
The Ctrl+F shortcut gives focus to a search bar in many applications.
In this case it allows to search the library without touching a mouse.

YACReaderMacOSXSearchLineEdit::setFocus() will have to be implemented to
make the shortcut work on macOS.
2021-03-13 14:59:29 +02:00
Luis Ángel San Martín
6ab5a83e01
Merge pull request #231 from vedgy/remove-unused-variable
PageController*::service: remove unused libraryName variable
2021-03-13 12:16:05 +01:00
Felix Kauselmann
97377cdcf4 Eliminate qsort, use std::sort 2021-03-13 10:46:43 +01:00
Igor Kushnir
f60e17674e Server controllers: remove unused libraryName variable 2021-03-13 10:16:27 +02:00
Igor Kushnir
b87be81037 Deprecated QSortFilterProxyModel::clear() => invalidate() 2021-03-09 21:32:23 +01:00
Igor Kushnir
8af4c01a03 Port away from deprecated QFlags(Zero) constructor
This change gets rid of a few GCC's -Wdeprecated-declarations warnings.
2021-03-09 21:32:23 +01:00
Igor Kushnir
4dcbb958dc Eliminate QStringList <=> QList<QString> conversions
The conversions prevented return value optimization and caused a
-Wreturn-std-move Clang warning.
2021-03-09 21:32:23 +01:00
Igor Kushnir
3c9ed6ef8f Deprecated qSort => std::sort
This change gets rid of some GCC's -Wdeprecated-declarations warnings.
2021-03-09 21:32:23 +01:00
Igor Kushnir
70287994dd Remove duplicate resource image alias 2021-03-09 21:32:23 +01:00
Felix Kauselmann
81b4d25b5c Remove unneeded QtOpenGL dependency
Qt OpenGL in Qt5 is a deprecated module that is discouraged for
new code usage. We have been including this module in our builds
despite not relying on its functionality for a long time now -
probably an oversight from porting to the newer functions.

Time to remove it.

IMPORTANT INFORMATION: In Qt6, a lot of functionality that was
provided by Qt GUI was moved into the 'new' Qt6 Qt OpenGL module.
Thus, even if it makes perfectly sense to remove it for Qt5 builds
we will likely have to restore it for Qt6 builds at a later time.
2021-03-09 18:26:01 +01:00
Felix Kauselmann
92be3addda Sync and update translation files
In the past, translation files provided by the community
mostly came as pregenerated .qm files missing the corresponding
.ts sources. This has led to a situation where the translations
are out of sync with the sources and the sources have not been
updated for several release iterations.

To improve the situation, this commit syncs all .qm files back to
the sources by using the lconvert tool to create .ts files and
updating these files against our sources using lupdate.

For future updates, a CI solution would be preferable.
2021-03-09 18:22:52 +01:00
Felix Kauselmann
a315021a22 Update qmake files 2021-03-09 18:22:52 +01:00
Luis Ángel San Martín
890f9846b3 Support HTML content in the synopsis within the current comic banner 2021-03-07 08:55:51 +01:00
Luis Ángel San Martín
49ad387908
Merge pull request #228 from YACReader/feature/make_comic_vine_dialog_more_keyboard_friendly
Feature: make comic vine dialog more keyboard friendly
2021-03-06 22:33:02 +01:00
Igor Kushnir
3fcf31d936 Enable/disable comics actions after updating search results
Before this commit starting a search when an empty folder or an empty
reading list was selected left all comics actions disabled. Fixes #213.

When search mode is exited, we always call either
YACReaderNavigationController::loadFolderInfo() or
YACReaderNavigationController::loadListInfo(). Both of them call
LibraryWindow::disableComicsActions(), so the enabled/disabled state of
the comics actions stays up-to-date at all times.
2021-03-06 21:01:20 +01:00
Igor Kushnir
c4333915c9 Library: don't leak DB model objects at exit
Currently these objects are created once at program startup and are
never destroyed. Printing debug messages in the models' destructors
confirms the leaks and proves that with this fix the objects are
destroyed at Library exit.
2021-03-06 21:00:31 +01:00
Igor Kushnir
5fd5ff5b64 DB model classes: use explicit, nullptr, override 2021-03-06 21:00:31 +01:00
Luis Ángel San Martín
c5de729635 Set the default button based on the current context 2021-03-06 18:07:29 +01:00
Luis Ángel San Martín
5303e247b7 Always use toggleSkipButton 2021-03-06 18:06:05 +01:00
Luis Ángel San Martín
f98ce43465 Add a shortcut to going back 2021-03-06 18:03:04 +01:00
Luis Ángel San Martín
5459ff78cf Disable close button as the default when pressing enter
It can be triggered using ESC
2021-03-06 18:02:41 +01:00
Luis Ángel San Martín
0f6b203d34 Embrace HTML coming from Comic Vine 2021-03-06 09:05:35 +01:00
Luis Ángel San Martín
51a9c72d05 Replace QtScript with QJson*
QtScript is deprecated and this was needed to start supporting Qt6
2021-02-27 12:02:57 +01:00
Igor Kushnir
6f182b2bb3 Extract CONFIG += c++11 into common config.pri 2021-02-18 19:49:43 +01:00
Igor Kushnir
0f372a001e Library: update toolbar title on history navigation
When Back or Forward action was triggered, the toolbar title was not
updated to match the reselected entry.

I am calling LibraryWindow::setToolbarTitle() from
selectedIndexFromHistory() rather than loadIndexFromHistory(), because
the latter is also called from
YACReaderNavigationController::loadPreviousStatus(), which in turn is
called only from LibraryWindow::setSearchFilter() when the search line
text becomes empty. The toolbar title is already correct and does not
have to be updated in this case.

My code analysis and experiments have revealed that YACReader code never
creates YACReaderLibrarySourceContainer objects of type None. This type
could be removed altogether along with YACReaderLibrarySourceContainer's
default constructor, but for Q_DECLARE_METATYPE macro's requirement. So
YACReaderNavigationController::loadIndexFromHistory() now simply prints
an error message instead of introducing a failure condition by returning
false when the type is None.
2021-02-14 19:07:37 +02:00
Luis Ángel San Martín
b55c442590 Add missing import
It fixes compilation with some compilers
2021-02-08 08:38:15 +01:00
Igor Kushnir
aa9dd95d5d LibraryWindow: remove a duplicate signal-slot connection
QSqlDatabase::commit() in ComicModel::finishTransaction() returned false
(failed) when this slot was invoked the second time in a row.
2021-02-07 20:16:20 +02:00
Igor Kushnir
5257dc88d6 Library: destroy the temporary thread when deleting finishes
finished() signal of both FoldersRemover and ComicsRemover was not
connected to their QThread's quit() slot. So the thread kept running
after the deletion completed. The QThread's parent is LibraryWindow.
Thus LibraryWindow's ~QObject() invokes the QThread's destructor.

As a result, when the user exited YACReader Library after deleting at
least one folder or comic, it printed the following FATAL message and
crashed at exit: "QThread: Destroyed while thread is still running".

Extract signal-slot connections between a remover and a QThread into
moveAndConnectRemoverToThread() to reduce code duplication.

Remove always true (thread != NULL) checks.
2021-02-07 19:46:15 +02:00
Igor Kushnir
5656c3f540 Make ComicQueryResultProcessor::modelData() static
The function doesn't use data members or other member functions. It
could even be put into an unnamed namespace in the cpp file, but that
would require more changes and complicate turning it back into a member
function if need be in the future.
2021-02-06 20:08:47 +02:00
Igor Kushnir
12c2ff027a ComicQueryResultProcessor: fix a typo in the class name 2021-02-06 20:08:44 +02:00
Igor Kushnir
3a9bec55f8 Library: don't print errors when search edit's text changes
This was a temporary debug output. Not useful anymore.
2021-02-05 09:34:13 +01:00
Luis Ángel San Martín
6d5f3d7de3 Use the query search queue in FolderQueryResultProcessor 2021-02-04 19:15:58 +01:00
Igor Kushnir
64d0e22fb5 Library: don't leak folderQueryResultProcessor at exit
FolderQueryResultProcessor has a ConcurrentQueue data member. The leak
meant that the thread was not joined before exit.
2021-02-04 17:58:33 +02:00
Igor Kushnir
f88af80379 Library: fix InfoComicsView crashes
InfoComicsView constructor is the only function that connects to
FlowView's currentCoverChanged signal. Neither of the slots connected to
this signal handles the argument value index==-1. So when FlowView emits
this signal with index==-1, YACReaderLibrary crashes. Returning early
from either ComicsView::updateInfoForIndex() or
InfoComicsView::setCurrentIndex() when index==-1 is not sufficient - the
crash happens in the other slot then. Let us skip emitting the signal in
FlowView if index==-1 rather than return early from both slots.

Steps to reproduce 1:
1. Launch YACReaderLibrary version that matches the version of the
default library database. Alternatively, select a compatible library
after starting the application.
2. If InfoComicsView is not active, switch to it.
3. (optional) Switch to another comics view out of InfoComicsView.
4. Quit YACReaderLibrary. The application crashes during exit - after
the "YACReaderLibrary closed with exit code : 0" message is printed.

Steps to reproduce 2:
1. Launch a YACReaderLibrary version newer than the version of the
default library database.
2. Click the "No" button in the "Update needed" dialog that pops up.
3. Change between comics views until InfoComicsView becomes active. If
this view was active at the beginning, switch through all the views to
get back to it. At this point YACReaderLibrary crashes.
2021-02-01 11:27:18 +02:00
Luis Ángel San Martín
f4b2b3d8e3 Update comments 2021-01-28 19:56:35 +01:00
Luis Ángel San Martín
d96d01d963 Fix launch sequence to avoid http port collisions 2021-01-25 15:48:15 +01:00
Luis Ángel San Martín
74840f9914 Enable SVG explicitly 2021-01-22 10:48:13 +01:00
Luis Ángel San Martín
58fdf0af23 Add what's new dialog 2021-01-21 21:39:22 +01:00
Luis Ángel San Martín
3f6c44ce7a Fix SQL update query for setting manga in all the comics in a folder 2021-01-17 14:05:14 +01:00
Luis Ángel San Martín
20c772797b Fix typo 2021-01-16 18:59:53 +01:00
Luis Ángel San Martín
6461a4014e Add actions for setting folders as manga/normal 2021-01-16 18:31:48 +01:00
Luis Ángel San Martín
d402999991 Set all new imported comics and folders as manga if the parent folder is manga 2021-01-16 18:31:13 +01:00
Luis Ángel San Martín
60de69635b Get/set new manga field from/to the db 2021-01-16 18:30:25 +01:00
Luis Ángel San Martín
f7fa4adbd0 Add manga field to folders too
This way we can tell the app that a folder contains mangas so the user doesn't have to constantly set comics as manga when new issues are added. And it should be easier to set all the content in a folder as manga from the folder tree.
2021-01-16 18:29:22 +01:00
Luis Ángel San Martín
9643274b39 Enable manga in the search engine 2021-01-16 14:26:37 +01:00
Luis Ángel San Martín
bc82078ec9 Add new manga field to the edit comic dialog 2021-01-16 14:26:07 +01:00
Luis Ángel San Martín
97c7723b17 Add support for setting issues as manga/normal in the comics view 2021-01-16 14:25:47 +01:00
Luis Ángel San Martín
52953633e5 Send manga field through the server 2021-01-16 14:24:14 +01:00
Luis Ángel San Martín
3ab05c6777 Add a new boolean field for tagging comics as manga 2021-01-16 14:23:59 +01:00
Luis Ángel San Martín
76a307d0d8 Remove comments 2021-01-14 19:11:25 +01:00
Luis Ángel San Martín
6bb64c5467 Import non-gui global header 2021-01-14 18:42:51 +01:00
Luis Ángel San Martín
24c0a783de Remove reference to lexertl's license 2021-01-14 18:42:21 +01:00
Luis Ángel San Martín
82eb5c0a8b Add fallback for qt < 5.15 2021-01-14 15:51:20 +01:00
Luis Ángel San Martín
f03ad848cb Add support for true and false literals to be used with bool fields
The lexer itself should be responsible for parsing those values but it will require a bigger refactoring.
2021-01-14 15:32:20 +01:00
Luis Ángel San Martín
f803b54f2e Add support for boolean folder fields 2021-01-14 12:25:24 +01:00
Luis Ángel San Martín
dde60b78ea YACReaderLibrary compiles using c++11 just fine
It is probably worth to bump this to c++14 and ideally use c++17, but it will be done in a separate branch.
2021-01-14 11:38:45 +01:00
Luis Ángel San Martín
5343d24f26 Run folder search filtering in the background
It uses the same approach used by the comics search filter
2021-01-14 11:37:17 +01:00
Luis Ángel San Martín
ccc382df7d Use ComicQueryResultProcesor 2021-01-14 09:17:18 +01:00
Luis Ángel San Martín
dbdc7bd965 Add a class for processing search queries and create the comics model data 2021-01-14 09:10:58 +01:00
Luis Ángel San Martín
fa5ce25425 Add concurrent queue based on lambdas 2021-01-14 09:03:17 +01:00
Luis Ángel San Martín
7b36100458 Use QString::fromStdString
Just to keep things consistent in the whole round trip conversion
2021-01-14 08:51:08 +01:00
Luis Ángel San Martín
260f538de3 Use an explicit constructor for TreeNode
List initialization ended using movable constructors which surprisingly caused data troubles in release mode, at least in VC2019 compiler. The tree being messed up caused crashes while SQL was generated.

I have no explanation for it.
2021-01-14 08:49:48 +01:00
Luis Ángel San Martín
f09c5955d8 Remove space and atWord tokens
`atWord` wasn't used at all and spaces should be eaten by the lexer

And added `unspecified` token
2021-01-14 08:39:16 +01:00
Luis Ángel San Martín
ddb140d430 Remove misplaced code 2021-01-12 18:57:25 +01:00
Luis Ángel San Martín
a777aa3fe8 Replace lexertl with a custom lexeter implementation
QueryLexeter does not parse "atWord" because I couldn't find what it is used for.
2021-01-12 18:56:59 +01:00
Luis Ángel San Martín
5037f3ac92 Fix data base removal in FolderModel 2021-01-12 18:41:57 +01:00
Luis Ángel San Martín
6438c9210f Move query execution and model setup to the right scope 2021-01-12 18:41:09 +01:00
Luis Ángel San Martín
255e51da86 Fix binding values to search query
This was broken while doing a rebase
2021-01-08 16:59:17 +01:00
Iain Benson
8efb9912ee Use concatenation, rather than ostringstream 2021-01-08 15:56:16 +01:00
Luis Ángel San Martín
4990093e3d Remove c++17 dependency 2021-01-08 15:56:16 +01:00
Luis Ángel San Martín
2d3888b4b4 Fix scopes 2021-01-08 15:56:13 +01:00
Luis Ángel San Martín
7ccb338455 Apply clang-format 2021-01-08 15:51:59 +01:00
Iain Benson
9a660350d2 Add some documentation and attribution to the query parser 2021-01-08 15:51:59 +01:00
Iain Benson
30529dca43 Some small tidy ups 2021-01-08 15:51:56 +01:00
Iain Benson
673ee1f067 Use the query parser in the comic and folder model 2021-01-08 15:41:29 +01:00
Iain Benson
5fa7da1e46 Add folder into the query parser 2021-01-08 15:41:29 +01:00
Iain Benson
4a50d438d0 Add query parser class 2021-01-08 15:41:28 +01:00
Iain Benson
d3de52ca82 Add commit 43aab01 of BenHanson/lexertl14 from github 2021-01-08 15:41:28 +01:00
Felix Kauselmann
c4f792bd40 Fix port settings
When setting ports, temporary or for good, we need to go via the config
files and not QTcpServer or we get undefined behavior. To support temp
ports, we need to back up the fixed port in the settings.
2020-12-11 12:33:05 +01:00
Luis Ángel San Martín
e79ea56d32 Fix format 2020-12-05 14:49:54 +01:00
Heimen Stoffels
ccf1e4cb56 Updated Dutch translation 2020-10-01 11:56:35 +02:00
Igor Kushnir
04140bef0b Remove an unnecessary indirection in ComicFlow
The timer pointer forced error-prone manual memory management without
any benefits.
2020-08-31 15:45:12 +02:00
Igor Kushnir
cb7c967252 Add WorkerThread class and use it in ComicFlow
In a later commit WorkerThread should also replace classes similar to
ImageLoader: PageLoader, ImageLoaderGL and ImageLoaderByteArrayGL.

Bugs fixed:
  1. Eliminated a data race between ImageLoader::run() and
ComicFlow::updateImageData()->ImageLoader::result(). Specifically when
ImageLoader::busy() returns false, then ImageLoader::run() sets
ImageLoader::working to true, loads the image and starts assigning it to
ImageLoader::img, while ImageLoader::result() is accessed without
locking from updateImageData().
Making ImageLoader::working atomic is clearly insufficient to eliminate
this data race. The fix is to set 'working' to true immediately and
synchronously as soon as a new task is assigned to the worker.
  2. Replaced thread termination with graceful thread exit. ComicFlow
destructor called QThread::terminate(), using which is discouraged by Qt
documentation. The application exited without errors in Release mode.
In Debug mode, however, it received the SIG32 signal on exit and printed
the following warning - "QWaitCondition: mutex destroy failure:
Device or resource busy".
The loop in WorkerThread::run() is no longer endless. The worker thread
properly ends and is joined in WorkerThread destructor.

Design decisions:
 1. WorkerThread could emit a signal when it completes a task.
Thus updateTimer could be removed from ComicFlow and GoToFlow. However,
there is no obvious way to use this new signal in the two GL classes.
Also I don't know whether updateTimer is just an inefficient polling
substitute for notification or an intentional animation mechanism.
 2. The index variable is no longer stored in the worker class, but in
ComicFlow directly. Thing is, this data member was never actually
accessed by the worker, but ComicFlow went so far as to lock worker's
mutex to "protect" access to the index.
 3. The common ImageLoader implementation turned out to be very general.
So I converted it into the WorkerThread class template that is not
restricted to producing QImage results and can be reused elsewhere.
 4. I used standard classes (such as std::thread) instead of their Qt
equivalents (e.g. QThread) because they are more thoroughly documented.
The standard classes should also be more efficient as they were more
carefully designed and provide much fewer unnecessary features.
 5. Release-Acquire ordering is safe for the WorkerThread::working
use case and is more efficient than the std::atomic-default
Sequentially-consistent ordering.
 6. condition.notify_one() is called while the mutex is unlocked
to improve performance. This is safe in both cases:
  a) if the worker thread exits due to a spurious wakeup just before
the condition.notify_one() call in WorkerThread destructor, so much the
better;
  b) if a spurious wakeup lets the worker thread finish the task and
start waiting on the condition again just before the
condition.notify_one() call in WorkerThread::performTask(), the second
waking will be ignored by the worker thread as 'working' and 'abort'
will be false then.
2020-08-31 15:45:12 +02:00
Felix Kauselmann
4a654c38c0 Headless server: Add support for setting a port from commandline
Manual editing of a config file for setting a port is not ideal.
Solution: add a set-port command to save a port and also a
--port option to allow setting a temporary port during startup
2020-08-29 18:21:06 +02:00
Luis Ángel San Martín
b64ea19e8b Use an invalid QVariant to set to NULL a value in the DB
nullptr causes troubles in some platforms/compiles
2020-08-25 19:45:05 +02:00
Luis Ángel San Martín
f11a757141 Code format
I had to update clang-format
2020-08-25 19:13:43 +02:00
Luis Ángel San Martín
5bc3ad5014 Send back more recent comic status to the client on sync 2020-08-25 19:03:00 +02:00