From 6461b931f7c9b43e739671dc3e933a4768280b7b 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 (1/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. --- .../widgets/accessible/accessiblewidget.cpp | 83 +-- application/widgets/animationdialog.cpp | 31 +- application/widgets/centerwidget.cpp | 11 +- application/widgets/createlvwidget.cpp | 305 +++++----- .../widgets/createpartitiontabledialog.cpp | 35 +- application/widgets/createvgwidget.cpp | 521 +++++++++--------- .../widgets/customcontrol/buttonlabel.cpp | 9 +- application/widgets/customcontrol/ddbase.cpp | 11 +- .../widgets/customcontrol/dmdiskinfobox.cpp | 23 +- .../widgets/customcontrol/dmframewidget.cpp | 43 +- 10 files changed, 541 insertions(+), 531 deletions(-) diff --git a/application/widgets/accessible/accessiblewidget.cpp b/application/widgets/accessible/accessiblewidget.cpp index 225c35da..496530d1 100644 --- a/application/widgets/accessible/accessiblewidget.cpp +++ b/application/widgets/accessible/accessiblewidget.cpp @@ -1,7 +1,8 @@ -// 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 "accessiblewidget.h" #include #include @@ -12,49 +13,49 @@ AccessibleWidget::AccessibleWidget(QWidget *widget) : QAccessibleWidget(widget) , m_widget(widget) { - qDebug() << "AccessibleWidget::AccessibleWidget constructor called."; + qCDebug(appLog) << "AccessibleWidget::AccessibleWidget constructor called."; } AccessibleWidget::~AccessibleWidget() { - // qDebug() << "AccessibleWidget::~AccessibleWidget destructor called."; + // qCDebug(appLog) << "AccessibleWidget::~AccessibleWidget destructor called."; } void *AccessibleWidget::interface_cast(QAccessible::InterfaceType t) { - qDebug() << "AccessibleWidget::interface_cast called with type:" << t; + qCDebug(appLog) << "AccessibleWidget::interface_cast called with type:" << t; switch (t) { case QAccessible::ActionInterface: - qDebug() << "Interface cast to ActionInterface."; + qCDebug(appLog) << "Interface cast to ActionInterface."; return static_cast(this); case QAccessible::TextInterface: - qDebug() << "Interface cast to TextInterface."; + qCDebug(appLog) << "Interface cast to TextInterface."; return static_cast(this); default: - qDebug() << "Interface cast to unknown type."; + qCDebug(appLog) << "Interface cast to unknown type."; return nullptr; } } QString AccessibleWidget::text(QAccessible::Text t) const { - qDebug() << "AccessibleWidget::text called with text type:" << t; + qCDebug(appLog) << "AccessibleWidget::text called with text type:" << t; switch (t) { case QAccessible::Name: - qDebug() << "Returning accessible name."; + qCDebug(appLog) << "Returning accessible name."; return m_widget->accessibleName(); case QAccessible::Description: - qDebug() << "Returning accessible description."; + qCDebug(appLog) << "Returning accessible description."; return m_widget->accessibleDescription(); default: - qDebug() << "Returning empty string for unknown text type."; + qCDebug(appLog) << "Returning empty string for unknown text type."; return QString(); } } QString AccessibleWidget::text(int startOffset, int endOffset) const { - qDebug() << "AccessibleWidget::text(int, int) called."; + qCDebug(appLog) << "AccessibleWidget::text(int, int) called."; Q_UNUSED(startOffset) Q_UNUSED(endOffset) @@ -63,7 +64,7 @@ QString AccessibleWidget::text(int startOffset, int endOffset) const void AccessibleWidget::selection(int selectionIndex, int *startOffset, int *endOffset) const { - qDebug() << "AccessibleWidget::selection called."; + qCDebug(appLog) << "AccessibleWidget::selection called."; Q_UNUSED(selectionIndex) Q_UNUSED(startOffset) Q_UNUSED(endOffset) @@ -71,26 +72,26 @@ void AccessibleWidget::selection(int selectionIndex, int *startOffset, int *endO int AccessibleWidget::selectionCount() const { - qDebug() << "AccessibleWidget::selectionCount called."; + qCDebug(appLog) << "AccessibleWidget::selectionCount called."; return 0; } void AccessibleWidget::addSelection(int startOffset, int endOffset) { - qDebug() << "AccessibleWidget::addSelection called."; + qCDebug(appLog) << "AccessibleWidget::addSelection called."; Q_UNUSED(startOffset) Q_UNUSED(endOffset) } void AccessibleWidget::removeSelection(int selectionIndex) { - qDebug() << "AccessibleWidget::removeSelection called."; + qCDebug(appLog) << "AccessibleWidget::removeSelection called."; Q_UNUSED(selectionIndex) } void AccessibleWidget::setSelection(int selectionIndex, int startOffset, int endOffset) { - qDebug() << "AccessibleWidget::setSelection called."; + qCDebug(appLog) << "AccessibleWidget::setSelection called."; Q_UNUSED(selectionIndex) Q_UNUSED(startOffset) Q_UNUSED(endOffset) @@ -98,25 +99,25 @@ void AccessibleWidget::setSelection(int selectionIndex, int startOffset, int end int AccessibleWidget::cursorPosition() const { - qDebug() << "AccessibleWidget::cursorPosition called."; + qCDebug(appLog) << "AccessibleWidget::cursorPosition called."; return 0; } void AccessibleWidget::setCursorPosition(int position) { - qDebug() << "AccessibleWidget::setCursorPosition called."; + qCDebug(appLog) << "AccessibleWidget::setCursorPosition called."; Q_UNUSED(position) } int AccessibleWidget::characterCount() const { - qDebug() << "AccessibleWidget::characterCount called."; + qCDebug(appLog) << "AccessibleWidget::characterCount called."; return 0; } QRect AccessibleWidget::characterRect(int offset) const { - qDebug() << "AccessibleWidget::characterRect called."; + qCDebug(appLog) << "AccessibleWidget::characterRect called."; Q_UNUSED(offset) return QRect(); @@ -124,7 +125,7 @@ QRect AccessibleWidget::characterRect(int offset) const int AccessibleWidget::offsetAtPoint(const QPoint &point) const { - qDebug() << "AccessibleWidget::offsetAtPoint called."; + qCDebug(appLog) << "AccessibleWidget::offsetAtPoint called."; Q_UNUSED(point) return 0; @@ -132,14 +133,14 @@ int AccessibleWidget::offsetAtPoint(const QPoint &point) const void AccessibleWidget::scrollToSubstring(int startIndex, int endIndex) { - qDebug() << "AccessibleWidget::scrollToSubstring called."; + qCDebug(appLog) << "AccessibleWidget::scrollToSubstring called."; Q_UNUSED(startIndex) Q_UNUSED(endIndex) } QString AccessibleWidget::attributes(int offset, int *startOffset, int *endOffset) const { - qDebug() << "AccessibleWidget::attributes called."; + qCDebug(appLog) << "AccessibleWidget::attributes called."; Q_UNUSED(offset) Q_UNUSED(startOffset) Q_UNUSED(endOffset) @@ -151,29 +152,29 @@ AccessibleLabel::AccessibleLabel(QLabel *label) : AccessibleWidget(label) , m_label(label) { - qDebug() << "AccessibleLabel::AccessibleLabel constructor called."; + qCDebug(appLog) << "AccessibleLabel::AccessibleLabel constructor called."; } AccessibleLabel::~AccessibleLabel() { - // qDebug() << "AccessibleLabel::~AccessibleLabel destructor called."; + // qCDebug(appLog) << "AccessibleLabel::~AccessibleLabel destructor called."; } QString AccessibleLabel::text(int startOffset, int endOffset) const { - qDebug() << "AccessibleLabel::text(int, int) called."; + qCDebug(appLog) << "AccessibleLabel::text(int, int) called."; if (Q_NULLPTR != m_label) { - qDebug() << "Label is not null."; + qCDebug(appLog) << "Label is not null."; if (m_label->objectName().contains("@==@")) { - qDebug() << "Label object name contains '@==@', removing it."; + qCDebug(appLog) << "Label object name contains '@==@', removing it."; return m_label->objectName().remove("@==@"); } else { - qDebug() << "Label object name does not contain '@==@', returning text."; + qCDebug(appLog) << "Label object name does not contain '@==@', returning text."; return m_label->text(); } } - qDebug() << "Label is null, calling base class text."; + qCDebug(appLog) << "Label is null, calling base class text."; return AccessibleWidget::text(startOffset, endOffset); } @@ -181,23 +182,23 @@ AccessibleButton::AccessibleButton(QPushButton *button) : AccessibleWidget(button) , m_button(button) { - qDebug() << "AccessibleButton::AccessibleButton constructor called."; + qCDebug(appLog) << "AccessibleButton::AccessibleButton constructor called."; } AccessibleButton::~AccessibleButton() { - qDebug() << "AccessibleButton::~AccessibleButton destructor called."; + qCDebug(appLog) << "AccessibleButton::~AccessibleButton destructor called."; } QString AccessibleButton::text(int startOffset, int endOffset) const { - qDebug() << "AccessibleButton::text(int, int) called."; + qCDebug(appLog) << "AccessibleButton::text(int, int) called."; if (Q_NULLPTR != m_button) { - qDebug() << "Button is not null, returning text."; + qCDebug(appLog) << "Button is not null, returning text."; return m_button->text(); } - qDebug() << "Button is null, calling base class text."; + qCDebug(appLog) << "Button is null, calling base class text."; return AccessibleWidget::text(startOffset, endOffset); } @@ -205,22 +206,22 @@ AccessibleComboBox::AccessibleComboBox(QComboBox *comboBox) : AccessibleWidget(comboBox) , m_comboBox(comboBox) { - qDebug() << "AccessibleComboBox::AccessibleComboBox constructor called."; + qCDebug(appLog) << "AccessibleComboBox::AccessibleComboBox constructor called."; } AccessibleComboBox::~AccessibleComboBox() { - qDebug() << "AccessibleComboBox::~AccessibleComboBox destructor called."; + qCDebug(appLog) << "AccessibleComboBox::~AccessibleComboBox destructor called."; } QString AccessibleComboBox::text(int startOffset, int endOffset) const { - qDebug() << "AccessibleComboBox::text(int, int) called."; + qCDebug(appLog) << "AccessibleComboBox::text(int, int) called."; if (Q_NULLPTR != m_comboBox) { - qDebug() << "ComboBox is not null, returning current text."; + qCDebug(appLog) << "ComboBox is not null, returning current text."; return m_comboBox->currentText(); } - qDebug() << "ComboBox is null, calling base class text."; + qCDebug(appLog) << "ComboBox is null, calling base class text."; return AccessibleWidget::text(startOffset, endOffset); } diff --git a/application/widgets/animationdialog.cpp b/application/widgets/animationdialog.cpp index f24a878d..c5fd8337 100644 --- a/application/widgets/animationdialog.cpp +++ b/application/widgets/animationdialog.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 "animationdialog.h" #include @@ -13,33 +14,33 @@ AnimationDialog::AnimationDialog(QWidget *parent) : DDialog(parent) { - qDebug() << "AnimationDialog initializing..."; + qCDebug(appLog) << "AnimationDialog initializing..."; initUi(); - qDebug() << "AnimationDialog initialized"; + qCDebug(appLog) << "AnimationDialog initialized"; } void AnimationDialog::initUi() { - qDebug() << "AnimationDialog::initUi called."; + qCDebug(appLog) << "AnimationDialog::initUi called."; setFixedSize(380, 160); setWindowFlags(windowFlags() & ~Qt::WindowCloseButtonHint); - qDebug() << "AnimationDialog window flags set."; + qCDebug(appLog) << "AnimationDialog window flags set."; DFrame *m_mainFrame = new DFrame(this); m_mainFrame->setFrameRounded(false); m_mainFrame->setFrameStyle(DFrame::NoFrame); addContent(m_mainFrame); - qDebug() << "Main frame initialized and added as content."; + qCDebug(appLog) << "Main frame initialized and added as content."; m_label = new DLabel(this); m_label->setAccessibleName("animationTitle"); - qDebug() << "Label initialized."; + qCDebug(appLog) << "Label initialized."; QVBoxLayout *mainLayout = new QVBoxLayout(m_mainFrame); m_spinner = new DSpinner(m_mainFrame); m_spinner->setFixedSize(28, 28); m_spinner->start(); m_spinner->hide(); - qDebug() << "Spinner initialized and started, initially hidden."; + qCDebug(appLog) << "Spinner initialized and started, initially hidden."; mainLayout->addWidget(m_label, 0, Qt::AlignCenter | Qt::AlignTop); mainLayout->addSpacing(15); @@ -47,31 +48,31 @@ void AnimationDialog::initUi() mainLayout->addStretch(); mainLayout->setSpacing(0); mainLayout->setContentsMargins(0, 0, 0, 0); - qDebug() << "Layout configured."; + qCDebug(appLog) << "Layout configured."; } void AnimationDialog::setShowSpinner(bool isShow, const QString &title) { - qDebug() << "Setting spinner visibility:" << isShow << "with title:" << title; + qCDebug(appLog) << "Setting spinner visibility:" << isShow << "with title:" << title; if (isShow) { - qDebug() << "Showing spinner."; + qCDebug(appLog) << "Showing spinner."; m_label->setText(title); m_spinner->show(); } else { - qDebug() << "Hiding spinner."; + qCDebug(appLog) << "Hiding spinner."; m_spinner->hide(); } } void AnimationDialog::keyPressEvent(QKeyEvent *event) { - // qDebug() << "AnimationDialog::keyPressEvent called. Key:" << event->key(); + // qCDebug(appLog) << "AnimationDialog::keyPressEvent called. 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 base keyPressEvent."; + // qCDebug(appLog) << "Other key pressed, calling base keyPressEvent."; DDialog::keyPressEvent(event); } } diff --git a/application/widgets/centerwidget.cpp b/application/widgets/centerwidget.cpp index 799b17de..7cd63a6f 100644 --- a/application/widgets/centerwidget.cpp +++ b/application/widgets/centerwidget.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 "centerwidget.h" #include "titlewidget.h" #include "mainsplitter.h" @@ -17,18 +18,18 @@ CenterWidget::CenterWidget(DWidget *parent) : Dtk::Widget::DWidget(parent) { - qDebug() << "CenterWidget initializing..."; + qCDebug(appLog) << "CenterWidget initializing..."; initUi(); } CenterWidget::~CenterWidget() { - qDebug() << "CenterWidget destroyed"; + qCDebug(appLog) << "CenterWidget destroyed"; } void CenterWidget::HandleQuit() { - qDebug() << "Handling CenterWidget quit"; + qCDebug(appLog) << "Handling CenterWidget quit"; } TitleWidget *CenterWidget::getTitleWidget() @@ -38,7 +39,7 @@ TitleWidget *CenterWidget::getTitleWidget() void CenterWidget::initUi() { - qDebug() << "Initializing CenterWidget UI"; + qCDebug(appLog) << "Initializing CenterWidget UI"; m_titleWidget = new TitleWidget(this); QVBoxLayout *mainlayout = new QVBoxLayout; diff --git a/application/widgets/createlvwidget.cpp b/application/widgets/createlvwidget.cpp index f4fe51b0..8a83b51f 100644 --- a/application/widgets/createlvwidget.cpp +++ b/application/widgets/createlvwidget.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "createlvwidget.h" #include "common.h" #include "customcontrol/passwordinputdialog.h" @@ -16,48 +17,48 @@ CreateLVWidget::CreateLVWidget(QWidget *parent) : DDialog(parent) { - qDebug() << "CreateLVWidget initializing..."; + qCDebug(appLog) << "CreateLVWidget initializing..."; initUi(); recPartitionInfo(); initConnection(); - qDebug() << "CreateLVWidget initialized for VG:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName; + qCDebug(appLog) << "CreateLVWidget initialized for VG:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName; } void CreateLVWidget::initUi() { - qDebug() << "CreateLVWidget::initUi called."; + qCDebug(appLog) << "CreateLVWidget::initUi called."; setModal(true); setFixedSize(900, 600); m_mainFrame = new QWidget(this); - qDebug() << "Main frame created and dialog properties set."; + qCDebug(appLog) << "Main frame created and dialog properties set."; QVBoxLayout *mainLayout = new QVBoxLayout(m_mainFrame); mainLayout->setSpacing(5); VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); setTitle(tr("Creating logical volumes on %1").arg(vgInfo.m_vgName)); - qDebug() << "Dialog title set to: Creating logical volumes on" << vgInfo.m_vgName; + qCDebug(appLog) << "Dialog title set to: Creating logical volumes on" << vgInfo.m_vgName; DLabel *tipLabel = new DLabel(QString(tr("Click %1 to create a logical volume. ")).arg("+"), m_mainFrame); tipLabel->setWordWrap(true); tipLabel->setAlignment(Qt::AlignCenter); if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) { - qDebug() << "Applying LightType theme palette to tipLabel."; + qCDebug(appLog) << "Applying LightType theme palette to tipLabel."; DPalette tipPalette; QColor tipColor("#000000"); tipColor.setAlphaF(0.7); tipPalette.setColor(DPalette::WindowText, tipColor); tipLabel->setPalette(tipPalette); } else if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType) { - qDebug() << "Applying DarkType theme palette to tipLabel."; + qCDebug(appLog) << "Applying DarkType theme palette to tipLabel."; DPalette tipPalette; QColor tipColor("#FFFFFF"); tipColor.setAlphaF(0.7); tipPalette.setColor(DPalette::WindowText, tipColor); tipLabel->setPalette(tipPalette); } - qDebug() << "Tip label initialized."; + qCDebug(appLog) << "Tip label initialized."; m_topFrame = new DFrame(m_mainFrame); m_topFrame->setLineWidth(0); @@ -65,12 +66,12 @@ void CreateLVWidget::initUi() topFrameSetting(); m_topFrame->setFrameRounded(true); #if QT_VERSION_MAJOR > 5 - qDebug() << "QT_VERSION_MAJOR > 5, setting topFrame palette."; + qCDebug(appLog) << "QT_VERSION_MAJOR > 5, setting topFrame palette."; DPalette palette = m_topFrame->palette(); palette.setBrush(DPalette::Base, palette.itemBackground()); m_topFrame->setPalette(palette); #else - qDebug() << "QT_VERSION_MAJOR <= 5, setting topFrame palette."; + qCDebug(appLog) << "QT_VERSION_MAJOR <= 5, setting topFrame palette."; DPalette palette = DApplicationHelper::instance()->palette(m_topFrame); palette.setBrush(DPalette::Base, palette.itemBackground()); DApplicationHelper::instance()->setPalette(m_topFrame, palette); @@ -78,7 +79,7 @@ void CreateLVWidget::initUi() m_topFrame->setAutoFillBackground(true); // m_topFrame->setStyleSheet("background:red"); m_topFrame->setFixedSize(864,110); - qDebug() << "Top frame initialized."; + qCDebug(appLog) << "Top frame initialized."; m_midFrame = new DFrame(m_mainFrame); //逻辑卷页中间部分的图形绘制 @@ -86,7 +87,7 @@ void CreateLVWidget::initUi() m_midFrame->setFrameStyle(DFrame::NoFrame); // m_midFrame->setStyleSheet("background:blue"); m_midFrame->setFixedSize(864, 85); - qDebug() << "Mid frame initialized."; + qCDebug(appLog) << "Mid frame initialized."; m_botFrame = new DFrame(m_mainFrame); // m_botFrame->setStyleSheet("background:green"); @@ -94,7 +95,7 @@ void CreateLVWidget::initUi() //逻辑卷页最下端的布局等 botFrameSetting(); m_botFrame->setFrameStyle(DFrame::NoFrame); - qDebug() << "Bottom frame initialized."; + qCDebug(appLog) << "Bottom frame initialized."; mainLayout->addWidget(tipLabel, 1); mainLayout->addSpacing(10); @@ -103,16 +104,16 @@ void CreateLVWidget::initUi() mainLayout->addWidget(m_midFrame, 3); mainLayout->addWidget(m_botFrame, 10); mainLayout->setSpacing(0); - qDebug() << "Main layout configured."; + qCDebug(appLog) << "Main layout configured."; setIcon(QIcon::fromTheme(appName)); addContent(m_mainFrame); - qDebug() << "Application icon and main content set."; + qCDebug(appLog) << "Application icon and main content set."; } void CreateLVWidget::topFrameSetting() { - qDebug() << "CreateLVWidget::topFrameSetting called."; + qCDebug(appLog) << "CreateLVWidget::topFrameSetting called."; //整体水平布局 QHBoxLayout *hLayout = new QHBoxLayout(m_topFrame); hLayout->setSpacing(5); @@ -221,24 +222,24 @@ void CreateLVWidget::topFrameSetting() hLayout->addWidget(picLabel); hLayout->addLayout(vLayout, 10); hLayout->setContentsMargins(20, 0, 0, 0); - qDebug() << "Top frame UI elements and layouts configured."; + qCDebug(appLog) << "Top frame UI elements and layouts configured."; } void CreateLVWidget::midFrameSetting() { - qDebug() << "CreateLVWidget::midFrameSetting called."; + qCDebug(appLog) << "CreateLVWidget::midFrameSetting called."; //调用绘制的图形 m_midFrame->setMinimumHeight(85); QVBoxLayout *mainLayout = new QVBoxLayout(m_midFrame); m_partChartWidget = new PartChartShowing(m_midFrame); mainLayout->addWidget(m_partChartWidget); mainLayout->setContentsMargins(0, 0, 0, 0); - qDebug() << "Middle frame UI elements and layouts configured."; + qCDebug(appLog) << "Middle frame UI elements and layouts configured."; } void CreateLVWidget::botFrameSetting() { - qDebug() << "CreateLVWidget::botFrameSetting called."; + qCDebug(appLog) << "CreateLVWidget::botFrameSetting called."; QVBoxLayout *vLayout = new QVBoxLayout(m_botFrame); m_partWidget = new QWidget(m_botFrame); //逻辑卷详细页 @@ -270,15 +271,15 @@ void CreateLVWidget::botFrameSetting() vLayout->addLayout(btnLayout, 1); vLayout->setContentsMargins(0, 0, 0, 0); - qDebug() << "Bottom frame UI elements and layouts configured."; + qCDebug(appLog) << "Bottom frame UI elements and layouts configured."; } void CreateLVWidget::partInfoShowing() { - qDebug() << "CreateLVWidget::partInfoShowing called."; + qCDebug(appLog) << "CreateLVWidget::partInfoShowing called."; auto formateList = DMDbusHandler::instance()->getAllSupportFileSystem(); formateList.removeOne("linux-swap"); - qDebug() << "Supported file systems retrieved. Removed linux-swap. Remaining count:" << formateList.count(); + qCDebug(appLog) << "Supported file systems retrieved. Removed linux-swap. Remaining count:" << formateList.count(); //lvm暂时不支持加密 // if (!DMDbusHandler::instance()->getIsSystemDisk(DMDbusHandler::instance()->getCurVGInfo().m_vgName)) { // formateList = DMDbusHandler::instance()->getEncryptionFormate(formateList); @@ -292,7 +293,7 @@ void CreateLVWidget::partInfoShowing() QPalette partPalette; partPalette.setColor(QPalette::WindowText, QColor("#414D68")); m_partInfoLabel->setPalette(partPalette); - qDebug() << "LV Information label initialized."; + qCDebug(appLog) << "LV Information label initialized."; //第二行 QPalette infoPalette; @@ -316,10 +317,10 @@ void CreateLVWidget::partInfoShowing() //按钮初始状态 if (m_sizeInfo.size() == 0) { - qDebug() << "No size info, disabling remove button."; + qCDebug(appLog) << "No size info, disabling remove button."; m_remButton->setEnabled(false); } else { - qDebug() << "Size info present, enabling remove button."; + qCDebug(appLog) << "Size info present, enabling remove button."; m_remButton->setEnabled(true); } @@ -342,7 +343,7 @@ void CreateLVWidget::partInfoShowing() line2Layout->addWidget(space, 1); line2Layout->addWidget(m_partNameLabel, 1); line2Layout->addWidget(m_partNameEdit, 7); - qDebug() << "Second row layout elements configured."; + qCDebug(appLog) << "Second row layout elements configured."; //第三行 QHBoxLayout *line3Layout = new QHBoxLayout(); m_partFormateLabel = new DLabel(tr("LV file system:"), m_partWidget); @@ -381,7 +382,7 @@ void CreateLVWidget::partInfoShowing() line3Layout->addWidget(m_slider, 2); line3Layout->addWidget(m_partSizeEdit, 3); line3Layout->addWidget(m_partComboBox, 2); - qDebug() << "Third row layout elements configured."; + qCDebug(appLog) << "Third row layout elements configured."; // 第四行 DPalette palette; @@ -394,10 +395,10 @@ void CreateLVWidget::partInfoShowing() m_emptyLabel = new DLabel(m_partWidget); #if QT_VERSION_MAJOR > 5 - qDebug() << "QT_VERSION_MAJOR > 5, setting emptyLabel width."; + qCDebug(appLog) << "QT_VERSION_MAJOR > 5, setting emptyLabel width."; m_emptyLabel->setFixedWidth(m_partFormateLabel->fontMetrics().boundingRect(tr("LV file system:")).width()); #else - qDebug() << "QT_VERSION_MAJOR <= 5, setting emptyLabel width."; + qCDebug(appLog) << "QT_VERSION_MAJOR <= 5, setting emptyLabel width."; m_emptyLabel->setFixedWidth(m_partFormateLabel->fontMetrics().width(tr("LV file system:"))); #endif m_encryptionInfo = new DLabel(m_partWidget); @@ -423,7 +424,7 @@ void CreateLVWidget::partInfoShowing() line4Layout->addWidget(m_emptyLabel, 1); line4Layout->addWidget(m_scrollArea, 7); line4Layout->addStretch(); - qDebug() << "Fourth row layout elements configured."; + qCDebug(appLog) << "Fourth row layout elements configured."; vLayout->addWidget(m_partInfoLabel); vLayout->addLayout(line2Layout); @@ -434,37 +435,37 @@ void CreateLVWidget::partInfoShowing() vLayout->setContentsMargins(0, 0, 0, 0); //输入框正则表达 setRegValidator(); - qDebug() << "Part info showing UI setup complete."; + qCDebug(appLog) << "Part info showing UI setup complete."; } void CreateLVWidget::recPartitionInfo() { - qDebug() << "Loading partition info for current VG"; + qCDebug(appLog) << "Loading partition info for current VG"; m_lstLVName.clear(); if (DMDbusHandler::VOLUMEGROUP == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Current level is VOLUMEGROUP."; + qCDebug(appLog) << "Current level is VOLUMEGROUP."; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); m_deviceName->setText(vgInfo.m_vgName); QString vgSize = vgInfo.m_vgSize; if (vgSize.contains("1024")) { - qDebug() << "VG size contains 1024, reformatting."; + qCDebug(appLog) << "VG size contains 1024, reformatting."; vgSize = Utils::LVMFormatSize(vgInfo.m_peCount * vgInfo.m_PESize + vgInfo.m_PESize); } m_allMemory->setText(vgSize); m_selectedPartition->setText("unallocated"); m_deviceFormate->setText("unallocated"); - qDebug() << "VG information set in UI."; + qCDebug(appLog) << "VG information set in UI."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); for (int i = 0; i < vgInfo.m_lvlist.count(); i++) { LVInfo info = vgInfo.m_lvlist.at(i); if (info.m_lvName.isEmpty() && info.m_lvUuid.isEmpty()) { lvInfo = info; - qDebug() << "Found unallocated LV info."; + qCDebug(appLog) << "Found unallocated LV info."; } else { m_lstLVName.append(info.m_lvName); - qDebug() << "Added existing LV name to list:" << info.m_lvName; + qCDebug(appLog) << "Added existing LV name to list:" << info.m_lvName; } } @@ -475,23 +476,23 @@ void CreateLVWidget::recPartitionInfo() m_currentEditSize = QString::number(m_totalSize, 'f', 2); m_partComboBox->setEnabled(true); setSelectUnallocatesSpace(); - qDebug() << "LV size details calculated and UI updated."; + qCDebug(appLog) << "LV size details calculated and UI updated."; } else if (DMDbusHandler::LOGICALVOLUME == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Current level is LOGICALVOLUME."; + qCDebug(appLog) << "Current level is LOGICALVOLUME."; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); m_deviceName->setText(lvInfo.m_vgName); QString vgSize = vgInfo.m_vgSize; if (vgSize.contains("1024")) { - qDebug() << "VG size contains 1024, reformatting."; + qCDebug(appLog) << "VG size contains 1024, reformatting."; vgSize = Utils::LVMFormatSize(vgInfo.m_peCount * vgInfo.m_PESize + vgInfo.m_PESize); } m_allMemory->setText(vgSize); m_selectedPartition->setText("unallocated"); QString partFstype = Utils::fileSystemTypeToString(static_cast(lvInfo.m_lvFsType)); m_deviceFormate->setText(partFstype); - qDebug() << "LV information set in UI for existing LV."; + qCDebug(appLog) << "LV information set in UI for existing LV."; Sector lvByteSize = static_cast(lvInfo.m_lvLECount * lvInfo.m_LESize); m_total = Utils::LVMSizeToUnit(lvByteSize, SIZE_UNIT::UNIT_GIB); @@ -500,24 +501,24 @@ void CreateLVWidget::recPartitionInfo() m_currentEditSize = QString::number(m_totalSize, 'f', 2); m_partComboBox->setEnabled(true); setSelectUnallocatesSpace(); - qDebug() << "LV size details calculated and UI updated for existing LV."; + qCDebug(appLog) << "LV size details calculated and UI updated for existing LV."; for (int i = 0; i < vgInfo.m_lvlist.count(); i++) { LVInfo info = vgInfo.m_lvlist.at(i); if (lvInfo.m_lvName.isEmpty() && lvInfo.m_lvUuid.isEmpty()) { m_lstLVName.append(info.m_lvName); - qDebug() << "Added existing LV name to list (empty name/uuid):" << info.m_lvName; + qCDebug(appLog) << "Added existing LV name to list (empty name/uuid):" << info.m_lvName; } } } m_partNameEdit->setText(lvName()); - qDebug() << "LV name edit field set."; + qCDebug(appLog) << "LV name edit field set."; } void CreateLVWidget::initConnection() { - qDebug() << "CreateLVWidget::initConnection called. Connecting signals and slots."; + qCDebug(appLog) << "CreateLVWidget::initConnection called. Connecting signals and slots."; connect(m_slider, &DSlider::valueChanged, this, &CreateLVWidget::onSliderValueChanged); connect(m_partSizeEdit, &DLineEdit::textChanged, this, &CreateLVWidget::onSetSliderValue); connect(m_addButton, &DIconButton::clicked, this, &CreateLVWidget::onAddPartition); @@ -531,17 +532,17 @@ void CreateLVWidget::initConnection() connect(m_partChartWidget, &PartChartShowing::sendMoveFlag, this, &CreateLVWidget::onShowTip); connect(m_partChartWidget, &PartChartShowing::sendFlag, this, &CreateLVWidget::onShowSelectPathInfo); connect(m_partChartWidget, &PartChartShowing::judgeLastPartition, this, &CreateLVWidget::onJudgeLastPartition); - qDebug() << "Signals and slots connected."; + qCDebug(appLog) << "Signals and slots connected."; } QString CreateLVWidget::lvName() { - qDebug() << "CreateLVWidget::lvName called to generate LV name."; + qCDebug(appLog) << "CreateLVWidget::lvName called to generate LV name."; QString name = QString("lv%1").arg(m_lstLVName.count() + 1, 2, 10, QLatin1Char('0')); for (int i = 0; i <= m_lstLVName.count(); i++) { name = QString("lv%1").arg(i + 1, 2, 10, QLatin1Char('0')); if (-1 == m_lstLVName.indexOf(name)) { - qDebug() << "Generated unique LV name:" << name; + qCDebug(appLog) << "Generated unique LV name:" << name; break; } } @@ -551,48 +552,48 @@ QString CreateLVWidget::lvName() double CreateLVWidget::sumValue() { - qDebug() << "CreateLVWidget::sumValue called."; + qCDebug(appLog) << "CreateLVWidget::sumValue called."; double sum = 0.00; for (int i = 0; i < m_sizeInfo.count(); i++) { sum = sum + m_sizeInfo.at(i); if (sum >= m_totalSize - 0.01) { - qDebug() << "Sum value reached total size, breaking loop."; + qCDebug(appLog) << "Sum value reached total size, breaking loop."; break; } } - qDebug() << "Calculated sum value:" << sum; + qCDebug(appLog) << "Calculated sum value:" << sum; return sum; } void CreateLVWidget::setSelectUnallocatesSpace() { - qDebug() << "CreateLVWidget::setSelectUnallocatesSpace called."; + qCDebug(appLog) << "CreateLVWidget::setSelectUnallocatesSpace called."; m_partNameEdit->lineEdit()->setPlaceholderText(tr("Unallocated")); m_partSizeEdit->setText(""); if (m_partComboBox->currentText() == "GiB") { - qDebug() << "Setting unallocated space in GiB."; + qCDebug(appLog) << "Setting unallocated space in GiB."; m_partSizeEdit->setText(QString::number(m_total - (sumValue() / 1024), 'f', 2)); } else { - qDebug() << "Setting unallocated space in MiB."; + qCDebug(appLog) << "Setting unallocated space in MiB."; m_partSizeEdit->setText(QString::number(m_totalSize - sumValue(), 'f', 2)); } - qDebug() << "Unallocated space set."; + qCDebug(appLog) << "Unallocated space set."; } void CreateLVWidget::setAddOrRemResult(const bool &isExceed) { - qDebug() << "CreateLVWidget::setAddOrRemResult called. isExceed:" << isExceed; + qCDebug(appLog) << "CreateLVWidget::setAddOrRemResult called. isExceed:" << isExceed; m_partNameEdit->setText(lvName()); m_partSizeEdit->setText(""); if (m_sizeInfo.size() == 0) { - qDebug() << "No size info, setting flag to 1."; + qCDebug(appLog) << "No size info, setting flag to 1."; m_flag = 1; } else { - qDebug() << "Size info present, setting flag to 0."; + qCDebug(appLog) << "Size info present, setting flag to 0."; m_flag = 0; } @@ -603,14 +604,14 @@ void CreateLVWidget::setAddOrRemResult(const bool &isExceed) setEnable(0, isExceed); onSliderValueChanged(100); - qDebug() << "Add/remove result handled."; + qCDebug(appLog) << "Add/remove result handled."; } void CreateLVWidget::setRegValidator() { - qDebug() << "CreateLVWidget::setRegValidator called."; + qCDebug(appLog) << "CreateLVWidget::setRegValidator called."; #if QT_VERSION_MAJOR > 5 - qDebug() << "Setting QRegularExpressionValidator for QT_VERSION_MAJOR > 5."; + qCDebug(appLog) << "Setting QRegularExpressionValidator for QT_VERSION_MAJOR > 5."; QRegularExpression reg("^[0-9]+(\\.[0-9]{1,4})?$"); QRegularExpressionValidator *va = new QRegularExpressionValidator(reg, this); m_partSizeEdit->lineEdit()->setValidator(va); @@ -619,7 +620,7 @@ void CreateLVWidget::setRegValidator() QRegularExpressionValidator *va1 = new QRegularExpressionValidator(re, this); m_partNameEdit->lineEdit()->setValidator(va1); #else - qDebug() << "Setting QRegExpValidator for QT_VERSION_MAJOR <= 5."; + qCDebug(appLog) << "Setting QRegExpValidator for QT_VERSION_MAJOR <= 5."; QRegExp reg("^[0-9]+(\\.[0-9]{1,4})?$"); QRegExpValidator *va = new QRegExpValidator(reg, this); m_partSizeEdit->lineEdit()->setValidator(va); @@ -628,29 +629,29 @@ void CreateLVWidget::setRegValidator() QRegExpValidator *va1 = new QRegExpValidator(re, this); m_partNameEdit->lineEdit()->setValidator(va1); #endif - qDebug() << "Validators set."; + qCDebug(appLog) << "Validators set."; } void CreateLVWidget::onShowSelectPathInfo(const int &flag, const int &num, const int &posX) { - qDebug() << "CreateLVWidget::onShowSelectPathInfo called. Flag:" << flag << ", Num:" << num; + qCDebug(appLog) << "CreateLVWidget::onShowSelectPathInfo called. Flag:" << flag << ", Num:" << num; m_flag = flag; m_number = num; if (m_flag == 0) { - qDebug() << "Flag is 0, returning."; + qCDebug(appLog) << "Flag is 0, returning."; return; } if (m_flag == 1 || m_flag == 3) { - qDebug() << "Flag is 1 or 3, setting unallocated space."; + qCDebug(appLog) << "Flag is 1 or 3, setting unallocated space."; setSelectUnallocatesSpace(); m_slider->setValue(100); m_number = -1; } else if (m_flag == 2) { - qDebug() << "Flag is 2."; + qCDebug(appLog) << "Flag is 2."; if (num < 0) { - qDebug() << "Num is less than 0, disabling part name edit."; + qCDebug(appLog) << "Num is less than 0, disabling part name edit."; #if QT_VERSION_MAJOR > 5 DPalette palette = m_partNameLabel->palette(); #else @@ -670,7 +671,7 @@ void CreateLVWidget::onShowSelectPathInfo(const int &flag, const int &num, const double clicked = m_sizeInfo.at(num); if (m_partComboBox->currentText() == "GiB") { - qDebug() << "Converting clicked size to GiB."; + qCDebug(appLog) << "Converting clicked size to GiB."; clicked = clicked / 1024; } m_partSizeEdit->setText(QString::number(clicked, 'f', 2)); @@ -678,31 +679,31 @@ void CreateLVWidget::onShowSelectPathInfo(const int &flag, const int &num, const setEnable(m_flag, m_isExceed); onShowTip(flag, num, posX); - qDebug() << "Show select path info handled."; + qCDebug(appLog) << "Show select path info handled."; } void CreateLVWidget::onShowTip(const int &hover, const int &num, const int &posX) { - qDebug() << "CreateLVWidget::onShowTip called. Hover:" << hover << ", Num:" << num; + qCDebug(appLog) << "CreateLVWidget::onShowTip called. Hover:" << hover << ", Num:" << num; int x = frameGeometry().x(); int y = frameGeometry().y(); if (hover == 2) { if (m_partName.at(num) != " ") { - qDebug() << "Showing tip for selected partition:" << m_partName.at(num); + qCDebug(appLog) << "Showing tip for selected partition:" << m_partName.at(num); QToolTip::showText(QPoint(x + posX + 5, y + 215), m_partName.at(num), this, QRect(QPoint(x + posX, y + 215), QSize(80, 20)), 1000); } } else if (hover == 3 || hover == 1) { - qDebug() << "Showing tip for unallocated space."; + qCDebug(appLog) << "Showing tip for unallocated space."; QToolTip::showText(QPoint(x + posX + 5, y + 215), tr("Unallocated"), this, QRect(QPoint(x + posX, y + 215), QSize(80, 20)), 1000); } - qDebug() << "Tooltip shown."; + qCDebug(appLog) << "Tooltip shown."; } void CreateLVWidget::setEnable(const int &flag, const bool &isExceed) { - qDebug() << "CreateLVWidget::setEnable called. Flag:" << flag << ", isExceed:" << isExceed; + qCDebug(appLog) << "CreateLVWidget::setEnable called. Flag:" << flag << ", isExceed:" << isExceed; #if QT_VERSION_MAJOR > 5 DPalette palette = m_partNameLabel->palette(); #else @@ -710,18 +711,18 @@ void CreateLVWidget::setEnable(const int &flag, const bool &isExceed) #endif if (isExceed) {//还有空闲空间剩余 - qDebug() << "There is free space remaining."; + qCDebug(appLog) << "There is free space remaining."; if (flag == 2) {//选中新建的逻辑卷 - qDebug() << "Selected new logical volume, disabling controls."; + qCDebug(appLog) << "Selected new logical volume, disabling controls."; setControlEnable(false); m_partNameEdit->setEnabled(false); } else { - qDebug() << "Enabling controls."; + qCDebug(appLog) << "Enabling controls."; setControlEnable(true); } // palette.setColor(DPalette::Text, QColor(this->palette().buttonText().color())); } else {//无空闲空间剩余 - qDebug() << "No free space remaining, disabling controls."; + qCDebug(appLog) << "No free space remaining, disabling controls."; setControlEnable(false); // if (flag != 2) { // palette.setBrush(DPalette::Text, palette.placeholderText()); @@ -733,25 +734,25 @@ void CreateLVWidget::setEnable(const int &flag, const bool &isExceed) } if (m_partNameEdit->text().toUtf8().size() <= 16) { - qDebug() << "LV name length is acceptable."; + qCDebug(appLog) << "LV name length is acceptable."; m_partNameEdit->setAlert(false); m_partNameEdit->hideAlertMessage(); } else { - qDebug() << "LV name too long, disabling add button."; + qCDebug(appLog) << "LV name too long, disabling add button."; m_addButton->setEnabled(false); } m_partNameLabel->setPalette(palette);//各情况下,逻辑卷名称label的样式 - qDebug() << "Part name label palette set."; + qCDebug(appLog) << "Part name label palette set."; m_remButton->setEnabled(m_sizeInfo.size()); m_applyBtn->setEnabled(m_sizeInfo.size()); - qDebug() << "Remove and apply button enabled state set."; + qCDebug(appLog) << "Remove and apply button enabled state set."; } void CreateLVWidget::setControlEnable(const bool &isTrue) { - qDebug() << "CreateLVWidget::setControlEnable called. isTrue:" << isTrue; + qCDebug(appLog) << "CreateLVWidget::setControlEnable called. isTrue:" << isTrue; m_addButton->setEnabled(isTrue); m_partSizeEdit->setEnabled(isTrue); m_slider->setEnabled(isTrue); @@ -760,14 +761,14 @@ void CreateLVWidget::setControlEnable(const bool &isTrue) m_partNameEdit->setEnabled(true); setLabelColor(isTrue); - qDebug() << "Controls enabled/disabled."; + qCDebug(appLog) << "Controls enabled/disabled."; } void CreateLVWidget::setLabelColor(const bool &isOk) { - qDebug() << "CreateLVWidget::setLabelColor called. isOk:" << isOk; + qCDebug(appLog) << "CreateLVWidget::setLabelColor called. isOk:" << isOk; if (isOk) { - qDebug() << "Setting label color to normal."; + qCDebug(appLog) << "Setting label color to normal."; #if QT_VERSION_MAJOR > 5 DPalette framePalette = m_botFrame->palette(); #else @@ -776,7 +777,7 @@ void CreateLVWidget::setLabelColor(const bool &isOk) framePalette.setColor(DPalette::Text, QColor(palette().buttonText().color())); m_botFrame->setPalette(framePalette); } else { - qDebug() << "Setting label color to placeholder."; + qCDebug(appLog) << "Setting label color to placeholder."; #if QT_VERSION_MAJOR > 5 DPalette palette = m_botFrame->palette(); #else @@ -798,51 +799,51 @@ void CreateLVWidget::setLabelColor(const bool &isOk) palatte2.setColor(DPalette::Text, QColor(palette().buttonText().color())); m_partDoLabel->setPalette(palatte2); - qDebug() << "Label colors set."; + qCDebug(appLog) << "Label colors set."; } void CreateLVWidget::onComboxCurTextChange(int index) { - qDebug() << "CreateLVWidget::onComboxCurTextChange called. Index:" << index; + qCDebug(appLog) << "CreateLVWidget::onComboxCurTextChange called. Index:" << index; if (!m_partSizeEdit->text().isEmpty()) { double m = m_currentEditSize.toDouble(); if (index == 1) { - qDebug() << "Index is 1 (MiB), setting size in MiB."; + qCDebug(appLog) << "Index is 1 (MiB), setting size in MiB."; if (m_sizeInfo.size() == 0 && m_slider->value() == 100) m_partSizeEdit->setText(QString::number(m_totalSize, 'f', 2)); else m_partSizeEdit->setText(QString::number(m, 'f', 2)); } else if (index == 0) { - qDebug() << "Index is 0 (GiB), setting size in GiB."; + qCDebug(appLog) << "Index is 0 (GiB), setting size in GiB."; if (m_sizeInfo.size() == 0 && m_slider->value() == 100) m_partSizeEdit->setText(QString::number(m_total, 'f', 2)); else m_partSizeEdit->setText(QString::number(m / 1024, 'f', 2)); } } - qDebug() << "Combobox current text change handled."; + qCDebug(appLog) << "Combobox current text change handled."; } void CreateLVWidget::onComboxFormatTextChange(const QString &text) { - qDebug() << "CreateLVWidget::onComboxFormatTextChange called. Text:" << text; + qCDebug(appLog) << "CreateLVWidget::onComboxFormatTextChange called. Text:" << text; if (m_partSizeEdit->isAlert()) { m_partSizeEdit->setAlert(false); m_partSizeEdit->hideAlertMessage(); - qDebug() << "Alert message hidden."; + qCDebug(appLog) << "Alert message hidden."; } m_scrollArea->setFixedWidth(m_partFormateCombox->width()); if (text.contains("AES")) { - qDebug() << "Format text contains AES."; + qCDebug(appLog) << "Format text contains AES."; QString text = tr("Use the aes-xts-plain64 standard algorithm to encrypt the disk. " "You should decrypt it before mounting it again."); m_encryptionInfo->setFixedSize(m_partFormateCombox->width(), Common::getLabelAdjustHeight(m_partFormateCombox->width(), text, m_encryptionInfo->font())); m_encryptionInfo->setText(text); } else if (text.contains("SM4")) { - qDebug() << "Format text contains SM4."; + qCDebug(appLog) << "Format text contains SM4."; QString text = tr("Use the sm4-xts-plain state cryptographic algorithm to encrypt the disk. " "You should decrypt it before mounting it again. " "Operating Systems that do not support the state cryptographic " @@ -851,30 +852,30 @@ void CreateLVWidget::onComboxFormatTextChange(const QString &text) Common::getLabelAdjustHeight(m_partFormateCombox->width(), text, m_encryptionInfo->font()) - 1); m_encryptionInfo->setText(text); } else { - qDebug() << "Format text is neither AES nor SM4, clearing encryption info."; + qCDebug(appLog) << "Format text is neither AES nor SM4, clearing encryption info."; m_encryptionInfo->setText(""); } - qDebug() << "Combobox format text change handled."; + qCDebug(appLog) << "Combobox format text change handled."; } void CreateLVWidget::onJudgeLastPartition() { - qDebug() << "CreateLVWidget::onJudgeLastPartition called. Disabling slider and size edit."; + qCDebug(appLog) << "CreateLVWidget::onJudgeLastPartition called. Disabling slider and size edit."; m_slider->setEnabled(false); m_partSizeEdit->setEnabled(false); } void CreateLVWidget::onSliderValueChanged(int value) { - qDebug() << "CreateLVWidget::onSliderValueChanged called. Value:" << value; + qCDebug(appLog) << "CreateLVWidget::onSliderValueChanged called. Value:" << value; m_value = value; QString size; if (m_block == 0) { - qDebug() << "Block is 0."; + qCDebug(appLog) << "Block is 0."; //选中逻辑卷大小与整个空闲空间的占比 if (m_flag == 2) { - qDebug() << "Flag is 2 (selected logical volume). Calculating size based on totalSize."; + qCDebug(appLog) << "Flag is 2 (selected logical volume). Calculating size based on totalSize."; if (m_partComboBox->currentText() == "MiB") { size = QString::number((static_cast(value) / 100) * m_totalSize, 'f', 2); } else { @@ -883,7 +884,7 @@ void CreateLVWidget::onSliderValueChanged(int value) m_partSizeEdit->setText(size); } else {//剩余空间为总大小,占比情况 - qDebug() << "Flag is not 2 (remaining space). Calculating size based on remaining totalSize."; + qCDebug(appLog) << "Flag is not 2 (remaining space). Calculating size based on remaining totalSize."; if (m_partComboBox->currentText() == "MiB") { size = QString::number((static_cast(value) / 100) * (m_totalSize - sumValue()), 'f', 2); } else { @@ -895,27 +896,27 @@ void CreateLVWidget::onSliderValueChanged(int value) m_currentEditSize = QString::number((static_cast(value) / 100) * (m_totalSize - sumValue()), 'f', 2); m_block = 0; - qDebug() << "Slider value change handled. Current edit size:" << m_currentEditSize; + qCDebug(appLog) << "Slider value change handled. Current edit size:" << m_currentEditSize; } void CreateLVWidget::onSetSliderValue() { - qDebug() << "CreateLVWidget::onSetSliderValue called."; + qCDebug(appLog) << "CreateLVWidget::onSetSliderValue called."; if (m_partSizeEdit->isAlert()) { m_partSizeEdit->setAlert(false); m_partSizeEdit->hideAlertMessage(); - qDebug() << "Alert message hidden."; + qCDebug(appLog) << "Alert message hidden."; } if(m_partSizeEdit->text().trimmed().isEmpty()) { - qDebug() << "Part size edit text is empty, disabling add button."; + qCDebug(appLog) << "Part size edit text is empty, disabling add button."; m_addButton->setDisabled(true); return; } double value = m_partSizeEdit->text().toDouble(); if (m_partComboBox->currentText() == "MiB") { - qDebug() << "Converting value from MiB to GiB."; + qCDebug(appLog) << "Converting value from MiB to GiB."; value = value / 1024; } m_block = 1; @@ -923,26 +924,26 @@ void CreateLVWidget::onSetSliderValue() m_currentEditSize = QString::number(value * 1024, 'f', 2); if (0.00 == value || value > (m_total - sumValue() / 1024)) { - qDebug() << "Value is 0 or exceeds available space, disabling add button."; + qCDebug(appLog) << "Value is 0 or exceeds available space, disabling add button."; m_addButton->setDisabled(true); } else { - qDebug() << "Value is acceptable, enabling add button."; + qCDebug(appLog) << "Value is acceptable, enabling add button."; m_addButton->setDisabled(false); } - qDebug() << "Slider value set from text edit."; + qCDebug(appLog) << "Slider value set from text edit."; } void CreateLVWidget::onAddPartition() { - qDebug() << "CreateLVWidget::onAddPartition called."; + qCDebug(appLog) << "CreateLVWidget::onAddPartition called."; double currentSize = 0.00; stLV part; m_partName.append(m_partNameEdit->text()); - qDebug() << "LV name appended:" << m_partNameEdit->text(); + qCDebug(appLog) << "LV name appended:" << m_partNameEdit->text(); //输入框内的值超过剩余空闲空间,以剩余空间新建 currentSize = m_currentEditSize.toDouble(); if (currentSize >= (m_totalSize - sumValue())) { - qDebug() << "Current size exceeds available space, adjusting to remaining space."; + qCDebug(appLog) << "Current size exceeds available space, adjusting to remaining space."; currentSize = m_totalSize - sumValue(); part.m_blast = true; } @@ -950,14 +951,14 @@ void CreateLVWidget::onAddPartition() int peCount = static_cast(currentSize / m_peSize); if ((peCount * m_peSize) < currentSize) { peCount += 1; - qDebug() << "Adjusted PE count to:" << peCount; + qCDebug(appLog) << "Adjusted PE count to:" << peCount; } currentSize = peCount * m_peSize; QString formate = m_partFormateCombox->currentText(); if (formate.contains("AES") || formate.contains("SM4")) { - qDebug() << "Encryption format detected:" << formate; + qCDebug(appLog) << "Encryption format detected:" << formate; if (currentSize <= 100) { - qDebug() << "Encryption volume too small, showing alert."; + qCDebug(appLog) << "Encryption volume too small, showing alert."; m_partSizeEdit->setAlert(true); m_partSizeEdit->showAlertMessage(tr("To encrypt a volume, it should be larger than 100 MiB")); return; @@ -970,23 +971,23 @@ void CreateLVWidget::onAddPartition() passwordInputDialog.setObjectName("passwordInputDialog"); passwordInputDialog.setAccessibleName("passwordInputDialog"); if (passwordInputDialog.exec() != DDialog::Accepted) { - qDebug() << "Password dialog not accepted, returning."; + qCDebug(appLog) << "Password dialog not accepted, returning."; return; } else { - qDebug() << "Password dialog accepted."; + qCDebug(appLog) << "Password dialog accepted."; part.m_password = passwordInputDialog.getPassword(); part.m_passwordHint = passwordInputDialog.getPasswordHint(); if (formate.contains("AES")) { part.m_encryption = CRYPT_CIPHER::AES_XTS_PLAIN64; part.m_dmName = QString("%1_%2_aesE").arg(m_deviceName->text()).arg(m_partNameEdit->text()); - qDebug() << "Set encryption to AES."; + qCDebug(appLog) << "Set encryption to AES."; } else if (formate.contains("SM4")) { part.m_encryption = CRYPT_CIPHER::SM4_XTS_PLAIN64; part.m_dmName = QString("%1_%2_sm4E").arg(m_deviceName->text()).arg(m_partNameEdit->text()); - qDebug() << "Set encryption to SM4."; + qCDebug(appLog) << "Set encryption to SM4."; } part.m_isEncryption = true; - qDebug() << "Encryption details set."; + qCDebug(appLog) << "Encryption details set."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); @@ -997,23 +998,23 @@ void CreateLVWidget::onAddPartition() warningBox.setGeometry(pos().x() + (width() - warningBox.width()) / 2, pos().y() + (height() - warningBox.height()) / 2, warningBox.width(), warningBox.height()); warningBox.exec(); - qDebug() << "Password backup warning shown."; + qCDebug(appLog) << "Password backup warning shown."; } #if QT_VERSION_MAJOR > 5 DPalette palette = m_botFrame->palette(); palette.setColor(QPalette::ButtonText, color); setPalette(palette); - qDebug() << "Palette set for QT_VERSION_MAJOR > 5."; + qCDebug(appLog) << "Palette set for QT_VERSION_MAJOR > 5."; #else DPalette palette = DApplicationHelper::instance()->palette(m_botFrame); palette.setColor(QPalette::ButtonText, color); DApplicationHelper::instance()->setPalette(this, palette); - qDebug() << "Palette set for QT_VERSION_MAJOR <= 5."; + qCDebug(appLog) << "Palette set for QT_VERSION_MAJOR <= 5."; #endif formate = formate.trimmed().split(" ").at(0); - qDebug() << "Formatted encryption type:" << formate; + qCDebug(appLog) << "Formatted encryption type:" << formate; } m_sizeInfo.append(currentSize); @@ -1024,47 +1025,47 @@ void CreateLVWidget::onAddPartition() part.m_lvByteSize = static_cast(currentSize * 1024 * 1024); if (m_partComboBox->currentText() == "GiB") { - qDebug() << "Setting LV size in GiB."; + qCDebug(appLog) << "Setting LV size in GiB."; part.m_lvSize = QString::number(currentSize / 1024, 'f', 2) + m_partComboBox->currentText(); } else { - qDebug() << "Setting LV size in MiB."; + qCDebug(appLog) << "Setting LV size in MiB."; part.m_lvSize = QString::number(currentSize) + m_partComboBox->currentText(); } m_patrinfo.push_back(part); m_partChartWidget->update(); - qDebug() << "LV information added and chart updated."; + qCDebug(appLog) << "LV information added and chart updated."; //新增逻辑卷后样式变化 if (sumValue() >= m_totalSize - 0.01) m_isExceed = false; else m_isExceed = true; - qDebug() << "Updated isExceed flag:" << m_isExceed; + qCDebug(appLog) << "Updated isExceed flag:" << m_isExceed; m_lstLVName.append(m_partNameEdit->text()); setAddOrRemResult(m_isExceed); m_applyBtn->setEnabled(true); - qDebug() << "Apply button enabled."; + qCDebug(appLog) << "Apply button enabled."; if (!m_partNameEdit->text().isEmpty()) { QByteArray byteArray = m_partNameEdit->text().toUtf8(); if (byteArray.size() >= 128) { - qDebug() << "LV name byte size >= 128, disabling add button."; + qCDebug(appLog) << "LV name byte size >= 128, disabling add button."; m_addButton->setDisabled(true); } } - qDebug() << "Add partition process finished."; + qCDebug(appLog) << "Add partition process finished."; } void CreateLVWidget::onRemovePartition() { - qDebug() << "Removing last LV from creation list"; + qCDebug(appLog) << "Removing last LV from creation list"; if (m_patrinfo.size() > 0) { m_patrinfo.pop_back(); - qDebug() << "Last partition info removed."; + qCDebug(appLog) << "Last partition info removed."; } m_addButton->setEnabled(true); @@ -1072,31 +1073,31 @@ void CreateLVWidget::onRemovePartition() if (m_sizeInfo.size() > 0) { m_sizeInfo.removeAt(m_sizeInfo.size() - 1); m_partName.removeAt(m_partName.size() - 1); - qDebug() << "Last size info and part name removed."; + qCDebug(appLog) << "Last size info and part name removed."; } //绘制删除逻辑卷图形 m_partChartWidget->transInfos(m_totalSize, m_sizeInfo); m_partChartWidget->update(); - qDebug() << "Chart updated after removal."; + qCDebug(appLog) << "Chart updated after removal."; //删除逻辑卷后样式变化 m_isExceed = true; - qDebug() << "Updated isExceed flag after removal:" << m_isExceed; + qCDebug(appLog) << "Updated isExceed flag after removal:" << m_isExceed; m_lstLVName.removeLast(); setAddOrRemResult(m_isExceed); - qDebug() << "Remove partition process finished."; + qCDebug(appLog) << "Remove partition process finished."; } void CreateLVWidget::onApplyButton() { - qDebug() << "Applying LV creation for VG:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName; + qCDebug(appLog) << "Applying LV creation for VG:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName; QList lstLVInfo; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); QString userName = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); userName.remove(0, 6); - qDebug() << "User name extracted:" << userName; + qCDebug(appLog) << "User name extracted:" << userName; for (int i = 0; i < m_patrinfo.size(); i++) { LVAction info; @@ -1109,20 +1110,20 @@ void CreateLVWidget::onApplyButton() info.m_lvAct = LVMAction::LVM_ACT_LV_CREATE; if (m_patrinfo.at(i).m_isEncryption) { - qDebug() << "Partition is encrypted."; + qCDebug(appLog) << "Partition is encrypted."; info.m_luksFlag = LUKSFlag::IS_CRYPT_LUKS; info.m_crypt = m_patrinfo.at(i).m_encryption; QStringList tokenList; if (!m_patrinfo.at(i).m_passwordHint.isEmpty()) { tokenList.append(m_patrinfo.at(i).m_passwordHint); - qDebug() << "Password hint added to token list."; + qCDebug(appLog) << "Password hint added to token list."; } info.m_tokenList = tokenList; info.m_decryptStr = m_patrinfo.at(i).m_password; info.m_dmName = m_patrinfo.at(i).m_dmName; } else { - qDebug() << "Partition is not encrypted."; + qCDebug(appLog) << "Partition is not encrypted."; info.m_luksFlag = LUKSFlag::NOT_CRYPT_LUKS; info.m_crypt = CRYPT_CIPHER::NOT_CRYPT; info.m_tokenList = QStringList(); @@ -1131,11 +1132,11 @@ void CreateLVWidget::onApplyButton() } lstLVInfo.append(info); - qDebug() << "LVAction info appended for LV:" << info.m_lvName; + qCDebug(appLog) << "LVAction info appended for LV:" << info.m_lvName; } if (lstLVInfo.size() > 0) { - qDebug() << "Creating" << lstLVInfo.size() << "logical volumes on VG:" << vgInfo.m_vgName; + qCDebug(appLog) << "Creating" << lstLVInfo.size() << "logical volumes on VG:" << vgInfo.m_vgName; DMDbusHandler::instance()->createLV(vgInfo.m_vgName, lstLVInfo); close(); } @@ -1143,7 +1144,7 @@ void CreateLVWidget::onApplyButton() void CreateLVWidget::onRevertButton() { - qDebug() << "Reverting all LV creation changes"; + qCDebug(appLog) << "Reverting all LV creation changes"; //复原,即清空 m_patrinfo.clear(); @@ -1164,7 +1165,7 @@ void CreateLVWidget::onRevertButton() m_isExceed = true; if (m_sizeInfo.size() == 0) { - qDebug() << "No LV info to create, apply button disabled."; + qCDebug(appLog) << "No LV info to create, apply button disabled."; m_applyBtn->setEnabled(false); } @@ -1178,7 +1179,7 @@ void CreateLVWidget::onRevertButton() void CreateLVWidget::onCancelButton() { - qDebug() << "Canceling LV creation dialog"; + qCDebug(appLog) << "Canceling LV creation dialog"; close(); } @@ -1187,7 +1188,7 @@ bool CreateLVWidget::event(QEvent *event) { // 字体大小改变 if (QEvent::ApplicationFontChange == event->type()) { - qDebug() << event->type() << QApplication::font().pointSizeF() / 0.75; + qCDebug(appLog) << event->type() << QApplication::font().pointSizeF() / 0.75; QFontMetrics fm(m_deviceNameLabel->font()); m_deviceNameLabel->setFixedWidth(fm.boundingRect(tr("VG name:")).width() + 5); #if QT_VERSION_MAJOR > 5 diff --git a/application/widgets/createpartitiontabledialog.cpp b/application/widgets/createpartitiontabledialog.cpp index 1daed074..d5ef09d8 100644 --- a/application/widgets/createpartitiontabledialog.cpp +++ b/application/widgets/createpartitiontabledialog.cpp @@ -2,6 +2,7 @@ // // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "createpartitiontabledialog.h" #include "partedproxy/dmdbushandler.h" @@ -17,70 +18,70 @@ CreatePartitionTableDialog::CreatePartitionTableDialog(QWidget *parent) : DDBase(parent) { - qDebug() << "CreatePartitionTableDialog initializing..."; + qCDebug(appLog) << "CreatePartitionTableDialog initializing..."; initUi(); initConnection(); - qDebug() << "CreatePartitionTableDialog initialized"; + qCDebug(appLog) << "CreatePartitionTableDialog initialized"; } void CreatePartitionTableDialog::initUi() { - qDebug() << "CreatePartitionTableDialog::initUi called."; + qCDebug(appLog) << "CreatePartitionTableDialog::initUi called."; m_ComboBox = new DComboBox; m_ComboBox->setObjectName("CreatePartitionTableDialogComboBox"); m_ComboBox->addItem("GPT"); m_ComboBox->addItem("MSDOS"); m_ComboBox->setAccessibleName("choosePartitionTable"); - qDebug() << "Partition table combo box initialized."; + qCDebug(appLog) << "Partition table combo box initialized."; QVBoxLayout *mainLayout = new QVBoxLayout(m_mainFrame); mainLayout->addWidget(m_ComboBox); int index = addButton(tr("Cancel"), true, ButtonNormal); getButton(index)->setAccessibleName("cancel"); - qDebug() << "Cancel button added."; + qCDebug(appLog) << "Cancel button added."; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); - qDebug() << "Current device info - path:" << info.m_path << ", type:" << info.m_disktype; + qCDebug(appLog) << "Current device info - path:" << info.m_path << ", type:" << info.m_disktype; if (info.m_disktype == "unrecognized") { - qDebug() << "Disk type is unrecognized, setting type to 'create'."; + qCDebug(appLog) << "Disk type is unrecognized, setting type to 'create'."; m_curType = "create"; // 当前磁盘无分区表,是否新建分区表? setTitle(tr("No partition table in this disk. Create a new one?")); m_okCode = addButton(tr("Create"), false, ButtonRecommend); getButton(m_okCode)->setAccessibleName("create"); - qDebug() << "Dialog title and create button set for new partition table."; + qCDebug(appLog) << "Dialog title and create button set for new partition table."; } else { - qDebug() << "Disk type is recognized, setting type to 'replace'."; + qCDebug(appLog) << "Disk type is recognized, setting type to 'replace'."; m_curType = "replace"; // 当前磁盘已有分区表,是否替换此分区表? setTitle(tr("The disk has a partition table already. Replace it?")); m_okCode = addButton(tr("Replace"), false, ButtonRecommend); getButton(m_okCode)->setAccessibleName("replace"); - qDebug() << "Dialog title and replace button set for existing partition table."; + qCDebug(appLog) << "Dialog title and replace button set for existing partition table."; } - qDebug() << "UI initialization finished."; + qCDebug(appLog) << "UI initialization finished."; } void CreatePartitionTableDialog::initConnection() { - qDebug() << "CreatePartitionTableDialog::initConnection called."; + qCDebug(appLog) << "CreatePartitionTableDialog::initConnection called."; connect(this, &CreatePartitionTableDialog::buttonClicked, this, &CreatePartitionTableDialog::onButtonClicked); - qDebug() << "Button clicked signal connected to onButtonClicked slot."; + qCDebug(appLog) << "Button clicked signal connected to onButtonClicked slot."; } void CreatePartitionTableDialog::onButtonClicked(int index, const QString &text) { - qDebug() << "CreatePartitionTableDialog::onButtonClicked called. Index:" << index << ", Text:" << text; + qCDebug(appLog) << "CreatePartitionTableDialog::onButtonClicked called. Index:" << index << ", Text:" << text; Q_UNUSED(text); if (index == m_okCode) { - qDebug() << "User confirmed partition table operation, type:" << m_curType; + qCDebug(appLog) << "User confirmed partition table operation, type:" << m_curType; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); DMDbusHandler::instance()->createPartitionTable(info.m_path, QString("%1").arg(info.m_length), QString("%1").arg(info.m_sectorSize), m_ComboBox->currentText(), m_curType); close(); - qDebug() << "Partition table creation initiated and dialog closed."; + qCDebug(appLog) << "Partition table creation initiated and dialog closed."; } else { - qDebug() << "User canceled partition table operation, closing dialog."; + qCDebug(appLog) << "User canceled partition table operation, closing dialog."; close(); } } diff --git a/application/widgets/createvgwidget.cpp b/application/widgets/createvgwidget.cpp index 82a728ba..2c5dbd63 100644 --- a/application/widgets/createvgwidget.cpp +++ b/application/widgets/createvgwidget.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "createvgwidget.h" #include "common.h" #include "messagebox.h" @@ -19,16 +20,16 @@ CreateVGWidget::CreateVGWidget(int operationType, QWidget *parent) : DDBase(parent) , m_curOperationType(operationType) { - qDebug() << "CreateVGWidget initialized with operationType:" << operationType; + qCDebug(appLog) << "CreateVGWidget initialized with operationType:" << operationType; initUi(); initConnection(); updateData(); - qDebug() << "CreateVGWidget initialization completed"; + qCDebug(appLog) << "CreateVGWidget initialization completed"; } void CreateVGWidget::initUi() { - qDebug() << "CreateVGWidget::initUi called."; + qCDebug(appLog) << "CreateVGWidget::initUi called."; setFixedSize(800, 538); m_curSeclectData.clear(); @@ -64,7 +65,7 @@ void CreateVGWidget::initUi() titleLabel->setAlignment(Qt::AlignCenter); if (m_curOperationType == OperationType::RESIZE) { - qDebug() << "CreateVGWidget::initUi - Resize operation type detected"; + qCDebug(appLog) << "CreateVGWidget::initUi - Resize operation type detected"; titleLabel->setText(tr("Resize")); } @@ -501,12 +502,12 @@ void CreateVGWidget::initUi() mainLayout->addWidget(m_stackedWidget); mainLayout->setSpacing(0); mainLayout->setContentsMargins(0, 0, 0, 0); - qDebug() << "CreateVGWidget initialization completed"; + qCDebug(appLog) << "CreateVGWidget initialization completed"; } void CreateVGWidget::initConnection() { - qDebug() << "CreateVGWidget::initConnection called."; + qCDebug(appLog) << "CreateVGWidget::initConnection called."; connect(m_nextButton, &DSuggestButton::clicked, this, &CreateVGWidget::onNextButtonClicked); connect(m_addButton, &DPushButton::clicked, this, &CreateVGWidget::onPreviousButtonClicked); connect(m_previousButton, &DPushButton::clicked, this, &CreateVGWidget::onPreviousButtonClicked); @@ -518,30 +519,30 @@ void CreateVGWidget::initConnection() connect(m_selectSpaceLineEdit, &DLineEdit::textChanged, this, &CreateVGWidget::onTextChanged); connect(DMDbusHandler::instance(), &DMDbusHandler::vgCreateMessage, this, &CreateVGWidget::onVGCreateMessage); connect(DMDbusHandler::instance(), &DMDbusHandler::updateDeviceInfo, this, &CreateVGWidget::onUpdateUsb); - qDebug() << "All connections initialized."; + qCDebug(appLog) << "All connections initialized."; } void CreateVGWidget::setScrollAreaAttribute(DScrollArea *scrollArea, bool hScrollBarHidden, bool vScrollBarHidden) { - qDebug() << "CreateVGWidget::setScrollAreaAttribute called. hScrollBarHidden:" << hScrollBarHidden << ", vScrollBarHidden:" << vScrollBarHidden; + qCDebug(appLog) << "CreateVGWidget::setScrollAreaAttribute called. hScrollBarHidden:" << hScrollBarHidden << ", vScrollBarHidden:" << vScrollBarHidden; scrollArea->setFrameShadow(QFrame::Plain); scrollArea->setFrameShape(QFrame::NoFrame); if (hScrollBarHidden) { - qDebug() << "Hiding horizontal scroll bar."; + qCDebug(appLog) << "Hiding horizontal scroll bar."; scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);//隐藏横向滚动条 } if (vScrollBarHidden) { - qDebug() << "Hiding vertical scroll bar."; + qCDebug(appLog) << "Hiding vertical scroll bar."; scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);//隐藏竖向滚动条 } - qDebug() << "Scroll area attributes set."; + qCDebug(appLog) << "Scroll area attributes set."; } bool CreateVGWidget::judgeDataEquality(const PVInfoData &data1, const PVInfoData &data2) { - qDebug() << "CreateVGWidget::judgeDataEquality (PVInfoData) called."; + qCDebug(appLog) << "CreateVGWidget::judgeDataEquality (PVInfoData) called."; return data1.m_partitionPath == data2.m_partitionPath && data1.m_sectorStart == data2.m_sectorStart && data1.m_sectorEnd == data2.m_sectorEnd @@ -550,7 +551,7 @@ bool CreateVGWidget::judgeDataEquality(const PVInfoData &data1, const PVInfoData bool CreateVGWidget::judgeDataEquality(const PartitionInfo &partInfo, const PVInfoData &pvInfo) { - qDebug() << "CreateVGWidget::judgeDataEquality (PartitionInfo) called."; + qCDebug(appLog) << "CreateVGWidget::judgeDataEquality (PartitionInfo) called."; return partInfo.m_path == pvInfo.m_partitionPath && partInfo.m_sectorStart == pvInfo.m_sectorStart && partInfo.m_sectorEnd == pvInfo.m_sectorEnd @@ -559,7 +560,7 @@ bool CreateVGWidget::judgeDataEquality(const PartitionInfo &partInfo, const PVIn void CreateVGWidget::showLoadingWidget(const QString &vgName) { - qDebug() << "CreateVGWidget::showLoadingWidget called. VG Name:" << vgName; + qCDebug(appLog) << "CreateVGWidget::showLoadingWidget called. VG Name:" << vgName; m_stackedWidget->setCurrentIndex(2); DPalette palette1; palette1.setColor(DPalette::TextTitle, QColor("#001A2E")); @@ -586,10 +587,10 @@ void CreateVGWidget::showLoadingWidget(const QString &vgName) waitLable->setPalette(palette1); if (m_curOperationType == OperationType::RESIZE) { - qDebug() << "Operation type is RESIZE, setting wait label text to 'Resizing space...'."; + qCDebug(appLog) << "Operation type is RESIZE, setting wait label text to 'Resizing space...'."; waitLable->setText(tr("Resizing space...")); } else { - qDebug() << "Operation type is not RESIZE, setting wait label text to 'Creating...'."; + qCDebug(appLog) << "Operation type is not RESIZE, setting wait label text to 'Creating...'."; waitLable->setText(tr("Creating...")); } @@ -601,7 +602,7 @@ void CreateVGWidget::showLoadingWidget(const QString &vgName) label->setPalette(palette2); if (i == (m_curSeclectData.count() - 1)) { - qDebug() << "Displaying single selected partition path:" << m_curSeclectData.at(i).m_partitionPath; + qCDebug(appLog) << "Displaying single selected partition path:" << m_curSeclectData.at(i).m_partitionPath; label->setText(QString("%1").arg(m_curSeclectData.at(i).m_partitionPath)); } else { QString path1; @@ -610,26 +611,26 @@ void CreateVGWidget::showLoadingWidget(const QString &vgName) PVInfoData pvInfoData2 = m_curSeclectData.at(i + 1); if (pvInfoData1.m_disktype == "unrecognized") { - qDebug() << "PVInfoData1 disktype is unrecognized, using diskPath."; + qCDebug(appLog) << "PVInfoData1 disktype is unrecognized, using diskPath."; path1 = pvInfoData1.m_diskPath; } else { - qDebug() << "PVInfoData1 disktype is recognized, using partitionPath."; + qCDebug(appLog) << "PVInfoData1 disktype is recognized, using partitionPath."; path1 = pvInfoData1.m_partitionPath; } if (pvInfoData2.m_disktype == "unrecognized") { - qDebug() << "PVInfoData2 disktype is unrecognized, using diskPath."; + qCDebug(appLog) << "PVInfoData2 disktype is unrecognized, using diskPath."; path2 = pvInfoData2.m_diskPath; } else { - qDebug() << "PVInfoData2 disktype is recognized, using partitionPath."; + qCDebug(appLog) << "PVInfoData2 disktype is recognized, using partitionPath."; path2 = pvInfoData2.m_partitionPath; } if (i == (m_curSeclectData.count() - 2)) { - qDebug() << "Displaying last pair of selected paths:" << path1 << "," << path2; + qCDebug(appLog) << "Displaying last pair of selected paths:" << path1 << "," << path2; label->setText(QString("%1, %2").arg(path1).arg(path2)); } else { - qDebug() << "Displaying selected paths:" << path1 << "," << path2; + qCDebug(appLog) << "Displaying selected paths:" << path1 << "," << path2; label->setText(QString("%1, %2, ").arg(path1).arg(path2)); } } @@ -657,7 +658,7 @@ void CreateVGWidget::showLoadingWidget(const QString &vgName) bool isShowScrollArea = false; int count = m_curSeclectData.count() / 2 + m_curSeclectData.count() % 2; if (count > 5) { - qDebug() << "Count of selected data is greater than 5, showing scroll area."; + qCDebug(appLog) << "Count of selected data is greater than 5, showing scroll area."; QWidget *widget = new QWidget; widget->setLayout(layout); widget->setFixedSize(600, count * 23 - 8); @@ -677,7 +678,7 @@ void CreateVGWidget::showLoadingWidget(const QString &vgName) frame->setLayout(scrollAreaLayout); } else { - qDebug() << "Count of selected data is 5 or less, not showing scroll area."; + qCDebug(appLog) << "Count of selected data is 5 or less, not showing scroll area."; layout->insertWidget(0, selectLable, 0, Qt::AlignCenter); frame->setFixedSize(600, (count + 1) * 23); @@ -686,7 +687,7 @@ void CreateVGWidget::showLoadingWidget(const QString &vgName) if (count >= 5) { isShowScrollArea = true; - qDebug() << "Setting isShowScrollArea to true as count >= 5."; + qCDebug(appLog) << "Setting isShowScrollArea to true as count >= 5."; } QLabel *vgSizeLabel = new QLabel(this); @@ -695,10 +696,10 @@ void CreateVGWidget::showLoadingWidget(const QString &vgName) vgSizeLabel->setPalette(palette2); if (m_selectSpaceStackedWidget->currentIndex() == 1) { - qDebug() << "Setting VG capacity label from min size."; + qCDebug(appLog) << "Setting VG capacity label from min size."; vgSizeLabel->setText(tr("VG capacity: %1").arg(QString::number(m_minSize, 'f', 2)) + m_selectSpaceComboBox->currentText()); } else { - qDebug() << "Setting VG capacity label from line edit."; + qCDebug(appLog) << "Setting VG capacity label from line edit."; vgSizeLabel->setText(tr("VG capacity: %1").arg(m_selectSpaceLineEdit->text() + m_selectSpaceComboBox->currentText())); } @@ -714,10 +715,10 @@ void CreateVGWidget::showLoadingWidget(const QString &vgName) mainLayout->addSpacing(10); mainLayout->addWidget(waitLable, 0, Qt::AlignCenter); if (isShowScrollArea) { - qDebug() << "Adding spacing for scroll area."; + qCDebug(appLog) << "Adding spacing for scroll area."; mainLayout->addSpacing(30); } else { - qDebug() << "Adding spacing without scroll area."; + qCDebug(appLog) << "Adding spacing without scroll area."; mainLayout->addSpacing(40); } mainLayout->addWidget(frame, 0, Qt::AlignCenter); @@ -733,35 +734,35 @@ void CreateVGWidget::showLoadingWidget(const QString &vgName) DWindowCloseButton *button = findChild("DTitlebarDWindowCloseButton"); if (button != nullptr) { - qDebug() << "Disabling and hiding window close button."; + qCDebug(appLog) << "Disabling and hiding window close button."; button->setDisabled(true); button->hide(); } m_waterLoadingWidget->setStartTime(1000); - qDebug() << "Loading widget shown."; + qCDebug(appLog) << "Loading widget shown."; } QString CreateVGWidget::getVGName() { - qDebug() << "CreateVGWidget::getVGName called."; + qCDebug(appLog) << "CreateVGWidget::getVGName called."; LVMInfo lvmInfo = DMDbusHandler::instance()->probLVMInfo(); QList lvmNameList = lvmInfo.m_vgInfo.keys(); QString name = QString("vg%1").arg(lvmNameList.count() + 1, 2, 10, QLatin1Char('0')); for (int i = 0; i <= lvmNameList.count(); ++i) { name = QString("vg%1").arg(i + 1, 2, 10, QLatin1Char('0')); if (-1 == lvmNameList.indexOf(name)) { - qDebug() << "Generated unique VG name:" << name; + qCDebug(appLog) << "Generated unique VG name:" << name; break; } } - qDebug() << "Returning VG name:" << name; + qCDebug(appLog) << "Returning VG name:" << name; return name; } set CreateVGWidget::getCurSelectPVData() { - qDebug() << "CreateVGWidget::getCurSelectPVData called."; + qCDebug(appLog) << "CreateVGWidget::getCurSelectPVData called."; set pvDataSet; for (int i = 0; i < m_curSeclectData.count(); ++i) { PVInfoData infoData = m_curSeclectData.at(i); @@ -774,81 +775,81 @@ set CreateVGWidget::getCurSelectPVData() pvData.m_pvAct = LVMAction::LVM_ACT_PV; if (infoData.m_disktype == "unrecognized") { - qDebug() << "PVInfoData disktype is unrecognized for path:" << infoData.m_diskPath; + qCDebug(appLog) << "PVInfoData disktype is unrecognized for path:" << infoData.m_diskPath; pvData.m_devicePath = infoData.m_diskPath; pvData.m_type = DevType::DEV_DISK; } else { if (infoData.m_partitionPath == "unallocated") { - qDebug() << "Partition path is unallocated for disk:" << infoData.m_diskPath; + qCDebug(appLog) << "Partition path is unallocated for disk:" << infoData.m_diskPath; pvData.m_devicePath = infoData.m_diskPath; pvData.m_type = DevType::DEV_UNALLOCATED_PARTITION; } else { - qDebug() << "Partition path is recognized for partition:" << infoData.m_partitionPath; + qCDebug(appLog) << "Partition path is recognized for partition:" << infoData.m_partitionPath; pvData.m_devicePath = infoData.m_partitionPath; pvData.m_type = DevType::DEV_PARTITION; } } pvDataSet.insert(pvData); - qDebug() << "Inserted PVData for device:" << pvData.m_devicePath; + qCDebug(appLog) << "Inserted PVData for device:" << pvData.m_devicePath; } - qDebug() << "Finished getting current selected PV data. Count:" << pvDataSet.size(); + qCDebug(appLog) << "Finished getting current selected PV data. Count:" << pvDataSet.size(); return pvDataSet; } void CreateVGWidget::onNextButtonClicked() { - qDebug() << "Next button clicked, switching to step 2"; + qCDebug(appLog) << "Next button clicked, switching to step 2"; m_stackedWidget->setCurrentIndex(1); updateSelectedData(); - qDebug() << "Step 2 UI updated with selected data"; + qCDebug(appLog) << "Step 2 UI updated with selected data"; } void CreateVGWidget::onPreviousButtonClicked() { - qDebug() << "Previous button clicked, switching back to step 1"; + qCDebug(appLog) << "Previous button clicked, switching back to step 1"; m_stackedWidget->setCurrentIndex(0); updateData(); - qDebug() << "Step 1 UI refreshed"; + qCDebug(appLog) << "Step 1 UI refreshed"; } void CreateVGWidget::onDoneButtonClicked() { - qDebug() << "Done button clicked, starting VG operation"; + qCDebug(appLog) << "Done button clicked, starting VG operation"; if (m_selectSpaceStackedWidget->currentIndex() == 0) { - qDebug() << "Validating VG size input..."; + qCDebug(appLog) << "Validating VG size input..."; double curSize = QString::number(m_selectSpaceLineEdit->text().toDouble(), 'f', 2).toDouble(); double minSize = QString::number(m_minSize, 'f', 2).toDouble(); double maxSize = QString::number(m_maxSize, 'f', 2).toDouble(); if (curSize < minSize) { - qDebug() << "Current size" << curSize << "is less than minimum size" << minSize; + qCDebug(appLog) << "Current size" << curSize << "is less than minimum size" << minSize; m_selectSpaceLineEdit->setAlertMessageAlignment(Qt::AlignTop); m_selectSpaceLineEdit->showAlertMessage(tr("No less than the used capacity please"), m_mainFrame); // 不得低于已用空间 m_selectSpaceLineEdit->setAlert(true); return; } else if (curSize > maxSize) { - qDebug() << "Current size" << curSize << "is greater than maximum size" << maxSize; + qCDebug(appLog) << "Current size" << curSize << "is greater than maximum size" << maxSize; m_selectSpaceLineEdit->setAlertMessageAlignment(Qt::AlignTop); m_selectSpaceLineEdit->showAlertMessage(tr("No more than the maximum capacity please"), m_mainFrame); // 超出最大可用空间 m_selectSpaceLineEdit->setAlert(true); return; } - qDebug() << "VG size input validated successfully."; + qCDebug(appLog) << "VG size input validated successfully."; } if (m_curOperationType == OperationType::RESIZE) { - qDebug() << "Operation type is RESIZE."; + qCDebug(appLog) << "Operation type is RESIZE."; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); set pvDataSet = getCurSelectPVData(); bool bigDataMove; QStringList realDelPvList; bool ret = adjudicationPVMove(vgInfo, pvDataSet, bigDataMove, realDelPvList); - qDebug() << "Adjudication PV move result:" << ret << ", bigDataMove:" << bigDataMove; + qCDebug(appLog) << "Adjudication PV move result:" << ret << ", bigDataMove:" << bigDataMove; if (ret) { if (bigDataMove) { - qDebug() << "Big data move detected, showing warning box for devices:" << realDelPvList; + qCDebug(appLog) << "Big data move detected, showing warning box for devices:" << realDelPvList; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("removeWarningWidget"); @@ -859,10 +860,10 @@ void CreateVGWidget::onDoneButtonClicked() warningBox.setWarings(text1 + "\n" + text2 + "\n" + text3, "", tr("Continue"), "continue", tr("Cancel"), "messageBoxCancelButton"); if (warningBox.exec() == DDialog::Rejected) { - qDebug() << "User rejected big data move, returning."; + qCDebug(appLog) << "User rejected big data move, returning."; return; } - qDebug() << "User accepted big data move."; + qCDebug(appLog) << "User accepted big data move."; } } } @@ -878,78 +879,78 @@ void CreateVGWidget::onDoneButtonClicked() pvData.m_pvAct = LVMAction::LVM_ACT_ADDPV; if (infoData.m_disktype == "unrecognized") { - qDebug() << "PVInfoData disktype is unrecognized for path:" << infoData.m_diskPath << ", setting DEV_DISK."; + qCDebug(appLog) << "PVInfoData disktype is unrecognized for path:" << infoData.m_diskPath << ", setting DEV_DISK."; pvData.m_devicePath = infoData.m_diskPath; pvData.m_type = DevType::DEV_DISK; } else { if (infoData.m_partitionPath == "unallocated") { - qDebug() << "Partition path is unallocated for disk:" << infoData.m_diskPath << ", setting DEV_UNALLOCATED_PARTITION."; + qCDebug(appLog) << "Partition path is unallocated for disk:" << infoData.m_diskPath << ", setting DEV_UNALLOCATED_PARTITION."; pvData.m_devicePath = infoData.m_diskPath; pvData.m_type = DevType::DEV_UNALLOCATED_PARTITION; } else { - qDebug() << "Partition path is recognized for partition:" << infoData.m_partitionPath << ", setting DEV_PARTITION."; + qCDebug(appLog) << "Partition path is recognized for partition:" << infoData.m_partitionPath << ", setting DEV_PARTITION."; pvData.m_devicePath = infoData.m_partitionPath; pvData.m_type = DevType::DEV_PARTITION; } } if(infoData.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS){ - qDebug() << "LUKS encrypted partition detected for device:" << pvData.m_devicePath; + qCDebug(appLog) << "LUKS encrypted partition detected for device:" << pvData.m_devicePath; LUKS_INFO luks = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(pvData.m_devicePath); if (luks.isDecrypt) { - qDebug() << "LUKS device is decrypted, using mapper path:" << luks.m_mapper.m_dmPath; + qCDebug(appLog) << "LUKS device is decrypted, using mapper path:" << luks.m_mapper.m_dmPath; pvData.m_devicePath = luks.m_mapper.m_dmPath; } } pvDataList.append(pvData); - qDebug() << "Added PVData to list for device:" << pvData.m_devicePath; + qCDebug(appLog) << "Added PVData to list for device:" << pvData.m_devicePath; } QString vgName = getVGName(); if (m_curOperationType == OperationType::RESIZE) { - qDebug() << "Operation type is RESIZE, calling resizeVG for VG:" << vgName; + qCDebug(appLog) << "Operation type is RESIZE, calling resizeVG for VG:" << vgName; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); vgName = vgInfo.m_vgName; DMDbusHandler::instance()->resizeVG(vgName, pvDataList, m_curSize); } else { - qInfo() << "Creating new VG:" << vgName << "with" << pvDataList.size() << "PVs"; + qCInfo(appLog) << "Creating new VG:" << vgName << "with" << pvDataList.size() << "PVs"; DMDbusHandler::instance()->createVG(vgName, pvDataList, m_curSize); - qDebug() << "CreateVG called for VG:" << vgName; + qCDebug(appLog) << "CreateVG called for VG:" << vgName; } showLoadingWidget(vgName); - qDebug() << "Done button clicked process finished."; + qCDebug(appLog) << "Done button clicked process finished."; } void CreateVGWidget::onCancelButtonClicked() { - qDebug() << "CreateVGWidget::onCancelButtonClicked called. Closing dialog."; + qCDebug(appLog) << "CreateVGWidget::onCancelButtonClicked called. Closing dialog."; close(); } void CreateVGWidget::updateData() { - qDebug() << "CreateVGWidget::updateData called."; + qCDebug(appLog) << "CreateVGWidget::updateData called."; QList lstDeviceInfo; lstDeviceInfo.clear(); if (m_curOperationType == OperationType::RESIZE) { - qDebug() << "Operation type is RESIZE, getting resizeAvailableDiskData."; + qCDebug(appLog) << "Operation type is RESIZE, getting resizeAvailableDiskData."; lstDeviceInfo = resizeAvailableDiskData(); } else { - qDebug() << "Operation type is CREATE, getting createAvailableDiskData."; + qCDebug(appLog) << "Operation type is CREATE, getting createAvailableDiskData."; lstDeviceInfo = createAvailableDiskData(); } - qDebug() << "Available device info list count:" << lstDeviceInfo.count(); + qCDebug(appLog) << "Available device info list count:" << lstDeviceInfo.count(); if (lstDeviceInfo.count() == 0) { - qDebug() << "No device info available, showing no disk widget and disabling next button."; + qCDebug(appLog) << "No device info available, showing no disk widget and disabling next button."; m_firstCenterStackedWidget->setCurrentIndex(1); m_nextButton->setDisabled(true); } else { - qDebug() << "Device info available, updating disk and partition UI."; + qCDebug(appLog) << "Device info available, updating disk and partition UI."; QWidget *diskWidget = m_diskScrollArea->findChild("diskScrollArea"); Utils::deletePoint(diskWidget); @@ -1143,7 +1144,7 @@ void CreateVGWidget::updateData() m_nextButton->setDisabled(false); } } - qDebug() << "CreateVGWidget::updateData completed"; + qCDebug(appLog) << "CreateVGWidget::updateData completed"; } static bool isDeviceRemovable(const QString &devicePath) @@ -1157,12 +1158,12 @@ static bool isDeviceRemovable(const QString &devicePath) QByteArray content; if (!removableFile.exists()) { - qWarning() << "Sysfs path does not exist:" << sysfsRemovablePath; + qCWarning(appLog) << "Sysfs path does not exist:" << sysfsRemovablePath; goto quit; } if (!removableFile.open(QIODevice::ReadOnly | QIODevice::Text)) { - qWarning() << "Could not open sysfs removable file:" << sysfsRemovablePath; + qCWarning(appLog) << "Could not open sysfs removable file:" << sysfsRemovablePath; goto quit; } @@ -1170,13 +1171,13 @@ static bool isDeviceRemovable(const QString &devicePath) removable = (content == "1"); quit: - qDebug() << "isDeviceRemovable:" << devicePath << removable; + qCDebug(appLog) << "isDeviceRemovable:" << devicePath << removable; return removable; } QList CreateVGWidget::createAvailableDiskData() { - qDebug() << "CreateVGWidget::createAvailableDiskData called."; + qCDebug(appLog) << "CreateVGWidget::createAvailableDiskData called."; QList lstDeviceInfo; lstDeviceInfo.clear(); @@ -1301,13 +1302,13 @@ QList CreateVGWidget::createAvailableDiskData() } } - qDebug() << "CreateVGWidget::createAvailableDiskData completed"; + qCDebug(appLog) << "CreateVGWidget::createAvailableDiskData completed"; return lstDeviceInfo; } QList CreateVGWidget::resizeAvailableDiskData() { - qDebug() << "CreateVGWidget::resizeAvailableDiskData called."; + qCDebug(appLog) << "CreateVGWidget::resizeAvailableDiskData called."; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); QMap mapPvInfo = vgInfo.m_pvInfo; QStringList pvList = mapPvInfo.keys(); @@ -1578,28 +1579,28 @@ QList CreateVGWidget::resizeAvailableDiskData() } if (m_isResizeInit) { - qDebug() << "Resize init."; + qCDebug(appLog) << "Resize init."; m_curSeclectData = m_oldSeclectData; } m_isResizeInit = false; - qDebug() << "CreateVGWidget::createAvailableDiskData completed"; + qCDebug(appLog) << "CreateVGWidget::createAvailableDiskData completed"; return lstDeviceInfo; } void CreateVGWidget::onDiskItemClicked() { - qDebug() << "CreateVGWidget::onDiskItemClicked called."; + qCDebug(appLog) << "CreateVGWidget::onDiskItemClicked called."; // 当前选中行是否为已选中行 SelectPVItemWidget *selectPVItemWidget = qobject_cast(sender()); if (m_curDiskItemWidget == selectPVItemWidget) { - qDebug() << "Current disk item is already selected, returning."; + qCDebug(appLog) << "Current disk item is already selected, returning."; return; } // 选中其他行时 if (nullptr != m_curDiskItemWidget) { - qDebug() << "Current disk item is not null, unchecking it."; + qCDebug(appLog) << "Current disk item is not null, unchecking it."; m_curDiskItemWidget->setChecked(false); QWidget *partWidget = m_partitionScrollArea->findChild("partScrollArea"); @@ -1611,60 +1612,60 @@ void CreateVGWidget::onDiskItemClicked() m_curDiskItemWidget = selectPVItemWidget; updatePartitionData(lstData); - qDebug() << "CreateVGWidget::onDiskItemClicked completed."; + qCDebug(appLog) << "CreateVGWidget::onDiskItemClicked completed."; } void CreateVGWidget::updatePartitionData(const QList &lstData) { - qDebug() << "CreateVGWidget::updatePartitionData called. Data count:" << lstData.count(); + qCDebug(appLog) << "CreateVGWidget::updatePartitionData called. Data count:" << lstData.count(); if (lstData.count() == 0) { - qDebug() << "No partition data, showing no partition widget."; + qCDebug(appLog) << "No partition data, showing no partition widget."; m_partitionStackedWidget->setCurrentIndex(1); } else { - qDebug() << "Partition data available, updating partition UI."; + qCDebug(appLog) << "Partition data available, updating partition UI."; m_partitionStackedWidget->setCurrentIndex(0); QVBoxLayout *partitionLayout = new QVBoxLayout; for (int i = 0; i < lstData.count(); ++i) { PVInfoData pvInfoData = lstData.at(i); - qDebug() << "Processing partition:" << pvInfoData.m_partitionPath; + qCDebug(appLog) << "Processing partition:" << pvInfoData.m_partitionPath; SelectPVItemWidget *selectPVItemWidget = new SelectPVItemWidget(pvInfoData); if (lstData.count() == 1) { - qDebug() << "Single partition in list, setting mode accordingly."; + qCDebug(appLog) << "Single partition in list, setting mode accordingly."; selectPVItemWidget->setMode(true, true, true, true); } else { if (i == 0) { - qDebug() << "First partition in multi-partition list, setting mode accordingly."; + qCDebug(appLog) << "First partition in multi-partition list, setting mode accordingly."; selectPVItemWidget->setMode(true, false, true, false); } else if (i == lstData.count() - 1) { - qDebug() << "Last partition in multi-partition list, setting mode accordingly."; + qCDebug(appLog) << "Last partition in multi-partition list, setting mode accordingly."; selectPVItemWidget->setMode(false, true, false, true); } else { - qDebug() << "Middle partition in multi-partition list, setting mode accordingly."; + qCDebug(appLog) << "Middle partition in multi-partition list, setting mode accordingly."; selectPVItemWidget->setMode(false, false, false, false); } } switch (pvInfoData.m_selectStatus) { case Qt::CheckState::Unchecked: { - qDebug() << "Partition status: Unchecked."; + qCDebug(appLog) << "Partition status: Unchecked."; selectPVItemWidget->setCheckBoxState(Qt::CheckState::Unchecked); break; } case Qt::CheckState::Checked: { - qDebug() << "Partition status: Checked."; + qCDebug(appLog) << "Partition status: Checked."; selectPVItemWidget->setCheckBoxState(Qt::CheckState::Checked); break; } default: - qDebug() << "Partition status: Default (no change)."; + qCDebug(appLog) << "Partition status: Default (no change)."; break; } connect(selectPVItemWidget, &SelectPVItemWidget::selectItem, this, &CreateVGWidget::onDiskItemClicked); connect(selectPVItemWidget, &SelectPVItemWidget::checkBoxStateChange, this, &CreateVGWidget::onPartitionCheckBoxStateChange); - qDebug() << "Connections made for partition SelectPVItemWidget."; + qCDebug(appLog) << "Connections made for partition SelectPVItemWidget."; partitionLayout->addWidget(selectPVItemWidget); } @@ -1678,77 +1679,77 @@ void CreateVGWidget::updatePartitionData(const QList &lstData) widget->setFixedSize(370, lstData.count() * 37); widget->setLayout(partitionLayout); m_partitionScrollArea->setWidget(widget); - qDebug() << "Partition scroll area widget set."; + qCDebug(appLog) << "Partition scroll area widget set."; } - qDebug() << "Update partition data process finished."; + qCDebug(appLog) << "Update partition data process finished."; } void CreateVGWidget::onDiskCheckBoxStateChange(int state) { - qDebug() << "CreateVGWidget::onDiskCheckBoxStateChange called. State:" << state; + qCDebug(appLog) << "CreateVGWidget::onDiskCheckBoxStateChange called. State:" << state; // 若为半选状态置为选中状态 if (state == Qt::CheckState::PartiallyChecked) { - qDebug() << "Disk checkbox state is PartiallyChecked, setting to Checked."; + qCDebug(appLog) << "Disk checkbox state is PartiallyChecked, setting to Checked."; SelectPVItemWidget *selectPVItemWidget = qobject_cast(sender()); selectPVItemWidget->setCheckBoxState(Qt::CheckState::Checked, true); } else { if (state == Qt::CheckState::Unchecked) { - qDebug() << "Disk checkbox state is Unchecked (disk unselected)."; + qCDebug(appLog) << "Disk checkbox state is Unchecked (disk unselected)."; // 磁盘取消选中 QList lstPartitionItem = m_partitionScrollArea->findChildren(); if (lstPartitionItem.count() == 0) { - qDebug() << "No partition items, calling onDiskItemClicked."; + qCDebug(appLog) << "No partition items, calling onDiskItemClicked."; onDiskItemClicked(); } else { SelectPVItemWidget *selectPVItemWidget = qobject_cast(sender()); if (m_curDiskItemWidget == selectPVItemWidget) { - qDebug() << "Current disk item widget matches sender."; + qCDebug(appLog) << "Current disk item widget matches sender."; int readOnlyCount = 0; for (int i = 0; i < lstPartitionItem.count(); ++i) { SelectPVItemWidget *selectPVItemWidget = lstPartitionItem.at(i); if (selectPVItemWidget->getCurInfo().m_isReadOnly) { readOnlyCount++; - qDebug() << "Partition is read-only, skipping uncheck."; + qCDebug(appLog) << "Partition is read-only, skipping uncheck."; continue; } selectPVItemWidget->setCheckBoxState(Qt::CheckState::Unchecked); - qDebug() << "Unchecked partition:" << selectPVItemWidget->getCurInfo().m_partitionPath; + qCDebug(appLog) << "Unchecked partition:" << selectPVItemWidget->getCurInfo().m_partitionPath; } if (readOnlyCount > 0 && readOnlyCount != lstPartitionItem.count()) { m_curDiskItemWidget->setCheckBoxState(Qt::CheckState::PartiallyChecked); - qDebug() << "Setting current disk item widget to PartiallyChecked due to read-only partitions."; + qCDebug(appLog) << "Setting current disk item widget to PartiallyChecked due to read-only partitions."; } else if (readOnlyCount == lstPartitionItem.count()) { m_curDiskItemWidget->setCheckBoxState(Qt::CheckState::Checked); - qDebug() << "Setting current disk item widget to Checked (all read-only)."; + qCDebug(appLog) << "Setting current disk item widget to Checked (all read-only)."; } } else { - qDebug() << "Current disk item widget does not match sender, calling onDiskItemClicked."; + qCDebug(appLog) << "Current disk item widget does not match sender, calling onDiskItemClicked."; onDiskItemClicked(); } } // 当前取消磁盘是否没有分区表 if (m_curDiskItemWidget->getCurInfo().m_disktype == "unrecognized") { - qDebug() << "Current unselected disk is unrecognized type."; + qCDebug(appLog) << "Current unselected disk is unrecognized type."; PVInfoData pvData = m_curDiskItemWidget->getCurInfo(); for (int i = 0; i < m_curSeclectData.count(); ++i) { PVInfoData infoData = m_curSeclectData.at(i); if (judgeDataEquality(pvData, infoData)) { if (infoData.m_isReadOnly) { - qDebug() << "Read-only unrecognized disk, skipping removal."; + qCDebug(appLog) << "Read-only unrecognized disk, skipping removal."; continue; } m_curSeclectData.removeAt(i); - qDebug() << "Removed unrecognized disk from selected data:" << pvData.m_diskPath; + qCDebug(appLog) << "Removed unrecognized disk from selected data:" << pvData.m_diskPath; break; } } } else { - qDebug() << "Current unselected disk is recognized type."; + qCDebug(appLog) << "Current unselected disk is recognized type."; QList lstData = m_curDiskItemWidget->getData(); for (int i = 0; i < lstData.count(); ++i) { PVInfoData pvData = lstData.at(i); @@ -1757,11 +1758,11 @@ void CreateVGWidget::onDiskCheckBoxStateChange(int state) PVInfoData infoData = m_curSeclectData.at(j); if (judgeDataEquality(pvData, infoData)) { if (infoData.m_isReadOnly) { - qDebug() << "Read-only partition, skipping removal."; + qCDebug(appLog) << "Read-only partition, skipping removal."; continue; } m_curSeclectData.removeAt(j); - qDebug() << "Removed partition from selected data:" << pvData.m_partitionPath; + qCDebug(appLog) << "Removed partition from selected data:" << pvData.m_partitionPath; break; } } @@ -1769,7 +1770,7 @@ void CreateVGWidget::onDiskCheckBoxStateChange(int state) } if (m_curSeclectData.count() == 0) { - qDebug() << "No current selected data after unchecking, setting capacity to 0GiB and disabling next button."; + qCDebug(appLog) << "No current selected data after unchecking, setting capacity to 0GiB and disabling next button."; m_seclectedLabel->setText(tr("Capacity selected: %1").arg("0GiB")); m_nextButton->setDisabled(true); } else { @@ -1779,38 +1780,38 @@ void CreateVGWidget::onDiskCheckBoxStateChange(int state) sumSize += Utils::sectorToUnit(infoData.m_sectorEnd - infoData.m_sectorStart + 1, infoData.m_sectorSize, SIZE_UNIT::UNIT_GIB); } - qDebug() << "Calculated sum size after unchecking:" << sumSize << "GiB."; + qCDebug(appLog) << "Calculated sum size after unchecking:" << sumSize << "GiB."; m_seclectedLabel->setText(tr("Capacity selected: %1").arg(QString::number(sumSize, 'f', 2)) + "GiB"); } } else if (state == Qt::CheckState::Checked) { - qDebug() << "Disk checkbox state is Checked (disk selected)."; + qCDebug(appLog) << "Disk checkbox state is Checked (disk selected)."; // 磁盘选中 QList lstPartitionItem = m_partitionScrollArea->findChildren(); if (lstPartitionItem.count() == 0) { - qDebug() << "No partition items, calling onDiskItemClicked."; + qCDebug(appLog) << "No partition items, calling onDiskItemClicked."; onDiskItemClicked(); } else { SelectPVItemWidget *selectPVItemWidget = qobject_cast(sender()); if (m_curDiskItemWidget == selectPVItemWidget) { - qDebug() << "Current disk item widget matches sender, checking all partitions."; + qCDebug(appLog) << "Current disk item widget matches sender, checking all partitions."; for (int i = 0; i < lstPartitionItem.count(); ++i) { SelectPVItemWidget *selectPVItemWidget = lstPartitionItem.at(i); selectPVItemWidget->setCheckBoxState(Qt::CheckState::Checked); - qDebug() << "Checked partition:" << selectPVItemWidget->getCurInfo().m_partitionPath; + qCDebug(appLog) << "Checked partition:" << selectPVItemWidget->getCurInfo().m_partitionPath; } } else { - qDebug() << "Current disk item widget does not match sender, calling onDiskItemClicked."; + qCDebug(appLog) << "Current disk item widget does not match sender, calling onDiskItemClicked."; onDiskItemClicked(); } } // 当前选中磁盘是否没有分区表 if (m_curDiskItemWidget->getCurInfo().m_disktype == "unrecognized") { - qDebug() << "Current selected disk is unrecognized type, adding to selected data."; + qCDebug(appLog) << "Current selected disk is unrecognized type, adding to selected data."; m_curSeclectData << m_curDiskItemWidget->getCurInfo(); } else { - qDebug() << "Current selected disk is recognized type, adding its partitions to selected data."; + qCDebug(appLog) << "Current selected disk is recognized type, adding its partitions to selected data."; QList lstData = m_curDiskItemWidget->getData(); for (int i = 0; i < lstData.count(); ++i) { PVInfoData pvData = lstData.at(i); @@ -1820,14 +1821,14 @@ void CreateVGWidget::onDiskCheckBoxStateChange(int state) PVInfoData infoData = m_curSeclectData.at(j); if (judgeDataEquality(pvData, infoData)) { isSameData = true; - qDebug() << "Partition already in selected data, skipping:" << pvData.m_partitionPath; + qCDebug(appLog) << "Partition already in selected data, skipping:" << pvData.m_partitionPath; break; } } if (!isSameData) { m_curSeclectData << pvData; - qDebug() << "Added partition to selected data:" << pvData.m_partitionPath; + qCDebug(appLog) << "Added partition to selected data:" << pvData.m_partitionPath; } } } @@ -1838,14 +1839,14 @@ void CreateVGWidget::onDiskCheckBoxStateChange(int state) sumSize += Utils::sectorToUnit(infoData.m_sectorEnd - infoData.m_sectorStart + 1, infoData.m_sectorSize, SIZE_UNIT::UNIT_GIB); } - qDebug() << "Calculated sum size after checking:" << sumSize << "GiB."; + qCDebug(appLog) << "Calculated sum size after checking:" << sumSize << "GiB."; m_seclectedLabel->setText(tr("Capacity selected: %1").arg(QString::number(sumSize, 'f', 2)) + "GiB"); m_nextButton->setDisabled(false); - qDebug() << "Capacity selected label updated and next button enabled."; + qCDebug(appLog) << "Capacity selected label updated and next button enabled."; if (m_curDiskItemWidget->getCurInfo().m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "LUKS encrypted disk selected, showing warning."; + qCDebug(appLog) << "LUKS encrypted disk selected, showing warning."; MessageBox warningBox(this); warningBox.setFixedWidth(450); warningBox.setObjectName("messageBox"); @@ -1854,44 +1855,44 @@ void CreateVGWidget::onDiskCheckBoxStateChange(int state) warningBox.setWarings(tr("Adding the disk/partition to a logical volume group \n" "will format it and remove its password."), "", tr("OK"), "ok"); warningBox.exec(); - qDebug() << "LUKS warning shown."; + qCDebug(appLog) << "LUKS warning shown."; } } } - qDebug() << "Disk checkbox state change handled."; + qCDebug(appLog) << "Disk checkbox state change handled."; } void CreateVGWidget::onPartitionCheckBoxStateChange(int state) { - qDebug() << "CreateVGWidget::onPartitionCheckBoxStateChange called. State:" << state; + qCDebug(appLog) << "CreateVGWidget::onPartitionCheckBoxStateChange called. State:" << state; SelectPVItemWidget *selectPVItemWidget = qobject_cast(sender()); PVInfoData pvData = selectPVItemWidget->getCurInfo(); QList lstData = m_curDiskItemWidget->getData(); bool isPartiallyCheck = false; if (state == Qt::CheckState::Unchecked) { - qDebug() << "Partition checkbox state is Unchecked (partition unselected)."; + qCDebug(appLog) << "Partition checkbox state is Unchecked (partition unselected)."; // 分区取消选中 for (int i = 0; i < lstData.count(); ++i) { PVInfoData data = lstData.at(i); if (pvData.m_sectorStart == data.m_sectorStart && pvData.m_sectorEnd == data.m_sectorEnd) { data.m_selectStatus = state; lstData.replace(i, data); - qDebug() << "Updated partition status to Unchecked for:" << data.m_partitionPath; + qCDebug(appLog) << "Updated partition status to Unchecked for:" << data.m_partitionPath; } if (data.m_selectStatus == Qt::CheckState::Checked) { isPartiallyCheck = true; - qDebug() << "Found checked partition, setting isPartiallyCheck to true."; + qCDebug(appLog) << "Found checked partition, setting isPartiallyCheck to true."; } } if (isPartiallyCheck) { m_curDiskItemWidget->setCheckBoxState(Qt::CheckState::PartiallyChecked); - qDebug() << "Setting disk item widget to PartiallyChecked."; + qCDebug(appLog) << "Setting disk item widget to PartiallyChecked."; } else { m_curDiskItemWidget->setCheckBoxState(Qt::CheckState::Unchecked); - qDebug() << "Setting disk item widget to Unchecked."; + qCDebug(appLog) << "Setting disk item widget to Unchecked."; } double sumSize = 0; @@ -1900,7 +1901,7 @@ void CreateVGWidget::onPartitionCheckBoxStateChange(int state) PVInfoData infoData = m_curSeclectData.at(i); if (judgeDataEquality(pvData, infoData)) { deleteNumber = i; - qDebug() << "Found partition to delete from selected data at index:" << i; + qCDebug(appLog) << "Found partition to delete from selected data at index:" << i; } else { sumSize += Utils::sectorToUnit(infoData.m_sectorEnd - infoData.m_sectorStart + 1, infoData.m_sectorSize, SIZE_UNIT::UNIT_GIB); @@ -1909,58 +1910,58 @@ void CreateVGWidget::onPartitionCheckBoxStateChange(int state) if (deleteNumber >= 0) { m_curSeclectData.removeAt(deleteNumber); - qDebug() << "Removed partition from selected data:" << pvData.m_partitionPath; + qCDebug(appLog) << "Removed partition from selected data:" << pvData.m_partitionPath; } if (m_curSeclectData.count() == 0) { m_seclectedLabel->setText(tr("Capacity selected: %1").arg("0GiB")); m_nextButton->setDisabled(true); - qDebug() << "No selected data, setting capacity to 0GiB and disabling next button."; + qCDebug(appLog) << "No selected data, setting capacity to 0GiB and disabling next button."; } else { m_seclectedLabel->setText(tr("Capacity selected: %1").arg(QString::number(sumSize, 'f', 2)) + "GiB"); - qDebug() << "Updated selected capacity label:" << sumSize << "GiB."; + qCDebug(appLog) << "Updated selected capacity label:" << sumSize << "GiB."; } } else { - qDebug() << "Partition checkbox state is Checked (partition selected)."; + qCDebug(appLog) << "Partition checkbox state is Checked (partition selected)."; // 分区选中 for (int i = 0; i < lstData.count(); ++i) { PVInfoData data = lstData.at(i); if (pvData.m_sectorStart == data.m_sectorStart && pvData.m_sectorEnd == data.m_sectorEnd) { data.m_selectStatus = state; lstData.replace(i, data); - qDebug() << "Updated partition status to Checked for:" << data.m_partitionPath; + qCDebug(appLog) << "Updated partition status to Checked for:" << data.m_partitionPath; } if (data.m_selectStatus == Qt::CheckState::Unchecked) { isPartiallyCheck = true; - qDebug() << "Found unchecked partition, setting isPartiallyCheck to true."; + qCDebug(appLog) << "Found unchecked partition, setting isPartiallyCheck to true."; } } if (isPartiallyCheck) { m_curDiskItemWidget->setCheckBoxState(Qt::CheckState::PartiallyChecked); - qDebug() << "Setting disk item widget to PartiallyChecked."; + qCDebug(appLog) << "Setting disk item widget to PartiallyChecked."; } else { m_curDiskItemWidget->setCheckBoxState(Qt::CheckState::Checked); - qDebug() << "Setting disk item widget to Checked."; + qCDebug(appLog) << "Setting disk item widget to Checked."; } m_curSeclectData.append(pvData); - qDebug() << "Added partition to current selected data:" << pvData.m_partitionPath; + qCDebug(appLog) << "Added partition to current selected data:" << pvData.m_partitionPath; double sumSize = 0; for (int i = 0; i < m_curSeclectData.count(); ++i) { PVInfoData infoData = m_curSeclectData.at(i); sumSize += Utils::sectorToUnit(infoData.m_sectorEnd - infoData.m_sectorStart + 1, infoData.m_sectorSize, SIZE_UNIT::UNIT_GIB); } - qDebug() << "Calculated sum size after checking partition:" << sumSize << "GiB."; + qCDebug(appLog) << "Calculated sum size after checking partition:" << sumSize << "GiB."; m_seclectedLabel->setText(tr("Capacity selected: %1").arg(QString::number(sumSize, 'f', 2)) + "GiB"); m_nextButton->setDisabled(false); - qDebug() << "Updated selected capacity label and enabled next button."; + qCDebug(appLog) << "Updated selected capacity label and enabled next button."; if (pvData.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "LUKS encrypted partition selected, showing warning."; + qCDebug(appLog) << "LUKS encrypted partition selected, showing warning."; MessageBox warningBox(this); // warningBox.setFixedWidth(400); warningBox.setObjectName("messageBox"); @@ -1969,58 +1970,58 @@ void CreateVGWidget::onPartitionCheckBoxStateChange(int state) warningBox.setWarings(tr("Adding the disk/partition to a logical volume group \n" "will format it and remove its password."), "", tr("OK"), "ok"); warningBox.exec(); - qDebug() << "LUKS warning shown."; + qCDebug(appLog) << "LUKS warning shown."; } } m_curDiskItemWidget->setData(lstData); - qDebug() << "Partition checkbox state change handled."; + qCDebug(appLog) << "Partition checkbox state change handled."; } SIZE_UNIT CreateVGWidget::getCurSizeUnit() { - qDebug() << "CreateVGWidget::getCurSizeUnit called."; + qCDebug(appLog) << "CreateVGWidget::getCurSizeUnit called."; SIZE_UNIT type = SIZE_UNIT::UNIT_GIB; switch (m_selectSpaceComboBox->currentIndex()) { case 0: { type = SIZE_UNIT::UNIT_MIB; - qDebug() << "Selected unit: MiB."; + qCDebug(appLog) << "Selected unit: MiB."; break; } case 1: { type = SIZE_UNIT::UNIT_GIB; - qDebug() << "Selected unit: GiB."; + qCDebug(appLog) << "Selected unit: GiB."; break; } case 2: { type = SIZE_UNIT::UNIT_TIB; - qDebug() << "Selected unit: TiB."; + qCDebug(appLog) << "Selected unit: TiB."; break; } default: - qDebug() << "Selected unit: Default (GiB)."; + qCDebug(appLog) << "Selected unit: Default (GiB)."; break; } - qDebug() << "Returning size unit:" << static_cast(type); + qCDebug(appLog) << "Returning size unit:" << static_cast(type); return type; } void CreateVGWidget::updateSelectedData() { - qDebug() << "CreateVGWidget::updateSelectedData called."; + qCDebug(appLog) << "CreateVGWidget::updateSelectedData called."; if (m_curSeclectData.count() == 0) { - qDebug() << "No current selected data, showing no info widget and disabling done button."; + qCDebug(appLog) << "No current selected data, showing no info widget and disabling done button."; m_selectedStackedWidget->setCurrentIndex(1); m_doneButton->setDisabled(true); } else { - qDebug() << "Current selected data available, updating selected data UI."; + qCDebug(appLog) << "Current selected data available, updating selected data UI."; m_selectedStackedWidget->setCurrentIndex(0); m_doneButton->setDisabled(false); QWidget *selectedWidget = m_selectedScrollArea->findChild("selectedScrollArea"); Utils::deletePoint(selectedWidget); - qDebug() << "Old selected scroll area widget deleted."; + qCDebug(appLog) << "Old selected scroll area widget deleted."; QVBoxLayout *selectedLayout = new QVBoxLayout; bool isUnallocated = false; @@ -2028,15 +2029,15 @@ void CreateVGWidget::updateSelectedData() m_maxSize = 0; m_sumSize = 0; SIZE_UNIT type = getCurSizeUnit(); - qDebug() << "Current size unit:" << static_cast(type); + qCDebug(appLog) << "Current size unit:" << static_cast(type); for (int i = 0; i < m_curSeclectData.count(); ++i) { PVInfoData pvInfoData = m_curSeclectData.at(i); - qDebug() << "Processing selected PVInfoData:" << pvInfoData.m_partitionPath; + qCDebug(appLog) << "Processing selected PVInfoData:" << pvInfoData.m_partitionPath; if (pvInfoData.m_partitionPath == "unallocated" || pvInfoData.m_disktype == "unrecognized") { isUnallocated = true; - qDebug() << "Found unallocated or unrecognized partition."; + qCDebug(appLog) << "Found unallocated or unrecognized partition."; } else { m_minSize += Utils::sectorToUnit(pvInfoData.m_sectorEnd - pvInfoData.m_sectorStart + 1, pvInfoData.m_sectorSize, type); @@ -2046,27 +2047,27 @@ void CreateVGWidget::updateSelectedData() pvInfoData.m_sectorSize, type); m_sumSize += (pvInfoData.m_sectorEnd - pvInfoData.m_sectorStart + 1) * pvInfoData.m_sectorSize; - qDebug() << "Added to sumSize (bytes):" << (pvInfoData.m_sectorEnd - pvInfoData.m_sectorStart + 1) * pvInfoData.m_sectorSize; + qCDebug(appLog) << "Added to sumSize (bytes):" << (pvInfoData.m_sectorEnd - pvInfoData.m_sectorStart + 1) * pvInfoData.m_sectorSize; SelectedItemWidget *selectedItemWidget = new SelectedItemWidget(pvInfoData); if (m_curSeclectData.count() == 1) { - qDebug() << "Single selected item, setting mode accordingly."; + qCDebug(appLog) << "Single selected item, setting mode accordingly."; selectedItemWidget->setMode(true, true, true, true); } else { if (i == 0) { - qDebug() << "First selected item, setting mode accordingly."; + qCDebug(appLog) << "First selected item, setting mode accordingly."; selectedItemWidget->setMode(true, false, true, false); } else if (i == m_curSeclectData.count() - 1) { - qDebug() << "Last selected item, setting mode accordingly."; + qCDebug(appLog) << "Last selected item, setting mode accordingly."; selectedItemWidget->setMode(false, true, false, true); } else { - qDebug() << "Middle selected item, setting mode accordingly."; + qCDebug(appLog) << "Middle selected item, setting mode accordingly."; selectedItemWidget->setMode(false, false, false, false); } } connect(selectedItemWidget, &SelectedItemWidget::deleteItem, this, &CreateVGWidget::onDeleteItemClicked); - qDebug() << "Connection made for SelectedItemWidget delete item."; + qCDebug(appLog) << "Connection made for SelectedItemWidget delete item."; selectedLayout->addWidget(selectedItemWidget); } @@ -2080,10 +2081,10 @@ void CreateVGWidget::updateSelectedData() widget->setFixedSize(760, m_curSeclectData.count() * 37); widget->setLayout(selectedLayout); m_selectedScrollArea->setWidget(widget); - qDebug() << "Selected scroll area widget set."; + qCDebug(appLog) << "Selected scroll area widget set."; if (m_curOperationType == OperationType::RESIZE) { - qDebug() << "Operation type is RESIZE, updating resize specific UI."; + qCDebug(appLog) << "Operation type is RESIZE, updating resize specific UI."; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); set pvDataSet = getCurSelectPVData(); Byte_Value maxSize = getMaxSize(vgInfo, pvDataSet); @@ -2094,24 +2095,24 @@ void CreateVGWidget::updateSelectedData() m_sumSize = maxSize; if (maxSize == minSize || !isUnallocated) { - qDebug() << "Max size equals min size or no unallocated space. Setting select space stacked widget to index 1."; + qCDebug(appLog) << "Max size equals min size or no unallocated space. Setting select space stacked widget to index 1."; m_selectSpaceStackedWidget->setCurrentIndex(1); m_curSize = m_sumSize; m_selectedSpaceLabel->setText(tr("Capacity selected: %1") .arg(QString::number(m_maxSize, 'f', 2)) + m_selectSpaceComboBox->currentText()); } else { - qDebug() << "Max size not equal to min size and unallocated space exists. Setting select space stacked widget to index 0."; + qCDebug(appLog) << "Max size not equal to min size and unallocated space exists. Setting select space stacked widget to index 0."; m_selectSpaceStackedWidget->setCurrentIndex(0); m_selectSpaceLineEdit->lineEdit()->setPlaceholderText(QString("%1-%2").arg(QString::number(m_minSize, 'f', 2)) .arg(QString::number(m_maxSize, 'f', 2))); // m_selectSpaceLabel->setText(QString("(%1-%2)").arg(QString::number(m_minSize, 'f', 2)) // .arg(QString::number(m_maxSize, 'f', 2)) + m_selectSpaceComboBox->currentText()); m_selectSpaceLineEdit->setText(QString::number(m_maxSize, 'f', 2)); - qDebug() << "Select space line edit placeholder and text updated."; + qCDebug(appLog) << "Select space line edit placeholder and text updated."; } if (maxSize < minSize) { - qDebug() << "Max size is less than min size, showing warning for not enough space."; + qCDebug(appLog) << "Max size is less than min size, showing warning for not enough space."; bool bigDataMove; QStringList realDelPvList; adjudicationPVMove(vgInfo, pvDataSet, bigDataMove, realDelPvList); @@ -2124,7 +2125,7 @@ void CreateVGWidget::updateSelectedData() m_doneButton->setDisabled(true); warningBox.exec(); - qDebug() << "Not enough space warning shown, done button disabled."; + qCDebug(appLog) << "Not enough space warning shown, done button disabled."; return; } else { // 判断当前选择的PV是否与当前调整VG的PV完全相同,若相同则“完成”按钮禁用 @@ -2137,78 +2138,78 @@ void CreateVGWidget::updateSelectedData() PVInfoData oldPVInfoData = m_oldSeclectData.at(j); if (judgeDataEquality(oldPVInfoData, curPVInfoData)) { isSame = true; - qDebug() << "Current PV is identical to old PV:" << curPVInfoData.m_partitionPath; + qCDebug(appLog) << "Current PV is identical to old PV:" << curPVInfoData.m_partitionPath; break; } } if (!isSame) { isIdentical = false; - qDebug() << "Found non-identical PV, setting isIdentical to false."; + qCDebug(appLog) << "Found non-identical PV, setting isIdentical to false."; break; } } if (isIdentical) { m_doneButton->setDisabled(true); - qDebug() << "All PVs are identical, done button disabled."; + qCDebug(appLog) << "All PVs are identical, done button disabled."; return; } } m_doneButton->setDisabled(false); - qDebug() << "Done button enabled."; + qCDebug(appLog) << "Done button enabled."; } } else { - qDebug() << "Operation type is CREATE, updating create specific UI."; + qCDebug(appLog) << "Operation type is CREATE, updating create specific UI."; if (isUnallocated) { - qDebug() << "Unallocated space found. Setting select space stacked widget to index 0."; + qCDebug(appLog) << "Unallocated space found. Setting select space stacked widget to index 0."; m_selectSpaceStackedWidget->setCurrentIndex(0); m_selectSpaceLineEdit->lineEdit()->setPlaceholderText(QString("%1-%2").arg(QString::number(m_minSize, 'f', 2)) .arg(QString::number(m_maxSize, 'f', 2))); // m_selectSpaceLabel->setText(QString("(%1-%2)").arg(QString::number(m_minSize, 'f', 2)) // .arg(QString::number(m_maxSize, 'f', 2)) + m_selectSpaceComboBox->currentText()); m_selectSpaceLineEdit->setText(QString::number(m_maxSize, 'f', 2)); - qDebug() << "Select space line edit placeholder and text updated for unallocated space."; + qCDebug(appLog) << "Select space line edit placeholder and text updated for unallocated space."; } else { - qDebug() << "No unallocated space found. Setting select space stacked widget to index 1."; + qCDebug(appLog) << "No unallocated space found. Setting select space stacked widget to index 1."; m_selectSpaceStackedWidget->setCurrentIndex(1); m_curSize = m_sumSize; m_selectedSpaceLabel->setText(tr("Capacity selected: %1") .arg(QString::number(m_minSize, 'f', 2)) + m_selectSpaceComboBox->currentText()); - qDebug() << "Selected space label updated for no unallocated space."; + qCDebug(appLog) << "Selected space label updated for no unallocated space."; } } } - qDebug() << "Update selected data process finished."; + qCDebug(appLog) << "Update selected data process finished."; } void CreateVGWidget::onDeleteItemClicked(PVInfoData pvInfoData) { - qDebug() << "CreateVGWidget::onDeleteItemClicked called. Deleting item for:" << pvInfoData.m_partitionPath; + qCDebug(appLog) << "CreateVGWidget::onDeleteItemClicked called. Deleting item for:" << pvInfoData.m_partitionPath; for (int i = 0; i < m_curSeclectData.count(); ++i) { PVInfoData infoData = m_curSeclectData.at(i); if (judgeDataEquality(pvInfoData, infoData)) { m_curSeclectData.removeAt(i); - qDebug() << "Removed item from current selected data:" << infoData.m_partitionPath; + qCDebug(appLog) << "Removed item from current selected data:" << infoData.m_partitionPath; break; } } updateSelectedData(); - qDebug() << "Delete item process finished, updating selected data UI."; + qCDebug(appLog) << "Delete item process finished, updating selected data UI."; } void CreateVGWidget::onCurrentIndexChanged(int index) { - qDebug() << "CreateVGWidget::onCurrentIndexChanged called. Index:" << index; + qCDebug(appLog) << "CreateVGWidget::onCurrentIndexChanged called. Index:" << index; SIZE_UNIT type = getCurSizeUnit(); m_minSize = 0; m_maxSize = 0; m_sumSize = 0; - qDebug() << "Reset minSize, maxSize, sumSize to 0. Current size unit:" << static_cast(type); + qCDebug(appLog) << "Reset minSize, maxSize, sumSize to 0. Current size unit:" << static_cast(type); for (int i = 0; i < m_curSeclectData.count(); ++i) { PVInfoData pvInfoData = m_curSeclectData.at(i); - qDebug() << "Processing selected PVInfoData for index change:" << pvInfoData.m_partitionPath; + qCDebug(appLog) << "Processing selected PVInfoData for index change:" << pvInfoData.m_partitionPath; if (pvInfoData.m_partitionPath != "unallocated" && pvInfoData.m_disktype != "unrecognized") { m_minSize += Utils::sectorToUnit(pvInfoData.m_sectorEnd - pvInfoData.m_sectorStart + 1, @@ -2219,7 +2220,7 @@ void CreateVGWidget::onCurrentIndexChanged(int index) pvInfoData.m_sectorSize, type); m_sumSize += (pvInfoData.m_sectorEnd - pvInfoData.m_sectorStart + 1) * pvInfoData.m_sectorSize; - qDebug() << "Added to sumSize (bytes):" << (pvInfoData.m_sectorEnd - pvInfoData.m_sectorStart + 1) * pvInfoData.m_sectorSize; + qCDebug(appLog) << "Added to sumSize (bytes):" << (pvInfoData.m_sectorEnd - pvInfoData.m_sectorStart + 1) * pvInfoData.m_sectorSize; } @@ -2227,48 +2228,48 @@ void CreateVGWidget::onCurrentIndexChanged(int index) .arg(QString::number(m_maxSize, 'f', 2))); // m_selectSpaceLabel->setText(QString("(%1-%2)").arg(QString::number(m_minSize, 'f', 2)) // .arg(QString::number(m_maxSize, 'f', 2)) + m_selectSpaceComboBox->currentText()); - qDebug() << "Select space line edit placeholder updated."; + qCDebug(appLog) << "Select space line edit placeholder updated."; m_curSize = m_curSize > m_sumSize ? m_sumSize : m_curSize; if (!m_selectSpaceLineEdit->text().isEmpty()) { - qDebug() << "Select space line edit is not empty, updating text based on index."; + qCDebug(appLog) << "Select space line edit is not empty, updating text based on index."; switch (index) { case 0: { m_selectSpaceLineEdit->setText(QString::number(m_curSize / static_cast(MEBIBYTE), 'f', 2)); - qDebug() << "Setting text to MiB."; + qCDebug(appLog) << "Setting text to MiB."; break; } case 1: { m_selectSpaceLineEdit->setText(QString::number(m_curSize / static_cast(GIBIBYTE), 'f', 2)); - qDebug() << "Setting text to GiB."; + qCDebug(appLog) << "Setting text to GiB."; break; } case 2: { m_selectSpaceLineEdit->setText(QString::number(m_curSize / static_cast(TEBIBYTE), 'f', 2)); - qDebug() << "Setting text to TiB."; + qCDebug(appLog) << "Setting text to TiB."; break; } default: - qDebug() << "Default case for index."; + qCDebug(appLog) << "Default case for index."; break; } } - qDebug() << "Current index change handled."; + qCDebug(appLog) << "Current index change handled."; } void CreateVGWidget::onTextChanged(const QString &text) { - qDebug() << "CreateVGWidget::onTextChanged called. Text:" << text; + qCDebug(appLog) << "CreateVGWidget::onTextChanged called. Text:" << text; double curSize = QString::number(text.toDouble(), 'f', 2).toDouble(); double maxSize = QString::number(m_maxSize, 'f', 2).toDouble(); m_doneButton->setDisabled(text.isEmpty() || curSize == 0.00); m_selectSpaceLineEdit->setAlert(false); - qDebug() << "Done button disabled state set, alert cleared."; + qCDebug(appLog) << "Done button disabled state set, alert cleared."; if (!m_selectSpaceLineEdit->text().isEmpty()) { - qDebug() << "Select space line edit is not empty, updating current size."; + qCDebug(appLog) << "Select space line edit is not empty, updating current size."; double curSize = QString::number(m_selectSpaceLineEdit->text().toDouble(), 'f', 2).toDouble(); switch (m_selectSpaceComboBox->currentIndex()) { case 0: { @@ -2284,56 +2285,56 @@ void CreateVGWidget::onTextChanged(const QString &text) break; } default: - qDebug() << "Default case for current index."; + qCDebug(appLog) << "Default case for current index."; break; } if (curSize >= maxSize) { m_curSize = m_sumSize; - qDebug() << "Current size is greater than or equal to max size, setting current size to sum size."; + qCDebug(appLog) << "Current size is greater than or equal to max size, setting current size to sum size."; } m_curSize = m_curSize > m_sumSize ? m_sumSize : m_curSize; } - qDebug() << "Text changed handled."; + qCDebug(appLog) << "Text changed handled."; } void CreateVGWidget::onVGCreateMessage(const QString &vgMessage) { - qDebug() << "Received VG create message:" << vgMessage; + qCDebug(appLog) << "Received VG create message:" << vgMessage; if (m_waterLoadingWidget != nullptr) { m_waterLoadingWidget->stopTimer(); - qDebug() << "Water loading widget timer stopped."; + qCDebug(appLog) << "Water loading widget timer stopped."; } QStringList infoList = vgMessage.split(":"); if (infoList.count() <= 1) { - qDebug() << "Info list count <= 1, closing dialog."; + qCDebug(appLog) << "Info list count <= 1, closing dialog."; close(); return; } if (infoList.at(0) == "0") { - qWarning() << "VG operation failed with error code:" << infoList.at(1); + qCWarning(appLog) << "VG operation failed with error code:" << infoList.at(1); QString text = ""; switch (infoList.at(1).toInt()) { case LVMError::LVM_ERR_VG_ALREADY_EXISTS: { text = tr("Existing volume group, creation failed. Please retry after reboot."); // 逻辑卷组已存在,创建失败,请重启电脑再试 - qDebug() << "LVM_ERR_VG_ALREADY_EXISTS:" << text; + qCDebug(appLog) << "LVM_ERR_VG_ALREADY_EXISTS:" << text; break; } case LVMError::LVM_ERR_PV_CREATE_FAILED: { text = tr("Failed to create a physical volume. Please refresh Disk Utility and try again."); // 物理卷创建失败,请刷新磁盘管理器再试 - qDebug() << "LVM_ERR_PV_CREATE_FAILED:" << text; + qCDebug(appLog) << "LVM_ERR_PV_CREATE_FAILED:" << text; break; } case LVMError::LVM_ERR_IO_ERROR: { text = tr("Device input/output error. Please try again after reboot."); // 设备输入输出错误,请重启电脑再试 - qDebug() << "LVM_ERR_IO_ERROR:" << text; + qCDebug(appLog) << "LVM_ERR_IO_ERROR:" << text; break; } default: - qDebug() << "Unknown LVM error code."; + qCDebug(appLog) << "Unknown LVM error code."; break; } @@ -2342,21 +2343,21 @@ void CreateVGWidget::onVGCreateMessage(const QString &vgMessage) QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), text); DMessageManager::instance()->setContentMargens(this->parentWidget()->parentWidget()->parentWidget()->parentWidget(), QMargins(0, 0, 0, 20)); - qDebug() << "Warning message sent."; + qCDebug(appLog) << "Warning message sent."; } } - qDebug() << "Closing CreateVGWidget"; + qCDebug(appLog) << "Closing CreateVGWidget"; close(); } void CreateVGWidget::onUpdateUsb() { - qDebug() << "USB device status changed, checking for updates..."; + qCDebug(appLog) << "USB device status changed, checking for updates..."; QStringList deviceNameList = DMDbusHandler::instance()->getDeviceNameList(); if (m_curDeviceNameList == deviceNameList) { - qDebug() << "Device name list is unchanged, returning."; + qCDebug(appLog) << "Device name list is unchanged, returning."; return; } @@ -2366,7 +2367,7 @@ void CreateVGWidget::onUpdateUsb() QString devPath = m_curDeviceNameList.at(i); if (deviceNameList.indexOf(devPath) == -1) { deleteDevNameList.append(devPath); - qDebug() << "Detected removed device:" << devPath; + qCDebug(appLog) << "Detected removed device:" << devPath; } } @@ -2378,7 +2379,7 @@ void CreateVGWidget::onUpdateUsb() PVInfoData pvInfoData = m_curSeclectData.at(j); if (pvInfoData.m_diskPath == devPath) { deleteIndexList.append(j); - qDebug() << "Found removed device in selected data at index:" << j; + qCDebug(appLog) << "Found removed device in selected data at index:" << j; } } } @@ -2386,54 +2387,54 @@ void CreateVGWidget::onUpdateUsb() // 将拔出磁盘信息从当前选择的列表里剔除 for (int i = 0; i < deleteIndexList.size(); ++i) { m_curSeclectData.removeAt(deleteIndexList.at(i)); - qDebug() << "Removed device from selected data at index:" << deleteIndexList.at(i); + qCDebug(appLog) << "Removed device from selected data at index:" << deleteIndexList.at(i); } if (m_stackedWidget->currentIndex() == 0) { - qDebug() << "Current index is 0, updating disk data."; + qCDebug(appLog) << "Current index is 0, updating disk data."; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/ok.svg"), tr("Refreshing the page to reload disks")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); - qDebug() << "Refreshing disk selection UI due to USB change"; + qCDebug(appLog) << "Refreshing disk selection UI due to USB change"; updateData(); } else if (m_stackedWidget->currentIndex() == 1) { - qDebug() << "Current index is 1, updating selected data."; + qCDebug(appLog) << "Current index is 1, updating selected data."; if (!deleteIndexList.isEmpty()) { - qDebug() << "USB device removed, updating selected data UI."; + qCDebug(appLog) << "USB device removed, updating selected data UI."; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/ok.svg"), tr("Refreshing the page to reload disks")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); - qDebug() << "Refreshing selected data UI due to USB change"; + qCDebug(appLog) << "Refreshing selected data UI due to USB change"; updateSelectedData(); } } m_curDeviceNameList = deviceNameList; - qDebug() << "USB update handler finished."; + qCDebug(appLog) << "USB update handler finished."; } Byte_Value CreateVGWidget::getPVSize(const VGInfo &vg, const PVData &pv, bool flag) { - qDebug() << "CreateVGWidget::getPVSize called. PV path:" << pv.m_devicePath << ", flag:" << flag; + qCDebug(appLog) << "CreateVGWidget::getPVSize called. PV path:" << pv.m_devicePath << ", flag:" << flag; LVMInfo lvmInfo = DMDbusHandler::instance()->probLVMInfo(); //判断 if (lvmInfo.pvExists(pv)) { PVInfo pvInfo = lvmInfo.getPV(pv); if (pvInfo.joinVG()) { //如果pv已经加入vg 且加入的是别的vg 则返回-1 - qDebug() << "PV exists and joined another VG."; + qCDebug(appLog) << "PV exists and joined another VG."; return lvmInfo.pvOfVg(vg, pv) ? pvInfo.m_pvByteTotalSize : -1; } else { - qDebug() << "PV exists and not joined any VG, returning total byte size."; + qCDebug(appLog) << "PV exists and not joined any VG, returning total byte size."; return pvInfo.m_pvByteTotalSize; } } auto it = DMDbusHandler::instance()->probDeviceInfo().find(pv.m_diskPath); if (it == DMDbusHandler::instance()->probDeviceInfo().end()) { - qDebug() << "Device info not found for disk path:" << pv.m_diskPath; + qCDebug(appLog) << "Device info not found for disk path:" << pv.m_diskPath; return -1; } @@ -2444,30 +2445,30 @@ Byte_Value CreateVGWidget::getPVSize(const VGInfo &vg, const PVData &pv, bool fl if (startSec == 0 && pv.m_type == DEV_UNALLOCATED_PARTITION) { startSec = UEFI_SECTOR; - qDebug() << "Unallocated partition at start sector 0, adjusting start sector to UEFI_SECTOR."; + qCDebug(appLog) << "Unallocated partition at start sector 0, adjusting start sector to UEFI_SECTOR."; } if (pv.m_type == DEV_UNALLOCATED_PARTITION && pv.m_endSector == (dev.m_length - 1) && dev.m_disktype.contains("gpt")) { endSec -= GPTBACKUP; - qDebug() << "Unallocated GPT partition at end of disk, adjusting end sector."; + qCDebug(appLog) << "Unallocated GPT partition at end of disk, adjusting end sector."; } if (pv.m_type == DEV_DISK && flag) { startSec -= UEFI_SECTOR; endSec -= GPTBACKUP; - qDebug() << "Full disk and flag is true, adjusting start and end sectors."; + qCDebug(appLog) << "Full disk and flag is true, adjusting start and end sectors."; } long long allByte = dev.m_sectorSize * (endSec - startSec + 1); //获取总的byte long long i = allByte % vg.m_PESize; //获取剩下的size大小 if(i == 0){ - qDebug() << "Remaining size is 0, returning all bytes."; + qCDebug(appLog) << "Remaining size is 0, returning all bytes."; return allByte; }else if(i >= MEBIBYTE){ - qDebug() << "Remaining size >= MiB, returning all bytes - remaining."; + qCDebug(appLog) << "Remaining size >= MiB, returning all bytes - remaining."; return allByte - i; }else { - qDebug() << "Remaining size < MiB, returning all bytes - remaining - 4 MiB."; + qCDebug(appLog) << "Remaining size < MiB, returning all bytes - remaining - 4 MiB."; return allByte - i - 4 * MEBIBYTE; } // return i == 0 ? allByte : ((i >= MEBIBYTE) ? allByte - i : allByte - i - 4 * MEBIBYTE); //去除末尾 保证是vg pe的倍数 @@ -2475,21 +2476,21 @@ Byte_Value CreateVGWidget::getPVSize(const VGInfo &vg, const PVData &pv, bool fl Byte_Value CreateVGWidget::getDevSize(const VGInfo &vg, const PVData &pv, bool flag, long long size) { - qDebug() << "CreateVGWidget::getDevSize called. PV path:" << pv.m_devicePath << ", flag:" << flag << ", size:" << size; + qCDebug(appLog) << "CreateVGWidget::getDevSize called. PV path:" << pv.m_devicePath << ", flag:" << flag << ", size:" << size; LVMInfo lvmInfo = DMDbusHandler::instance()->probLVMInfo(); //判断 if (lvmInfo.pvExists(pv)) { PVInfo pvInfo = lvmInfo.getPV(pv); if (pvInfo.joinVG()) { //如果pv已经加入vg 且加入的是别的vg 则返回-1 - qDebug() << "PV exists and joined another VG, returning -1 if not of current VG, else total size."; + qCDebug(appLog) << "PV exists and joined another VG, returning -1 if not of current VG, else total size."; return lvmInfo.pvOfVg(vg, pv) ? (pv.m_endSector - pv.m_startSector + 1) * pv.m_sectorSize : -1; } } auto it = DMDbusHandler::instance()->probDeviceInfo().find(pv.m_diskPath); if (it == DMDbusHandler::instance()->probDeviceInfo().end()) { - qDebug() << "Device info not found for disk path:" << pv.m_diskPath << ", returning -1."; + qCDebug(appLog) << "Device info not found for disk path:" << pv.m_diskPath << ", returning -1."; return -1; } @@ -2499,35 +2500,35 @@ Byte_Value CreateVGWidget::getDevSize(const VGInfo &vg, const PVData &pv, bool f long long endSec = pv.m_endSector; if (startSec == 0 && pv.m_type == DEV_UNALLOCATED_PARTITION) { startSec = UEFI_SECTOR; - qDebug() << "Unallocated partition at start sector 0, adjusting start sector to UEFI_SECTOR."; + qCDebug(appLog) << "Unallocated partition at start sector 0, adjusting start sector to UEFI_SECTOR."; } if (pv.m_type == DEV_UNALLOCATED_PARTITION && pv.m_endSector == (dev.m_length - 1) && dev.m_disktype.contains("gpt")) { endSec -= GPTBACKUP; - qDebug() << "Unallocated GPT partition at end of disk, adjusting end sector."; + qCDebug(appLog) << "Unallocated GPT partition at end of disk, adjusting end sector."; } if (pv.m_type == DEV_DISK && flag) { startSec -= UEFI_SECTOR; endSec -= GPTBACKUP; - qDebug() << "Full disk and flag is true, adjusting start and end sectors."; + qCDebug(appLog) << "Full disk and flag is true, adjusting start and end sectors."; } long long allSize = size; long long tmpSize = size % vg.m_PESize; if (tmpSize > 0) { - qDebug() << "Size not divisible by PESize, rounding up."; + qCDebug(appLog) << "Size not divisible by PESize, rounding up."; allSize += vg.m_PESize; } if (allSize == vg.m_PESize) { - qDebug() << "Size is equal to PESize, adding PESize to allSize."; + qCDebug(appLog) << "Size is equal to PESize, adding PESize to allSize."; allSize += vg.m_PESize; } long long allSec = allSize / dev.m_sectorSize + 1; if ((endSec - startSec + 1) < allSec) { - qDebug() << "Not enough space for size, returning -1."; + qCDebug(appLog) << "Not enough space for size, returning -1."; return -1; } endSec = startSec + allSec - 1; @@ -2536,18 +2537,18 @@ Byte_Value CreateVGWidget::getDevSize(const VGInfo &vg, const PVData &pv, bool f Byte_Value CreateVGWidget::getMaxSize(const VGInfo &vg, const set &pvlist) { - qDebug() << "CreateVGWidget::getMaxSize called."; + qCDebug(appLog) << "CreateVGWidget::getMaxSize called."; Byte_Value maxSize = 0; foreach (const PVData &pv, pvlist) { //这里计算设备真实大小 跟getpvsize不同 maxSize += (pv.m_endSector - pv.m_startSector + 1) * pv.m_sectorSize; } - qDebug() << "Calculated max size"; + qCDebug(appLog) << "Calculated max size"; return maxSize; } Byte_Value CreateVGWidget::getMinSize(const VGInfo &vg, const set &pvlist) { - qDebug() << "CreateVGWidget::getMinSize called."; + qCDebug(appLog) << "CreateVGWidget::getMinSize called."; QListdiskList; QListpvDiskList; QListpartList; @@ -2559,7 +2560,7 @@ Byte_Value CreateVGWidget::getMinSize(const VGInfo &vg, const set &pvlis Byte_Value minSize = 0 ; if (vgUsed > getMaxSize(vg, pvlist)) { //vg使用大小超过最大值 - qDebug() << "VG used size exceeds max size, returning VG used size."; + qCDebug(appLog) << "VG used size exceeds max size, returning VG used size."; return vgUsed; } @@ -2614,7 +2615,7 @@ Byte_Value CreateVGWidget::getMinSize(const VGInfo &vg, const set &pvlis vgUsed -= minSize; if (vgUsed <= 0) { - qDebug() << "VG used size is less than or equal to minimum size, returning minimum size."; + qCDebug(appLog) << "VG used size is less than or equal to minimum size, returning minimum size."; return minSize; } @@ -2665,17 +2666,17 @@ Byte_Value CreateVGWidget::getMinSize(const VGInfo &vg, const set &pvlis } if (vgUsed > 0) { - qDebug() << "VG used size is greater than minimum size, returning VG used size."; + qCDebug(appLog) << "VG used size is greater than minimum size, returning VG used size."; return vg.m_peUsed * vg.m_PESize; } - qDebug() << "Minimum size calculation finished, returning minimum size."; + qCDebug(appLog) << "Minimum size calculation finished, returning minimum size."; return minSize; } bool CreateVGWidget::adjudicationPVMove(const VGInfo &vg, const set &pvlist, bool &bigDataMove, QStringList &realDelPvList) { - qDebug() << "CreateVGWidget::adjudicationPVMove called."; + qCDebug(appLog) << "CreateVGWidget::adjudicationPVMove called."; LUKSMap luks = DMDbusHandler::instance()->probLUKSInfo(); bigDataMove = false; @@ -2691,7 +2692,7 @@ bool CreateVGWidget::adjudicationPVMove(const VGInfo &vg, const set &pvl foreach (const PVData &pv, pvlist) { if (it.m_pvPath == pv.m_devicePath || (luksDev ==pv.m_devicePath&&!luksDev.isEmpty())) { - qDebug() << "PV" << it.m_pvPath << "is not deleted. break."; + qCDebug(appLog) << "PV" << it.m_pvPath << "is not deleted. break."; isDelete = false; break; } @@ -2705,15 +2706,15 @@ bool CreateVGWidget::adjudicationPVMove(const VGInfo &vg, const set &pvl } if (getMinSize(vg, pvlist) > getMaxSize(vg, pvlist)) { - qDebug() << "VG used size exceeds max size, returning false."; + qCDebug(appLog) << "VG used size exceeds max size, returning false."; return false; } if (((size / GIBIBYTE) >= 1)) { //判断是否存在大量数据需要移动 - qDebug() << "There are large amounts of data to move, returning true."; + qCDebug(appLog) << "There are large amounts of data to move, returning true."; bigDataMove = true; } - qDebug() << "CreateVGWidget::adjudicationPVMove finished."; + qCDebug(appLog) << "CreateVGWidget::adjudicationPVMove finished."; return true; } diff --git a/application/widgets/customcontrol/buttonlabel.cpp b/application/widgets/customcontrol/buttonlabel.cpp index 9a018cdb..3dde0f7c 100644 --- a/application/widgets/customcontrol/buttonlabel.cpp +++ b/application/widgets/customcontrol/buttonlabel.cpp @@ -1,21 +1,22 @@ -// 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 "buttonlabel.h" #include ButtonLabel::ButtonLabel(QWidget *parent) : QLabel(parent) { - qDebug() << "ButtonLabel created"; + qCDebug(appLog) << "ButtonLabel created"; } void ButtonLabel::mousePressEvent(QMouseEvent *event) { - qDebug() << "ButtonLabel clicked"; + qCDebug(appLog) << "ButtonLabel clicked"; Q_UNUSED(event); emit clicked(); - qDebug() << "ButtonLabel click signal emitted"; + qCDebug(appLog) << "ButtonLabel click signal emitted"; } diff --git a/application/widgets/customcontrol/ddbase.cpp b/application/widgets/customcontrol/ddbase.cpp index 1fe9d8bb..44aae59a 100644 --- a/application/widgets/customcontrol/ddbase.cpp +++ b/application/widgets/customcontrol/ddbase.cpp @@ -1,7 +1,8 @@ -// 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 "ddbase.h" #include "common.h" @@ -10,7 +11,7 @@ DDBase::DDBase(QWidget *parent) : DDialog(parent) { - qDebug() << "Creating base dialog"; + qCDebug(appLog) << "Creating base dialog"; setModal(true); setIcon(QIcon::fromTheme(appName)); @@ -19,17 +20,17 @@ DDBase::DDBase(QWidget *parent) m_mainFrame->setFrameStyle(DFrame::NoFrame); addContent(m_mainFrame); - qDebug() << "Base dialog initialized with main frame"; + qCDebug(appLog) << "Base dialog initialized with main frame"; // updateGeometry(); } void DDBase::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key::Key_Escape) { - qDebug() << "Ignoring Escape key press"; + qCDebug(appLog) << "Ignoring Escape key press"; event->ignore(); } else { - qDebug() << "Forwarding key press to base class"; + qCDebug(appLog) << "Forwarding key press to base class"; DDialog::keyPressEvent(event); } } diff --git a/application/widgets/customcontrol/dmdiskinfobox.cpp b/application/widgets/customcontrol/dmdiskinfobox.cpp index cccfe973..559cbff8 100644 --- a/application/widgets/customcontrol/dmdiskinfobox.cpp +++ b/application/widgets/customcontrol/dmdiskinfobox.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 "dmdiskinfobox.h" DmDiskinfoBox::DmDiskinfoBox(int level, QObject *parent, QString diskPath, QString diskSize, int vgFlag, int luksFlag, @@ -29,52 +30,52 @@ DmDiskinfoBox::DmDiskinfoBox(int level, QObject *parent, QString diskPath, QStri { m_childs.clear(); m_id = 0; - qDebug() << "DmDiskinfoBox initialized"; + qCDebug(appLog) << "DmDiskinfoBox initialized"; } DmDiskinfoBox::DmDiskinfoBox(QObject *parent) : QObject(parent) { - qDebug() << "Creating empty DmDiskinfoBox"; + qCDebug(appLog) << "Creating empty DmDiskinfoBox"; m_id = 0; m_level = 0; m_flag = 0; - qDebug() << "Empty DmDiskinfoBox initialized"; + qCDebug(appLog) << "Empty DmDiskinfoBox initialized"; } DmDiskinfoBox::~DmDiskinfoBox() { - // qDebug() << "Destroying DmDiskinfoBox, child count:" << m_childs.count(); + // qCDebug(appLog) << "Destroying DmDiskinfoBox, child count:" << m_childs.count(); for (int i = 0; i < m_childs.length(); i++) { if (m_childs.at(i) != nullptr) { - // qDebug() << "Deleting child item:" << i; + // qCDebug(appLog) << "Deleting child item:" << i; delete m_childs.at(i); } } m_childs.clear(); - // qDebug() << "DmDiskinfoBox destroyed"; + // qCDebug(appLog) << "DmDiskinfoBox destroyed"; } int DmDiskinfoBox::addChild(DmDiskinfoBox *child) { - qDebug() << "Adding child, current level:" << m_level + qCDebug(appLog) << "Adding child, current level:" << m_level << "child id:" << child->m_id; child->m_level = m_level + 1; foreach (DmDiskinfoBox *item, m_childs) { if (item->m_id == child->m_id) { - // qDebug() << "Replacing existing child with same id"; + // qCDebug(appLog) << "Replacing existing child with same id"; m_childs.removeOne(item); delete item; } } m_childs.append(child); - qDebug() << "Child added, new child count:" << m_childs.count(); + qCDebug(appLog) << "Child added, new child count:" << m_childs.count(); return 0; } int DmDiskinfoBox::childCount() { - qDebug() << "Getting child count:" << m_childs.count(); + qCDebug(appLog) << "Getting child count:" << m_childs.count(); return m_childs.count(); } diff --git a/application/widgets/customcontrol/dmframewidget.cpp b/application/widgets/customcontrol/dmframewidget.cpp index fe31b49f..04b29419 100644 --- a/application/widgets/customcontrol/dmframewidget.cpp +++ b/application/widgets/customcontrol/dmframewidget.cpp @@ -1,7 +1,8 @@ -// 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 "dmframewidget.h" #include "utils.h" #include "partitioninfo.h" @@ -21,7 +22,7 @@ DmFrameWidget::DmFrameWidget(DiskInfoData data, QWidget *parent) : DFrame(parent) , m_infoData(data) { - qDebug() << "DmFrameWidget constructor"; + qCDebug(appLog) << "DmFrameWidget constructor"; #if QT_VERSION_MAJOR > 5 m_parentPb = DGuiApplicationHelper::instance()->applicationPalette(); connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, @@ -31,14 +32,14 @@ DmFrameWidget::DmFrameWidget(DiskInfoData data, QWidget *parent) connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &DmFrameWidget::onHandleChangeTheme); #endif - qDebug() << "DmFrameWidget initialized"; + qCDebug(appLog) << "DmFrameWidget initialized"; } void DmFrameWidget::setFrameData() { - qDebug() << "Setting frame data, current level:" << DMDbusHandler::instance()->getCurLevel(); + qCDebug(appLog) << "Setting frame data, current level:" << DMDbusHandler::instance()->getCurLevel(); if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Updating partition information"; + qCDebug(appLog) << "Updating partition information"; //获取首页相关硬盘数据 PartitionInfo data = DMDbusHandler::instance()->getCurPartititonInfo(); @@ -56,7 +57,7 @@ void DmFrameWidget::setFrameData() QString partitionSize = Utils::formatSize(data.m_sectorEnd - data.m_sectorStart + 1, data.m_sectorSize); if (data.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "Partition is encrypted"; + qCDebug(appLog) << "Partition is encrypted"; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(data.m_path); if (luksInfo.isDecrypt) { mountpoints = ""; @@ -71,7 +72,7 @@ void DmFrameWidget::setFrameData() } if (mountpoints.contains("�")) { - qDebug() << "Partition contains gbk encoding"; + qCDebug(appLog) << "Partition contains gbk encoding"; mountpoints.remove(mountpoints.mid(mountpoints.indexOf("�"))); mountpoints.append(m_str); } @@ -79,13 +80,13 @@ void DmFrameWidget::setFrameData() m_infoData.m_mountpoints = mountpoints; m_infoData.m_unused = unused; if (m_infoData.m_unused.contains("-")) { - qDebug() << "Partition unused size is -"; + qCDebug(appLog) << "Partition unused size is -"; m_infoData.m_unused = "-"; } m_infoData.m_used = used; if (m_infoData.m_used.contains("-")) { - qDebug() << "Partition used size is -"; + qCDebug(appLog) << "Partition used size is -"; m_infoData.m_used = "-"; } @@ -94,26 +95,26 @@ void DmFrameWidget::setFrameData() QString partitionPath = data.m_path.remove(0, 5); // 从下标0开始,删除5个字符 if (data.m_fileSystemLabel == "") { - qDebug() << "Partition label is empty"; + qCDebug(appLog) << "Partition label is empty"; m_infoData.m_sysLabel = ""; } else { m_infoData.m_sysLabel = diskVolumn(partitionPath); if (m_infoData.m_sysLabel.contains("�")) { - qDebug() << "Partition label contains gbk encoding"; + qCDebug(appLog) << "Partition label contains gbk encoding"; QString sysLabel = m_infoData.m_sysLabel.split("�").at(0); m_infoData.m_sysLabel = sysLabel; }//==============gbk编码的中文到在应用下无名称格式化文件系统转换时中文乱码 } } update(); - qDebug() << "Frame data updated, mountpoints:" << m_infoData.m_mountpoints + qCDebug(appLog) << "Frame data updated, mountpoints:" << m_infoData.m_mountpoints << "size:" << m_infoData.m_partitionSize; } void DmFrameWidget::setDiskFrameData(const QString &path, const QString &diskType, const QString &used, const QString &unused, const QString &capacity, const QString &interface) { - qDebug() << "Setting disk frame data, path:" << path << "type:" << diskType; + qCDebug(appLog) << "Setting disk frame data, path:" << path << "type:" << diskType; m_infoData.m_mountpoints = path; m_infoData.m_unused = unused; m_infoData.m_used = used; @@ -122,31 +123,31 @@ void DmFrameWidget::setDiskFrameData(const QString &path, const QString &diskTyp m_infoData.m_sysLabel = interface; update(); - qDebug() << "Disk frame data updated"; + qCDebug(appLog) << "Disk frame data updated"; } QString DmFrameWidget::diskVolumn(QString partitionPath) { - qDebug() << "Getting disk volume, partition path:" << partitionPath; + qCDebug(appLog) << "Getting disk volume, partition path:" << partitionPath; DMDbusHandler *handler = DMDbusHandler::instance(); PartitionInfo curInfo = handler->getCurPartititonInfo(); // //将gbku盘label中文乱码转换为正常中文显示 // QProcess process; // process.start("ls", QStringList() << "-al" << "/dev/disk/by-label/"); // if (!process.waitForStarted()) { -// qWarning() << "Cmd Exec Failed:" << process.errorString(); +// qCWarning(appLog) << "Cmd Exec Failed:" << process.errorString(); // } // if (!process.waitForFinished(-1)) { -// qWarning() << "waitForFinished Failed:" << process.errorString(); +// qCWarning(appLog) << "waitForFinished Failed:" << process.errorString(); // } // QString standardError = process.readAllStandardOutput(); // QStringList mountsList = standardError.split("\n").filter(partitionPath); // QString sr = mountsList.last(); // QString st = sr.mid(40).remove(" -> ../../" + partitionPath); -// qDebug() << __FUNCTION__ << st; +// qCDebug(appLog) << __FUNCTION__ << st; // if (st.at(1) != "x") { // QString strstr1 = st.mid(st.indexOf("\\")); -// qDebug() << __FUNCTION__ << strstr1 << st.at(1); +// qCDebug(appLog) << __FUNCTION__ << strstr1 << st.at(1); // if (strstr1.at(1) != "x") { // QString stres = strstr1; // } else { @@ -332,9 +333,9 @@ void DmFrameWidget::resizeEvent(QResizeEvent *event) } void DmFrameWidget::onHandleChangeTheme() { - qDebug() << "Handling theme change"; + qCDebug(appLog) << "Handling theme change"; m_parentPb = Dtk::Gui::DGuiApplicationHelper::instance()->applicationPalette(); - qDebug() << "Theme palette updated"; + qCDebug(appLog) << "Theme palette updated"; } //QString DmFrameWidget::diffMountpoints(int width, QString mountpoints)