diff --git a/application/common.cpp b/application/common.cpp index 2da06c3..67f6c55 100644 --- a/application/common.cpp +++ b/application/common.cpp @@ -4,6 +4,7 @@ #include "common.h" +#include QIcon Common::getIcon(const QString &iconName) { @@ -12,6 +13,7 @@ QIcon Common::getIcon(const QString &iconName) int Common::getLabelAdjustHeight(const int &width, const QString &text, const QFont &font) { + qDebug() << "Calculating label height for text:" << text.left(20) << "..."; DLabel label; label.setFont(font); label.setWordWrap(true); @@ -19,5 +21,7 @@ int Common::getLabelAdjustHeight(const int &width, const QString &text, const QF label.setText(text); label.adjustSize(); - return label.height(); + int height = label.height(); + qDebug() << "Calculated label height:" << height; + return height; } diff --git a/application/cusapplication.cpp b/application/cusapplication.cpp index 22ad91e..5582a52 100644 --- a/application/cusapplication.cpp +++ b/application/cusapplication.cpp @@ -4,14 +4,18 @@ #include "cusapplication.h" +#include CusApplication::CusApplication(int &argc, char **argv) : DApplication(argc, argv) { + qDebug() << "CusApplication initialized with argc:" << argc; } void CusApplication::handleQuitAction() { + qDebug() << "Handling quit action"; emit handleQuitActionChanged(); DApplication::handleQuitAction(); + qDebug() << "Quit action handled"; } diff --git a/application/widgets/animationdialog.cpp b/application/widgets/animationdialog.cpp index 2816e43..bec9429 100644 --- a/application/widgets/animationdialog.cpp +++ b/application/widgets/animationdialog.cpp @@ -9,10 +9,13 @@ #include #include +#include AnimationDialog::AnimationDialog(QWidget *parent) : DDialog(parent) { + qDebug() << "AnimationDialog initializing..."; initUi(); + qDebug() << "AnimationDialog initialized"; } void AnimationDialog::initUi() @@ -43,6 +46,8 @@ void AnimationDialog::initUi() void AnimationDialog::setShowSpinner(bool isShow, const QString &title) { + qDebug() << "Setting spinner visibility:" << isShow << "with title:" << title; + if (isShow) { m_label->setText(title); m_spinner->show(); @@ -54,6 +59,7 @@ void AnimationDialog::setShowSpinner(bool isShow, const QString &title) void AnimationDialog::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key::Key_Escape) { + qDebug() << "Escape key pressed, ignoring event"; event->ignore(); } else { DDialog::keyPressEvent(event); diff --git a/application/widgets/centerwidget.cpp b/application/widgets/centerwidget.cpp index aad00f3..799b17d 100644 --- a/application/widgets/centerwidget.cpp +++ b/application/widgets/centerwidget.cpp @@ -17,15 +17,18 @@ CenterWidget::CenterWidget(DWidget *parent) : Dtk::Widget::DWidget(parent) { + qDebug() << "CenterWidget initializing..."; initUi(); } CenterWidget::~CenterWidget() { + qDebug() << "CenterWidget destroyed"; } void CenterWidget::HandleQuit() { + qDebug() << "Handling CenterWidget quit"; } TitleWidget *CenterWidget::getTitleWidget() @@ -35,6 +38,8 @@ TitleWidget *CenterWidget::getTitleWidget() void CenterWidget::initUi() { + qDebug() << "Initializing CenterWidget UI"; + m_titleWidget = new TitleWidget(this); QVBoxLayout *mainlayout = new QVBoxLayout; mainlayout->setContentsMargins(0, 0, 0, 0); diff --git a/application/widgets/createlvwidget.cpp b/application/widgets/createlvwidget.cpp index 68202e9..25079a7 100644 --- a/application/widgets/createlvwidget.cpp +++ b/application/widgets/createlvwidget.cpp @@ -16,9 +16,11 @@ CreateLVWidget::CreateLVWidget(QWidget *parent) : DDialog(parent) { + qDebug() << "CreateLVWidget initializing..."; initUi(); recPartitionInfo(); initConnection(); + qDebug() << "CreateLVWidget initialized for VG:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName; } void CreateLVWidget::initUi() @@ -402,7 +404,7 @@ void CreateLVWidget::partInfoShowing() void CreateLVWidget::recPartitionInfo() { - //获取数据 + qDebug() << "Loading partition info for current VG"; m_lstLVName.clear(); if (DMDbusHandler::VOLUMEGROUP == DMDbusHandler::instance()->getCurLevel()) { VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); @@ -920,6 +922,8 @@ void CreateLVWidget::onAddPartition() void CreateLVWidget::onRemovePartition() { + qDebug() << "Removing last LV from creation list"; + if (m_patrinfo.size() > 0) m_patrinfo.pop_back(); @@ -942,6 +946,8 @@ void CreateLVWidget::onRemovePartition() void CreateLVWidget::onApplyButton() { + qDebug() << "Applying LV creation for VG:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName; + QList lstLVInfo; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); QString userName = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); @@ -980,6 +986,7 @@ void CreateLVWidget::onApplyButton() } if (lstLVInfo.size() > 0) { + qDebug() << "Creating" << lstLVInfo.size() << "logical volumes on VG:" << vgInfo.m_vgName; DMDbusHandler::instance()->createLV(vgInfo.m_vgName, lstLVInfo); close(); } @@ -987,6 +994,8 @@ void CreateLVWidget::onApplyButton() void CreateLVWidget::onRevertButton() { + qDebug() << "Reverting all LV creation changes"; + //复原,即清空 m_patrinfo.clear(); m_sizeInfo.clear(); @@ -1019,6 +1028,8 @@ void CreateLVWidget::onRevertButton() void CreateLVWidget::onCancelButton() { + qDebug() << "Canceling LV creation dialog"; + close(); } diff --git a/application/widgets/createpartitiontabledialog.cpp b/application/widgets/createpartitiontabledialog.cpp index 16f3c3c..2be5320 100644 --- a/application/widgets/createpartitiontabledialog.cpp +++ b/application/widgets/createpartitiontabledialog.cpp @@ -17,8 +17,10 @@ CreatePartitionTableDialog::CreatePartitionTableDialog(QWidget *parent) : DDBase(parent) { + qDebug() << "CreatePartitionTableDialog initializing..."; initUi(); initConnection(); + qDebug() << "CreatePartitionTableDialog initialized"; } void CreatePartitionTableDialog::initUi() @@ -35,6 +37,7 @@ void CreatePartitionTableDialog::initUi() getButton(index)->setAccessibleName("cancel"); DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); + qDebug() << "Current device info - path:" << info.m_path << "type:" << info.m_disktype; if (info.m_disktype == "unrecognized") { m_curType = "create"; // 当前磁盘无分区表,是否新建分区表? @@ -60,6 +63,7 @@ void CreatePartitionTableDialog::onButtonClicked(int index, const QString &text) { Q_UNUSED(text); if (index == m_okCode) { + qDebug() << "User confirmed partition table operation, type:" << m_curType; DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); DMDbusHandler::instance()->createPartitionTable(info.m_path, QString("%1").arg(info.m_length), QString("%1").arg(info.m_sectorSize), m_ComboBox->currentText(), m_curType); close(); diff --git a/application/widgets/createvgwidget.cpp b/application/widgets/createvgwidget.cpp index 2f4926e..18a526c 100644 --- a/application/widgets/createvgwidget.cpp +++ b/application/widgets/createvgwidget.cpp @@ -19,9 +19,11 @@ CreateVGWidget::CreateVGWidget(int operationType, QWidget *parent) : DDBase(parent) , m_curOperationType(operationType) { + qDebug() << "CreateVGWidget initialized with operationType:" << operationType; initUi(); initConnection(); updateData(); + qDebug() << "CreateVGWidget initialization completed"; } void CreateVGWidget::initUi() @@ -752,19 +754,26 @@ set CreateVGWidget::getCurSelectPVData() void CreateVGWidget::onNextButtonClicked() { + qDebug() << "Next button clicked, switching to step 2"; m_stackedWidget->setCurrentIndex(1); updateSelectedData(); + qDebug() << "Step 2 UI updated with selected data"; } void CreateVGWidget::onPreviousButtonClicked() { + qDebug() << "Previous button clicked, switching back to step 1"; m_stackedWidget->setCurrentIndex(0); updateData(); + qDebug() << "Step 1 UI refreshed"; } void CreateVGWidget::onDoneButtonClicked() { + qDebug() << "Done button clicked, starting VG operation"; + if (m_selectSpaceStackedWidget->currentIndex() == 0) { + qDebug() << "Validating VG size input..."; double curSize = QString::number(m_selectSpaceLineEdit->text().toDouble(), 'f', 2).toDouble(); double minSize = QString::number(m_minSize, 'f', 2).toDouble(); double maxSize = QString::number(m_maxSize, 'f', 2).toDouble(); @@ -846,6 +855,7 @@ void CreateVGWidget::onDoneButtonClicked() DMDbusHandler::instance()->resizeVG(vgName, pvDataList, m_curSize); } else { + qInfo() << "Creating new VG:" << vgName << "with" << pvDataList.size() << "PVs"; DMDbusHandler::instance()->createVG(vgName, pvDataList, m_curSize); } @@ -2056,7 +2066,7 @@ void CreateVGWidget::onTextChanged(const QString &text) void CreateVGWidget::onVGCreateMessage(const QString &vgMessage) { - qDebug() << vgMessage; + qDebug() << "Received VG create message:" << vgMessage; if (m_waterLoadingWidget != nullptr) { m_waterLoadingWidget->stopTimer(); } @@ -2068,6 +2078,7 @@ void CreateVGWidget::onVGCreateMessage(const QString &vgMessage) } if (infoList.at(0) == "0") { + qWarning() << "VG operation failed with error code:" << infoList.at(1); QString text = ""; switch (infoList.at(1).toInt()) { case LVMError::LVM_ERR_VG_ALREADY_EXISTS: { @@ -2094,11 +2105,14 @@ void CreateVGWidget::onVGCreateMessage(const QString &vgMessage) } } + qDebug() << "Closing CreateVGWidget"; close(); } void CreateVGWidget::onUpdateUsb() { + qDebug() << "USB device status changed, checking for updates..."; + QStringList deviceNameList = DMDbusHandler::instance()->getDeviceNameList(); if (m_curDeviceNameList == deviceNameList) { return; @@ -2135,6 +2149,7 @@ void CreateVGWidget::onUpdateUsb() tr("Refreshing the page to reload disks")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); + qDebug() << "Refreshing disk selection UI due to USB change"; updateData(); } else if (m_stackedWidget->currentIndex() == 1) { if (!deleteIndexList.isEmpty()) { @@ -2142,6 +2157,7 @@ void CreateVGWidget::onUpdateUsb() tr("Refreshing the page to reload disks")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); + qDebug() << "Refreshing selected data UI due to USB change"; updateSelectedData(); } } diff --git a/application/widgets/customcontrol/buttonlabel.cpp b/application/widgets/customcontrol/buttonlabel.cpp index e5f3b8d..9a018cd 100644 --- a/application/widgets/customcontrol/buttonlabel.cpp +++ b/application/widgets/customcontrol/buttonlabel.cpp @@ -3,15 +3,19 @@ // SPDX-License-Identifier: GPL-3.0-only #include "buttonlabel.h" +#include + ButtonLabel::ButtonLabel(QWidget *parent) : QLabel(parent) { - + qDebug() << "ButtonLabel created"; } void ButtonLabel::mousePressEvent(QMouseEvent *event) { + qDebug() << "ButtonLabel clicked"; Q_UNUSED(event); emit clicked(); + qDebug() << "ButtonLabel click signal emitted"; } diff --git a/application/widgets/customcontrol/ddbase.cpp b/application/widgets/customcontrol/ddbase.cpp index 6fdb846..1fe9d8b 100644 --- a/application/widgets/customcontrol/ddbase.cpp +++ b/application/widgets/customcontrol/ddbase.cpp @@ -10,6 +10,7 @@ DDBase::DDBase(QWidget *parent) : DDialog(parent) { + qDebug() << "Creating base dialog"; setModal(true); setIcon(QIcon::fromTheme(appName)); @@ -18,14 +19,17 @@ DDBase::DDBase(QWidget *parent) m_mainFrame->setFrameStyle(DFrame::NoFrame); addContent(m_mainFrame); + qDebug() << "Base dialog initialized with main frame"; // updateGeometry(); } void DDBase::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key::Key_Escape) { + qDebug() << "Ignoring Escape key press"; event->ignore(); } else { + qDebug() << "Forwarding key press to base class"; DDialog::keyPressEvent(event); } } diff --git a/application/widgets/customcontrol/dmdiskinfobox.cpp b/application/widgets/customcontrol/dmdiskinfobox.cpp index acfae8c..243d8a1 100644 --- a/application/widgets/customcontrol/dmdiskinfobox.cpp +++ b/application/widgets/customcontrol/dmdiskinfobox.cpp @@ -29,41 +29,52 @@ DmDiskinfoBox::DmDiskinfoBox(int level, QObject *parent, QString diskPath, QStri { m_childs.clear(); m_id = 0; + qDebug() << "DmDiskinfoBox initialized"; } DmDiskinfoBox::DmDiskinfoBox(QObject *parent) : QObject(parent) { + qDebug() << "Creating empty DmDiskinfoBox"; m_id = 0; m_level = 0; m_flag = 0; + qDebug() << "Empty DmDiskinfoBox initialized"; } DmDiskinfoBox::~DmDiskinfoBox() { + qDebug() << "Destroying DmDiskinfoBox, child count:" << m_childs.count(); for (int i = 0; i < m_childs.length(); i++) { if (m_childs.at(i) != nullptr) { + qDebug() << "Deleting child item:" << i; delete m_childs.at(i); } } m_childs.clear(); + qDebug() << "DmDiskinfoBox destroyed"; } int DmDiskinfoBox::addChild(DmDiskinfoBox *child) { + qDebug() << "Adding child, current level:" << m_level + << "child id:" << child->m_id; child->m_level = m_level + 1; foreach (DmDiskinfoBox *item, m_childs) { if (item->m_id == child->m_id) { + qDebug() << "Replacing existing child with same id"; m_childs.removeOne(item); delete item; } } m_childs.append(child); + qDebug() << "Child added, new child count:" << m_childs.count(); return 0; } int DmDiskinfoBox::childCount() { + qDebug() << "Getting child count:" << m_childs.count(); return m_childs.count(); } diff --git a/application/widgets/customcontrol/dmframewidget.cpp b/application/widgets/customcontrol/dmframewidget.cpp index c7d57b2..2239689 100644 --- a/application/widgets/customcontrol/dmframewidget.cpp +++ b/application/widgets/customcontrol/dmframewidget.cpp @@ -21,6 +21,7 @@ DmFrameWidget::DmFrameWidget(DiskInfoData data, QWidget *parent) : DFrame(parent) , m_infoData(data) { + qDebug() << "DmFrameWidget constructor"; #if QT_VERSION_MAJOR > 5 m_parentPb = DGuiApplicationHelper::instance()->applicationPalette(); connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, @@ -30,10 +31,12 @@ DmFrameWidget::DmFrameWidget(DiskInfoData data, QWidget *parent) connect(DApplicationHelper::instance(), &DApplicationHelper::themeTypeChanged, this, &DmFrameWidget::onHandleChangeTheme); #endif + qDebug() << "DmFrameWidget initialized"; } void DmFrameWidget::setFrameData() { + qDebug() << "Setting frame data, current level:" << DMDbusHandler::instance()->getCurLevel(); if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { //获取首页相关硬盘数据 PartitionInfo data = DMDbusHandler::instance()->getCurPartititonInfo(); @@ -96,11 +99,14 @@ void DmFrameWidget::setFrameData() } } update(); + qDebug() << "Frame data updated, mountpoints:" << m_infoData.m_mountpoints + << "size:" << m_infoData.m_partitionSize; } void DmFrameWidget::setDiskFrameData(const QString &path, const QString &diskType, const QString &used, const QString &unused, const QString &capacity, const QString &interface) { + qDebug() << "Setting disk frame data, path:" << path << "type:" << diskType; m_infoData.m_mountpoints = path; m_infoData.m_unused = unused; m_infoData.m_used = used; @@ -109,6 +115,7 @@ void DmFrameWidget::setDiskFrameData(const QString &path, const QString &diskTyp m_infoData.m_sysLabel = interface; update(); + qDebug() << "Disk frame data updated"; } QString DmFrameWidget::diskVolumn(QString partitionPath) @@ -317,7 +324,9 @@ void DmFrameWidget::resizeEvent(QResizeEvent *event) } void DmFrameWidget::onHandleChangeTheme() { + qDebug() << "Handling theme change"; m_parentPb = Dtk::Gui::DGuiApplicationHelper::instance()->applicationPalette(); + qDebug() << "Theme palette updated"; } //QString DmFrameWidget::diffMountpoints(int width, QString mountpoints) diff --git a/application/widgets/customcontrol/dmtreeview.cpp b/application/widgets/customcontrol/dmtreeview.cpp index 117ceba..7be8b3c 100644 --- a/application/widgets/customcontrol/dmtreeview.cpp +++ b/application/widgets/customcontrol/dmtreeview.cpp @@ -10,9 +10,11 @@ DmTreeview::DmTreeview(QWidget *parent) : DTreeView(parent) { + qDebug() << "DmTreeview constructor"; initUI(); initModel(); initDelegate(); + qDebug() << "DmTreeview initialized"; } void DmTreeview::initUI() @@ -31,6 +33,7 @@ void DmTreeview::initUI() QStandardItem *DmTreeview::addItem(QStandardItem *item, const DiskInfoData &data, int flag) { + qDebug() << "Adding item, level:" << data.m_level << "path:" << data.m_diskPath; if (data.m_level == DMDbusHandler::DISK || data.m_level == DMDbusHandler::VOLUMEGROUP) { QStandardItem *standardItem = new QStandardItem(); standardItem->setAccessibleDescription(data.m_diskPath); @@ -52,10 +55,12 @@ QStandardItem *DmTreeview::addItem(QStandardItem *item, const DiskInfoData &data QStandardItem *DmTreeview::addTopItem(const DiskInfoData &data) { + qDebug() << "Adding top item, path:" << data.m_diskPath; QStandardItem *item = new QStandardItem; item->setAccessibleDescription(data.m_diskPath); item->setData(QVariant::fromValue(data), Qt::UserRole + 1); m_model->appendRow(item); + qDebug() << "Top item added successfully"; return item; } @@ -97,6 +102,7 @@ void DmTreeview::currentChanged(const QModelIndex ¤t, const QModelIndex &p qDebug() << data.m_diskPath << data.m_diskSize << data.m_partitionSize << data.m_partitionPath << data.m_level << data.m_used << data.m_unused << data.m_start << data.m_end << data.m_fstype << data.m_mountpoints << data.m_sysLabel; if (data.m_level == DMDbusHandler::OTHER) { + qDebug() << "Ignoring OTHER level item"; return; } @@ -104,10 +110,13 @@ void DmTreeview::currentChanged(const QModelIndex ¤t, const QModelIndex &p m_diskNum = current.parent().row(); m_groupNum = current.parent().parent().row(); + qDebug() << "Selection position - curNum:" << m_curNum << "diskNum:" << m_diskNum << "groupNum:" << m_groupNum; + emit selectItem(current); emit curSelectChanged(data.m_diskPath, data.m_partitionPath, data.m_start, data.m_end, data.m_level); m_diskSize = data.m_diskSize; + qDebug() << "Current change handled, disk size:" << m_diskSize; } void DmTreeview::mousePressEvent(QMouseEvent *event) diff --git a/application/widgets/customcontrol/dmtreeviewdelegate.cpp b/application/widgets/customcontrol/dmtreeviewdelegate.cpp index e68ae0f..c4a890f 100644 --- a/application/widgets/customcontrol/dmtreeviewdelegate.cpp +++ b/application/widgets/customcontrol/dmtreeviewdelegate.cpp @@ -17,6 +17,7 @@ DmTreeviewDelegate::DmTreeviewDelegate(QAbstractItemView *parent) : DStyledItemDelegate(parent) , m_parentView(parent) { + qDebug() << "DmTreeviewDelegate constructor"; #if QT_VERSION_MAJOR > 5 m_parentPb = m_parentView->palette(); connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, @@ -27,6 +28,7 @@ DmTreeviewDelegate::DmTreeviewDelegate(QAbstractItemView *parent) &DmTreeviewDelegate::onHandleChangeTheme); #endif onHandleChangeTheme(); + qDebug() << "DmTreeviewDelegate initialized"; } QSize DmTreeviewDelegate::sizeHint(const QStyleOptionViewItem &option, @@ -35,18 +37,23 @@ QSize DmTreeviewDelegate::sizeHint(const QStyleOptionViewItem &option, Q_UNUSED(option); DiskInfoData infoData = index.data(Qt::UserRole + 1).value(); + qDebug() << "Calculating size hint for item level:" << infoData.m_level; + int height = 55; if (infoData.m_level == DMDbusHandler::DISK || infoData.m_level == DMDbusHandler::VOLUMEGROUP) { height = 72 + static_cast((QApplication::font().pointSizeF() / 0.75 - 14) * 1); + qDebug() << "Disk/VG item size:" << QSize(180, height); return QSize(180, height); } if (infoData.m_level == DMDbusHandler::OTHER) { height = 30 + static_cast((QApplication::font().pointSizeF() / 0.75 - 14) * 1); + qDebug() << "Other item size:" << QSize(180, height); return QSize(180, height); } height = 55 + static_cast((QApplication::font().pointSizeF() / 0.75 - 14) * 1); + qDebug() << "Default item size:" << QSize(180, height); return QSize(180, height); } @@ -326,6 +333,8 @@ void DmTreeviewDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op } void DmTreeviewDelegate::onHandleChangeTheme() { + qDebug() << "Handling theme change"; m_parentPb = Dtk::Gui::DGuiApplicationHelper::instance()->applicationPalette(); m_parentView->update(m_parentView->currentIndex()); + qDebug() << "Theme updated and view refreshed"; } diff --git a/application/widgets/customcontrol/infotopframe.cpp b/application/widgets/customcontrol/infotopframe.cpp index bd802e3..62845c8 100644 --- a/application/widgets/customcontrol/infotopframe.cpp +++ b/application/widgets/customcontrol/infotopframe.cpp @@ -16,6 +16,7 @@ InfoTopFrame::InfoTopFrame(DWidget *parent) : DFrame(parent) { + qDebug() << "InfoTopFrame constructor"; setFixedHeight(110); setBackgroundRole(DPalette::ItemBackground); @@ -42,6 +43,7 @@ InfoTopFrame::InfoTopFrame(DWidget *parent) m_mainLayout->addStretch(); initRightInfo(); + qDebug() << "InfoTopFrame initialized"; } void InfoTopFrame::initRightInfo() @@ -91,6 +93,8 @@ void InfoTopFrame::initLeftInfo() void InfoTopFrame::updateDiskInfo() { + qDebug() << "Updating disk info for level:" + << DMDbusHandler::instance()->getCurLevel(); if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { auto info = DMDbusHandler::instance()->getCurPartititonInfo(); @@ -205,6 +209,7 @@ void InfoTopFrame::updateDiskInfo() if (luksInfo.isDecrypt) { fstypeName = DMDbusHandler::instance()->getEncryptionFsType(luksInfo); } + qDebug() << "Disk info updated successfully"; } m_typeLabel->setText(tr("File system") + ": " + fstypeName); } diff --git a/application/widgets/customcontrol/partchartshowing.cpp b/application/widgets/customcontrol/partchartshowing.cpp index cde7a6e..10a4aef 100644 --- a/application/widgets/customcontrol/partchartshowing.cpp +++ b/application/widgets/customcontrol/partchartshowing.cpp @@ -18,6 +18,7 @@ PartChartShowing::PartChartShowing(QWidget *parent) : QWidget(parent) { + qDebug() << "PartChartShowing constructor"; QColor color("#70BEFF"); //浅蓝色 QColor color1("#4293FF"); //深蓝色 QColor color2("#6751E4"); //紫色 @@ -28,26 +29,34 @@ PartChartShowing::PartChartShowing(QWidget *parent) setMouseTracking(true); m_showTipTimer = new QTimer(this); connect(m_showTipTimer, &QTimer::timeout, this, &PartChartShowing::showTipTimerSlot); + qDebug() << "PartChartShowing initialized with colors and mouse tracking"; } void PartChartShowing::transInfos(const double &totals, const QVector sizeInfo) { + qDebug() << "Transferring partition info, total size:" << totals + << "partition count:" << sizeInfo.size(); m_total = totals; m_partSize = sizeInfo; + qDebug() << "Partition info updated"; } void PartChartShowing::transFlag(int flag, int value) { + qDebug() << "Transferring flag:" << flag << "value:" << value; m_flag = flag; m_sumValue = value; update(); + qDebug() << "Flag updated and widget refreshed"; } void PartChartShowing::showTipTimerSlot() { - // qDebug() << hover; + qDebug() << "Showing tooltip for hover state:" << m_hover + << "partition:" << m_number2 << "at position:" << m_posX; emit sendMoveFlag(m_hover, m_number2, m_posX); m_showTipTimer->stop(); + qDebug() << "Tooltip shown and timer stopped"; } void PartChartShowing::paintEvent(QPaintEvent *event) @@ -319,6 +328,7 @@ void PartChartShowing::addPaint(QPainter *painter) void PartChartShowing::mousePressEvent(QMouseEvent *event) { if (event->button() != Qt::LeftButton) { + qDebug() << "Ignoring non-left mouse button press"; return; } diff --git a/application/widgets/customcontrol/partitioninfowidget.cpp b/application/widgets/customcontrol/partitioninfowidget.cpp index 55a6aa1..5f8f4bb 100644 --- a/application/widgets/customcontrol/partitioninfowidget.cpp +++ b/application/widgets/customcontrol/partitioninfowidget.cpp @@ -12,6 +12,7 @@ PartitionInfoWidget::PartitionInfoWidget(QWidget *parent) : QWidget(parent) { + qDebug() << "PartitionInfoWidget constructor"; QColor color("#70BEFF"); //浅蓝色 QColor color1("#4293FF"); //蓝色 QColor color2("#6751E4"); //紫色 @@ -25,10 +26,12 @@ PartitionInfoWidget::PartitionInfoWidget(QWidget *parent) : QWidget(parent) m_colorInfo = QVector {color, color1, color2, color3, color4, color5, color6, color7, color8, color9}; setMouseTracking(true); + qDebug() << "PartitionInfoWidget initialized with colors and mouse tracking"; } void PartitionInfoWidget::setData(DeviceInfo info) { + qDebug() << "Setting partition data, partition count:" << info.m_partition.size(); m_sizeInfo.clear(); m_pathInfo.clear(); m_totalSize = 0.00; @@ -45,11 +48,13 @@ void PartitionInfoWidget::setData(DeviceInfo info) m_totalSize += Utils::sectorToUnit(info.m_length, info.m_sectorSize, SIZE_UNIT::UNIT_GIB); if (info.m_partition.isEmpty()) { + qDebug() << "No partitions found, adding unallocated space"; m_sizeInfo.append(m_totalSize); m_pathInfo.append("unallocated"); } update(); + qDebug() << "Partition data set, total size:" << m_totalSize << "GiB"; } void PartitionInfoWidget::paintEvent(QPaintEvent *event) @@ -269,7 +274,9 @@ void PartitionInfoWidget::mouseMoveEvent(QMouseEvent *event) void PartitionInfoWidget::onHandleChangeTheme() { + qDebug() << "Handling theme change"; m_parentPb = Dtk::Gui::DGuiApplicationHelper::instance()->applicationPalette(); + qDebug() << "Theme palette updated"; } void PartitionInfoWidget::leaveEvent(QEvent *event) diff --git a/application/widgets/customcontrol/partitionwidget.cpp b/application/widgets/customcontrol/partitionwidget.cpp index 668b26c..ce127f4 100644 --- a/application/widgets/customcontrol/partitionwidget.cpp +++ b/application/widgets/customcontrol/partitionwidget.cpp @@ -16,13 +16,16 @@ PartitionWidget::PartitionWidget(QWidget *parent) : DDialog(parent) { + qDebug() << "PartitionWidget constructor"; // setAttribute(Qt::WA_DeleteOnClose, true); initUi(); recPartitionInfo(); initConnection(); + qDebug() << "PartitionWidget initialized"; } PartitionWidget::~PartitionWidget() { + qDebug() << "PartitionWidget destructor"; } void PartitionWidget::initUi() { @@ -867,6 +870,7 @@ void PartitionWidget::onSetPartName() void PartitionWidget::onAddPartition() { + qDebug() << "Adding new partition"; DeviceInfo device = DMDbusHandler::instance()->getCurDeviceInfo(); int partitionCount = 0; @@ -878,6 +882,7 @@ void PartitionWidget::onAddPartition() } if (m_sizeInfo.size() >= 24 || maxAmountPrimReached() == true || (partitionCount + m_sizeInfo.size()) >= device.m_maxPrims) { + qDebug() << "Partition limit exceeded"; DMessageManager::instance()->sendMessage(this, QIcon(":/icons/deepin/builtin/warning.svg"), tr("The number of new partitions exceeds the limit")); return; } @@ -982,6 +987,7 @@ void PartitionWidget::onAddPartition() void PartitionWidget::onRemovePartition() { + qDebug() << "Removing partition, current count:" << m_patrinfo.size(); if (m_patrinfo.size() > 0) m_patrinfo.pop_back(); @@ -1126,6 +1132,7 @@ void PartitionWidget::onApplyButton() void PartitionWidget::onRevertButton() { + qDebug() << "Reverting all changes"; //复原,即清空 m_patrinfo.clear(); m_sizeInfo.clear(); @@ -1146,10 +1153,12 @@ void PartitionWidget::onRevertButton() setSelectUnallocatesSpace(); m_partChartWidget->transFlag(1, 0); setEnable(1, true); + qDebug() << "All changes reverted"; } void PartitionWidget::onCancelButton() { + qDebug() << "Canceling partition operation"; close(); } diff --git a/application/widgets/customcontrol/passwordinputdialog.cpp b/application/widgets/customcontrol/passwordinputdialog.cpp index a4952c9..3fdcb31 100644 --- a/application/widgets/customcontrol/passwordinputdialog.cpp +++ b/application/widgets/customcontrol/passwordinputdialog.cpp @@ -176,6 +176,7 @@ QString PasswordInputDialog::getPasswordHint() void PasswordInputDialog::onInputPasswordEditTextChanged(const QString &) { + qDebug() << "Password input changed, length:" << m_inputPasswordEdit->text().length(); if (m_inputPasswordEdit->isAlert() && m_inputPasswordEdit->text().length() <= 256) { m_inputPasswordEdit->setAlert(false); m_inputPasswordEdit->hideAlertMessage(); @@ -190,6 +191,7 @@ void PasswordInputDialog::onInputPasswordEditTextChanged(const QString &) void PasswordInputDialog::onCheckPasswordEditTextChanged(const QString &) { + qDebug() << "Password confirmation changed, length:" << m_checkPasswordEdit->text().length(); if (m_checkPasswordEdit->isAlert() && m_checkPasswordEdit->text().length() <= 256) { m_checkPasswordEdit->setAlert(false); m_checkPasswordEdit->hideAlertMessage(); @@ -222,6 +224,7 @@ void PasswordInputDialog::onButtonClicked(int index, const QString &text) { Q_UNUSED(text); if (index == m_okCode) { + qDebug() << "Confirm button clicked, validating password"; // 密码不能为空 if (m_inputPasswordEdit->text().isEmpty()) { m_inputPasswordEdit->setAlert(true); @@ -237,12 +240,14 @@ void PasswordInputDialog::onButtonClicked(int index, const QString &text) } // 密码不一致 + qDebug() << "Checking password match"; if (m_inputPasswordEdit->text() != m_checkPasswordEdit->text()) { m_checkPasswordEdit->setAlert(true); m_checkPasswordEdit->showAlertMessage(tr("Passwords do not match")); return; } + qDebug() << "Checking password hint difference"; if (m_inputPasswordEdit->text() == m_textEdit->toPlainText()) { // 提示内容不得与密码相同 DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), @@ -251,8 +256,10 @@ void PasswordInputDialog::onButtonClicked(int index, const QString &text) return; } + qDebug() << "Password validation passed"; accept(); } else { + qDebug() << "Dialog rejected"; reject(); } } diff --git a/application/widgets/customcontrol/radiuswidget.cpp b/application/widgets/customcontrol/radiuswidget.cpp index 8d3427b..1d53c97 100644 --- a/application/widgets/customcontrol/radiuswidget.cpp +++ b/application/widgets/customcontrol/radiuswidget.cpp @@ -17,6 +17,10 @@ RadiusWidget::RadiusWidget(QWidget *parent) : QWidget(parent) void RadiusWidget::setMode(bool leftTop, bool leftBottom, bool rightTop, bool rightBottom) { + qDebug() << "Setting corner modes - LT:" << leftTop + << " LB:" << leftBottom + << " RT:" << rightTop + << " RB:" << rightBottom; m_leftTop = leftTop; m_leftBottom = leftBottom; m_rightTop = rightTop; @@ -25,6 +29,7 @@ void RadiusWidget::setMode(bool leftTop, bool leftBottom, bool rightTop, bool ri void RadiusWidget::setChecked(bool isChecked) { + qDebug() << "Setting checked state:" << isChecked; m_isChecked = isChecked; update(); } diff --git a/application/widgets/customcontrol/selecteditemwidget.cpp b/application/widgets/customcontrol/selecteditemwidget.cpp index 40ef5ad..01c66c6 100644 --- a/application/widgets/customcontrol/selecteditemwidget.cpp +++ b/application/widgets/customcontrol/selecteditemwidget.cpp @@ -15,6 +15,8 @@ SelectedItemWidget::SelectedItemWidget(PVInfoData pvInfoData, QWidget *parent) : RadiusWidget(parent) , m_pvInfoData(pvInfoData) { + qDebug() << "Creating selected item for:" + << (m_pvInfoData.m_disktype == "unrecognized" ? m_pvInfoData.m_diskPath : m_pvInfoData.m_partitionPath); initUi(); initConnection(); } @@ -60,12 +62,15 @@ void SelectedItemWidget::initUi() m_iconButton->setFixedSize(17, 17); if (m_pvInfoData.m_disktype == "unrecognized") { + qDebug() << "Setting unrecognized disk info:" << m_pvInfoData.m_diskPath << m_pvInfoData.m_diskSize; m_nameInfo->setText(m_pvInfoData.m_diskPath); m_sizeInfo->setText(m_pvInfoData.m_diskSize); } else { if (m_pvInfoData.m_partitionPath == "unallocated") { + qDebug() << "Setting unallocated partition info:" << m_pvInfoData.m_diskPath; m_nameInfo->setText(m_pvInfoData.m_diskPath); } else { + qDebug() << "Setting partition info:" << m_pvInfoData.m_partitionPath << m_pvInfoData.m_partitionSize; m_nameInfo->setText(m_pvInfoData.m_partitionPath); } @@ -95,6 +100,8 @@ void SelectedItemWidget::initConnection() void SelectedItemWidget::onDeleteClicked() { + qDebug() << "Delete clicked for:" + << (m_pvInfoData.m_disktype == "unrecognized" ? m_pvInfoData.m_diskPath : m_pvInfoData.m_partitionPath); emit deleteItem(m_pvInfoData); } diff --git a/application/widgets/customcontrol/selectpvitemwidget.cpp b/application/widgets/customcontrol/selectpvitemwidget.cpp index f391d16..b8bafe1 100644 --- a/application/widgets/customcontrol/selectpvitemwidget.cpp +++ b/application/widgets/customcontrol/selectpvitemwidget.cpp @@ -15,6 +15,7 @@ SelectPVItemWidget::SelectPVItemWidget(PVInfoData pvInfoData, QWidget *parent) : RadiusWidget(parent) , m_pvInfoData(pvInfoData) { + qDebug() << "Creating PV select item for:" << pvInfoData.m_diskPath << pvInfoData.m_partitionPath; initUi(); initConnection(); initData(); @@ -122,6 +123,7 @@ void SelectPVItemWidget::initData() void SelectPVItemWidget::onCheckBoxStateChange(int state) { + qDebug() << "Checkbox state changed to:" << state << "for:" << m_pvInfoData.m_diskPath << m_pvInfoData.m_partitionPath; if (m_pvInfoData.m_level == DMDbusHandler::DISK) { if (state != Qt::CheckState::PartiallyChecked) { if (m_lstPVInfoData.count() != 0) { @@ -150,6 +152,7 @@ void SelectPVItemWidget::onCheckBoxStateChange(int state) void SelectPVItemWidget::setCheckBoxState(Qt::CheckState state, bool isPartiallyChecked) { + qDebug() << "Setting checkbox state:" << state << "isPartially:" << isPartiallyChecked; if(isPartiallyChecked){ m_pvInfoData.m_selectStatus = state; m_checkBox->setCheckState(state); diff --git a/application/widgets/customcontrol/sizeinfowidget.cpp b/application/widgets/customcontrol/sizeinfowidget.cpp index 64ba583..246d404 100644 --- a/application/widgets/customcontrol/sizeinfowidget.cpp +++ b/application/widgets/customcontrol/sizeinfowidget.cpp @@ -13,6 +13,7 @@ SizeInfoWidget::SizeInfoWidget(QWidget *parent) : QWidget(parent) { + qDebug() << "SizeInfoWidget constructor"; #if QT_VERSION_MAJOR > 5 m_parentPb = DGuiApplicationHelper::instance()->applicationPalette();; connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, @@ -29,6 +30,7 @@ SizeInfoWidget::SizeInfoWidget(double used, double unused, bool flag, QWidget *p , m_noused(unused) , m_flag(flag) { + qDebug() << "SizeInfoWidget constructor with data, used:" << used << "GiB, unused:" << unused << "GiB"; #if QT_VERSION_MAJOR > 5 m_parentPb = DGuiApplicationHelper::instance()->applicationPalette();; connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, @@ -42,6 +44,7 @@ SizeInfoWidget::SizeInfoWidget(double used, double unused, bool flag, QWidget *p void SizeInfoWidget::setData(PartitionInfo info, QVector color, QVector size, bool flag) { + qDebug() << "Setting partition data, path:" << info.m_path << "size:" << size; m_sizeInfo = size; m_colorInfo = color; m_flag = flag; @@ -75,10 +78,12 @@ void SizeInfoWidget::setData(PartitionInfo info, QVector color, QVector< } update(); + qDebug() << "Partition data set, total:" << m_totalSize << "GiB, used:" << m_used << "GiB"; } void SizeInfoWidget::setData(LVInfo info, QVector color, QVector size, bool flag) { + qDebug() << "Setting LV data, name:" << info.m_lvName << "size:" << size; m_sizeInfo = size; m_colorInfo = color; m_flag = flag; @@ -116,10 +121,12 @@ void SizeInfoWidget::setData(LVInfo info, QVector color, QVector m_sizeInfo = QVector {0.00, 0.00}; } update(); + qDebug() << "LV data set, total:" << m_totalSize << "GiB, used:" << m_used << "GiB"; } void SizeInfoWidget::setData(DeviceInfo info, QVector color, QVector size, bool flag) { + qDebug() << "Setting device data, path:" << info.m_path << "size:" << size; m_sizeInfo = size; m_colorInfo = color; m_flag = flag; @@ -147,6 +154,7 @@ void SizeInfoWidget::setData(DeviceInfo info, QVector color, QVector {0.00, 0.00}; } update(); + qDebug() << "Device data set, total:" << m_totalSize << "GiB, used:" << m_used << "GiB"; } void SizeInfoWidget::paintEvent(QPaintEvent *event) diff --git a/application/widgets/customcontrol/vgsizeinfowidget.cpp b/application/widgets/customcontrol/vgsizeinfowidget.cpp index 287baba..d82462f 100644 --- a/application/widgets/customcontrol/vgsizeinfowidget.cpp +++ b/application/widgets/customcontrol/vgsizeinfowidget.cpp @@ -13,6 +13,7 @@ VGSizeInfoWidget::VGSizeInfoWidget(QWidget *parent) : QWidget(parent) { + qDebug() << "VGSizeInfoWidget constructor"; QColor color("#70BEFF"); //浅蓝色 QColor color1("#4293FF"); //蓝色 QColor color2("#6751E4"); //紫色 @@ -30,6 +31,7 @@ VGSizeInfoWidget::VGSizeInfoWidget(QWidget *parent) : QWidget(parent) void VGSizeInfoWidget::setData(const DeviceInfo &info) { + qDebug() << "Setting device data, partitions:" << info.m_partition.size(); m_sizeInfo.clear(); m_pathInfo.clear(); m_pathList.clear(); @@ -58,10 +60,12 @@ void VGSizeInfoWidget::setData(const DeviceInfo &info) m_totalSize += Utils::sectorToUnit(info.m_length, info.m_sectorSize, SIZE_UNIT::UNIT_GIB); update(); + qDebug() << "Device data set, total size:" << m_totalSize << "GiB"; } void VGSizeInfoWidget::setData(const VGInfo &info) { + qDebug() << "Setting VG info, LVs:" << info.m_lvlist.count(); m_sizeInfo.clear(); m_pathInfo.clear(); m_pathList.clear(); @@ -94,13 +98,16 @@ void VGSizeInfoWidget::setData(const VGInfo &info) } update(); + qDebug() << "VG info set, total size:" << m_totalSize << "GiB"; } void VGSizeInfoWidget::setData(const QVector &vglist) { if (vglist.count() == 0 ) { + qWarning() << "Empty VG data list provided"; return; } + qInfo() << "Setting VG list data, count:" << vglist.count(); m_sizeInfo.clear(); m_pathInfo.clear(); @@ -284,10 +291,12 @@ void VGSizeInfoWidget::setData(const QVector &vglist) } update(); + qDebug() << "VG list data set, total size:" << m_totalSize << "GiB"; } void VGSizeInfoWidget::setData(const VGData &vgData) { + qDebug() << "Setting single VG data, name:" << vgData.m_vgName; m_sizeInfo.clear(); m_pathInfo.clear(); m_pathList.clear(); @@ -343,6 +352,7 @@ void VGSizeInfoWidget::setData(const VGData &vgData) } update(); + qDebug() << "Single VG data set, total size:" << m_totalSize << "GiB"; } void VGSizeInfoWidget::paintEvent(QPaintEvent *event) diff --git a/application/widgets/customcontrol/waterloadingwidget.cpp b/application/widgets/customcontrol/waterloadingwidget.cpp index 2ce1e40..c13239f 100644 --- a/application/widgets/customcontrol/waterloadingwidget.cpp +++ b/application/widgets/customcontrol/waterloadingwidget.cpp @@ -12,6 +12,7 @@ WaterLoadingWidget::WaterLoadingWidget(QWidget *parent) : QWidget(parent) { + qDebug() << "WaterLoadingWidget constructor"; initUi(); initConnection(); } @@ -30,6 +31,7 @@ void WaterLoadingWidget::initUi() mainLayout->setContentsMargins(0, 0, 0, 0); setLayout(mainLayout); + qDebug() << "UI initialized"; } void WaterLoadingWidget::initConnection() @@ -54,6 +56,7 @@ void WaterLoadingWidget::onStartWaterProgress() void WaterLoadingWidget::setStartTime(int msec) { + qDebug() << "Starting water progress with interval:" << msec << "ms"; m_waterProgress->start(); m_waterProgress->setValue(1); m_time->start(msec); @@ -61,6 +64,7 @@ void WaterLoadingWidget::setStartTime(int msec) void WaterLoadingWidget::stopTimer() { + qDebug() << "Stopping water progress"; m_waterProgress->setValue(100); m_waterProgress->stop(); m_time->stop(); diff --git a/application/widgets/cylinderinfowidget.cpp b/application/widgets/cylinderinfowidget.cpp index ce2092a..da1b530 100644 --- a/application/widgets/cylinderinfowidget.cpp +++ b/application/widgets/cylinderinfowidget.cpp @@ -20,12 +20,14 @@ CylinderInfoWidget::CylinderInfoWidget(int cylNumber, QWidget *parent) : DFrame(parent) , m_cylNumber(cylNumber) { + qDebug() << "[CylinderInfoWidget] Initializing with cylinder count:" << cylNumber; initUI(); initConnections(); } void CylinderInfoWidget::initUI() { + qDebug() << "[CylinderInfoWidget] Initializing UI components"; m_gridLayout = new QGridLayout; int initCount = 360; @@ -145,6 +147,7 @@ void CylinderInfoWidget::initUI() void CylinderInfoWidget::initConnections() { + qDebug() << "[CylinderInfoWidget] Setting up signal-slot connections"; connect(m_scrollBar, &QScrollBar::valueChanged, this, &CylinderInfoWidget::onScrollBarValueChanged); } @@ -304,9 +307,13 @@ void CylinderInfoWidget::setCylinderNumber(int cylNumber) void CylinderInfoWidget::setCurCheckBadBlocksInfo(const QString &LBANumber, const QString &cylinderNumber, const QString &cylinderTimeConsuming, const QString &cylinderStatus, const QString &cylinderErrorInfo) { + qDebug() << "[CylinderInfoWidget] Updating cylinder info - LBA:" << LBANumber + << "Cylinder:" << cylinderNumber << "Status:" << cylinderStatus << "Time:" << cylinderTimeConsuming << "ms"; ++m_curCheckCount; if (cylinderStatus == "bad") { + qWarning() << "[CylinderInfoWidget] Bad sector detected - LBA:" << LBANumber + << "Cylinder:" << cylinderNumber; ++m_badSectorsCount; } @@ -371,9 +378,12 @@ void CylinderInfoWidget::setCurCheckBadBlocksInfo(const QString &LBANumber, cons void CylinderInfoWidget::updateCylinderInfo(int number, const QString &LBANumber, const QString &cylinderNumber, const QString &cylinderTimeConsuming, const QString &cylinderStatus, const QString &cylinderErrorInfo, const QString &repair) { + qDebug() << "[CylinderInfoWidget] Updating cylinder widget - Number:" << number + << "LBA:" << LBANumber << "Status:" << cylinderStatus << "Repair:" << repair; CylinderWidget *cylinderWidget = m_widget->findChild(QString("%1").arg(number)); if(cylinderWidget == nullptr) { + qWarning() << "[CylinderInfoWidget] Cylinder widget not found for number:" << number; return; } @@ -438,6 +448,7 @@ void CylinderInfoWidget::setCurRepairBadBlocksInfo(const QString &cylinderNumber void CylinderInfoWidget::enterSlot() { + qDebug() << "[CylinderInfoWidget] Mouse entered cylinder widget"; CylinderWidget *label = qobject_cast(sender()); QMap mapInfo = label->getUserData().toMap(); @@ -474,6 +485,7 @@ void CylinderInfoWidget::enterSlot() void CylinderInfoWidget::leaveSlot() { + qDebug() << "[CylinderInfoWidget] Mouse left cylinder widget"; CylinderWidget *label = qobject_cast(sender()); QMap mapInfo = label->getUserData().toMap(); if (mapInfo.isEmpty()) { diff --git a/application/widgets/cylinderwidget.cpp b/application/widgets/cylinderwidget.cpp index 6363b14..39c58ad 100644 --- a/application/widgets/cylinderwidget.cpp +++ b/application/widgets/cylinderwidget.cpp @@ -10,16 +10,18 @@ CylinderWidget::CylinderWidget(QWidget *parent) : QLabel(parent) { - + qDebug() << "[CylinderWidget] Initializing cylinder widget"; } void CylinderWidget::setUserData(const QVariant &userData) { + qDebug() << "[CylinderWidget] Setting user data"; m_userData = userData; } QVariant CylinderWidget::getUserData() { + qDebug() << "[CylinderWidget] Getting user data"; return m_userData; } diff --git a/application/widgets/decryptdialog.cpp b/application/widgets/decryptdialog.cpp index 258e4b3..a25a710 100644 --- a/application/widgets/decryptdialog.cpp +++ b/application/widgets/decryptdialog.cpp @@ -16,6 +16,7 @@ DecryptDialog::DecryptDialog(QWidget *parent) : DDBase(parent) { + qDebug() << "[DecryptDialog] Constructor initialized"; initUi(); initConnection(); initData(); @@ -23,6 +24,7 @@ DecryptDialog::DecryptDialog(QWidget *parent) void DecryptDialog::initUi() { + qDebug() << "[DecryptDialog] Initializing UI components"; m_height = 240; setFixedSize(406, m_height); @@ -180,6 +182,7 @@ void DecryptDialog::initUi() void DecryptDialog::initConnection() { + qDebug() << "[DecryptDialog] Setting up signal-slot connections"; connect(m_passwordEdit, &DPasswordEdit::textChanged, this, &DecryptDialog::onPasswordEditTextChanged); connect(m_pushButton, &DPushButton::clicked, this, &DecryptDialog::onPasswordHintButtonClicked); connect(m_decryptButton, &DSuggestButton::clicked, this, &DecryptDialog::onButtonClicked); @@ -270,6 +273,7 @@ void DecryptDialog::onCancelButtonClicked() void DecryptDialog::onButtonClicked() { + qDebug() << "[DecryptDialog] Starting decryption process for device:" << m_devPath; // 密码不能为空 if (m_passwordEdit->text().isEmpty()) { m_passwordEdit->setAlert(true); @@ -316,9 +320,12 @@ void DecryptDialog::onDecryptMessage(const LUKS_INFO &luks) QMargins(0, 0, 0, 20)); reject(); } else { + qDebug() << "[DecryptDialog] Decrypt successful for device:" << m_devPath; accept(); } } else { + qWarning() << "[DecryptDialog] Decrypt failed for device:" << m_devPath + << "Error count:" << luks.m_decryptErrCount; setFixedSize(406, m_height); m_stackedWidget->setCurrentIndex(0); DWindowCloseButton *button = findChild("DTitlebarDWindowCloseButton"); @@ -359,6 +366,7 @@ void DecryptDialog::onDecryptMessage(const LUKS_INFO &luks) void DecryptDialog::onTimeOut() { + qDebug() << "[DecryptDialog] Timer expired, resetting password input"; m_timer.stop(); setPasswordEditStatus(false, false); m_decryptButton->setDisabled(false); diff --git a/application/widgets/devicelistwidget.cpp b/application/widgets/devicelistwidget.cpp index 950cea7..ba090d3 100644 --- a/application/widgets/devicelistwidget.cpp +++ b/application/widgets/devicelistwidget.cpp @@ -25,6 +25,7 @@ DeviceListWidget::DeviceListWidget(QWidget *parent) : DWidget(parent) { + qDebug() << "[DeviceListWidget] Constructor called"; m_curChooseDevicePath = ""; setAutoFillBackground(true); @@ -36,15 +37,17 @@ DeviceListWidget::DeviceListWidget(QWidget *parent) initUi(); initConnection(); } - DeviceListWidget::~DeviceListWidget() { + qDebug() << "[DeviceListWidget] Destructor called"; // delete m_box; // delete m_childbox; } + void DeviceListWidget::initUi() { + qDebug() << "[DeviceListWidget] Initializing UI components"; QVBoxLayout *layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -56,6 +59,7 @@ void DeviceListWidget::initUi() void DeviceListWidget::initConnection() { + qDebug() << "[DeviceListWidget] Initializing signal-slot connections"; connect(DMDbusHandler::instance(), &DMDbusHandler::updateDeviceInfo, this, &DeviceListWidget::onUpdateDeviceInfo); connect(m_treeView, &DmTreeview::curSelectChanged, DMDbusHandler::instance(), &DMDbusHandler::onSetCurSelect); connect(m_treeView, &QTreeView::customContextMenuRequested, this, &DeviceListWidget::treeMenu); @@ -72,6 +76,7 @@ void DeviceListWidget::initConnection() void DeviceListWidget::treeMenu(const QPoint &pos) { + qDebug() << "[DeviceListWidget] Showing context menu at position:" << pos; QModelIndex curIndex = m_treeView->indexAt(pos); //当前点击的元素的index QModelIndex index = curIndex.sibling(curIndex.row(), 0); //该行的第1列元素的index @@ -257,6 +262,7 @@ void DeviceListWidget::treeMenu(const QPoint &pos) void DeviceListWidget::onDiskInfoClicked() { + qDebug() << "[DeviceListWidget] Showing disk info dialog for:" << m_curDiskInfoData.m_diskPath; setCurDevicePath(m_curDiskInfoData.m_diskPath); DiskInfoDisplayDialog diskInfoDisplayDialog(m_curDiskInfoData.m_diskPath, this); @@ -269,6 +275,7 @@ void DeviceListWidget::onDiskInfoClicked() void DeviceListWidget::onDiskCheckHealthClicked() { + qDebug() << "[DeviceListWidget] Disk health check clicked for:" << m_curDiskInfoData.m_diskPath; setCurDevicePath(m_curDiskInfoData.m_diskPath); HardDiskStatusInfoList hardDiskStatusInfoList = DMDbusHandler::instance()->getDeviceHardStatusInfo(m_curDiskInfoData.m_diskPath); @@ -295,6 +302,7 @@ void DeviceListWidget::onDiskCheckHealthClicked() void DeviceListWidget::onDiskBadSectorsClicked() { + qDebug() << "[DeviceListWidget] Disk bad sectors check clicked for:" << m_curDiskInfoData.m_diskPath; setCurDevicePath(m_curDiskInfoData.m_diskPath); DiskBadSectorsDialog diskBadSectorsDialog(this); @@ -307,6 +315,7 @@ void DeviceListWidget::onDiskBadSectorsClicked() void DeviceListWidget::onCreatePartitionTableClicked() { + qDebug() << "[DeviceListWidget] Create partition table requested for:" << m_curDiskInfoData.m_diskPath; setCurDevicePath(m_curDiskInfoData.m_diskPath); if (DMDbusHandler::instance()->isExistMountPartition(DMDbusHandler::instance()->getCurDeviceInfo())) { @@ -339,6 +348,7 @@ void DeviceListWidget::onCreatePartitionTableClicked() void DeviceListWidget::onPartitionErrorCheckClicked() { + qDebug() << "[DeviceListWidget] Partition table error check started for:" << m_curDiskInfoData.m_diskPath; bool result = DMDbusHandler::instance()->detectionPartitionTableError(m_curDiskInfoData.m_diskPath); if (result) { QString deviceInfo = QString("%1(%2)").arg(m_curDiskInfoData.m_diskPath).arg(m_curDiskInfoData.m_diskSize); @@ -359,6 +369,7 @@ void DeviceListWidget::onPartitionErrorCheckClicked() void DeviceListWidget::onHidePartitionClicked() { + qDebug() << "[DeviceListWidget] Hide partition clicked for:" << m_curDiskInfoData.m_diskPath; setCurDevicePath(m_curDiskInfoData.m_diskPath); MessageBox messageBox(this); @@ -391,6 +402,7 @@ void DeviceListWidget::onHidePartitionClicked() void DeviceListWidget::onShowPartitionClicked() { + qDebug() << "[DeviceListWidget] Show partition clicked for:" << m_curDiskInfoData.m_diskPath; setCurDevicePath(m_curDiskInfoData.m_diskPath); MessageBox messageBox(this); @@ -407,6 +419,7 @@ void DeviceListWidget::onShowPartitionClicked() void DeviceListWidget::onDeletePartitionClicked() { + qDebug() << "[DeviceListWidget] Delete partition requested for:" << m_curDiskInfoData.m_diskPath; setCurDevicePath(m_curDiskInfoData.m_diskPath); MessageBox messageBox(this); @@ -548,6 +561,7 @@ void DeviceListWidget::onCreatePartitionTableMessage(const bool &flag) void DeviceListWidget::onDeleteVGClicked() { + qDebug() << "[DeviceListWidget] Delete VG requested for:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); setCurVGName(vgInfo.m_vgName); if (DMDbusHandler::instance()->isExistMountLV(vgInfo)) { @@ -581,6 +595,7 @@ void DeviceListWidget::onDeleteVGClicked() void DeviceListWidget::onCreateLVClicked() { + qDebug() << "[DeviceListWidget] Create LV clicked for VG:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName; setCurVGName(DMDbusHandler::instance()->getCurVGInfo().m_vgName); PartitionDialog dlg(this); @@ -600,6 +615,7 @@ void DeviceListWidget::onCreateLVClicked() void DeviceListWidget::onDeleteLVClicked() { + qDebug() << "[DeviceListWidget] Delete LV requested for:" << DMDbusHandler::instance()->getCurLVInfo().m_lvName; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setCurVGName(lvInfo.m_vgName); @@ -634,6 +650,7 @@ void DeviceListWidget::onDeleteLVClicked() void DeviceListWidget::onVGDeleteMessage(const QString &vgMessage) { + qDebug() << "[DeviceListWidget] Delete VG result:" << vgMessage; QStringList infoList = vgMessage.split(":"); if (infoList.count() <= 1) { @@ -642,6 +659,7 @@ void DeviceListWidget::onVGDeleteMessage(const QString &vgMessage) if ("1" == infoList.at(0)) { isDeleteVGSuccess = true; + qDebug() << "[DeviceListWidget] Delete VG succeeded"; return; } @@ -676,6 +694,7 @@ void DeviceListWidget::onVGDeleteMessage(const QString &vgMessage) void DeviceListWidget::onLVDeleteMessage(const QString &lvMessage) { + qDebug() << "[DeviceListWidget] Delete LV result:" << lvMessage; QStringList infoList = lvMessage.split(":"); if (infoList.count() <= 1) { @@ -774,16 +793,19 @@ void DeviceListWidget::onUpdateUsb() void DeviceListWidget::setCurDevicePath(const QString &devPath) { + qDebug() << "[DeviceListWidget] Updating current device path from" << m_curChooseDevicePath << "to:" << devPath; m_curChooseDevicePath = devPath; } void DeviceListWidget::setCurVGName(const QString &vgName) { + qDebug() << "[DeviceListWidget] Updating current VG name from" << m_curChooseVGName << "to:" << vgName; m_curChooseVGName = vgName; } void DeviceListWidget::onUpdateDeviceInfo() { + qDebug() << "[DeviceListWidget] Updating device information"; //更新DmTreeview lx //设置当前选项 diff --git a/application/widgets/diskbadsectorsdialog.cpp b/application/widgets/diskbadsectorsdialog.cpp index 130b77c..5b47981 100644 --- a/application/widgets/diskbadsectorsdialog.cpp +++ b/application/widgets/diskbadsectorsdialog.cpp @@ -25,12 +25,15 @@ DiskBadSectorsDialog::DiskBadSectorsDialog(QWidget *parent) : DDialog(parent) { + qDebug() << "Disk bad sectors dialog initializing"; initUI(); initConnections(); + qDebug() << "Disk bad sectors dialog initialized"; } void DiskBadSectorsDialog::initUI() { + qDebug() << "Initializing UI components"; setIcon(QIcon::fromTheme(appName)); setTitle(tr("Verify or repair bad sectors")); // 坏道检测与修复 // 最低分辨率1024*768,高度需减去dock @@ -54,7 +57,7 @@ void DiskBadSectorsDialog::initUI() palette3.setColor(DPalette::NoType, color3); m_deviceInfo = DMDbusHandler::instance()->getCurDeviceInfo(); - qDebug() << __FUNCTION__ << m_deviceInfo.m_path << m_deviceInfo.m_length << m_deviceInfo.m_heads << m_deviceInfo.m_sectors + qDebug() << m_deviceInfo.m_path << m_deviceInfo.m_length << m_deviceInfo.m_heads << m_deviceInfo.m_sectors << m_deviceInfo.m_cylinders << m_deviceInfo.m_cylsize << m_deviceInfo.m_model << m_deviceInfo.m_serialNumber << m_deviceInfo.m_disktype << m_deviceInfo.m_sectorSize << m_deviceInfo.m_maxPrims << m_deviceInfo.m_highestBusy << m_deviceInfo.m_readonly << m_deviceInfo.m_maxPartitionNameLength; @@ -583,7 +586,9 @@ bool DiskBadSectorsDialog::inputValueIsEffective() void DiskBadSectorsDialog::onStartVerifyButtonClicked() { + qDebug() << "Start verify button clicked"; if (!inputValueIsEffective()) { + qWarning() << "Input values are invalid"; return; } @@ -769,6 +774,7 @@ void DiskBadSectorsDialog::onCheckTimeOut() void DiskBadSectorsDialog::onCheckComplete() { + qDebug() << "Bad sectors check completed"; m_checkTimer.stop(); m_progressBar->setValue(100); m_unusedTimeLabel->setText(tr("Time left:") + "00:00:00"); @@ -801,6 +807,7 @@ void DiskBadSectorsDialog::onCheckComplete() void DiskBadSectorsDialog::onStopButtonClicked() { + qDebug() << "Stop button clicked. Current type:" << static_cast(m_curType); switch (m_curType) { case StatusType::Check: { m_buttonStackedWidget->setCurrentIndex(2); @@ -836,6 +843,7 @@ void DiskBadSectorsDialog::onStopButtonClicked() void DiskBadSectorsDialog::onContinueButtonClicked() { + qDebug() << "Continue button clicked. Current type:" << static_cast(m_curType); switch (m_curType) { case StatusType::StopCheck: { m_buttonStackedWidget->setCurrentIndex(1); @@ -876,6 +884,7 @@ void DiskBadSectorsDialog::onContinueButtonClicked() void DiskBadSectorsDialog::onAgainVerifyButtonClicked() { + qDebug() << "Verify again button clicked"; m_progressBar->setValue(0); m_usedTimeLabel->setText(tr("Time elapsed:") + "00:00:00"); m_unusedTimeLabel->setText(tr("Time left:") + "00:00:00"); @@ -922,6 +931,7 @@ void DiskBadSectorsDialog::onAgainVerifyButtonClicked() void DiskBadSectorsDialog::onResetButtonClicked() { + qDebug() << "Reset button clicked. Resetting all states"; m_progressBar->setValue(0); m_usedTimeLabel->setText(tr("Time elapsed:") + "00:00:00"); m_unusedTimeLabel->setText(tr("Time left:") + "00:00:00"); @@ -958,7 +968,9 @@ void DiskBadSectorsDialog::onResetButtonClicked() void DiskBadSectorsDialog::onRepairButtonClicked() { + qDebug() << "Repair button clicked"; if (DMDbusHandler::instance()->isExistMountPartition(m_deviceInfo)) { + qWarning() << "Cannot repair - disk has mounted partitions"; MessageBox warningBox(this); warningBox.setObjectName("messageBox"); warningBox.setAccessibleName("messageBox"); @@ -1072,6 +1084,7 @@ void DiskBadSectorsDialog::onRepairBadBlocksInfo(const QString &cylinderNumber, void DiskBadSectorsDialog::onRepairComplete() { + qDebug() << "Bad sectors repair completed. Repaired:" << m_repairedCount; m_timer.stop(); m_progressBar->setValue(100); m_unusedTimeLabel->setText(tr("Time left:") + "00:00:00"); @@ -1147,6 +1160,7 @@ void DiskBadSectorsDialog::stopCheckRepair() void DiskBadSectorsDialog::closeEvent(QCloseEvent *event) { + qDebug() << "Close event triggered. Current type:" << static_cast(m_curType); switch (m_curType) { case StatusType::Check: { MessageBox messageBox(this); diff --git a/application/widgets/diskhealthdetectiondelegate.cpp b/application/widgets/diskhealthdetectiondelegate.cpp index 3acdb47..51872f3 100644 --- a/application/widgets/diskhealthdetectiondelegate.cpp +++ b/application/widgets/diskhealthdetectiondelegate.cpp @@ -22,16 +22,19 @@ DiskHealthDetectionDelegate::DiskHealthDetectionDelegate(DDialog *dialog) { + qDebug() << "DiskHealthDetectionDelegate constructor"; m_dialog = dialog; } void DiskHealthDetectionDelegate::setTextColor(const QColor &color) { + qDebug() << "Setting text color:" << color; m_color = color; } void DiskHealthDetectionDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const { + qDebug() << "Painting cell at row:" << index.row() << "column:" << index.column(); painter->save(); QRect paintRect = QRect(option.rect.left(), option.rect.top(), option.rect.width(), option.rect.height()); @@ -109,12 +112,16 @@ void DiskHealthDetectionDelegate::paint(QPainter *painter, const QStyleOptionVie QFont font = DFontSizeManager::instance()->get(DFontSizeManager::T8, QFont::Normal); painter->setFont(font); if (text == "G") { + qDebug() << "Drawing GOOD status icon"; painter->setPen(QColor("#00c800")); } else if (text == "W") { + qDebug() << "Drawing WARNING status icon"; painter->setPen(QColor("#FA6400")); } else if (text == "D") { + qDebug() << "Drawing DAMAGED status icon"; painter->setPen(QColor("#E02020")); } else if (text == "U") { + qDebug() << "Drawing UNKNOWN status icon"; painter->setPen(QColor("#777777")); } else { painter->setPen(m_color); diff --git a/application/widgets/diskhealthdetectiondialog.cpp b/application/widgets/diskhealthdetectiondialog.cpp index 267f09e..38dde16 100644 --- a/application/widgets/diskhealthdetectiondialog.cpp +++ b/application/widgets/diskhealthdetectiondialog.cpp @@ -32,6 +32,7 @@ DiskHealthDetectionDialog::DiskHealthDetectionDialog(const QString &devicePath, , m_devicePath(devicePath) , m_hardDiskStatusInfoList(hardDiskStatusInfoList) { + qDebug() << "DiskHealthDetectionDialog constructor for device:" << devicePath; initUI(); initConnections(); } @@ -43,6 +44,7 @@ DiskHealthDetectionDialog::~DiskHealthDetectionDialog() void DiskHealthDetectionDialog::initUI() { + qDebug() << "Initializing DiskHealthDetectionDialog UI"; setIcon(QIcon::fromTheme(appName)); setTitle(tr("Check Health")); // 硬盘健康检测 setFixedSize(726, 700); @@ -98,6 +100,7 @@ void DiskHealthDetectionDialog::initUI() // 硬盘健康状态 QString healthStateValue = DMDbusHandler::instance()->getDeviceHardStatus(m_devicePath); + qDebug() << "Device health status:" << healthStateValue; DLabel *healthStateLabel = new DLabel(tr("Health Status")); // 健康状态 DFontSizeManager::instance()->bind(healthStateLabel, DFontSizeManager::T6, QFont::Medium); @@ -236,6 +239,7 @@ void DiskHealthDetectionDialog::initUI() } if (!value.isEmpty()) { + qDebug() << "Temperature value:" << value; m_temperatureValue->setText(QString("%1°C").arg(value)); } } @@ -357,6 +361,7 @@ void DiskHealthDetectionDialog::initConnections() void DiskHealthDetectionDialog::onExportButtonClicked() { + qInfo() << "Starting health info export for device:" << m_devicePath; //文件保存路径 QString fileDirPath = QFileDialog::getSaveFileName(this, tr("Save File"), "CheckHealthInfo.txt", tr("Text files (*.txt)"));// 文件保存 硬盘健康检测信息 文件类型 if (fileDirPath.isEmpty()) { @@ -372,6 +377,7 @@ void DiskHealthDetectionDialog::onExportButtonClicked() if (!dir.exists()) { // 路径错误 + qWarning() << "Invalid export path:" << fileDir; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), tr("Wrong path")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); @@ -380,6 +386,7 @@ void DiskHealthDetectionDialog::onExportButtonClicked() if (!fileInfo.isWritable()) { // 您无权访问该路径 + qWarning() << "No write permission for path:" << fileDir; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), tr("You do not have permission to access this path")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); } else { @@ -410,9 +417,11 @@ void DiskHealthDetectionDialog::onExportButtonClicked() file.close(); + qInfo() << "Health info exported successfully to:" << fileDirPath; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/ok.svg"), tr("Export successful")); // 导出成功 DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); } else { + qWarning() << "Failed to export health info to:" << fileDirPath; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), tr("Export failed")); // 导出失败 DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); } @@ -451,6 +460,7 @@ void DiskHealthDetectionDialog::keyPressEvent(QKeyEvent *event) void DiskHealthDetectionDialog::onHandleChangeTheme() { + qDebug() << "Handling theme change"; DPalette palette; QColor valueColor; QColor tableColor; diff --git a/application/widgets/diskhealthheaderview.cpp b/application/widgets/diskhealthheaderview.cpp index e78496e..dbe0c72 100644 --- a/application/widgets/diskhealthheaderview.cpp +++ b/application/widgets/diskhealthheaderview.cpp @@ -23,6 +23,7 @@ static const QSize kDropDownSize {11, 10}; DiskHealthHeaderView::DiskHealthHeaderView(Qt::Orientation orientation, QWidget *parent) : DHeaderView(orientation, parent) { + qDebug() << "DiskHealthHeaderView constructor"; installEventFilter(this); viewport()->setAutoFillBackground(false); diff --git a/application/widgets/diskinfodisplaydialog.cpp b/application/widgets/diskinfodisplaydialog.cpp index b7d9aeb..7b98937 100644 --- a/application/widgets/diskinfodisplaydialog.cpp +++ b/application/widgets/diskinfodisplaydialog.cpp @@ -24,12 +24,14 @@ DiskInfoDisplayDialog::DiskInfoDisplayDialog(const QString &devicePath, QWidget : DDialog(parent) , m_devicePath(devicePath) { + qDebug() << "DiskInfoDisplayDialog constructor for device:" << devicePath; initUI(); initConnections(); } void DiskInfoDisplayDialog::initUI() { + qDebug() << "Initializing DiskInfoDisplayDialog UI"; // setWindowTitle("磁盘信息展示"); setIcon(QIcon::fromTheme(appName)); setTitle(tr("Disk Info")); // 磁盘信息 @@ -43,8 +45,10 @@ void DiskInfoDisplayDialog::initUI() HardDiskInfo hardDiskInfo = DMDbusHandler::instance()->getHardDiskInfo(m_devicePath); if (hardDiskInfo.m_mediaType == "SSD") { hardDiskInfo.m_mediaType = tr("SSD"); + qDebug() << "Disk media type: SSD"; } else if (hardDiskInfo.m_mediaType == "HDD") { hardDiskInfo.m_mediaType = tr("HDD"); + qDebug() << "Disk media type: HDD"; } m_diskInfoNameList.clear(); @@ -129,12 +133,13 @@ void DiskInfoDisplayDialog::initUI() void DiskInfoDisplayDialog::initConnections() { + qDebug() << "Setting up DiskInfoDisplayDialog signal connections"; connect(m_linkButton, &DCommandLinkButton::clicked, this, &DiskInfoDisplayDialog::onExportButtonClicked); } void DiskInfoDisplayDialog::onExportButtonClicked() { - qDebug() << "startExport"; + qInfo() << "Starting disk info export for device:" << m_devicePath; //文件保存路径 QString fileDirPath = QFileDialog::getSaveFileName(this, tr("Save File"), "DiskInfo.txt", tr("Text files (*.txt)"));// 文件保存 磁盘信息 文件类型 qDebug() << "fileDirPath:" << fileDirPath; @@ -151,6 +156,7 @@ void DiskInfoDisplayDialog::onExportButtonClicked() if (!dir.exists()) { // 路径错误 + qWarning() << "Invalid export path:" << fileDir; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), tr("Wrong path")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); @@ -159,6 +165,7 @@ void DiskInfoDisplayDialog::onExportButtonClicked() if (!fileInfo.isWritable()) { // 您无权访问该路径 + qWarning() << "No write permission for path:" << fileDir; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), tr("You do not have permission to access this path")); DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); } else { @@ -184,9 +191,11 @@ void DiskInfoDisplayDialog::onExportButtonClicked() file.close(); + qInfo() << "Disk info exported successfully to:" << fileDirPath; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/ok.svg"), tr("Export successful")); // 导出成功 DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); } else { + qWarning() << "Failed to export disk info to:" << fileDirPath; DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), tr("Export failed")); // 导出失败 DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20)); } diff --git a/application/widgets/formatedialog.cpp b/application/widgets/formatedialog.cpp index 3f22dce..cadc42c 100644 --- a/application/widgets/formatedialog.cpp +++ b/application/widgets/formatedialog.cpp @@ -21,12 +21,14 @@ FormateDialog::FormateDialog(QWidget *parent) : DDBase(parent) { + qDebug() << "FormateDialog constructor"; initUi(); initConnection(); } void FormateDialog::initUi() { + qDebug() << "Initializing FormatDialog UI"; m_height = 355; setFixedSize(450, m_height); @@ -352,6 +354,7 @@ void FormateDialog::initUi() void FormateDialog::initConnection() { + qDebug() << "Setting up FormatDialog signal connections"; connect(m_pushButton, &DPushButton::clicked, this, &FormateDialog::onCancelButtonClicked); connect(m_warningButton, &DWarningButton::clicked, this, &FormateDialog::onWipeButtonClicked); connect(m_fileNameEdit, &DLineEdit::textChanged, this, &FormateDialog::onTextChanged); @@ -365,6 +368,7 @@ void FormateDialog::initConnection() void FormateDialog::onTextChanged(const QString &text) { + qDebug() << "Format name changed:" << text; if (!text.isEmpty()) { QByteArray byteArray = text.toUtf8(); if (m_formatComboBox->currentText().contains("fat32")) { @@ -397,6 +401,7 @@ void FormateDialog::onTextChanged(const QString &text) void FormateDialog::onComboxFormatTextChange(const QString &text) { + qDebug() << "File system type changed:" << text; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION || DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { QByteArray byteArray = m_fileNameEdit->text().toUtf8(); @@ -464,6 +469,7 @@ void FormateDialog::updateEncryptionInfo(const QString &text, const int &width) void FormateDialog::onSecurityCurrentIndexChanged(int index) { + qDebug() << "Security option changed to index:" << index; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION || DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { switch (index) { @@ -551,6 +557,7 @@ void FormateDialog::onSecurityCurrentIndexChanged(int index) void FormateDialog::onWipingMethodCurrentIndexChanged(int index) { + qDebug() << "Wiping method changed to index:" << index; switch (index) { case 0: { m_curWipeMethod = WipeType::DOD; @@ -572,6 +579,7 @@ void FormateDialog::onCancelButtonClicked() void FormateDialog::onWipeButtonClicked() { + qInfo() << "Starting wipe operation for:" << m_pathInfo; QString userName = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); userName.remove(0, 6); @@ -694,6 +702,7 @@ void FormateDialog::onWipeButtonClicked() void FormateDialog::onWipeResult(const QString &info) { + qDebug() << "Wipe operation result:" << info; QStringList infoList = info.split(":"); if (infoList.count() <= 2) { diff --git a/application/widgets/infoshowwidget.cpp b/application/widgets/infoshowwidget.cpp index ee423b6..2a5c8c2 100644 --- a/application/widgets/infoshowwidget.cpp +++ b/application/widgets/infoshowwidget.cpp @@ -11,6 +11,7 @@ #include "customcontrol/partitioninfowidget.h" #include "customcontrol/vgsizeinfowidget.h" #include "vginfoshowwidget.h" +#include #include #include @@ -21,12 +22,14 @@ DWIDGET_USE_NAMESPACE InfoShowWidget::InfoShowWidget(DWidget *parent) : DFrame(parent) { + qDebug() << "InfoShowWidget constructor"; initUi(); initConnection(); } void InfoShowWidget::initUi() { + qDebug() << "Initializing InfoShowWidget UI"; setWindowFlags(Qt::FramelessWindowHint); //无边框 setAttribute(Qt::WA_TranslucentBackground); //背景透明 @@ -64,6 +67,7 @@ void InfoShowWidget::initUi() void InfoShowWidget::initConnection() { + qDebug() << "Setting up InfoShowWidget signal connections"; connect(DMDbusHandler::instance(), &DMDbusHandler::curSelectChanged, this, &InfoShowWidget::onCurSelectChanged); #if QT_VERSION_MAJOR > 5 connect(DGuiApplicationHelper::instance(), &DGuiApplicationHelper::themeTypeChanged, this, @@ -79,6 +83,7 @@ void InfoShowWidget::initConnection() void InfoShowWidget::midFramSettings() { + qDebug() << "Configuring mid frame settings"; QVBoxLayout *mainLayout = new QVBoxLayout(m_frameMid); m_infoWidget = new SizeInfoWidget; m_partitionInfoWidget = new PartitionInfoWidget; @@ -117,6 +122,7 @@ void InfoShowWidget::midFramSettings() void InfoShowWidget::bottomFramSettings() { + qDebug() << "Configuring bottom frame settings"; QVBoxLayout *leftInfoLayout = new QVBoxLayout(); QVBoxLayout *rightInfolayout = new QVBoxLayout(); @@ -222,7 +228,7 @@ void InfoShowWidget::bottomFramSettings() void InfoShowWidget::onCurSelectChanged() { - qDebug() << __FUNCTION__ << "-0--0-"; + qDebug() << "Current selection changed, level:" << DMDbusHandler::instance()->getCurLevel(); if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { m_frameBottom->setFrameData(); m_mountpointLabel->setText(tr("Mount point:")); @@ -602,6 +608,7 @@ void InfoShowWidget::onCurSelectChanged() void InfoShowWidget::onHandleChangeTheme() { + qDebug() << "Handling theme change"; DPalette palette; DGuiApplicationHelper::ColorType themeType = DGuiApplicationHelper::instance()->themeType(); if (themeType == DGuiApplicationHelper::LightType) { @@ -625,6 +632,7 @@ void InfoShowWidget::onHandleChangeTheme() void InfoShowWidget::onEnterWidget(QRectF rect, QString path) { + qDebug() << "Mouse entered widget, path:" << path; if ("unallocated" != path) { path = path.remove(0, 5); } @@ -644,11 +652,13 @@ void InfoShowWidget::onEnterWidget(QRectF rect, QString path) void InfoShowWidget::onLeaveWidget() { + qDebug() << "Mouse left widget"; m_arrowRectangle->hide(); } void InfoShowWidget::onEnterVGInfoWidget(QRect rect, const QList > &lstInfo) { + qDebug() << "Mouse entered VG info widget"; if (!m_vgInfoShowWidget->isHidden()) { return; } diff --git a/application/widgets/mainsplitter.cpp b/application/widgets/mainsplitter.cpp index f3072be..de0c1bd 100644 --- a/application/widgets/mainsplitter.cpp +++ b/application/widgets/mainsplitter.cpp @@ -6,10 +6,12 @@ #include "mainsplitter.h" #include "devicelistwidget.h" #include "infoshowwidget.h" +#include MainSplitter::MainSplitter(DWidget *parent) : DSplitter(parent) { + qDebug() << "MainSplitter constructor"; setFrameShape(QFrame::NoFrame); initui(); @@ -18,10 +20,13 @@ MainSplitter::MainSplitter(DWidget *parent) void MainSplitter::initui() { + qDebug() << "Initializing MainSplitter UI"; setHandleWidth(1); setChildrenCollapsible(false); // 子部件不可拉伸到 0 + qDebug() << "Creating device list widget"; m_deviceList = new DeviceListWidget(this); + qDebug() << "Creating info show widget"; m_infoShow = new InfoShowWidget(this); setMouseTracking(true); @@ -29,8 +34,10 @@ void MainSplitter::initui() m_infoShow->setFrameShape(QFrame::NoFrame); + qDebug() << "Adding widgets to splitter"; addWidget(m_deviceList); addWidget(m_infoShow); + qDebug() << "Setting stretch factors (1:4 ratio)"; setStretchFactor(0, 1); setStretchFactor(1, 4); } diff --git a/application/widgets/mainwindow.cpp b/application/widgets/mainwindow.cpp index fb3eba0..0108284 100644 --- a/application/widgets/mainwindow.cpp +++ b/application/widgets/mainwindow.cpp @@ -26,6 +26,7 @@ MainWindow *MainWindow::instance() { static MainWindow *m = nullptr; if (m == nullptr) { + qDebug() << "Creating MainWindow singleton instance"; m = new MainWindow; } return m; @@ -34,6 +35,7 @@ MainWindow *MainWindow::instance() MainWindow::MainWindow(QWidget *parent) : DMainWindow(parent) { + qDebug() << "MainWindow constructor"; // if (false == DeviceInfoParser::instance().getRootPassword()) { // exit(-1); // } @@ -92,6 +94,7 @@ void MainWindow::closeEvent(QCloseEvent *event) void MainWindow::initUi() { + qDebug() << "Initializing MainWindow UI"; m_dialog = new AnimationDialog(this); m_dialog->setWindowModality(Qt::ApplicationModal); m_dialog->hide(); @@ -137,6 +140,7 @@ void MainWindow::setSizebyMode(DPushButton *button) void MainWindow::initConnection() { + qDebug() << "Setting up MainWindow signal connections"; connect(m_handler, &DMDbusHandler::showSpinerWindow, this, &MainWindow::onShowSpinerWindow); connect(m_btnRefresh, &DPushButton::clicked, this, &MainWindow::onRefreshButtonClicked); #ifdef DTKWIDGET_CLASS_DSizeMode @@ -163,16 +167,19 @@ QString MainWindow::getRootLoginResult() void MainWindow::getDeviceInfo() { + qDebug() << "Requesting device information"; m_handler->getDeviceInfo(); //call after initUi } void MainWindow::onRefreshButtonClicked() { + qDebug() << "Refresh button clicked"; m_handler->refresh(); } void MainWindow::onShowSpinerWindow(bool isShow, const QString &title) { + qDebug() << "Spinner window visibility changed:" << isShow << "title:" << title; if (isShow) { Dtk::Widget::moveToCenter(m_dialog); m_dialog->setShowSpinner(isShow, title); diff --git a/application/widgets/messagebox.cpp b/application/widgets/messagebox.cpp index 1066c14..d8e9af0 100644 --- a/application/widgets/messagebox.cpp +++ b/application/widgets/messagebox.cpp @@ -5,6 +5,7 @@ #include "messagebox.h" +#include #include #include @@ -15,11 +16,13 @@ MessageBox::MessageBox(QWidget *parent) : DDialog(parent) { - + qDebug() << "MessageBox constructor"; } void MessageBox::setWarings(const QString &title, const QString &warningMsg, const QString &sureBtnText, const QString &sureAccessibleName, const QString &cancalBtnText, const QString &cancelAccessibleName) { + qDebug() << "Setting warning message box with title:" << title + << "sureBtnText:" << sureBtnText; setIcon(QIcon::fromTheme("://icons/deepin/builtin/exception-logo.svg")); if (!title.isEmpty()) { @@ -46,6 +49,8 @@ void MessageBox::setWarings(const QString &title, const QString &warningMsg, con void MessageBox::setWarings(const QString &title, const QString &warningMsg, const QString &sureBtnText, ButtonType sureBtnType, const QString &sureAccessibleName, const QString &cancalBtnText, const QString &cancelAccessibleName) { + qDebug() << "Setting warning message box with button type:" << sureBtnType + << "title:" << title; setIcon(QIcon::fromTheme("://icons/deepin/builtin/exception-logo.svg")); if (!title.isEmpty()) { @@ -73,6 +78,8 @@ void MessageBox::setWarings(const QString &title, const QString &warningMsg, con void MessageBox::setWarings(const QString &title, const QString &sureBtnText, ButtonType sureBtnType, const QString &sureAccessibleName, const QString &cancalBtnText, const QString &cancelAccessibleName) { + qDebug() << "Setting warning message box with custom title layout" + << "title:" << title; setIcon(QIcon::fromTheme("://icons/deepin/builtin/exception-logo.svg")); DLabel *label= new DLabel(this); @@ -115,6 +122,7 @@ void MessageBox::setWarings(const QString &title, const QString &sureBtnText, Bu void MessageBox::setProgressBar(const QString &title, const QString &cancalBtnText) { + qDebug() << "Setting progress bar message box with title:" << title; setIcon(QIcon::fromTheme("://icons/deepin/builtin/exception-logo.svg")); if (!title.isEmpty()) { @@ -133,6 +141,7 @@ void MessageBox::setProgressBar(const QString &title, const QString &cancalBtnTe void MessageBox::addLabel(QString text) { + qDebug() << "Adding label to message box with text:" << text; DLabel *label= new DLabel(this); label->setText(text); label->adjustSize(); @@ -142,6 +151,7 @@ void MessageBox::addLabel(QString text) void MessageBox::addProgressBar() { + qDebug() << "Adding progress bar to message box"; m_progressBar = new DProgressBar(this); m_progressBar->setValue(50); m_progressBar->setFixedSize(330, 10); @@ -150,6 +160,7 @@ void MessageBox::addProgressBar() void MessageBox::keyPressEvent(QKeyEvent *event) { + qDebug() << "Key press event in message box, key:" << event->key(); if (event->key() == Qt::Key::Key_Escape) { event->ignore(); } else { diff --git a/application/widgets/mountdialog.cpp b/application/widgets/mountdialog.cpp index dce7165..199914d 100644 --- a/application/widgets/mountdialog.cpp +++ b/application/widgets/mountdialog.cpp @@ -6,6 +6,7 @@ #include "mountdialog.h" #include "partedproxy/dmdbushandler.h" #include "messagebox.h" +#include #include #include @@ -17,12 +18,15 @@ MountDialog::MountDialog(QWidget *parent) : DDBase(parent) { + qDebug() << "MountDialog constructor"; initUi(); initConnection(); + qDebug() << "MountDialog initialized"; } void MountDialog::initUi() { + qDebug() << "Initializing MountDialog UI"; setMinimumSize(QSize(420, 200)); if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); @@ -181,6 +185,7 @@ bool MountDialog::isSystemDirectory(const QString &directory) void MountDialog::mountCurPath() { + qInfo() << "Starting mount operation for current path"; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); if (!onCheckMountPoint(static_cast(info.m_fileSystemType), m_fileChooserEdit->text())) { @@ -243,6 +248,7 @@ void MountDialog::mountCurPath() void MountDialog::onButtonClicked(int index, const QString &text) { + qDebug() << "Button clicked - index:" << index << "text:" << text; Q_UNUSED(text); if (index == m_okCode) { QString mountPath = m_fileChooserEdit->text(); @@ -258,6 +264,7 @@ void MountDialog::onButtonClicked(int index, const QString &text) messageBox.setWarings(tr("The data under this mount point would be lost, please mount the directory to another location"), "", tr("Continue", "button"), "ok", tr("Cancel"), "cancelBtn"); if (messageBox.exec() == 1) { + qInfo() << "User confirmed mount operation despite warning"; mountCurPath(); close(); } @@ -272,10 +279,13 @@ void MountDialog::onButtonClicked(int index, const QString &text) bool MountDialog::onCheckMountPoint(FSType fsType, const QString &mountPoint) { + qDebug() << "Checking mount point validity for FS type:" << fsType << "path:" << mountPoint; //exfat文件系统的挂载点必须为空目录 if (fsType == FS_EXFAT) { + qDebug() << "Checking EXFAT mount point requirements"; QDir dir(m_fileChooserEdit->text()); if (!dir.isEmpty()) { + qWarning() << "Mount point not empty for EXFAT filesystem"; MessageBox messageBox(this); messageBox.setObjectName("mountPointMessageBox"); messageBox.setAccessibleName("mountPointMessageBox"); diff --git a/application/widgets/partitiondialog.cpp b/application/widgets/partitiondialog.cpp index 17f3d4f..35d1572 100644 --- a/application/widgets/partitiondialog.cpp +++ b/application/widgets/partitiondialog.cpp @@ -17,11 +17,13 @@ PartitionDialog::PartitionDialog(QWidget *parent) : DDBase(parent) { + qDebug() << "PartitionDialog initialized"; initUi(); } void PartitionDialog::initUi() { + qInfo() << "Initializing partition dialog UI"; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setTitle(tr("Partition %1").arg(info.m_path)); @@ -42,6 +44,7 @@ void PartitionDialog::initUi() void PartitionDialog::setTitleText(const QString &title, const QString &subTitle) { + qDebug() << "Setting dialog title to:" << title << "and subtitle to:" << subTitle; setTitle(title); m_tipLabel->setText(subTitle); } diff --git a/application/widgets/partitiontableerrorsinfodelegate.cpp b/application/widgets/partitiontableerrorsinfodelegate.cpp index 9a29259..33c7494 100644 --- a/application/widgets/partitiontableerrorsinfodelegate.cpp +++ b/application/widgets/partitiontableerrorsinfodelegate.cpp @@ -21,11 +21,13 @@ PartitionTableErrorsInfoDelegate::PartitionTableErrorsInfoDelegate(DDialog *dialog) { + qDebug() << "PartitionTableErrorsInfoDelegate initialized"; m_dialog = dialog; } void PartitionTableErrorsInfoDelegate::setTextColor(const QColor &color) { + qDebug() << "Setting text color to:" << color.name(); m_color = color; } diff --git a/application/widgets/partitiontableerrorsinfodialog.cpp b/application/widgets/partitiontableerrorsinfodialog.cpp index d47adb8..8460271 100644 --- a/application/widgets/partitiontableerrorsinfodialog.cpp +++ b/application/widgets/partitiontableerrorsinfodialog.cpp @@ -7,6 +7,7 @@ #include "partitiontableerrorsinfodelegate.h" #include "common.h" #include "diskhealthheaderview.h" +#include #include #include @@ -23,6 +24,7 @@ PartitionTableErrorsInfoDialog::PartitionTableErrorsInfoDialog(const QString &de : DDialog(parent) , m_deviceInfo(deviceInfo) { + qDebug() << "Creating partition table errors dialog for device:" << deviceInfo; initUI(); initConnections(); } @@ -34,6 +36,7 @@ PartitionTableErrorsInfoDialog::~PartitionTableErrorsInfoDialog() void PartitionTableErrorsInfoDialog::initUI() { + qDebug() << "Initializing partition table errors UI"; setIcon(QIcon::fromTheme(appName)); setTitle(tr("Errors in Partition Table")); // 分区表错误报告 setMinimumSize(580, 386); @@ -135,6 +138,7 @@ void PartitionTableErrorsInfoDialog::initConnections() void PartitionTableErrorsInfoDialog::keyPressEvent(QKeyEvent *event) { if (event->key() == Qt::Key::Key_Escape) { + qDebug() << "Escape key pressed, ignoring"; event->ignore(); } else { DDialog::keyPressEvent(event); diff --git a/application/widgets/removepvwidget.cpp b/application/widgets/removepvwidget.cpp index 997576d..74c492b 100644 --- a/application/widgets/removepvwidget.cpp +++ b/application/widgets/removepvwidget.cpp @@ -6,6 +6,7 @@ #include "removepvwidget.h" #include "messagebox.h" #include "utils.h" +#include #include #include @@ -15,6 +16,7 @@ RemovePVWidget::RemovePVWidget(QWidget *parent) : DDBase(parent) { + qDebug() << "RemovePVWidget initialized"; initUi(); initConnection(); } @@ -145,6 +147,7 @@ void RemovePVWidget::onCancelButtonClicked() void RemovePVWidget::onButtonClicked() { + qInfo() << "Delete PV button clicked"; bool bigDataMove = false; QStringList realDelPvLis; set pvStrList; @@ -203,6 +206,7 @@ void RemovePVWidget::onButtonClicked() if (pvStrList.size() > 0 && Utils::adjudicationPVDelete(DMDbusHandler::instance()->probLVMInfo(), pvStrList, bigDataMove, realDelPvLis)) { //todo 进入 说明允许删除 补充允许删除逻辑 + qDebug() << "PV deletion allowed for:" << realDelPvLis.join(','); if (bigDataMove) { MessageBox warningBox(this); warningBox.setObjectName("messageBox"); @@ -214,6 +218,7 @@ 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"; return; } } @@ -227,6 +232,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(','); return; } @@ -242,6 +248,7 @@ void RemovePVWidget::onButtonClicked() void RemovePVWidget::onPVDeleteMessage(const QString &pvMessage) { + qDebug() << "Received PV delete message:" << pvMessage; QStringList infoList = pvMessage.split(":"); if (infoList.count() <= 1) { @@ -249,6 +256,7 @@ void RemovePVWidget::onPVDeleteMessage(const QString &pvMessage) } if (infoList.at(0) == "0") { + qWarning() << "Failed to delete PV:" << infoList.mid(1).join(':'); // 删除物理卷失败 DMessageManager::instance()->sendMessage(this->parentWidget()->parentWidget()->parentWidget()->parentWidget(), QIcon::fromTheme("://icons/deepin/builtin/warning.svg"), @@ -257,6 +265,7 @@ void RemovePVWidget::onPVDeleteMessage(const QString &pvMessage) QMargins(0, 0, 0, 20)); close(); } else { + qInfo() << "PV deleted successfully"; close(); } } diff --git a/application/widgets/resizedialog.cpp b/application/widgets/resizedialog.cpp index 0c8b4fc..a1dec0f 100644 --- a/application/widgets/resizedialog.cpp +++ b/application/widgets/resizedialog.cpp @@ -6,6 +6,7 @@ #include "resizedialog.h" #include "partedproxy/dmdbushandler.h" #include "messagebox.h" +#include #include @@ -21,7 +22,7 @@ ResizeDialog::ResizeDialog(QWidget *parent) : DDBase(parent) { - + qDebug() << "ResizeDialog initialized"; initUi(); initConnection(); setOnButtonClickedClose(false); @@ -128,6 +129,7 @@ void ResizeDialog::initConnection() void ResizeDialog::partitionResize() { + qInfo() << "Starting partition resize operation"; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); double newSize = 0; if (0 == m_comboBox->currentIndex()) { @@ -141,6 +143,7 @@ void ResizeDialog::partitionResize() 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; return; } @@ -172,6 +175,7 @@ void ResizeDialog::partitionResize() 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; return; } else { PartitionInfo newInfo = info; @@ -203,6 +207,7 @@ void ResizeDialog::partitionResize() 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; return; } else { newInfo.m_alignment = ALIGN_MEBIBYTE; //ALIGN_MEBIBYTE; @@ -262,6 +267,7 @@ void ResizeDialog::partitionResize() void ResizeDialog::lvResize() { + qInfo() << "Starting LV resize operation"; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); int peSize = vgInfo.m_PESize; @@ -294,6 +300,7 @@ void ResizeDialog::lvResize() 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; return; } @@ -379,6 +386,7 @@ void ResizeDialog::noSupportFSDailog() void ResizeDialog::onButtonClicked(int index, const QString &) { + qDebug() << "Button clicked with index:" << index; if (m_okCode == index) { if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { partitionResize(); @@ -392,6 +400,7 @@ void ResizeDialog::onButtonClicked(int index, const QString &) void ResizeDialog::onComboSelectedChanged(int index) { + qDebug() << "Unit selection changed to index:" << index; if (index == 0) { //MiB if (DMDbusHandler::PARTITION == DMDbusHandler::instance()->getCurLevel()) { @@ -421,6 +430,7 @@ void ResizeDialog::onComboSelectedChanged(int index) void ResizeDialog::onEditTextChanged(const QString &) { + qDebug() << "Size input changed to:" << m_lineEdit->text(); if (!m_lineEdit->text().isEmpty() && m_lineEdit->text().toDouble() != 0.00) { getButton(m_okCode)->setDisabled(false); if (m_lineEdit->isAlert()) { diff --git a/application/widgets/titlewidget.cpp b/application/widgets/titlewidget.cpp index 013ea51..8ec7efe 100644 --- a/application/widgets/titlewidget.cpp +++ b/application/widgets/titlewidget.cpp @@ -14,6 +14,7 @@ #include "createvgwidget.h" #include "removepvwidget.h" #include "decryptdialog.h" +#include #include #include @@ -22,6 +23,7 @@ TitleWidget::TitleWidget(DWidget *parent) : DWidget(parent) { + qDebug() << "TitleWidget initialized"; initUi(); initConnection(); } @@ -181,6 +183,7 @@ DPushButton *TitleWidget::createBtn(const QString &btnName, const QString &objNa void TitleWidget::showPartInfoWidget() { + qDebug() << "Show partition info widget"; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); PartitionDialog dlg(this); dlg.setObjectName("partitionDialog"); @@ -213,6 +216,7 @@ void TitleWidget::showPartInfoWidget() void TitleWidget::showFormateInfoWidget() { + qDebug() << "Show format dialog"; setCurDevicePath(DMDbusHandler::instance()->getCurDevicePath()); FormateDialog dlg(this); @@ -254,6 +258,7 @@ bool TitleWidget::showNoFileSystemWarningDialog(const LUKS_INFO &luksInfo) void TitleWidget::showMountInfoWidget() { + qDebug() << "Show mount dialog"; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setCurDevicePath(info.m_devicePath); @@ -315,6 +320,7 @@ void TitleWidget::showMountInfoWidget() void TitleWidget::showUnmountInfoWidget() { + qDebug() << "Show unmount dialog"; if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { setCurDevicePath(DMDbusHandler::instance()->getCurPartititonInfo().m_devicePath); } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { @@ -335,6 +341,7 @@ void TitleWidget::showUnmountInfoWidget() void TitleWidget::showResizeInfoWidget() { + qDebug() << "Show resize dialog"; PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setCurDevicePath(info.m_devicePath); FS_Limits limits = info.m_fsLimits; @@ -361,6 +368,7 @@ void TitleWidget::showResizeInfoWidget() void TitleWidget::onCreateLVClicked() { + qDebug() << "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")); @@ -379,6 +387,7 @@ void TitleWidget::onCreateLVClicked() void TitleWidget::onDeleteLVClicked() { + qDebug() << "Delete LV button clicked"; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setCurVGName(lvInfo.m_vgName); @@ -413,6 +422,7 @@ void TitleWidget::onDeleteLVClicked() void TitleWidget::onResizeLVClicked() { + qDebug() << "Resize LV button clicked"; LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setCurVGName(lvInfo.m_vgName); if(lvInfo.m_lvFsType == FS_NTFS){ @@ -465,6 +475,7 @@ void TitleWidget::onResizeLVClicked() void TitleWidget::onCreateVGClicked() { + qDebug() << "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"); @@ -480,6 +491,7 @@ void TitleWidget::onCreateVGClicked() void TitleWidget::onDeleteVGClicked() { + qDebug() << "Delete VG button clicked"; VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo(); setCurVGName(vgInfo.m_vgName); if (DMDbusHandler::instance()->isExistMountLV(vgInfo)) { @@ -513,6 +525,7 @@ void TitleWidget::onDeleteVGClicked() void TitleWidget::onResizeVGClicked() { + qDebug() << "Resize VG button clicked"; setCurVGName(DMDbusHandler::instance()->getCurVGInfo().m_vgName); CreateVGWidget createVGWidget(CreateVGWidget::RESIZE, this); @@ -525,6 +538,7 @@ void TitleWidget::onResizeVGClicked() void TitleWidget::onDeletePVClicked() { + qDebug() << "Delete PV button clicked"; QMap mapVGInfo = DMDbusHandler::instance()->probLVMInfo().m_vgInfo; bool vgIsMount = false; QStringList lstVGName; @@ -845,7 +859,7 @@ void TitleWidget::updateEncryptDeviceBtnStatus(const LUKS_INFO &luksInfo) void TitleWidget::onCurSelectChanged() { updateBtnStatus(); - qDebug() << __FUNCTION__ << "-1--1-"; + qDebug() << "Current selection changed"; } void TitleWidget::onUpdateUsb() diff --git a/application/widgets/unmountdialog.cpp b/application/widgets/unmountdialog.cpp index 2684eaa..2cb2f56 100644 --- a/application/widgets/unmountdialog.cpp +++ b/application/widgets/unmountdialog.cpp @@ -7,6 +7,7 @@ #include "partedproxy/dmdbushandler.h" #include "messagebox.h" #include "unmountwarningdialog.h" +#include #include #include @@ -17,6 +18,7 @@ UnmountDialog::UnmountDialog(QWidget *parent) : DDBase(parent) { + qDebug() << "UnmountDialog initialized"; initUi(); initConnection(); } @@ -34,14 +36,17 @@ void UnmountDialog::initUi() if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); setTitle(tr("Unmount %1").arg(info.m_path)); + qDebug() << "Preparing to unmount partition:" << info.m_path; } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); setTitle(tr("Unmount %1").arg(lvInfo.m_lvName)); + qDebug() << "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) { DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); setTitle(tr("Unmount %1").arg(info.m_path)); + qDebug() << "Preparing to unmount disk:" << info.m_path; } int index = addButton(tr("Cancel"), false, ButtonNormal); @@ -62,15 +67,19 @@ void UnmountDialog::umountCurMountPoints() if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::PARTITION) { PartitionInfo info = DMDbusHandler::instance()->getCurPartititonInfo(); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { + qDebug() << "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; DMDbusHandler::instance()->unmount(); } } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::LOGICALVOLUME) { LVInfo lvInfo = DMDbusHandler::instance()->getCurLVInfo(); if (lvInfo.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { + qDebug() << "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; LVAction lvAction; lvAction.m_vgName = lvInfo.m_vgName; lvAction.m_lvName = lvInfo.m_lvName; @@ -84,6 +93,7 @@ void UnmountDialog::umountCurMountPoints() } else if (DMDbusHandler::instance()->getCurLevel() == DMDbusHandler::DISK) { DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo(); if (info.m_luksFlag == LUKSFlag::IS_CRYPT_LUKS) { + qDebug() << "Unmounting encrypted disk:" << info.m_path; DMDbusHandler::instance()->cryptUmount(DMDbusHandler::instance()->probLUKSInfo().m_luksMap.value(info.m_path), info.m_path); } } @@ -119,13 +129,15 @@ void UnmountDialog::onButtonClicked(int index, const QString &text) } } - qDebug() << __FUNCTION__; + qDebug() << "Checking system path status"; if (isSysPath || partitionFlag == 4 || lvFlag) { + qWarning() << "Attempting to unmount system path - showing warning dialog"; UnmountWarningDialog unmountWarningDialog; unmountWarningDialog.setObjectName("firstWarning"); unmountWarningDialog.setAccessibleName("firstWarning"); if (unmountWarningDialog.exec() == DDialog::Accepted) { umountCurMountPoints(); + qDebug() << "User canceled unmount operation"; close(); } } else { diff --git a/application/widgets/unmountwarningdialog.cpp b/application/widgets/unmountwarningdialog.cpp index 92b09a7..294a90a 100644 --- a/application/widgets/unmountwarningdialog.cpp +++ b/application/widgets/unmountwarningdialog.cpp @@ -4,12 +4,14 @@ #include "unmountwarningdialog.h" +#include #include #include UnmountWarningDialog::UnmountWarningDialog(QWidget *parent) : DDBase(parent) { + qDebug() << "UnmountWarningDialog initialized"; initUi(); initConnection(); } @@ -57,6 +59,7 @@ 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"; getButton(index)->setAccessibleName("cancelBtn"); getButton(m_okCode)->setAccessibleName("unmountBtn"); @@ -72,10 +75,12 @@ void UnmountWarningDialog::onCheckBoxStateChange(int state) switch (state) { case Qt::CheckState::Unchecked: { getButton(m_okCode)->setDisabled(true); + qDebug() << "Unmount button disabled"; break; } case Qt::CheckState::Checked: { getButton(m_okCode)->setDisabled(false); + qDebug() << "Unmount button enabled"; break; } default: diff --git a/application/widgets/vginfoshowwidget.cpp b/application/widgets/vginfoshowwidget.cpp index c0205e4..28ae01b 100644 --- a/application/widgets/vginfoshowwidget.cpp +++ b/application/widgets/vginfoshowwidget.cpp @@ -4,6 +4,7 @@ #include "vginfoshowwidget.h" +#include #include #include @@ -20,6 +21,7 @@ VGInfoShowWidget::VGInfoShowWidget(QWidget *parent) : QWidget(parent) { + qDebug() << "VGInfoShowWidget initialized"; initUi(); initConnection(); } @@ -37,6 +39,7 @@ void VGInfoShowWidget::initConnection() void VGInfoShowWidget::setData(const QList< QMap > &lstInfo) { + qDebug() << "Setting VG info data, items count:" << lstInfo.count(); QList lstCylinderWidget = children(); for (int i = 0; i < lstCylinderWidget.count(); i ++) { QObject *obj = lstCylinderWidget.at(i); @@ -57,6 +60,7 @@ 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"); if (themeType == DGuiApplicationHelper::LightType) { QColor color("#F7F7F7"); color.setAlphaF(0.6); @@ -120,10 +124,12 @@ void VGInfoShowWidget::setData(const QList< QMap > &lstInfo) if (lstInfo.count() % 2 != 0) { height += 1; } + qDebug() << "Calculated layout height:" << height; DFrame *frame = new DFrame; frame->setPalette(paletteBackground); if (height > 4) { + qDebug() << "Creating scrollable layout for large content"; setFixedSize(340, 192); m_gridLayout->setSpacing(8); @@ -152,6 +158,7 @@ void VGInfoShowWidget::setData(const QList< QMap > &lstInfo) frame->setLayout(scrollAreaLayout); } else { + qDebug() << "Creating fixed layout for small content"; int width = 340; if (lstInfo.count() == 1) { width = 170; diff --git a/basestruct/deviceinfo.cpp b/basestruct/deviceinfo.cpp index 46183fd..441ab7b 100644 --- a/basestruct/deviceinfo.cpp +++ b/basestruct/deviceinfo.cpp @@ -8,11 +8,13 @@ /*********************************** stCustest *********************************************/ QDBusArgument &operator<<(QDBusArgument &argument, const stCustest &stcus) { + qDebug() << "Starting stCustest serialization"; argument.beginStructure(); argument << stcus.m_length << stcus.m_heads << stcus.m_path; argument.endStructure(); + qDebug() << "Completed stCustest serialization"; return argument; } @@ -29,6 +31,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, stCustest &stcus) /*********************************** HardDiskInfo *********************************************/ QDBusArgument &operator<<(QDBusArgument &argument, const HardDiskInfo &inhdinfo) { + qDebug() << "Starting HardDiskInfo serialization"; argument.beginStructure(); argument << inhdinfo.m_model << inhdinfo.m_vendor @@ -45,6 +48,7 @@ QDBusArgument &operator<<(QDBusArgument &argument, const HardDiskInfo &inhdinfo) << inhdinfo.m_firmwareVersion << inhdinfo.m_speed; argument.endStructure(); + qDebug() << "Completed HardDiskInfo serialization"; return argument; } @@ -71,6 +75,7 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, HardDiskInfo &inh /*********************************** HardDiskStatusInfo *********************************************/ QDBusArgument &operator<<(QDBusArgument &argument, const HardDiskStatusInfo &inhdinfo) { + qDebug() << "Starting HardDiskStatusInfo serialization"; argument.beginStructure(); argument << inhdinfo.m_id << inhdinfo.m_attributeName @@ -83,10 +88,12 @@ QDBusArgument &operator<<(QDBusArgument &argument, const HardDiskStatusInfo &inh << inhdinfo.m_whenFailed << inhdinfo.m_rawValue; argument.endStructure(); + qDebug() << "Completed HardDiskStatusInfo serialization"; return argument; } const QDBusArgument &operator>>(const QDBusArgument &argument, HardDiskStatusInfo &inhdinfo) { + qDebug() << "Starting HardDiskStatusInfo deserialization"; argument.beginStructure(); argument >> inhdinfo.m_id >> inhdinfo.m_attributeName @@ -99,6 +106,8 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, HardDiskStatusInf >> inhdinfo.m_whenFailed >> inhdinfo.m_rawValue; argument.endStructure(); + + qDebug() << "Completed HardDiskStatusInfo deserialization"; return argument; } /*********************************** DeviceInfo *********************************************/ @@ -159,22 +168,26 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, DeviceInfo &info) info.m_vgFlag = static_cast(flag); info.m_luksFlag = static_cast(flag2); argument.endStructure(); + qDebug() << "Completed DeviceInfo deserialization"; return argument; } DeviceInfo::DeviceInfo() : m_readonly(false) { + qDebug() << "Initializing DeviceInfo with default values"; m_length = m_heads = m_sectors = m_cylinders = m_cylsize = m_sectorSize = m_maxPrims = m_highestBusy = m_maxPartitionNameLength = 0; m_path = m_model = m_serialNumber = m_disktype = m_mediaType = m_interface = QString(""); m_partition.clear(); m_vgFlag = LVM_FLAG_NOT_PV; m_vglist.clear(); m_luksFlag = LUKSFlag::NOT_CRYPT_LUKS; + qDebug() << "DeviceInfo initialization completed"; } /*********************************** WipeAction *********************************************/ QDBusArgument &operator<<(QDBusArgument &argument, const WipeAction &data) { + qDebug() << "Starting WipeAction serialization"; argument.beginStructure(); argument << data.m_fstype << data.m_path @@ -193,6 +206,7 @@ QDBusArgument &operator<<(QDBusArgument &argument, const WipeAction &data) const QDBusArgument &operator>>(const QDBusArgument &argument, WipeAction &data) { + qDebug() << "Starting WipeAction deserialization"; argument.beginStructure(); int flag1, flag2; argument >> data.m_fstype diff --git a/basestruct/luksstruct.cpp b/basestruct/luksstruct.cpp index d77f537..efa1897 100644 --- a/basestruct/luksstruct.cpp +++ b/basestruct/luksstruct.cpp @@ -4,38 +4,48 @@ // SPDX-License-Identifier: GPL-3.0-only #include "luksstruct.h" + +#include + /*********************************** CRYPT_CIPHER_Support *********************************************/ bool CRYPT_CIPHER_Support::supportDecrypt(CRYPT_CIPHER_Support::Support x) { + qDebug() << "Checking decrypt support for cipher type:" << x; return (supportAllcrypt(x) || (((x) & 0xFFFF) == (CRYPT_CIPHER_Support::Support::DECRYPT))); } bool CRYPT_CIPHER_Support::supportEncrypt(CRYPT_CIPHER_Support::Support x) { + qDebug() << "Checking encrypt support for cipher type:" << x; return (supportAllcrypt(x) || (((x) & 0xFFFF) == (CRYPT_CIPHER_Support::Support::ENCRYPT))); } bool CRYPT_CIPHER_Support::notSupportCrypt(CRYPT_CIPHER_Support::Support x) { + qDebug() << "Checking no support for cipher type:" << x; return ((x) & 0xFFFF) == (CRYPT_CIPHER_Support::Support::NOT_SUPPORT); } bool CRYPT_CIPHER_Support::supportAllcrypt(CRYPT_CIPHER_Support::Support x) { + qDebug() << "Checking all crypt support for cipher type:" << x; return ((x) & 0xFFFF) == (CRYPT_CIPHER_Support::Support::CRYPT_ALL); } QDBusArgument &operator<<(QDBusArgument &argument, const CRYPT_CIPHER_Support &data) { + qDebug() << "Starting CRYPT_CIPHER_Support serialization"; argument.beginStructure(); argument << static_cast(data.aes_xts_plain64) << static_cast(data.sm4_xts_plain64); argument.endStructure(); + qDebug() << "Completed CRYPT_CIPHER_Support serialization"; return argument; } const QDBusArgument &operator>>(const QDBusArgument &argument, CRYPT_CIPHER_Support &data) { + qDebug() << "Starting CRYPT_CIPHER_Support deserialization"; argument.beginStructure(); int aes, sm4; argument >> aes @@ -43,11 +53,13 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, CRYPT_CIPHER_Supp data.aes_xts_plain64 = static_cast(aes); data.sm4_xts_plain64 = static_cast(sm4); argument.endStructure(); + qDebug() << "Completed CRYPT_CIPHER_Support deserialization"; return argument; } /*********************************** LUKS_MapperInfo *********************************************/ QDBusArgument &operator<<(QDBusArgument &argument, const LUKS_MapperInfo &data) { + qDebug() << "Starting LUKS_MapperInfo serialization"; argument.beginStructure(); argument << static_cast(data.m_luksFs) << data.m_mountPoints @@ -67,11 +79,13 @@ QDBusArgument &operator<<(QDBusArgument &argument, const LUKS_MapperInfo &data) << data.m_fsLimits.min_size << data.m_fileSystemLabel; argument.endStructure(); + qDebug() << "Completed LUKS_MapperInfo serialization"; return argument; } const QDBusArgument &operator>>(const QDBusArgument &argument, LUKS_MapperInfo &data) { + qDebug() << "Starting LUKS_MapperInfo deserialization"; argument.beginStructure(); int luksFlag, vgFlag, cipher; argument >> luksFlag @@ -95,11 +109,13 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, LUKS_MapperInfo & data.m_vgflag = static_cast(vgFlag); data.m_crypt = static_cast(cipher); argument.endStructure(); + qDebug() << "Completed LUKS_MapperInfo deserialization"; return argument; } /*********************************** LUKS_INFO *********************************************/ QDBusArgument &operator<<(QDBusArgument &argument, const LUKS_INFO &data) { + qDebug() << "Starting LUKS_INFO serialization"; argument.beginStructure(); argument << data.m_mapper << data.m_devicePath @@ -116,11 +132,13 @@ QDBusArgument &operator<<(QDBusArgument &argument, const LUKS_INFO &data) << data.m_Suspend << data.m_fileSystemLabel; argument.endStructure(); + qDebug() << "Completed LUKS_INFO serialization"; return argument; } const QDBusArgument &operator>>(const QDBusArgument &argument, LUKS_INFO &data) { + qDebug() << "Starting LUKS_INFO deserialization"; argument.beginStructure(); int crypt, cryptErr; argument >> data.m_mapper @@ -140,22 +158,26 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, LUKS_INFO &data) data.m_crypt = static_cast(crypt); data.m_cryptErr = static_cast(cryptErr); argument.endStructure(); + qDebug() << "Completed LUKS_INFO deserialization"; return argument; } /*********************************** LUKSMap ************************************************/ QDBusArgument &operator<<(QDBusArgument &argument, const LUKSMap &data) { + qDebug() << "Starting LUKSMap serialization"; argument.beginStructure(); argument << data.m_luksMap << data.m_mapper << static_cast(data.m_cryErr) << data.m_cryptSuuport; argument.endStructure(); + qDebug() << "Completed LUKSMap serialization"; return argument; } const QDBusArgument &operator>>(const QDBusArgument &argument, LUKSMap &data) { + qDebug() << "Starting LUKSMap deserialization"; argument.beginStructure(); int cryptErr; argument >> data.m_luksMap @@ -164,47 +186,63 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, LUKSMap &data) >> data.m_cryptSuuport; data.m_cryErr = static_cast(cryptErr); argument.endStructure(); + qDebug() << "Completed LUKSMap deserialization"; return argument; } LUKSMap::LUKSMap() { - + qDebug() << "LUKSMap object created"; } bool LUKSMap::mapperExists(const QString &path) const { + qDebug() << "Checking mapper existence for path:" << path; if (itemExists(path, m_mapper)) { + qDebug() << "Mapper exists for path:" << path; return true; } - + foreach (const LUKS_MapperInfo &tmp, m_mapper) { if (tmp.m_dmPath == path) { return true; } } - return false; + qDebug() << "Mapper does not exist for path:" << path; + return false; } QString LUKSMap::getMapperPath(const QString &devPath) const { - return getItem(devPath, m_mapper).m_dmPath; + qDebug() << "Getting mapper path for device:" << devPath; + QString mapperPath = getItem(devPath, m_mapper).m_dmPath; + qDebug() << "Mapper path for device" << devPath << "is:" << mapperPath; + return mapperPath; } QString LUKSMap::getDevPath(const QString &mapper) const { - return getMapper(mapper).m_devicePath; + qDebug() << "Getting device path for mapper:" << mapper; + QString devPath = getMapper(mapper).m_devicePath; + qDebug() << "Device path for mapper" << mapper << "is:" << devPath; + return devPath; } bool LUKSMap::mapperOfDevice(const QString &mapper, const QString &dev) const { - return mapperExists(mapper) ? getMapper(mapper).m_devicePath == dev : false; + qDebug() << "Checking if mapper" << mapper << "belongs to device" << dev; + bool isMatch = mapperExists(mapper) ? getMapper(mapper).m_devicePath == dev : false; + qDebug() << "Mapper" << mapper << (isMatch ? "matches" : "does not match") << "device" << dev; + return isMatch; } bool LUKSMap::deviceExists(const QString &dev) const { - return itemExists(dev, m_luksMap); + qDebug() << "Checking device existence:" << dev; + bool exists = itemExists(dev, m_luksMap); + qDebug() << "Device" << dev << (exists ? "exists" : "does not exist") << "in LUKS map"; + return exists; } LUKS_MapperInfo LUKSMap::getMapper(const QString &path) const @@ -214,7 +252,8 @@ LUKS_MapperInfo LUKSMap::getMapper(const QString &path) const return tmp; } } - return LUKS_MapperInfo(); + qDebug() << "No mapper found for path:" << path; + return LUKS_MapperInfo(); } LUKS_MapperInfo LUKSMap::getMapper(const LUKS_MapperInfo &mapper) const @@ -225,7 +264,9 @@ LUKS_MapperInfo LUKSMap::getMapper(const LUKS_MapperInfo &mapper) const bool LUKSMap::luksExists(const QString &devPath) const { - return itemExists(devPath, m_luksMap); + bool exists = itemExists(devPath, m_luksMap); + qDebug() << "LUKS" << (exists ? "exists" : "does not exist") << "for device path:" << devPath; + return exists; } LUKS_INFO LUKSMap::getLUKS(const QString &path) const diff --git a/basestruct/lvmstruct.cpp b/basestruct/lvmstruct.cpp index 0d2ff24..fffe8ab 100644 --- a/basestruct/lvmstruct.cpp +++ b/basestruct/lvmstruct.cpp @@ -3,6 +3,9 @@ // SPDX-License-Identifier: GPL-3.0-only #include "lvmstruct.h" + +#include + /*********************************** PVData *********************************************/ bool PVData::operator<(const PVData &tmp) const { @@ -343,16 +346,19 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, VGInfo &data) LVInfo VGInfo::getLVinfo(const QString &lvName) { + qDebug() << "VGInfo::getLVinfo - Enter, lvName:" << lvName; foreach (const LVInfo &info, m_lvlist) { if (info.m_lvName == lvName) { return info; } } - return LVInfo(); + qDebug() << "VGInfo::getLVinfo - Exit, lvName:" << lvName << "not found"; + return LVInfo(); } bool VGInfo::lvInfoExists(const QString &lvName) { + qDebug() << "VGInfo::lvInfoExists - Checking lvName:" << lvName; foreach (const LVInfo &info, m_lvlist) { if (info.m_lvName == lvName) { return true; @@ -397,16 +403,19 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, LVMInfo &data) LVInfo LVMInfo::getLVInfo(const QString &lvPath) { + qDebug() << "LVMInfo::getLVInfo - Enter, lvPath:" << lvPath; // /dev/vg01/lv01 Or /dev/mapper/vg01-lv01 QStringList list = lvPath.split("/"); list.pop_front(); if (list.count() < 3) { + qWarning() << "LVMInfo::getLVInfo - Invalid lvPath format:" << lvPath; return LVInfo(); } if (lvPath.contains("/dev/mapper/")) { QStringList list2 = list[2].split("-"); if (!vgExists(list2[0])) { + qWarning() << "LVMInfo::getLVInfo - VG not found for lvPath:" << lvPath; return LVInfo(); } @@ -416,6 +425,7 @@ LVInfo LVMInfo::getLVInfo(const QString &lvPath) return lv; } } + qWarning() << "LVMInfo::getLVInfo - LV not found in mapper path:" << lvPath; return LVInfo(); } return getLVInfo(list[1], list[2]); @@ -423,9 +433,11 @@ LVInfo LVMInfo::getLVInfo(const QString &lvPath) LVInfo LVMInfo::getLVInfo(const QString &vgName, const QString &lvName) { + qDebug() << "LVMInfo::getLVInfo - Enter, vgName:" << vgName << "lvName:" << lvName; //判断lv是否存在 auto it = m_vgInfo.find(vgName); if (m_vgInfo.end() == it) { + qWarning() << "LVMInfo::getLVInfo - VG not found:" << vgName; return LVInfo(); } return it.value().getLVinfo(lvName); @@ -433,6 +445,7 @@ LVInfo LVMInfo::getLVInfo(const QString &vgName, const QString &lvName) VGInfo LVMInfo::getVG(const QString &vgName) { + qDebug() << "LVMInfo::getVG - Enter, vgName:" << vgName; return getItem(vgName, m_vgInfo); } @@ -452,6 +465,7 @@ VGInfo LVMInfo::getVG(const PVInfo &pv) PVInfo LVMInfo::getPV(const QString &pvPath) { + qDebug() << "LVMInfo::getPV - Enter, pvPath:" << pvPath; return getItem(pvPath, m_pvInfo); } @@ -505,9 +519,11 @@ QVector LVMInfo::getVGPVList(const QString &vgName, bool isUsed) bool LVMInfo::lvInfoExists(const QString &vgName, const QString &lvName) { + qDebug() << "LVMInfo::lvInfoExists - Enter, vgName:" << vgName << "lvName:" << lvName; //判断lv是否存在 auto it = m_vgInfo.find(vgName); if (m_vgInfo.end() == it) { + qDebug() << "LVMInfo::lvInfoExists - VG not found:" << vgName; return false; } return it.value().lvInfoExists(lvName); @@ -515,15 +531,18 @@ bool LVMInfo::lvInfoExists(const QString &vgName, const QString &lvName) bool LVMInfo::lvInfoExists(const QString &lvPath) { + qDebug() << "LVMInfo::lvInfoExists - Enter, lvPath:" << lvPath; QStringList list = lvPath.split("/"); list.pop_front(); if (list.count() < 3) { + qWarning() << "LVMInfo::lvInfoExists - Invalid lvPath format:" << lvPath; return false; } if (lvPath.contains("/dev/mapper/")) { QStringList list2 = list[2].split("-"); if (!vgExists(list2[0])) { + qWarning() << "LVMInfo::lvInfoExists - VG not found in mapper path:" << lvPath; return false; } @@ -533,6 +552,7 @@ bool LVMInfo::lvInfoExists(const QString &lvPath) return true; } } + qWarning() << "LVMInfo::lvInfoExists - LV not found in mapper path:" << lvPath; return false; } return lvInfoExists(list[1], list[2]); @@ -540,11 +560,13 @@ bool LVMInfo::lvInfoExists(const QString &lvPath) bool LVMInfo::vgExists(const QString &vgName) { + qDebug() << "LVMInfo::vgExists - Checking vgName:" << vgName; return itemExists(vgName, m_vgInfo); } bool LVMInfo::pvExists(const QString &pvPath) { + qDebug() << "LVMInfo::pvExists - Checking pvPath:" << pvPath; return itemExists(pvPath, m_pvInfo); } diff --git a/basestruct/partitioninfo.cpp b/basestruct/partitioninfo.cpp index 09fdea3..b879c80 100644 --- a/basestruct/partitioninfo.cpp +++ b/basestruct/partitioninfo.cpp @@ -6,12 +6,14 @@ #include "partitioninfo.h" #include +#include PartitionInfo::PartitionInfo() : m_insideExtended(false) , m_busy(false) , m_fileSystemReadOnly(false) { + qDebug() << "PartitionInfo constructor"; //inside_extended = busy = fs_readonly = false; m_devicePath = m_uuid = m_name = m_path = m_fileSystemLabel = ""; m_partitionNumber = m_type = m_status = m_alignment = m_fileSystemType = 0; @@ -23,6 +25,7 @@ PartitionInfo::PartitionInfo() Sector PartitionInfo::getSectorLength() const { + qDebug() << "PartitionInfo::getSectorLength"; if (m_sectorStart >= 0 && m_sectorEnd >= 0) return m_sectorEnd - m_sectorStart + 1; else @@ -31,6 +34,7 @@ Sector PartitionInfo::getSectorLength() const Byte_Value PartitionInfo::getByteLength() const { + qDebug() << "PartitionInfo::getByteLength"; if (getSectorLength() >= 0) return getSectorLength() * m_sectorSize; else @@ -39,12 +43,15 @@ Byte_Value PartitionInfo::getByteLength() const bool PartitionInfo::operator==(const PartitionInfo &info) const { + qDebug() << "PartitionInfo::operator=="; return m_devicePath == info.m_devicePath && m_partitionNumber == info.m_partitionNumber && m_sectorStart == info.m_sectorStart && m_type == info.m_type; } QDBusArgument &operator<<(QDBusArgument &argument, const PartitionInfo &info) { + qDebug() << "Starting PartitionInfo serialization"; argument.beginStructure(); + qDebug() << "Serializing PartitionInfo fields"; argument << info.m_devicePath << info.m_partitionNumber << info.m_type @@ -79,13 +86,15 @@ QDBusArgument &operator<<(QDBusArgument &argument, const PartitionInfo &info) << info.m_decryptStr << info.m_dmName;; argument.endStructure(); - + qDebug() << "Completed PartitionInfo serialization"; return argument; } const QDBusArgument &operator>>(const QDBusArgument &argument, PartitionInfo &info) { + qDebug() << "Starting PartitionInfo deserialization"; argument.beginStructure(); + qDebug() << "Deserializing PartitionInfo fields"; int flag = 0; int flag2 = 0; int crypt = 0; @@ -126,6 +135,6 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, PartitionInfo &in info.m_luksFlag = static_cast(flag2); info.m_crypt = static_cast(crypt); argument.endStructure(); - + qDebug() << "Completed PartitionInfo deserialization"; return argument; } diff --git a/basestruct/utils.cpp b/basestruct/utils.cpp index 99dfafc..060e776 100644 --- a/basestruct/utils.cpp +++ b/basestruct/utils.cpp @@ -19,6 +19,7 @@ Utils::Utils() { + qDebug() << "Utils constructor"; } QString Utils::findProgramInPath(const QString &proName) @@ -327,6 +328,8 @@ const QString Utils::fileSystemTypeToString(FSType type) FSType Utils::stringToFileSystemType(const QString &fileSystemName) { + qDebug() << "Utils::stringToFileSystemType - Converting:" << fileSystemName; + qDebug() << "Input filesystem name:" << fileSystemName; FSType type = FS_UNKNOWN; if (fileSystemName == "extended") type = FS_EXTENDED; @@ -389,11 +392,13 @@ FSType Utils::stringToFileSystemType(const QString &fileSystemName) else if (fileSystemName == "adaptec_raid_member" || fileSystemName == "ddf_raid_member" || fileSystemName == "hpt45x_raid_member" || fileSystemName == "hpt37x_raid_member" || fileSystemName == "isw_raid_member" || fileSystemName == "jmicron_raid_member" || fileSystemName == "lsi_mega_raid_member" || fileSystemName == "nvidia_raid_member" || fileSystemName == "promise_fasttrack_raid_member" || fileSystemName == "silicon_medley_raid_member" || fileSystemName == "via_raid_member") type = FS_ATARAID; + qDebug() << "Converted filesystem type:" << type; return type; } int Utils::getMountedFileSystemUsage(const QString &mountpoint, Byte_Value &fileSystemSize, Byte_Value &fileSystemFree) { + qDebug() << "Utils::getMountedFileSystemUsage - Checking:" << mountpoint; struct statvfs sfs; int ret; ret = statvfs(mountpoint.toStdString().c_str(), &sfs); @@ -401,6 +406,7 @@ int Utils::getMountedFileSystemUsage(const QString &mountpoint, Byte_Value &file fileSystemSize = static_cast(sfs.f_blocks) * sfs.f_frsize; fileSystemFree = static_cast(sfs.f_bfree) * sfs.f_bsize; } else { + qWarning() << "Utils::getMountedFileSystemUsage - Failed for:" << mountpoint << "Error:" << errno; QString errorMessage("statvfs(\"%1\"):%2 "); // = "statvfs(\"" + mountpoint + "\"): " + Glib::strerror(errno) ; errorMessage = errorMessage.arg(mountpoint).arg(errno); // qDebug() << errorMessage; @@ -461,6 +467,7 @@ QString Utils::getFileSystemSoftWare(FSType fileSystemType) QString Utils::formatSize(Sector sectors, Byte_Value sectorSize) { + qDebug() << "Utils::formatSize - Formatting size for sectors:" << sectors << "sectorSize:" << sectorSize; QString res; if ((sectors * sectorSize) < KIBIBYTE) { res = res.setNum(sectorToUnit(sectors, sectorSize, UNIT_BYTE), 'f', 2); @@ -665,11 +672,13 @@ CRYPT_CIPHER Utils::getCipher(QString cipher) bool Utils::kernelSupportFS(const QString &fsType) { + qDebug() << "Utils::kernelSupportFS - Checking support for:" << fsType; bool supported = false; QFile file("/proc/filesystems"); if (file.open(QIODevice::ReadOnly)) { QString info = file.readAll(); if (info.contains(fsType)) { + qDebug() << "Utils::kernelSupportFS - Supported:" << fsType; supported = true; } file.close(); @@ -679,6 +688,7 @@ bool Utils::kernelSupportFS(const QString &fsType) QString Utils::mkTempDir(const QString &infix) { + qDebug() << "Utils::mkTempDir - Creating temp dir with infix:" << infix; // Construct template like "/var/tmp/diskmanager-XXXXXX" or "/var/tmp/diskmanager-INFIX-XXXXXX" QString dirTemplate = "/var/tmp/"; @@ -688,24 +698,32 @@ QString Utils::mkTempDir(const QString &infix) dirTemplate += "XXXXXX" ; QDir dir(dirTemplate); if (!dir.exists() && dir.mkpath(dirTemplate)) { + qDebug() << "Utils::mkTempDir - Created temp dir:" << dirTemplate; return dirTemplate; } + qDebug() << "Utils::mkTempDir - Using existing temp dir:" << dirTemplate; return dirTemplate; } void Utils::rmTempDir(QString &dirName) { + qDebug() << "Utils::rmTempDir - Removing temp dir:" << dirName; QDir dir(dirName); if (dir.exists()) { dir.remove(dirName); + qDebug() << "Utils::rmTempDir - Removed temp dir:" << dirName; + } else { + qDebug() << "Utils::rmTempDir - Temp dir does not exist:" << dirName; } } QString Utils::readContent(const QString &filename) { + qDebug() << "Utils::readContent - Reading file:" << filename; QString ret; QFile file(filename); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { + qDebug() << "Utils::readContent - Successfully read:" << filename; ret = file.readAll(); file.close(); } @@ -714,6 +732,7 @@ QString Utils::readContent(const QString &filename) int Utils::executCmd(const QString &strCmd) { + qDebug() << "Utils::executCmd - Executing:" << strCmd; QProcess proc; proc.setProgram(strCmd); proc.start(QIODevice::ReadWrite); diff --git a/service/PolicyKitHelper.cpp b/service/PolicyKitHelper.cpp index 34fe330..8fc2d62 100755 --- a/service/PolicyKitHelper.cpp +++ b/service/PolicyKitHelper.cpp @@ -11,25 +11,31 @@ bool PolicyKitHelper::checkAuthorization(const QString& actionId, const QString& appBusName) { - if (appBusName.isEmpty()) + if (appBusName.isEmpty()) { + qWarning() << "Empty appBusName provided for authorization check"; return false; + } Authority::Result result; result = Authority::instance()->checkAuthorizationSync(actionId, SystemBusNameSubject(appBusName), Authority::AllowUserInteraction); if (result == Authority::Yes) { + qDebug() << "Authorization granted for action:" << actionId; return true; - }else { + } else { + qWarning() << "Authorization denied for action:" << actionId; return false; } } PolicyKitHelper::PolicyKitHelper() { + qDebug() << "PolicyKitHelper instance created"; } PolicyKitHelper::~PolicyKitHelper() { + qDebug() << "PolicyKitHelper instance destroyed"; } diff --git a/service/diskmanagerservice.cpp b/service/diskmanagerservice.cpp index 50368cc..3618005 100644 --- a/service/diskmanagerservice.cpp +++ b/service/diskmanagerservice.cpp @@ -17,6 +17,7 @@ DiskManagerService::DiskManagerService(const QString &frontEndDBusName, QObject , m_partedcore(new PartedCore(this)) , m_frontEndDBusName(frontEndDBusName) { + qDebug() << "Initializing DiskManagerService with frontEndDBusName:" << frontEndDBusName; initConnection(); } @@ -77,8 +78,10 @@ void DiskManagerService::Start() DeviceInfo DiskManagerService::getDeviceinfo() { - if (!checkAuthorization()) + if (!checkAuthorization()) { + qWarning() << "Authorization failed for getDeviceinfo"; return DeviceInfo(); + } QString msg = "DiskManagerService::getDeviceinfo"; Q_EMIT MessageReport(msg); @@ -166,9 +169,12 @@ QStringList DiskManagerService::getallsupportfs() bool DiskManagerService::format(const QString &fstype, const QString &name) { - if (!checkAuthorization()) + if (!checkAuthorization()) { + qWarning() << "Authorization failed for format operation"; return false; + } + qDebug() << "Formatting with filesystem:" << fstype << "name:" << name; return m_partedcore->format(fstype, name); } @@ -387,12 +393,15 @@ int DiskManagerService::test() bool DiskManagerService::checkAuthorization(void) { QString actionId("com.deepin.diskmanager"); + QString serviceName = message().service(); - if (message().service() == m_frontEndDBusName || - connection().interface()->serviceUid(message().service()).value() == 0 || - PolicyKitHelper::instance()->checkAuthorization(actionId, message().service())) { + if (serviceName == m_frontEndDBusName || + connection().interface()->serviceUid(serviceName).value() == 0 || + PolicyKitHelper::instance()->checkAuthorization(actionId, serviceName)) { + qDebug() << "Authorization granted for service:" << serviceName; return true; } else { + qWarning() << "Authorization denied for service:" << serviceName; sendErrorReply(QDBusError::AccessDenied); return false; } diff --git a/service/diskoperation/DeviceStorage.cpp b/service/diskoperation/DeviceStorage.cpp index 131bdce..9c1615e 100755 --- a/service/diskoperation/DeviceStorage.cpp +++ b/service/diskoperation/DeviceStorage.cpp @@ -15,14 +15,16 @@ DeviceStorage::DeviceStorage() : m_model(""), m_vendor(""), m_mediaType(""), m_size(""), m_rotationRate(""), m_interface("") , m_serialNumber(""), m_version(""), m_capabilities(""), m_description(""), m_KeyToLshw(""), m_KeyFromStorage("") { - + qDebug() << "DeviceStorage object created"; } bool DeviceStorage::setHwinfoInfo(const QMap &mapInfo) { + qDebug() << "Setting hwinfo info for storage device"; // 龙芯机器中 hwinfo --disk会列出所有的分区信息 // 存储设备不应包含分区,根据SysFS BusID 来确定是否是分区信息 if (mapInfo.find("SysFS BusID") == mapInfo.end()) { + qWarning() << "No SysFS BusID found in hwinfo info"; return false; } setAttribute(mapInfo, "Model", m_model); @@ -61,6 +63,7 @@ bool DeviceStorage::setHwinfoInfo(const QMap &mapInfo) setAttribute(mapInfo, "SysFS BusID", m_KeyToLshw); setAttribute(mapInfo, "Device File", m_DeviceFile); + qDebug() << "Hwinfo info set successfully for device:" << m_DeviceFile; return true; } @@ -120,10 +123,11 @@ bool DeviceStorage::setKLUHwinfoInfo(const QMap &mapInfo) bool DeviceStorage::addInfoFromlshw(const QMap &mapInfo) { - + qDebug() << "Adding lshw info for storage device"; // 先获取需要进行匹配的关键字 QStringList keys = mapInfo["bus info"].split("@"); if (keys.size() != 2) { + qWarning() << "Invalid bus info format:" << mapInfo["bus info"]; return false; } QString key = keys[1].trimmed(); @@ -144,6 +148,7 @@ bool DeviceStorage::addInfoFromlshw(const QMap &mapInfo) // 获取基本信息 getInfoFromLshw(mapInfo); + qDebug() << "Lshw info added successfully"; return true; } @@ -218,7 +223,7 @@ void DeviceStorage::getInfoFromLshw(const QMap &mapInfo) void DeviceStorage::getInfoFromsmartctl(const QMap &mapInfo) { -// qDebug() << mapInfo << endl; + qDebug() << "Getting smartctl info for storage device"; // 固件版本 m_firmwareVersion = mapInfo["Firmware Version"]; @@ -285,9 +290,11 @@ void DeviceStorage::getInfoFromsmartctl(const QMap &mapInfo) void DeviceStorage::setAttribute(const QMap &mapInfo, const QString &key, QString &variable, bool overwrite) { if (mapInfo.find(key) == mapInfo.end()) { + qDebug() << "Key not found in map:" << key; return; } if (mapInfo[key] == "") { + qDebug() << "Empty value for key:" << key; return; } if (overwrite) { @@ -305,6 +312,7 @@ void DeviceStorage::setAttribute(const QMap &mapInfo, const QS bool DeviceStorage::getDiskInfoFromHwinfo(const QString &devicePath) { + qDebug() << "Getting disk info from hwinfo for device:" << devicePath; QString cmd = QString("hwinfo --disk --only %1").arg(devicePath); QProcess proc; proc.start(cmd); @@ -322,6 +330,7 @@ bool DeviceStorage::getDiskInfoFromHwinfo(const QString &devicePath) if (!cid.isEmpty()) { m_serialNumber = cid; } + qDebug() << "Successfully got disk info from hwinfo"; return true; } diff --git a/service/diskoperation/blockspecial.cpp b/service/diskoperation/blockspecial.cpp index a7f719c..3fc2c73 100644 --- a/service/diskoperation/blockspecial.cpp +++ b/service/diskoperation/blockspecial.cpp @@ -18,6 +18,7 @@ #include "blockspecial.h" #include +#include #include #include @@ -45,6 +46,7 @@ BlockSpecial::BlockSpecial() , m_major(0UL) , m_minor(0UL) { + qDebug() << "BlockSpecial object created with empty name"; } BlockSpecial::BlockSpecial(const QString &name) @@ -52,6 +54,7 @@ BlockSpecial::BlockSpecial(const QString &name) , m_major(0UL) , m_minor(0UL) { + qDebug() << "BlockSpecial object created for device:" << name; MMNumberMapping::const_iterator mmNumIter = mmNumberCache.find(name); if (mmNumIter != mmNumberCache.end()) { // Use already cached major, minor pair @@ -76,15 +79,18 @@ BlockSpecial::BlockSpecial(const QString &name) BlockSpecial::~BlockSpecial() { + qDebug() << "BlockSpecial object destroyed for device:" << m_name; } void BlockSpecial::clearCache() { + qDebug() << "Clearing block device number cache"; mmNumberCache.clear(); } void BlockSpecial::registerBlockSpecial(const QString &name, unsigned long major, unsigned long minor) { + qDebug() << "Registering block device:" << name << "with major:" << major << "minor:" << minor; MmNumber pair; pair.m_major = major; pair.m_minor = minor; diff --git a/service/diskoperation/device.cpp b/service/diskoperation/device.cpp index b6cdf56..e51add5 100644 --- a/service/diskoperation/device.cpp +++ b/service/diskoperation/device.cpp @@ -10,6 +10,7 @@ namespace DiskManager { Device::Device() { + qDebug() << "Initializing Device object with DBus type registrations"; qDBusRegisterMetaType(); qDBusRegisterMetaType(); qDBusRegisterMetaType(); @@ -53,8 +54,10 @@ void Device::enablePartitionNaming(int length) { if (length > 0) { m_maxPartitionNameLength = length; + qDebug() << "Enabled partition naming with max length:" << length; } else { m_maxPartitionNameLength = 0; + qDebug() << "Disabled partition naming"; } } @@ -87,10 +90,10 @@ DeviceInfo Device::getDeviceInfo() info.m_interface = m_interface; info.m_mediaType = m_mediaType; -// qDebug() << __FUNCTION__ << info.m_path << info.length << info.heads << info.sectors -// << info.cylinders << info.cylsize << info.model << info.serial_number << info.disktype -// << info.sector_size << info.max_prims << info.highest_busy << info.readonly -// << info.max_partition_name_length; + qDebug() << "Retrieving device info - Path:" << info.m_path + << "Length:" << info.m_length + << "SectorSize:" << info.m_sectorSize + << "MaxPrims:" << info.m_maxPrims; return info; } diff --git a/service/diskoperation/filesystems/btrfs.cpp b/service/diskoperation/filesystems/btrfs.cpp index 91f5003..5557cfc 100644 --- a/service/diskoperation/filesystems/btrfs.cpp +++ b/service/diskoperation/filesystems/btrfs.cpp @@ -5,6 +5,7 @@ #include "btrfs.h" #include "fsinfo.h" #include +#include namespace DiskManager { @@ -18,6 +19,7 @@ std::map btrfs_device_cache; FS Btrfs::getFilesystemSupport() { + qDebug() << "Checking Btrfs filesystem support"; FS fs(FS_BTRFS); fs.busy = FS::GPARTED ; @@ -67,6 +69,7 @@ FS Btrfs::getFilesystemSupport() void Btrfs::setUsedSectors(Partition &partition) { + qDebug() << "Setting used sectors for partition:" << partition.getPath(); QString output, error; Utils::executCmd(QString("btrfs filesystem show %1").arg(partition.getPath()), output, error); @@ -121,6 +124,7 @@ void Btrfs::setUsedSectors(Partition &partition) void Btrfs::readLabel(Partition &partition) { + qDebug() << "Reading label for partition:" << partition.getPath(); QString output, error; Utils::executCmd(QString("btrfs filesystem show %1").arg(partition.getPath()), output, error); @@ -141,6 +145,8 @@ void Btrfs::readLabel(Partition &partition) bool Btrfs::writeLabel(const Partition &partition) { + qDebug() << "Writing label for partition:" << partition.getPath() + << "new label:" << partition.getFileSystemLabel(); QString output, error; if (partition.m_busy) Utils::executCmd(QString("umount -v %1").arg(partition.getPath()), output, error); @@ -156,6 +162,7 @@ bool Btrfs::writeLabel(const Partition &partition) void Btrfs::readUuid(Partition &partition) { + qDebug() << "Reading UUID for partition:" << partition.getPath(); QString output, error; auto exitCode = Utils::executCmd(QString("btrfs filesystem show %1").arg(partition.getPath()), output, error); //In many cases the exit status doesn't reflect valid output or an error condition @@ -169,6 +176,7 @@ void Btrfs::readUuid(Partition &partition) bool Btrfs::writeUuid(const Partition &partition) { + qInfo() << "Writing new UUID for partition:" << partition.getPath(); QString output, error; auto exitCode = Utils::executCmd(QString("btrfstune -f -u ").arg(partition.getPath()), output, error); return exitCode == 0; @@ -176,6 +184,8 @@ bool Btrfs::writeUuid(const Partition &partition) bool Btrfs::create(const Partition &new_partition) { + qDebug() << "Creating Btrfs filesystem on:" << new_partition.getPath() + << "with label:" << new_partition.getFileSystemLabel(); QString output, error; QString cmd; if (new_partition.getFileSystemLabel().isEmpty() || new_partition.getFileSystemLabel() == " ") { @@ -189,6 +199,8 @@ bool Btrfs::create(const Partition &new_partition) bool Btrfs::resize(const Partition &partitionNew, bool fillPartition) { + qDebug() << "Resizing Btrfs filesystem on:" << partitionNew.getPath() + << "fill partition:" << fillPartition; bool success = true ; QString path = partitionNew.getPath(); const BTRFS_Device& btrfsDev = getCacheEntry(path); @@ -251,6 +263,7 @@ bool Btrfs::resize(const QString &path, const QString &size, bool fillPartition) bool Btrfs::checkRepair(const Partition &partition) { + qDebug() << "Checking/repairing Btrfs filesystem on:" << partition.getPath(); QString path = partition.getPath(); return checkRepair(path); } diff --git a/service/diskoperation/filesystems/exfat.cpp b/service/diskoperation/filesystems/exfat.cpp index f4adfd8..7ac74af 100644 --- a/service/diskoperation/filesystems/exfat.cpp +++ b/service/diskoperation/filesystems/exfat.cpp @@ -4,10 +4,13 @@ #include "exfat.h" #include +#include + namespace DiskManager { FS ExFat::getFilesystemSupport() { + qDebug() << "Checking exFAT filesystem support"; FS fs(FS_EXFAT); fs.busy = FS::GPARTED; @@ -50,6 +53,7 @@ FS ExFat::getFilesystemSupport() void ExFat::setUsedSectors(DiskManager::Partition &partition) { + qDebug() << "Setting used sectors for exFAT partition:" << partition.getPath(); QString output, error; auto errCode = Utils::executCmd("dump.exfat ", output, error); // dump.exfat returns non-zero status for both success and failure. Instead use @@ -109,6 +113,7 @@ void ExFat::setUsedSectors(DiskManager::Partition &partition) void ExFat::readLabel(DiskManager::Partition &partition) { + qDebug() << "Reading label for exFAT partition:" << partition.getPath(); QString output, error; auto errCode = Utils::executCmd(QString("tune.exfat -l %1").arg(partition.getPath()), output, error); if (errCode != 0) { @@ -120,6 +125,8 @@ void ExFat::readLabel(DiskManager::Partition &partition) bool ExFat::writeLabel(const DiskManager::Partition &partition) { + qDebug() << "Writing label for exFAT partition:" << partition.getPath() + << "new label:" << partition.getFileSystemLabel(); QString cmd, output, error; if (!partition.getFileSystemLabel().isEmpty() && partition.getFileSystemLabel() != " ") { cmd = QString("tune.exfat -L %1 %2").arg(partition.getFileSystemLabel()).arg(partition.getPath()); @@ -131,6 +138,7 @@ bool ExFat::writeLabel(const DiskManager::Partition &partition) void ExFat::readUuid(DiskManager::Partition &partition) { + qDebug() << "Reading UUID for exFAT partition:" << partition.getPath(); QString output, error; auto errCode = Utils::executCmd(QString("tune.exfat -i %1").arg(partition.getPath()), output, error); if (errCode != 0) { @@ -142,6 +150,7 @@ void ExFat::readUuid(DiskManager::Partition &partition) bool ExFat::writeUuid(const DiskManager::Partition &partition) { + qDebug() << "Writing new UUID for exFAT partition:" << partition.getPath(); QString output, error; auto errCode = Utils::executCmd(QString("tune.exfat -I %1 %2") .arg(randomSerial()) @@ -151,6 +160,8 @@ bool ExFat::writeUuid(const DiskManager::Partition &partition) bool ExFat::create(const DiskManager::Partition &new_partition) { + qDebug() << "Creating exFAT filesystem on:" << new_partition.getPath() + << "with label:" << new_partition.getFileSystemLabel(); QString cmd, output, error; if (new_partition.getFileSystemLabel().isEmpty() || new_partition.getFileSystemLabel() == " ") { cmd = QString("mkfs.exfat %1").arg(new_partition.getPath()); @@ -179,6 +190,7 @@ bool DiskManager::ExFat::checkRepair(const DiskManager::Partition &partition) bool DiskManager::ExFat::checkRepair(const QString &devpath) { + qDebug() << "Checking/repairing exFAT filesystem on:" << devpath; QString output, error; auto errCode = Utils::executCmd(QString("fsck.exfat %1").arg(devpath), output, error); return errCode == 0; diff --git a/service/diskoperation/filesystems/ext2.cpp b/service/diskoperation/filesystems/ext2.cpp index 7a77c68..dbebd70 100644 --- a/service/diskoperation/filesystems/ext2.cpp +++ b/service/diskoperation/filesystems/ext2.cpp @@ -13,10 +13,12 @@ EXT2::EXT2(FSType type) : m_forceAuto64bit(false) , m_specificType(type) { + qDebug() << "EXT2/3/4 filesystem handler created for type:" << Utils::fileSystemTypeToString(type); } FS EXT2::getFilesystemSupport() { + qDebug() << "Checking ext2/3/4 filesystem support for type:" << Utils::fileSystemTypeToString(m_specificType); FS fs(m_specificType); fs.busy = FS::GPARTED; @@ -115,6 +117,7 @@ FS EXT2::getFilesystemSupport() void EXT2::setUsedSectors(Partition &partition) { + qDebug() << "Setting used sectors for ext2/3/4 partition:" << partition.getPath(); QString output, error, strmatch, strcmd; m_blocksSize = m_numOfFreeOrUsedBlocks = m_totalNumOfBlock = -1; strcmd = QString("dumpe2fs -h %1").arg(partition.getPath()); @@ -175,6 +178,7 @@ void EXT2::setUsedSectors(Partition &partition) void EXT2::readLabel(Partition &partition) { + qDebug() << "Reading label for ext2/3/4 partition:" << partition.getPath(); QString output, error; if (!Utils::executCmd(QString("e2label %1").arg(partition.getPath()), output, error)) { partition.setFilesystemLabel(output.trimmed()); @@ -184,6 +188,8 @@ void EXT2::readLabel(Partition &partition) bool EXT2::writeLabel(const Partition &partition) { + qDebug() << "Writing label for ext2/3/4 partition:" << partition.getPath() + << "new label:" << partition.getFileSystemLabel(); QString output, error; int exitcode = Utils::executCmd(QString("e2label %1 %2").arg(partition.getPath()).arg(partition.getFileSystemLabel()), output, error); // qDebug() << __FUNCTION__ << output << error; @@ -192,6 +198,7 @@ bool EXT2::writeLabel(const Partition &partition) void EXT2::readUuid(Partition &partition) { + qDebug() << "Reading UUID for ext2/3/4 partition:" << partition.getPath(); QString output, error; if (!Utils::executCmd(QString("tune2fs -l %1").arg(partition.getPath()), output, error)) { partition.m_uuid = Utils::regexpLabel(output, "(?<=Filesystem UUID:).*(?=\n)").trimmed(); @@ -201,6 +208,7 @@ void EXT2::readUuid(Partition &partition) bool EXT2::writeUuid(const Partition &partition) { + qDebug() << "Writing new UUID for ext2/3/4 partition:" << partition.getPath(); QString output, error; int exitcode = Utils::executCmd(QString("tune2fs -U random ").arg(partition.getPath()), output, error); return exitcode == 0 || error.compare("Unknown error") == 0; @@ -208,6 +216,8 @@ bool EXT2::writeUuid(const Partition &partition) bool EXT2::create(const Partition &new_partition) { + qDebug() << "Creating ext2/3/4 filesystem on:" << new_partition.getPath() + << "with label:" << new_partition.getFileSystemLabel(); QString features, output, error, cmd; if (m_forceAuto64bit) { // (#766910) Manually implement mke2fs.conf(5) auto_64-bit_support option @@ -269,6 +279,7 @@ bool EXT2::checkRepair(const Partition &partition) bool EXT2::checkRepair(const QString &devpath) { + qDebug() << "Checking/repairing ext2/3/4 filesystem on:" << devpath; QString output, error; int exitcode = Utils::executCmd(QString("e2fsck -f -y -v -C 0 %1").arg(devpath), output, error); // qDebug() << QString("EXT2::check_repair---%1----%2").arg(output).arg(error); diff --git a/service/diskoperation/filesystems/fat16.cpp b/service/diskoperation/filesystems/fat16.cpp index 4840e0b..a0df333 100644 --- a/service/diskoperation/filesystems/fat16.cpp +++ b/service/diskoperation/filesystems/fat16.cpp @@ -16,6 +16,7 @@ namespace DiskManager { FS FAT16::getFilesystemSupport() { + qDebug() << "Checking FAT16/FAT32 filesystem support"; FS fs(specificType); // hack to disable silly mtools warnings @@ -74,6 +75,7 @@ FS FAT16::getFilesystemSupport() void FAT16::setUsedSectors( Partition & partition ) { + qDebug() << "Setting used sectors for FAT partition:" << partition.getPath(); QString output, error, strmatch, strcmd; Sector logicalSectorSize,clusterSize,smallSize,bigSize; @@ -174,6 +176,7 @@ void FAT16::setUsedSectors( Partition & partition ) void FAT16::readLabel( Partition & partition ) { + qDebug() << "Reading label for FAT partition:" << partition.getPath(); QString output, error, filesystemLabel; QString partitionPath = partition.getPath().remove("/dev/"); if (!Utils::executCmd(QString("ls -l /dev/disk/by-label"), output, error)) { @@ -200,6 +203,8 @@ void FAT16::readLabel( Partition & partition ) bool FAT16::writeLabel(const Partition & partition) { + qDebug() << "Writing label for FAT partition:" << partition.getPath() + << "new label:" << partition.getFileSystemLabel(); QString output, error, cmd; if (partition.getFileSystemLabel().isEmpty() || partition.getFileSystemLabel() == " ") cmd = QString("mlabel -c :: -i %1").arg(partition.getPath()); @@ -216,6 +221,7 @@ bool FAT16::writeLabel(const Partition & partition) void FAT16::readUuid( Partition & partition ) { + qDebug() << "Reading UUID for FAT partition:" << partition.getPath(); QString output, error; QString cmd = QString("mdir -f :: -i %1").arg(partition.getPath()); @@ -229,7 +235,7 @@ void FAT16::readUuid( Partition & partition ) bool FAT16::writeUuid(const Partition & partition) { - + qDebug() << "Writing new UUID for FAT partition:" << partition.getPath(); QString output, error; int exitcode = Utils::executCmd(QString("mlabel -s -n :: -i ").arg(partition.getPath()), output, error); return exitcode == 0 || error.compare("Unknown error") == 0; @@ -237,6 +243,8 @@ bool FAT16::writeUuid(const Partition & partition) bool FAT16::create(const Partition & new_partition) { + qDebug() << "Creating FAT filesystem on:" << new_partition.getPath() + << "with label:" << new_partition.getFileSystemLabel(); QString output, error, cmd; QString fat_size = (specificType == FS_FAT16 ? "16" : "32"); int exitcode = -1; @@ -256,6 +264,7 @@ bool FAT16::checkRepair(const Partition & partition) bool FAT16::checkRepair(const QString &devpath) { + qDebug() << "Checking/repairing FAT filesystem on:" << devpath; QString output, error; int exitcode = Utils::executCmd(QString("fsck.fat -a -w -v %1").arg(devpath), output, error); // qDebug() << QString("EXT2::check_repair---%1----%2").arg(output).arg(error); diff --git a/service/diskoperation/filesystems/linuxswap.cpp b/service/diskoperation/filesystems/linuxswap.cpp index ea57315..e8e3876 100644 --- a/service/diskoperation/filesystems/linuxswap.cpp +++ b/service/diskoperation/filesystems/linuxswap.cpp @@ -27,6 +27,7 @@ namespace DiskManager { FS LinuxSwap::getFilesystemSupport() { + qDebug() << "Checking Linux swap filesystem support"; FS fs(FS_LINUX_SWAP); fs.busy = FS::GPARTED; @@ -54,6 +55,7 @@ FS LinuxSwap::getFilesystemSupport() void LinuxSwap::setUsedSectors(Partition &partition) { + qDebug() << "Setting used sectors for swap partition:" << partition.getPath(); if (partition.m_busy) { m_numOfFreeOrUsedBlocks = -1; QFile file("/proc/swaps"); @@ -87,6 +89,7 @@ void LinuxSwap::setUsedSectors(Partition &partition) void LinuxSwap::readLabel(Partition &partition) { + qDebug() << "Reading label for swap partition:" << partition.getPath(); QString output, error, label; Utils::executCmd(QString("swaplabel %1").arg(partition.getPath()), output, error); label = Utils::regexpLabel(output, "(?<=LABEL:).*(?=\n)"); @@ -97,6 +100,8 @@ void LinuxSwap::readLabel(Partition &partition) bool LinuxSwap::writeLabel(const Partition &partition) { + qDebug() << "Writing label for swap partition:" << partition.getPath() + << "new label:" << partition.getFileSystemLabel(); QString output, error; int exitcode = Utils::executCmd(QString("swaplabel -L %1 %2").arg(partition.getFileSystemLabel()).arg(partition.getPath()), output, error); @@ -105,6 +110,7 @@ bool LinuxSwap::writeLabel(const Partition &partition) void LinuxSwap::readUuid(Partition &partition) { + qDebug() << "Reading UUID for swap partition:" << partition.getPath(); QString output, error; Utils::executCmd(QString("swaplabel %1").arg(partition.getPath()), output, error); partition.m_uuid = Utils::regexpLabel(output, "(?<=UUID:).*(?=\n)"); @@ -112,6 +118,7 @@ void LinuxSwap::readUuid(Partition &partition) bool LinuxSwap::writeUuid(const Partition &partition) { + qDebug() << "Writing new UUID for swap partition:" << partition.getPath(); QString output, error; int exitcode = Utils::executCmd(QString("swaplabel -L %1 %2").arg(Utils::createUuid()).arg(partition.getPath()), output, error); @@ -120,6 +127,8 @@ bool LinuxSwap::writeUuid(const Partition &partition) bool LinuxSwap::create(const Partition &new_partition) { + qDebug() << "Creating swap partition on:" << new_partition.getPath() + << "with label:" << new_partition.getFileSystemLabel(); QString output, error; int exitcode = Utils::executCmd(QString("mkswap -L %1 %2").arg(new_partition.getFileSystemLabel()).arg(new_partition.getPath()), output, error); @@ -128,6 +137,8 @@ bool LinuxSwap::create(const Partition &new_partition) bool LinuxSwap::resize(const Partition &partitionNew, bool fillPartition) { + qDebug() << "Resizing swap partition:" << partitionNew.getPath() + << "fill partition:" << fillPartition; QString output, error; QString command = QString("mkswap -L %1 ").arg(partitionNew.getFileSystemLabel()); if (!partitionNew.m_uuid.isEmpty()) diff --git a/service/diskoperation/filesystems/ntfs.cpp b/service/diskoperation/filesystems/ntfs.cpp index e7ec77c..d62220c 100644 --- a/service/diskoperation/filesystems/ntfs.cpp +++ b/service/diskoperation/filesystems/ntfs.cpp @@ -12,6 +12,7 @@ namespace DiskManager { FS NTFS::getFilesystemSupport() { + qDebug() << "[NTFS]::getFilesystemSupport - Enter"; FS fs(FS_NTFS); fs.busy = FS::GPARTED; @@ -51,11 +52,13 @@ FS NTFS::getFilesystemSupport() // For GParted this means 2 MiB because smallest GUI unit is MiB. m_fsLimits.min_size = 2 * MEBIBYTE; + qDebug() << "[NTFS]::getFilesystemSupport - Exit"; return fs; } void NTFS::setUsedSectors( Partition & partition ) { + qDebug() << "[NTFS]::setUsedSectors - Enter"; QString output, error, strmatch; m_blocksSize = m_numOfFreeOrUsedBlocks = m_totalNumOfBlock = -1; @@ -93,37 +96,46 @@ void NTFS::setUsedSectors( Partition & partition ) partition.m_fsBlockSize = m_blocksSize; } + qDebug() << "[NTFS]::setUsedSectors - Exit"; } void NTFS::readLabel( Partition & partition ) { + qDebug() << "[NTFS]::readLabel - Enter"; QString output, error; if (!Utils::executCmd(QString("ntfslabel --force").arg(partition.getPath()), output, error)) { partition.setFilesystemLabel(output.trimmed()); } + qDebug() << "[NTFS]::readLabel - Exit"; } bool NTFS::writeLabel( const Partition & partition) { + qDebug() << "[NTFS]::writeLabel - Enter"; QString output, error; int exitcode = Utils::executCmd(QString("ntfslabel --force %1 %2").arg(partition.getPath()).arg(partition.getFileSystemLabel()), output, error); // qDebug() << __FUNCTION__ << output << error; return exitcode == 0; + qDebug() << "[NTFS]::writeLabel - Exit"; } void NTFS::readUuid(Partition & partition) { + qDebug() << "[NTFS]::readUuid - Enter/Exit"; } bool NTFS::writeUuid( const Partition & partition) { + qDebug() << "[NTFS]::writeUuid - Enter"; QString output, error; int exitcode = Utils::executCmd(QString("ntfslabel --new-serial ").arg(partition.getPath()), output, error); return exitcode == 0 || error.compare("Unknown error") == 0; + qDebug() << "[NTFS]::writeUuid - Exit"; } bool NTFS::create(const Partition & newPartition) { + qDebug() << "[NTFS]::create - Enter"; QString output, error; int exitcode = -1; if (newPartition.getFileSystemLabel().isEmpty() || newPartition.getFileSystemLabel() == " ") { @@ -180,11 +192,16 @@ bool NTFS::resize(const QString &path, const QString &sizeByte, bool fillPartiti bool NTFS::checkRepair(const Partition &partition) { - return checkRepair(partition.getPath()); + qDebug() << "[NTFS]::checkRepair - Enter"; + + bool result = checkRepair(partition.getPath()); + qDebug() << "[NTFS]::checkRepair - return " << result; + return result; } bool NTFS::checkRepair(const QString &devpath) { + qDebug() << "[NTFS]::checkRepair(path) - Enter"; QString output, error; int exitcode = Utils::executCmd(QString("ntfsresize -i -f -v %1").arg(devpath), output, error); // qDebug() << QString("NTFS::check_repair---%1----%2").arg(output).arg(error); diff --git a/service/diskoperation/filesystems/xfs.cpp b/service/diskoperation/filesystems/xfs.cpp index 27fcea1..3523abd 100644 --- a/service/diskoperation/filesystems/xfs.cpp +++ b/service/diskoperation/filesystems/xfs.cpp @@ -10,6 +10,7 @@ namespace DiskManager { FS XFS::getFilesystemSupport() { + qDebug() << "[XFS]::getFilesystemSupport - Enter"; FS fs(FS_XFS); fs.busy = FS::GPARTED; if (!Utils::findProgramInPath("xfs_db").isEmpty()) { @@ -41,12 +42,14 @@ FS XFS::getFilesystemSupport() fs.move = FS::GPARTED; fs.online_read = FS::GPARTED; + qDebug() << "[XFS]::getFilesystemSupport - Exit"; return fs; } void XFS::setUsedSectors(Partition &partition) { + qDebug() << "[XFS]::setUsedSectors - Enter"; QString output, error, strmatch, strcmd; m_blocksSize = m_numOfFreeOrUsedBlocks = m_totalNumOfBlock = -1; strcmd = QString("xfs_db -r -c \"sb 0\" -c \"print blocksize\" -c \"print dblocks\"" @@ -83,18 +86,22 @@ void XFS::setUsedSectors(Partition &partition) } else { qDebug() << __FUNCTION__ << "dumpe2fs -h failed :" << output << error; } + qDebug() << "[XFS]::setUsedSectors - Exit"; } void XFS::readLabel(Partition &partition) { + qDebug() << "[XFS]::readLabel - Enter"; QString output, error; if (!Utils::executCmd(QString("xfs_db -r -c label %1").arg(partition.getPath()), output, error)) { auto items = output.split("="); if (items.size() == 2) partition.setFilesystemLabel(items[1].replace("\"", "").trimmed()); } + qDebug() << "[XFS]::readLabel - Exit"; } bool XFS::writeLabel(const Partition &partition) { + qDebug() << "[XFS]::writeLabel - Enter"; QString cmd = ""; if (partition.getFileSystemLabel().isEmpty()) cmd = QString("xfs_admin -L -- %1").arg(partition.getPath()); @@ -103,22 +110,28 @@ bool XFS::writeLabel(const Partition &partition) QString output, error; int exitcode = Utils::executCmd(cmd, output, error); return exitcode == 0; + qDebug() << "[XFS]::writeLabel - Exit"; } void XFS::readUuid(Partition &partition) { + qDebug() << "[XFS]::readUuid - Enter"; QString output, error; if (!Utils::executCmd(QString("xfs_admin -u %1").arg(partition.getPath()), output, error)) { partition.m_uuid = Utils::regexpLabel(output, "^UUID[[:blank:]]*=[[:blank:]]*(" RFC4122_NONE_NIL_UUID_REGEXP ")"); } + qDebug() << "[XFS]::readUuid - Exit"; } bool XFS::writeUuid(const Partition &partition) { + qDebug() << "[XFS]::writeUuid - Enter"; QString output, error; int exitcode = Utils::executCmd(QString("xfs_admin -U generate %1").arg(partition.getPath()), output, error); return exitcode == 0 || error.compare("Unknown error") == 0; + qDebug() << "[XFS]::writeUuid - Exit"; } bool XFS::create(const Partition &newPartition) { + qDebug() << "[XFS]::create - Enter"; QString output, error; int exitcode = -1; if (newPartition.getFileSystemLabel().isEmpty() || newPartition.getFileSystemLabel().trimmed().isEmpty()) { @@ -178,6 +191,7 @@ bool XFS::checkRepair(const Partition &partition) } bool XFS::checkRepair(const QString &devpath) { + qDebug() << "[XFS]::checkRepair(path) - Enter"; QString output, error; int exitcode = Utils::executCmd(QString("xfs_repair -v %1").arg(devpath), output, error); return exitcode == 0 || error.compare("Unknown error") == 0; diff --git a/service/diskoperation/luksoperator/luksoperator.cpp b/service/diskoperation/luksoperator/luksoperator.cpp index b2c29fd..c90a18f 100644 --- a/service/diskoperation/luksoperator/luksoperator.cpp +++ b/service/diskoperation/luksoperator/luksoperator.cpp @@ -22,11 +22,12 @@ static const QString saveKeyPath = "/root/.deepin-diskmanager-service"; //ke LUKSOperator::LUKSOperator() { - + qDebug() << "LUKSOperator constructor called"; } bool LUKSOperator::updateLUKSInfo(DeviceInfoMap &dev, LVMInfo &lvmInfo, LUKSMap &luks) { + qDebug() << "Updating LUKS information"; m_dev = &dev; m_lvmInfo = &lvmInfo; resetLuksMap(luks); @@ -87,10 +88,12 @@ bool LUKSOperator::updateLUKSInfo(DeviceInfoMap &dev, LVMInfo &lvmInfo, LUKSMap bool LUKSOperator::encrypt(LUKSMap &luks, LUKS_INFO &luksInfo) { + qDebug() << "Starting encryption for device:" << luksInfo.m_devicePath; //判断参数是否正确 if (!(luksInfo.m_crypt == CRYPT_CIPHER::AES_XTS_PLAIN64 || luksInfo.m_crypt == CRYPT_CIPHER::SM4_XTS_PLAIN64) || luksInfo.m_devicePath.isEmpty() || luksInfo.m_decryptStr.isEmpty()) { + qWarning() << "Invalid arguments for encryption"; return setLUKSErr(luks, CRYPTError::CRYPT_ERR_ENCRYPT_ARGUMENT); } //加密 @@ -109,10 +112,12 @@ bool LUKSOperator::encrypt(LUKSMap &luks, LUKS_INFO &luksInfo) bool LUKSOperator::decrypt(LUKSMap &luks, LUKS_INFO &luksInfo) { + qDebug() << "Starting decryption for device:" << luksInfo.m_devicePath; //判断参数是否正确 if (luksInfo.m_mapper.m_dmName.isEmpty() || luksInfo.m_devicePath.isEmpty() || luksInfo.m_decryptStr.isEmpty()) { + qWarning() << "Invalid arguments for decryption"; return setLUKSErr(luks, CRYPTError::CRYPT_ERR_ENCRYPT_ARGUMENT); } @@ -476,6 +481,7 @@ bool LUKSOperator::isLUKS(QString devPath) bool LUKSOperator::format(const LUKS_INFO &luks) { + qInfo() << "Formatting device for LUKS:" << luks.m_devicePath << "with cipher:" << Utils::getCipherStr(luks.m_crypt); QString outPut, error; QString cmd = QString("cryptsetup --cipher %1 --key-size 256 --hash sha256 luksFormat --label=%2 %3 -q") .arg(Utils::getCipherStr(luks.m_crypt)) @@ -490,6 +496,7 @@ bool LUKSOperator::format(const LUKS_INFO &luks) bool LUKSOperator::open(const LUKS_INFO &luks) { + qDebug() << "Opening LUKS device:" << luks.m_devicePath << "with mapper:" << luks.m_mapper.m_dmName; QString outPut, error; QString cmd = QString("cryptsetup open %1 %2 -q") .arg(luks.m_devicePath) @@ -508,6 +515,7 @@ bool LUKSOperator::testKey(const LUKS_INFO &luks) bool LUKSOperator::close(const LUKS_INFO &luks) { + qDebug() << "Closing LUKS device:" << luks.m_mapper.m_dmPath; QString cmd, strout, strerr; cmd = QString("cryptsetup close %1").arg(luks.m_mapper.m_dmPath); return Utils::executCmd(cmd, strout, strerr) == 0; @@ -560,6 +568,7 @@ bool LUKSOperator::updateDecryptToken(LUKS_INFO &info, bool isFirst) bool LUKSOperator::addKeyFile(const LUKS_INFO &luks) { + qInfo() << "Adding key file for LUKS device:" << luks.m_devicePath; //创建文件 QDir dir; if(!dir.exists(saveKeyPath)){ @@ -586,6 +595,7 @@ bool LUKSOperator::addKeyFile(const LUKS_INFO &luks) bool LUKSOperator::deleteKeyFile(const LUKS_INFO &luks) { + qInfo() << "Deleting key file for LUKS device:" << luks.m_devicePath; QString filePath = QString("%1/%2.key").arg(saveKeyPath).arg(luks.m_dmUUID); if (!QFile::exists(filePath)) { return true; diff --git a/service/diskoperation/lvmoperator/lvmoperator.cpp b/service/diskoperation/lvmoperator/lvmoperator.cpp index 79c68ed..ec1406a 100644 --- a/service/diskoperation/lvmoperator/lvmoperator.cpp +++ b/service/diskoperation/lvmoperator/lvmoperator.cpp @@ -23,6 +23,7 @@ LVMError LVMOperator::m_lvmErr = LVM_ERR_NORMAL; /******************************** 初始化操作 ******************************/ LVMOperator::LVMOperator() { + qDebug() << "LVMOperator constructor called"; initSuport(); } @@ -35,6 +36,7 @@ void LVMOperator::resetLVMInfo(LVMInfo &lvmInfo) bool LVMOperator::initSuport() { + qDebug() << "Initializing LVM support"; if (!m_initSupport) { m_lvmSupport.LVM_CMD_lvchange = getExecSupport("lvchange"); m_lvmSupport.LVM_CMD_lvconvert = getExecSupport("lvconvert"); @@ -398,6 +400,7 @@ bool LVMOperator::updateLVInfo(LVMInfo &lvmInfo, VGInfo &vg) bool LVMOperator::createVG(LVMInfo &lvmInfo, QString vgName, QList devList, long long size) { if (LVM_CMD_Support::NONE == m_lvmSupport.LVM_CMD_vgcreate || LVM_CMD_Support::NONE == m_lvmSupport.LVM_CMD_pvcreate) { + qWarning() << "Failed to create VG: required commands not supported"; return setLVMErr(lvmInfo, LVMError::LVM_ERR_NO_CMD_SUPPORT); } @@ -407,6 +410,7 @@ bool LVMOperator::createVG(LVMInfo &lvmInfo, QString vgName, QList devLi //判断vg是否已经存在 存在退出 if (lvmInfo.vgExists(vgName)) { + qWarning() << "Failed to create VG: VG already exists -" << vgName; return setLVMErr(lvmInfo, LVMError::LVM_ERR_VG_ALREADY_EXISTS); } //创建pv @@ -546,11 +550,13 @@ bool LVMOperator::resizeVG(LVMInfo &lvmInfo, QString vgName, QList devLi bool LVMOperator::createLV(LVMInfo &lvmInfo, QString vgName, QList lvList) { if (LVM_CMD_Support::NONE == m_lvmSupport.LVM_CMD_lvcreate) { + qWarning() << "Failed to create LV: lvcreate command not supported"; return setLVMErr(lvmInfo, LVMError::LVM_ERR_NO_CMD_SUPPORT); } //判断参数是否正确 if (vgName.isEmpty() || lvList.count() == 0) { + qWarning() << "Failed to create LV: invalid arguments"; return setLVMErr(lvmInfo, LVMError::LVM_ERR_LV_ARGUMENT); } @@ -590,7 +596,9 @@ bool LVMOperator::createLV(LVMInfo &lvmInfo, QString vgName, QList lvL } //更新lv数据 + qInfo() << "Creating LV in VG:" << vgName << "with size:" << lvList.first().m_lvByteSize; updateLVInfo(lvmInfo, vg); + qInfo() << "Successfully created LV in VG:" << vgName; return setLVMErr(lvmInfo, LVMError::LVM_ERR_NORMAL); } diff --git a/service/diskoperation/partition.cpp b/service/diskoperation/partition.cpp index 0aeba14..9faa25d 100644 --- a/service/diskoperation/partition.cpp +++ b/service/diskoperation/partition.cpp @@ -12,11 +12,13 @@ namespace DiskManager { Partition::Partition() { + qDebug() << "Creating new partition"; reset(); } Partition *Partition::clone() const { + qDebug() << "Cloning partition"; return new Partition(*this); } @@ -103,6 +105,11 @@ void Partition::set(const QString &devicePath, const QString &partition, int par m_insideExtended = insideExtended; m_busy = busy; + qDebug() << "Setting partition:" << partition + << "type:" << type + << "fs:" << fstype + << "sectors:" << sectorStart << "-" << sectorEnd; + SupportedFileSystems s; FileSystem *fs = s.getFsObject(m_fstype); m_fsLimits = fs ? fs->getFilesystemLimits(*this) : FS_Limits{-1, -1}; //-1 -1 no support fileSystem 0 =>no limits @@ -135,6 +142,8 @@ void Partition::setUnpartitioned(const QString &devicePath, const QString &parti void Partition::setUnallocated(const QString &devicePath, Sector sectorStart, Sector sectorEnd, Byte_Value sectorSize, bool insideExtended) { + qDebug() << "Setting unallocated partition at sectors:" + << sectorStart << "-" << sectorEnd; reset(); set(devicePath, @@ -191,7 +200,7 @@ QString Partition::getMountPoint() const void Partition::setSectorUsage(Sector sectorsFsSize, Sector sectorsFsUnused) { Sector length = getSectorLength(); - qDebug() << "1111111" << length; + qDebug() << "Setting sector usage, partition length:" << length; if (0 <= sectorsFsSize && sectorsFsSize <= length && 0 <= sectorsFsUnused && sectorsFsUnused <= sectorsFsSize) { m_sectorsUsed = sectorsFsSize - sectorsFsUnused; @@ -264,10 +273,11 @@ PartitionInfo Partition::getPartitionInfo() const info.m_fileSystemReadOnly = m_fsReadonly; info.m_mountPoints = m_mountpoints; info.m_fsLimits = m_fsLimits; -// qDebug() << info.devicePath << info.partition_number << info.type << info.status << info.alignment << info.fstype << info.uuid -// << info.name << info.sector_start << info.sector_end << info.sectors_used << info.sectors_unused -// << info.sectors_unallocated << info.significant_threshold << info.free_space_before -// << info.sector_size << info.fs_block_size << info.path << info.filesystem_label; + qDebug() << "Getting partition info:" + << "path:" << info.m_path + << "type:" << info.m_type + << "fs:" << info.m_fileSystemType + << "sectors:" << info.m_sectorStart << "-" << info.m_sectorEnd; return info; } diff --git a/service/diskoperation/procpartitionsinfo.cpp b/service/diskoperation/procpartitionsinfo.cpp index db0107c..c0fdb09 100644 --- a/service/diskoperation/procpartitionsinfo.cpp +++ b/service/diskoperation/procpartitionsinfo.cpp @@ -33,6 +33,7 @@ const QVector &ProcPartitionsInfo::getDevicePaths() void ProcPartitionsInfo::initializeIfRequired() { if (!procPartitionsInfoCacheInitialized) { + qDebug() << "Loading partitions info cache"; loadProcPartitionsInfoCache(); procPartitionsInfoCacheInitialized = true; } @@ -41,15 +42,17 @@ void ProcPartitionsInfo::initializeIfRequired() void ProcPartitionsInfo::loadProcPartitionsInfoCache() { devicePathsCache.clear(); + qDebug() << "Reading /proc/partitions"; QFile file("/proc/partitions"); if (file.open(QIODevice::ReadOnly | QIODevice::Text)) { + qDebug() << "Successfully opened /proc/partitions"; QTextStream in(&file); in.skipWhiteSpace(); QString line = in.readLine(); QString device; while (!in.atEnd() || !line.isEmpty()) { - qDebug() << __FUNCTION__ << "-----++++++------"; + qDebug() << "Processing partition entry"; QStringList strlist = line.split(" "); unsigned long maj = 0; unsigned long min = 0; @@ -64,7 +67,7 @@ void ProcPartitionsInfo::loadProcPartitionsInfoCache() break; } } -// qDebug() << name; + qDebug() << "Found partition:" << name; BlockSpecial::registerBlockSpecial("/dev/" + name, maj, min); @@ -93,6 +96,9 @@ void ProcPartitionsInfo::loadProcPartitionsInfoCache() // E.g., device = /dev/nvme0n1, partition = /dev/nvme0n1p1 if (device == "") { device = Utils::regexpLabel(name, "^(nvme[0-9]+n[0-9]+)$"); + qDebug() << "Found total devices:" << devicePathsCache.size(); + } else { + qWarning() << "Failed to open /proc/partitions"; } //Device names that end with a #[^p]# are HP Smart Array Devices (disks) @@ -109,7 +115,7 @@ void ProcPartitionsInfo::loadProcPartitionsInfoCache() } if (device != "") { - //add potential device to the list + qDebug() << "Adding device to cache:" << device; devicePathsCache.push_back("/dev/" + device); } line = in.readLine(); diff --git a/service/diskoperation/supportedfilesystems.cpp b/service/diskoperation/supportedfilesystems.cpp index ccc2288..bbb103d 100644 --- a/service/diskoperation/supportedfilesystems.cpp +++ b/service/diskoperation/supportedfilesystems.cpp @@ -31,6 +31,7 @@ namespace DiskManager { SupportedFileSystems::SupportedFileSystems() { + qDebug() << "Initializing supported filesystems"; m_fsObjects[FS_UNKNOWN] = NULL; m_fsObjects[FS_OTHER] = NULL; m_fsObjects[FS_BTRFS] = new Btrfs; @@ -68,11 +69,13 @@ SupportedFileSystems::SupportedFileSystems() SupportedFileSystems::~SupportedFileSystems() { + qDebug() << "Cleaning up filesystem objects"; FSObjectsMap::iterator iter; for (iter = m_fsObjects.begin(); iter != m_fsObjects.end(); iter++) { auto pvalue = iter.value(); if (pvalue != NULL) { + qDebug() << "Deleting filesystem handler for:" << Utils::fileSystemTypeToString(iter.key()); delete pvalue; } @@ -83,20 +86,25 @@ SupportedFileSystems::~SupportedFileSystems() void SupportedFileSystems::findSupportedFilesystems() { FSObjectsMap::iterator iter; + qDebug() << "Finding supported filesystems"; m_fsSupport.clear(); for (iter = m_fsObjects.begin(); iter != m_fsObjects.end(); iter++) { if (iter.value()) { FileSystem *psys = iter.value(); - m_effectivefs.append(Utils::fileSystemTypeToString(iter.key())); + QString fsName = Utils::fileSystemTypeToString(iter.key()); + m_effectivefs.append(fsName); m_fsSupport.push_back(psys->getFilesystemSupport()); + qDebug() << "Found supported filesystem:" << fsName; } else { FS fsBasicsupp(iter.key()); fsBasicsupp.move = FS::GPARTED; fsBasicsupp.copy = FS::GPARTED; m_fsSupport.push_back(fsBasicsupp); + qDebug() << "Basic support for filesystem:" << Utils::fileSystemTypeToString(iter.key()); } } + qDebug() << "Total supported filesystems:" << m_fsSupport.size(); } FileSystem *SupportedFileSystems::getFsObject(FSType fstype) const @@ -104,8 +112,10 @@ FileSystem *SupportedFileSystems::getFsObject(FSType fstype) const // qDebug() << Utils::fileSystemTypeToString(fstype); FSObjectsMap::const_iterator iter = m_fsObjects.find(fstype); if (iter == m_fsObjects.end()) { + qDebug() << "Filesystem not found, return NULL"; return nullptr; } else { + qDebug() << "Found filesystem handler for value"; return iter.value(); } } diff --git a/service/diskoperation/thread.cpp b/service/diskoperation/thread.cpp index b722f56..dc9e86a 100644 --- a/service/diskoperation/thread.cpp +++ b/service/diskoperation/thread.cpp @@ -29,6 +29,7 @@ WorkThread::WorkThread(QObject *parent) m_blockEnd = 0; m_checkConut = 0; m_checkSize = 0; + qDebug() << "WorkThread created"; } void WorkThread::setStopFlag(int flag) @@ -56,7 +57,7 @@ void WorkThread::setTimeInfo(const QString &devicePath, int blockStart, int bloc void WorkThread::runCount() { -// qDebug() << QThread::currentThreadId() << endl; + qDebug() << "Check range:" << m_blockStart << "-" << m_blockEnd << "with count:" << m_checkConut; Sector i = m_blockStart; Sector j = m_blockStart + 1; QProcess proc; @@ -93,7 +94,10 @@ void WorkThread::runCount() } if (m_stopFlag != 2) { + qDebug() << "Bad blocks count check completed normally"; emit checkBadBlocksFinished(); //检测完成正常退出,发送给页面的正常结束信号 + } else { + qDebug() << "Bad blocks count check was stopped by user"; } } @@ -151,6 +155,7 @@ FixThread::FixThread(QObject *parent) Q_UNUSED(parent); m_stopFlag = 0; m_checkSize = 0; + qDebug() << "FixThread created"; } void FixThread::setStopFlag(int flag) @@ -160,7 +165,7 @@ void FixThread::setStopFlag(int flag) void FixThread::runFix() { -// qDebug() << m_list << endl; + qDebug() << "Bad blocks count to fix:" << m_list.size(); int i = 0; QProcess proc; while (i < m_list.size() && m_stopFlag != 2) { @@ -194,7 +199,10 @@ void FixThread::runFix() } if (m_stopFlag != 2) { + qDebug() << "Bad blocks fix completed normally"; emit fixBadBlocksFinished(); + } else { + qDebug() << "Bad blocks fix was stopped by user"; } } @@ -208,11 +216,12 @@ void FixThread::setFixBadBlocksInfo(const QString &devicePath, QStringList list, ProbeThread::ProbeThread(QObject *parent) { Q_UNUSED(parent); + qDebug() << "ProbeThread created"; } void ProbeThread::probeDeviceInfo() { - qDebug() << __FILE__ << ":" << __FUNCTION__ << "Someone call me in thread!"; + qDebug() << "ProbeDeviceInfo started in thread"; QString rootFsName; m_inforesult.clear(); m_deviceMap.clear(); @@ -226,7 +235,7 @@ void ProbeThread::probeDeviceInfo() PedDevice *lpDevice = ped_device_get_next(nullptr); while (lpDevice) { /* TO TRANSLATORS: looks like Confirming /dev/sda */ - qDebug() << QString("Confirming %1").arg(lpDevice->path); + qDebug() << "Probing device:" << lpDevice->path; //only add this device if we can read the first sector (which means it's a real device) @@ -268,7 +277,7 @@ void ProbeThread::probeDeviceInfo() //partinfo = pat.getPartitionInfo(); if (rootFsName == pat.getPath()) { partinfo.m_flag = 4; - qDebug() << __FUNCTION__ << "Set systemfs Flags3 !! " << pat.m_devicePath << " " << pat.m_name << " " << pat.m_uuid; + qDebug() << "Set systemfs Flags3 for:" << pat.m_devicePath << "name:" << pat.m_name << "uuid:" << pat.m_uuid; } if (pat.m_type == PartitionType::TYPE_EXTENDED) { @@ -278,9 +287,9 @@ void ProbeThread::probeDeviceInfo() partinfo = plogic.getPartitionInfo(); if (rootFsName == plogic.m_name) { partinfo.m_flag = 4; - qDebug() << __FUNCTION__ << "Set systemfs Flags4 !! " << plogic.m_devicePath << " " << plogic.m_name << " " << plogic.m_uuid; + qDebug() << "Set systemfs Flags4 for:" << plogic.m_devicePath << "name:" << plogic.m_name << "uuid:" << plogic.m_uuid; } - qDebug() << __FUNCTION__ << plogic.m_devicePath << " " << plogic.m_name << " " << plogic.m_uuid; + qDebug() << "Logical partition:" << plogic.m_devicePath << "name:" << plogic.m_name << "uuid:" << plogic.m_uuid; devinfo.m_partition.push_back(partinfo); } } else { @@ -298,8 +307,8 @@ void ProbeThread::probeDeviceInfo() emit updateDeviceInfo(/*m_deviceMap,*/ m_inforesult, m_lvmInfo,m_luksInfo); - qDebug() << __FILE__ << ":" << __FUNCTION__ << "Someone call me in thread,working done!"; - qDebug() << __FILE__ << "Now I am working on thread:" << QThread::currentThreadId(); + qDebug() << "ProbeDeviceInfo completed"; + qDebug() << "Current thread ID:" << QThread::currentThreadId(); } QMap ProbeThread::getDeviceMap() diff --git a/service/main.cpp b/service/main.cpp index 421800a..e0d269d 100644 --- a/service/main.cpp +++ b/service/main.cpp @@ -30,7 +30,7 @@ int main(int argc, char *argv[]) //set env otherwise utils excutecmd excute command failed QString PATH = qgetenv("PATH"); - qDebug() << "main start" << PATH; + qDebug() << "Application starting with PATH:" << PATH; if (PATH.isEmpty()) { PATH = "/usr/bin"; } @@ -40,9 +40,10 @@ int main(int argc, char *argv[]) uint frontEndPid; QString frontEndDBusName; - if (argc < 3) + if (argc < 3) { + qCritical() << "Invalid arguments count:" << argc; return 1; - else { + } else { QString frontEndPidString(argv[1]); frontEndPid = frontEndPidString.toUInt(); if (frontEndPid == 0) diff --git a/service/watcher.cpp b/service/watcher.cpp index e937413..5d5d698 100644 --- a/service/watcher.cpp +++ b/service/watcher.cpp @@ -25,17 +25,20 @@ namespace DiskManager { */ void Watcher::executCmd(const QString &strCmd, QString &outPut, QString &error) { + qDebug() << "Executing command:" << strCmd; // QProcess proc; // proc.start("b-a-s-h", QStringList() << "-c" << strCmd); // proc.waitForFinished(-1); // outPut = proc.readAllStandardOutput(); + qDebug() << "Command execution completed"; } void Watcher::exit() { - qDebug() << "Watcher wait for exit now!"; + qDebug() << "Watcher received exit request"; stoped = true; this->wait(); + qDebug() << "Watcher thread stopped"; } void Watcher::run() @@ -44,6 +47,7 @@ void Watcher::run() QString cmd, outPut, error; //先判断后台服务进程是否存在,如果存在可能是强制退出导致,应先退出后台程序再重新启动磁盘管理器 cmd = QString("ps -eo pid,cmd |awk '{print $2}' |grep -w deepin-diskmanager$"); + qDebug() << "Watcher thread started monitoring process"; while (!stoped) { QThread::msleep(500); //0.5 second @@ -57,7 +61,7 @@ void Watcher::run() } else { //这里表示,前端启动过,但是现在已经关闭了 if (isrun) { - qDebug() << "Need to quit now"; + qWarning() << "Main process terminated unexpectedly, exiting watcher"; _exit(0); } }