diff options
22 files changed, 81 insertions, 20 deletions
diff --git a/examples/pdfwidgets/pdfviewer/mainwindow.cpp b/examples/pdfwidgets/pdfviewer/mainwindow.cpp index 25c2cbaab..abe462750 100644 --- a/examples/pdfwidgets/pdfviewer/mainwindow.cpp +++ b/examples/pdfwidgets/pdfviewer/mainwindow.cpp @@ -23,7 +23,11 @@ using namespace Qt::StringLiterals; const qreal zoomMultiplier = qSqrt(2.0); +#if defined(Q_STATIC_LOGGING_CATEGORY) +Q_STATIC_LOGGING_CATEGORY(lcExample, "qt.examples.pdfviewer") +#else Q_LOGGING_CATEGORY(lcExample, "qt.examples.pdfviewer") +#endif MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) diff --git a/examples/pdfwidgets/pdfviewer/mainwindow.h b/examples/pdfwidgets/pdfviewer/mainwindow.h index 7f5a5dbca..009e3c1e0 100644 --- a/examples/pdfwidgets/pdfviewer/mainwindow.h +++ b/examples/pdfwidgets/pdfviewer/mainwindow.h @@ -7,8 +7,6 @@ #include <QLoggingCategory> #include <QMainWindow> -Q_DECLARE_LOGGING_CATEGORY(lcExample) - QT_BEGIN_NAMESPACE namespace Ui { class MainWindow; diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a24ffbbb2..bf9de4afd 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -188,6 +188,7 @@ foreach(arch ${archs}) web_engine_context.cpp web_engine_context.h web_engine_error.cpp web_engine_error.h web_engine_library_info.cpp web_engine_library_info.h + web_engine_logging.h web_engine_settings.cpp web_engine_settings.h web_event_factory.cpp web_event_factory.h web_usb_detector_qt.cpp web_usb_detector_qt.h diff --git a/src/core/renderer_host/web_channel_ipc_transport_host.cpp b/src/core/renderer_host/web_channel_ipc_transport_host.cpp index 0824ed56d..2ffe91ae1 100644 --- a/src/core/renderer_host/web_channel_ipc_transport_host.cpp +++ b/src/core/renderer_host/web_channel_ipc_transport_host.cpp @@ -10,6 +10,7 @@ #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" #include "services/service_manager/public/cpp/interface_provider.h" #include "qtwebengine/browser/qtwebchannel.mojom.h" +#include "web_engine_logging.h" #include <QJsonDocument> #include <QJsonObject> @@ -17,7 +18,7 @@ namespace QtWebEngineCore { -Q_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport") +Q_WEBENGINE_LOGGING_CATEGORY(log, "qt.webengine.webchanneltransport") inline QDebug operator<<(QDebug stream, content::RenderFrameHost *frame) { diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index b37360de2..b4f7c92f5 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -98,6 +98,7 @@ #include "profile_adapter.h" #include "type_conversion.h" #include "web_engine_library_info.h" +#include "web_engine_logging.h" #include <QFileInfo> #include <QGuiApplication> @@ -129,7 +130,7 @@ QT_END_NAMESPACE namespace QtWebEngineCore { -Q_LOGGING_CATEGORY(webEngineContextLog, "qt.webenginecontext") +Q_WEBENGINE_LOGGING_CATEGORY(webEngineContextLog, "qt.webenginecontext") class GPUInfo { diff --git a/src/core/web_engine_library_info.cpp b/src/core/web_engine_library_info.cpp index b6b8fc763..2508c3f94 100644 --- a/src/core/web_engine_library_info.cpp +++ b/src/core/web_engine_library_info.cpp @@ -16,6 +16,7 @@ #include "ui/base/ui_base_switches.h" #include "type_conversion.h" +#include "web_engine_logging.h" #include <QByteArray> #include <QCoreApplication> @@ -36,7 +37,7 @@ using namespace QtWebEngineCore; -Q_LOGGING_CATEGORY(webEngineLibraryInfoLog, "qt.webengine.libraryinfo") +Q_WEBENGINE_LOGGING_CATEGORY(webEngineLibraryInfoLog, "qt.webengine.libraryinfo") namespace { diff --git a/src/core/web_engine_logging.h b/src/core/web_engine_logging.h new file mode 100644 index 000000000..113d805e6 --- /dev/null +++ b/src/core/web_engine_logging.h @@ -0,0 +1,31 @@ +// Copyright (C) 2024 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#ifndef WEB_ENGINE_LOGGING_H +#define WEB_ENGINE_LOGGING_H + +#include <QLoggingCategory> + +// The Q_WEBENGINE_LOGGING_CATEGORY macro is a stopgap fix for the deprecation warnings +// introduced alongside the new logging category macros in Qt 6.9. Since we need to support +// building with older versions up to and including the last LTS release (6.8), we can't simply +// switch to using Q_STATIC_LOGGING_CATEGORY. This file and the macro definition within +// are intended to be removed in the next Qt 6 LTS release. +#if defined(Q_STATIC_LOGGING_CATEGORY) +#define Q_WEBENGINE_LOGGING_CATEGORY(name, ...) Q_STATIC_LOGGING_CATEGORY(name, __VA_ARGS__) +#else +#define Q_WEBENGINE_LOGGING_CATEGORY(name, ...) Q_LOGGING_CATEGORY(name, __VA_ARGS__) +#endif + +#endif // WEB_ENGINE_LOGGING_H diff --git a/src/pdf/plugins/imageformats/pdf/qpdfiohandler.cpp b/src/pdf/plugins/imageformats/pdf/qpdfiohandler.cpp index bb3e7c929..d63bdf4d5 100644 --- a/src/pdf/plugins/imageformats/pdf/qpdfiohandler.cpp +++ b/src/pdf/plugins/imageformats/pdf/qpdfiohandler.cpp @@ -2,13 +2,14 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qpdfiohandler_p.h" +#include "../../../../core/web_engine_logging.h" #include <QLoggingCategory> #include <QPainter> #include <QtPdf/private/qpdffile_p.h> QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qLcPdf, "qt.imageformat.pdf") +Q_WEBENGINE_LOGGING_CATEGORY(qLcPdf, "qt.imageformat.pdf") QPdfIOHandler::QPdfIOHandler() { diff --git a/src/pdf/qpdfbookmarkmodel.cpp b/src/pdf/qpdfbookmarkmodel.cpp index 93dbf5d1f..ab037d5f9 100644 --- a/src/pdf/qpdfbookmarkmodel.cpp +++ b/src/pdf/qpdfbookmarkmodel.cpp @@ -9,6 +9,8 @@ #include "third_party/pdfium/public/fpdf_doc.h" #include "third_party/pdfium/public/fpdfview.h" +#include "../core/web_engine_logging.h" + #include <QLoggingCategory> #include <QMetaEnum> #include <QPointer> @@ -17,7 +19,7 @@ QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qLcBM, "qt.pdf.bookmarks") +Q_WEBENGINE_LOGGING_CATEGORY(qLcBM, "qt.pdf.bookmarks") class BookmarkNode { diff --git a/src/pdf/qpdfdocument.cpp b/src/pdf/qpdfdocument.cpp index 17fdb29b9..b68b0d2b1 100644 --- a/src/pdf/qpdfdocument.cpp +++ b/src/pdf/qpdfdocument.cpp @@ -7,6 +7,8 @@ #include "third_party/pdfium/public/fpdf_doc.h" #include "third_party/pdfium/public/fpdf_text.h" +#include "../core/web_engine_logging.h" + #include <QDateTime> #include <QDebug> #include <QElapsedTimer> @@ -25,7 +27,7 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QRecursiveMutex, pdfMutex) static int libraryRefCount; static const double CharacterHitTolerance = 16.0; -Q_LOGGING_CATEGORY(qLcDoc, "qt.pdf.document") +Q_WEBENGINE_LOGGING_CATEGORY(qLcDoc, "qt.pdf.document") QPdfMutexLocker::QPdfMutexLocker() : std::unique_lock<QRecursiveMutex>(*pdfMutex()) diff --git a/src/pdf/qpdflinkmodel.cpp b/src/pdf/qpdflinkmodel.cpp index 0a8b1e812..4d8b68b77 100644 --- a/src/pdf/qpdflinkmodel.cpp +++ b/src/pdf/qpdflinkmodel.cpp @@ -9,12 +9,14 @@ #include "third_party/pdfium/public/fpdf_doc.h" #include "third_party/pdfium/public/fpdf_text.h" +#include "../core/web_engine_logging.h" + #include <QLoggingCategory> #include <QMetaEnum> QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qLcLink, "qt.pdf.links") +Q_WEBENGINE_LOGGING_CATEGORY(qLcLink, "qt.pdf.links") /*! \class QPdfLinkModel diff --git a/src/pdf/qpdfpagenavigator.cpp b/src/pdf/qpdfpagenavigator.cpp index e077e2184..1f3088908 100644 --- a/src/pdf/qpdfpagenavigator.cpp +++ b/src/pdf/qpdfpagenavigator.cpp @@ -5,12 +5,14 @@ #include "qpdfdocument.h" #include "qpdflink_p.h" +#include "../core/web_engine_logging.h" + #include <QtCore/qloggingcategory.h> #include <QtCore/qpointer.h> QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qLcNav, "qt.pdf.pagenavigator") +Q_WEBENGINE_LOGGING_CATEGORY(qLcNav, "qt.pdf.pagenavigator") struct QPdfPageNavigatorPrivate { diff --git a/src/pdf/qpdfsearchmodel.cpp b/src/pdf/qpdfsearchmodel.cpp index a81ae77dc..ffe3d7d78 100644 --- a/src/pdf/qpdfsearchmodel.cpp +++ b/src/pdf/qpdfsearchmodel.cpp @@ -9,13 +9,15 @@ #include "third_party/pdfium/public/fpdf_text.h" #include "third_party/pdfium/public/fpdfview.h" +#include "../core/web_engine_logging.h" + #include <QtCore/qelapsedtimer.h> #include <QtCore/qloggingcategory.h> #include <QtCore/QMetaEnum> QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qLcS, "qt.pdf.search") +Q_WEBENGINE_LOGGING_CATEGORY(qLcS, "qt.pdf.search") static const int UpdateTimerInterval = 100; static const int ContextChars = 64; diff --git a/src/pdfquick/qquickpdfpageimage.cpp b/src/pdfquick/qquickpdfpageimage.cpp index fe6dced8e..be43c1c53 100644 --- a/src/pdfquick/qquickpdfpageimage.cpp +++ b/src/pdfquick/qquickpdfpageimage.cpp @@ -3,12 +3,13 @@ #include "qquickpdfpageimage_p.h" #include "qquickpdfdocument_p.h" +#include "../core/web_engine_logging.h" #include <private/qpdffile_p.h> #include <QtQuick/private/qquickimage_p_p.h> QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qLcImg, "qt.pdf.image") +Q_WEBENGINE_LOGGING_CATEGORY(qLcImg, "qt.pdf.image") /*! \qmltype PdfPageImage diff --git a/src/pdfquick/qquickpdfsearchmodel.cpp b/src/pdfquick/qquickpdfsearchmodel.cpp index 87acf46ae..cbad39b59 100644 --- a/src/pdfquick/qquickpdfsearchmodel.cpp +++ b/src/pdfquick/qquickpdfsearchmodel.cpp @@ -2,11 +2,12 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qquickpdfsearchmodel_p.h" +#include "../core/web_engine_logging.h" #include <QtCore/qloggingcategory.h> QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qLcSearch, "qt.pdf.search") +Q_WEBENGINE_LOGGING_CATEGORY(qLcSearch, "qt.pdf.search") /*! \qmltype PdfSearchModel diff --git a/src/pdfquick/qquickpdfselection.cpp b/src/pdfquick/qquickpdfselection.cpp index f93cb4394..d31822fad 100644 --- a/src/pdfquick/qquickpdfselection.cpp +++ b/src/pdfquick/qquickpdfselection.cpp @@ -3,6 +3,7 @@ #include "qquickpdfselection_p.h" #include "qquickpdfdocument_p.h" +#include "../core/web_engine_logging.h" #include <QClipboard> #include <QGuiApplication> #include <QLoggingCategory> @@ -12,7 +13,7 @@ #include <QStandardPaths> #include <QtPdf/private/qpdfdocument_p.h> -Q_LOGGING_CATEGORY(qLcIm, "qt.pdf.im") +Q_WEBENGINE_LOGGING_CATEGORY(qLcIm, "qt.pdf.im") QT_BEGIN_NAMESPACE diff --git a/src/pdfwidgets/qpdfview.cpp b/src/pdfwidgets/qpdfview.cpp index a19b77a7f..79e60408f 100644 --- a/src/pdfwidgets/qpdfview.cpp +++ b/src/pdfwidgets/qpdfview.cpp @@ -7,6 +7,8 @@ #include "qpdfpagerenderer.h" +#include "../core/web_engine_logging.h" + #include <QGuiApplication> #include <QLoggingCategory> #include <QPainter> @@ -19,7 +21,7 @@ QT_BEGIN_NAMESPACE -Q_LOGGING_CATEGORY(qLcWLink, "qt.pdf.widgets.links") +Q_WEBENGINE_LOGGING_CATEGORY(qLcWLink, "qt.pdf.widgets.links") //#define DEBUG_LINKS static const QColor SearchResultHighlight("#80B0C4DE"); diff --git a/tests/auto/core/origins/tst_origins.cpp b/tests/auto/core/origins/tst_origins.cpp index 06af1123e..e39d9c38a 100644 --- a/tests/auto/core/origins/tst_origins.cpp +++ b/tests/auto/core/origins/tst_origins.cpp @@ -4,6 +4,8 @@ #include <util.h> #include "httpserver.h" +#include "../../../../src/core/web_engine_logging.h" + #include <QtCore/qfile.h> #include <QtTest/QtTest> #include <QtWebEngineCore/qwebengineurlrequestinterceptor.h> @@ -25,7 +27,7 @@ #define QSL QStringLiteral #define QBAL QByteArrayLiteral -Q_LOGGING_CATEGORY(lc, "qt.webengine.tests") +Q_WEBENGINE_LOGGING_CATEGORY(lc, "qt.webengine.tests") void registerSchemes() { diff --git a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp index 89b82ca49..78d9cb652 100644 --- a/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp +++ b/tests/auto/core/qwebengineurlrequestinterceptor/tst_qwebengineurlrequestinterceptor.cpp @@ -13,6 +13,8 @@ #include <QtWebEngineCore/qwebenginepage.h> #include <QtWebEngineCore/qwebenginehttprequest.h> +#include "../../../../src/core/web_engine_logging.h" + #include <httpserver.h> #include <httpreqrep.h> @@ -99,7 +101,7 @@ struct RequestInfo { static const QUrl kRedirectUrl = QUrl("qrc:///resources/content.html"); -Q_LOGGING_CATEGORY(lc, "qt.webengine.tests") +Q_WEBENGINE_LOGGING_CATEGORY(lc, "qt.webengine.tests") class TestRequestInterceptor : public QWebEngineUrlRequestInterceptor { diff --git a/tests/auto/httpserver/httpserver.cpp b/tests/auto/httpserver/httpserver.cpp index 8a1d8e6f6..fad7fe4dd 100644 --- a/tests/auto/httpserver/httpserver.cpp +++ b/tests/auto/httpserver/httpserver.cpp @@ -2,11 +2,13 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include "httpserver.h" +#include "../../../src/core/web_engine_logging.h" + #include <QFile> #include <QLoggingCategory> #include <QMimeDatabase> -Q_LOGGING_CATEGORY(gHttpServerLog, "HttpServer") +Q_WEBENGINE_LOGGING_CATEGORY(gHttpServerLog, "HttpServer") HttpServer::HttpServer(QObject *parent) : HttpServer(new QTcpServer, "http", QHostAddress::LocalHost, 0, parent) diff --git a/tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp b/tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp index f5e946d19..fbc2538ec 100644 --- a/tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp +++ b/tests/auto/pdf/qpdfsearchmodel/tst_qpdfsearchmodel.cpp @@ -1,13 +1,14 @@ // Copyright (C) 2020 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only +#include "../../../../src/core/web_engine_logging.h" #include <QtTest/QtTest> #include <QPdfDocument> #include <QPdfSearchModel> -Q_LOGGING_CATEGORY(lcTests, "qt.pdf.tests") +Q_WEBENGINE_LOGGING_CATEGORY(lcTests, "qt.pdf.tests") class tst_QPdfSearchModel: public QObject { diff --git a/tests/auto/pdfquick/multipageview/tst_multipageview.cpp b/tests/auto/pdfquick/multipageview/tst_multipageview.cpp index 71c09077c..049dd5b74 100644 --- a/tests/auto/pdfquick/multipageview/tst_multipageview.cpp +++ b/tests/auto/pdfquick/multipageview/tst_multipageview.cpp @@ -12,10 +12,11 @@ #include <QtPdfQuick/private/qquickpdfsearchmodel_p.h> #include <QtPdfQuick/private/qquickpdfpageimage_p.h> #include "../shared/util.h" +#include "../../../../src/core/web_engine_logging.h" using namespace Qt::StringLiterals; -Q_LOGGING_CATEGORY(lcTests, "qt.pdf.tests") +Q_WEBENGINE_LOGGING_CATEGORY(lcTests, "qt.pdf.tests") class tst_MultiPageView : public QQuickDataTest { |
