diff --git a/src/src/closedialog.cpp b/src/src/closedialog.cpp index cc62e533..0bd589a4 100644 --- a/src/src/closedialog.cpp +++ b/src/src/closedialog.cpp @@ -1,5 +1,5 @@ -// Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// Copyright (C) 2020 - 2026 Uniontech Software Technology Co.,Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -17,6 +17,8 @@ #include #endif #include +#include "ddlog.h" +using namespace DDLog; DWIDGET_USE_NAMESPACE @@ -25,7 +27,7 @@ typedef DLabel QLbtoDLabel; CloseDialog::CloseDialog(QWidget *parent, QString strText) : DDialog(parent), m_leftNamebtn(tr("Cancel")), m_rightNamebtn(tr("Close")) { - qDebug() << "Function started: CloseDialog constructor"; + qCDebug(appLog) << "Function started: CloseDialog constructor"; this->setIcon(QIcon(":/images/icons/warning.svg")); setFixedSize(380, 140); m_widget = new DWidget(this); @@ -64,5 +66,5 @@ CloseDialog::CloseDialog(QWidget *parent, QString strText) setTabOrder(windowCloseBtn, cancelBtn); setTabOrder(cancelBtn, closeBtn); - qDebug() << "Function completed: CloseDialog constructor"; + qCDebug(appLog) << "Function completed: CloseDialog constructor"; } diff --git a/src/src/devnummonitor.cpp b/src/src/devnummonitor.cpp index f21e731d..e9974b2f 100644 --- a/src/src/devnummonitor.cpp +++ b/src/src/devnummonitor.cpp @@ -1,11 +1,13 @@ -// Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// Copyright (C) 2020 - 2026 Uniontech Software Technology Co.,Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #include "devnummonitor.h" #include +#include "ddlog.h" +using namespace DDLog; extern "C" { @@ -15,7 +17,7 @@ extern "C" DevNumMonitor::DevNumMonitor() { - qDebug() << "Initializing DevNumMonitor"; + qCDebug(appLog) << "Initializing DevNumMonitor"; m_noDevice = false; m_pTimer = nullptr; } @@ -26,12 +28,12 @@ DevNumMonitor::DevNumMonitor() */ void DevNumMonitor::startCheck() { - qDebug() << "Starting device number monitoring"; + qCDebug(appLog) << "Starting device number monitoring"; m_pTimer = new QTimer; m_pTimer->setInterval(500); connect(m_pTimer, &QTimer::timeout, this, &DevNumMonitor::timeOutSlot); m_pTimer->start(); - qDebug() << "Device monitoring timer started with 500ms interval"; + qCDebug(appLog) << "Device monitoring timer started with 500ms interval"; } //void DevNumMonitor::run() @@ -59,7 +61,7 @@ void DevNumMonitor::timeOutSlot() if (deviceCount < 1) { if (!m_noDevice) { - qWarning() << "No camera devices found"; + qCWarning(appLog) << "No camera devices found"; emit noDeviceFound(); m_noDevice = true; } @@ -67,7 +69,7 @@ void DevNumMonitor::timeOutSlot() if (m_noDevice) { v4l2_dev_sys_data_t *v4l2_devices = get_device_list()->list_devices; if (v4l2_devices) { - qWarning() << "Device found:" << v4l2_devices[0].device << v4l2_devices[0].name; + qCWarning(appLog) << "Device found:" << v4l2_devices[0].device << v4l2_devices[0].name; } } m_noDevice = false; @@ -83,9 +85,9 @@ void DevNumMonitor::timeOutSlot() DevNumMonitor::~DevNumMonitor() { - qDebug() << "Destroying DevNumMonitor"; + qCDebug(appLog) << "Destroying DevNumMonitor"; if (nullptr != m_pTimer) { - qDebug() << "Stopping and cleaning up monitoring timer"; + qCDebug(appLog) << "Stopping and cleaning up monitoring timer"; m_pTimer->stop(); m_pTimer->deleteLater(); m_pTimer = nullptr; diff --git a/src/src/exposureslider.cpp b/src/src/exposureslider.cpp index 7847ff63..3e5d93e9 100644 --- a/src/src/exposureslider.cpp +++ b/src/src/exposureslider.cpp @@ -15,6 +15,8 @@ #include #include +#include "ddlog.h" +using namespace DDLog; #define WIDTH 40 #define HEIGHT 192 @@ -28,7 +30,7 @@ ExposureSlider::ExposureSlider(QWidget *parent) : QWidget(parent) ,m_curValue(0) ,m_opacity(102) //UI默认 { - qDebug() << "Initializing ExposureSlider"; + qCDebug(appLog) << "Initializing ExposureSlider"; resize(WIDTH, HEIGHT); QVBoxLayout *vLayout = new QVBoxLayout(this); vLayout->setContentsMargins(0, 0, 0, 0); @@ -54,7 +56,7 @@ ExposureSlider::ExposureSlider(QWidget *parent) : QWidget(parent) m_pLabShowValue->setPalette(pa); //字体大小不随系统变化 connect(qApp, &QGuiApplication::fontChanged, this, [=](){ - qDebug() << "Updating font settings for value display"; + qCDebug(appLog) << "Updating font settings for value display"; QFont font("SourceHanSansSC"); font.setPixelSize(15); font.setWeight(QFont::Medium); @@ -82,19 +84,19 @@ ExposureSlider::ExposureSlider(QWidget *parent) : QWidget(parent) m_pLabShowValue->hide(); m_slider->hide(); - qDebug() << "ExposureSlider initialization completed"; + qCDebug(appLog) << "ExposureSlider initialization completed"; } void ExposureSlider::setOpacity(int opacity) { - qDebug() << "Setting slider opacity to:" << opacity; + qCDebug(appLog) << "Setting slider opacity to:" << opacity; m_opacity = opacity; update(); } void ExposureSlider::showContent(bool show, bool isShortCut) { - qDebug() << "Showing exposure slider content:" << show << "isShortCut:" << isShortCut; + qCDebug(appLog) << "Showing exposure slider content:" << show << "isShortCut:" << isShortCut; QGraphicsOpacityEffect *effectSlider = new QGraphicsOpacityEffect(m_slider); m_slider->setGraphicsEffect(effectSlider); QPropertyAnimation *opacity = new QPropertyAnimation(effectSlider, "opacity", this); @@ -112,14 +114,14 @@ void ExposureSlider::showContent(bool show, bool isShortCut) pGroup->addAnimation(opacity1); if (show) { - qDebug() << "Condition check: Showing content (fade in)"; + qCDebug(appLog) << "Condition check: Showing content (fade in)"; opacity->setStartValue(0); opacity->setEndValue(1); opacity1->setStartValue(0); opacity1->setEndValue(1); connect(pGroup, &QParallelAnimationGroup::finished, this, [=](){ - qDebug() << "Animation finished, handling cleanup"; + qCDebug(appLog) << "Animation finished, handling cleanup"; m_slider->slider()->setFocus(); pGroup->deleteLater(); }); @@ -128,7 +130,7 @@ void ExposureSlider::showContent(bool show, bool isShortCut) m_slider->show(); pGroup->start(); } else { - qDebug() << "Condition check: Hiding content (fade out)"; + qCDebug(appLog) << "Condition check: Hiding content (fade out)"; opacity->setStartValue(1); opacity->setEndValue(0); opacity1->setStartValue(1); @@ -136,7 +138,7 @@ void ExposureSlider::showContent(bool show, bool isShortCut) connect(pGroup, &QParallelAnimationGroup::finished, this, &ExposureSlider::contentHided); connect(pGroup, &QParallelAnimationGroup::finished, this, [=](){ - qDebug() << "Animation finished, hiding widgets"; + qCDebug(appLog) << "Animation finished, hiding widgets"; m_pLabShowValue->hide(); m_slider->hide(); pGroup->deleteLater(); @@ -144,7 +146,7 @@ void ExposureSlider::showContent(bool show, bool isShortCut) pGroup->start(); } - qDebug() << "Function completed: showContent"; + qCDebug(appLog) << "Function completed: showContent"; } void ExposureSlider::paintEvent(QPaintEvent *event) diff --git a/src/src/filterpreviewbutton.cpp b/src/src/filterpreviewbutton.cpp index 07bd90e7..cb403a8a 100644 --- a/src/src/filterpreviewbutton.cpp +++ b/src/src/filterpreviewbutton.cpp @@ -1,9 +1,11 @@ -// Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// Copyright (C) 2020 - 2026 Uniontech Software Technology Co.,Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #include "filterpreviewbutton.h" +#include "ddlog.h" +using namespace DDLog; extern "C" { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) @@ -32,11 +34,11 @@ DWIDGET_USE_NAMESPACE; filterPreviewButton::filterPreviewButton(QWidget *parent, efilterType filter/* = filter_Normal*/): QWidget(parent) , m_filterType(filter) { - qDebug() << "Function started: filterPreviewButton constructor"; + qCDebug(appLog) << "Function started: filterPreviewButton constructor"; QString objName = filterName_CUBE(filter); if (objName.isEmpty()) { - qDebug() << "Condition check: Filter name empty, using 'normal'"; + qCDebug(appLog) << "Condition check: Filter name empty, using 'normal'"; objName = "normal"; } setObjectName(objName); @@ -56,7 +58,7 @@ filterPreviewButton::filterPreviewButton(QWidget *parent, efilterType filter/* = setAutoFillBackground(false); resize(BUTTON_SIZE, BUTTON_SIZE); - qDebug() << "Function completed: filterPreviewButton constructor"; + qCDebug(appLog) << "Function completed: filterPreviewButton constructor"; } void filterPreviewButton::setbackground(QColor color) @@ -286,44 +288,44 @@ QString filterPreviewButton::filterName(efilterType type) QString name = tr("Normal"); switch (type) { case filter_Normal: - qDebug() << "Condition check: Normal filter"; + qCDebug(appLog) << "Condition check: Normal filter"; name = tr("Normal"); break; case filter_Vivid: - qDebug() << "Condition check: Vivid filter"; + qCDebug(appLog) << "Condition check: Vivid filter"; name = tr("Vivid"); break; case filter_Warm: - qDebug() << "Condition check: Warm filter"; + qCDebug(appLog) << "Condition check: Warm filter"; name = tr("Warm"); break; case filter_Cold: - qDebug() << "Condition check: Cold filter"; + qCDebug(appLog) << "Condition check: Cold filter"; name = tr("Cold"); break; case filter_Retro: - qDebug() << "Condition check: Retro filter"; + qCDebug(appLog) << "Condition check: Retro filter"; name = tr("Retro"); break; case filter_Film: - qDebug() << "Condition check: Film filter"; + qCDebug(appLog) << "Condition check: Film filter"; name = tr("Film"); break; case filter_Gray: - qDebug() << "Condition check: Gray filter"; + qCDebug(appLog) << "Condition check: Gray filter"; name = tr("Gray"); break; case filter_BAndW: - qDebug() << "Condition check: B&W filter"; + qCDebug(appLog) << "Condition check: B&W filter"; name = tr("B&W"); break; default: - qDebug() << "Condition check: Unknown filter type, using Normal"; + qCDebug(appLog) << "Condition check: Unknown filter type, using Normal"; name = tr("Normal"); break; } - qDebug() << "Function completed: filterName:" << name; + qCDebug(appLog) << "Function completed: filterName:" << name; return name; } @@ -333,43 +335,43 @@ QString filterPreviewButton::filterName_CUBE(efilterType type) QString name = ""; switch (type) { case filter_Normal: - qDebug() << "Condition check: Normal filter (no CUBE)"; + qCDebug(appLog) << "Condition check: Normal filter (no CUBE)"; name = ""; break; case filter_Vivid: - qDebug() << "Condition check: Vivid filter"; + qCDebug(appLog) << "Condition check: Vivid filter"; name = "bright"; break; case filter_Warm: - qDebug() << "Condition check: Warm filter"; + qCDebug(appLog) << "Condition check: Warm filter"; name = "warm"; break; case filter_Cold: - qDebug() << "Condition check: Cold filter"; + qCDebug(appLog) << "Condition check: Cold filter"; name = "cold"; break; case filter_Retro: - qDebug() << "Condition check: Retro filter"; + qCDebug(appLog) << "Condition check: Retro filter"; name = "classic"; break; case filter_Film: - qDebug() << "Condition check: Film filter"; + qCDebug(appLog) << "Condition check: Film filter"; name = "print"; break; case filter_Gray: - qDebug() << "Condition check: Gray filter"; + qCDebug(appLog) << "Condition check: Gray filter"; name = "gray"; break; case filter_BAndW: - qDebug() << "Condition check: B&W filter"; + qCDebug(appLog) << "Condition check: B&W filter"; name = "black"; break; default: - qDebug() << "Condition check: Unknown filter type, using empty"; + qCDebug(appLog) << "Condition check: Unknown filter type, using empty"; name = ""; break; } - qDebug() << "Function completed: filterName_CUBE:" << name; + qCDebug(appLog) << "Function completed: filterName_CUBE:" << name; return name; } diff --git a/src/src/globalutils.cpp b/src/src/globalutils.cpp index 72d9621d..ff23298e 100644 --- a/src/src/globalutils.cpp +++ b/src/src/globalutils.cpp @@ -12,6 +12,8 @@ #include #include #include +#include "ddlog.h" +using namespace DDLog; DCORE_USE_NAMESPACE @@ -83,7 +85,7 @@ bool GlobalUtils::isLowPerformanceBoard() QString systemInfoInterface = "com.deepin.system.SystemInfo"; auto ver = DSysInfo::majorVersion().toInt(); if (ver > 20) { - qDebug() << "Condition check: System version > 20, using newer D-Bus interface"; + qCDebug(appLog) << "Condition check: System version > 20, using newer D-Bus interface"; systemInfoService = "org.deepin.dde.SystemInfo1"; systemInfoPath = "/org/deepin/dde/SystemInfo1"; systemInfoInterface = "org.deepin.dde.SystemInfo1"; @@ -91,7 +93,7 @@ bool GlobalUtils::isLowPerformanceBoard() QDBusInterface *monitorInterface = new QDBusInterface(systemInfoService, systemInfoPath, "org.freedesktop.DBus.Properties", QDBusConnection::systemBus()); if (!monitorInterface->isValid()) { - qWarning() << "Failed to connect to system info D-Bus interface"; + qCWarning(appLog) << "Failed to connect to system info D-Bus interface"; return false; } @@ -100,32 +102,32 @@ bool GlobalUtils::isLowPerformanceBoard() replay.value().variant().value() >> dmiInfo; - qDebug() << "System DMI info - Product Name:" << dmiInfo.productName; - qDebug() << "System DMI info - Manufacturer:" << dmiInfo.Manufacturer; - qDebug() << "System DMI info - Version:" << dmiInfo.version; + qCDebug(appLog) << "System DMI info - Product Name:" << dmiInfo.productName; + qCDebug(appLog) << "System DMI info - Manufacturer:" << dmiInfo.Manufacturer; + qCDebug(appLog) << "System DMI info - Version:" << dmiInfo.version; // BXC 600F/NZ2750、CC GWMNDA1GL1等主板不能满足mp4封装的性能要求,因此需要特殊适配 for (auto board : m_LowPerformanceBoards) { if (dmiInfo.productName.contains(board)) { - qInfo() << "Detected low performance board:" << board; + qCInfo(appLog) << "Detected low performance board:" << board; return true; } } - qDebug() << "No low performance board detected"; + qCDebug(appLog) << "No low performance board detected"; return false; } void GlobalUtils::loadCameraConf() { - qDebug() << "Loading camera configuration from:" << CAMERA_CONF_PATH; + qCDebug(appLog) << "Loading camera configuration from:" << CAMERA_CONF_PATH; QSettings conf(CAMERA_CONF_PATH, QSettings::IniFormat); QVariant value = conf.value(LOW_PERFORMANCE_BOARD); if (value.isValid()) { - qDebug() << "Condition check: Configuration value valid"; + qCDebug(appLog) << "Condition check: Configuration value valid"; m_LowPerformanceBoards = value.toStringList(); } else { - qWarning() << "No low performance boards configuration found in" << CAMERA_CONF_PATH; + qCWarning(appLog) << "No low performance boards configuration found in" << CAMERA_CONF_PATH; m_LowPerformanceBoards = QStringList(); } @@ -137,5 +139,5 @@ void GlobalUtils::loadCameraConf() m_IsLowPerformanceDevice = dconfig->value("isLowPerformanceDevice").toBool(); } #endif - qDebug() << "Function completed: loadCameraConf"; + qCDebug(appLog) << "Function completed: loadCameraConf"; } diff --git a/src/src/gstvideowriter.cpp b/src/src/gstvideowriter.cpp index 4a9326b7..2a4b61bb 100644 --- a/src/src/gstvideowriter.cpp +++ b/src/src/gstvideowriter.cpp @@ -1,10 +1,12 @@ -// Copyright (C) 2021 ~ 2022 Uniontech Software Technology Co.,Ltd. -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// Copyright (C) 2021 - 2026 Uniontech Software Technology Co.,Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later #include "gstvideowriter.h" #include +#include "ddlog.h" +using namespace DDLog; extern "C" { #include #include "v4l2_core.h" @@ -125,152 +127,152 @@ GstVideoWriter::~GstVideoWriter() void GstVideoWriter::start() { - qDebug() << "Function started: start"; + qCDebug(appLog) << "Function started: start"; // 设置视频帧数据格式 loadAppSrcCaps(); #if defined(__mips__) || defined(__aarch64__) // mips/arm下,牺牲了成像质量 - qDebug() << "Condition check: MIPS/ARM architecture detected, adjusting quantizer"; + qCDebug(appLog) << "Condition check: MIPS/ARM architecture detected, adjusting quantizer"; if (m_nWidth >= 1920) { - qDebug() << "Condition check: High resolution (>=1920), setting quantizer to 30"; + qCDebug(appLog) << "Condition check: High resolution (>=1920), setting quantizer to 30"; setQuantizer(30); } else if (m_nWidth >= 1280) { - qDebug() << "Condition check: Medium resolution (>=1280), setting quantizer to 10"; + qCDebug(appLog) << "Condition check: Medium resolution (>=1280), setting quantizer to 10"; setQuantizer(10); } else { - qDebug() << "Condition check: Low resolution, setting quantizer to 5"; + qCDebug(appLog) << "Condition check: Low resolution, setting quantizer to 5"; setQuantizer(5); } #endif // 启动管道 - qDebug() << "Starting GStreamer pipeline"; + qCDebug(appLog) << "Starting GStreamer pipeline"; g_mvideo_gst_element_set_state(m_pipeline, GST_STATE_PLAYING); // 将录制任务放到线程中运行,bus回调收到eos信号,结束录制任务 - qDebug() << "Running main loop in separate thread"; + qCDebug(appLog) << "Running main loop in separate thread"; QtConcurrent::run(g_main_loop_run, m_gloop); - qDebug() << "Function completed: start"; + qCDebug(appLog) << "Function completed: start"; } void GstVideoWriter::stop() { - qDebug() << "Function started: stop"; + qCDebug(appLog) << "Function started: stop"; GstFlowReturn ret; // 停止音频流 if (m_audsrc) { - qDebug() << "Condition check: Stopping audio stream"; + qCDebug(appLog) << "Condition check: Stopping audio stream"; g_signal_emit_by_name(m_audsrc, "end-of-stream", &ret); } // 停止视频流 if (m_appsrc) { - qDebug() << "Condition check: Stopping video stream"; + qCDebug(appLog) << "Condition check: Stopping video stream"; g_signal_emit_by_name(m_appsrc, "end-of-stream", &ret); } - qDebug() << "Function completed: stop"; + qCDebug(appLog) << "Function completed: stop"; } void GstVideoWriter::setVideoPath(const QString &videoPath) { - qDebug() << "Function started: setVideoPath"; + qCDebug(appLog) << "Function started: setVideoPath"; if (!videoPath.isEmpty() && m_videoPath != videoPath) m_videoPath = videoPath; if (m_filesink) g_object_set(m_filesink, "location", videoPath.toStdString().c_str(), NULL); - qDebug() << "Function completed: setVideoPath"; + qCDebug(appLog) << "Function completed: setVideoPath"; } void GstVideoWriter::setQuantizer(uint quantizer) { - qDebug() << "Function started: setQuantizer"; + qCDebug(appLog) << "Function started: setQuantizer"; m_nQuantizer = quantizer; if (m_vp8enc) g_object_set(m_vp8enc, "min-quantizer", m_nQuantizer, NULL); - qDebug() << "Function completed: setQuantizer"; + qCDebug(appLog) << "Function completed: setQuantizer"; } bool GstVideoWriter::writeFrame(uchar *rgb, uint size) { - qDebug() << "Function started: writeFrame"; + qCDebug(appLog) << "Function started: writeFrame"; GstFlowReturn ret = GST_FLOW_CUSTOM_ERROR; guint8 *ptr = (guint8 *)g_malloc(size * sizeof(uchar)); if (ptr) { - qDebug() << "Condition check: Memory allocation successful"; + qCDebug(appLog) << "Condition check: Memory allocation successful"; memcpy(ptr, rgb, size); GstBuffer *buffer = g_mvideo_gst_buffer_new_wrapped((void*)ptr, size); //设置时间戳 if (m_pipeline) { - qDebug() << "Condition check: Setting timestamp for video buffer"; + qCDebug(appLog) << "Condition check: Setting timestamp for video buffer"; GST_BUFFER_PTS(buffer) = g_mvideo_gst_clock_get_time(m_pipeline->clock) - m_pipeline->base_time; } //注入视频帧数据 if (m_appsrc) { - qDebug() << "Condition check: Pushing video buffer to app source"; + qCDebug(appLog) << "Condition check: Pushing video buffer to app source"; g_signal_emit_by_name(m_appsrc, "push-buffer", buffer, &ret); } g_mvideo_gst_mini_object_unref(GST_MINI_OBJECT_CAST(buffer)); } - qDebug() << "Function completed: writeFrame, result:" << (ret == GST_FLOW_OK ? "success" : "failed"); + qCDebug(appLog) << "Function completed: writeFrame, result:" << (ret == GST_FLOW_OK ? "success" : "failed"); return ret == GST_FLOW_OK; } bool GstVideoWriter::writeAudio(uchar *audio, uint size) { - qDebug() << "Function started: writeAudio"; + qCDebug(appLog) << "Function started: writeAudio"; GstFlowReturn ret = GST_FLOW_CUSTOM_ERROR; guint8 *ptr = (guint8 *)g_malloc(size * sizeof(uchar)); if (ptr) { - qDebug() << "Condition check: Memory allocation successful"; + qCDebug(appLog) << "Condition check: Memory allocation successful"; memcpy(ptr, audio, size); GstBuffer *buffer = g_mvideo_gst_buffer_new_wrapped((void*)ptr, size); // 设置时间戳 if (m_pipeline) { - qDebug() << "Condition check: Setting timestamp for audio buffer"; + qCDebug(appLog) << "Condition check: Setting timestamp for audio buffer"; GST_BUFFER_PTS(buffer) = g_mvideo_gst_clock_get_time(m_pipeline->clock) - m_pipeline->base_time; } // 注入音频帧数据 if (m_audsrc) { - qDebug() << "Condition check: Pushing audio buffer to audio source"; + qCDebug(appLog) << "Condition check: Pushing audio buffer to audio source"; g_signal_emit_by_name(m_audsrc, "push-buffer", buffer, &ret); } g_mvideo_gst_mini_object_unref(GST_MINI_OBJECT_CAST(buffer)); } - qDebug() << "Function completed: writeAudio, result:" << (ret == GST_FLOW_OK ? "success" : "failed"); + qCDebug(appLog) << "Function completed: writeAudio, result:" << (ret == GST_FLOW_OK ? "success" : "failed"); return ret == GST_FLOW_OK; } float GstVideoWriter::getRecrodTime() { - qDebug() << "Function started: getRecrodTime"; + qCDebug(appLog) << "Function started: getRecrodTime"; float pts = 0; if (m_pipeline) { - qDebug() << "Condition check: Pipeline exists, getting timestamp"; + qCDebug(appLog) << "Condition check: Pipeline exists, getting timestamp"; pts = g_mvideo_gst_clock_get_time(m_pipeline->clock) - m_pipeline->base_time; } float result = pts / 1000 / 1000 / 1000; - qDebug() << "Function completed: getRecrodTime, result:" << result << "seconds"; + qCDebug(appLog) << "Function completed: getRecrodTime, result:" << result << "seconds"; return result; } void GstVideoWriter::init() { - qDebug() << "Function started: init"; + qCDebug(appLog) << "Function started: init"; g_mvideo_gst_init(nullptr, nullptr); // 使用vp8编码录制视频裸流数据、使用vorbis编码录制音频裸流数据 QString pipDesc = QString("webmmux name=mux ! filesink name=filename " @@ -291,14 +293,14 @@ void GstVideoWriter::init() m_bus = g_mvideo_gst_pipeline_get_bus(getGstPipline(m_pipeline)); if (m_bus) { - qDebug() << "Condition check: Bus exists, adding message watch"; + qCDebug(appLog) << "Condition check: Bus exists, adding message watch"; g_mvideo_gst_bus_add_watch(m_bus, (GstBusFunc)bus_message, this); } /* 设置视频src属性 */ m_appsrc = g_mvideo_gst_bin_get_by_name(getGstBin(m_pipeline), "source"); if (m_appsrc) { - qDebug() << "Condition check: Video app source exists, configuring properties"; + qCDebug(appLog) << "Condition check: Video app source exists, configuring properties"; loadAppSrcCaps(); g_object_set(m_appsrc, "format", GST_FORMAT_TIME, NULL); g_object_set(m_appsrc, "is-live", TRUE, NULL); @@ -307,7 +309,7 @@ void GstVideoWriter::init() /* 设置音频src属性 */ m_audsrc = g_mvideo_gst_bin_get_by_name(getGstBin(m_pipeline), "audiosource"); if (m_audsrc) { - qDebug() << "Condition check: Audio app source exists, configuring properties"; + qCDebug(appLog) << "Condition check: Audio app source exists, configuring properties"; GstCaps *audiocaps = g_mvideo_gst_caps_new_simple("audio/x-raw", "format", G_TYPE_STRING, "F32LE", "layout", G_TYPE_STRING, "interleaved", @@ -319,17 +321,17 @@ void GstVideoWriter::init() g_object_set(m_audsrc, "is-live", TRUE, NULL); } - qDebug() << "Function completed: init"; + qCDebug(appLog) << "Function completed: init"; } void GstVideoWriter::loadAppSrcCaps() { - qDebug() << "Function started: loadAppSrcCaps"; + qCDebug(appLog) << "Function started: loadAppSrcCaps"; // 获取当前相机分辨率 m_nWidth = v4l2core_get_frame_width(get_v4l2_device_handler()); m_nHeight = v4l2core_get_frame_height(get_v4l2_device_handler()); if (m_nWidth > 0 && m_nHeight > 0 && m_appsrc) { - qDebug() << "Condition check: Valid resolution and app source exist, setting caps"; + qCDebug(appLog) << "Condition check: Valid resolution and app source exist, setting caps"; GstCaps *caps = g_mvideo_gst_caps_new_simple("video/x-raw", "format", G_TYPE_STRING, "RGB", "width", G_TYPE_INT, m_nWidth, @@ -339,7 +341,7 @@ void GstVideoWriter::loadAppSrcCaps() g_mvideo_gst_app_src_set_caps(getGstAppSrc(m_appsrc), caps); } - qDebug() << "Function completed: loadAppSrcCaps"; + qCDebug(appLog) << "Function completed: loadAppSrcCaps"; } QString GstVideoWriter::libPath(const QString &strlib) diff --git a/src/src/imageitem.cpp b/src/src/imageitem.cpp index daf4653f..32835ce0 100644 --- a/src/src/imageitem.cpp +++ b/src/src/imageitem.cpp @@ -29,6 +29,8 @@ #include #include #include +#include "ddlog.h" +using namespace DDLog; extern "C" { #include @@ -104,7 +106,7 @@ ImageItem::ImageItem(QWidget *parent) m_menu->exec(QCursor::pos()); } #endif - qDebug() << "Click the right mouse to open the thumbnail menu bar"; + qCDebug(appLog) << "Click the right mouse to open the thumbnail menu bar"; }); connect(m_actCopy, &QAction::triggered, this, &ImageItem::onCopy); connect(m_actOpenFolder, &QAction::triggered, this, &ImageItem::onOpenFolder); @@ -119,14 +121,14 @@ ImageItem::ImageItem(QWidget *parent) void ImageItem::updatePicPath(const QString &filePath) { - qDebug() << "Updating picture path:" << filePath; + qCDebug(appLog) << "Updating picture path:" << filePath; m_path = filePath; QPixmap pix; QFileInfo fileInfo(filePath); if (fileInfo.suffix() == "webm" || fileInfo.suffix() == "mp4") { m_bVideo = true; - qDebug() << "Processing video file:" << filePath; + qCDebug(appLog) << "Processing video file:" << filePath; if (DataManager::instance()->encodeEnv() == FFmpeg_Env) { video_thumbnailer *m_video_thumbnailer = getLoadLibsInstance()->m_video_thumbnailer(); image_data *m_image_data = getLoadLibsInstance()->m_video_thumbnailer_create_image_data(); @@ -139,7 +141,7 @@ void ImageItem::updatePicPath(const QString &filePath) pix = QPixmap::fromImage(img); malloc_trim(0); } catch (...) { - qWarning() << "Failed to generate video thumbnail for:" << filePath; + qCWarning(appLog) << "Failed to generate video thumbnail for:" << filePath; } getLoadLibsInstance()->m_video_thumbnailer_destroy_image_data(m_image_data); @@ -150,7 +152,7 @@ void ImageItem::updatePicPath(const QString &filePath) } } else if (fileInfo.suffix() == "jpg") { m_bVideo = false; - qInfo() << "Processing image file:" << filePath; + qCInfo(appLog) << "Processing image file:" << filePath; QImage img(filePath); if (img.isNull()) { img.load(filePath); @@ -159,19 +161,19 @@ void ImageItem::updatePicPath(const QString &filePath) pix = QPixmap::fromImage(img); malloc_trim(0); } else { - qWarning() << "Unsupported file format:" << fileInfo.suffix(); + qCWarning(appLog) << "Unsupported file format:" << fileInfo.suffix(); pix = QPixmap(); } QTimer::singleShot(500, this, [ = ]() { updatePic(pix); pix.scaled(this->size(), Qt::KeepAspectRatio); }); - qDebug() << "Function completed: updatePicPath"; + qCDebug(appLog) << "Function completed: updatePicPath"; } void ImageItem::updatePic(QPixmap pixmap) { - qDebug() << "Function started: updatePic"; + qCDebug(appLog) << "Function started: updatePic"; m_pAniWidget->setVisible(true); m_pAniWidget->setPixmap(pixmap); @@ -190,7 +192,7 @@ void ImageItem::updatePic(QPixmap pixmap) update(); m_pAniWidget->setVisible(false); }); - qDebug() << "Function completed: updatePic"; + qCDebug(appLog) << "Function completed: updatePic"; } void ImageItem::paintEvent(QPaintEvent *event) @@ -310,41 +312,41 @@ void ImageItem::focusOutEvent(QFocusEvent *event) void ImageItem::onShowMenu() { - qDebug() << "Function started: onShowMenu"; + qCDebug(appLog) << "Function started: onShowMenu"; QPoint centerpos(width() / 2, height() / 2); QPoint screen_centerpos = mapToGlobal(centerpos); if (m_bVideo) { - qDebug() << "ImageItem::onShowMenu: Enter if branch (video mode, removing print action)"; + qCDebug(appLog) << "ImageItem::onShowMenu: Enter if branch (video mode, removing print action)"; m_menu->removeAction(m_actPrint); } else { - qDebug() << "ImageItem::onShowMenu: Enter else branch (image mode, inserting print action)"; + qCDebug(appLog) << "ImageItem::onShowMenu: Enter else branch (image mode, inserting print action)"; m_menu->insertAction(m_actOpenFolder, m_actPrint); } #ifndef UNITTEST if (!m_path.isEmpty()) { - qDebug() << "ImageItem::onShowMenu: Enter if branch (path not empty, executing menu)"; + qCDebug(appLog) << "ImageItem::onShowMenu: Enter if branch (path not empty, executing menu)"; m_menu->exec(screen_centerpos); } #endif - qDebug() << "Function completed: onShowMenu"; + qCDebug(appLog) << "Function completed: onShowMenu"; } void ImageItem::onOpenFolder() { - qDebug() << "Function started: onOpenFolder"; + qCDebug(appLog) << "Function started: onOpenFolder"; if (!m_path.isEmpty() && m_path == '~') { - qDebug() << "ImageItem::onOpenFolder: Enter if branch (path is home shortcut)"; + qCDebug(appLog) << "ImageItem::onOpenFolder: Enter if branch (path is home shortcut)"; //这里不能直接使用strFolder调replace函数 m_path.replace(0, 1, QDir::homePath()); } QString path = QFileInfo(m_path).absolutePath(); Dtk::Widget::DDesktopServices::showFolder(path); - qDebug() << "Click the right mouse or press the shortcut to open the folder"; + qCDebug(appLog) << "Click the right mouse or press the shortcut to open the folder"; } void ImageItem::initShortcut() { - qDebug() << "Function started: initShortcut"; + qCDebug(appLog) << "Function started: initShortcut"; QShortcutEx *shortcutCopy = new QShortcutEx(QKeySequence("ctrl+c"), this); shortcutCopy->setObjectName(SHORTCUT_COPY); connect(shortcutCopy, SIGNAL(activated()), this, SLOT(onCopy())); @@ -364,16 +366,16 @@ void ImageItem::initShortcut() QShortcutEx *shortcutPrint = new QShortcutEx(QKeySequence("Ctrl+P"), this); shortcutPrint->setObjectName(SHORTCUT_PRINT); connect(shortcutPrint, SIGNAL(activated()), this, SLOT(onPrint())); - qDebug() << "Function completed: initShortcut"; + qCDebug(appLog) << "Function completed: initShortcut"; } void ImageItem::openFile() { - qDebug() << "Function started: openFile"; + qCDebug(appLog) << "Function started: openFile"; const QString filePath = m_path; QFileInfo fileInfo(filePath); if (filePath.isEmpty()) { - qWarning() << "Cannot open file: path is empty"; + qCWarning(appLog) << "Cannot open file: path is empty"; return; } @@ -384,20 +386,20 @@ void ImageItem::openFile() QStringList arguments; bool opened = false; - qDebug() << "Using backup method to open file"; + qCDebug(appLog) << "Using backup method to open file"; if (fileInfo.suffix() == "jpg") { program = "deepin-image-viewer"; //用看图打开 arguments << filePath; - qDebug() << "Attempting to open image with deepin-image-viewer"; + qCDebug(appLog) << "Attempting to open image with deepin-image-viewer"; } else { program = "deepin-movie"; //用影院打开 arguments << filePath; - qDebug() << "Attempting to open video with deepin-movie"; + qCDebug(appLog) << "Attempting to open video with deepin-movie"; } opened = myProcess->startDetached(program, arguments); if (!opened) { //打开失败,调用文管选择"打开方式"窗口 - qWarning() << "Failed to open file with default applications, trying file manager"; + qCWarning(appLog) << "Failed to open file with default applications, trying file manager"; arguments.clear(); program = "dde-file-manager"; arguments << "-o" << filePath; @@ -412,7 +414,7 @@ void ImageItem::openFile() const int osMajor = DSysInfo::majorVersion().toInt(); if (osMajor >= kMinOsEdition) { - qInfo() << "Using DBus to open file on OS v23+"; + qCInfo(appLog) << "Using DBus to open file on OS v23+"; //玲珑环境下无法通过QProcess方式打开应用,通过DBus打开 if (fileInfo.suffix() == "jpg") { //用看图打开 @@ -428,9 +430,9 @@ void ImageItem::openFile() ok = retMessage.arguments().value(0).toBool(); } if (ok) { - qDebug() << "Successfully opened image with deepin-image-viewer via DBus"; + qCDebug(appLog) << "Successfully opened image with deepin-image-viewer via DBus"; } else { - qWarning() << "Failed to open image with deepin-image-viewer via DBus:" << retMessage.errorMessage(); + qCWarning(appLog) << "Failed to open image with deepin-image-viewer via DBus:" << retMessage.errorMessage(); openWithBackup(); } watcher->deleteLater(); @@ -444,7 +446,7 @@ void ImageItem::openFile() << "org.deepin.movie" << "--" << "deepin-movie" << m_path; - qDebug() << "[process] Open it with deepin-movie (ll-cli)"; + qCDebug(appLog) << "[process] Open it with deepin-movie (ll-cli)"; ret = myProcess->startDetached(program, arguments); #else QDBusMessage message = QDBusMessage::createMethodCall("com.deepin.movie", "/", "com.deepin.movie", "openFile"); @@ -454,9 +456,9 @@ void ImageItem::openFile() connect(watcher, &QDBusPendingCallWatcher::finished, this, [watcher, openWithBackup]() { const QDBusMessage retMessage = watcher->reply(); if (retMessage.type() != QDBusMessage::ErrorMessage) { - qDebug() << "Successfully opened video with deepin-movie via DBus"; + qCDebug(appLog) << "Successfully opened video with deepin-movie via DBus"; } else { - qWarning() << "Failed to open video with deepin-movie via DBus:" << retMessage.errorMessage(); + qCWarning(appLog) << "Failed to open video with deepin-movie via DBus:" << retMessage.errorMessage(); openWithBackup(); } watcher->deleteLater(); @@ -472,12 +474,12 @@ void ImageItem::openFile() if (CamApp->isPanelEnvironment()) CamApp->getMainWindow()->showMinimized(); - qDebug() << "Function completed: openFile"; + qCDebug(appLog) << "Function completed: openFile"; } void ImageItem::onCopy() { - qDebug() << "Function started: onCopy"; + qCDebug(appLog) << "Function started: onCopy"; QStringList paths; paths << m_path; @@ -502,38 +504,38 @@ void ImageItem::onCopy() newMimeData->setData("x-special/gnome-copied-files", gnomeFormat); cb->setMimeData(newMimeData, QClipboard::Clipboard); - qDebug() << "Function completed: onCopy"; + qCDebug(appLog) << "Function completed: onCopy"; } void ImageItem::onShortcutDel() { - qDebug() << "Delete shortcut triggered"; + qCDebug(appLog) << "Delete shortcut triggered"; //改用datetime,避免跨天之后判断错误 QDateTime timeNow = QDateTime::currentDateTime(); if (m_lastDelTime.msecsTo(timeNow) < 100) { - qWarning() << "Delete operation too frequent, ignoring"; + qCWarning(appLog) << "Delete operation too frequent, ignoring"; return; } m_lastDelTime = timeNow; emit trashFile(m_path); - qDebug() << "Function completed: onShortcutDel"; + qCDebug(appLog) << "Function completed: onShortcutDel"; } void ImageItem::onPrint() { - qDebug() << "Function started: onPrint"; + qCDebug(appLog) << "Function started: onPrint"; if (!m_bVideo) { - qDebug() << "ImageItem::onPrint: Enter if branch (not video, showing print dialog)"; + qCDebug(appLog) << "ImageItem::onPrint: Enter if branch (not video, showing print dialog)"; showPrintDialog(QStringList(m_path), this); } - qDebug() << "Function completed: onPrint"; + qCDebug(appLog) << "Function completed: onPrint"; } void ImageItem::showPrintDialog(const QStringList &paths, QWidget *parent) { - qDebug() << "Opening print dialog for" << paths.size() << "files"; + qCDebug(appLog) << "Opening print dialog for" << paths.size() << "files"; m_imgs.clear(); QStringList tempExistPaths; @@ -567,11 +569,11 @@ void ImageItem::showPrintDialog(const QStringList &paths, QWidget *parent) // 连接打印信号 if (useNewAPI && printDialog.setAsynPreview(m_imgs.size())) { - qDebug() << "Using async preview for printing"; + qCDebug(appLog) << "Using async preview for printing"; connect(&printDialog, SIGNAL(paintRequested(DPrinter *, const QVector &)), this, SLOT(paintRequestedAsyn(DPrinter *, const QVector &))); } else { - qDebug() << "Using sync preview for printing"; + qCDebug(appLog) << "Using sync preview for printing"; connect(&printDialog, SIGNAL(paintRequested(DPrinter *)), this, SLOT(paintRequestSync(DPrinter *))); } @@ -581,7 +583,7 @@ void ImageItem::showPrintDialog(const QStringList &paths, QWidget *parent) #else printDialog.show(); #endif - qDebug() << "Function completed: showPrintDialog"; + qCDebug(appLog) << "Function completed: showPrintDialog"; } // 公共绘图方法 diff --git a/src/src/logconfigread.cpp b/src/src/logconfigread.cpp index bdfaf334..9b260a8e 100644 --- a/src/src/logconfigread.cpp +++ b/src/src/logconfigread.cpp @@ -21,18 +21,19 @@ MLogger::MLogger(QObject *parent) // 保存环境变量中的规则 m_rules = logRules; // 从 DConfig 读取日志规则 - m_config = DConfig::create("org.deepin.camera", "org.deepin.camera.encode"); + m_config = DConfig::create("org.deepin.camera", "org.deepin.camera"); if (m_config && m_config->isValid()) { - logRules = m_config->value("rules").toByteArray(); + logRules = m_config->value("log_rules").toByteArray(); appendRules(logRules); - setRules(m_rules); // 监听 DConfig 变化,动态更新日志规则 connect(m_config, &DConfig::valueChanged, this, [this](const QString &key) { - if (key == "rules") { + if (key == "log_rules") { setRules(m_config->value(key).toByteArray()); } }); } + // DConfig 不可用时兜底:环境变量中的规则仍然生效 + setRules(m_rules); } MLogger::~MLogger() { diff --git a/src/src/mainwindow.cpp b/src/src/mainwindow.cpp index 95631a8d..0366c9e3 100755 --- a/src/src/mainwindow.cpp +++ b/src/src/mainwindow.cpp @@ -3,6 +3,8 @@ // // SPDX-License-Identifier: GPL-3.0-or-later +#include "ddlog.h" +using namespace DDLog; extern "C" { #include "v4l2_formats.h" } @@ -383,7 +385,7 @@ static QWidget *createPicSelectableLineEditOptionHandle(QObject *opt) } QString qlastPath = Settings::get().getOption("base.save.picdatapath").toString(); - qDebug() << QString("-----------------qlastPath: %1").arg(qlastPath); + qCDebug(appLog) << QString("-----------------qlastPath: %1").arg(qlastPath); QFileInfo fm(selectPicSavePath); @@ -445,10 +447,10 @@ static QWidget *createPicSelectableLineEditOptionHandle(QObject *opt) auto pi = ElideText(value.toString(), { pathEditWidth, tem_fontmetrics.height() }, QTextOption::WrapAnywhere, picPathLineEdit->font(), Qt::ElideMiddle, tem_fontmetrics.height(), pathEditWidth); picPathLineEdit->setText(pi); - qDebug() << "picPathLineEdit text:" << picPathLineEdit->text(); + qCDebug(appLog) << "picPathLineEdit text:" << picPathLineEdit->text(); lastPicPath = value.toString(); option->setValue(value.toString()); - qDebug() << "save pic last path:" << value.toString(); + qCDebug(appLog) << "save pic last path:" << value.toString(); picPathLineEdit->update(); }); @@ -715,10 +717,10 @@ static QWidget *createVdSelectableLineEditOptionHandle(QObject *opt) QTextOption::WrapAnywhere, videoPathLineEdit->font(), Qt::ElideMiddle, tem_fontmetrics.height(), pathEditWidth); videoPathLineEdit->setText(pi); - qDebug() << "picPathLineEdit text:" << videoPathLineEdit->text(); + qCDebug(appLog) << "picPathLineEdit text:" << videoPathLineEdit->text(); lastVideoPath = value.toString(); option->setValue(value.toString()); - qDebug() << "save video last path:" << value.toString(); + qCDebug(appLog) << "save video last path:" << value.toString(); videoPathLineEdit->update(); }); @@ -762,9 +764,9 @@ QString CMainWindow::lastOpenedPath(QStandardPaths::StandardLocation standard) QDir dirNew(lastPath); if (!dirNew.exists()) { if (!dirNew.mkdir(lastPath)) { - qWarning() << "make dir error:" << lastPath; + qCWarning(appLog) << "make dir error:" << lastPath; lastPath = QDir::currentPath(); //这是错误的路径,但肯定存在 - qDebug() << "now lastVdPath is:" << lastPath; + qCDebug(appLog) << "now lastVdPath is:" << lastPath; } } } @@ -791,7 +793,7 @@ CMainWindow::CMainWindow(QWidget *parent) m_bUIinit(false), m_windowStateThread(nullptr) { - qDebug() << "Function started: CMainWindow constructor"; + qCDebug(appLog) << "Function started: CMainWindow constructor"; m_cameraSwitchBtn = nullptr; m_photoRecordBtn = nullptr; m_modeSwitchBox = nullptr; @@ -816,18 +818,18 @@ CMainWindow::CMainWindow(QWidget *parent) //修复在性能较差的电脑上启动闪烁白框 initUI(); - qDebug() << "Function completed: CMainWindow constructor"; + qCDebug(appLog) << "Function completed: CMainWindow constructor"; } void CMainWindow::slotPopupSettingsDialog() { - qDebug() << "Function started: slotPopupSettingsDialog"; + qCDebug(appLog) << "Function started: slotPopupSettingsDialog"; #ifndef UNITTEST settingDialog(); m_SetDialog->exec(); settingDialogDel(); #endif - qDebug() << "Function completed: slotPopupSettingsDialog"; + qCDebug(appLog) << "Function completed: slotPopupSettingsDialog"; } QString CMainWindow::libPath(const QString &strlib) @@ -878,9 +880,9 @@ void CMainWindow::reflushSnapshotLabel() void CMainWindow::getMediaFileInfoList(const QString &path, QFileInfoList &fileList) { - qDebug() << "Function started: getMediaFileInfoList"; + qCDebug(appLog) << "Function started: getMediaFileInfoList"; if (path.isEmpty()) { - qDebug() << "path is empty, return."; + qCDebug(appLog) << "path is empty, return."; return; } @@ -890,15 +892,15 @@ void CMainWindow::getMediaFileInfoList(const QString &path, QFileInfoList &fileL dir.setNameFilters(filters); dir.setSorting(QDir::Time /*| QDir::Reversed*/); //按时间逆序排序 if (dir.exists()) { - qDebug() << "dir exists, get file list."; + qCDebug(appLog) << "dir exists, get file list."; fileList = dir.entryInfoList(); } - qDebug() << "Function completed: getMediaFileInfoList"; + qCDebug(appLog) << "Function completed: getMediaFileInfoList"; } void CMainWindow::initDynamicLibPath() { - qDebug() << "Function started: initDynamicLibPath"; + qCDebug(appLog) << "Function started: initDynamicLibPath"; LoadLibNames tmp; QByteArray avcodec = libPath("libavcodec.so").toLatin1(); tmp.chAvcodec = avcodec.data(); @@ -921,14 +923,14 @@ void CMainWindow::initDynamicLibPath() QByteArray swresample = libPath("libswresample.so").toLatin1(); tmp.chSwresample = swresample.data(); setLibNames(tmp); - qDebug() << "Function completed: initDynamicLibPath"; + qCDebug(appLog) << "Function completed: initDynamicLibPath"; } void CMainWindow::initBlockShutdown() { - qDebug() << "Function started: initBlockShutdown"; + qCDebug(appLog) << "Function started: initBlockShutdown"; if (!m_arg.isEmpty() || m_reply.value().isValid()) { - qInfo() << "m_reply.value().isValid():" << m_reply.value().isValid(); + qCInfo(appLog) << "m_reply.value().isValid():" << m_reply.value().isValid(); return; } @@ -951,16 +953,16 @@ void CMainWindow::initBlockShutdown() if (m_reply.isValid()) { QDBusReply tmp = m_reply; m_reply = QDBusReply(); - qDebug() << "init Unblock shutdown."; + qCDebug(appLog) << "init Unblock shutdown."; } - qDebug() << "Function completed: initBlockShutdown"; + qCDebug(appLog) << "Function completed: initBlockShutdown"; } void CMainWindow::initBlockSleep() { - qDebug() << "Function started: initBlockSleep"; + qCDebug(appLog) << "Function started: initBlockSleep"; if (!m_argSleep.isEmpty() || m_replySleep.value().isValid()) { - qInfo() << "m_reply.value().isValid():" << m_replySleep.value().isValid(); + qCInfo(appLog) << "m_reply.value().isValid():" << m_replySleep.value().isValid(); return; } @@ -983,14 +985,14 @@ void CMainWindow::initBlockSleep() if (m_replySleep.isValid()) { QDBusReply tmp = m_replySleep; m_replySleep = QDBusReply(); - qDebug() << "init Unblock sleep."; + qCDebug(appLog) << "init Unblock sleep."; } - qDebug() << "Function completed: initBlockSleep"; + qCDebug(appLog) << "Function completed: initBlockSleep"; } void CMainWindow::initTabOrder() { - qDebug() << "Function started: initTabOrder"; + qCDebug(appLog) << "Function started: initTabOrder"; m_windowMinBtn = m_pTitlebar->titlebar()->findChild("DTitlebarDWindowMinButton"); m_windowoptionButton = m_pTitlebar->titlebar()->findChild("DTitlebarDWindowOptionButton"); m_windowMaxBtn = m_pTitlebar->titlebar()->findChild("DTitlebarDWindowMaxButton"); @@ -1006,12 +1008,12 @@ void CMainWindow::initTabOrder() setTabOrder(m_windowMinBtn, m_windowMaxBtn); setTabOrder(m_windowMaxBtn, m_windowCloseBtn); setTabOrder(m_windowCloseBtn, m_takePhotoSettingArea); - qDebug() << "Function completed: initTabOrder"; + qCDebug(appLog) << "Function completed: initTabOrder"; } void CMainWindow::initEventFilter() { - qDebug() << "Function started: initEventFilter"; + qCDebug(appLog) << "Function started: initEventFilter"; /** * @brief windowMinBtn 最小化按钮 */ @@ -1049,12 +1051,12 @@ void CMainWindow::initEventFilter() if (m_videoPre) m_videoPre->installEventFilter(this); - qDebug() << "Function completed: initEventFilter"; + qCDebug(appLog) << "Function completed: initEventFilter"; } void CMainWindow::initShortcut() { - qDebug() << "Function started: initShortcut"; + qCDebug(appLog) << "Function started: initShortcut"; QShortcutEx *scViewShortcut = new QShortcutEx(QKeySequence("Ctrl+Shift+/"), this); QShortcutEx *scSpaceShortcut = new QShortcutEx(Qt::Key_Space, this); QShortcutEx *scEnterShortcut = new QShortcutEx(Qt::Key_Return, this); @@ -1072,7 +1074,7 @@ void CMainWindow::initShortcut() scSpaceShortcut->setObjectName(SHORTCUT_SPACE); connect(scViewShortcut, &QShortcut::activated, this, [=] { - qDebug() << "receive Ctrl+Shift+/"; + qCDebug(appLog) << "receive Ctrl+Shift+/"; QRect rect = window()->geometry(); QPoint pos(rect.x() + rect.width() / 2, rect.y() + rect.height() / 2); Shortcut sc; @@ -1128,12 +1130,12 @@ void CMainWindow::initShortcut() else return; }); - qDebug() << "Function completed: initShortcut"; + qCDebug(appLog) << "Function completed: initShortcut"; } void CMainWindow::settingDialog() { - qDebug() << "Function started: settingDialog"; + qCDebug(appLog) << "Function started: settingDialog"; m_SetDialog = new DSettingsDialog(this); m_SetDialog->setFixedSize(820, 600); m_SetDialog->widgetFactory()->registerWidget("selectableEditpic", createPicSelectableLineEditOptionHandle); @@ -1254,7 +1256,7 @@ void CMainWindow::settingDialog() QPushButton *resetbtn = m_SetDialog->findChild("SettingsContentReset"); resetbtn->setDefault(false); resetbtn->setAutoDefault(false); - qDebug() << "Function completed: settingDialog"; + qCDebug(appLog) << "Function completed: settingDialog"; } void CMainWindow::settingDialogDel() @@ -1270,7 +1272,7 @@ void CMainWindow::settingDialogDel() void CMainWindow::loadAfterShow() { - qDebug() << "Function started: loadAfterShow"; + qCDebug(appLog) << "Function started: loadAfterShow"; encodeenv = DataManager::instance()->encodeEnv(); initDynamicLibPath(); initShortcut(); @@ -1325,12 +1327,12 @@ void CMainWindow::loadAfterShow() {"camera_connected", DataManager::instance()->getdevStatus() ? true : false} }; EventLogUtils::get().writeLogs(obj); - qDebug() << "Function completed: loadAfterShow"; + qCDebug(appLog) << "Function completed: loadAfterShow"; } void CMainWindow::updateBlockSystem(bool bTrue) { - qDebug() << "Function started: updateBlockSystem"; + qCDebug(appLog) << "Function started: updateBlockSystem"; if (!CamApp->isPanelEnvironment()) { // qDebug() << "Condition check: !CamApp->isPanelEnvironment(), initBlockShutdown"; initBlockShutdown(); @@ -1340,7 +1342,7 @@ void CMainWindow::updateBlockSystem(bool bTrue) } else { QDBusReply tmp = m_reply; m_reply = QDBusReply(); - qDebug() << "Unblock shutdown."; + qCDebug(appLog) << "Unblock shutdown."; } } if (m_bWayland) { @@ -1352,25 +1354,25 @@ void CMainWindow::updateBlockSystem(bool bTrue) } else { QDBusReply tmp = m_replySleep; m_replySleep = QDBusReply(); - qDebug() << "Unblock sleep."; + qCDebug(appLog) << "Unblock sleep."; } } - qDebug() << "Function completed: updateBlockSystem"; + qCDebug(appLog) << "Function completed: updateBlockSystem"; } void CMainWindow::onNoCam() { - qDebug() << "Function started: onNoCam"; + qCDebug(appLog) << "Function started: onNoCam"; m_pTitlebar->titlebar()->setBackgroundTransparent(false); m_pTitlebar->slotThemeTypeChanged(); showChildWidget(); onEnableSettings(true); - qDebug() << "Function completed: onNoCam"; + qCDebug(appLog) << "Function completed: onNoCam"; } void CMainWindow::stopCancelContinuousRecording(bool bTrue) { - qDebug() << "Function started: stopCancelContinuousRecording"; + qCDebug(appLog) << "Function started: stopCancelContinuousRecording"; if (bTrue) { onStopPhotoAndRecord(); } @@ -1378,7 +1380,7 @@ void CMainWindow::stopCancelContinuousRecording(bool bTrue) void CMainWindow::onDirectoryChanged(const QString &filePath) { - qDebug() << "Function started: onDirectoryChanged"; + qCDebug(appLog) << "Function started: onDirectoryChanged"; Q_UNUSED(filePath); // 转为绝对路径进行比较 QString relativeHomePath = QString("~") + QDir::separator(); @@ -1390,7 +1392,7 @@ void CMainWindow::onDirectoryChanged(const QString &filePath) picPath.replace(0, 1, QDir::homePath()); QDir dir(videoPath); if (!dir.exists()) { - qInfo() << "Video directory does not exist, creating default path"; + qCInfo(appLog) << "Video directory does not exist, creating default path"; QString videoDefaultPath = lastOpenedPath(QStandardPaths::MoviesLocation); if (videoDefaultPath != videoPath) { QDir setVideoDir(videoDefaultPath); @@ -1420,7 +1422,7 @@ void CMainWindow::onDirectoryChanged(const QString &filePath) dir = QDir(picPath); if (!dir.exists()) { - qInfo() << "Picture directory does not exist, creating default path"; + qCInfo(appLog) << "Picture directory does not exist, creating default path"; QString picDefaultPath = lastOpenedPath(QStandardPaths::PicturesLocation); if (picDefaultPath != picPath) { QDir setPicDir(picDefaultPath); @@ -1449,12 +1451,12 @@ void CMainWindow::onDirectoryChanged(const QString &filePath) } reflushSnapshotLabel(); - qDebug() << "Function completed: onDirectoryChanged"; + qCDebug(appLog) << "Function completed: onDirectoryChanged"; } void CMainWindow::onSwitchCameraSuccess(const QString &cameraName) { - qDebug() << "Function started: onSwitchCameraSuccess"; + qCDebug(appLog) << "Function started: onSwitchCameraSuccess"; QStringList tmpList = cameraName.split(":"); if (!tmpList.isEmpty()) { m_labelCameraName->setText(tmpList[0]); @@ -1469,12 +1471,12 @@ void CMainWindow::onSwitchCameraSuccess(const QString &cameraName) m_filterName->hide(); m_showCameraNameTimer->start(); showChildWidget(); - qDebug() << "Function completed: onSwitchCameraSuccess"; + qCDebug(appLog) << "Function completed: onSwitchCameraSuccess"; } void CMainWindow::onTimeoutLock(const QString &serviceName, QVariantMap key2value, QStringList) { - qDebug() << serviceName << key2value; + qCDebug(appLog) << serviceName << key2value; //仅wayland需要锁屏结束录制并停止使用摄像头,从锁屏恢复重新开启摄像头 //wayland下只需要停止录像,不需要停止线程,需要在锁屏状态下继续处理摄像头状态 // if (m_bWayland) { @@ -1502,64 +1504,64 @@ void CMainWindow::onTimeoutLock(const QString &serviceName, QVariantMap key2valu // } // 锁屏时,停用摄像头,因为用户可能需要人脸解锁。解锁后,恢复使用摄像头。 m_videoPre->onLockedScreen(key2value.value("Locked").value()); - qDebug() << "Function completed: onTimeoutLock"; + qCDebug(appLog) << "Function completed: onTimeoutLock"; } void CMainWindow::onTrashFile(const QString &fileName) { - qDebug() << "Deleting file:" << fileName; + qCDebug(appLog) << "Deleting file:" << fileName; QFile file(fileName); if (!file.exists()) { - qWarning() << "File does not exist:" << fileName; + qCWarning(appLog) << "File does not exist:" << fileName; return; } if (!file.remove()) { - qWarning() << "Failed to delete file:" << fileName; + qCWarning(appLog) << "Failed to delete file:" << fileName; } //删除文件后,filewatcher会自动刷新缩略图 } void CMainWindow::onSwitchPhotoBtnClked() { - qDebug() << "Function started: onSwitchPhotoBtnClked"; + qCDebug(appLog) << "Function started: onSwitchPhotoBtnClked"; m_photoRecordBtn->setState(true); m_photoRecordBtn->setToolTip(tr("Photo")); m_takePhotoSettingArea->setState(true); m_videoPre->setState(true); locateRightButtons(); - qDebug() << "Function completed: onSwitchPhotoBtnClked"; + qCDebug(appLog) << "Function completed: onSwitchPhotoBtnClked"; } void CMainWindow::onSwitchRecordBtnClked() { - qDebug() << "Function started: onSwitchRecordBtnClked"; + qCDebug(appLog) << "Function started: onSwitchRecordBtnClked"; m_photoRecordBtn->setState(false); m_photoRecordBtn->setToolTip(tr("Video")); m_takePhotoSettingArea->setState(false); m_videoPre->setState(false); locateRightButtons(); - qDebug() << "Function completed: onSwitchRecordBtnClked"; + qCDebug(appLog) << "Function completed: onSwitchRecordBtnClked"; } void CMainWindow::onModeSwitchBoxValueChanged(int type) { - qDebug() << "Function started: onModeSwitchBoxValueChanged"; + qCDebug(appLog) << "Function started: onModeSwitchBoxValueChanged"; if (type == ActType::ActTakePic) { - qDebug() << "type is ActType::ActTakePic, onSwitchPhotoBtnClked"; + qCDebug(appLog) << "type is ActType::ActTakePic, onSwitchPhotoBtnClked"; onSwitchPhotoBtnClked(); } else if (type == ActType::ActTakeVideo) { - qDebug() << "type is ActType::ActTakeVideo, onSwitchRecordBtnClked"; + qCDebug(appLog) << "type is ActType::ActTakeVideo, onSwitchRecordBtnClked"; onSwitchRecordBtnClked(); } else { - qDebug() << "type is not ActType::ActTakePic or ActType::ActTakeVideo, return."; + qCDebug(appLog) << "type is not ActType::ActTakePic or ActType::ActTakeVideo, return."; return; } - qDebug() << "Function completed: onModeSwitchBoxValueChanged"; + qCDebug(appLog) << "Function completed: onModeSwitchBoxValueChanged"; } void CMainWindow::onPhotoRecordBtnClked() { - qDebug() << "Function started: onPhotoRecordBtnClked"; + qCDebug(appLog) << "Function started: onPhotoRecordBtnClked"; QJsonObject obj { { "tid", m_photoRecordBtn->photoState() ? EventLogUtils::StartPhoto : EventLogUtils::StartRecording }, { "version", VERSION }, @@ -1570,21 +1572,21 @@ void CMainWindow::onPhotoRecordBtnClked() //没有摄像机,不进行任何操作 if (NOCAM == DataManager::instance()->getdevStatus()) { - qWarning() << "No camera available, ignoring photo/record request"; + qCWarning(appLog) << "No camera available, ignoring photo/record request"; return; } //拍照模式下 if (true == m_photoRecordBtn->photoState()) { - qDebug() << "Photo mode activated"; + qCDebug(appLog) << "Photo mode activated"; //正在拍照 if (photoNormal != m_photoState) { - qDebug() << "Taking photo"; + qCDebug(appLog) << "Taking photo"; m_videoPre->onTakePic(false); } else { int nContinuous = Settings::get().getOption("photosetting.photosnumber.takephotos").toInt(); if (nContinuous > 1) { - qInfo() << "Starting continuous photo mode with" << nContinuous << "shots"; + qCInfo(appLog) << "Starting continuous photo mode with" << nContinuous << "shots"; // 仅在连拍模式下才开启窗口状态监听线程 if (!m_windowStateThread->isRunning() && !m_bWayland) { m_windowStateThread->start(); @@ -1594,38 +1596,38 @@ void CMainWindow::onPhotoRecordBtnClked() } } else { //录像模式下 if (true == m_bRecording) { - qDebug() << "Stopping video recording"; + qCDebug(appLog) << "Stopping video recording"; m_videoPre->onEndBtnClicked(); } else { QFileInfo fi(m_videoPath); if (!fi.isWritable()) { - qWarning() << "Video save path is not writable:" << m_videoPath; + qCWarning(appLog) << "Video save path is not writable:" << m_videoPath; return; } - qDebug() << "Starting video recording"; + qCDebug(appLog) << "Starting video recording"; m_videoPre->onTakeVideo(); if (!m_windowStateThread->isRunning() && !m_bWayland) { m_windowStateThread->start(); } } } - qDebug() << "Function completed: onPhotoRecordBtnClked"; + qCDebug(appLog) << "Function completed: onPhotoRecordBtnClked"; } void CMainWindow::onShowCameraNameTimer() { - qDebug() << "Function started: onShowCameraNameTimer"; + qCDebug(appLog) << "Function started: onShowCameraNameTimer"; m_showCameraNameTimer->stop(); m_labelCameraName->hide(); if (m_bShowFilterName) m_filterName->show(); - qDebug() << "Function completed: onShowCameraNameTimer"; + qCDebug(appLog) << "Function completed: onShowCameraNameTimer"; } void CMainWindow::onUpdateRecordState(int state) { - qDebug() << "Recording state changed to:" << state; + qCDebug(appLog) << "Recording state changed to:" << state; m_photoRecordBtn->setRecordState(state); m_bRecording = (photoRecordBtn::Normal != state); m_actionSettings->setEnabled(!m_bRecording); @@ -1634,12 +1636,12 @@ void CMainWindow::onUpdateRecordState(int state) && m_windowStateThread->isRunning() && !m_bWayland) { m_windowStateThread->requestInterruption(); } - qDebug() << "Function completed: onUpdateRecordState"; + qCDebug(appLog) << "Function completed: onUpdateRecordState"; } void CMainWindow::onUpdatePhotoState(int state) { - qDebug() << "Photo state changed to:" << state; + qCDebug(appLog) << "Photo state changed to:" << state; m_actionSettings->setEnabled(photoNormal == state); m_photoState = state; showChildWidget(); @@ -1651,7 +1653,7 @@ void CMainWindow::onUpdatePhotoState(int state) void CMainWindow::onStopPhotoAndRecord() { - qDebug() << "Stopping all photo and recording operations"; + qCDebug(appLog) << "Stopping all photo and recording operations"; if (photoNormal != m_photoState) { m_videoPre->onTakePic(false); } @@ -1662,17 +1664,17 @@ void CMainWindow::onStopPhotoAndRecord() void CMainWindow::onMirrorStateChanged(bool bMirror) { - qDebug() << "Function started: onMirrorStateChanged"; + qCDebug(appLog) << "Function started: onMirrorStateChanged"; if (m_videoPre) { - qDebug() << "Setting horizontal mirror to:" << bMirror; + qCDebug(appLog) << "Setting horizontal mirror to:" << bMirror; m_videoPre->setHorizontalMirror(bMirror); } - qDebug() << "Function completed: onMirrorStateChanged"; + qCDebug(appLog) << "Function completed: onMirrorStateChanged"; } void CMainWindow::onSetFlash(bool bFlashOn) { - qDebug() << "Function started: onSetFlash"; + qCDebug(appLog) << "Function started: onSetFlash"; if (m_videoPre) { m_videoPre->setFlash(bFlashOn); } @@ -1682,79 +1684,79 @@ void CMainWindow::onSetFlash(bool bFlashOn) if (bFlashOn != m_takePhotoSettingArea->flashLight()) { m_takePhotoSettingArea->setFlashlight(bFlashOn); } - qDebug() << "Function completed: onSetFlash"; + qCDebug(appLog) << "Function completed: onSetFlash"; } void CMainWindow::onKeyUp() { - qDebug() << "Function started: onKeyUp"; + qCDebug(appLog) << "Function started: onKeyUp"; QWidget *pWidget = focusWidget(); if (m_cameraSwitchBtn == pWidget || m_takePhotoSettingArea == pWidget) { - qDebug() << "m_cameraSwitchBtn == pWidget or m_takePhotoSettingArea == pWidget, set focus to m_windowoptionButton"; + qCDebug(appLog) << "m_cameraSwitchBtn == pWidget or m_takePhotoSettingArea == pWidget, set focus to m_windowoptionButton"; m_windowoptionButton->setFocus(); } else if (m_photoRecordBtn == pWidget) { if (m_cameraSwitchBtn->isHidden()) { - qDebug() << "m_cameraSwitchBtn->isHidden(), set focus to m_windowoptionButton"; + qCDebug(appLog) << "m_cameraSwitchBtn->isHidden(), set focus to m_windowoptionButton"; m_windowoptionButton->setFocus(); } else { - qDebug() << "m_cameraSwitchBtn->isHidden() is false, set focus to m_cameraSwitchBtn"; + qCDebug(appLog) << "m_cameraSwitchBtn->isHidden() is false, set focus to m_cameraSwitchBtn"; m_cameraSwitchBtn->setFocus(); } } - qDebug() << "Function completed: onKeyUp"; + qCDebug(appLog) << "Function completed: onKeyUp"; } void CMainWindow::onKeyDown() { - qDebug() << "Function started: onKeyDown"; + qCDebug(appLog) << "Function started: onKeyDown"; QWidget *pWidget = focusWidget(); if (m_windowMinBtn == pWidget || m_windowoptionButton == pWidget || m_windowMaxBtn == pWidget || m_windowCloseBtn == pWidget) { if (m_cameraSwitchBtn->isHidden()) { - qDebug() << "m_cameraSwitchBtn->isHidden(), set focus to m_photoRecordBtn"; + qCDebug(appLog) << "m_cameraSwitchBtn->isHidden(), set focus to m_photoRecordBtn"; m_photoRecordBtn->setFocus(); } else { - qDebug() << "m_cameraSwitchBtn->isHidden() is false, set focus to m_cameraSwitchBtn"; + qCDebug(appLog) << "m_cameraSwitchBtn->isHidden() is false, set focus to m_cameraSwitchBtn"; m_cameraSwitchBtn->setFocus(); } } else if (m_cameraSwitchBtn == pWidget) { - qDebug() << "m_cameraSwitchBtn == pWidget, set focus to m_photoRecordBtn"; + qCDebug(appLog) << "m_cameraSwitchBtn == pWidget, set focus to m_photoRecordBtn"; m_photoRecordBtn->setFocus(); } else if (m_photoRecordBtn == pWidget) { - qDebug() << "m_photoRecordBtn == pWidget, set focus to m_snapshotLabel"; + qCDebug(appLog) << "m_photoRecordBtn == pWidget, set focus to m_snapshotLabel"; m_snapshotLabel->setFocus(); } - qDebug() << "Function completed: onKeyDown"; + qCDebug(appLog) << "Function completed: onKeyDown"; } void CMainWindow::onKeyLeft() { - qDebug() << "Function started: onKeyLeft"; + qCDebug(appLog) << "Function started: onKeyLeft"; QWidget *pWidget = focusWidget(); if (m_cameraSwitchBtn == pWidget || m_photoRecordBtn == pWidget || m_snapshotLabel == pWidget) { - qDebug() << "m_cameraSwitchBtn == pWidget or m_photoRecordBtn == pWidget or m_snapshotLabel == pWidget, set focus to m_takePhotoSettingArea"; + qCDebug(appLog) << "m_cameraSwitchBtn == pWidget or m_photoRecordBtn == pWidget or m_snapshotLabel == pWidget, set focus to m_takePhotoSettingArea"; m_takePhotoSettingArea->setFocus(); } else if (m_windowCloseBtn == pWidget) { - qDebug() << "m_windowCloseBtn == pWidget, set focus to m_windowMaxBtn"; + qCDebug(appLog) << "m_windowCloseBtn == pWidget, set focus to m_windowMaxBtn"; m_windowMaxBtn->setFocus(); } else if (m_windowMaxBtn == pWidget) { - qDebug() << "m_windowMaxBtn == pWidget, set focus to m_windowMinBtn"; + qCDebug(appLog) << "m_windowMaxBtn == pWidget, set focus to m_windowMinBtn"; m_windowMinBtn->setFocus(); } else if (m_windowMinBtn == pWidget) { - qDebug() << "m_windowMinBtn == pWidget, set focus to m_windowoptionButton"; + qCDebug(appLog) << "m_windowMinBtn == pWidget, set focus to m_windowoptionButton"; m_windowoptionButton->setFocus(); } - qDebug() << "Function completed: onKeyLeft"; + qCDebug(appLog) << "Function completed: onKeyLeft"; } void CMainWindow::onkeyRight() { - qDebug() << "Function started: onkeyRight"; + qCDebug(appLog) << "Function started: onkeyRight"; QWidget *pWidget = focusWidget(); if (m_windowoptionButton == pWidget) { m_windowMinBtn->setFocus(); @@ -1764,42 +1766,42 @@ void CMainWindow::onkeyRight() m_windowCloseBtn->setFocus(); } else if (m_takePhotoSettingArea == pWidget) { if (m_cameraSwitchBtn->isHidden()) { - qDebug() << "m_cameraSwitchBtn->isHidden(), set focus to m_photoRecordBtn"; + qCDebug(appLog) << "m_cameraSwitchBtn->isHidden(), set focus to m_photoRecordBtn"; m_photoRecordBtn->setFocus(); } else { - qDebug() << "m_cameraSwitchBtn->isHidden() is false, set focus to m_cameraSwitchBtn"; + qCDebug(appLog) << "m_cameraSwitchBtn->isHidden() is false, set focus to m_cameraSwitchBtn"; m_cameraSwitchBtn->setFocus(); } } - qDebug() << "Function completed: onkeyRight"; + qCDebug(appLog) << "Function completed: onkeyRight"; } void CMainWindow::onFilterChanged(efilterType type) { - qDebug() << "Function started: onFilterChanged"; + qCDebug(appLog) << "Function started: onFilterChanged"; if (m_videoPre) { m_videoPre->setFilterType(type); } - qDebug() << "Function completed: onFilterChanged"; + qCDebug(appLog) << "Function completed: onFilterChanged"; } void CMainWindow::onShowFilterName(bool bShow) { - qDebug() << "Function started: onShowFilterName"; + qCDebug(appLog) << "Function started: onShowFilterName"; m_filterName->setVisible(bShow); m_bShowFilterName = bShow; - qDebug() << "Function completed: onShowFilterName"; + qCDebug(appLog) << "Function completed: onShowFilterName"; } void CMainWindow::onSetFilterName(const QString &name) { - qDebug() << "Function started: onSetFilterName"; + qCDebug(appLog) << "Function started: onSetFilterName"; m_filterName->setText(name); } void CMainWindow::initUI() { - qDebug() << "Initializing main window UI"; + qCDebug(appLog) << "Initializing main window UI"; m_videoPre = new videowidget(this); QPalette paletteTime = m_videoPre->palette(); m_videoPre->setObjectName(VIDEO_PREVIEW_WIDGET); @@ -1966,7 +1968,7 @@ void CMainWindow::initUI() #endif m_bUIinit = true; - qDebug() << "Main window UI initialization completed"; + qCDebug(appLog) << "Main window UI initialization completed"; } void CMainWindow::updateSizeMode() @@ -1993,24 +1995,24 @@ void CMainWindow::updateSizeMode() g_videospace->changeSize(0, 0); #endif } - qDebug() << "Function completed: updateSizeMode"; + qCDebug(appLog) << "Function completed: updateSizeMode"; } void CMainWindow::initTitleBar() { - qDebug() << "Function started: initTitleBar"; + qCDebug(appLog) << "Function started: initTitleBar"; m_pTitlebar->titlebar()->setIcon(QIcon::fromTheme("deepin-camera")); m_pTitlebar->raise(); m_pTitlebar->titlebar()->raise(); - qDebug() << "Function completed: initTitleBar"; + qCDebug(appLog) << "Function completed: initTitleBar"; } void CMainWindow::initConnection() { - qDebug() << "Initializing main window connections"; + qCDebug(appLog) << "Initializing main window connections"; connect(CamApp, &CApplication::popupConfirmDialog, this, [=] { if (m_videoPre->getCapStatus()) { - qDebug() << "Video recording in progress, showing close confirmation dialog"; + qCDebug(appLog) << "Video recording in progress, showing close confirmation dialog"; CloseDialog closeDlg(this, tr("Video recording is in progress. Close the window?")); #ifdef UNITTEST closeDlg.show(); @@ -2020,14 +2022,14 @@ void CMainWindow::initConnection() int ret = closeDlg.exec(); if (ret == 1) { - qDebug() << "User confirmed closing during recording, stopping recording"; + qCDebug(appLog) << "User confirmed closing during recording, stopping recording"; m_videoPre->onEndBtnClicked(); usleep(200); qApp->quit(); } #endif } else { - qDebug() << "No recording in progress, closing application"; + qCDebug(appLog) << "No recording in progress, closing application"; qApp->quit(); } }); @@ -2092,7 +2094,7 @@ void CMainWindow::initConnection() if (!QDBusConnection::sessionBus().connect(sessionManagerService, sessionManagerPath, "org.freedesktop.DBus.Properties", "PropertiesChanged", this, SLOT(onTimeoutLock(QString, QVariantMap, QStringList)))) { - qWarning() << "Failed to connect to session manager service"; + qCWarning(appLog) << "Failed to connect to session manager service"; } //控制中心更改了本地时间,及时更新当前时间 @@ -2100,7 +2102,7 @@ void CMainWindow::initConnection() if (!QDBusConnection::sessionBus().connect(timedateService, timedatePath, timedateInterface, "TimeUpdate", this, SLOT(onLocalTimeChanged()))) { - qWarning() << "Failed to connect to timedate service"; + qCWarning(appLog) << "Failed to connect to timedate service"; } QDBusConnection::systemBus().connect("org.freedesktop.login1", "/org/freedesktop/login1", @@ -2108,12 +2110,12 @@ void CMainWindow::initConnection() QDBusConnection::systemBus().connect("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", "PrepareForShutdown", this, SLOT(stopCancelContinuousRecording(bool))); - qDebug() << "Main window connections initialized"; + qCDebug(appLog) << "Main window connections initialized"; } void CMainWindow::initCameraConnection() { - qDebug() << "Function started: initCameraConnection"; + qCDebug(appLog) << "Function started: initCameraConnection"; connect(m_devnumMonitor, &DevNumMonitor::existDevice, Camera::instance(), &Camera::refreshCamera); connect(Camera::instance(), SIGNAL(cameraSwitched(const QString &)), this, SLOT(onSwitchCameraSuccess(const QString &))); // 摄像头重连,刷新设置页分辨率下拉框内容 @@ -2138,12 +2140,12 @@ void CMainWindow::initCameraConnection() DataManager::instance()->setdevStatus(CAM_CANNOT_USE); m_videoPre->showCamUsed(); }); - qDebug() << "Function completed: initCameraConnection"; + qCDebug(appLog) << "Function completed: initCameraConnection"; } void CMainWindow::initRightButtons() { - qDebug() << "Function started: initRightButtons"; + qCDebug(appLog) << "Function started: initRightButtons"; m_cameraSwitchBtn = new SwitchCameraBtn(this); m_cameraSwitchBtn->setFixedSize(SwitchcameraDiam, SwitchcameraDiam); m_cameraSwitchBtn->setObjectName(CAMERA_SWITCH_BTN); @@ -2189,12 +2191,12 @@ void CMainWindow::initRightButtons() //摄像头切换成功信号 connect(m_videoPre, SIGNAL(switchCameraSuccess(const QString &)), this, SLOT(onSwitchCameraSuccess(const QString &))); locateRightButtons(); - qDebug() << "Function completed: initRightButtons"; + qCDebug(appLog) << "Function completed: initRightButtons"; } void CMainWindow::locateRightButtons() { - qDebug() << "Function started: locateRightButtons"; + qCDebug(appLog) << "Function started: locateRightButtons"; if (nullptr == m_photoRecordBtn) { return; } @@ -2217,28 +2219,28 @@ void CMainWindow::locateRightButtons() int snapLabelX = buttonCenterX - snapLabelDiam / 2; int snapLabelY = switchBtnY + switchBtnHeight * 2 + snapLabelOffset; m_snapshotLabel->move(snapLabelX, snapLabelY); - qDebug() << "Function completed: locateRightButtons"; + qCDebug(appLog) << "Function completed: locateRightButtons"; } void CMainWindow::setSelBtnHide() { - qDebug() << "Function started: setSelBtnHide"; + qCDebug(appLog) << "Function started: setSelBtnHide"; m_bSwitchCameraShowEnable = false; if (!m_cameraSwitchBtn->isHidden()) { showChildWidget(); } - qDebug() << "Function completed: setSelBtnHide"; + qCDebug(appLog) << "Function completed: setSelBtnHide"; } void CMainWindow::onLocalTimeChanged() { - qDebug() << "Function started: onLocalTimeChanged"; + qCDebug(appLog) << "Function started: onLocalTimeChanged"; m_SpaceKeyInterval = QDateTime::currentMSecsSinceEpoch(); } void CMainWindow::setSelBtnShow() { - qDebug() << "Function started: setSelBtnShow"; + qCDebug(appLog) << "Function started: setSelBtnShow"; // 有效设备个数小于等于1,不显示切换按钮 if (m_videoPre->getValidDeviceNum() <= 1) { return; @@ -2248,12 +2250,12 @@ void CMainWindow::setSelBtnShow() if (m_cameraSwitchBtn->isHidden()) { showChildWidget(); } - qDebug() << "Function completed: setSelBtnShow"; + qCDebug(appLog) << "Function completed: setSelBtnShow"; } void CMainWindow::setupTitlebar() { - qDebug() << "Function started: setupTitlebar"; + qCDebug(appLog) << "Function started: setupTitlebar"; m_pTitlebar = new Titlebar(this); m_titlemenu = new DMenu(this); m_actionSettings = new QAction(tr("Settings"), this); @@ -2271,7 +2273,7 @@ void CMainWindow::setupTitlebar() m_pTitlebar->move(0, 0); m_pTitlebar->setFixedHeight(50); - qDebug() << "Function completed: setupTitlebar"; + qCDebug(appLog) << "Function completed: setupTitlebar"; } void CMainWindow::resizeEvent(QResizeEvent *event) @@ -2344,14 +2346,14 @@ void CMainWindow::changeEvent(QEvent *event) void CMainWindow::onSettingsDlgClose() { - qDebug() << "Function started: onSettingsDlgClose"; + qCDebug(appLog) << "Function started: onSettingsDlgClose"; bool bPathChanged = false; QString setVideoPath = lastOpenedPath(QStandardPaths::MoviesLocation); QString setPicPath = lastOpenedPath(QStandardPaths::PicturesLocation); //判断图片路径是否改变 if (m_picPath != setPicPath) { //图片路径修改了 - qDebug() << "the picture path is changed"; + qCDebug(appLog) << "the picture path is changed"; QDir setPicDir(setPicPath); QDir lastPicDir(m_picPath); setPicDir.cdUp(); @@ -2373,7 +2375,7 @@ void CMainWindow::onSettingsDlgClose() } if (m_videoPath != setVideoPath) { - qDebug() << "the video path is changed"; + qCDebug(appLog) << "the video path is changed"; QDir setVideoDir(setVideoPath); QDir lastVideoDir(m_videoPath); setVideoDir.cdUp(); @@ -2439,30 +2441,30 @@ void CMainWindow::onSettingsDlgClose() void CMainWindow::onEnableSettings(bool bTrue) { - qDebug() << "Function started: onEnableSettings"; + qCDebug(appLog) << "Function started: onEnableSettings"; m_actionSettings->setEnabled(bTrue); } void CMainWindow::onTakePicDone() { - qDebug() << "Function started: onTakePicOnce"; + qCDebug(appLog) << "Function started: onTakePicOnce"; onEnableSettings(true); } void CMainWindow::onTakePicOnce() { - qDebug() << "onTakePicOnce"; + qCDebug(appLog) << "onTakePicOnce"; } void CMainWindow::onTakePicCancel() { - qDebug() << "Function started: onTakePicCancel"; + qCDebug(appLog) << "Function started: onTakePicCancel"; onEnableSettings(true); } void CMainWindow::onTakeVdDone() { - qDebug() << "Function started: onTakeVdDone"; + qCDebug(appLog) << "Function started: onTakeVdDone"; onEnableSettings(true); QTimer::singleShot(200, this, [=] { @@ -2472,14 +2474,14 @@ void CMainWindow::onTakeVdDone() if (!file.exists()) usleep(200000); }); - qDebug() << "Taking video completed!"; + qCDebug(appLog) << "Taking video completed!"; reflushSnapshotLabel(); - qDebug() << "Function completed: onTakeVdDone"; + qCDebug(appLog) << "Function completed: onTakeVdDone"; } void CMainWindow::onTakeVdCancel() //保存视频完成,通过已有的文件检测实现缩略图恢复,这里不需要额外处理 { - qDebug() << "Function started: onTakeVdCancel"; + qCDebug(appLog) << "Function started: onTakeVdCancel"; onEnableSettings(true); } @@ -2535,10 +2537,10 @@ bool CMainWindow::eventFilter(QObject *obj, QEvent *e) void CMainWindow::showChildWidget() { - qDebug() << "Function started: showChildWidget"; + qCDebug(appLog) << "Function started: showChildWidget"; //正在拍照过程中 if (photoNormal != m_photoState) { - qDebug() << "正在拍照过程中"; + qCDebug(appLog) << "正在拍照过程中"; showWidget(m_cameraSwitchBtn, false); showWidget(m_snapshotLabel, false); showWidget(m_modeSwitchBox, false); @@ -2548,7 +2550,7 @@ void CMainWindow::showChildWidget() return; } if (m_bRecording) { //正在录像 - qDebug() << "正在录像"; + qCDebug(appLog) << "正在录像"; showWidget(m_cameraSwitchBtn, false); showWidget(m_snapshotLabel, false); showWidget(m_modeSwitchBox, false); @@ -2565,14 +2567,14 @@ void CMainWindow::showChildWidget() showWidget(m_photoRecordBtn, true); showWidget(m_takePhotoSettingArea, true); showWidget(m_filterName, m_bShowFilterName); - qDebug() << "Function completed: showChildWidget"; + qCDebug(appLog) << "Function completed: showChildWidget"; } void CMainWindow::showWidget(DWidget *widget, bool bShow) { - qDebug() << "Function started: showWidget"; + qCDebug(appLog) << "Function started: showWidget"; if (widget) { - qDebug() << "widget"; + qCDebug(appLog) << "widget"; if (!bShow) { widget->hide(); } @@ -2581,7 +2583,7 @@ void CMainWindow::showWidget(DWidget *widget, bool bShow) widget->show(); } } - qDebug() << "Function completed: showWidget"; + qCDebug(appLog) << "Function completed: showWidget"; } bool CMainWindow::checkResolutionTooHigh() const @@ -2594,7 +2596,7 @@ bool CMainWindow::checkResolutionTooHigh() const currentHeight = v4l2core_get_frame_height(fd); } bool isTrue = currentWidth > MAX_WIDTH_LIMIT || currentHeight > MAX_HEIGHT_LIMIT; - qInfo() << __func__ << isTrue << currentWidth << "x" << currentHeight; + qCInfo(appLog) << __func__ << isTrue << currentWidth << "x" << currentHeight; return isTrue; } diff --git a/src/src/majorimageprocessingthread.cpp b/src/src/majorimageprocessingthread.cpp index 3ce4b53a..3dd1a920 100644 --- a/src/src/majorimageprocessingthread.cpp +++ b/src/src/majorimageprocessingthread.cpp @@ -1,4 +1,4 @@ -// Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co.,Ltd. +// Copyright (C) 2020 - 2026 Uniontech Software Technology Co.,Ltd. // SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -6,6 +6,8 @@ #include "majorimageprocessingthread.h" #include "datamanager.h" #include "camera.h" +#include "ddlog.h" +using namespace DDLog; extern "C" { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) @@ -23,7 +25,7 @@ DCORE_USE_NAMESPACE MajorImageProcessingThread::MajorImageProcessingThread():m_bHorizontalMirror(false) { - qDebug() << "Initializing MajorImageProcessingThread"; + qCDebug(appLog) << "Initializing MajorImageProcessingThread"; m_rgbPtr = nullptr; m_bRecording = false; m_nVdWidth = 0; @@ -38,13 +40,13 @@ MajorImageProcessingThread::MajorImageProcessingThread():m_bHorizontalMirror(fal void MajorImageProcessingThread::stop() { - qDebug() << __func__; + qCDebug(appLog) << __func__; m_stopped = 1; } void MajorImageProcessingThread::init() { - qDebug() << "Initializing thread state"; + qCDebug(appLog) << "Initializing thread state"; m_stopped = 0; m_majorindex = -1; m_frame = nullptr; @@ -75,7 +77,7 @@ int MajorImageProcessingThread::getRecCount() void MajorImageProcessingThread::ImageHorizontalMirror(const uint8_t* src, uint8_t* dst, int width, int height) { - qDebug() << "Function started: ImageHorizontalMirror"; + qCDebug(appLog) << "Function started: ImageHorizontalMirror"; /* yu12 y1 y2 y3 y4 y4 y3 y2 y1 @@ -99,18 +101,18 @@ void MajorImageProcessingThread::ImageHorizontalMirror(const uint8_t* src, uint8 uvLineStartIndex += width; } } - qDebug() << "Function completed: ImageHorizontalMirror"; + qCDebug(appLog) << "Function completed: ImageHorizontalMirror"; } void MajorImageProcessingThread::processingImage(QImage& img) { - qDebug() << "Processing image, size:" << img.size() << "format:" << img.format(); + qCDebug(appLog) << "Processing image, size:" << img.size() << "format:" << img.format(); // 镜像 if (!m_bHorizontalMirror) img = img.mirrored(true,false); if (m_bPhoto) { - qDebug() << "Processing image in photo mode"; + qCDebug(appLog) << "Processing image in photo mode"; img = img.convertToFormat(QImage::Format_RGB888); // 滤镜预览 @@ -118,7 +120,7 @@ void MajorImageProcessingThread::processingImage(QImage& img) emit SendFilterImageProcessing(&m_filterImg); if (!m_filter.isEmpty() || m_exposure) { - qDebug() << "Applying filter:" << m_filter << "and exposure:" << m_exposure; + qCDebug(appLog) << "Applying filter:" << m_filter << "and exposure:" << m_exposure; // 滤镜效果渲染 uint8_t *rgb = img.bits(); if (!m_filter.isEmpty()) @@ -130,18 +132,18 @@ void MajorImageProcessingThread::processingImage(QImage& img) /*拍照*/ if (m_bTake) { - qDebug() << "Processing photo in photo mode"; + qCDebug(appLog) << "Processing photo in photo mode"; int nRet = -1; if (!img.isNull()) { if (img.save(m_strPath, "JPG")) { nRet = 0; - qInfo() << "Successfully saved photo to:" << m_strPath; + qCInfo(appLog) << "Successfully saved photo to:" << m_strPath; emit sigReflushSnapshotLabel(m_strPath); } } if (nRet < 0) { - qWarning() << "Failed to save photo to:" << m_strPath; + qCWarning(appLog) << "Failed to save photo to:" << m_strPath; } m_bTake = false; @@ -150,14 +152,14 @@ void MajorImageProcessingThread::processingImage(QImage& img) } emit SendMajorImageProcessing(&img, 0); - qDebug() << "Function completed: processingImage"; + qCDebug(appLog) << "Function completed: processingImage"; } void MajorImageProcessingThread::run() { - qInfo() << "Starting MajorImageProcessingThread run loop"; + qCInfo(appLog) << "Starting MajorImageProcessingThread run loop"; if (m_eEncodeEnv != QCamera_Env) { - qDebug() << "Processing video frame in video mode"; + qCDebug(appLog) << "Processing video frame in video mode"; m_videoDevice = get_v4l2_device_handler(); v4l2core_start_stream(m_videoDevice); int framedely = 0; @@ -178,7 +180,7 @@ void MajorImageProcessingThread::run() int ret = v4l2core_update_current_format(m_videoDevice); if (ret != E_OK) { - qWarning() << "Failed to set defined stream format, trying first listed format"; + qCWarning(appLog) << "Failed to set defined stream format, trying first listed format"; fprintf(stderr, "camera: could not set the defined stream format\n"); fprintf(stderr, "camera: trying first listed stream format\n"); @@ -220,7 +222,7 @@ void MajorImageProcessingThread::run() if (decodeCount % LOGGING_INTERVAL == LOGGING_INTERVAL - 1) { decodeTimer.start(); m_frame = v4l2core_get_decoded_frame(m_videoDevice); - qDebug() << "v4l2 decoded time:" << decodeTimer.elapsed() << "ms"; + qCDebug(appLog) << "v4l2 decoded time:" << decodeTimer.elapsed() << "ms"; decodeCount = 0; } else { m_frame = v4l2core_get_decoded_frame(m_videoDevice); @@ -442,7 +444,7 @@ void MajorImageProcessingThread::run() // qDebug() << "Processing photo capture"; if (imgTmp->save(m_strPath, "JPG")) { nRet = 0; - qInfo() << "Successfully saved photo to:" << m_strPath; + qCInfo(appLog) << "Successfully saved photo to:" << m_strPath; emit sigReflushSnapshotLabel(m_strPath); } } else if (FFmpeg_Env == m_eEncodeEnv) { @@ -460,7 +462,7 @@ void MajorImageProcessingThread::run() saveImg = new QImage(rgbPtr, m_frame->width, m_frame->height, QImage::Format_RGB888); if (saveImg->save(m_strPath, "JPG")) { nRet = 0; - qInfo() << "Successfully saved photo to:" << m_strPath; + qCInfo(appLog) << "Successfully saved photo to:" << m_strPath; emit sigReflushSnapshotLabel(m_strPath); } if (saveImg) @@ -473,7 +475,7 @@ void MajorImageProcessingThread::run() } if (nRet < 0) { - qWarning() << "Failed to save photo to:" << m_strPath; + qCWarning(appLog) << "Failed to save photo to:" << m_strPath; } m_bTake = false;