Commit Graph

555 Commits

Author SHA1 Message Date
255e51da86 Fix binding values to search query
This was broken while doing a rebase
2021-01-08 16:59:17 +01:00
8efb9912ee Use concatenation, rather than ostringstream 2021-01-08 15:56:16 +01:00
4990093e3d Remove c++17 dependency 2021-01-08 15:56:16 +01:00
2d3888b4b4 Fix scopes 2021-01-08 15:56:13 +01:00
7ccb338455 Apply clang-format 2021-01-08 15:51:59 +01:00
9a660350d2 Add some documentation and attribution to the query parser 2021-01-08 15:51:59 +01:00
30529dca43 Some small tidy ups 2021-01-08 15:51:56 +01:00
673ee1f067 Use the query parser in the comic and folder model 2021-01-08 15:41:29 +01:00
5fa7da1e46 Add folder into the query parser 2021-01-08 15:41:29 +01:00
4a50d438d0 Add query parser class 2021-01-08 15:41:28 +01:00
d3de52ca82 Add commit 43aab01 of BenHanson/lexertl14 from github 2021-01-08 15:41:28 +01:00
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
e79ea56d32 Fix format 2020-12-05 14:49:54 +01:00
ccf1e4cb56 Updated Dutch translation 2020-10-01 11:56:35 +02:00
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
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
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
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
f11a757141 Code format
I had to update clang-format
2020-08-25 19:13:43 +02:00
5bc3ad5014 Send back more recent comic status to the client on sync 2020-08-25 19:03:00 +02:00
2b780e23a4 Make updateFromRemoteClient return more updated comics
So they can be sent back to the client.
2020-08-25 19:01:43 +02:00
fe15bc2ba8 Include "last_time_opened" in JSON serialization 2020-08-25 19:01:03 +02:00
c84fc20419 Reset last time opened when setting a comic as unread 2020-08-25 19:00:21 +02:00
4b3042def4 Fix object leaks in database code
Qt's database and query model requires that both the queries and the database
objects are out of scope before a database connection can safely be removed.

Solution: Properly encapsulate databases and queries in "{ }" and use a string
to cache the connection name for out-of-scope removal.
2020-08-25 17:34:46 +02:00
1b344d70e5 Update server code integration for QtWebApp 1.7.11
- Adapt server code for QtWebapp namespace 'stefanfrings'
- Implement custom modifications needed by v1 controller
  via template engine
- Unify iphone and ipad templates
2020-08-20 18:22:57 +02:00
3de099491f Move QtWebApp sources to third_party 2020-08-20 18:22:57 +02:00
1af613663c Fix QsLog setup in Library and LibraryServer
The calls changed, so we need to adapt them.
2020-08-20 17:41:56 +02:00
c13ec618d0 Move QsLog to third_party directory 2020-08-20 17:41:56 +02:00
b9acd13120 Fix code format errors due to changes in default coding style. (#150) 2020-07-24 21:17:49 +02:00
65a77daa75 Explicitly include <sys/socket.h>
server_config_dialog.cpp:57:30: error: member access into incomplete type 'struct sockaddr'
            if (ifa->ifa_addr->sa_family == AF_INET) { // check it is IP4
                             ^
/usr/local/include/qt5/QtNetwork/qhostaddress.h:50:8: note: forward declaration of 'sockaddr'
struct sockaddr;
       ^
server_config_dialog.cpp:61:27: error: use of undeclared identifier 'AF_INET'
                inet_ntop(AF_INET, tmpAddrPtr, addressBuffer, INET_ADDRSTRLEN);
                          ^
server_config_dialog.cpp:64:37: error: member access into incomplete type 'struct sockaddr'
            } else if (ifa->ifa_addr->sa_family == AF_INET6) { // check it is IP6
                                    ^
/usr/local/include/qt5/QtNetwork/qhostaddress.h:50:8: note: forward declaration of 'sockaddr'
struct sockaddr;
       ^
server_config_dialog.cpp:68:27: error: use of undeclared identifier 'AF_INET6'
                inet_ntop(AF_INET6, tmpAddrPtr, addressBuffer, INET6_ADDRSTRLEN);
                          ^
2019-11-26 19:03:34 +00:00
e1b0e7c96f Fix full screen mode in windows with qt 5.12.4+ 2019-09-28 10:11:44 +02:00
346bcdaf75 Clang format fix. 2019-09-25 17:38:59 +02:00
cfb4e31af9 Fix for story arcs not being parsed from comicvine. 2019-09-25 17:38:59 +02:00
0b83764734 Revert "Thread ping pong" 2019-09-24 12:00:21 +02:00
be547081f2 Fix huge memleak in server code caused by thread pingpong fix.
Stopped QThreads don't process events, so cleanup signals get lost.
Prevent this from happening by keeping the threads alive and the comic
inside the thread (as we already do in the viewer). Cleanup happens by
connecting the comic's destroyed() signal to the thread's quit() slot.
2019-09-24 08:21:14 +02:00
68ae40fda7 Fix restoring the window from a minimized state 2019-09-22 15:04:54 +02:00
6990ba0765 Use showNormal in macos and show in other platforms 2019-09-22 13:27:06 +02:00
1ddf0038b8 Use Trigger in linux, we have seen some setups were double click is not reported 2019-09-22 13:14:02 +02:00
94d17a1d5c Use "show" instead of "showNormal" to keep maximized geometry 2019-09-22 13:08:10 +02:00
fc85f77d15 Use LibraryWindow::closeApp to exit from the system tray context menu 2019-09-21 12:12:19 +02:00
9fafa06063 Move call forward 2019-09-21 12:11:56 +02:00
674fa21717 Pass a more specific instance of our main window 2019-09-21 12:11:39 +02:00
ef8216b338 Make closeApp work with no event
And exit using QApplication.exit so we don't mess with window events to exit the app
2019-09-21 12:11:03 +02:00
7ac331ed41 Do not force macos sdk for now
This was commited by mistake
2019-09-21 11:06:51 +02:00
8e99d9e59f Extract the system tray functionality to its own class
LibraryWindow is already a monster, so we'll try to not make it bigger.
2019-09-21 10:47:01 +02:00
3c07e7269a Update the UI string about system tray support 2019-09-21 10:45:34 +02:00
5b78ef2dae Use new property name and set false as default 2019-09-21 10:44:28 +02:00
b5f3799753 Restore the code to start the app into the system tray 2019-09-21 10:44:03 +02:00
63e16e44b7 Better macos tray icon 2019-09-20 16:38:11 +02:00
403e657062 A new trayicon is needed for macos 2019-09-20 13:41:26 +02:00