Commit Graph

119 Commits

Author SHA1 Message Date
Ismael Luceno 628ff65828 logging: Add proper backtrace support detection
The Q_OS_UNIX macro is inappropriate because many UNIX-like platforms may
lack backtrace support in the libc. E.g.: Darwin / Mac OS X, Musl libc,
OpenBSD, OpenIndiana.
2021-08-31 11:15:55 +01:00
Jonas Kvinge 320a1b81c9 Fix incorrect use of QFutureWatcher
To avoid a race condition, it is important to call setFuture() after doing the connections.

See: https://doc.qt.io/qt-6/qfuturewatcher.html
2021-07-14 10:18:15 +01:00
Jim Broadus 9a337a9efc logging: Fix {anonymous} class name.
If the __PRETTY_FUNCTION__ macro yields {anonymous} as the class name,
use the method name as the tag.
2021-05-03 14:44:19 +01:00
Jim Broadus 5f75bde396 libclementine-common: Use positive numbers for worker ids.
QRandomGenerator::generate() returns an unbounded int32, while the legacy
qrand method always returned a positive number. When generating a tag
reader ID with QRandomGenerator, cast the random value to an unsigned so
that it is formatted as a positive number in the name.

Note that most usages of QRandomGenrator in the codebase use bounded()
instead of generate(), and should work as expected.
2021-04-22 11:21:08 +01:00
Jim Broadus f04657e7e7 Replace qrand usage with QRandomGenerator
QRandomGenerator was introduced in 5.10 and qrand has since been
deprecated. QRandomGenerator::global() returns a global instance that
has been securely seeded. QRandomGenerator provides methods that
generate values within ranges, so taking a modulus of the result isn't
necessary.
2021-04-20 10:31:07 +01:00
Jim Broadus 429d8ee0f9 core/logging: Fix QString::split deprecation
QString::SplitBehavior is deprecated in 5.14. Use Qt::SplitBehavior
after this version.
2021-04-19 10:25:31 +01:00
Jim Broadus 8b2f7f08ae ext: Remove depencency on src
Remove /src from all include paths in /ext.
2021-03-17 18:26:51 +00:00
Jim Broadus cd41f706af libclementine-common: Move timeconstants.h to common location
This header is used by code in /ext, so move it out of /src. This is the
last /ext dependency on /src.
2021-03-17 18:26:51 +00:00
Jim Broadus af75ebbd6f libclementine-common: Mac: Fix exec search path
workerpool.h utilizes the MAC-specific USE_BUNDLE option, but the file
didn't directly include the config header file. Cleanup change 341dc73
reordered some headers, so it was no longer included as a side-effect
either.
2021-03-16 09:30:56 +00:00
John Maguire 341dc7326f Reformat all C++ 2020-09-22 14:56:06 +01:00
Jim Broadus 5b918a70aa Add an optional delete function for Lazy pointers.
This allows a delete function to be provided with the prototype: void d(T*)
This function is passed to the unique_ptr constructor to be used when the object
is released. The default function simply deletes the object, where the default
behavior for unique_ptr would have a specialization for arrays. If Lazy is ever
used with arrays, a delete function should be provided.
2020-05-19 10:39:06 +01:00
Jim Broadus 902522f4d3 Fix Qt generated log messages.
To avoid infinite recursion, Qt prevents a log generated from an installed
message handler from being handled by that same handler. So when a Qt message
is handled, the logging magic (__logging_message__) that is added by
CreateLogger, and is expected to be detected and stripped by the handler, is
instead dumped to the log.

Instead of sending the Qt messages back through the logging system, use a new
BufferedDebug to build the log message in a buffer, then immeiately print the
buffer to stderr.
2020-03-07 02:41:56 +00:00
Jim Broadus 09723d516c Use a template for CreateLogger to allow different QDebug derivatives. 2020-03-07 02:41:56 +00:00
Jim Broadus 79ac16afeb Move unneeded declarations and macros from logging header.
Some functions and macros aren't used outside of logging.cpp and don't need be
declared in header. Functions can be static.
2020-03-06 11:09:20 +00:00
Jim Broadus 52fd6ffadc Add a logging category to log all network requests.
New logging class NetworkRequests disabled by default, but can be enabled with
the command line option.
2020-02-13 11:09:51 +00:00
Jim Broadus d45a9f5c53 Enable debug logging for GstEnginePipeline by default.
Use qLogCat to put verbose GStreamer callback messages into a new
GstEnginePipelineCallbacks category. Filter that category instead of
the entire class by default.
2020-01-31 10:24:53 +00:00
Jim Broadus 4b37e0c577 Use qLogCat for GLog handler.
Provide the domain string from the GLog callback as the category.
2020-01-30 11:20:03 -08:00
Jim Broadus a2d2850884 Add a new qLogCat macro to specify category.
In some cases, such as message handling callback functions, the line and function
macros don't provide a lot of useful information. In other cases, we may want more
granularity of control withing a class. For these cases, add a qLogCat that takes
a category string. Print this string in the message and use it as the filter
category.
2020-01-30 11:19:58 -08:00
Jim Broadus 203d6425fd Fix nomenclature in logging functions.
The qLog macro passes the result of the __PRETTY_FUNCTION__ macro to the
CreateLogger* functions, but these all take an argument called class_name.
2020-01-30 08:50:06 -08:00
Jim Broadus dbe67bf32b Fix closure timing hole.
When a closure involves an ObjectHelper, a connection is made from the
receiver's destroyed signal and the helper object's deleteLater slot. Since
the signal between the sender and the helper object isn't disconnected until
either object is actually destroyed, this leaves a hole where the helper
holds a pointer to an invalid receiver object, but is still able to receive
the signal connected to its Invoke slot.

Instead of connecting the destroyed signal to deleteLater, connect it to a new
TearDown slot that immediately disconnects the signal then calls deleteLater.
2020-01-11 00:53:35 -08:00
Jonas Kvinge 1a2274bd2b Merge branch 'master' into qt5-update 2019-07-21 14:20:59 +02:00
Jonas Kvinge 5bb35bf08a Fix crash in messagereply (#6372)
* Fix crash in messagereply

* Fix formatting
2019-07-20 18:52:37 +01:00
Jonas Kvinge 1d17bee44a Merge with master and fix conflicts 2019-01-18 01:38:12 +01:00
John Maguire 453270c8b5 Fixes for compiling against qt5 on mac 2018-12-05 18:16:34 +01:00
Jonas Kvinge 2d1f6cd239 Replace Q_OS_MACOS with Q_OS_MAC (#6223) 2018-11-29 22:11:55 +00:00
Jonas Kvinge 9f946a2898 Improvements to makefiles and make components optional (#6221) 2018-11-29 21:32:12 +00:00
Jonas Kvinge 8c198a99a5 Qt 5 fixes 2018-11-21 10:31:17 +00:00
Andreas Sturmlechner a4e362b9f7
Fix cmake with Qt 5.11_beta3 (dropping qt5_use_modules)
One usage of the macro remains in the bundled libmygpo-qt5. This should
be updated once the pending upstream fix was merged. qtsingleapplication
is already fixed upstream.
2018-04-16 01:33:15 +02:00
Chocobozzz 70f68b1926
Merge remote-tracking branch 'upstream/master' into qt5 2018-02-01 09:50:42 +01:00
John Maguire 7599b5771f Explicitly link qt to libclementine-common 2017-11-21 13:25:33 +01:00
Chocobozzz 18a89f78a9 Merge remote-tracking branch 'upstream/master' into qt5 2016-10-07 14:30:09 +02:00
John Maguire 7750d5015e Cope with empty biography responses. 2016-06-28 18:22:15 +01:00
John Maguire 55af2b1d3b Add image fetching from wikipedia
#5416
2016-06-28 15:34:14 +01:00
Chocobozzz e6e189967d Merge remote-tracking branch 'upstream/master' into qt5 2016-02-29 18:03:02 +01:00
John Maguire b99b090adc Refactor simple dialogs to use Lazy 2016-02-12 16:01:35 +00:00
John Maguire f2daa772c1 Lazy initialise everything in Application. 2016-02-11 15:15:38 +00:00
John Maguire a7ca007e24 Tidy up lazy implementation. 2016-02-11 14:09:36 +00:00
John Maguire 4c8b1d8143 Add lazy initialisation helper. 2016-02-11 13:46:23 +00:00
John Maguire ac660dcf3d Use a simpler arraysize() implementation. 2016-01-14 16:14:13 +00:00
Chocobozzz ff7026c9fe Merge remote-tracking branch 'upstream/master' into qt5 2015-12-13 20:05:12 +01:00
David Sansome 170c64cd8b Link statically to libprotobuf from the spotifyblob 2015-12-14 00:02:07 +11:00
John Maguire f300946c81 Remove most usages of QFutureWatcher 2015-11-27 14:28:12 +00:00
John Maguire 2d61fe6c87 Changed my mind about automatically passing QFutures. 2015-11-27 12:04:14 +00:00
Arnaud Bienner ec98a68c3d Update SLOT signatures.
There weren't update as part of commit 33494dcddcb64f9fccae215f1100cfa885c72039: this prevented the slider to be updated, among other things.
2015-11-27 11:44:59 +01:00
John Maguire 3cc9c1e446 Remove ModelFutureWatcher 2015-11-26 19:02:08 +00:00
John Maguire 689858026e Actually pass the finished QFuture back. 2015-11-26 18:42:12 +00:00
John Maguire 2cd15ff430 Add NewClosure overload for QFuture 2015-11-26 18:35:17 +00:00
Chocobozzz 631a6cdabd Merge branch 'master' into qt5 2015-09-16 17:40:54 +02:00
Chocobozzz 7a866ac46b Fix compilation with Qt5.5 2015-07-26 09:54:19 +02:00
John Maguire b2a532be62 Experiment with typesafe time units 2015-07-20 14:35:13 +01:00