diff --git a/3rdparty/deepin-pdfium/src/dpdfdoc.cpp b/3rdparty/deepin-pdfium/src/dpdfdoc.cpp index b7e359dd9..d1e22586d 100755 --- a/3rdparty/deepin-pdfium/src/dpdfdoc.cpp +++ b/3rdparty/deepin-pdfium/src/dpdfdoc.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: LGPL-3.0-or-later #include "dpdfdoc.h" +#include "dpdflog.h" #include "dpdfpage.h" #include "public/fpdfview.h" @@ -131,14 +132,14 @@ DPdfDoc::Status DPdfDocPrivate::loadFile(const QString &filePath, const QString DPdfMutexLocker locker("DPdfDocPrivate::loadFile"); - qDebug() << "deepin-pdfium正在加载PDF文档... 文档名称: " << filePath; + qCDebug(dpfLog) << "deepin-pdfium正在加载PDF文档... 文档名称: " << filePath; void *ptr = FPDF_LoadDocument(m_filePath.toUtf8().constData(), password.toUtf8().constData()); m_docHandler = static_cast(ptr); m_status = m_docHandler ? DPdfDoc::SUCCESS : parseError(static_cast(FPDF_GetLastError())); - qDebug() << "文档(" << filePath << ")文档加载状态: " << m_status; + qCDebug(dpfLog) << "文档(" << filePath << ")文档加载状态: " << m_status; if (m_docHandler) { m_pageCount = FPDF_GetPageCount(reinterpret_cast(m_docHandler)); @@ -202,7 +203,7 @@ bool DPdfDoc::isLinearized(const QString &fileName) { QFile file(fileName); if (!file.open(QFile::ReadOnly)) { - qInfo() << "file open failed when isLinearized" << fileName; + qCInfo(dpfLog) << "file open failed when isLinearized" << fileName; } QByteArray content = file.readAll(); int len = content.length(); @@ -279,7 +280,7 @@ bool DPdfDoc::save() // Rename original file to backup instead of deleting (avoids SMB file handle issues) if (targetFile.exists()) { if (!targetFile.rename(backupPath)) { - qWarning() << "Failed to rename original file to backup:" << targetPath; + qCWarning(dpfLog) << "Failed to rename original file to backup:" << targetPath; return false; } } @@ -287,7 +288,7 @@ bool DPdfDoc::save() // Write new file QFile newFile(targetPath); if (!newFile.open(QIODevice::WriteOnly | QIODevice::Truncate)) { - qWarning() << "Failed to open file for writing:" << targetPath; + qCWarning(dpfLog) << "Failed to open file for writing:" << targetPath; // Restore original file on failure if (QFile::exists(backupPath)) { QFile::rename(backupPath, targetPath); @@ -296,7 +297,7 @@ bool DPdfDoc::save() } if (array.size() != newFile.write(array)) { - qWarning() << "Failed to write data to file:" << targetPath; + qCWarning(dpfLog) << "Failed to write data to file:" << targetPath; result = false; newFile.close(); newFile.remove(); diff --git a/3rdparty/deepin-pdfium/src/dpdfglobal.cpp b/3rdparty/deepin-pdfium/src/dpdfglobal.cpp index 524654ac0..bf9146d7f 100755 --- a/3rdparty/deepin-pdfium/src/dpdfglobal.cpp +++ b/3rdparty/deepin-pdfium/src/dpdfglobal.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: LGPL-3.0-or-later @@ -6,10 +6,13 @@ #include #include #include "dpdfglobal.h" +#include "dpdflog.h" #include "public/fpdfview.h" #include +Q_LOGGING_CATEGORY(dpfLog, "org.deepin.reader.pdfium") + static bool initialized = false; const static DPdfGlobal instance = DPdfGlobal(); @@ -60,11 +63,11 @@ DPdfMutexLocker::DPdfMutexLocker(const QString &tmpLog): QMutexLocker(m_cupsApi); if (cups) { if (!cups->init()) { - qWarning() << "CUPS init failed"; + qCWarning(batchprintLog) << "CUPS init failed"; NotifyClient::notifyError(ErrorMessages::cupsUnavailable()); return 2; } if (!cups->checkEnvironment()) { - qWarning() << "CUPS environment check failed"; + qCWarning(batchprintLog) << "CUPS environment check failed"; NotifyClient::notifyError(ErrorMessages::noDefaultPrinter()); return 2; } @@ -64,7 +66,7 @@ int BatchPrintApp::run(const QStringList &fileList) QString errorMsg; if (!FormatConverter::convertToPdf(filePath, tempDir.path(), outputPdfPath, errorMsg)) { - qWarning() << errorMsg; + qCWarning(batchprintLog) << errorMsg; failedFiles.append(QFileInfo(filePath).fileName()); continue; } diff --git a/batch-print/cupsclient.cpp b/batch-print/cupsclient.cpp index dda4b1a74..a6236bfba 100644 --- a/batch-print/cupsclient.cpp +++ b/batch-print/cupsclient.cpp @@ -10,6 +10,8 @@ #include #include +#include "ddlog.h" + #include typedef int (*cupsGetDests_fn)(cups_dest_t **dests); @@ -55,13 +57,13 @@ bool CupsClient::init() { m_lib.setFileName(QStringLiteral("cups")); if (!m_lib.load()) { - qWarning() << "Failed to dlopen libcups:" << m_lib.errorString(); + qCWarning(batchprintLog) << "Failed to dlopen libcups:" << m_lib.errorString(); return false; } m_loaded = loadSymbols(); if (!m_loaded) { - qWarning() << "Failed to resolve CUPS symbols"; + qCWarning(batchprintLog) << "Failed to resolve CUPS symbols"; return false; } @@ -76,7 +78,7 @@ bool CupsClient::checkEnvironment() cups_dest_t *dests = nullptr; int numDest = ((cupsGetDests_fn)m_cupsGetDests)(&dests); if (numDest <= 0) { - qWarning() << "No printers found"; + qCWarning(batchprintLog) << "No printers found"; return false; } diff --git a/htmltopdf/CMakeLists.txt b/htmltopdf/CMakeLists.txt index e42619e9e..733c4ba2c 100644 --- a/htmltopdf/CMakeLists.txt +++ b/htmltopdf/CMakeLists.txt @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2026 UnionTech Software Technology Co., Ltd. +# +# SPDX-License-Identifier: GPL-3.0-or-later + # 定义htmltopdf可执行文件 add_executable(htmltopdf main.cpp @@ -14,6 +18,9 @@ set_target_properties(htmltopdf PROPERTIES find_package(Qt${QT_DESIRED_VERSION} REQUIRED COMPONENTS WebEngineWidgets) +# 引用 reader/ddlog.h 的日志分类定义 +target_include_directories(htmltopdf PRIVATE ${CMAKE_SOURCE_DIR}/reader) + # 链接Qt模块 target_link_libraries(htmltopdf PRIVATE Qt${QT_VERSION_MAJOR}::WebEngineWidgets diff --git a/htmltopdf/htmltopdfconverter.cpp b/htmltopdf/htmltopdfconverter.cpp index 0ace65617..63eae2bfc 100644 --- a/htmltopdf/htmltopdfconverter.cpp +++ b/htmltopdf/htmltopdfconverter.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -7,12 +7,14 @@ #include +#include "ddlog.h" + HtmltoPdfConverter::HtmltoPdfConverter(const QString &inputPath, const QString &outputPath) : m_inputPath(inputPath) , m_outputPath(outputPath) , m_page(new QWebEnginePage) { - qDebug() << "HtmltoPdfConverter initialized with input:" << inputPath << "output:" << outputPath; + qCDebug(htmltopdfLog) << "HtmltoPdfConverter initialized with input:" << inputPath << "output:" << outputPath; connect(m_page.data(), &QWebEnginePage::loadFinished, this, &HtmltoPdfConverter::loadFinished); @@ -22,9 +24,9 @@ HtmltoPdfConverter::HtmltoPdfConverter(const QString &inputPath, const QString & int HtmltoPdfConverter::run() { - qDebug() << "Starting HTML to PDF conversion process"; + qCDebug(htmltopdfLog) << "Starting HTML to PDF conversion process"; QUrl url = QUrl::fromUserInput(m_inputPath); - qDebug() << "Loading HTML file from path:" << url; + qCDebug(htmltopdfLog) << "Loading HTML file from path:" << url; m_page->load(url); return QCoreApplication::exec(); } @@ -32,17 +34,17 @@ int HtmltoPdfConverter::run() void HtmltoPdfConverter::loadFinished(bool ok) { if (!ok) { - qWarning() << QString("Failed to load URL '%1'").arg(m_inputPath); + qCWarning(htmltopdfLog) << QString("Failed to load URL '%1'").arg(m_inputPath); QCoreApplication::exit(1); } - qInfo() << QString("Successfully loaded URL '%1'").arg(m_inputPath); + qCInfo(htmltopdfLog) << QString("Successfully loaded URL '%1'").arg(m_inputPath); m_page->printToPdf(m_outputPath); } void HtmltoPdfConverter::pdfPrintingFinished(const QString &filePath, bool success) { if (!success) { - qWarning() << QString("Failed to print to output file '%1'").arg(filePath); + qCWarning(htmltopdfLog) << QString("Failed to print to output file '%1'").arg(filePath); QCoreApplication::exit(1); } else { QCoreApplication::quit(); diff --git a/htmltopdf/main.cpp b/htmltopdf/main.cpp index 80aed2571..2d4b3be85 100644 --- a/htmltopdf/main.cpp +++ b/htmltopdf/main.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -10,26 +10,28 @@ #include #include +#include "ddlog.h" + bool isWayland(); int main(int argc, char *argv[]) { - qDebug() << "Starting html2pdf converter application"; + qCDebug(htmltopdfLog) << "Starting html2pdf converter application"; QApplication app(argc, argv); QApplication::setApplicationName("html2pdf"); QApplication::setApplicationVersion("v1.0"); bool wayland = isWayland(); - qDebug() << "Wayland environment detected:" << wayland; + qCDebug(htmltopdfLog) << "Wayland environment detected:" << wayland; if (wayland) { - qDebug() << "Wayland detected, disabling GPU"; + qCDebug(htmltopdfLog) << "Wayland detected, disabling GPU"; // 解决klu panguV平台使用QWebEnginePage崩溃的问题,不支持gpu渲染 qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--disable-gpu"); } // 解决__sw_64__平台使用QWebEnginePage崩溃的问题 #ifdef __sw_64__ - qDebug() << "Running on __sw_64__ platform, --js-flags=--jitless"; + qCDebug(htmltopdfLog) << "Running on __sw_64__ platform, --js-flags=--jitless"; qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--js-flags=--jitless"); #endif @@ -50,28 +52,28 @@ int main(int argc, char *argv[]) const QStringList requiredArguments = parser.positionalArguments(); if (requiredArguments.size() != 2) { - qCritical() << "Invalid number of arguments, expected 2 but got" << requiredArguments.size(); + qCCritical(htmltopdfLog) << "Invalid number of arguments, expected 2 but got" << requiredArguments.size(); parser.showHelp(1); } - qInfo() << "Input file:" << requiredArguments.at(0) << "Output PDF:" << requiredArguments.at(1); + qCInfo(htmltopdfLog) << "Input file:" << requiredArguments.at(0) << "Output PDF:" << requiredArguments.at(1); - qInfo() << "Creating PDF converter instance"; + qCInfo(htmltopdfLog) << "Creating PDF converter instance"; HtmltoPdfConverter converter(requiredArguments.at(0), requiredArguments.at(1)); return converter.run(); } bool isWayland() { - qDebug() << "Checking display environment"; + qCDebug(htmltopdfLog) << "Checking display environment"; auto e = QProcessEnvironment::systemEnvironment(); QString XDG_SESSION_TYPE = e.value(QStringLiteral("XDG_SESSION_TYPE")); QString WAYLAND_DISPLAY = e.value(QStringLiteral("WAYLAND_DISPLAY")); if (XDG_SESSION_TYPE == QLatin1String("wayland") || WAYLAND_DISPLAY.contains(QLatin1String("wayland"), Qt::CaseInsensitive)) { - qDebug() << "Wayland session detected"; + qCDebug(htmltopdfLog) << "Wayland session detected"; return true; } else { - qDebug() << "X11 session detected"; + qCDebug(htmltopdfLog) << "X11 session detected"; return false; } } diff --git a/reader/app/Database.cpp b/reader/app/Database.cpp index 53823fb2e..1e49440a0 100644 --- a/reader/app/Database.cpp +++ b/reader/app/Database.cpp @@ -1195,7 +1195,7 @@ Database::Database(QObject *parent) : QObject(parent) m_database.setDatabaseName(QDir(path).filePath("user.db")); qCDebug(appLog) << "Opening database:" << m_database.databaseName(); if (!m_database.open()) { - qCritical() << "Failed to open database:" << m_database.lastError(); + qCCritical(appLog) << "Failed to open database:" << m_database.lastError(); } if (m_database.isOpen()) { diff --git a/reader/ddlog.h b/reader/ddlog.h index 7d592a0ca..fe0b45e30 100644 --- a/reader/ddlog.h +++ b/reader/ddlog.h @@ -1,18 +1,21 @@ -// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd. // -// SPDX-Liteense-Identifier: GPL-3.0-or-later +// SPDX-License-Identifier: GPL-3.0-or-later #ifndef DDLOG_H #define DDLOG_H -#ifdef DTKCORE_CLASS_DConfigFile -#include -#endif -#include -DCORE_USE_NAMESPACE +#include +#include -// namespace DDLog { +// 全项目统一的日志分类:reader / batch-print / htmltopdf 共用此定义, +// 便于 DConfig(deepin-log-viewer) 按应用统一过滤 inline Q_LOGGING_CATEGORY(appLog, "org.deepin.reader") -// } + +// 模块分离:batch-print 批量打印进程 +inline Q_LOGGING_CATEGORY(batchprintLog, "org.deepin.reader.batchprint") + +// 模块分离:htmltopdf 转换进程 +inline Q_LOGGING_CATEGORY(htmltopdfLog, "org.deepin.reader.htmltopdf") #endif // DDLOG_H diff --git a/reader/document/DjVuModel.cpp b/reader/document/DjVuModel.cpp index 5429ce7de..3b3529dd5 100644 --- a/reader/document/DjVuModel.cpp +++ b/reader/document/DjVuModel.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2019 ~ 2020 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -524,7 +524,7 @@ deepin_reader::DjVuDocument *DjVuDocument::loadDocument(const QString &filePath, ddjvu_context_t *context = ddjvu_context_create("deepin_reader"); if (context == nullptr) { - qCritical() << "Failed to create DjVu context"; + qCCritical(appLog) << "Failed to create DjVu context"; error = Document::FileError; return nullptr; } @@ -536,7 +536,7 @@ deepin_reader::DjVuDocument *DjVuDocument::loadDocument(const QString &filePath, #endif // DDJVUAPI_VERSION if (document == nullptr) { - qCritical() << "Failed to create DjVu document from file:" << filePath; + qCCritical(appLog) << "Failed to create DjVu document from file:" << filePath; ddjvu_context_release(context); error = Document::FileError; @@ -546,7 +546,7 @@ deepin_reader::DjVuDocument *DjVuDocument::loadDocument(const QString &filePath, waitForMessageTag(context, DDJVU_DOCINFO); if (ddjvu_document_decoding_error(document)) { - qCritical() << "Document decoding error occurred"; + qCCritical(appLog) << "Document decoding error occurred"; ddjvu_document_release(document); ddjvu_context_release(context); diff --git a/reader/document/Model.cpp b/reader/document/Model.cpp index 09dbd8718..92229d28e 100644 --- a/reader/document/Model.cpp +++ b/reader/document/Model.cpp @@ -112,7 +112,7 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int & QFile::remove(localFilePath); if (!QFile::copy(filePath, localFilePath)) { - qCritical() << "Failed to copy network DJVU file from" << filePath << "to" << localFilePath; + qCCritical(appLog) << "Failed to copy network DJVU file from" << filePath << "to" << localFilePath; error = deepin_reader::Document::FileError; } else { qCInfo(appLog) << "Copied network DJVU to local:" << localFilePath; @@ -134,7 +134,7 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int & } else if (Dr::DOCX == fileType) { qCDebug(appLog) << "Starting DOCX document conversion process"; if (nullptr == pprocess) { - qCritical() << "Invalid process pointer for DOCX conversion"; + qCCritical(appLog) << "Invalid process pointer for DOCX conversion"; error = deepin_reader::Document::ConvertFailed; return nullptr; } @@ -158,7 +158,7 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int & QFile file(filePath); if (!file.copy(targetDoc)) { - qCritical() << "Failed to copy file from" << filePath << "to" << targetDoc; + qCCritical(appLog) << "Failed to copy file from" << filePath << "to" << targetDoc; error = deepin_reader::Document::ConvertFailed; *pprocess = nullptr; return nullptr; @@ -184,19 +184,19 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int & qCDebug(appLog) << "执行命令: unzip" << unzipArgs; decompressor.start("unzip", unzipArgs); if (!decompressor.waitForStarted()) { - qCritical() << "Failed to start unzip process for file:" << targetDoc; + qCCritical(appLog) << "Failed to start unzip process for file:" << targetDoc; error = deepin_reader::Document::ConvertFailed; *pprocess = nullptr; return nullptr; } if (!decompressor.waitForFinished(unzipTimeout)) { - qCritical() << "Unzip process failed for file:" << targetDoc; + qCCritical(appLog) << "Unzip process failed for file:" << targetDoc; error = deepin_reader::Document::ConvertFailed; *pprocess = nullptr; return nullptr; } if (!QDir(convertedFileDir + "/word").exists()) { - qCritical() << "Unzip failed! Directory not found:" << (convertedFileDir + "/word"); + qCCritical(appLog) << "Unzip failed! Directory not found:" << (convertedFileDir + "/word"); error = deepin_reader::Document::ConvertFailed; if (!(QProcess::CrashExit == decompressor.exitStatus() && 9 == decompressor.exitCode())) { *pprocess = nullptr; @@ -225,20 +225,20 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int & qCDebug(appLog) << "执行命令: pandoc" << pandocArgs; converter.start("pandoc", pandocArgs); if (!converter.waitForStarted()) { - qCritical() << "Failed to start pandoc conversion process"; + qCCritical(appLog) << "Failed to start pandoc conversion process"; error = deepin_reader::Document::ConvertFailed; *pprocess = nullptr; return nullptr; } if (!converter.waitForFinished(pandocTimeout)) { - qCritical() << "Pandoc conversion process failed"; + qCCritical(appLog) << "Pandoc conversion process failed"; error = deepin_reader::Document::ConvertFailed; *pprocess = nullptr; return nullptr; } QFile tmpHtmlFile(tmpHtmlFilePath); if (!tmpHtmlFile.exists()) { - qCritical() << "Pandoc conversion failed! Output file not found:" << tmpHtmlFilePath; + qCCritical(appLog) << "Pandoc conversion failed! Output file not found:" << tmpHtmlFilePath; error = deepin_reader::Document::ConvertFailed; // 转换过程中关闭应用,docsheet被释放,对应的*pprocess已不存在 if (!(QProcess::CrashExit == converter.exitStatus() && 9 == converter.exitCode())) { @@ -259,13 +259,13 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int & qCDebug(appLog) << "执行命令:" << getHtmlToPdfPath() << htmltopdfArgs; converter2.start(getHtmlToPdfPath(), htmltopdfArgs); if (!converter2.waitForStarted()) { - qCritical() << "Failed to start htmltopdf conversion process"; + qCCritical(appLog) << "Failed to start htmltopdf conversion process"; error = deepin_reader::Document::ConvertFailed; *pprocess = nullptr; return nullptr; } if (!converter2.waitForFinished(htmlToPdfTimeout)) { - qCritical() << "Htmltopdf conversion process failed"; + qCCritical(appLog) << "Htmltopdf conversion process failed"; error = deepin_reader::Document::ConvertFailed; *pprocess = nullptr; return nullptr; @@ -273,7 +273,7 @@ deepin_reader::Document *deepin_reader::DocumentFactory::getDocument(const int & QFile realFile(realFilePath); if (!realFile.exists()) { - qCritical() << "Htmltopdf conversion failed! Output file not found:" << realFilePath; + qCCritical(appLog) << "Htmltopdf conversion failed! Output file not found:" << realFilePath; error = deepin_reader::Document::ConvertFailed; if (!(QProcess::CrashExit == converter.exitStatus() && 9 == converter.exitCode())) { *pprocess = nullptr; diff --git a/reader/document/PDFModel.cpp b/reader/document/PDFModel.cpp index cd5595c5e..faf6ddafd 100644 --- a/reader/document/PDFModel.cpp +++ b/reader/document/PDFModel.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 -2026 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -397,7 +397,7 @@ Annotation *PDFPage::addIconAnnotation(const QRectF &rect, const QString &text) qCInfo(appLog) << "Adding icon annotation at rect:" << rect << "with text:" << text; if (nullptr == m_page) { - qCritical() << "Attempt to add icon annotation to null page"; + qCCritical(appLog) << "Attempt to add icon annotation to null page"; return nullptr; } @@ -409,7 +409,7 @@ Annotation *PDFPage::moveIconAnnotation(Annotation *annot, const QRectF &rect) qCInfo(appLog) << "Moving icon annotation to rect:" << rect; if (nullptr == m_page || nullptr == annot) { - qCritical() << "Attempt to move icon annotation with null page or annotation"; + qCCritical(appLog) << "Attempt to move icon annotation with null page or annotation"; return nullptr; } @@ -586,7 +586,7 @@ PDFDocument *PDFDocument::loadDocument(const QString &filePath, const QString &p error = Document::WrongPassword; } } else { - qCritical() << "Failed to load PDF document, error code:" << document->status(); + qCCritical(appLog) << "Failed to load PDF document, error code:" << document->status(); error = Document::FileError; } diff --git a/reader/sidebar/CatalogTreeView.cpp b/reader/sidebar/CatalogTreeView.cpp index 91d2e55c3..ddb4b6449 100644 --- a/reader/sidebar/CatalogTreeView.cpp +++ b/reader/sidebar/CatalogTreeView.cpp @@ -186,7 +186,7 @@ void CatalogTreeView::handleOpenSuccess() model->clear(); if (nullptr == m_sheet) { - qCritical() << "Cannot build catalog tree - document sheet is null"; + qCCritical(appLog) << "Cannot build catalog tree - document sheet is null"; return; } @@ -295,7 +295,7 @@ void CatalogTreeView::currentChanged(const QModelIndex ¤t, const QModelInd && !current.data(deepin_reader::CatalogNavigationRole).isValid()) { if (nullptr == m_sheet) { - qCritical() << "Cannot navigate - document sheet is null"; + qCCritical(appLog) << "Cannot navigate - document sheet is null"; return; } @@ -317,7 +317,7 @@ void CatalogTreeView::onItemClicked(const QModelIndex ¤t) qCDebug(appLog) << "Catalog item clicked:" << current.data().toString() << "page:" << current.data(Qt::UserRole + 1).toInt(); if (nullptr == m_sheet) { - qCritical() << "Cannot navigate to clicked item - document sheet is null"; + qCCritical(appLog) << "Cannot navigate to clicked item - document sheet is null"; return; } if (m_populating || !current.isValid()) diff --git a/reader/sidebar/CatalogWidget.cpp b/reader/sidebar/CatalogWidget.cpp index 1071b9579..4392da348 100644 --- a/reader/sidebar/CatalogWidget.cpp +++ b/reader/sidebar/CatalogWidget.cpp @@ -90,7 +90,7 @@ void CatalogWidget::handleOpenSuccess() qCDebug(appLog) << "Handling document open success, loading catalog"; if (nullptr == m_sheet) { - qCritical() << "Cannot load catalog - document sheet is null"; + qCCritical(appLog) << "Cannot load catalog - document sheet is null"; return; } if (bIshandOpenSuccess) {