diff --git a/application/widgets/partitiontableerrorsinfodialog.cpp b/application/widgets/partitiontableerrorsinfodialog.cpp index 7b4258d..d75a33d 100644 --- a/application/widgets/partitiontableerrorsinfodialog.cpp +++ b/application/widgets/partitiontableerrorsinfodialog.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "partitiontableerrorsinfodialog.h" #include "partitiontableerrorsinfodelegate.h" #include "common.h" @@ -24,34 +25,34 @@ PartitionTableErrorsInfoDialog::PartitionTableErrorsInfoDialog(const QString &de : DDialog(parent) , m_deviceInfo(deviceInfo) { - qDebug() << "Creating partition table errors dialog for device:" << deviceInfo; + qCDebug(appLog) << "Creating partition table errors dialog for device:" << deviceInfo; initUI(); initConnections(); - qDebug() << "PartitionTableErrorsInfoDialog constructor completed."; + qCDebug(appLog) << "PartitionTableErrorsInfoDialog constructor completed."; } PartitionTableErrorsInfoDialog::~PartitionTableErrorsInfoDialog() { - qDebug() << "PartitionTableErrorsInfoDialog destructor called."; + qCDebug(appLog) << "PartitionTableErrorsInfoDialog destructor called."; delete m_partitionTableErrorsInfoDelegatee; - qDebug() << "PartitionTableErrorsInfoDialog destructor completed."; + qCDebug(appLog) << "PartitionTableErrorsInfoDialog destructor completed."; } void PartitionTableErrorsInfoDialog::initUI() { - qDebug() << "Initializing partition table errors UI"; + qCDebug(appLog) << "Initializing partition table errors UI"; setIcon(QIcon::fromTheme(appName)); setTitle(tr("Errors in Partition Table")); // 分区表错误报告 setMinimumSize(580, 386); DPalette palette1; if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType) { - qDebug() << "Theme is DarkType, setting palette color for dark theme."; + qCDebug(appLog) << "Theme is DarkType, setting palette color for dark theme."; QColor color("#FFFFFF"); color.setAlphaF(0.7); palette1.setColor(DPalette::WindowText, color); } else if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) { - qDebug() << "Theme is LightType, setting palette color for light theme."; + qCDebug(appLog) << "Theme is LightType, setting palette color for light theme."; QColor color("#000000"); color.setAlphaF(0.7); palette1.setColor(DPalette::WindowText, color); @@ -91,10 +92,10 @@ void PartitionTableErrorsInfoDialog::initUI() m_partitionTableErrorsInfoDelegatee = new PartitionTableErrorsInfoDelegate(this); m_tableView->setItemDelegate(m_partitionTableErrorsInfoDelegatee); if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::DarkType) { - qDebug() << "Theme is DarkType, setting delegate text color for dark theme."; + qCDebug(appLog) << "Theme is DarkType, setting delegate text color for dark theme."; m_partitionTableErrorsInfoDelegatee->setTextColor(QColor("#C0C6D4")); } else if (DGuiApplicationHelper::instance()->themeType() == DGuiApplicationHelper::LightType) { - qDebug() << "Theme is LightType, setting delegate text color for light theme."; + qCDebug(appLog) << "Theme is LightType, setting delegate text color for light theme."; m_partitionTableErrorsInfoDelegatee->setTextColor(QColor("#001A2E")); } @@ -138,27 +139,27 @@ void PartitionTableErrorsInfoDialog::initUI() addContent(tableWidget); addSpacing(17); addContent(buttonWidget); - qDebug() << "Partition table errors UI initialization completed."; + qCDebug(appLog) << "Partition table errors UI initialization completed."; } void PartitionTableErrorsInfoDialog::initConnections() { - qDebug() << "Initializing PartitionTableErrorsInfoDialog connections."; + qCDebug(appLog) << "Initializing PartitionTableErrorsInfoDialog connections."; connect(pushButton, &DPushButton::clicked, this, &PartitionTableErrorsInfoDialog::close); - qDebug() << "PartitionTableErrorsInfoDialog connections initialized."; + qCDebug(appLog) << "PartitionTableErrorsInfoDialog connections initialized."; } void PartitionTableErrorsInfoDialog::keyPressEvent(QKeyEvent *event) { - // qDebug() << "Key press event in PartitionTableErrorsInfoDialog, key:" << event->key(); + // qCDebug(appLog) << "Key press event in PartitionTableErrorsInfoDialog, key:" << event->key(); if (event->key() == Qt::Key::Key_Escape) { - qDebug() << "Escape key pressed, ignoring"; + qCDebug(appLog) << "Escape key pressed, ignoring"; event->ignore(); } else { - // qDebug() << "Other key pressed, calling DDialog::keyPressEvent."; + // qCDebug(appLog) << "Other key pressed, calling DDialog::keyPressEvent."; DDialog::keyPressEvent(event); } - // qDebug() << "PartitionTableErrorsInfoDialog::keyPressEvent completed."; + // qCDebug(appLog) << "PartitionTableErrorsInfoDialog::keyPressEvent completed."; } diff --git a/application/widgets/removepvwidget.cpp b/application/widgets/removepvwidget.cpp index e4f762f..3beea51 100644 --- a/application/widgets/removepvwidget.cpp +++ b/application/widgets/removepvwidget.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "removepvwidget.h" #include "messagebox.h" #include "utils.h" @@ -16,15 +17,15 @@ RemovePVWidget::RemovePVWidget(QWidget *parent) : DDBase(parent) { - qDebug() << "RemovePVWidget initialized"; + qCDebug(appLog) << "RemovePVWidget initialized"; initUi(); initConnection(); - qDebug() << "RemovePVWidget initialized"; + qCDebug(appLog) << "RemovePVWidget initialized"; } void RemovePVWidget::initUi() { - qDebug() << "Initializing RemovePVWidget UI."; + qCDebug(appLog) << "Initializing RemovePVWidget UI."; setIcon(QIcon::fromTheme("://icons/deepin/builtin/exception-logo.svg")); setFixedSize(380, 190); @@ -135,35 +136,35 @@ void RemovePVWidget::initUi() mainLayout->addWidget(m_stackedWidget); mainLayout->setSpacing(0); mainLayout->setContentsMargins(0, 0, 0, 0); - qDebug() << "RemovePVWidget UI initialization completed."; + qCDebug(appLog) << "RemovePVWidget UI initialization completed."; } void RemovePVWidget::initConnection() { - qDebug() << "Initializing RemovePVWidget connections."; + qCDebug(appLog) << "Initializing RemovePVWidget connections."; connect(m_deleteButton, &DWarningButton::clicked, this, &RemovePVWidget::onButtonClicked); connect(m_cancelButton, &DPushButton::clicked, this, &RemovePVWidget::onCancelButtonClicked); connect(DMDbusHandler::instance(), &DMDbusHandler::pvDeleteMessage, this, &RemovePVWidget::onPVDeleteMessage); - qDebug() << "RemovePVWidget connections initialized."; + qCDebug(appLog) << "RemovePVWidget connections initialized."; } void RemovePVWidget::onCancelButtonClicked() { - qDebug() << "onCancelButtonClicked called, closing widget."; + qCDebug(appLog) << "onCancelButtonClicked called, closing widget."; close(); - qDebug() << "onCancelButtonClicked completed."; + qCDebug(appLog) << "onCancelButtonClicked completed."; } void RemovePVWidget::onButtonClicked() { - qDebug() << "onButtonClicked called."; - qInfo() << "Delete PV button clicked"; + qCDebug(appLog) << "onButtonClicked called."; + qCInfo(appLog) << "Delete PV button clicked"; bool bigDataMove = false; QStringList realDelPvLis; set pvStrList; QList devList; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is PARTITION for PV deletion."; + qCDebug(appLog) << "Current level is PARTITION for PV deletion."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); //todo pvStrList 填入分区路径 pvStrList.insert(info.m_path); @@ -179,11 +180,11 @@ void RemovePVWidget::onButtonClicked() devList.append(pvData); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Current level is DISK for PV deletion."; + qCDebug(appLog) << "Current level is DISK for PV deletion."; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); //todo 此处 判断是磁盘加入还是分区加入 如果是磁盘 pvStrList 填入磁盘路径 如果是分区 依次填入分区路径 if (info.m_disktype == "none") { - qDebug() << "Disk type is 'none', inserting disk path to pvStrList."; + qCDebug(appLog) << "Disk type is 'none', inserting disk path to pvStrList."; pvStrList.insert(info.m_path); PVData pvData; @@ -197,11 +198,11 @@ void RemovePVWidget::onButtonClicked() devList.append(pvData); } else { - qDebug() << "Disk type is not 'none', iterating partitions to find PVs."; + qCDebug(appLog) << "Disk type is not 'none', iterating partitions to find PVs."; for (int i = 0; i < info.m_partition.size(); i++) { PartitionInfo partInfo = info.m_partition.at(i); if (partInfo.m_vgFlag != LVMFlag::LVM_FLAG_NOT_PV) { - qDebug() << "Partition is a PV, inserting partition path to pvStrList:" << partInfo.m_path; + qCDebug(appLog) << "Partition is a PV, inserting partition path to pvStrList:" << partInfo.m_path; pvStrList.insert(partInfo.m_path); PVData pvData; @@ -220,11 +221,11 @@ void RemovePVWidget::onButtonClicked() } if (pvStrList.size() > 0 && Utils::adjudicationPVDelete(DMDbusHandler::instance()->probLVMInfo(), pvStrList, bigDataMove, realDelPvLis)) { - qDebug() << "PV deletion allowed, bigDataMove:" << bigDataMove << ", realDelPvLis:" << realDelPvLis.join(','); + qCDebug(appLog) << "PV deletion allowed, bigDataMove:" << bigDataMove << ", realDelPvLis:" << realDelPvLis.join(','); //todo 进入 说明允许删除 补充允许删除逻辑 - qDebug() << "PV deletion allowed for:" << realDelPvLis.join(','); + qCDebug(appLog) << "PV deletion allowed for:" << realDelPvLis.join(','); if (bigDataMove) { - qDebug() << "Big data move detected, showing warning message box."; + qCDebug(appLog) << "Big data move detected, showing warning message box."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("removeWarningWidget"); @@ -235,14 +236,14 @@ void RemovePVWidget::onButtonClicked() warningBox.setWarings(text1 + "\n" + text2 + "\n" + text3, "", tr("Continue"), "continue", tr("Cancel"), "messageBoxCancelButton"); if (warningBox.exec() == DDialog::Rejected) { - qDebug() << "User canceled PV deletion due to large data movement"; + qCDebug(appLog) << "User canceled PV deletion due to large data movement"; return; } } DMDbusHandler::instance()->onDeletePVList(devList); } else { - qDebug() << "PV deletion not allowed, showing warning message box due to insufficient space."; + qCDebug(appLog) << "PV deletion not allowed, showing warning message box due to insufficient space."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("NotEnoughSpaceWidget"); @@ -250,7 +251,7 @@ void RemovePVWidget::onButtonClicked() warningBox.setWarings(tr("Not enough space to back up data on %1, please delete the logical volume first") .arg(realDelPvLis.join(',')), "", tr("OK"), "ok"); warningBox.exec(); - qWarning() << "Not enough space to delete PV:" << realDelPvLis.join(','); + qCWarning(appLog) << "Not enough space to delete PV:" << realDelPvLis.join(','); return; } @@ -258,26 +259,26 @@ void RemovePVWidget::onButtonClicked() m_stackedWidget->setCurrentIndex(1); DWindowCloseButton *button = findChild("DTitlebarDWindowCloseButton"); if (button != nullptr) { - qDebug() << "Close button found, disabling and hiding."; + qCDebug(appLog) << "Close button found, disabling and hiding."; button->setDisabled(true); button->hide(); } m_waterLoadingWidget->setStartTime(1000); - qDebug() << "onButtonClicked completed."; + qCDebug(appLog) << "onButtonClicked completed."; } void RemovePVWidget::onPVDeleteMessage(const QString &pvMessage) { - qDebug() << "Received PV delete message:" << pvMessage; + qCDebug(appLog) << "Received PV delete message:" << pvMessage; QStringList infoList = pvMessage.split(":"); if (infoList.count() <= 1) { - qWarning() << "Invalid PV delete message:" << pvMessage; + qCWarning(appLog) << "Invalid PV delete message:" << pvMessage; return; } if (infoList.at(0) == "0") { - qWarning() << "Failed to delete PV:" << infoList.mid(1).join(':'); + qCWarning(appLog) << "Failed to delete PV:" << infoList.mid(1).join(':'); // 删除物理卷失败 DMessageManager::instance()->sendMessage(this->parentWidget()->parentWidget()->parentWidget()->parentWidget(), QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), @@ -286,9 +287,9 @@ void RemovePVWidget::onPVDeleteMessage(const QString &pvMessage) QMargins(0, 0, 0, 20)); close(); } else { - qInfo() << "PV deleted successfully"; + qCInfo(appLog) << "PV deleted successfully"; close(); } - qDebug() << "onPVDeleteMessage completed."; + qCDebug(appLog) << "onPVDeleteMessage completed."; } diff --git a/application/widgets/resizedialog.cpp b/application/widgets/resizedialog.cpp index 4a32057..bd04733 100644 --- a/application/widgets/resizedialog.cpp +++ b/application/widgets/resizedialog.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "resizedialog.h" #include "partedproxy/dmdbushandler.h" #include "messagebox.h" @@ -22,24 +23,24 @@ ResizeDialog::ResizeDialog(QWidget *parent) : DDBase(parent) { - qDebug() << "ResizeDialog initialized"; + qCDebug(appLog) << "ResizeDialog initialized"; initUi(); initConnection(); setOnButtonClickedClose(false); - qDebug() << "ResizeDialog initialized."; + qCDebug(appLog) << "ResizeDialog initialized."; } void ResizeDialog::initUi() { - qDebug() << "Initializing ResizeDialog UI."; + qCDebug(appLog) << "Initializing ResizeDialog UI."; this->setFixedWidth(380); QVBoxLayout *mainLayout = new QVBoxLayout(m_mainFrame); #if QT_VERSION_MAJOR > 5 - qDebug() << "Setting contents margins for Qt6 or higher."; + qCDebug(appLog) << "Setting contents margins for Qt6 or higher."; mainLayout->setContentsMargins(0, 0, 0, 0); #else - qDebug() << "Setting margin for Qt5."; + qCDebug(appLog) << "Setting margin for Qt5."; mainLayout->setMargin(0); #endif DLabel *tipLabel = new DLabel(tr("It will resize the partitions on the disk"), this); @@ -52,11 +53,11 @@ void ResizeDialog::initUi() m_lineEdit = new DLineEdit(this); m_lineEdit->setObjectName("ResizeDialogLineEdit"); #if QT_VERSION_MAJOR > 5 - qDebug() << "Using QRegularExpressionValidator for Qt6 or higher."; + qCDebug(appLog) << "Using QRegularExpressionValidator for Qt6 or higher."; QRegularExpression regexp("^[0-9]*\\.[0-9]{1,2}"); QRegularExpressionValidator *pvalidaor = new QRegularExpressionValidator(regexp, this); #else - qDebug() << "Using QRegExpValidator for Qt5."; + qCDebug(appLog) << "Using QRegExpValidator for Qt5."; QRegExp regexp("^[0-9]*\\.[0-9]{1,2}"); QRegExpValidator *pvalidaor = new QRegExpValidator(regexp, this); #endif @@ -90,7 +91,7 @@ void ResizeDialog::initUi() vboxLayout->addLayout(hLayout); if (DMDbusHandler::LOGICALVOLUME == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Current level is LOGICALVOLUME, adding LV resize label."; + qCDebug(appLog) << "Current level is LOGICALVOLUME, adding LV resize label."; DPalette palette; palette.setColor(DPalette::Text, QColor("#526A7F")); @@ -107,13 +108,13 @@ void ResizeDialog::initUi() mainLayout->addLayout(vboxLayout); if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Current level is PARTITION, setting title and line edit text for partition resize."; + qCDebug(appLog) << "Current level is PARTITION, setting title and line edit text for partition resize."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setTitle(tr("Resize %1").arg(info.m_path)); m_lineEdit->setText(QString::number(Utils::sectorToUnit(info.m_sectorEnd - info.m_sectorStart + 1, info.m_sectorSize, UNIT_GIB), 'f', 2)); } else if (DMDbusHandler::LOGICALVOLUME == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Current level is LOGICALVOLUME, setting title and line edit text for logical volume resize."; + qCDebug(appLog) << "Current level is LOGICALVOLUME, setting title and line edit text for logical volume resize."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setTitle(tr("Resize %1").arg(lvInfo.m_lvName)); @@ -129,48 +130,48 @@ void ResizeDialog::initUi() getButton(index)->setAccessibleName("cancel"); getButton(m_okCode)->setAccessibleName("confirm"); getButton(m_okCode)->setDisabled(true); - qDebug() << "ResizeDialog UI initialization completed."; + qCDebug(appLog) << "ResizeDialog UI initialization completed."; } void ResizeDialog::initConnection() { - qDebug() << "Initializing ResizeDialog connections."; + qCDebug(appLog) << "Initializing ResizeDialog connections."; connect(this, &ResizeDialog::buttonClicked, this, &ResizeDialog::onButtonClicked); connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onComboSelectedChanged(int))); connect(m_lineEdit, &DLineEdit::textChanged, this, &ResizeDialog::onEditTextChanged); - qDebug() << "ResizeDialog connections initialized."; + qCDebug(appLog) << "ResizeDialog connections initialized."; } void ResizeDialog::partitionResize() { - qDebug() << "partitionResize called."; - qInfo() << "Starting partition resize operation"; + qCDebug(appLog) << "partitionResize called."; + qCInfo(appLog) << "Starting partition resize operation"; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); double newSize = 0; if (0 == m_comboBox->currentIndex()) { - qDebug() << "Unit is MiB, newSize:" << m_lineEdit->text().toDouble(); + qCDebug(appLog) << "Unit is MiB, newSize:" << m_lineEdit->text().toDouble(); newSize = m_lineEdit->text().toDouble(); } else { - qDebug() << "Unit is GiB, newSize:" << m_lineEdit->text().toDouble() * 1024; + qCDebug(appLog) << "Unit is GiB, newSize:" << m_lineEdit->text().toDouble() * 1024; newSize = m_lineEdit->text().toDouble() * 1024; } Sector newSectorEnd = info.m_sectorStart + static_cast(newSize * (MEBIBYTE / info.m_sectorSize)); if (newSectorEnd < 0) { - qDebug() << "Calculated newSectorEnd is less than 0, showing alert."; + qCDebug(appLog) << "Calculated newSectorEnd is less than 0, showing alert."; m_lineEdit->setAlertMessageAlignment(Qt::AlignTop); m_lineEdit->showAlertMessage(tr("No more than the maximum capacity please"), m_mainFrame); // 超出最大可用空间 m_lineEdit->setAlert(true); - qWarning() << "New size exceeds maximum capacity for partition:" << info.m_path; + qCWarning(appLog) << "New size exceeds maximum capacity for partition:" << info.m_path; return; } Sector curSectorEnd = info.m_sectorEnd; FS_Limits limits = info.m_fsLimits; if (newSectorEnd > curSectorEnd) { - qDebug() << "Attempting to expand partition."; + qCDebug(appLog) << "Attempting to expand partition."; if (limits.max_size == -1) { - qDebug() << "File system does not support expansion, showing noSupportFSDailog."; + qCDebug(appLog) << "File system does not support expansion, showing noSupportFSDailog."; noSupportFSDailog(); return; } @@ -182,10 +183,10 @@ void ResizeDialog::partitionResize() for (index = 0; index < arrInfo.size(); index++) { PartitionInfo tem = arrInfo.at(index); if (info == tem && index + 1 < arrInfo.size()) { - qDebug() << "Found current partition, checking next partition."; + qCDebug(appLog) << "Found current partition, checking next partition."; next = arrInfo.at(index + 1); if (next.m_type == TYPE_UNALLOCATED) { - qDebug() << "Next partition is unallocated, can expand."; + qCDebug(appLog) << "Next partition is unallocated, can expand."; canExpand = true; index += 1; break; @@ -194,20 +195,20 @@ void ResizeDialog::partitionResize() } if (!canExpand) { - qDebug() << "Cannot expand partition, no unallocated space."; + qCDebug(appLog) << "Cannot expand partition, no unallocated space."; m_lineEdit->setAlertMessageAlignment(Qt::AlignTop); m_lineEdit->showAlertMessage(tr("No more than the maximum capacity please"), m_mainFrame); // 超出最大可用空间 m_lineEdit->setAlert(true); - qWarning() << "No unallocated space available for expanding partition:" << info.m_path; + qCWarning(appLog) << "No unallocated space available for expanding partition:" << info.m_path; return; } else { - qDebug() << "Preparing to resize partition."; + qCDebug(appLog) << "Preparing to resize partition."; PartitionInfo newInfo = info; newInfo.m_sectorEnd = newSectorEnd; Sector diff = 0; diff = (newInfo.m_sectorEnd + 1) % (MEBIBYTE / newInfo.m_sectorSize); if (diff) { - qDebug() << "Adjusting newInfo.m_sectorEnd due to diff."; + qCDebug(appLog) << "Adjusting newInfo.m_sectorEnd due to diff."; newInfo.m_sectorEnd -= diff; } else { // If this is a GPT partition table and the partition ends less than 34 sectors @@ -216,43 +217,43 @@ void ResizeDialog::partitionResize() DeviceInfo device = DMDbusHandler::instance()->getCurDeviceInfo(); if (device.m_disktype == "gpt" && device.m_length - newInfo.m_sectorEnd < 34) { - qDebug() << "GPT partition and near end of device, reserving space for backup partition table."; + qCDebug(appLog) << "GPT partition and near end of device, reserving space for backup partition table."; newInfo.m_sectorEnd -= MEBIBYTE / newInfo.m_sectorSize; } } // 处理输入最大值,没有成功扩容的问题 if (m_maxSize == QString::number(m_lineEdit->text().toDouble(), 'f', 2)) { - qDebug() << "Input is max size, adjusting newInfo.m_sectorEnd."; + qCDebug(appLog) << "Input is max size, adjusting newInfo.m_sectorEnd."; DeviceInfo device = DMDbusHandler::instance()->getCurDeviceInfo(); if (device.m_disktype == "gpt" && device.m_length == (next.m_sectorEnd + 1)) { - qDebug() << "GPT disk and next sector is device end, adjusting for GPT."; + qCDebug(appLog) << "GPT disk and next sector is device end, adjusting for GPT."; newInfo.m_sectorEnd = next.m_sectorEnd - 33; } else { - qDebug() << "Setting newInfo.m_sectorEnd to next.m_sectorEnd."; + qCDebug(appLog) << "Setting newInfo.m_sectorEnd to next.m_sectorEnd."; newInfo.m_sectorEnd = next.m_sectorEnd; } } if (newInfo.m_sectorEnd > next.m_sectorEnd) { - qDebug() << "New sector end is greater than next sector end, showing alert."; + qCDebug(appLog) << "New sector end is greater than next sector end, showing alert."; m_lineEdit->setAlertMessageAlignment(Qt::AlignTop); m_lineEdit->showAlertMessage(tr("No more than the maximum capacity please"), m_mainFrame); // 超出最大可用空间 m_lineEdit->setAlert(true); - qWarning() << "New size exceeds adjacent unallocated space for partition:" << info.m_path; + qCWarning(appLog) << "New size exceeds adjacent unallocated space for partition:" << info.m_path; return; } else { - qDebug() << "Resizing partition via D-Bus."; + qCDebug(appLog) << "Resizing partition via D-Bus."; newInfo.m_alignment = ALIGN_MEBIBYTE; //ALIGN_MEBIBYTE; - qDebug() << "diff:" << diff << ", newInfo.m_sectorEnd:" << newInfo.m_sectorEnd; + qCDebug(appLog) << "diff:" << diff << ", newInfo.m_sectorEnd:" << newInfo.m_sectorEnd; DMDbusHandler::instance()->resize(newInfo); close(); } } } else if (newSectorEnd < curSectorEnd) { - qDebug() << "Attempting to shrink partition."; + qCDebug(appLog) << "Attempting to shrink partition."; if (limits.min_size == -1) { - qDebug() << "File system does not support shrinking, showing warning message box."; + qCDebug(appLog) << "File system does not support shrinking, showing warning message box."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("LVNoSupportFSWidget"); @@ -266,24 +267,24 @@ void ResizeDialog::partitionResize() // 处理输入最小值,弹出错误提示的问题 if (m_minSize == QString::number(m_lineEdit->text().toDouble(), 'f', 2) && newSectorEnd < minReduceSize) { - qDebug() << "Input is min size, adjusting newSectorEnd to minReduceSize."; + qCDebug(appLog) << "Input is min size, adjusting newSectorEnd to minReduceSize."; newSectorEnd = minReduceSize; } if (newSectorEnd < minReduceSize) { - qDebug() << "New sector end is less than minimum reduce size, showing alert."; + qCDebug(appLog) << "New sector end is less than minimum reduce size, showing alert."; m_lineEdit->setAlertMessageAlignment(Qt::AlignTop); m_lineEdit->showAlertMessage(tr("No less than the used capacity please"), m_mainFrame); // 不得低于已用空间 m_lineEdit->setAlert(true); return; } else { - qDebug() << "Showing backup warning message box before shrinking."; + qCDebug(appLog) << "Showing backup warning message box before shrinking."; MessageBox messageBox(this); messageBox.setObjectName("messageBox"); messageBox.setAccessibleName("messageBox"); messageBox.setWarings(tr("To prevent data loss, back up data before shrinking it"), "", tr("OK"), "ok", tr("Cancel"), "cancel"); if (messageBox.exec() == DDialog::Accepted) { - qDebug() << "User accepted shrinking, proceeding with resize."; + qCDebug(appLog) << "User accepted shrinking, proceeding with resize."; PartitionInfo newInfo = info; newInfo.m_sectorEnd = newSectorEnd; @@ -302,12 +303,12 @@ void ResizeDialog::partitionResize() } } } - qDebug() << "partitionResize completed."; + qCDebug(appLog) << "partitionResize completed."; } void ResizeDialog::lvResize() { - qInfo() << "Starting LV resize operation"; + qCInfo(appLog) << "Starting LV resize operation"; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); int peSize = vgInfo.m_PESize; @@ -316,55 +317,55 @@ void ResizeDialog::lvResize() Sector unUsedSize = static_cast(vgInfo.m_PESize * vgInfo.m_peUnused); FS_Limits limits = lvInfo.m_fsLimits; if (lvInfo.m_lvFsType == FS_UNKNOWN || lvInfo.m_lvFsType == FS_UNALLOCATED) { //如果没有文件系统 不限制放大缩小 - qInfo() << "LV does not have a file system, no resize limits."; + qCInfo(appLog) << "LV does not have a file system, no resize limits."; limits = FS_Limits(); } // 如果当前lv是系统盘,最小值为lv的大小 if (DMDbusHandler::instance()->getIsSystemDisk(lvInfo.m_vgName)) { - qInfo() << "LV is a system disk, setting min size to LV size."; + qCInfo(appLog) << "LV is a system disk, setting min size to LV size."; limits.min_size = curSize; } Sector newSize = 0; if (0 == m_comboBox->currentIndex()) { - qInfo() << "Resizing LV to MiB."; + qCInfo(appLog) << "Resizing LV to MiB."; newSize = static_cast(m_lineEdit->text().toDouble() * MEBIBYTE); } else { - qInfo() << "Resizing LV to GiB."; + qCInfo(appLog) << "Resizing LV to GiB."; newSize = static_cast(m_lineEdit->text().toDouble() * GIBIBYTE); } // 处理输入最小值,弹出错误提示的问题 if (m_minSize == QString::number(m_lineEdit->text().toDouble(), 'f', 2) && newSize < limits.min_size) { - qInfo() << "Input is min size, adjusting newSize to minSize."; + qCInfo(appLog) << "Input is min size, adjusting newSize to minSize."; newSize = limits.min_size; } if (newSize < limits.min_size) { - qInfo() << "New size is less than minimum size, showing alert."; + qCInfo(appLog) << "New size is less than minimum size, showing alert."; m_lineEdit->setAlertMessageAlignment(Qt::AlignTop); m_lineEdit->showAlertMessage(tr("No less than the used capacity please"), m_mainFrame); // 不得低于已用空间 m_lineEdit->setAlert(true); - qWarning() << "New size exceeds maximum capacity for LV:" << vgInfo.m_vgName; + qCWarning(appLog) << "New size exceeds maximum capacity for LV:" << vgInfo.m_vgName; return; } Sector peCount = newSize / peSize; if ((peCount * peSize) < newSize) { - qInfo() << "New size is not a multiple of PE size, rounding up."; + qCInfo(appLog) << "New size is not a multiple of PE size, rounding up."; peCount += 1; } newSize = peCount * peSize; // 处理输入最大值,没有成功扩容或者直接弹出错误提示的问题 if (m_maxSize == QString::number(m_lineEdit->text().toDouble(), 'f', 2) && newSize > curSize) { - qInfo() << "Input is max size, adjusting newSize to maxSize."; + qCInfo(appLog) << "Input is max size, adjusting newSize to maxSize."; newSize = curSize + unUsedSize; } if (newSize < 0 || (newSize - curSize) > unUsedSize) { - qInfo() << "New size exceeds maximum capacity for LV, showing alert."; + qCInfo(appLog) << "New size exceeds maximum capacity for LV, showing alert."; m_lineEdit->setAlertMessageAlignment(Qt::AlignTop); m_lineEdit->showAlertMessage(tr("No more than the maximum capacity please"), m_mainFrame); // 超出最大可用空间 m_lineEdit->setAlert(true); @@ -372,16 +373,16 @@ void ResizeDialog::lvResize() } if (newSize < curSize) { - qInfo() << "New size is less than current size, checking min size."; + qCInfo(appLog) << "New size is less than current size, checking min size."; if (limits.min_size == -1) { - qInfo() << "File system does not support shrinking, showing warning message box."; + qCInfo(appLog) << "File system does not support shrinking, showing warning message box."; noSupportFSDailog(); return; } Sector usedSize = lvInfo.m_fsUsed; if (limits.min_size < usedSize) { - qInfo() << "File system used size is less than minimum size, showing warning message box."; + qCInfo(appLog) << "File system used size is less than minimum size, showing warning message box."; m_lineEdit->setAlertMessageAlignment(Qt::AlignTop); m_lineEdit->showAlertMessage(tr("Unmount it before shrinking its space"), m_mainFrame); // 缩小空间前请先卸载 m_lineEdit->setAlert(true); @@ -392,17 +393,17 @@ void ResizeDialog::lvResize() messageBox.setObjectName("messageBox"); messageBox.setAccessibleName("messageBox"); if (lvInfo.m_busy) { - qInfo() << "LV is busy, showing warning message box."; + qCInfo(appLog) << "LV is busy, showing warning message box."; //当前设备已挂载,将会自动卸载,请对其内的数据做好备份,以防数据丢失 messageBox.setWarings(tr("The current device has been mounted and will be unmounted automatically. Please back up data in it to prevent data loss"), "", tr("OK"), "ok", tr("Cancel"), "cancel"); } else { - qInfo() << "LV is not busy, showing warning message box."; + qCInfo(appLog) << "LV is not busy, showing warning message box."; //缩减逻辑卷前,请对其内的数据做好备份,以防数据丢失 messageBox.setWarings(tr("To prevent data loss, back up data in the logical volume before shrinking it"), "", tr("OK"), "ok", tr("Cancel"), "cancel"); } if (messageBox.exec() == DDialog::Accepted) { - qInfo() << "User accepted shrinking, proceeding with resize."; + qCInfo(appLog) << "User accepted shrinking, proceeding with resize."; LVAction info; info.m_vgName = lvInfo.m_vgName; info.m_lvName = lvInfo.m_lvName; @@ -413,9 +414,9 @@ void ResizeDialog::lvResize() close(); } } else if (newSize > curSize) { - qInfo() << "New size is greater than current size, checking max size."; + qCInfo(appLog) << "New size is greater than current size, checking max size."; if (limits.max_size == -1) { - qInfo() << "File system does not support extending, showing warning message box."; + qCInfo(appLog) << "File system does not support extending, showing warning message box."; noSupportFSDailog(); return; } @@ -429,12 +430,12 @@ void ResizeDialog::lvResize() DMDbusHandler::instance()->resizeLV(info); close(); } - qDebug() << "LV resize completed."; + qCDebug(appLog) << "LV resize completed."; } void ResizeDialog::noSupportFSDailog() { - qDebug() << "Showing warning message box for file system does not support space adjustment."; + qCDebug(appLog) << "Showing warning message box for file system does not support space adjustment."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("LVNoSupportFSWidget"); @@ -445,48 +446,48 @@ void ResizeDialog::noSupportFSDailog() void ResizeDialog::onButtonClicked(int index, const QString &) { - qDebug() << "Button clicked with index:" << index; + qCDebug(appLog) << "Button clicked with index:" << index; if (m_okCode == index) { - qDebug() << "OK button clicked, starting resize operation."; + qCDebug(appLog) << "OK button clicked, starting resize operation."; if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Partition resize operation started."; + qCDebug(appLog) << "Partition resize operation started."; partitionResize(); } else if (DMDbusHandler::LOGICALVOLUME == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "LV resize operation started."; + qCDebug(appLog) << "LV resize operation started."; lvResize(); } } else { - qDebug() << "Cancel button clicked, closing dialog."; + qCDebug(appLog) << "Cancel button clicked, closing dialog."; done(index); } } void ResizeDialog::onComboSelectedChanged(int index) { - qDebug() << "Unit selection changed to index:" << index; + qCDebug(appLog) << "Unit selection changed to index:" << index; if (index == 0) { - qDebug() << "Selected unit is MiB."; + qCDebug(appLog) << "Selected unit is MiB."; //MiB if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Partition resize unit is MiB."; + qCDebug(appLog) << "Partition resize unit is MiB."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); m_lineEdit->setText(QString::number(Utils::sectorToUnit(info.m_sectorEnd - info.m_sectorStart + 1, info.m_sectorSize, UNIT_MIB), 'f', 2)); } else if (DMDbusHandler::LOGICALVOLUME == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "LV resize unit is MiB."; + qCDebug(appLog) << "LV resize unit is MiB."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); m_lineEdit->setText(QString::number(Utils::LVMSizeToUnit(lvInfo.m_lvLECount * lvInfo.m_LESize, UNIT_MIB), 'f', 2)); } getButton(m_okCode)->setDisabled(true); } else if (index == 1) { - qDebug() << "Selected unit is GiB."; + qCDebug(appLog) << "Selected unit is GiB."; //GiB if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Partition resize unit is GiB."; + qCDebug(appLog) << "Partition resize unit is GiB."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); m_lineEdit->setText(QString::number(Utils::sectorToUnit(info.m_sectorEnd - info.m_sectorStart + 1, info.m_sectorSize, UNIT_GIB), 'f', 2)); } else if (DMDbusHandler::LOGICALVOLUME == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "LV resize unit is GiB."; + qCDebug(appLog) << "LV resize unit is GiB."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); m_lineEdit->setText(QString::number(Utils::LVMSizeToUnit(lvInfo.m_lvLECount * lvInfo.m_LESize, UNIT_GIB), 'f', 2)); } @@ -499,12 +500,12 @@ void ResizeDialog::onComboSelectedChanged(int index) void ResizeDialog::onEditTextChanged(const QString &) { - qDebug() << "Size input changed to:" << m_lineEdit->text(); + qCDebug(appLog) << "Size input changed to:" << m_lineEdit->text(); if (!m_lineEdit->text().isEmpty() && m_lineEdit->text().toDouble() != 0.00) { - qDebug() << "Size input is valid."; + qCDebug(appLog) << "Size input is valid."; getButton(m_okCode)->setDisabled(false); if (m_lineEdit->isAlert()) { - qDebug() << "Size input is in alert state."; + qCDebug(appLog) << "Size input is in alert state."; m_lineEdit->setAlert(false); } @@ -512,12 +513,12 @@ void ResizeDialog::onEditTextChanged(const QString &) double setSize = 0; double curSize = 0; if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { //分区调整 - qDebug() << "Partition resize unit is:" << unit; + qCDebug(appLog) << "Partition resize unit is:" << unit; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); //获取磁盘 setSize = m_lineEdit->text().toDouble(); //获取当前设置大小 curSize = Utils::sectorToUnit(info.m_sectorEnd - info.m_sectorStart + 1, info.m_sectorSize, unit);//获取磁盘大小 } else if (DMDbusHandler::LOGICALVOLUME == DMDbusHandler::instance()->getCurLevel()) { //lv调整 - qDebug() << "LV resize unit is:" << unit; + qCDebug(appLog) << "LV resize unit is:" << unit; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); double tmpUnit = (unit == UNIT_MIB) ? MEBIBYTE : GIBIBYTE; Byte_Value tmp = static_cast(m_lineEdit->text().toDouble() * tmpUnit); //获取输入大小 @@ -527,19 +528,19 @@ void ResizeDialog::onEditTextChanged(const QString &) getButton(m_okCode)->setDisabled(QString::number(setSize, 'f', 2) == QString::number(curSize, 'f', 2)); } else { - qDebug() << "Size input is invalid."; + qCDebug(appLog) << "Size input is invalid."; getButton(m_okCode)->setDisabled(true); } } void ResizeDialog::updateInputRange() { - qDebug() << "Updating input range."; + qCDebug(appLog) << "Updating input range."; SIZE_UNIT unit = (0 == m_comboBox->currentIndex()) ? UNIT_MIB : UNIT_GIB; m_minSize = "0"; m_maxSize = "0"; if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "Partition resize unit is:" << unit; + qCDebug(appLog) << "Partition resize unit is:" << unit; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); FS_Limits limits = info.m_fsLimits; @@ -571,7 +572,7 @@ void ResizeDialog::updateInputRange() m_maxSize = QString::number(Utils::sectorToUnit(next.m_sectorEnd - info.m_sectorStart + 1, next.m_sectorSize, unit), 'f', 2); } } else if (DMDbusHandler::LOGICALVOLUME == DMDbusHandler::instance()->getCurLevel()) { - qDebug() << "LV resize unit is:" << unit; + qCDebug(appLog) << "LV resize unit is:" << unit; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); Sector curSize = lvInfo.m_lvLECount * lvInfo.m_LESize; @@ -591,5 +592,5 @@ void ResizeDialog::updateInputRange() } m_lineEdit->lineEdit()->setPlaceholderText(QString("%1-%2").arg(m_minSize).arg(m_maxSize)); - qDebug() << "Input range updated."; + qCDebug(appLog) << "Input range updated."; } diff --git a/application/widgets/titlewidget.cpp b/application/widgets/titlewidget.cpp index 69dceb7..bb3b41e 100644 --- a/application/widgets/titlewidget.cpp +++ b/application/widgets/titlewidget.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 "titlewidget.h" #include "mountdialog.h" #include "unmountdialog.h" @@ -23,14 +24,14 @@ TitleWidget::TitleWidget(DWidget *parent) : DWidget(parent) { - qDebug() << "TitleWidget initialized"; + qCDebug(appLog) << "TitleWidget initialized"; initUi(); initConnection(); } void TitleWidget::initUi() { - qDebug() << "Initializing TitleWidget UI."; + qCDebug(appLog) << "Initializing TitleWidget UI."; QHBoxLayout *layout = new QHBoxLayout(this); m_btnParted = createBtn(tr("Partition"), "partition"); @@ -103,27 +104,27 @@ void TitleWidget::initUi() m_btnResizeVG->hide(); resetButtonsSize(); - qDebug() << "TitleWidget UI initialization completed."; + qCDebug(appLog) << "TitleWidget UI initialization completed."; } void TitleWidget::setSizebyMode(DPushButton *button) { - qDebug() << "setSizebyMode called"; + qCDebug(appLog) << "setSizebyMode called"; #ifdef DTKWIDGET_CLASS_DSizeMode - qDebug() << "DTKWIDGET_CLASS_DSizeMode is defined, setting size by DSizeModeHelper."; + qCDebug(appLog) << "DTKWIDGET_CLASS_DSizeMode is defined, setting size by DSizeModeHelper."; button->setFixedSize(QSize(DSizeModeHelper::element(24, 36), DSizeModeHelper::element(24, 36))); button->setIconSize(QSize(DSizeModeHelper::element(12, 18), DSizeModeHelper::element(12, 18))); #else - qDebug() << "DTKWIDGET_CLASS_DSizeMode is not defined, setting fixed size (36x36) and icon size (18x18)."; + qCDebug(appLog) << "DTKWIDGET_CLASS_DSizeMode is not defined, setting fixed size (36x36) and icon size (18x18)."; button->setFixedSize(QSize(36, 36)); button->setIconSize(QSize(18, 18)); #endif - qDebug() << "setSizebyMode completed."; + qCDebug(appLog) << "setSizebyMode completed."; } void TitleWidget::resetButtonsSize() { - qDebug() << "resetButtonsSize called."; + qCDebug(appLog) << "resetButtonsSize called."; setSizebyMode(m_btnCreateVG); setSizebyMode(m_btnParted); setSizebyMode(m_btnFormat); @@ -136,12 +137,12 @@ void TitleWidget::resetButtonsSize() setSizebyMode(m_btnDeletePV); setSizebyMode(m_btnDeleteVG); setSizebyMode(m_btnDeleteLV); - qDebug() << "resetButtonsSize completed."; + qCDebug(appLog) << "resetButtonsSize completed."; } void TitleWidget::initConnection() { - qDebug() << "Initializing TitleWidget connections."; + qCDebug(appLog) << "Initializing TitleWidget connections."; connect(DMDbusHandler::instance(), &DMDbusHandler::curSelectChanged, this, &TitleWidget::onCurSelectChanged); connect(m_btnParted, &DPushButton::clicked, this, &TitleWidget::showPartInfoWidget); connect(m_btnFormat, &DPushButton::clicked, this, &TitleWidget::showFormateInfoWidget); @@ -158,29 +159,29 @@ void TitleWidget::initConnection() connect(DMDbusHandler::instance(), &DMDbusHandler::updateUsb, this, &TitleWidget::onUpdateUsb); #ifdef DTKWIDGET_CLASS_DSizeMode - qDebug() << "Connecting sizeModeChanged signal for DTKWIDGET_CLASS_DSizeMode."; + qCDebug(appLog) << "Connecting sizeModeChanged signal for DTKWIDGET_CLASS_DSizeMode."; connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::sizeModeChanged, this, [this]() { resetButtonsSize(); - qDebug() << "Size mode changed, resetButtonsSize called."; + qCDebug(appLog) << "Size mode changed, resetButtonsSize called."; }); #endif - qDebug() << "TitleWidget connections initialized."; + qCDebug(appLog) << "TitleWidget connections initialized."; } DPushButton *TitleWidget::createBtn(const QString &btnName, const QString &objName, bool bCheckable) { - qDebug() << "createBtn called for btnName:" << btnName << ", objName:" << objName << ", bCheckable:" << bCheckable; + qCDebug(appLog) << "createBtn called for btnName:" << btnName << ", objName:" << objName << ", bCheckable:" << bCheckable; auto btn = new DPushButton(this); // wzx 设置图标icon 2020-05-19 QIcon icon = Common::getIcon(objName); btn->setIcon(icon); #ifdef DTKWIDGET_CLASS_DSizeMode - qDebug() << "DTKWIDGET_CLASS_DSizeMode is defined, setting size by DSizeModeHelper."; + qCDebug(appLog) << "DTKWIDGET_CLASS_DSizeMode is defined, setting size by DSizeModeHelper."; btn->setFixedSize(QSize(DSizeModeHelper::element(24, 36), DSizeModeHelper::element(24, 36))); btn->setIconSize(QSize(DSizeModeHelper::element(12, 18), DSizeModeHelper::element(12, 18))); #else - qDebug() << "DTKWIDGET_CLASS_DSizeMode is not defined, setting fixed size (36x36) and icon size (18x18)."; + qCDebug(appLog) << "DTKWIDGET_CLASS_DSizeMode is not defined, setting fixed size (36x36) and icon size (18x18)."; btn->setFixedSize(QSize(36, 36)); btn->setIconSize(QSize(18, 18)); #endif @@ -190,17 +191,17 @@ DPushButton *TitleWidget::createBtn(const QString &btnName, const QString &objNa btn->setAccessibleName(objName); if (bCheckable) { - qDebug() << "Button is checkable, setting checked to false."; + qCDebug(appLog) << "Button is checkable, setting checked to false."; btn->setChecked(false); } - qDebug() << "createBtn completed, returning button:" << btn->objectName(); + qCDebug(appLog) << "createBtn completed, returning button:" << btn->objectName(); return btn; } void TitleWidget::showPartInfoWidget() { - qDebug() << "Show partition info widget"; + qCDebug(appLog) << "Show partition info widget"; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); PartitionDialog dlg(this); dlg.setObjectName("partitionDialog"); @@ -209,12 +210,12 @@ void TitleWidget::showPartInfoWidget() setCurDevicePath(info.m_devicePath); if (dlg.exec() == 1) { - qDebug() << "PartitionDialog accepted."; + qCDebug(appLog) << "PartitionDialog accepted."; if (TYPE_UNPARTITIONED == info.m_type && FS_UNALLOCATED == info.m_fileSystemType) { - qDebug() << "Device is unpartitioned and unallocated, showing warning."; + qCDebug(appLog) << "Device is unpartitioned and unallocated, showing warning."; setCurDevicePath(""); - qDebug() << QString("No partition table found on device %1").arg(info.m_devicePath); - qDebug() << "A partition table is required before partitions can be added"; + qCDebug(appLog) << QString("No partition table found on device %1").arg(info.m_devicePath); + qCDebug(appLog) << "A partition table is required before partitions can be added"; //ToDo:empty device create partition table // 无法识别当前设备分区表 DMessageManager::instance()->sendMessage(this->parentWidget()->parentWidget()->parentWidget(), @@ -231,14 +232,14 @@ void TitleWidget::showPartInfoWidget() setCurDevicePath(""); } else { - qDebug() << "PartitionDialog rejected."; + qCDebug(appLog) << "PartitionDialog rejected."; } - qDebug() << "showPartInfoWidget completed."; + qCDebug(appLog) << "showPartInfoWidget completed."; } void TitleWidget::showFormateInfoWidget() { - qDebug() << "Show format dialog"; + qCDebug(appLog) << "Show format dialog"; setCurDevicePath(DMDbusHandler::instance()->getCurDevicePath()); FormateDialog dlg(this); @@ -251,25 +252,25 @@ void TitleWidget::showFormateInfoWidget() bool TitleWidget::showDecryptDialog() { - qDebug() << "Show decrypt dialog"; + qCDebug(appLog) << "Show decrypt dialog"; DecryptDialog decryptDialog(this); decryptDialog.setObjectName("decryptDialog"); decryptDialog.setAccessibleName("decryptDialog"); if (decryptDialog.exec() != DDialog::Accepted) { - qDebug() << "Decrypt dialog not accepted."; + qCDebug(appLog) << "Decrypt dialog not accepted."; return false; } - qDebug() << "Decrypt dialog accepted."; + qCDebug(appLog) << "Decrypt dialog accepted."; return true; } bool TitleWidget::showNoFileSystemWarningDialog(const LUKS_INFO &luksInfo) { - qDebug() << "Show no file system warning dialog"; + qCDebug(appLog) << "Show no file system warning dialog"; if (luksInfo.m_mapper.m_luksFs == FSType::FS_UNKNOWN || luksInfo.m_mapper.m_luksFs == FSType::FS_UNALLOCATED || luksInfo.m_mapper.m_luksFs == FSType::FS_UNSUPPORTED || luksInfo.m_mapper.m_luksFs == FSType::FS_UNFORMATTED) { - qDebug() << "No file system found, showing warning."; + qCDebug(appLog) << "No file system found, showing warning."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("partNoSupportFSWidget"); @@ -280,64 +281,64 @@ bool TitleWidget::showNoFileSystemWarningDialog(const LUKS_INFO &luksInfo) return true; } - qDebug() << "No file system warning dialog not shown."; + qCDebug(appLog) << "No file system warning dialog not shown."; return false; } void TitleWidget::showMountInfoWidget() { - qDebug() << "Show mount dialog"; + qCDebug(appLog) << "Show mount dialog"; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is partition."; + qCDebug(appLog) << "Current level is partition."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setCurDevicePath(info.m_devicePath); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { if (!showDecryptDialog()) { setCurDevicePath(""); - qDebug() << "Decrypt dialog not accepted, returning."; + qCDebug(appLog) << "Decrypt dialog not accepted, returning."; return; } LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path); if (showNoFileSystemWarningDialog(luksInfo)) { setCurDevicePath(""); - qDebug() << "No file system warning dialog shown, returning."; + qCDebug(appLog) << "No file system warning dialog shown, returning."; return; } } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is logical volume."; + qCDebug(appLog) << "Current level is logical volume."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setCurVGName(lvInfo.m_vgName); if (lvInfo.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { if (!showDecryptDialog()) { setCurVGName(""); - qDebug() << "Decrypt dialog not accepted, returning."; + qCDebug(appLog) << "Decrypt dialog not accepted, returning."; return; } LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(lvInfo.m_lvPath); if (showNoFileSystemWarningDialog(luksInfo)) { setCurVGName(""); - qDebug() << "No file system warning dialog shown, returning."; + qCDebug(appLog) << "No file system warning dialog shown, returning."; return; } } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Current level is disk."; + qCDebug(appLog) << "Current level is disk."; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); setCurDevicePath(info.m_path); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { if (!showDecryptDialog()) { setCurDevicePath(""); - qDebug() << "Decrypt dialog not accepted, returning."; + qCDebug(appLog) << "Decrypt dialog not accepted, returning."; return; } LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path); if (showNoFileSystemWarningDialog(luksInfo)) { setCurDevicePath(""); - qDebug() << "No file system warning dialog shown, returning."; + qCDebug(appLog) << "No file system warning dialog shown, returning."; return; } } @@ -349,22 +350,22 @@ void TitleWidget::showMountInfoWidget() dlg.exec(); if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is partition."; + qCDebug(appLog) << "Current level is partition."; setCurDevicePath(""); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is logical volume."; + qCDebug(appLog) << "Current level is logical volume."; setCurVGName(""); } } void TitleWidget::showUnmountInfoWidget() { - qDebug() << "Show unmount dialog"; + qCDebug(appLog) << "Show unmount dialog"; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is partition."; + qCDebug(appLog) << "Current level is partition."; setCurDevicePath(DMDbusHandler::instance()->getCurPartititonInfo().m_devicePath); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is logical volume."; + qCDebug(appLog) << "Current level is logical volume."; setCurVGName(DMDbusHandler::instance()->getCurLVInfo().m_vgName); } @@ -374,22 +375,22 @@ void TitleWidget::showUnmountInfoWidget() dlg.exec(); if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is partition."; + qCDebug(appLog) << "Current level is partition."; setCurDevicePath(""); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is logical volume."; + qCDebug(appLog) << "Current level is logical volume."; setCurVGName(""); } } void TitleWidget::showResizeInfoWidget() { - qDebug() << "Show resize dialog"; + qCDebug(appLog) << "Show resize dialog"; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setCurDevicePath(info.m_devicePath); FS_Limits limits = info.m_fsLimits; if (limits.min_size == -1 && limits.max_size == -1) { - qDebug() << "Partition does not support resizing."; + qCDebug(appLog) << "Partition does not support resizing."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("partNoSupportFSWidget"); @@ -412,7 +413,7 @@ void TitleWidget::showResizeInfoWidget() void TitleWidget::onCreateLVClicked() { - qDebug() << "Create LV button clicked"; + qCDebug(appLog) << "Create LV button clicked"; setCurVGName(DMDbusHandler::instance()->getCurLVInfo().m_vgName); PartitionDialog dlg(this); dlg.setTitleText(tr("Create logical volume"), tr("The disks will be formatted if you create a logical volume")); @@ -420,7 +421,7 @@ void TitleWidget::onCreateLVClicked() dlg.setAccessibleName("createLVDialog"); if (dlg.exec() == 1) { - qDebug() << "Create LV dialog accepted."; + qCDebug(appLog) << "Create LV dialog accepted."; CreateLVWidget createLVWidget(this); createLVWidget.setObjectName("createLVWidget"); createLVWidget.setAccessibleName("createLVWidget"); @@ -432,12 +433,12 @@ void TitleWidget::onCreateLVClicked() void TitleWidget::onDeleteLVClicked() { - qDebug() << "Delete LV button clicked"; + qCDebug(appLog) << "Delete LV button clicked"; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setCurVGName(lvInfo.m_vgName); if (DMDbusHandler::instance()->lvIsMount(lvInfo)) { - qDebug() << "LV is mounted."; + qCDebug(appLog) << "LV is mounted."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("messageBox"); @@ -457,7 +458,7 @@ void TitleWidget::onDeleteLVClicked() messageBox.setWarings(tr("Data cannot be recovered if deleted, please confirm before proceeding"), "", tr("Delete"), DDialog::ButtonWarning, "delete", tr("Cancel"), "cancel"); if (messageBox.exec() == DDialog::Accepted) { - qDebug() << "Delete LV dialog accepted."; + qCDebug(appLog) << "Delete LV dialog accepted."; QStringList lvNameList; lvNameList << lvInfo.m_lvPath; @@ -465,18 +466,18 @@ void TitleWidget::onDeleteLVClicked() } setCurVGName(""); - qDebug() << "Delete LV dialog closed."; + qCDebug(appLog) << "Delete LV dialog closed."; } void TitleWidget::onResizeLVClicked() { - qDebug() << "Resize LV button clicked"; + qCDebug(appLog) << "Resize LV button clicked"; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setCurVGName(lvInfo.m_vgName); if(lvInfo.m_lvFsType == FS_NTFS){ - qDebug() << "LV is NTFS."; + qCDebug(appLog) << "LV is NTFS."; if (DMDbusHandler::instance()->lvIsMount(lvInfo)){ - qDebug() << "LV is mounted."; + qCDebug(appLog) << "LV is mounted."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("messageBox"); @@ -493,7 +494,7 @@ void TitleWidget::onResizeLVClicked() FS_Limits limits = lvInfo.m_fsLimits; if ((limits.min_size == -1 && limits.max_size == -1) || lvInfo.m_lvFsType == FS_FAT16 || lvInfo.m_lvFsType == FS_FAT32) { //fat32 or fat16 lvm情况下不支持调整 - qDebug() << "LV does not support resizing."; + qCDebug(appLog) << "LV does not support resizing."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("LVNoSupportFSWidget"); @@ -507,7 +508,7 @@ void TitleWidget::onResizeLVClicked() } if (lvInfo.m_fileSystemLabel == "Roota" || lvInfo.m_fileSystemLabel == "Rootb") { - qDebug() << "LV is Roota or Rootb."; + qCDebug(appLog) << "LV is Roota or Rootb."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("messageBox"); @@ -523,19 +524,19 @@ void TitleWidget::onResizeLVClicked() dlg.exec(); setCurVGName(""); - qDebug() << "Resize LV dialog closed."; + qCDebug(appLog) << "Resize LV dialog closed."; } void TitleWidget::onCreateVGClicked() { - qDebug() << "Create VG button clicked"; + qCDebug(appLog) << "Create VG button clicked"; PartitionDialog dlg(this); dlg.setTitleText(tr("Create volume group"), tr("The disks will be formatted if you create a volume group")); dlg.setObjectName("createVGDialog"); dlg.setAccessibleName("createVGDialog"); if (dlg.exec() == 1) { - qDebug() << "Create VG dialog accepted."; + qCDebug(appLog) << "Create VG dialog accepted."; CreateVGWidget createVGWidget(CreateVGWidget::CREATE, this); createVGWidget.setObjectName("createVGWidget"); createVGWidget.setAccessibleName("createVGWidget"); @@ -545,11 +546,11 @@ void TitleWidget::onCreateVGClicked() void TitleWidget::onDeleteVGClicked() { - qDebug() << "Delete VG button clicked"; + qCDebug(appLog) << "Delete VG button clicked"; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); setCurVGName(vgInfo.m_vgName); if (DMDbusHandler::instance()->isExistMountLV(vgInfo)) { - qDebug() << "VG has mounted LV."; + qCDebug(appLog) << "VG has mounted LV."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("messageBox"); @@ -569,7 +570,7 @@ void TitleWidget::onDeleteVGClicked() messageBox.setWarings(tr("Data cannot be recovered if deleted, please confirm before proceeding"), "", tr("Delete"), DDialog::ButtonWarning, "delete", tr("Cancel"), "cancel"); if (messageBox.exec() == DDialog::Accepted) { - qDebug() << "Delete VG dialog accepted."; + qCDebug(appLog) << "Delete VG dialog accepted."; QStringList vgNameList; vgNameList << vgInfo.m_vgName; @@ -577,12 +578,12 @@ void TitleWidget::onDeleteVGClicked() } setCurVGName(""); - qDebug() << "Delete VG dialog closed."; + qCDebug(appLog) << "Delete VG dialog closed."; } void TitleWidget::onResizeVGClicked() { - qDebug() << "Resize VG button clicked"; + qCDebug(appLog) << "Resize VG button clicked"; setCurVGName(DMDbusHandler::instance()->getCurVGInfo().m_vgName); CreateVGWidget createVGWidget(CreateVGWidget::RESIZE, this); @@ -591,17 +592,17 @@ void TitleWidget::onResizeVGClicked() createVGWidget.exec(); setCurVGName(""); - qDebug() << "Resize VG dialog closed."; + qCDebug(appLog) << "Resize VG dialog closed."; } void TitleWidget::onDeletePVClicked() { - qDebug() << "Delete PV button clicked"; + qCDebug(appLog) << "Delete PV button clicked"; QMap mapVGInfo = DMDbusHandler::instance()->probLVMInfo().m_vgInfo; bool vgIsMount = false; QStringList lstVGName; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is partition."; + qCDebug(appLog) << "Current level is partition."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setCurDevicePath(info.m_devicePath); VGData vgData = info.m_vgData; @@ -619,7 +620,7 @@ void TitleWidget::onDeletePVClicked() } } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Current level is disk."; + qCDebug(appLog) << "Current level is disk."; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); setCurDevicePath(info.m_path); QStringList pvStrList; @@ -665,13 +666,13 @@ void TitleWidget::onDeletePVClicked() } if (!lstVGName.isEmpty()) { - qDebug() << "VG has mounted LV."; + qCDebug(appLog) << "VG has mounted LV."; vgIsMount = true; } } if (vgIsMount) { - qDebug() << "PV has mounted LV."; + qCDebug(appLog) << "PV has mounted LV."; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("deletePVMessageBox"); @@ -690,18 +691,18 @@ void TitleWidget::onDeletePVClicked() removePVWidget.exec(); setCurDevicePath(""); - qDebug() << "Delete PV dialog closed."; + qCDebug(appLog) << "Delete PV dialog closed."; } void TitleWidget::updateBtnStatus() { - qDebug() << "Update button status."; + qCDebug(appLog) << "Update button status."; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is partition."; + qCDebug(appLog) << "Current level is partition."; updateBtnShowStatus(true, true, false, false, true, false, true, true); PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); if (info.m_vgFlag != LVMFlag::LVM_FLAG_NOT_PV) { - qDebug() << "Partition is in PV."; + qCDebug(appLog) << "Partition is in PV."; m_btnParted->hide(); m_btnCreateLV->show(); @@ -711,7 +712,7 @@ void TitleWidget::updateBtnStatus() m_btnCreateLV->setDisabled(true); updatePartitionBtnStatus(true, true, true, true, true); } else if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "Partition is in LUKS."; + qCDebug(appLog) << "Partition is in LUKS."; m_btnResize->setDisabled(true); m_btnDeletePV->setDisabled(true); m_btnParted->setDisabled(true); @@ -719,23 +720,23 @@ void TitleWidget::updateBtnStatus() LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path); updateEncryptDeviceBtnStatus(luksInfo); } else { - qDebug() << "Partition is not in PV or LUKS."; + qCDebug(appLog) << "Partition is not in PV or LUKS."; m_btnDeletePV->setDisabled(true); m_btnParted->show(); m_btnCreateLV->hide(); //已挂载 if (info.m_mountPoints.size() > 0 && info.m_busy) { - qDebug() << "Partition is mounted."; + qCDebug(appLog) << "Partition is mounted."; updatePartitionBtnStatus(true, true, true, false, true); if (1 == info.m_flag) { m_btnUnmount->setDisabled(true); } } else { - qDebug() << "Partition is not mounted."; + qCDebug(appLog) << "Partition is not mounted."; if (1 == info.m_flag) { - qDebug() << "Partition is not mounted."; + qCDebug(appLog) << "Partition is not mounted."; updatePartitionBtnStatus(true, true, true, true, true); } else { //需判断扩展分区上是否无分区,否则认为不可操作,此处省略操作 @@ -754,25 +755,25 @@ void TitleWidget::updateBtnStatus() } } - qDebug() << info.m_type << info.m_fileSystemType; + qCDebug(appLog) << info.m_type << info.m_fileSystemType; if (info.m_fileSystemType == FSType::FS_LINUX_SWAP) { - qDebug() << "Partition is swap."; + qCDebug(appLog) << "Partition is swap."; updatePartitionBtnStatus(true, true, true, true, true); } //CD,DVD disable format if (info.m_devicePath.startsWith("/dev/sr") || info.m_devicePath.startsWith("/dev/cdrom")) { - qDebug() << "Partition is CD or DVD."; + qCDebug(appLog) << "Partition is CD or DVD."; updatePartitionBtnStatus(true, true, true, true, true); } } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Current level is disk."; + qCDebug(appLog) << "Current level is disk."; updateBtnShowStatus(true, true, false, false, true, false, true, true); updatePartitionBtnStatus(true, true, true, true, true); DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); if (info.m_vgFlag != LVMFlag::LVM_FLAG_NOT_PV) { //有分区创建为pv - qDebug() << "Disk is in PV."; + qCDebug(appLog) << "Disk is in PV."; m_btnParted->hide(); m_btnCreateLV->show(); @@ -790,7 +791,7 @@ void TitleWidget::updateBtnStatus() m_btnCreateLV->setDisabled(true); m_btnFormat->setDisabled(true); } else if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS && info.m_partition.size() == 0) { - qDebug() << "Disk is in LUKS."; + qCDebug(appLog) << "Disk is in LUKS."; LUKS_INFO luksInfo = DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path); m_btnDeletePV->setDisabled(true); if (luksInfo.isDecrypt) { @@ -803,7 +804,7 @@ void TitleWidget::updateBtnStatus() updatePartitionBtnStatus(true, false, false, true, true); } } else { - qDebug() << "Disk is not in PV or LUKS."; + qCDebug(appLog) << "Disk is not in PV or LUKS."; m_btnParted->show(); m_btnCreateLV->hide(); @@ -818,7 +819,7 @@ void TitleWidget::updateBtnStatus() } } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::VOLUMEGROUP) { - qDebug() << "Current level is VG."; + qCDebug(appLog) << "Current level is VG."; updateBtnShowStatus(false, true, true, true, false, true, false, true); // 如果VG异常,所有相关操作禁用 @@ -835,20 +836,20 @@ void TitleWidget::updateBtnStatus() m_btnCreateLV->setDisabled(true); } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is LV."; + qCDebug(appLog) << "Current level is LV."; updateBtnShowStatus(true, false, true, true, false, true, true, false); // 如果VG异常,所有相关操作禁用 VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); if (vgInfo.isPartial()) { - qDebug() << "VG is partial."; + qCDebug(appLog) << "VG is partial."; updateLVBtnStatus(true, true, true, true, true, true); return; } LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); if (lvInfo.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "LV is in LUKS."; + qCDebug(appLog) << "LV is in LUKS."; m_btnResizeLV->setDisabled(true); m_btnCreateLV->setDisabled(true); @@ -858,24 +859,24 @@ void TitleWidget::updateBtnStatus() } if (lvInfo.m_lvName.isEmpty() && lvInfo.m_lvUuid.isEmpty()) { - qDebug() << "LV is not exist."; + qCDebug(appLog) << "LV is not exist."; updateLVBtnStatus(true, false, true, true, true, true); } else if (lvInfo.m_lvFsType == FSType::FS_LINUX_SWAP) { - qDebug() << "LV is swap."; + qCDebug(appLog) << "LV is swap."; updateLVBtnStatus(true, true, true, true, true, false); } else { - qDebug() << "LV is not swap."; + qCDebug(appLog) << "LV is not swap."; bool noMountPoint = lvInfo.m_mountPoints.isEmpty(); updateLVBtnStatus(false, true, !noMountPoint, !noMountPoint, noMountPoint, false); } } - qDebug() << "TitleWidget::updateLVBtnStatus completed."; + qCDebug(appLog) << "TitleWidget::updateLVBtnStatus completed."; } void TitleWidget::updatePartitionBtnStatus(const bool &isCreate, const bool &isWipe, const bool &isMount, const bool &isUnmount, const bool &isResize) { - qDebug() << "Update partition button status."; + qCDebug(appLog) << "Update partition button status."; m_btnParted->setDisabled(isCreate); m_btnFormat->setDisabled(isWipe); m_btnMount->setDisabled(isMount); @@ -886,7 +887,7 @@ void TitleWidget::updatePartitionBtnStatus(const bool &isCreate, const bool &isW void TitleWidget::updateVGBtnStatus(const bool &isDeleteVG, const bool &isCreateLV, const bool &isWipe, const bool &isMount, const bool &isUnmount, const bool &isResize) { - qDebug() << "Update VG button status."; + qCDebug(appLog) << "Update VG button status."; m_btnDeleteVG->setDisabled(isDeleteVG); m_btnCreateLV->setDisabled(isCreateLV); m_btnFormat->setDisabled(isWipe); @@ -898,7 +899,7 @@ void TitleWidget::updateVGBtnStatus(const bool &isDeleteVG, const bool &isCreate void TitleWidget::updateLVBtnStatus(const bool &isDeleteLV, const bool &isCreateLV, const bool &isWipe, const bool &isMount, const bool &isUnmount, const bool &isResize) { - qDebug() << "Update LV button status."; + qCDebug(appLog) << "Update LV button status."; m_btnDeleteLV->setDisabled(isDeleteLV); m_btnCreateLV->setDisabled(isCreateLV); m_btnFormat->setDisabled(isWipe); @@ -911,7 +912,7 @@ void TitleWidget::updateBtnShowStatus(const bool &isDeleteVGShow, const bool &is const bool &isPartedShow, const bool &isCreateLVShow, const bool &isResizShow, const bool &isResizeVGShow, const bool &isResizeLVShow) { - qDebug() << "Update button show status."; + qCDebug(appLog) << "Update button show status."; m_btnDeleteVG->setHidden(isDeleteVGShow); m_btnDeleteLV->setHidden(isDeleteLVShow); m_btnDeletePV->setHidden(isDeletePVShow); @@ -924,27 +925,27 @@ void TitleWidget::updateBtnShowStatus(const bool &isDeleteVGShow, const bool &is void TitleWidget::updateEncryptDeviceBtnStatus(const LUKS_INFO &luksInfo) { - qDebug() << "Update encrypt device button status."; + qCDebug(appLog) << "Update encrypt device button status."; if (luksInfo.isDecrypt) { - qDebug() << "Device is decrypt."; + qCDebug(appLog) << "Device is decrypt."; if (luksInfo.m_mapper.m_luksFs == FSType::FS_LVM2_PV) { - qDebug() << "Device is PV."; + qCDebug(appLog) << "Device is PV."; m_btnFormat->setDisabled(true); m_btnMount->setDisabled(true); m_btnUnmount->setDisabled(true); } else if (luksInfo.m_mapper.m_mountPoints.isEmpty()) { - qDebug() << "Device is not mount."; + qCDebug(appLog) << "Device is not mount."; m_btnFormat->setDisabled(false); m_btnMount->setDisabled(false); m_btnUnmount->setDisabled(true); } else { - qDebug() << "Device is mount."; + qCDebug(appLog) << "Device is mount."; m_btnFormat->setDisabled(true); m_btnMount->setDisabled(true); m_btnUnmount->setDisabled(false); } } else { - qDebug() << "Device is not decrypt."; + qCDebug(appLog) << "Device is not decrypt."; m_btnFormat->setDisabled(false); m_btnMount->setDisabled(false); m_btnUnmount->setDisabled(true); @@ -953,24 +954,24 @@ void TitleWidget::updateEncryptDeviceBtnStatus(const LUKS_INFO &luksInfo) void TitleWidget::onCurSelectChanged() { - qDebug() << "TitleWidget::onCurSelectChanged"; + qCDebug(appLog) << "TitleWidget::onCurSelectChanged"; updateBtnStatus(); - qDebug() << "Current selection changed"; + qCDebug(appLog) << "Current selection changed"; } void TitleWidget::onUpdateUsb() { - qDebug() << "TitleWidget::onUpdateUsb"; + qCDebug(appLog) << "TitleWidget::onUpdateUsb"; if (m_curChooseDevicePath.isEmpty() && m_curChooseVGName.isEmpty()) { - qDebug() << "No device or VG selected."; + qCDebug(appLog) << "No device or VG selected."; return; } if (!m_curChooseDevicePath.isEmpty()) { - qDebug() << "Update device: " << m_curChooseDevicePath; + qCDebug(appLog) << "Update device: " << m_curChooseDevicePath; QStringList deviceNameList = DMDbusHandler::instance()->getDeviceNameList(); if (deviceNameList.indexOf(m_curChooseDevicePath) != -1) { - qDebug() << "Device is already in list."; + qCDebug(appLog) << "Device is already in list."; return; } @@ -993,10 +994,10 @@ void TitleWidget::onUpdateUsb() setCurDevicePath(""); } else if (!m_curChooseVGName.isEmpty()) { - qDebug() << "Update VG: " << m_curChooseVGName; + qCDebug(appLog) << "Update VG: " << m_curChooseVGName; QStringList vgNameList = DMDbusHandler::instance()->getVGNameList(); if (vgNameList.indexOf(m_curChooseVGName) != -1) { - qDebug() << "VG is already in list."; + qCDebug(appLog) << "VG is already in list."; return; } @@ -1013,25 +1014,25 @@ void TitleWidget::onUpdateUsb() setCurVGName(""); } - qDebug() << "Update VG completed."; + qCDebug(appLog) << "Update VG completed."; } void TitleWidget::setCurDevicePath(const QString &devPath) { - qDebug() << "TitleWidget::setCurDevicePath"; + qCDebug(appLog) << "TitleWidget::setCurDevicePath"; m_curChooseDevicePath = devPath; } void TitleWidget::setCurVGName(const QString &vgName) { - qDebug() << "TitleWidget::setCurVGName"; + qCDebug(appLog) << "TitleWidget::setCurVGName"; m_curChooseVGName = vgName; } void TitleWidget::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::RightButton) { - qDebug() << "TitleWidget::mousePressEvent"; + qCDebug(appLog) << "TitleWidget::mousePressEvent"; return; } diff --git a/application/widgets/unmountdialog.cpp b/application/widgets/unmountdialog.cpp index 6504d9c..87dd9f0 100644 --- a/application/widgets/unmountdialog.cpp +++ b/application/widgets/unmountdialog.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 "unmountdialog.h" #include "partedproxy/dmdbushandler.h" #include "messagebox.h" @@ -18,14 +19,14 @@ UnmountDialog::UnmountDialog(QWidget *parent) : DDBase(parent) { - qDebug() << "UnmountDialog initialized"; + qCDebug(appLog) << "UnmountDialog initialized"; initUi(); initConnection(); } void UnmountDialog::initUi() { - qDebug() << "Initializing UnmountDialog UI."; + qCDebug(appLog) << "Initializing UnmountDialog UI."; QVBoxLayout *mainLayout = new QVBoxLayout(m_mainFrame); DLabel *tipLabel = new DLabel(tr("Make sure there are no programs running on the disk"), this); tipLabel->setWordWrap(true); @@ -35,22 +36,22 @@ void UnmountDialog::initUi() mainLayout->addWidget(tipLabel); if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is PARTITION, setting title for partition unmount."; + qCDebug(appLog) << "Current level is PARTITION, setting title for partition unmount."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setTitle(tr("Unmount %1").arg(info.m_path)); - qDebug() << "Preparing to unmount partition:" << info.m_path; + qCDebug(appLog) << "Preparing to unmount partition:" << info.m_path; } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is LOGICALVOLUME, setting title for logical volume unmount."; + qCDebug(appLog) << "Current level is LOGICALVOLUME, setting title for logical volume unmount."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setTitle(tr("Unmount %1").arg(lvInfo.m_lvName)); - qDebug() << "Preparing to unmount logical volume:" << lvInfo.m_lvName; + qCDebug(appLog) << "Preparing to unmount logical volume:" << lvInfo.m_lvName; tipLabel->setText(tr("Make sure there are no programs running on the logical volume")); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Current level is DISK, setting title for disk unmount."; + qCDebug(appLog) << "Current level is DISK, setting title for disk unmount."; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); setTitle(tr("Unmount %1").arg(info.m_path)); - qDebug() << "Preparing to unmount disk:" << info.m_path; + qCDebug(appLog) << "Preparing to unmount disk:" << info.m_path; } int index = addButton(tr("Cancel"), false, ButtonNormal); @@ -59,37 +60,37 @@ void UnmountDialog::initUi() getButton(index)->setAccessibleName("cancel"); getButton(m_okCode)->setAccessibleName("unmountButton"); setOnButtonClickedClose(false); - qDebug() << "UnmountDialog UI initialization completed."; + qCDebug(appLog) << "UnmountDialog UI initialization completed."; } void UnmountDialog::initConnection() { - qDebug() << "Initializing UnmountDialog connections."; + qCDebug(appLog) << "Initializing UnmountDialog connections."; connect(this, &UnmountDialog::buttonClicked, this, &UnmountDialog::onButtonClicked); - qDebug() << "UnmountDialog connections initialized."; + qCDebug(appLog) << "UnmountDialog connections initialized."; } void UnmountDialog::umountCurMountPoints() { - qDebug() << "umountCurMountPoints called."; + qCDebug(appLog) << "umountCurMountPoints called."; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is PARTITION for unmount operation."; + qCDebug(appLog) << "Current level is PARTITION for unmount operation."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "Unmounting encrypted partition:" << info.m_path; + qCDebug(appLog) << "Unmounting encrypted partition:" << info.m_path; DMDbusHandler::instance()->cryptUmount(DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path), info.m_path); } else { - qDebug() << "Unmounting partition:" << info.m_path; + qCDebug(appLog) << "Unmounting partition:" << info.m_path; DMDbusHandler::instance()->unmount(); } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is LOGICALVOLUME for unmount operation."; + qCDebug(appLog) << "Current level is LOGICALVOLUME for unmount operation."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); if (lvInfo.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "Unmounting encrypted logical volume:" << lvInfo.m_lvName; + qCDebug(appLog) << "Unmounting encrypted logical volume:" << lvInfo.m_lvName; DMDbusHandler::instance()->cryptUmount(DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(lvInfo.m_lvPath), lvInfo.m_lvName); } else { - qDebug() << "Unmounting logical volume:" << lvInfo.m_lvName; + qCDebug(appLog) << "Unmounting logical volume:" << lvInfo.m_lvName; LVAction lvAction; lvAction.m_vgName = lvInfo.m_vgName; lvAction.m_lvName = lvInfo.m_lvName; @@ -101,74 +102,74 @@ void UnmountDialog::umountCurMountPoints() DMDbusHandler::instance()->onUmountLV(lvAction); } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { - qDebug() << "Current level is DISK for unmount operation."; + qCDebug(appLog) << "Current level is DISK for unmount operation."; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { - qDebug() << "Unmounting encrypted disk:" << info.m_path; + qCDebug(appLog) << "Unmounting encrypted disk:" << info.m_path; DMDbusHandler::instance()->cryptUmount(DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path), info.m_path); } } - qDebug() << "umountCurMountPoints completed."; + qCDebug(appLog) << "umountCurMountPoints completed."; } void UnmountDialog::onButtonClicked(int index, const QString &text) { - qDebug() << "onButtonClicked called with index:" << index << ", text:" << text; + qCDebug(appLog) << "onButtonClicked called with index:" << index << ", text:" << text; Q_UNUSED(text); if (m_okCode == index) { - qDebug() << "OK button clicked."; + qCDebug(appLog) << "OK button clicked."; int partitionFlag = 0; bool isSysPath = false; bool lvFlag = false; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { - qDebug() << "Current level is PARTITION, checking system path for partition."; + qCDebug(appLog) << "Current level is PARTITION, checking system path for partition."; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); partitionFlag = info.m_flag; for (int i = 0; i < info.m_mountPoints.size(); i++) { if (info.m_mountPoints[i] == "/boot/efi" || info.m_mountPoints[i] == "/boot" || info.m_mountPoints[i] == "/" || info.m_mountPoints[i] == "/recovery") { - qDebug() << "Partition mount point is a system path:" << info.m_mountPoints[i]; + qCDebug(appLog) << "Partition mount point is a system path:" << info.m_mountPoints[i]; isSysPath = true; break; } } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { - qDebug() << "Current level is LOGICALVOLUME, checking system path for logical volume."; + qCDebug(appLog) << "Current level is LOGICALVOLUME, checking system path for logical volume."; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); lvFlag = lvInfo.m_dataFlag; for (int i = 0; i < lvInfo.m_mountPoints.size(); i++) { if (lvInfo.m_mountPoints[i] == "/boot/efi" || lvInfo.m_mountPoints[i] == "/boot" || lvInfo.m_mountPoints[i] == "/" || lvInfo.m_mountPoints[i] == "/recovery") { - qDebug() << "Logical volume mount point is a system path:" << lvInfo.m_mountPoints[i]; + qCDebug(appLog) << "Logical volume mount point is a system path:" << lvInfo.m_mountPoints[i]; isSysPath = true; break; } } } - qDebug() << "Checking system path status"; + qCDebug(appLog) << "Checking system path status"; if (isSysPath || partitionFlag == 4 || lvFlag) { - qWarning() << "Attempting to unmount system path - showing warning dialog"; + qCWarning(appLog) << "Attempting to unmount system path - showing warning dialog"; UnmountWarningDialog unmountWarningDialog; unmountWarningDialog.setObjectName("firstWarning"); unmountWarningDialog.setAccessibleName("firstWarning"); if (unmountWarningDialog.exec() == DDialog::Accepted) { - qDebug() << "User accepted unmount warning, proceeding with unmount."; + qCDebug(appLog) << "User accepted unmount warning, proceeding with unmount."; umountCurMountPoints(); - qDebug() << "User canceled unmount operation"; + qCDebug(appLog) << "User canceled unmount operation"; close(); } else { - qDebug() << "User rejected unmount warning."; + qCDebug(appLog) << "User rejected unmount warning."; } } else { - qDebug() << "Not a system path, proceeding with unmount."; + qCDebug(appLog) << "Not a system path, proceeding with unmount."; umountCurMountPoints(); close(); } } else { - qDebug() << "Cancel button clicked, closing dialog."; + qCDebug(appLog) << "Cancel button clicked, closing dialog."; close(); } - qDebug() << "onButtonClicked completed."; + qCDebug(appLog) << "onButtonClicked completed."; } diff --git a/application/widgets/unmountwarningdialog.cpp b/application/widgets/unmountwarningdialog.cpp index d09e9e9..b8ab00f 100644 --- a/application/widgets/unmountwarningdialog.cpp +++ b/application/widgets/unmountwarningdialog.cpp @@ -3,6 +3,7 @@ // SPDX-License-Identifier: GPL-3.0-only +#include "ddlog.h" #include "unmountwarningdialog.h" #include @@ -11,14 +12,14 @@ UnmountWarningDialog::UnmountWarningDialog(QWidget *parent) : DDBase(parent) { - qDebug() << "UnmountWarningDialog initialized"; + qCDebug(appLog) << "UnmountWarningDialog initialized"; initUi(); initConnection(); } void UnmountWarningDialog::initUi() { - qDebug() << "Initializing UnmountWarningDialog UI."; + qCDebug(appLog) << "Initializing UnmountWarningDialog UI."; DPalette palette1; QColor color("#000000"); color.setAlphaF(0.9); @@ -62,41 +63,41 @@ void UnmountWarningDialog::initUi() int index = addButton(tr("Cancel"), true, ButtonNormal); m_okCode = addButton(tr("Unmount"), false, ButtonWarning); getButton(m_okCode)->setDisabled(true); - qDebug() << "Unmount button initially disabled"; + qCDebug(appLog) << "Unmount button initially disabled"; getButton(index)->setAccessibleName("cancelBtn"); getButton(m_okCode)->setAccessibleName("unmountBtn"); - qDebug() << "UnmountWarningDialog UI initialization completed."; + qCDebug(appLog) << "UnmountWarningDialog UI initialization completed."; } void UnmountWarningDialog::initConnection() { - qDebug() << "Initializing UnmountWarningDialog connections."; + qCDebug(appLog) << "Initializing UnmountWarningDialog connections."; connect(m_checkBox, &DCheckBox::stateChanged, this, &UnmountWarningDialog::onCheckBoxStateChange); - qDebug() << "UnmountWarningDialog connections initialized."; + qCDebug(appLog) << "UnmountWarningDialog connections initialized."; } void UnmountWarningDialog::onCheckBoxStateChange(int state) { - qDebug() << "onCheckBoxStateChange called with state:" << state; + qCDebug(appLog) << "onCheckBoxStateChange called with state:" << state; switch (state) { case Qt::CheckState::Unchecked: { - qDebug() << "CheckBox state is Unchecked, disabling unmount button."; + qCDebug(appLog) << "CheckBox state is Unchecked, disabling unmount button."; getButton(m_okCode)->setDisabled(true); - qDebug() << "Unmount button disabled"; + qCDebug(appLog) << "Unmount button disabled"; break; } case Qt::CheckState::Checked: { - qDebug() << "CheckBox state is Checked, enabling unmount button."; + qCDebug(appLog) << "CheckBox state is Checked, enabling unmount button."; getButton(m_okCode)->setDisabled(false); - qDebug() << "Unmount button enabled"; + qCDebug(appLog) << "Unmount button enabled"; break; } default: - qDebug() << "Unknown CheckBox state."; + qCDebug(appLog) << "Unknown CheckBox state."; break; } - qDebug() << "onCheckBoxStateChange completed."; + qCDebug(appLog) << "onCheckBoxStateChange completed."; } diff --git a/application/widgets/vginfoshowwidget.cpp b/application/widgets/vginfoshowwidget.cpp index f0c24c5..8bcfb4a 100644 --- a/application/widgets/vginfoshowwidget.cpp +++ b/application/widgets/vginfoshowwidget.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 "vginfoshowwidget.h" #include @@ -21,27 +22,27 @@ VGInfoShowWidget::VGInfoShowWidget(QWidget *parent) : QWidget(parent) { - qDebug() << "VGInfoShowWidget initialized"; + qCDebug(appLog) << "VGInfoShowWidget initialized"; initUi(); initConnection(); } void VGInfoShowWidget::initUi() { - qDebug() << "Initializing VGInfoShowWidget UI."; + qCDebug(appLog) << "Initializing VGInfoShowWidget UI."; setWindowFlags(Qt::FramelessWindowHint | Qt::Popup); setAttribute(Qt::WA_TranslucentBackground); - qDebug() << "VGInfoShowWidget UI initialized."; + qCDebug(appLog) << "VGInfoShowWidget UI initialized."; } void VGInfoShowWidget::initConnection() { - qDebug() << "Initializing VGInfoShowWidget connections."; + qCDebug(appLog) << "Initializing VGInfoShowWidget connections."; } void VGInfoShowWidget::setData(const QList< QMap > &lstInfo) { - qDebug() << "setData called, setting VG info data, items count:" << lstInfo.count(); + qCDebug(appLog) << "setData called, setting VG info data, items count:" << lstInfo.count(); QList lstCylinderWidget = children(); for (int i = 0; i < lstCylinderWidget.count(); i ++) { QObject *obj = lstCylinderWidget.at(i); @@ -62,16 +63,16 @@ void VGInfoShowWidget::setData(const QList< QMap > &lstInfo) DPalette paletteText; QPalette paletteBackground; DGuiApplicationHelper::ColorType themeType = DGuiApplicationHelper::instance()->themeType(); - qDebug() << "Current theme type:" << (themeType == DGuiApplicationHelper::LightType ? "Light" : "Dark"); + qCDebug(appLog) << "Current theme type:" << (themeType == DGuiApplicationHelper::LightType ? "Light" : "Dark"); if (themeType == DGuiApplicationHelper::LightType) { - qDebug() << "Theme is LightType, setting palette colors for light theme."; + qCDebug(appLog) << "Theme is LightType, setting palette colors for light theme."; QColor color("#F7F7F7"); color.setAlphaF(0.6); paletteBackground.setColor(QPalette::Base, color); paletteText.setColor(DPalette::Text, QColor("#000000")); } else if (themeType == DGuiApplicationHelper::DarkType) { - qDebug() << "Theme is DarkType, setting palette colors for dark theme."; + qCDebug(appLog) << "Theme is DarkType, setting palette colors for dark theme."; QColor color("#080808"); color.setAlphaF(0.6); paletteBackground.setColor(QPalette::Base, color); @@ -85,7 +86,7 @@ void VGInfoShowWidget::setData(const QList< QMap > &lstInfo) QString path = mapInfo["name"].toString(); QString size = mapInfo["size"].toString(); QColor color = mapInfo["color"].value(); - // qDebug() << "Processing item" << i << ": path=" << path << ", size=" << size; + // qCDebug(appLog) << "Processing item" << i << ": path=" << path << ", size=" << size; DLabel *m_label = new DLabel(this); m_label->setFixedSize(16, 16); @@ -127,15 +128,15 @@ void VGInfoShowWidget::setData(const QList< QMap > &lstInfo) int height = lstInfo.count() / 2; if (lstInfo.count() % 2 != 0) { - qDebug() << "lstInfo count is odd, increasing height by 1."; + qCDebug(appLog) << "lstInfo count is odd, increasing height by 1."; height += 1; } - qDebug() << "Calculated layout height:" << height; + qCDebug(appLog) << "Calculated layout height:" << height; DFrame *frame = new DFrame; frame->setPalette(paletteBackground); if (height > 4) { - qDebug() << "Height is greater than 4, creating scrollable layout for large content."; + qCDebug(appLog) << "Height is greater than 4, creating scrollable layout for large content."; setFixedSize(340, 192); m_gridLayout->setSpacing(8); @@ -164,18 +165,18 @@ void VGInfoShowWidget::setData(const QList< QMap > &lstInfo) frame->setLayout(scrollAreaLayout); } else { - qDebug() << "Height is 4 or less, creating fixed layout for small content."; + qCDebug(appLog) << "Height is 4 or less, creating fixed layout for small content."; int width = 340; if (lstInfo.count() == 1) { - qDebug() << "lstInfo count is 1, setting width to 170."; + qCDebug(appLog) << "lstInfo count is 1, setting width to 170."; width = 170; } if (height == 1) { - qDebug() << "Height is 1, setting fixed size (width, 60)."; + qCDebug(appLog) << "Height is 1, setting fixed size (width, 60)."; setFixedSize(width, 60); } else { - qDebug() << "Height is greater than 1, setting fixed size (width, height * 50)."; + qCDebug(appLog) << "Height is greater than 1, setting fixed size (width, height * 50)."; setFixedSize(width, height * 50); } @@ -191,7 +192,7 @@ void VGInfoShowWidget::setData(const QList< QMap > &lstInfo) mainLayout->setContentsMargins(0, 0, 0, 0); setLayout(mainLayout); - qDebug() << "setData completed."; + qCDebug(appLog) << "setData completed."; } diff --git a/log/CMakeLists.txt b/log/CMakeLists.txt index 30ddeed..2cb56a6 100644 --- a/log/CMakeLists.txt +++ b/log/CMakeLists.txt @@ -1,6 +1,8 @@ #include_directories(${PROJECT_SOURCE_DIR}/log) +# ddlog.h(日志分类声明)在 basestruct 中,log 库转换分类化后需要该头文件路径 +include_directories(${PROJECT_SOURCE_DIR}/basestruct) #add_library(dlmlog SHARED # log.cpp diff --git a/log/log.cpp b/log/log.cpp index 004f376..1b94580 100644 --- a/log/log.cpp +++ b/log/log.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 "log.h" static int s_logLevel = QtDebugMsg; @@ -61,12 +62,12 @@ quint64 GetDiskFreeSpace() storage.refresh(); //获得最新磁盘信息 if (storage.isReadOnly()) - qDebug() << "isReadOnly:" << storage.isReadOnly(); + qCDebug(serviceLog) << "isReadOnly:" << storage.isReadOnly(); else { - qDebug() << "name:" << storage.name(); - qDebug() << "fileSystemType:" << storage.fileSystemType(); - qDebug() << "size:" << storage.bytesTotal() / 1000 / 1000 << "MB"; - qDebug() << "availableSize:" << storage.bytesAvailable() / 1000 / 1000 << "MB"; + qCDebug(serviceLog) << "name:" << storage.name(); + qCDebug(serviceLog) << "fileSystemType:" << storage.fileSystemType(); + qCDebug(serviceLog) << "size:" << storage.bytesTotal() / 1000 / 1000 << "MB"; + qCDebug(serviceLog) << "availableSize:" << storage.bytesAvailable() / 1000 / 1000 << "MB"; } return (quint64)storage.bytesAvailable(); } diff --git a/service/PolicyKitHelper.cpp b/service/PolicyKitHelper.cpp index 8fc2d62..13566ff 100755 --- a/service/PolicyKitHelper.cpp +++ b/service/PolicyKitHelper.cpp @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2022 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-only @@ -6,13 +6,14 @@ // Created by linux on 5/23/17. // +#include "ddlog.h" #include "PolicyKitHelper.h" #include bool PolicyKitHelper::checkAuthorization(const QString& actionId, const QString& appBusName) { if (appBusName.isEmpty()) { - qWarning() << "Empty appBusName provided for authorization check"; + qCWarning(serviceLog) << "Empty appBusName provided for authorization check"; return false; } @@ -20,22 +21,22 @@ bool PolicyKitHelper::checkAuthorization(const QString& actionId, const QString& result = Authority::instance()->checkAuthorizationSync(actionId, SystemBusNameSubject(appBusName), Authority::AllowUserInteraction); if (result == Authority::Yes) { - qDebug() << "Authorization granted for action:" << actionId; + qCDebug(serviceLog) << "Authorization granted for action:" << actionId; return true; } else { - qWarning() << "Authorization denied for action:" << actionId; + qCWarning(serviceLog) << "Authorization denied for action:" << actionId; return false; } } PolicyKitHelper::PolicyKitHelper() { - qDebug() << "PolicyKitHelper instance created"; + qCDebug(serviceLog) << "PolicyKitHelper instance created"; } PolicyKitHelper::~PolicyKitHelper() { - qDebug() << "PolicyKitHelper instance destroyed"; + qCDebug(serviceLog) << "PolicyKitHelper instance destroyed"; }