Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 17 additions & 16 deletions application/widgets/partitiontableerrorsinfodialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
// SPDX-License-Identifier: GPL-3.0-only


#include "ddlog.h"

Check warning on line 6 in application/widgets/partitiontableerrorsinfodialog.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "ddlog.h" not found.
#include "partitiontableerrorsinfodialog.h"
#include "partitiontableerrorsinfodelegate.h"
#include "common.h"

Check warning on line 9 in application/widgets/partitiontableerrorsinfodialog.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "common.h" not found.
#include "diskhealthheaderview.h"
#include <QDebug>

Expand All @@ -24,34 +25,34 @@
: 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);
Expand Down Expand Up @@ -91,10 +92,10 @@
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"));
}

Expand Down Expand Up @@ -138,27 +139,27 @@
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.";
}


57 changes: 29 additions & 28 deletions application/widgets/removepvwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
// SPDX-License-Identifier: GPL-3.0-only


#include "ddlog.h"

Check warning on line 6 in application/widgets/removepvwidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "ddlog.h" not found.
#include "removepvwidget.h"
#include "messagebox.h"
#include "utils.h"

Check warning on line 9 in application/widgets/removepvwidget.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "utils.h" not found.
#include <QDebug>

#include <DWindowCloseButton>
Expand All @@ -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);

Expand Down Expand Up @@ -135,35 +136,35 @@
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<QString> pvStrList;
QList<PVData> 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);
Expand All @@ -179,11 +180,11 @@

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;
Expand All @@ -197,11 +198,11 @@

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;
Expand All @@ -220,11 +221,11 @@
}

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");
Expand All @@ -235,49 +236,49 @@
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");
// 剩余空间不足,移除XXX(磁盘名称)将会造成数据丢失,请先删除逻辑卷 确定
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;
}

setFixedSize(380, 222);
m_stackedWidget->setCurrentIndex(1);
DWindowCloseButton *button = findChild<DWindowCloseButton *>("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"),
Expand All @@ -286,9 +287,9 @@
QMargins(0, 0, 0, 20));
close();
} else {
qInfo() << "PV deleted successfully";
qCInfo(appLog) << "PV deleted successfully";
close();
}
qDebug() << "onPVDeleteMessage completed.";
qCDebug(appLog) << "onPVDeleteMessage completed.";
}

Loading
Loading