From 230029602895b39b62cc63ce29181cbab72b60c1 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Fri, 30 Oct 2026 10:09:09 +0800 Subject: [PATCH] feat: convert logging calls to categorized macros (4/8) Convert uncategorized qDebug/qWarning/qInfo/qCritical calls in this part of the code to the categorized macros (appLog/serviceLog/baseLog), so the log level follows the DConfig log_rules of org.deepin.dde.diskmanager and can be switched at runtime by the debug-mode script without restart. --- application/widgets/diskhealthheaderview.cpp | 67 ++++----- application/widgets/diskinfodisplaydialog.cpp | 71 ++++----- application/widgets/formatedialog.cpp | 123 ++++++++-------- application/widgets/infoshowwidget.cpp | 139 +++++++++--------- application/widgets/mainsplitter.cpp | 17 ++- application/widgets/mainwindow.cpp | 53 +++---- application/widgets/messagebox.cpp | 69 ++++----- application/widgets/mountdialog.cpp | 105 ++++++------- application/widgets/partitiondialog.cpp | 9 +- .../partitiontableerrorsinfodelegate.cpp | 17 ++- 10 files changed, 340 insertions(+), 330 deletions(-) diff --git a/application/widgets/diskhealthheaderview.cpp b/application/widgets/diskhealthheaderview.cpp index 7946135e..4dac8746 100644 --- a/application/widgets/diskhealthheaderview.cpp +++ b/application/widgets/diskhealthheaderview.cpp @@ -2,6 +2,7 @@ // // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "diskhealthheaderview.h" #include @@ -23,22 +24,22 @@ static const QSize kDropDownSize {11, 10}; DiskHealthHeaderView::DiskHealthHeaderView(Qt::Orientation orientation, QWidget *parent) : DHeaderView(orientation, parent) { - qDebug() << "DiskHealthHeaderView constructor"; + qCDebug(appLog) << "DiskHealthHeaderView constructor"; installEventFilter(this); viewport()->setAutoFillBackground(false); - qDebug() << "DiskHealthHeaderView constructor finished."; + qCDebug(appLog) << "DiskHealthHeaderView constructor finished."; } QSize DiskHealthHeaderView::sizeHint() const { - qDebug() << "DiskHealthHeaderView::sizeHint called."; + qCDebug(appLog) << "DiskHealthHeaderView::sizeHint called."; return QSize(width(), 36 + m_spacing); } int DiskHealthHeaderView::sectionSizeHint(int logicalIndex) const { - qDebug() << "DiskHealthHeaderView::sectionSizeHint called for logicalIndex:" << logicalIndex; + qCDebug(appLog) << "DiskHealthHeaderView::sectionSizeHint called for logicalIndex:" << logicalIndex; // QStyleOptionHeader option; // initStyleOption(&option); // auto *style = dynamic_cast(DApplication::style()); @@ -56,32 +57,32 @@ int DiskHealthHeaderView::sectionSizeHint(int logicalIndex) const void DiskHealthHeaderView::paintEvent(QPaintEvent *event) { - // qDebug() << "DiskHealthHeaderView::paintEvent called."; + // qCDebug(appLog) << "DiskHealthHeaderView::paintEvent called."; QPainter painter(viewport()); painter.save(); DPalette::ColorGroup cg; #ifdef ENABLE_INACTIVE_DISPLAY - // qDebug() << "ENABLE_INACTIVE_DISPLAY is defined."; + // qCDebug(appLog) << "ENABLE_INACTIVE_DISPLAY is defined."; QWidget *wnd = DApplication::activeWindow(); if (!wnd) { - // qDebug() << "No active window, setting ColorGroup to Inactive."; + // qCDebug(appLog) << "No active window, setting ColorGroup to Inactive."; cg = DPalette::Inactive; } else { - // qDebug() << "Active window found, setting ColorGroup to Active."; + // qCDebug(appLog) << "Active window found, setting ColorGroup to Active."; cg = DPalette::Active; } #else - // qDebug() << "ENABLE_INACTIVE_DISPLAY is not defined, setting ColorGroup to Active."; + // qCDebug(appLog) << "ENABLE_INACTIVE_DISPLAY is not defined, setting ColorGroup to Active."; cg = DPalette::Active; // cg = DPalette::Current; #endif #if QT_VERSION_MAJOR > 5 - // qDebug() << "Using Qt6 or higher for application palette."; + // qCDebug(appLog) << "Using Qt6 or higher for application palette."; auto palette = DGuiApplicationHelper::instance()->applicationPalette(); #else - // qDebug() << "Using Qt5 for application palette."; + // qCDebug(appLog) << "Using Qt5 for application palette."; auto palette = DApplicationHelper::instance()->applicationPalette(); #endif @@ -108,19 +109,19 @@ void DiskHealthHeaderView::paintEvent(QPaintEvent *event) // draw focus if (hasFocus()) { - // qDebug() << "Header view has focus, drawing focus rect."; + // qCDebug(appLog) << "Header view has focus, drawing focus rect."; QStyleOptionFocusRect o; o.QStyleOption::operator=(option); QRect focusRect {rect.x() - offset(), rect.y(), length() - sectionPosition(0), rect.height()}; o.rect = style->visualRect(layoutDirection(), rect, focusRect); style->drawPrimitive(DStyle::PE_FrameFocusRect, &o, &painter); } - // qDebug() << "DiskHealthHeaderView::paintEvent completed."; + // qCDebug(appLog) << "DiskHealthHeaderView::paintEvent completed."; } void DiskHealthHeaderView::paintSection(QPainter *painter, const QRect &rect, int logicalIndex) const { - // qDebug() << "DiskHealthHeaderView::paintSection called for logicalIndex:" << logicalIndex << ", rect:" << rect; + // qCDebug(appLog) << "DiskHealthHeaderView::paintSection called for logicalIndex:" << logicalIndex << ", rect:" << rect; painter->save(); painter->setRenderHint(QPainter::Antialiasing); painter->setOpacity(1); @@ -129,35 +130,35 @@ void DiskHealthHeaderView::paintSection(QPainter *painter, const QRect &rect, in QStyleOption opt; opt.initFrom(this); if (!(opt.state & DStyle::State_Enabled)) { - // qDebug() << "Style option state is not enabled, setting ColorGroup to Disabled."; + // qCDebug(appLog) << "Style option state is not enabled, setting ColorGroup to Disabled."; cg = DPalette::Disabled; } else { #ifdef ENABLE_INACTIVE_DISPLAY - // qDebug() << "ENABLE_INACTIVE_DISPLAY is defined in paintSection."; + // qCDebug(appLog) << "ENABLE_INACTIVE_DISPLAY is defined in paintSection."; if (!wnd) { - // qDebug() << "No active window, setting ColorGroup to Inactive in paintSection."; + // qCDebug(appLog) << "No active window, setting ColorGroup to Inactive in paintSection."; cg = DPalette::Inactive; } else { if (wnd->isModal()) { - // qDebug() << "Window is modal, setting ColorGroup to Inactive in paintSection."; + // qCDebug(appLog) << "Window is modal, setting ColorGroup to Inactive in paintSection."; cg = DPalette::Inactive; } else { - // qDebug() << "Window is active and not modal, setting ColorGroup to Active in paintSection."; + // qCDebug(appLog) << "Window is active and not modal, setting ColorGroup to Active in paintSection."; cg = DPalette::Active; } } #else - // qDebug() << "ENABLE_INACTIVE_DISPLAY is not defined in paintSection, setting ColorGroup to Active."; + // qCDebug(appLog) << "ENABLE_INACTIVE_DISPLAY is not defined in paintSection, setting ColorGroup to Active."; cg = DPalette::Active; // cg = DPalette::Current; #endif } #if QT_VERSION_MAJOR > 5 - // qDebug() << "Using Qt6 or higher for application palette in paintSection."; + // qCDebug(appLog) << "Using Qt6 or higher for application palette in paintSection."; DGuiApplicationHelper *dAppHelper = DGuiApplicationHelper::instance(); DPalette palette = dAppHelper->applicationPalette(); #else - // qDebug() << "Using Qt5 for application palette in paintSection."; + // qCDebug(appLog) << "Using Qt5 for application palette in paintSection."; DApplicationHelper *dAppHelper = DApplicationHelper::instance(); DPalette palette = dAppHelper->applicationPalette(); #endif @@ -189,7 +190,7 @@ void DiskHealthHeaderView::paintSection(QPainter *painter, const QRect &rect, in painter->fillRect(hSpacingRect, hSpacingBrush); if (visualIndex(logicalIndex) > 0) { - // qDebug() << "Visual index is greater than 0, filling vertical spacing rects."; + // qCDebug(appLog) << "Visual index is greater than 0, filling vertical spacing rects."; painter->fillRect(vSpacingRect, clearBrush); painter->fillRect(vSpacingRect, vSpacingBrush); } @@ -198,12 +199,12 @@ void DiskHealthHeaderView::paintSection(QPainter *painter, const QRect &rect, in foreground.setColor(palette.color(cg, DPalette::Text)); QRect textRect; if (sortIndicatorSection() == logicalIndex) { - // qDebug() << "Logical index matches sort indicator section, adjusting textRect for sort indicator."; + // qCDebug(appLog) << "Logical index matches sort indicator section, adjusting textRect for sort indicator."; textRect = {contentRect.x() + margin, contentRect.y() + 7, contentRect.width() - margin * 3 - kDropDownSize.width(), contentRect.height() }; } else { - // qDebug() << "Logical index does not match sort indicator section, setting normal textRect."; + // qCDebug(appLog) << "Logical index does not match sort indicator section, setting normal textRect."; textRect = {contentRect.x() + margin, contentRect.y() + 7, contentRect.width() - margin, contentRect.height() }; @@ -215,37 +216,37 @@ void DiskHealthHeaderView::paintSection(QPainter *painter, const QRect &rect, in // sort indicator if (isSortIndicatorShown() && logicalIndex == sortIndicatorSection()) { - // qDebug() << "Sort indicator is shown and logical index matches sort indicator section, drawing sort indicator."; + // qCDebug(appLog) << "Sort indicator is shown and logical index matches sort indicator section, drawing sort indicator."; QRect sortIndicator(textRect.x() + textRect.width() + margin, textRect.y() + qCeil((textRect.height() - kDropDownSize.height()) / 2.), kDropDownSize.width(), kDropDownSize.height()); option.rect = sortIndicator; if (sortIndicatorOrder() == Qt::DescendingOrder) { - // qDebug() << "Drawing descending sort indicator."; + // qCDebug(appLog) << "Drawing descending sort indicator."; style->drawPrimitive(DStyle::PE_IndicatorArrowDown, &option, painter, this); } else if (sortIndicatorOrder() == Qt::AscendingOrder) { - // qDebug() << "Drawing ascending sort indicator."; + // qCDebug(appLog) << "Drawing ascending sort indicator."; style->drawPrimitive(DStyle::PE_IndicatorArrowUp, &option, painter, this); } } painter->restore(); - // qDebug() << "DiskHealthHeaderView::paintSection completed."; + // qCDebug(appLog) << "DiskHealthHeaderView::paintSection completed."; } bool DiskHealthHeaderView::eventFilter(QObject *obj, QEvent *ev) { - // qDebug() << "DiskHealthHeaderView::eventFilter called for object:" << obj << ", event type:" << ev->type(); + // qCDebug(appLog) << "DiskHealthHeaderView::eventFilter called for object:" << obj << ", event type:" << ev->type(); if (ev->type() == QEvent::KeyPress) { - qDebug() << "Event type is KeyPress."; + qCDebug(appLog) << "Event type is KeyPress."; QKeyEvent *kev = dynamic_cast(ev); if (kev->key() == Qt::Key_Space || kev->key() == Qt::Key_Up || kev->key() == Qt::Key_Down) { - qDebug() << "Key is Space, Up, or Down. Filtering event."; + qCDebug(appLog) << "Key is Space, Up, or Down. Filtering event."; return true; } } - // qDebug() << "Calling base eventFilter. Event type:" << ev->type(); + // qCDebug(appLog) << "Calling base eventFilter. Event type:" << ev->type(); return DHeaderView::eventFilter(obj, ev); } diff --git a/application/widgets/diskinfodisplaydialog.cpp b/application/widgets/diskinfodisplaydialog.cpp index a2f77ec2..c7bdc2f9 100644 --- a/application/widgets/diskinfodisplaydialog.cpp +++ b/application/widgets/diskinfodisplaydialog.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "diskinfodisplaydialog.h" #include "partedproxy/dmdbushandler.h" #include "messagebox.h" @@ -24,14 +25,14 @@ DiskInfoDisplayDialog::DiskInfoDisplayDialog(const QString &devicePath, QWidget : DDialog(parent) , m_devicePath(devicePath) { - qDebug() << "DiskInfoDisplayDialog constructor for device:" << devicePath; + qCDebug(appLog) << "DiskInfoDisplayDialog constructor for device:" << devicePath; initUI(); initConnections(); } void DiskInfoDisplayDialog::initUI() { - qDebug() << "Initializing DiskInfoDisplayDialog UI"; + qCDebug(appLog) << "Initializing DiskInfoDisplayDialog UI"; // setWindowTitle("磁盘信息展示"); setIcon(QIcon::fromTheme(appName)); setTitle(tr("Disk Info")); // 磁盘信息 @@ -45,10 +46,10 @@ void DiskInfoDisplayDialog::initUI() HardDiskInfo hardDiskInfo = DMDbusHandler::instance()->getHardDiskInfo(m_devicePath); if (hardDiskInfo.m_mediaType == "SSD") { hardDiskInfo.m_mediaType = tr("SSD"); - qDebug() << "Disk media type: SSD"; + qCDebug(appLog) << "Disk media type: SSD"; } else if (hardDiskInfo.m_mediaType == "HDD") { hardDiskInfo.m_mediaType = tr("HDD"); - qDebug() << "Disk media type: HDD"; + qCDebug(appLog) << "Disk media type: HDD"; } m_diskInfoNameList.clear(); @@ -79,7 +80,7 @@ void DiskInfoDisplayDialog::initUI() palette2.setColor(DPalette::WindowText, color2); for (int i = 0; i < m_diskInfoNameList.count(); i++) { - // qDebug() << "Processing disk info item:" << i << ", Name:" << m_diskInfoNameList.at(i); + // qCDebug(appLog) << "Processing disk info item:" << i << ", Name:" << m_diskInfoNameList.at(i); DLabel *nameLabel = new DLabel; nameLabel->setText(m_diskInfoNameList.at(i)); DFontSizeManager::instance()->bind(nameLabel, DFontSizeManager::T7, QFont::Medium); @@ -88,10 +89,10 @@ void DiskInfoDisplayDialog::initUI() DLabel *valueLabel = new DLabel; if (!m_diskInfoValueList.at(i).isEmpty()) { - qDebug() << "Value is not empty, setting text:" << m_diskInfoValueList.at(i); + qCDebug(appLog) << "Value is not empty, setting text:" << m_diskInfoValueList.at(i); valueLabel->setText(m_diskInfoValueList.at(i)); } else { - qDebug() << "Value is empty, setting text to '-'."; + qCDebug(appLog) << "Value is empty, setting text to '-'."; valueLabel->setText("-"); } @@ -113,10 +114,10 @@ void DiskInfoDisplayDialog::initUI() DFontSizeManager::instance()->bind(m_linkButton, DFontSizeManager::T8, QFont::Medium); QFontMetrics fmCapacity = m_linkButton->fontMetrics(); #if QT_VERSION_MAJOR > 5 - qDebug() << "Calculating link button width for Qt6 or higher."; + qCDebug(appLog) << "Calculating link button width for Qt6 or higher."; int width = fmCapacity.boundingRect(QString(tr("Export", "button"))).width(); #else - qDebug() << "Calculating link button width for Qt5."; + qCDebug(appLog) << "Calculating link button width for Qt5."; int width = fmCapacity.width(QString(tr("Export", "button"))); #endif m_linkButton->setFixedWidth(width); @@ -135,24 +136,24 @@ void DiskInfoDisplayDialog::initUI() addSpacing(10); addContent(infoWidget); - qDebug() << "DiskInfoDisplayDialog UI initialization complete."; + qCDebug(appLog) << "DiskInfoDisplayDialog UI initialization complete."; } void DiskInfoDisplayDialog::initConnections() { - qDebug() << "Setting up DiskInfoDisplayDialog signal connections"; + qCDebug(appLog) << "Setting up DiskInfoDisplayDialog signal connections"; connect(m_linkButton, &DCommandLinkButton::clicked, this, &DiskInfoDisplayDialog::onExportButtonClicked); } void DiskInfoDisplayDialog::onExportButtonClicked() { - qDebug() << "onExportButtonClicked called."; - qInfo() << "Starting disk info export for device:" << m_devicePath; + qCDebug(appLog) << "onExportButtonClicked called."; + qCInfo(appLog) << "Starting disk info export for device:" << m_devicePath; //文件保存路径 QString fileDirPath = QFileDialog::getSaveFileName(this, tr("Save File"), "DiskInfo.txt", tr("Text files (*.txt)"));// 文件保存 磁盘信息 文件类型 - qDebug() << "fileDirPath:" << fileDirPath; + qCDebug(appLog) << "fileDirPath:" << fileDirPath; if (fileDirPath.isEmpty()) { - qDebug() << "File save path is empty, returning."; + qCDebug(appLog) << "File save path is empty, returning."; return; } @@ -165,7 +166,7 @@ void DiskInfoDisplayDialog::onExportButtonClicked() if (!dir.exists()) { // 路径错误 - qWarning() << "Invalid export path:" << fileDir; + qCWarning(appLog) << "Invalid export path:" << fileDir; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), tr("Wrong path")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); @@ -174,29 +175,29 @@ void DiskInfoDisplayDialog::onExportButtonClicked() if (!fileInfo.isWritable()) { // 您无权访问该路径 - qWarning() << "No write permission for path:" << fileDir; + qCWarning(appLog) << "No write permission for path:" << fileDir; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), tr("You do not have permission to access this path")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); } else { - qDebug() << "Path is writable."; + qCDebug(appLog) << "Path is writable."; if (!fileDirPath.contains(".txt")) { - qDebug() << "Adding .txt extension to file path."; + qCDebug(appLog) << "Adding .txt extension to file path."; fileDirPath = fileDirPath + ".txt"; } QFile file(fileDirPath); if (file.open(QIODevice::ReadWrite | QIODevice::Truncate)) { - qDebug() << "Successfully opened file for writing."; + qCDebug(appLog) << "Successfully opened file for writing."; QTextStream out(&file); for (int i = 0; i < m_diskInfoNameList.count(); i++) { - qDebug() << "Processing item" << i << ":" << m_diskInfoNameList.at(i); + qCDebug(appLog) << "Processing item" << i << ":" << m_diskInfoNameList.at(i); QString strInfo = ""; if (!m_diskInfoValueList.at(i).isEmpty()) { - qDebug() << "Value is not empty, formatting info."; + qCDebug(appLog) << "Value is not empty, formatting info."; strInfo = m_diskInfoNameList.at(i) + m_diskInfoValueList.at(i) + "\n"; } else { - qDebug() << "Value is empty, formatting info with '-'."; + qCDebug(appLog) << "Value is empty, formatting info with '-'."; strInfo = m_diskInfoNameList.at(i) + "-" + "\n"; } @@ -206,49 +207,49 @@ void DiskInfoDisplayDialog::onExportButtonClicked() file.close(); - qInfo() << "Disk info exported successfully to:" << fileDirPath; + qCInfo(appLog) << "Disk info exported successfully to:" << fileDirPath; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/ok.svg"), tr("Export successful")); // 导出成功 DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); } else { - qWarning() << "Failed to export disk info to:" << fileDirPath; + qCWarning(appLog) << "Failed to export disk info to:" << fileDirPath; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), tr("Export failed")); // 导出失败 DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); } } - qDebug() << "onExportButtonClicked completed."; + qCDebug(appLog) << "onExportButtonClicked completed."; } bool DiskInfoDisplayDialog::event(QEvent *event) { - // qDebug() << "DiskInfoDisplayDialog::event called for event type:" << event->type(); + // qCDebug(appLog) << "DiskInfoDisplayDialog::event called for event type:" << event->type(); // 字体大小改变 if (QEvent::ApplicationFontChange == event->type()) { - // qDebug() << "Application font change event detected."; + // qCDebug(appLog) << "Application font change event detected."; #if QT_VERSION_MAJOR > 5 - // qDebug() << "Adjusting link button width for Qt6 or higher."; + // qCDebug(appLog) << "Adjusting link button width for Qt6 or higher."; m_linkButton->setFixedWidth(m_linkButton->fontMetrics().boundingRect(QString(tr("Export", "button"))).width()); #else - // qDebug() << "Adjusting link button width for Qt5."; + // qCDebug(appLog) << "Adjusting link button width for Qt5."; m_linkButton->setFixedWidth(m_linkButton->fontMetrics().width(QString(tr("Export", "button")))); #endif DDialog::event(event); } - // qDebug() << "Event handling completed, returning DDialog::event result."; + // qCDebug(appLog) << "Event handling completed, returning DDialog::event result."; return DDialog::event(event); } void DiskInfoDisplayDialog::keyPressEvent(QKeyEvent *event) { - // qDebug() << "DiskInfoDisplayDialog::keyPressEvent called for key:" << event->key(); + // qCDebug(appLog) << "DiskInfoDisplayDialog::keyPressEvent called for key:" << event->key(); if (event->key() == Qt::Key::Key_Escape) { - // qDebug() << "Escape key pressed, ignoring event."; + // qCDebug(appLog) << "Escape key pressed, ignoring event."; event->ignore(); } else { - // qDebug() << "Other key pressed, calling DDialog::keyPressEvent."; + // qCDebug(appLog) << "Other key pressed, calling DDialog::keyPressEvent."; DDialog::keyPressEvent(event); } - // qDebug() << "DiskInfoDisplayDialog::keyPressEvent completed."; + // qCDebug(appLog) << "DiskInfoDisplayDialog::keyPressEvent completed."; } diff --git a/application/widgets/formatedialog.cpp b/application/widgets/formatedialog.cpp index 082b0a58..b736fefd 100644 --- a/application/widgets/formatedialog.cpp +++ b/application/widgets/formatedialog.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "formatedialog.h" #include "partedproxy/dmdbushandler.h" #include "common.h" @@ -21,14 +22,14 @@ FormateDialog::FormateDialog(QWidget *parent) : DDBase(parent) { - qDebug() << "FormateDialog constructor"; + qCDebug(appLog) << "FormateDialog constructor"; initUi(); initConnection(); } void FormateDialog::initUi() { - qDebug() << "Initializing FormatDialog UI"; + qCDebug(appLog) << "Initializing FormatDialog UI"; m_height = 355; setFixedSize(450, m_height); @@ -38,7 +39,7 @@ void FormateDialog::initUi() LUKSFlag luksFlag = LUKSFlag::NOT_CRYPT_LUKS; bool isSystemDevice = false; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is PARTITION."; + qCDebug(appLog) << "Current level is PARTITION."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); m_pathInfo = info.m_path; fileSystemType = info.m_fileSystemType; @@ -48,7 +49,7 @@ void FormateDialog::initUi() luksFlag = info.m_luksFlag; isSystemDevice = DMDbusHandler::instance()->getIsSystemDisk(info.m_devicePath); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Current level is DISK."; + qCDebug(appLog) << "Current level is DISK."; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); m_pathInfo = info.m_path; m_curDiskMediaType = info.m_mediaType; @@ -56,7 +57,7 @@ void FormateDialog::initUi() luksFlag = info.m_luksFlag; isSystemDevice = DMDbusHandler::instance()->getIsSystemDisk(info.m_path); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is LOGICALVOLUME."; + qCDebug(appLog) << "Current level is LOGICALVOLUME."; m_height = 315; setFixedSize(450, m_height); LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); @@ -108,7 +109,7 @@ void FormateDialog::initUi() m_fileNameEdit->lineEdit()->setValidator(validator ); m_fileNameEdit->setFixedHeight(36); if (m_fileNameEdit->text().isEmpty()) { - qDebug() << "File name edit is empty, setting placeholder text."; + qCDebug(appLog) << "File name edit is empty, setting placeholder text."; m_fileNameEdit->lineEdit()->setPlaceholderText(tr("Name")); } @@ -125,7 +126,7 @@ void FormateDialog::initUi() fslist.removeOne("linux-swap"); // QStringList formateList = fslist; if (size > 100 && !isSystemDevice && DMDbusHandler::instance()->getCurLevel() != DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Size is greater than 100, not system device, and not logical volume. Getting encryption formats."; + qCDebug(appLog) << "Size is greater than 100, not system device, and not logical volume. Getting encryption formats."; fslist = DMDbusHandler::instance()->getEncryptionFormate(fslist); } @@ -135,37 +136,37 @@ void FormateDialog::initUi() QString fsTypeName = Utils::fileSystemTypeToString(static_cast(fileSystemType)); // 判断当前设备是否加密 if (luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "LUKS flag is IS_CRYPT_LUKS, checking LUKS info."; + qCDebug(appLog) << "LUKS flag is IS_CRYPT_LUKS, checking LUKS info."; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(m_pathInfo); // 加密设备是否打开,打开格式设为加密格式,未打开默认设为ext4 if (luksInfo.isDecrypt) { - qDebug() << "LUKS device is decrypted."; + qCDebug(appLog) << "LUKS device is decrypted."; fileSystemType = luksInfo.m_mapper.m_luksFs; if (-1 == fslist.indexOf(Utils::fileSystemTypeToString(static_cast(fileSystemType)))) { - qDebug() << "Decrypted file system type not in list, setting to EXT4."; + qCDebug(appLog) << "Decrypted file system type not in list, setting to EXT4."; fsTypeName = Utils::fileSystemTypeToString(FSType::FS_EXT4); } else { if (luksInfo.m_crypt == CRYPT_CIPHER::AES_XTS_PLAIN64) { - qDebug() << "LUKS encryption is AES_XTS_PLAIN64."; + qCDebug(appLog) << "LUKS encryption is AES_XTS_PLAIN64."; fsTypeName = QString("%1 (%2)").arg(Utils::fileSystemTypeToString(static_cast(fileSystemType))) .arg(tr("AES Encryption")); } else if (luksInfo.m_crypt == CRYPT_CIPHER::SM4_XTS_PLAIN64){ - qDebug() << "LUKS encryption is SM4_XTS_PLAIN64."; + qCDebug(appLog) << "LUKS encryption is SM4_XTS_PLAIN64."; fsTypeName = QString("%1 (%2)").arg(Utils::fileSystemTypeToString(static_cast(fileSystemType))) .arg(tr("SM4 Encryption")); } } } else { - qDebug() << "LUKS device is not decrypted, setting to EXT4."; + qCDebug(appLog) << "LUKS device is not decrypted, setting to EXT4."; fsTypeName = Utils::fileSystemTypeToString(FSType::FS_EXT4); } } if (-1 == fslist.indexOf(fsTypeName)) { - qDebug() << "File system type not in list, setting current text to ext4."; + qCDebug(appLog) << "File system type not in list, setting current text to ext4."; m_formatComboBox->setCurrentText("ext4"); } else { - qDebug() << "File system type found in list, setting current text to:" << fsTypeName; + qCDebug(appLog) << "File system type found in list, setting current text to:" << fsTypeName; m_formatComboBox->setCurrentText(fsTypeName); } @@ -182,12 +183,12 @@ void FormateDialog::initUi() m_securityComboBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); if ("SSD" == m_curDiskMediaType || DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Disk media type is SSD or current level is LOGICALVOLUME, adding Fast and Secure options."; + qCDebug(appLog) << "Disk media type is SSD or current level is LOGICALVOLUME, adding Fast and Secure options."; QStringList securitylist; securitylist << tr("Fast") << tr("Secure"); m_securityComboBox->addItems(securitylist); } else { - qDebug() << "Disk media type is not SSD and not logical volume, adding Fast, Secure, and Advanced options."; + qCDebug(appLog) << "Disk media type is not SSD and not logical volume, adding Fast, Secure, and Advanced options."; QStringList securitylist; securitylist << tr("Fast") << tr("Secure") << tr("Advanced"); m_securityComboBox->addItems(securitylist); @@ -333,7 +334,7 @@ void FormateDialog::initUi() m_failLabel->setText(tr("Failed to find the disk")); if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is logical volume."; + qCDebug(appLog) << "Current level is logical volume."; tipLabel->setText(tr("The action cannot be undone, please proceed with caution")); tipLabel->setFixedHeight(30); fileName->setText(tr("LV name:")); @@ -373,12 +374,12 @@ void FormateDialog::initUi() QFontMetrics fm(formatName->font()); updateEncryptionInfo(m_formatComboBox->currentText(), width() - fm.boundingRect(formatName->text()).width() - 40); } - qDebug() << "FormateDialog initialized."; + qCDebug(appLog) << "FormateDialog initialized."; } void FormateDialog::initConnection() { - qDebug() << "Setting up FormatDialog signal connections"; + qCDebug(appLog) << "Setting up FormatDialog signal connections"; connect(m_pushButton, &DPushButton::clicked, this, &FormateDialog::onCancelButtonClicked); connect(m_warningButton, &DWarningButton::clicked, this, &FormateDialog::onWipeButtonClicked); connect(m_fileNameEdit, &DLineEdit::textChanged, this, &FormateDialog::onTextChanged); @@ -392,35 +393,35 @@ void FormateDialog::initConnection() void FormateDialog::onTextChanged(const QString &text) { - qDebug() << "Format name changed:" << text; + qCDebug(appLog) << "Format name changed:" << text; if (!text.isEmpty()) { - qDebug() << "Format name is not empty."; + qCDebug(appLog) << "Format name is not empty."; QByteArray byteArray = text.toUtf8(); if (m_formatComboBox->currentText().contains("fat32")) { - qDebug() << "File system type is fat32."; + qCDebug(appLog) << "File system type is fat32."; if (byteArray.size() > 11) { - qDebug() << "File system type is fat32, length exceeds the limit."; + qCDebug(appLog) << "File system type is fat32, length exceeds the limit."; m_fileNameEdit->setAlert(true); m_fileNameEdit->showAlertMessage(tr("The length exceeds the limit"), -1); m_warningButton->setEnabled(false); } else { - qDebug() << "File system type is fat32, length is within the limit."; + qCDebug(appLog) << "File system type is fat32, length is within the limit."; m_fileNameEdit->setAlert(false); m_fileNameEdit->hideAlertMessage(); m_warningButton->setEnabled(true); } } else { - qDebug() << "File system type is not fat32."; + qCDebug(appLog) << "File system type is not fat32."; if (byteArray.size() > 16) { - qDebug() << "File system type is not fat32, length exceeds the limit."; + qCDebug(appLog) << "File system type is not fat32, length exceeds the limit."; m_fileNameEdit->setAlert(true); m_fileNameEdit->showAlertMessage(tr("The length exceeds the limit"), -1); m_warningButton->setEnabled(false); } else { - qDebug() << "File system type is not fat32, length is within the limit."; + qCDebug(appLog) << "File system type is not fat32, length is within the limit."; m_fileNameEdit->setAlert(false); m_fileNameEdit->hideAlertMessage(); @@ -428,12 +429,12 @@ void FormateDialog::onTextChanged(const QString &text) } } } - qDebug() << "Format name changed end."; + qCDebug(appLog) << "Format name changed end."; } void FormateDialog::onComboxFormatTextChange(const QString &text) { - qDebug() << "File system type changed:" << text; + qCDebug(appLog) << "File system type changed:" << text; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION || DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { QByteArray byteArray = m_fileNameEdit->text().toUtf8(); @@ -501,7 +502,7 @@ void FormateDialog::updateEncryptionInfo(const QString &text, const int &width) void FormateDialog::onSecurityCurrentIndexChanged(int index) { - qDebug() << "Security option changed to index:" << index; + qCDebug(appLog) << "Security option changed to index:" << index; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION || DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { switch (index) { @@ -585,12 +586,12 @@ void FormateDialog::onSecurityCurrentIndexChanged(int index) break; } } - qDebug() << "onSecurityCurrentIndexChanged completed."; + qCDebug(appLog) << "onSecurityCurrentIndexChanged completed."; } void FormateDialog::onWipingMethodCurrentIndexChanged(int index) { - qDebug() << "Wiping method changed to index:" << index; + qCDebug(appLog) << "Wiping method changed to index:" << index; switch (index) { case 0: { m_curWipeMethod = WipeType::DOD; @@ -601,20 +602,20 @@ void FormateDialog::onWipingMethodCurrentIndexChanged(int index) break; } default: - qDebug() << "Unknown wiping method index:" << index; + qCDebug(appLog) << "Unknown wiping method index:" << index; break; } } void FormateDialog::onCancelButtonClicked() { - qDebug() << "Cancel button clicked."; + qCDebug(appLog) << "Cancel button clicked."; close(); } void FormateDialog::onWipeButtonClicked() { - qInfo() << "Starting wipe operation for:" << m_pathInfo; + qCInfo(appLog) << "Starting wipe operation for:" << m_pathInfo; QString userName = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); userName.remove(0, 6); @@ -625,23 +626,23 @@ void FormateDialog::onWipeButtonClicked() CRYPT_CIPHER encryption = CRYPT_CIPHER::NOT_CRYPT; bool isEncryption = false; if (formate.contains("AES") || formate.contains("SM4")) { - qDebug() << "AES or SM4 encryption selected."; + qCDebug(appLog) << "AES or SM4 encryption selected."; PasswordInputDialog passwordInputDialog(this); passwordInputDialog.setDeviceName(m_pathInfo); passwordInputDialog.setAccessibleName("passwordInputDialog"); if (passwordInputDialog.exec() != DDialog::Accepted) { - qDebug() << "Password input dialog cancelled."; + qCDebug(appLog) << "Password input dialog cancelled."; return; } else { - qDebug() << "Password input dialog accepted."; + qCDebug(appLog) << "Password input dialog accepted."; password = passwordInputDialog.getPassword(); passwordHint = passwordInputDialog.getPasswordHint(); if (formate.contains("AES")) { - qDebug() << "AES encryption selected."; + qCDebug(appLog) << "AES encryption selected."; encryption = CRYPT_CIPHER::AES_XTS_PLAIN64; encryptName = "aesE"; } else if (formate.contains("SM4")) { - qDebug() << "SM4 encryption selected."; + qCDebug(appLog) << "SM4 encryption selected."; encryption = CRYPT_CIPHER::SM4_XTS_PLAIN64; encryptName = "sm4E"; } @@ -663,7 +664,7 @@ void FormateDialog::onWipeButtonClicked() if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION || DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Partition or disk wipe operation."; + qCDebug(appLog) << "Partition or disk wipe operation."; WipeAction wipe; wipe.m_fstype = formate; wipe.m_path = m_pathInfo; @@ -673,40 +674,40 @@ void FormateDialog::onWipeButtonClicked() wipe.m_crypt = encryption; wipe.m_decryptStr = password; if (isEncryption) { - qDebug() << "Encryption enabled."; + qCDebug(appLog) << "Encryption enabled."; wipe.m_luksFlag = LUKSFlag::IS_CRYPT_LUKS; QStringList tokenList; if (!passwordHint.isEmpty()) { - qDebug() << "Password hint added."; + qCDebug(appLog) << "Password hint added."; tokenList.append(passwordHint); } wipe.m_tokenList = tokenList; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Disk encryption selected."; + qCDebug(appLog) << "Disk encryption selected."; wipe.m_dmName = ""; } else { - qDebug() << "Partition encryption selected."; + qCDebug(appLog) << "Partition encryption selected."; m_pathInfo == "unallocated" ? wipe.m_dmName = "" : wipe.m_dmName = QString("%1_%2").arg(m_pathInfo.remove("/dev/")).arg(encryptName); } } else { - qDebug() << "Encryption disabled."; + qCDebug(appLog) << "Encryption disabled."; wipe.m_luksFlag = LUKSFlag::NOT_CRYPT_LUKS; wipe.m_tokenList = QStringList(); wipe.m_dmName = ""; } if (m_fileNameEdit->text().isEmpty()) { - qDebug() << "File system label not set."; + qCDebug(appLog) << "File system label not set."; wipe.m_fileSystemLabel = " "; DMDbusHandler::instance()->clear(wipe); } else { - qDebug() << "File system label set."; + qCDebug(appLog) << "File system label set."; wipe.m_fileSystemLabel = m_fileNameEdit->text(); DMDbusHandler::instance()->clear(wipe); } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Logical volume wipe operation."; + qCDebug(appLog) << "Logical volume wipe operation."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); LVAction lvAction; @@ -720,18 +721,18 @@ void FormateDialog::onWipeButtonClicked() lvAction.m_crypt = encryption; lvAction.m_decryptStr = password; if (isEncryption) { - qDebug() << "Encryption enabled."; + qCDebug(appLog) << "Encryption enabled."; lvAction.m_luksFlag = LUKSFlag::IS_CRYPT_LUKS; QStringList tokenList; if (!passwordHint.isEmpty()) { - qDebug() << "Password hint added."; + qCDebug(appLog) << "Password hint added."; tokenList.append(passwordHint); } lvAction.m_tokenList = tokenList; lvAction.m_dmName = QString("%1_%2_%3").arg(lvInfo.m_vgName).arg(lvInfo.m_lvName).arg(encryptName); } else { - qDebug() << "Encryption disabled."; + qCDebug(appLog) << "Encryption disabled."; lvAction.m_luksFlag = LUKSFlag::NOT_CRYPT_LUKS; lvAction.m_tokenList = QStringList(); lvAction.m_dmName = ""; @@ -745,34 +746,34 @@ void FormateDialog::onWipeButtonClicked() m_stackedWidget->setCurrentIndex(1); DWindowCloseButton *button = findChild("DTitlebarDWindowCloseButton"); if (button != nullptr) { - qDebug() << "DWindowCloseButton found."; + qCDebug(appLog) << "DWindowCloseButton found."; button->setDisabled(true); button->hide(); } m_waterLoadingWidget->setStartTime(1000); - qDebug() << "Wiping operation started."; + qCDebug(appLog) << "Wiping operation started."; } void FormateDialog::onWipeResult(const QString &info) { - qDebug() << "Wipe operation result:" << info; + qCDebug(appLog) << "Wipe operation result:" << info; QStringList infoList = info.split(":"); if (infoList.count() <= 2) { - qDebug() << "infoList count less than 2."; + qCDebug(appLog) << "infoList count less than 2."; return; } m_waterLoadingWidget->stopTimer(); bool isSuccess = false; if (infoList.at(0) == "DISK_ERROR" && infoList.at(1).toInt() == DISK_ERROR::DISK_ERR_NORMAL) { - qDebug() << "Wipe operation succeeded."; + qCDebug(appLog) << "Wipe operation succeeded."; isSuccess = true; } if (isSuccess) { - qDebug() << "Wipe operation succeeded."; + qCDebug(appLog) << "Wipe operation succeeded."; DMessageManager::instance()->sendMessage(this->parentWidget()->parentWidget()->parentWidget()->parentWidget(), QIcon::fromTheme("://icons/deepin/builtin/ok.svg"), tr("\"%1\" wiped").arg(m_pathInfo)); @@ -781,7 +782,7 @@ void FormateDialog::onWipeResult(const QString &info) close(); } else { - qDebug() << "Wipe operation failed."; + qCDebug(appLog) << "Wipe operation failed."; QString failedReason = DMDbusHandler::instance()->getFailedMessage(infoList.at(0), infoList.at(1).toInt(), ""); setTitle(tr("Failed to wipe %1").arg(m_pathInfo)); m_stackedWidget->setCurrentIndex(2); @@ -792,6 +793,6 @@ void FormateDialog::onWipeResult(const QString &info) m_failLabel->setText(failedReason); } - qDebug() << "Wipe operation completed."; + qCDebug(appLog) << "Wipe operation completed."; } diff --git a/application/widgets/infoshowwidget.cpp b/application/widgets/infoshowwidget.cpp index 2d8974f2..eee59740 100644 --- a/application/widgets/infoshowwidget.cpp +++ b/application/widgets/infoshowwidget.cpp @@ -1,8 +1,9 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "infoshowwidget.h" #include "customcontrol/sizeinfowidget.h" #include "partedproxy/dmdbushandler.h" @@ -22,15 +23,15 @@ DWIDGET_USE_NAMESPACE InfoShowWidget::InfoShowWidget(DWidget *parent) : DFrame(parent) { - qDebug() << "InfoShowWidget constructor"; + qCDebug(appLog) << "InfoShowWidget constructor"; initUi(); initConnection(); - qDebug() << "InfoShowWidget constructor finished."; + qCDebug(appLog) << "InfoShowWidget constructor finished."; } void InfoShowWidget::initUi() { - qDebug() << "Initializing InfoShowWidget UI"; + qCDebug(appLog) << "Initializing InfoShowWidget UI"; setWindowFlags(Qt::FramelessWindowHint); //无边框 setAttribute(Qt::WA_TranslucentBackground); //背景透明 @@ -56,7 +57,7 @@ void InfoShowWidget::initUi() m_frameMid->setFrameShape(QFrame::NoFrame); frameLayout->addWidget(m_frameMid); midFramSettings(); - qDebug() << "midFramSettings called in initUi."; + qCDebug(appLog) << "midFramSettings called in initUi."; // 右侧 底部数据信息 m_frameBottom = new DmFrameWidget(m_diskInfoData); @@ -65,31 +66,31 @@ void InfoShowWidget::initUi() frameLayout->addWidget(m_frameBottom); frameLayout->addStretch(); bottomFramSettings(); - qDebug() << "InfoShowWidget UI initialization complete."; + qCDebug(appLog) << "InfoShowWidget UI initialization complete."; } void InfoShowWidget::initConnection() { - qDebug() << "Setting up InfoShowWidget signal connections"; + qCDebug(appLog) << "Setting up InfoShowWidget signal connections"; connect(DMDbusHandler::instance(), &DMDbusHandler::curSelectChanged, this, &InfoShowWidget::onCurSelectChanged); #if QT_VERSION_MAJOR > 5 - qDebug() << "Connecting themeTypeChanged signal for Qt6 or higher."; + qCDebug(appLog) << "Connecting themeTypeChanged signal for Qt6 or higher."; connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, &InfoShowWidget::onHandleChangeTheme); #else - qDebug() << "Connecting themeTypeChanged signal for Qt5."; + qCDebug(appLog) << "Connecting themeTypeChanged signal for Qt5."; connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &InfoShowWidget::onHandleChangeTheme); #endif connect(m_partitionInfoWidget, &PartitionInfoWidget::enterWidget, this, &InfoShowWidget::onEnterWidget); connect(m_partitionInfoWidget, &PartitionInfoWidget::leaveWidget, this, &InfoShowWidget::onLeaveWidget); connect(m_vgSizeInfoWidget, &VGSizeInfoWidget::enterWidget, this, &InfoShowWidget::onEnterVGInfoWidget); - qDebug() << "InfoShowWidget signal connections setup complete."; + qCDebug(appLog) << "InfoShowWidget signal connections setup complete."; } void InfoShowWidget::midFramSettings() { - qDebug() << "Configuring mid frame settings"; + qCDebug(appLog) << "Configuring mid frame settings"; QVBoxLayout *mainLayout = new QVBoxLayout(m_frameMid); m_infoWidget = new SizeInfoWidget; m_partitionInfoWidget = new PartitionInfoWidget; @@ -124,12 +125,12 @@ void InfoShowWidget::midFramSettings() m_vgInfoShowWidget = new VGInfoShowWidget; m_vgInfoShowWidget->setObjectName("vgInfoShowWidget"); - qDebug() << "Mid frame settings configuration complete."; + qCDebug(appLog) << "Mid frame settings configuration complete."; } void InfoShowWidget::bottomFramSettings() { - qDebug() << "Configuring bottom frame settings"; + qCDebug(appLog) << "Configuring bottom frame settings"; QVBoxLayout *leftInfoLayout = new QVBoxLayout(); QVBoxLayout *rightInfolayout = new QVBoxLayout(); @@ -231,14 +232,14 @@ void InfoShowWidget::bottomFramSettings() mainlayout->addLayout(leftInfoLayout); mainlayout->addSpacing(10); mainlayout->addLayout(rightInfolayout); - qDebug() << "Bottom frame settings configuration complete."; + qCDebug(appLog) << "Bottom frame settings configuration complete."; } void InfoShowWidget::onCurSelectChanged() { - qDebug() << "Current selection changed, level:" << DMDbusHandler::instance()->getCurLevel(); + qCDebug(appLog) << "Current selection changed, level:" << DMDbusHandler::instance()->getCurLevel(); if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Current selection is PARTITION."; + qCDebug(appLog) << "Current selection is PARTITION."; m_frameBottom->setFrameData(); m_mountpointLabel->setText(tr("Mount point:")); m_typeLabel->setText(tr("Type:")); @@ -259,7 +260,7 @@ void InfoShowWidget::onCurSelectChanged() QString capacity = Utils::formatSize(info.m_sectorEnd - info.m_sectorStart + 1, info.m_sectorSize); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "LUKS partition detected."; + qCDebug(appLog) << "LUKS partition detected."; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path); if (luksInfo.isDecrypt) { free = Utils::LVMFormatSize(luksInfo.m_mapper.m_fsUnused); @@ -276,12 +277,12 @@ void InfoShowWidget::onCurSelectChanged() } if (free.contains("-")){ - qDebug() << "LUKS partition free size is not available."; + qCDebug(appLog) << "LUKS partition free size is not available."; free = "-"; } if (used.contains("-")){ - qDebug() << "LUKS partition used size is not available."; + qCDebug(appLog) << "LUKS partition used size is not available."; used = "-"; } @@ -294,7 +295,7 @@ void InfoShowWidget::onCurSelectChanged() m_infoTopFrame->updateDiskInfo(); if (info.m_vgFlag == LVMFlag::LVM_FLAG_NOT_PV) { - qDebug() << "LUKS partition is not PV."; + qCDebug(appLog) << "LUKS partition is not PV."; m_partitionInfoWidget->hide(); m_vgSizeInfoWidget->hide(); m_infoWidget->show(); @@ -316,7 +317,7 @@ void InfoShowWidget::onCurSelectChanged() QVector size {m_used, m_noused}; m_infoWidget->setData(info, color, size, 1); } else { - qDebug() << "LUKS partition is PV."; + qCDebug(appLog) << "LUKS partition is PV."; m_partitionInfoWidget->hide(); m_vgSizeInfoWidget->show(); m_infoWidget->hide(); @@ -324,17 +325,17 @@ void InfoShowWidget::onCurSelectChanged() m_vgSizeInfoWidget->setData(info.m_vgData); } } else if (DMDbusHandler::DISK == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Current selection is DISK."; + qCDebug(appLog) << "Current selection is DISK."; m_mountpointLabel->setText(tr("Path:")); m_typeLabel->setText(tr("Disk type:")); m_volumeLabel->setText(tr("Interface:")); DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); if (info.m_mediaType == "SSD") { - qDebug() << "SSD disk detected."; + qCDebug(appLog) << "SSD disk detected."; info.m_mediaType = tr("SSD"); } else if (info.m_mediaType == "HDD") { - qDebug() << "HDD disk detected."; + qCDebug(appLog) << "HDD disk detected."; info.m_mediaType = tr("HDD"); } Sector usedSector = 0; @@ -344,24 +345,24 @@ void InfoShowWidget::onCurSelectChanged() for (int i = 0; i < info.m_partition.size(); i++) { PartitionInfo partitionInfo = info.m_partition.at(i); if (partitionInfo.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "LUKS partition detected."; + qCDebug(appLog) << "LUKS partition detected."; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(partitionInfo.m_path); if (luksInfo.isDecrypt) { - qDebug() << "LUKS partition is decrypted."; + qCDebug(appLog) << "LUKS partition is decrypted."; if (luksInfo.m_mapper.m_fsUsed > 0) { - qDebug() << "LUKS partition used size:" << luksInfo.m_mapper.m_fsUsed; + qCDebug(appLog) << "LUKS partition used size:" << luksInfo.m_mapper.m_fsUsed; usedSector += luksInfo.m_mapper.m_fsUsed; } if (luksInfo.m_mapper.m_fsUnused > 0) { - qDebug() << "LUKS partition unused size:" << luksInfo.m_mapper.m_fsUnused; + qCDebug(appLog) << "LUKS partition unused size:" << luksInfo.m_mapper.m_fsUnused; unusedSector += luksInfo.m_mapper.m_fsUnused; } sumUsed += luksInfo.m_mapper.m_fsUsed; sumUnused += luksInfo.m_mapper.m_fsUnused; } else { - qDebug() << "LUKS partition is not decrypted."; + qCDebug(appLog) << "LUKS partition is not decrypted."; usedSector += (partitionInfo.m_sectorEnd - partitionInfo.m_sectorStart + 1) * partitionInfo.m_sectorSize; sumUsed += (partitionInfo.m_sectorEnd - partitionInfo.m_sectorStart + 1) * partitionInfo.m_sectorSize; sumUnused += luksInfo.m_mapper.m_fsUnused; @@ -371,26 +372,26 @@ void InfoShowWidget::onCurSelectChanged() } if (partitionInfo.m_path != "unallocated") { - qDebug() << "Partition detected."; + qCDebug(appLog) << "Partition detected."; if (partitionInfo.m_sectorsUsed > 0) { - qDebug() << "Partition used size:" << partitionInfo.m_sectorsUsed; + qCDebug(appLog) << "Partition used size:" << partitionInfo.m_sectorsUsed; usedSector += partitionInfo.m_sectorsUsed * partitionInfo.m_sectorSize; } if (partitionInfo.m_sectorsUnused > 0) { - qDebug() << "Partition unused size:" << partitionInfo.m_sectorsUnused; + qCDebug(appLog) << "Partition unused size:" << partitionInfo.m_sectorsUnused; unusedSector += partitionInfo.m_sectorsUnused * partitionInfo.m_sectorSize; } if (partitionInfo.m_sectorsUsed < 0 && partitionInfo.m_sectorsUnused < 0) { - qDebug() << "Partition size is not available."; + qCDebug(appLog) << "Partition size is not available."; usedSector += (partitionInfo.m_sectorEnd - partitionInfo.m_sectorStart + 1) * partitionInfo.m_sectorSize; } sumUsed += partitionInfo.m_sectorsUsed * partitionInfo.m_sectorSize; sumUnused += partitionInfo.m_sectorsUnused * partitionInfo.m_sectorSize; } else { - qDebug() << "Partition is unallocated."; + qCDebug(appLog) << "Partition is unallocated."; unusedSector += (partitionInfo.m_sectorEnd - partitionInfo.m_sectorStart + 1) * partitionInfo.m_sectorSize; sumUsed += partitionInfo.m_sectorsUsed * partitionInfo.m_sectorSize; sumUnused += (partitionInfo.m_sectorEnd - partitionInfo.m_sectorStart + 1) * partitionInfo.m_sectorSize; @@ -403,20 +404,20 @@ void InfoShowWidget::onCurSelectChanged() // 当前选择为磁盘时,是否是整盘加密的磁盘 if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS && info.m_partition.size() == 0) { - qDebug() << "Disk is LUKS encrypted and has no partitions."; + qCDebug(appLog) << "Disk is LUKS encrypted and has no partitions."; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path); m_mountpointLabel->setText(tr("Mount point:")); m_typeLabel->setText(tr("Type:")); m_volumeLabel->setText(tr("Volume label:")); if (luksInfo.isDecrypt) { - qDebug() << "LUKS disk is decrypted."; + qCDebug(appLog) << "LUKS disk is decrypted."; if (luksInfo.m_mapper.m_fsUsed > 0) { - qDebug() << "LUKS disk used size:" << luksInfo.m_mapper.m_fsUsed; + qCDebug(appLog) << "LUKS disk used size:" << luksInfo.m_mapper.m_fsUsed; usedSector += luksInfo.m_mapper.m_fsUsed; } if (luksInfo.m_mapper.m_fsUnused > 0) { - qDebug() << "LUKS disk unused size:" << luksInfo.m_mapper.m_fsUnused; + qCDebug(appLog) << "LUKS disk unused size:" << luksInfo.m_mapper.m_fsUnused; unusedSector += luksInfo.m_mapper.m_fsUnused; } @@ -430,7 +431,7 @@ void InfoShowWidget::onCurSelectChanged() diskType = DMDbusHandler::instance()->getEncryptionFsType(luksInfo); } else { - qDebug() << "LUKS disk is not decrypted."; + qCDebug(appLog) << "LUKS disk is not decrypted."; usedSector = -1 * info.m_sectorSize; unusedSector = -1 * info.m_sectorSize; sumUsed = -1 * info.m_sectorSize; @@ -450,12 +451,12 @@ void InfoShowWidget::onCurSelectChanged() QString sumUnusedSiz = Utils::LVMFormatSize(sumUnused); if (sumUsedSize.contains("-")) { - qDebug() << "LUKS disk used size is not available."; + qCDebug(appLog) << "LUKS disk used size is not available."; used = "-"; } if (sumUnusedSiz.contains("-")) { - qDebug() << "LUKS disk unused size is not available."; + qCDebug(appLog) << "LUKS disk unused size is not available."; unused = "-"; } @@ -476,7 +477,7 @@ void InfoShowWidget::onCurSelectChanged() // m_vgSizeInfoWidget->setData(info); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS && info.m_partition.size() == 0) { - qDebug() << "Disk is LUKS encrypted and has no partitions."; + qCDebug(appLog) << "Disk is LUKS encrypted and has no partitions."; // 当前磁盘是整盘加密时的逻辑处理 m_partitionInfoWidget->hide(); m_vgSizeInfoWidget->hide(); @@ -488,12 +489,12 @@ void InfoShowWidget::onCurSelectChanged() DPalette palette; DGuiApplicationHelper::ColorType themeType = DGuiApplicationHelper::instance()->themeType(); if (themeType == DGuiApplicationHelper::LightType) { - qDebug() << "Light theme is used."; + qCDebug(appLog) << "Light theme is used."; fillcolor = QColor("#0091ff"); fillcolor1 = palette.color(DPalette::Normal, DPalette::ToolTipText); fillcolor1.setAlphaF(0.1); } else if (themeType == DGuiApplicationHelper::DarkType) { - qDebug() << "Dark theme is used."; + qCDebug(appLog) << "Dark theme is used."; fillcolor = QColor("#0059D2"); fillcolor1 = palette.color(DPalette::Normal, DPalette::BrightText); fillcolor1.setAlphaF(0.2); @@ -503,7 +504,7 @@ void InfoShowWidget::onCurSelectChanged() QVector size {m_used, m_noused}; m_infoWidget->setData(info, color, size, 1); } else if (DMDbusHandler::instance()->getIsJoinAllVG().value(info.m_path) == "false") { - qDebug() << "Disk is not joined to any VG."; + qCDebug(appLog) << "Disk is not joined to any VG."; // 判断当前磁盘是否全部加入VG,是则显示磁盘下VG的分布情况,否则依然显示磁盘分区的分布情况 m_partitionInfoWidget->show(); m_vgSizeInfoWidget->hide(); @@ -511,7 +512,7 @@ void InfoShowWidget::onCurSelectChanged() m_partitionInfoWidget->setData(info); } else { - qDebug() << "Disk is joined to VG."; + qCDebug(appLog) << "Disk is joined to VG."; m_partitionInfoWidget->hide(); m_infoWidget->hide(); m_vgSizeInfoWidget->show(); @@ -520,7 +521,7 @@ void InfoShowWidget::onCurSelectChanged() m_vgSizeInfoWidget->setData(vglist); } } else if (DMDbusHandler::VOLUMEGROUP == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Current level is VOLUMEGROUP."; + qCDebug(appLog) << "Current level is VOLUMEGROUP."; m_partitionInfoWidget->hide(); m_infoWidget->hide(); m_vgSizeInfoWidget->show(); @@ -528,13 +529,13 @@ void InfoShowWidget::onCurSelectChanged() VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); QString vgSize = vgInfo.m_vgSize; if (vgSize.contains("1024")) { - qDebug() << "VG size is in 1024 units."; + qCDebug(appLog) << "VG size is in 1024 units."; vgSize = Utils::LVMFormatSize(vgInfo.m_peCount * vgInfo.m_PESize + vgInfo.m_PESize); } QString unused = vgInfo.m_vgUnused; if (unused.contains("1024")) { - qDebug() << "VG unused size is in 1024 units."; + qCDebug(appLog) << "VG unused size is in 1024 units."; unused = Utils::LVMFormatSize(vgInfo.m_peCount * vgInfo.m_PESize + vgInfo.m_PESize); } @@ -553,7 +554,7 @@ void InfoShowWidget::onCurSelectChanged() m_infoTopFrame->updateDiskInfo(); m_vgSizeInfoWidget->setData(vgInfo); } else if (DMDbusHandler::LOGICALVOLUME == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Current level is LOGICALVOLUME."; + qCDebug(appLog) << "Current level is LOGICALVOLUME."; m_partitionInfoWidget->hide(); m_infoWidget->show(); m_vgSizeInfoWidget->hide(); @@ -572,10 +573,10 @@ void InfoShowWidget::onCurSelectChanged() QString lvSize = lvInfo.m_lvSize; if (lvInfo.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "LV is LUKS encrypted."; + qCDebug(appLog) << "LV is LUKS encrypted."; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(lvInfo.m_lvPath); if (luksInfo.isDecrypt) { - qDebug() << "LV is LUKS encrypted and decrypted."; + qCDebug(appLog) << "LV is LUKS encrypted and decrypted."; unused = Utils::LVMFormatSize(luksInfo.m_mapper.m_fsUnused); used = Utils::LVMFormatSize(luksInfo.m_mapper.m_fsUsed); mountPoint = ""; @@ -586,7 +587,7 @@ void InfoShowWidget::onCurSelectChanged() unusedSize = Utils::LVMSizeToUnit(luksInfo.m_mapper.m_fsUnused, SIZE_UNIT::UNIT_GIB); usedSize = Utils::LVMSizeToUnit(luksInfo.m_mapper.m_fsUsed, SIZE_UNIT::UNIT_GIB); } else { - qDebug() << "LV is LUKS encrypted but not decrypted."; + qCDebug(appLog) << "LV is LUKS encrypted but not decrypted."; unused = "-"; used = "-"; usedSize = 0.00; @@ -595,34 +596,34 @@ void InfoShowWidget::onCurSelectChanged() } if (lvInfo.m_lvName.isEmpty() && lvInfo.m_lvUuid.isEmpty()) { - qDebug() << "LV is unallocated."; + qCDebug(appLog) << "LV is unallocated."; unused = Utils::LVMFormatSize(lvInfo.m_lvLECount * lvInfo.m_LESize); unusedSize = Utils::LVMSizeToUnit(lvInfo.m_lvLECount * lvInfo.m_LESize, SIZE_UNIT::UNIT_GIB); lvName = "unallocated"; } if (usedSize == 0.00 && unusedSize == 0.00) { - qDebug() << "LV size is not available."; + qCDebug(appLog) << "LV size is not available."; unused = Utils::LVMFormatSize(lvInfo.m_lvLECount * lvInfo.m_LESize); } if (used.contains("-")) { - qDebug() << "LV used size is not available."; + qCDebug(appLog) << "LV used size is not available."; used = "-"; } if (unused.contains("-")) { - qDebug() << "LV unused size is not available."; + qCDebug(appLog) << "LV unused size is not available."; unused = "-"; } if (lvSize.contains("1024")) { - qDebug() << "LV size is in 1024 units."; + qCDebug(appLog) << "LV size is in 1024 units."; lvSize = Utils::LVMFormatSize(lvInfo.m_lvLECount * lvInfo.m_LESize + lvInfo.m_LESize); } if (unused.contains("1024")) { - qDebug() << "LV unused size is in 1024 units."; + qCDebug(appLog) << "LV unused size is in 1024 units."; unused = Utils::LVMFormatSize(lvInfo.m_lvLECount * lvInfo.m_LESize + lvInfo.m_LESize); } @@ -643,12 +644,12 @@ void InfoShowWidget::onCurSelectChanged() // typeLabel->setText(typeLabel->objectName()); DGuiApplicationHelper::ColorType themeType = DGuiApplicationHelper::instance()->themeType(); if (themeType == DGuiApplicationHelper::LightType) { - qDebug() << "Light theme is used."; + qCDebug(appLog) << "Light theme is used."; fillcolor = QColor("#0091ff"); fillcolor1 = palette.color(DPalette::Normal, DPalette::ToolTipText); fillcolor1.setAlphaF(0.1); } else if (themeType == DGuiApplicationHelper::DarkType) { - qDebug() << "Dark theme is used."; + qCDebug(appLog) << "Dark theme is used."; fillcolor = QColor("#0059D2"); fillcolor1 = palette.color(DPalette::Normal, DPalette::BrightText); fillcolor1.setAlphaF(0.2); @@ -662,17 +663,17 @@ void InfoShowWidget::onCurSelectChanged() void InfoShowWidget::onHandleChangeTheme() { - qDebug() << "Handling theme change"; + qCDebug(appLog) << "Handling theme change"; DPalette palette; DGuiApplicationHelper::ColorType themeType = DGuiApplicationHelper::instance()->themeType(); if (themeType == DGuiApplicationHelper::LightType) { - qDebug() << "Light theme is used."; + qCDebug(appLog) << "Light theme is used."; fillcolor = QColor("#0091ff"); fillcolor1 = palette.color(DPalette::Normal, DPalette::ToolTipText); fillcolor1.setAlphaF(0.1); } else if (themeType == DGuiApplicationHelper::DarkType) { - qDebug() << "Dark theme is used."; + qCDebug(appLog) << "Dark theme is used."; fillcolor = QColor("#0059D2"); fillcolor1 = palette.color(DPalette::Normal, DPalette::BrightText); fillcolor1.setAlphaF(0.2); @@ -688,9 +689,9 @@ void InfoShowWidget::onHandleChangeTheme() void InfoShowWidget::onEnterWidget(QRectF rect, QString path) { - qDebug() << "Mouse entered widget, path:" << path; + qCDebug(appLog) << "Mouse entered widget, path:" << path; if ("unallocated" != path) { - qDebug() << "Path is not 'unallocated'."; + qCDebug(appLog) << "Path is not 'unallocated'."; path = path.remove(0, 5); } @@ -709,15 +710,15 @@ void InfoShowWidget::onEnterWidget(QRectF rect, QString path) void InfoShowWidget::onLeaveWidget() { - // qDebug() << "Mouse left widget"; + // qCDebug(appLog) << "Mouse left widget"; m_arrowRectangle->hide(); } void InfoShowWidget::onEnterVGInfoWidget(QRect rect, const QList > &lstInfo) { - // qDebug() << "Mouse entered VG info widget"; + // qCDebug(appLog) << "Mouse entered VG info widget"; if (!m_vgInfoShowWidget->isHidden()) { - qDebug() << "VG info widget is already visible."; + qCDebug(appLog) << "VG info widget is already visible."; return; } diff --git a/application/widgets/mainsplitter.cpp b/application/widgets/mainsplitter.cpp index 62346d14..499ec7db 100644 --- a/application/widgets/mainsplitter.cpp +++ b/application/widgets/mainsplitter.cpp @@ -1,8 +1,9 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "mainsplitter.h" #include "devicelistwidget.h" #include "infoshowwidget.h" @@ -11,7 +12,7 @@ MainSplitter::MainSplitter(DWidget *parent) : DSplitter(parent) { - qDebug() << "MainSplitter constructor"; + qCDebug(appLog) << "MainSplitter constructor"; setFrameShape(QFrame::NoFrame); initui(); @@ -20,13 +21,13 @@ MainSplitter::MainSplitter(DWidget *parent) void MainSplitter::initui() { - qDebug() << "Initializing MainSplitter UI"; + qCDebug(appLog) << "Initializing MainSplitter UI"; setHandleWidth(1); setChildrenCollapsible(false); // 子部件不可拉伸到 0 - qDebug() << "Creating device list widget"; + qCDebug(appLog) << "Creating device list widget"; m_deviceList = new DeviceListWidget(this); - qDebug() << "Creating info show widget"; + qCDebug(appLog) << "Creating info show widget"; m_infoShow = new InfoShowWidget(this); setMouseTracking(true); @@ -34,15 +35,15 @@ void MainSplitter::initui() m_infoShow->setFrameShape(QFrame::NoFrame); - qDebug() << "Adding widgets to splitter"; + qCDebug(appLog) << "Adding widgets to splitter"; addWidget(m_deviceList); addWidget(m_infoShow); - qDebug() << "Setting stretch factors (1:4 ratio)"; + qCDebug(appLog) << "Setting stretch factors (1:4 ratio)"; setStretchFactor(0, 1); setStretchFactor(1, 4); } void MainSplitter::initConnection() { - qDebug() << "Initializing MainSplitter connections"; + qCDebug(appLog) << "Initializing MainSplitter connections"; } diff --git a/application/widgets/mainwindow.cpp b/application/widgets/mainwindow.cpp index 3a695317..077dd293 100644 --- a/application/widgets/mainwindow.cpp +++ b/application/widgets/mainwindow.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "mainwindow.h" #include "centerwidget.h" #include "titlewidget.h" @@ -26,7 +27,7 @@ MainWindow *MainWindow::instance() { static MainWindow *m = nullptr; if (m == nullptr) { - qDebug() << "Creating MainWindow singleton instance"; + qCDebug(appLog) << "Creating MainWindow singleton instance"; m = new MainWindow; } return m; @@ -35,7 +36,7 @@ MainWindow *MainWindow::instance() MainWindow::MainWindow(QWidget *parent) : DMainWindow(parent) { - qDebug() << "MainWindow constructor"; + qCDebug(appLog) << "MainWindow constructor"; // if (false == DeviceInfoParser::instance().getRootPassword()) { // exit(-1); // } @@ -59,16 +60,16 @@ MainWindow::MainWindow(QWidget *parent) int scaleWidth = screenGeometry.width() * DEFAULT_SCALE; int scaleHeight = screenGeometry.height() * DEFAULT_SCALE; if (scaleWidth < normal.width() && scaleHeight < normal.height()) { - qDebug() << "Screen dimensions are smaller than normal, adjusting window size."; + qCDebug(appLog) << "Screen dimensions are smaller than normal, adjusting window size."; normal.setWidth(scaleWidth); normal.setHeight(scaleHeight); } if (normal.width() < minWidth || normal.height() < minHeight) { - qDebug() << "Adjusting window to minimum size."; + qCDebug(appLog) << "Adjusting window to minimum size."; setMinimumSize(minWidth, minHeight); } else { - qDebug() << "Setting window to normal size."; + qCDebug(appLog) << "Setting window to normal size."; setMinimumSize(normal.width(), normal.height()); } @@ -76,12 +77,12 @@ MainWindow::MainWindow(QWidget *parent) // m_handler->getDeviceInfo(); //call after initUi QTimer::singleShot(200, this, SLOT(getDeviceInfo())); - qDebug() << "MainWindow constructor finished."; + qCDebug(appLog) << "MainWindow constructor finished."; } MainWindow::~MainWindow() { - qDebug() << "MainWindow destructor called."; + qCDebug(appLog) << "MainWindow destructor called."; // if (nullptr != m_bufferWin) { // m_bufferWin->deleteLater(); // } @@ -89,7 +90,7 @@ MainWindow::~MainWindow() void MainWindow::closeEvent(QCloseEvent *event) { - qDebug() << "MainWindow::closeEvent called."; + qCDebug(appLog) << "MainWindow::closeEvent called."; m_central->HandleQuit(); // m_handler->Quit(); QProcess proc; @@ -98,12 +99,12 @@ void MainWindow::closeEvent(QCloseEvent *event) proc.startDetached("dbus-send", argList); DMainWindow::closeEvent(event); - qDebug() << "MainWindow::closeEvent completed."; + qCDebug(appLog) << "MainWindow::closeEvent completed."; } void MainWindow::initUi() { - qDebug() << "Initializing MainWindow UI"; + qCDebug(appLog) << "Initializing MainWindow UI"; m_dialog = new AnimationDialog(this); m_dialog->setWindowModality(Qt::ApplicationModal); m_dialog->hide(); @@ -115,7 +116,7 @@ void MainWindow::initUi() QIcon icon = Common::getIcon("refresh"); m_btnRefresh->setIcon(icon); setSizebyMode(m_btnRefresh); - qDebug() << "setSizebyMode called for m_btnRefresh."; + qCDebug(appLog) << "setSizebyMode called for m_btnRefresh."; m_btnRefresh->setToolTip(tr("Refresh")); m_btnRefresh->setCheckable(false); m_btnRefresh->setObjectName("refresh"); @@ -135,43 +136,43 @@ void MainWindow::initUi() titlebar()->addWidget(widget, Qt::AlignLeft); titlebar()->addWidget(m_central->getTitleWidget(), Qt::AlignCenter); titlebar()->menu(); - qDebug() << "MainWindow UI initialization complete."; + qCDebug(appLog) << "MainWindow UI initialization complete."; } void MainWindow::setSizebyMode(DPushButton *button) { - qDebug() << "setSizebyMode called."; + qCDebug(appLog) << "setSizebyMode called."; #ifdef DTKWIDGET_CLASS_DSizeMode - qDebug() << "DTKWIDGET_CLASS_DSizeMode is defined, setting size by DSizeModeHelper."; + qCDebug(appLog) << "DTKWIDGET_CLASS_DSizeMode is defined, setting size by DSizeModeHelper."; button->setFixedSize(QSize(DSizeModeHelper::element(24, 36), DSizeModeHelper::element(24, 36))); button->setIconSize(QSize(DSizeModeHelper::element(12, 18), DSizeModeHelper::element(12, 18))); #else - qDebug() << "DTKWIDGET_CLASS_DSizeMode is not defined, setting fixed size (36x36) and icon size (18x18)."; + qCDebug(appLog) << "DTKWIDGET_CLASS_DSizeMode is not defined, setting fixed size (36x36) and icon size (18x18)."; button->setFixedSize(QSize(36, 36)); button->setIconSize(QSize(18, 18)); #endif - qDebug() << "setSizebyMode completed."; + qCDebug(appLog) << "setSizebyMode completed."; } void MainWindow::initConnection() { - qDebug() << "Setting up MainWindow signal connections"; + qCDebug(appLog) << "Setting up MainWindow signal connections"; connect(m_handler, &DMDbusHandler::showSpinerWindow, this, &MainWindow::onShowSpinerWindow); connect(m_btnRefresh, &DPushButton::clicked, this, &MainWindow::onRefreshButtonClicked); #ifdef DTKWIDGET_CLASS_DSizeMode - qDebug() << "Connecting sizeModeChanged signal for DTKWIDGET_CLASS_DSizeMode."; + qCDebug(appLog) << "Connecting sizeModeChanged signal for DTKWIDGET_CLASS_DSizeMode."; connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, [this]() { setSizebyMode(m_btnRefresh); - qDebug() << "Size mode changed, setSizebyMode called for m_btnRefresh."; + qCDebug(appLog) << "Size mode changed, setSizebyMode called for m_btnRefresh."; }); #endif - qDebug() << "MainWindow signal connections setup complete."; + qCDebug(appLog) << "MainWindow signal connections setup complete."; } void MainWindow::onHandleQuitAction() { //ToDo judge exit or no - qDebug() << __FUNCTION__; + qCDebug(appLog) << __FUNCTION__; QProcess proc; QString args = QString("--system --type=method_call --dest=com.deepin.diskmanager /com/deepin/diskmanager com.deepin.diskmanager.Quit"); @@ -187,26 +188,26 @@ QString MainWindow::getRootLoginResult() void MainWindow::getDeviceInfo() { - qDebug() << "Requesting device information"; + qCDebug(appLog) << "Requesting device information"; m_handler->getDeviceInfo(); //call after initUi } void MainWindow::onRefreshButtonClicked() { - qDebug() << "Refresh button clicked"; + qCDebug(appLog) << "Refresh button clicked"; m_handler->refresh(); } void MainWindow::onShowSpinerWindow(bool isShow, const QString &title) { - qDebug() << "Spinner window visibility changed:" << isShow << "title:" << title; + qCDebug(appLog) << "Spinner window visibility changed:" << isShow << "title:" << title; if (isShow) { - qDebug() << "Show spinner window"; + qCDebug(appLog) << "Show spinner window"; Dtk::Widget::moveToCenter(m_dialog); m_dialog->setShowSpinner(isShow, title); m_dialog->show(); } else { - qDebug() << "Hide spinner window"; + qCDebug(appLog) << "Hide spinner window"; m_dialog->setShowSpinner(isShow, title); m_dialog->hide(); diff --git a/application/widgets/messagebox.cpp b/application/widgets/messagebox.cpp index 8e3bbeea..0902db43 100644 --- a/application/widgets/messagebox.cpp +++ b/application/widgets/messagebox.cpp @@ -1,9 +1,10 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "messagebox.h" #include @@ -16,29 +17,29 @@ MessageBox::MessageBox(QWidget *parent) : DDialog(parent) { - qDebug() << "MessageBox constructor"; + qCDebug(appLog) << "MessageBox constructor"; } void MessageBox::setWarings(const QString &title, const QString &warningMsg, const QString &sureBtnText, const QString &sureAccessibleName, const QString &cancalBtnText, const QString &cancelAccessibleName) { - qDebug() << "Setting warning message box with title:" << title + qCDebug(appLog) << "Setting warning message box with title:" << title << "sureBtnText:" << sureBtnText; setIcon(QIcon::fromTheme("://icons/deepin/builtin/exception-logo.svg")); if (!title.isEmpty()) { - qDebug() << "Title is not empty, setting title."; + qCDebug(appLog) << "Title is not empty, setting title."; setTitle(title); addSpacing(10); } if (!warningMsg.isEmpty()) { - qDebug() << "Warning message is not empty, adding label."; + qCDebug(appLog) << "Warning message is not empty, adding label."; addLabel(warningMsg); addSpacing(10); } if (!cancalBtnText.isEmpty()) { - qDebug() << "Cancel button text is not empty, adding button."; + qCDebug(appLog) << "Cancel button text is not empty, adding button."; int index = addButton(cancalBtnText); getButton(index)->setAccessibleName(cancelAccessibleName); } @@ -46,32 +47,32 @@ void MessageBox::setWarings(const QString &title, const QString &warningMsg, con int index = addButton(sureBtnText); getButton(index)->setAccessibleName(sureAccessibleName); connect(this, &MessageBox::buttonClicked, this, [=]() { - qDebug() << "Sure button clicked, closing message box."; + qCDebug(appLog) << "Sure button clicked, closing message box."; close(); }); - qDebug() << "MessageBox::setWarings (first overload) completed."; + qCDebug(appLog) << "MessageBox::setWarings (first overload) completed."; } void MessageBox::setWarings(const QString &title, const QString &warningMsg, const QString &sureBtnText, ButtonType sureBtnType, const QString &sureAccessibleName, const QString &cancalBtnText, const QString &cancelAccessibleName) { - qDebug() << "Setting warning message box with button type:" << sureBtnType + qCDebug(appLog) << "Setting warning message box with button type:" << sureBtnType << "title:" << title; setIcon(QIcon::fromTheme("://icons/deepin/builtin/exception-logo.svg")); if (!title.isEmpty()) { - qDebug() << "Title is not empty, setting title."; + qCDebug(appLog) << "Title is not empty, setting title."; setTitle(title); addSpacing(10); } if (!warningMsg.isEmpty()) { - qDebug() << "Warning message is not empty, adding label."; + qCDebug(appLog) << "Warning message is not empty, adding label."; addLabel(warningMsg); addSpacing(10); } if (!cancalBtnText.isEmpty()) { - qDebug() << "Cancel button text is not empty, adding button."; + qCDebug(appLog) << "Cancel button text is not empty, adding button."; int index = addButton(cancalBtnText); getButton(index)->setAccessibleName(cancelAccessibleName); } @@ -79,16 +80,16 @@ void MessageBox::setWarings(const QString &title, const QString &warningMsg, con int index = addButton(sureBtnText, false, sureBtnType); getButton(index)->setAccessibleName(sureAccessibleName); connect(this, &MessageBox::buttonClicked, this, [=]() { - qDebug() << "Button clicked, closing message box."; + qCDebug(appLog) << "Button clicked, closing message box."; close(); }); - qDebug() << "MessageBox::setWarings (second overload) completed."; + qCDebug(appLog) << "MessageBox::setWarings (second overload) completed."; } void MessageBox::setWarings(const QString &title, const QString &sureBtnText, ButtonType sureBtnType, const QString &sureAccessibleName, const QString &cancalBtnText, const QString &cancelAccessibleName) { - qDebug() << "Setting warning message box with custom title layout" + qCDebug(appLog) << "Setting warning message box with custom title layout" << "title:" << title; setIcon(QIcon::fromTheme("://icons/deepin/builtin/exception-logo.svg")); @@ -104,25 +105,25 @@ void MessageBox::setWarings(const QString &title, const QString &sureBtnText, Bu label->setPalette(palette); QFontMetrics fmDevpath = label->fontMetrics(); #if QT_VERSION_MAJOR > 5 - qDebug() << "Calculating font metrics for Qt6 or higher."; + qCDebug(appLog) << "Calculating font metrics for Qt6 or higher."; int fmWidth = fmDevpath.boundingRect(label->text()).width(); #else - qDebug() << "Calculating font metrics for Qt5."; + qCDebug(appLog) << "Calculating font metrics for Qt5."; int fmWidth = fmDevpath.width(label->text()); #endif int labelWidth = fmWidth / 3 * 2; if (labelWidth >= (width() - 20)) { - qDebug() << "Label width adjusted to fit within dialog."; + qCDebug(appLog) << "Label width adjusted to fit within dialog."; labelWidth = width() - 20; } - qDebug() << "Calculated labelWidth:" << labelWidth << "dialog width:" << width(); + qCDebug(appLog) << "Calculated labelWidth:" << labelWidth << "dialog width:" << width(); label->setFixedWidth(labelWidth); label->adjustSize(); addContent(label, Qt::AlignHCenter); addSpacing(10); if (!cancalBtnText.isEmpty()) { - qDebug() << "Cancel button text is not empty, adding button."; + qCDebug(appLog) << "Cancel button text is not empty, adding button."; int index = addButton(cancalBtnText); getButton(index)->setAccessibleName(cancelAccessibleName); } @@ -130,19 +131,19 @@ void MessageBox::setWarings(const QString &title, const QString &sureBtnText, Bu int index = addButton(sureBtnText, false, sureBtnType); getButton(index)->setAccessibleName(sureAccessibleName); connect(this, &MessageBox::buttonClicked, this, [=]() { - qDebug() << "Button clicked, closing message box."; + qCDebug(appLog) << "Button clicked, closing message box."; close(); }); - qDebug() << "MessageBox::setWarings (third overload) completed."; + qCDebug(appLog) << "MessageBox::setWarings (third overload) completed."; } void MessageBox::setProgressBar(const QString &title, const QString &cancalBtnText) { - qDebug() << "Setting progress bar message box with title:" << title; + qCDebug(appLog) << "Setting progress bar message box with title:" << title; setIcon(QIcon::fromTheme("://icons/deepin/builtin/exception-logo.svg")); if (!title.isEmpty()) { - qDebug() << "Title is not empty, setting title."; + qCDebug(appLog) << "Title is not empty, setting title."; setTitle(title); addSpacing(10); } @@ -152,44 +153,44 @@ void MessageBox::setProgressBar(const QString &title, const QString &cancalBtnTe addButton(cancalBtnText); connect(this, &MessageBox::buttonClicked, this, [=]() { - qDebug() << "Button clicked, closing message box."; + qCDebug(appLog) << "Button clicked, closing message box."; close(); }); - qDebug() << "MessageBox::setProgressBar completed."; + qCDebug(appLog) << "MessageBox::setProgressBar completed."; } void MessageBox::addLabel(QString text) { - qDebug() << "Adding label to message box with text:" << text; + qCDebug(appLog) << "Adding label to message box with text:" << text; DLabel *label= new DLabel(this); label->setText(text); label->adjustSize(); label->setWordWrap(true); addContent(label, Qt::AlignHCenter); - qDebug() << "MessageBox::addLabel completed."; + qCDebug(appLog) << "MessageBox::addLabel completed."; } void MessageBox::addProgressBar() { - qDebug() << "Adding progress bar to message box"; + qCDebug(appLog) << "Adding progress bar to message box"; m_progressBar = new DProgressBar(this); m_progressBar->setValue(50); m_progressBar->setFixedSize(330, 10); addContent(m_progressBar, Qt::AlignHCenter); - qDebug() << "MessageBox::addProgressBar completed."; + qCDebug(appLog) << "MessageBox::addProgressBar completed."; } void MessageBox::keyPressEvent(QKeyEvent *event) { - // qDebug() << "Key press event in message box, key:" << event->key(); + // qCDebug(appLog) << "Key press event in message box, key:" << event->key(); if (event->key() == Qt::Key::Key_Escape) { - qDebug() << "Escape key pressed, ignoring event."; + qCDebug(appLog) << "Escape key pressed, ignoring event."; event->ignore(); } else { - // qDebug() << "Other key pressed, calling DDialog::keyPressEvent."; + // qCDebug(appLog) << "Other key pressed, calling DDialog::keyPressEvent."; DDialog::keyPressEvent(event); } - // qDebug() << "MessageBox::keyPressEvent completed."; + // qCDebug(appLog) << "MessageBox::keyPressEvent completed."; } diff --git a/application/widgets/mountdialog.cpp b/application/widgets/mountdialog.cpp index 018b37e8..45d81dd8 100644 --- a/application/widgets/mountdialog.cpp +++ b/application/widgets/mountdialog.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "mountdialog.h" #include "partedproxy/dmdbushandler.h" #include "messagebox.h" @@ -18,26 +19,26 @@ MountDialog::MountDialog(QWidget *parent) : DDBase(parent) { - qDebug() << "MountDialog constructor"; + qCDebug(appLog) << "MountDialog constructor"; initUi(); initConnection(); - qDebug() << "MountDialog initialized"; + qCDebug(appLog) << "MountDialog initialized"; } void MountDialog::initUi() { - qDebug() << "Initializing MountDialog UI"; + qCDebug(appLog) << "Initializing MountDialog UI"; setMinimumSize(QSize(420, 200)); if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is PARTITION, setting title for partition mount."; + qCDebug(appLog) << "Current level is PARTITION, setting title for partition mount."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setTitle(tr("Mount %1").arg(info.m_path)); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is LOGICALVOLUME, setting title for logical volume mount."; + qCDebug(appLog) << "Current level is LOGICALVOLUME, setting title for logical volume mount."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setTitle(tr("Mount %1").arg(lvInfo.m_lvPath)); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Current level is DISK, setting title for disk mount."; + qCDebug(appLog) << "Current level is DISK, setting title for disk mount."; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); setTitle(tr("Mount %1").arg(info.m_path)); } @@ -102,51 +103,51 @@ void MountDialog::initUi() getButton(index)->setAccessibleName("cancel"); getButton(m_okCode)->setAccessibleName("mountButton"); - qDebug() << "MountDialog UI initialization complete."; + qCDebug(appLog) << "MountDialog UI initialization complete."; } void MountDialog::initConnection() { - qDebug() << "Initializing MountDialog connections."; + qCDebug(appLog) << "Initializing MountDialog connections."; connect(m_fileChooserEdit->lineEdit(), &QLineEdit::textChanged, this, &MountDialog::onEditContentChanged); connect(this, &MountDialog::buttonClicked, this, &MountDialog::onButtonClicked); - qDebug() << "MountDialog connections initialized."; + qCDebug(appLog) << "MountDialog connections initialized."; } void MountDialog::onEditContentChanged(const QString &content) { - qDebug() << "onEditContentChanged called with content:" << content; + qCDebug(appLog) << "onEditContentChanged called with content:" << content; if (content.isEmpty()) { - qDebug() << "Content is empty, disabling mount button."; + qCDebug(appLog) << "Content is empty, disabling mount button."; getButton(m_okCode)->setDisabled(true); } else { QDir dir(content); if (dir.exists()) { - qDebug() << "Directory exists:" << content; + qCDebug(appLog) << "Directory exists:" << content; if (isSystemDirectory(content)) { - qDebug() << "Directory is a system directory, disabling mount button and showing warning."; + qCDebug(appLog) << "Directory is a system directory, disabling mount button and showing warning."; getButton(m_okCode)->setDisabled(true); m_warnning->setVisible(true); m_mountPointSuggest->setVisible(false); } else { - qDebug() << "Directory is not a system directory, enabling mount button and hiding warning."; + qCDebug(appLog) << "Directory is not a system directory, enabling mount button and hiding warning."; getButton(m_okCode)->setDisabled(false); m_warnning->setVisible(false); m_mountPointSuggest->setVisible(true); } // m_fileChooserEdit->setAlert(false); } else { - qDebug() << "Directory does not exist, disabling mount button."; + qCDebug(appLog) << "Directory does not exist, disabling mount button."; getButton(m_okCode)->setDisabled(true); // m_fileChooserEdit->setAlert(true); } } - qDebug() << "onEditContentChanged completed."; + qCDebug(appLog) << "onEditContentChanged completed."; } bool MountDialog::isExistMountPoint(const QString &mountPoint) { - qDebug() << "isExistMountPoint called for mountPoint:" << mountPoint; + qCDebug(appLog) << "isExistMountPoint called for mountPoint:" << mountPoint; // 判断是否有分区已经挂载在该路径 DeviceInfoMap infoMap = DMDbusHandler::instance()->probDeviceInfo(); for (auto devInfo = infoMap.begin(); devInfo != infoMap.end(); devInfo++) { @@ -156,13 +157,13 @@ bool MountDialog::isExistMountPoint(const QString &mountPoint) for (int i = 0; i < it->m_mountPoints.size(); i++) { mountpoints += it->m_mountPoints[i]; if (it->m_mountPoints.size() > 1 && mountPoint == it->m_mountPoints[i]) { - qDebug() << "Mount point exists for partition:" << mountPoint; + qCDebug(appLog) << "Mount point exists for partition:" << mountPoint; return true; } } if (mountPoint == mountpoints) { - qDebug() << "Mount point matches partition mountpoints:" << mountPoint; + qCDebug(appLog) << "Mount point matches partition mountpoints:" << mountPoint; return true; } } @@ -179,49 +180,49 @@ bool MountDialog::isExistMountPoint(const QString &mountPoint) for (int j = 0; j < info.m_mountPoints.size(); j++) { mountpoints += info.m_mountPoints[j]; if (info.m_mountPoints.size() > 1 && mountPoint == info.m_mountPoints[j]) { - qDebug() << "Mount point exists for logical volume:" << mountPoint; + qCDebug(appLog) << "Mount point exists for logical volume:" << mountPoint; return true; } } if (mountPoint == mountpoints) { - qDebug() << "Mount point matches logical volume mountpoints:" << mountPoint; + qCDebug(appLog) << "Mount point matches logical volume mountpoints:" << mountPoint; return true; } } } - qDebug() << "Mount point does not exist:" << mountPoint; + qCDebug(appLog) << "Mount point does not exist:" << mountPoint; return false; } bool MountDialog::isSystemDirectory(const QString &directory) { - qDebug() << "isSystemDirectory called for directory:" << directory; + qCDebug(appLog) << "isSystemDirectory called for directory:" << directory; if (directory.startsWith("/mnt") || directory.startsWith("/media")) { - qDebug() << "Directory starts with /mnt or /media, not a system directory."; + qCDebug(appLog) << "Directory starts with /mnt or /media, not a system directory."; return false; } - qDebug() << "Directory is a system directory."; + qCDebug(appLog) << "Directory is a system directory."; return true; } void MountDialog::mountCurPath() { - qDebug() << "mountCurPath called."; - qInfo() << "Starting mount operation for current path"; + qCDebug(appLog) << "mountCurPath called."; + qCInfo(appLog) << "Starting mount operation for current path"; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is PARTITION for mount operation."; + qCDebug(appLog) << "Current level is PARTITION for mount operation."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); if (!onCheckMountPoint(static_cast(info.m_fileSystemType), m_fileChooserEdit->text())) { - qDebug() << "Mount point check failed for partition, returning."; + qCDebug(appLog) << "Mount point check failed for partition, returning."; return; } if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "Partition is LUKS encrypted, attempting crypt mount."; + qCDebug(appLog) << "Partition is LUKS encrypted, attempting crypt mount."; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path); if (!onCheckMountPoint(luksInfo.m_mapper.m_luksFs, m_fileChooserEdit->text())) { - qDebug() << "Mount point check failed for LUKS partition, returning."; + qCDebug(appLog) << "Mount point check failed for LUKS partition, returning."; return; } QVector mountPoints; @@ -230,22 +231,22 @@ void MountDialog::mountCurPath() DMDbusHandler::instance()->cryptMount(luksInfo, info.m_path); } else { - qDebug() << "Partition is not LUKS encrypted, attempting standard mount."; + qCDebug(appLog) << "Partition is not LUKS encrypted, attempting standard mount."; DMDbusHandler::instance()->mount(m_fileChooserEdit->text()); } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is LOGICALVOLUME for mount operation."; + qCDebug(appLog) << "Current level is LOGICALVOLUME for mount operation."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); if (!onCheckMountPoint(lvInfo.m_lvFsType, m_fileChooserEdit->text())) { - qDebug() << "Mount point check failed for logical volume, returning."; + qCDebug(appLog) << "Mount point check failed for logical volume, returning."; return; } if (lvInfo.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "Logical volume is LUKS encrypted, attempting crypt mount."; + qCDebug(appLog) << "Logical volume is LUKS encrypted, attempting crypt mount."; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(lvInfo.m_lvPath); if (!onCheckMountPoint(luksInfo.m_mapper.m_luksFs, m_fileChooserEdit->text())) { - qDebug() << "Mount point check failed for LUKS logical volume, returning."; + qCDebug(appLog) << "Mount point check failed for LUKS logical volume, returning."; return; } @@ -255,7 +256,7 @@ void MountDialog::mountCurPath() DMDbusHandler::instance()->cryptMount(luksInfo, lvInfo.m_lvName); } else { - qDebug() << "Logical volume is not LUKS encrypted, attempting standard mount."; + qCDebug(appLog) << "Logical volume is not LUKS encrypted, attempting standard mount."; LVAction lvAction; lvAction.m_vgName = lvInfo.m_vgName; lvAction.m_lvName = lvInfo.m_lvName; @@ -268,10 +269,10 @@ void MountDialog::mountCurPath() DMDbusHandler::instance()->onMountLV(lvAction); } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Current level is DISK for mount operation."; + qCDebug(appLog) << "Current level is DISK for mount operation."; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "Disk is LUKS encrypted, attempting crypt mount."; + qCDebug(appLog) << "Disk is LUKS encrypted, attempting crypt mount."; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path); QVector mountPoints; mountPoints.append(m_fileChooserEdit->text()); @@ -280,66 +281,66 @@ void MountDialog::mountCurPath() DMDbusHandler::instance()->cryptMount(luksInfo, info.m_path); } } - qDebug() << "mountCurPath completed."; + qCDebug(appLog) << "mountCurPath completed."; } void MountDialog::onButtonClicked(int index, const QString &text) { - qDebug() << "Button clicked - index:" << index << "text:" << text; + qCDebug(appLog) << "Button clicked - index:" << index << "text:" << text; Q_UNUSED(text); if (index == m_okCode) { - qDebug() << "OK button clicked, checking mount point."; + qCDebug(appLog) << "OK button clicked, checking mount point."; QString mountPath = m_fileChooserEdit->text(); if (mountPath.endsWith("/")) { - qDebug() << "Mount path ends with '/', removing trailing slash."; + qCDebug(appLog) << "Mount path ends with '/', removing trailing slash."; mountPath.chop(1); } QDir dir(mountPath); if (!dir.isEmpty() || isExistMountPoint(mountPath)) { - qDebug() << "Checking mount point:" << mountPath; + qCDebug(appLog) << "Checking mount point:" << mountPath; MessageBox messageBox(this); messageBox.setObjectName("mountMessageBox"); messageBox.setAccessibleName("messageBox"); messageBox.setWarings(tr("The data under this mount point would be lost, please mount the directory to another location"), "", tr("Continue", "button"), "ok", tr("Cancel"), "cancelBtn"); if (messageBox.exec() == 1) { - qInfo() << "User confirmed mount operation despite warning"; + qCInfo(appLog) << "User confirmed mount operation despite warning"; mountCurPath(); close(); } } else { - qDebug() << "Cancel button clicked, closing dialog."; + qCDebug(appLog) << "Cancel button clicked, closing dialog."; mountCurPath(); close(); } } else { - qDebug() << "Cancel button clicked, closing dialog."; + qCDebug(appLog) << "Cancel button clicked, closing dialog."; close(); } } bool MountDialog::onCheckMountPoint(FSType fsType, const QString &mountPoint) { - qDebug() << "Checking mount point validity for FS type:" << fsType << "path:" << mountPoint; + qCDebug(appLog) << "Checking mount point validity for FS type:" << fsType << "path:" << mountPoint; //exfat文件系统的挂载点必须为空目录 if (fsType == FS_EXFAT) { - qDebug() << "Checking EXFAT mount point requirements"; + qCDebug(appLog) << "Checking EXFAT mount point requirements"; QDir dir(m_fileChooserEdit->text()); if (!dir.isEmpty()) { - qWarning() << "Mount point not empty for EXFAT filesystem"; + qCWarning(appLog) << "Mount point not empty for EXFAT filesystem"; MessageBox messageBox(this); messageBox.setObjectName("mountPointMessageBox"); messageBox.setAccessibleName("mountPointMessageBox"); messageBox.setWarings("", tr("Mounting failed: The selected mount point is not empty. Please select another one!"), tr("OK", "button"), ButtonNormal); if (messageBox.exec() == 1) { - qDebug() << "User confirmed mount point change, closing dialog."; + qCDebug(appLog) << "User confirmed mount point change, closing dialog."; close(); } return false; } } - qDebug() << "Mount point check passed for FS type:" << fsType << "path:" << mountPoint; + qCDebug(appLog) << "Mount point check passed for FS type:" << fsType << "path:" << mountPoint; return true; } diff --git a/application/widgets/partitiondialog.cpp b/application/widgets/partitiondialog.cpp index 35d15728..cddc4dba 100644 --- a/application/widgets/partitiondialog.cpp +++ b/application/widgets/partitiondialog.cpp @@ -1,8 +1,9 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "partitiondialog.h" #include "partedproxy/dmdbushandler.h" #include "partitioninfo.h" @@ -17,13 +18,13 @@ PartitionDialog::PartitionDialog(QWidget *parent) : DDBase(parent) { - qDebug() << "PartitionDialog initialized"; + qCDebug(appLog) << "PartitionDialog initialized"; initUi(); } void PartitionDialog::initUi() { - qInfo() << "Initializing partition dialog UI"; + qCInfo(appLog) << "Initializing partition dialog UI"; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setTitle(tr("Partition %1").arg(info.m_path)); @@ -44,7 +45,7 @@ void PartitionDialog::initUi() void PartitionDialog::setTitleText(const QString &title, const QString &subTitle) { - qDebug() << "Setting dialog title to:" << title << "and subtitle to:" << subTitle; + qCDebug(appLog) << "Setting dialog title to:" << title << "and subtitle to:" << subTitle; setTitle(title); m_tipLabel->setText(subTitle); } diff --git a/application/widgets/partitiontableerrorsinfodelegate.cpp b/application/widgets/partitiontableerrorsinfodelegate.cpp index 9335d837..31e44983 100644 --- a/application/widgets/partitiontableerrorsinfodelegate.cpp +++ b/application/widgets/partitiontableerrorsinfodelegate.cpp @@ -1,8 +1,9 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "partitiontableerrorsinfodelegate.h" #include "common.h" @@ -21,24 +22,24 @@ PartitionTableErrorsInfoDelegate::PartitionTableErrorsInfoDelegate(DDialog *dialog) { - qDebug() << "PartitionTableErrorsInfoDelegate initialized"; + qCDebug(appLog) << "PartitionTableErrorsInfoDelegate initialized"; m_dialog = dialog; } void PartitionTableErrorsInfoDelegate::setTextColor(const QColor &color) { - qDebug() << "Setting text color to:" << color.name(); + qCDebug(appLog) << "Setting text color to:" << color.name(); m_color = color; } void PartitionTableErrorsInfoDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { - // qDebug() << "paint called for index:" << index.row() << ", column:" << index.column(); + // qCDebug(appLog) << "paint called for index:" << index.row() << ", column:" << index.column(); painter->save(); QRect paintRect = QRect(option.rect.left(), option.rect.top(), option.rect.width(), option.rect.height()); if (index.row() % 2 == 0) { - // qDebug() << "Row is even, adjusting paintRect."; + // qCDebug(appLog) << "Row is even, adjusting paintRect."; paintRect = QRect(option.rect.left() + 10, option.rect.top(), option.rect.width() - 20, option.rect.height()); } @@ -61,10 +62,10 @@ void PartitionTableErrorsInfoDelegate::paint(QPainter *painter, const QStyleOpti 270, 90); if (index.row() % 2 == 1) { - // qDebug() << "Row is odd, filling path with base palette."; + // qCDebug(appLog) << "Row is odd, filling path with base palette."; painter->fillPath(path, option.palette.base()); } else { - // qDebug() << "Row is even, filling path with alternateBase palette."; + // qCDebug(appLog) << "Row is even, filling path with alternateBase palette."; painter->fillPath(path, option.palette.alternateBase()); } @@ -82,7 +83,7 @@ void PartitionTableErrorsInfoDelegate::paint(QPainter *painter, const QStyleOpti painter->drawText(option.rect.x() + 36, option.rect.y() + 20, text); painter->restore(); - // qDebug() << "paint completed."; + // qCDebug(appLog) << "paint completed."; }