Skip to content

Commit 1b67a1c

Browse files
committed
chore: [log]More logs
Add more logs for log coverage. Log: Add more logs.
1 parent 9571401 commit 1b67a1c

73 files changed

Lines changed: 725 additions & 66 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

application/common.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55

66
#include "common.h"
7+
#include <QDebug>
78

89
QIcon Common::getIcon(const QString &iconName)
910
{
@@ -12,12 +13,15 @@ QIcon Common::getIcon(const QString &iconName)
1213

1314
int Common::getLabelAdjustHeight(const int &width, const QString &text, const QFont &font)
1415
{
16+
qDebug() << "Calculating label height for text:" << text.left(20) << "...";
1517
DLabel label;
1618
label.setFont(font);
1719
label.setWordWrap(true);
1820
label.setFixedWidth(width);
1921
label.setText(text);
2022
label.adjustSize();
2123

22-
return label.height();
24+
int height = label.height();
25+
qDebug() << "Calculated label height:" << height;
26+
return height;
2327
}

application/cusapplication.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@
44

55

66
#include "cusapplication.h"
7+
#include <QDebug>
78

89
CusApplication::CusApplication(int &argc, char **argv)
910
: DApplication(argc, argv)
1011
{
12+
qDebug() << "CusApplication initialized with argc:" << argc;
1113
}
1214

1315
void CusApplication::handleQuitAction()
1416
{
17+
qDebug() << "Handling quit action";
1518
emit handleQuitActionChanged();
1619
DApplication::handleQuitAction();
20+
qDebug() << "Quit action handled";
1721
}

application/widgets/animationdialog.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@
99

1010
#include <QVBoxLayout>
1111
#include <QKeyEvent>
12+
#include <QDebug>
1213

1314
AnimationDialog::AnimationDialog(QWidget *parent) : DDialog(parent)
1415
{
16+
qDebug() << "AnimationDialog initializing...";
1517
initUi();
18+
qDebug() << "AnimationDialog initialized";
1619
}
1720

1821
void AnimationDialog::initUi()
@@ -43,6 +46,8 @@ void AnimationDialog::initUi()
4346

4447
void AnimationDialog::setShowSpinner(bool isShow, const QString &title)
4548
{
49+
qDebug() << "Setting spinner visibility:" << isShow << "with title:" << title;
50+
4651
if (isShow) {
4752
m_label->setText(title);
4853
m_spinner->show();
@@ -54,6 +59,7 @@ void AnimationDialog::setShowSpinner(bool isShow, const QString &title)
5459
void AnimationDialog::keyPressEvent(QKeyEvent *event)
5560
{
5661
if (event->key() == Qt::Key::Key_Escape) {
62+
qDebug() << "Escape key pressed, ignoring event";
5763
event->ignore();
5864
} else {
5965
DDialog::keyPressEvent(event);

application/widgets/centerwidget.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,18 @@
1717
CenterWidget::CenterWidget(DWidget *parent)
1818
: Dtk::Widget::DWidget(parent)
1919
{
20+
qDebug() << "CenterWidget initializing...";
2021
initUi();
2122
}
2223

2324
CenterWidget::~CenterWidget()
2425
{
26+
qDebug() << "CenterWidget destroyed";
2527
}
2628

2729
void CenterWidget::HandleQuit()
2830
{
31+
qDebug() << "Handling CenterWidget quit";
2932
}
3033

3134
TitleWidget *CenterWidget::getTitleWidget()
@@ -35,6 +38,8 @@ TitleWidget *CenterWidget::getTitleWidget()
3538

3639
void CenterWidget::initUi()
3740
{
41+
qDebug() << "Initializing CenterWidget UI";
42+
3843
m_titleWidget = new TitleWidget(this);
3944
QVBoxLayout *mainlayout = new QVBoxLayout;
4045
mainlayout->setContentsMargins(0, 0, 0, 0);

application/widgets/createlvwidget.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

1717
CreateLVWidget::CreateLVWidget(QWidget *parent) : DDialog(parent)
1818
{
19+
qDebug() << "CreateLVWidget initializing...";
1920
initUi();
2021
recPartitionInfo();
2122
initConnection();
23+
qDebug() << "CreateLVWidget initialized for VG:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName;
2224
}
2325

2426
void CreateLVWidget::initUi()
@@ -402,7 +404,7 @@ void CreateLVWidget::partInfoShowing()
402404

403405
void CreateLVWidget::recPartitionInfo()
404406
{
405-
//获取数据
407+
qDebug() << "Loading partition info for current VG";
406408
m_lstLVName.clear();
407409
if (DMDbusHandler::VOLUMEGROUP == DMDbusHandler::instance()->getCurLevel()) {
408410
VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo();
@@ -920,6 +922,8 @@ void CreateLVWidget::onAddPartition()
920922

921923
void CreateLVWidget::onRemovePartition()
922924
{
925+
qDebug() << "Removing last LV from creation list";
926+
923927
if (m_patrinfo.size() > 0)
924928
m_patrinfo.pop_back();
925929

@@ -942,6 +946,8 @@ void CreateLVWidget::onRemovePartition()
942946

943947
void CreateLVWidget::onApplyButton()
944948
{
949+
qDebug() << "Applying LV creation for VG:" << DMDbusHandler::instance()->getCurVGInfo().m_vgName;
950+
945951
QList<LVAction> lstLVInfo;
946952
VGInfo vgInfo = DMDbusHandler::instance()->getCurVGInfo();
947953
QString userName = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
@@ -980,13 +986,16 @@ void CreateLVWidget::onApplyButton()
980986
}
981987

982988
if (lstLVInfo.size() > 0) {
989+
qDebug() << "Creating" << lstLVInfo.size() << "logical volumes on VG:" << vgInfo.m_vgName;
983990
DMDbusHandler::instance()->createLV(vgInfo.m_vgName, lstLVInfo);
984991
close();
985992
}
986993
}
987994

988995
void CreateLVWidget::onRevertButton()
989996
{
997+
qDebug() << "Reverting all LV creation changes";
998+
990999
//复原,即清空
9911000
m_patrinfo.clear();
9921001
m_sizeInfo.clear();
@@ -1019,6 +1028,8 @@ void CreateLVWidget::onRevertButton()
10191028

10201029
void CreateLVWidget::onCancelButton()
10211030
{
1031+
qDebug() << "Canceling LV creation dialog";
1032+
10221033
close();
10231034
}
10241035

application/widgets/createpartitiontabledialog.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
CreatePartitionTableDialog::CreatePartitionTableDialog(QWidget *parent)
1818
: DDBase(parent)
1919
{
20+
qDebug() << "CreatePartitionTableDialog initializing...";
2021
initUi();
2122
initConnection();
23+
qDebug() << "CreatePartitionTableDialog initialized";
2224
}
2325

2426
void CreatePartitionTableDialog::initUi()
@@ -35,6 +37,7 @@ void CreatePartitionTableDialog::initUi()
3537
getButton(index)->setAccessibleName("cancel");
3638

3739
DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo();
40+
qDebug() << "Current device info - path:" << info.m_path << "type:" << info.m_disktype;
3841
if (info.m_disktype == "unrecognized") {
3942
m_curType = "create";
4043
// 当前磁盘无分区表,是否新建分区表?
@@ -60,6 +63,7 @@ void CreatePartitionTableDialog::onButtonClicked(int index, const QString &text)
6063
{
6164
Q_UNUSED(text);
6265
if (index == m_okCode) {
66+
qDebug() << "User confirmed partition table operation, type:" << m_curType;
6367
DeviceInfo info = DMDbusHandler::instance()->getCurDeviceInfo();
6468
DMDbusHandler::instance()->createPartitionTable(info.m_path, QString("%1").arg(info.m_length), QString("%1").arg(info.m_sectorSize), m_ComboBox->currentText(), m_curType);
6569
close();

application/widgets/createvgwidget.cpp

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ CreateVGWidget::CreateVGWidget(int operationType, QWidget *parent)
1919
: DDBase(parent)
2020
, m_curOperationType(operationType)
2121
{
22+
qDebug() << "CreateVGWidget initialized with operationType:" << operationType;
2223
initUi();
2324
initConnection();
2425
updateData();
26+
qDebug() << "CreateVGWidget initialization completed";
2527
}
2628

2729
void CreateVGWidget::initUi()
@@ -752,19 +754,26 @@ set<PVData> CreateVGWidget::getCurSelectPVData()
752754

753755
void CreateVGWidget::onNextButtonClicked()
754756
{
757+
qDebug() << "Next button clicked, switching to step 2";
755758
m_stackedWidget->setCurrentIndex(1);
756759
updateSelectedData();
760+
qDebug() << "Step 2 UI updated with selected data";
757761
}
758762

759763
void CreateVGWidget::onPreviousButtonClicked()
760764
{
765+
qDebug() << "Previous button clicked, switching back to step 1";
761766
m_stackedWidget->setCurrentIndex(0);
762767
updateData();
768+
qDebug() << "Step 1 UI refreshed";
763769
}
764770

765771
void CreateVGWidget::onDoneButtonClicked()
766772
{
773+
qDebug() << "Done button clicked, starting VG operation";
774+
767775
if (m_selectSpaceStackedWidget->currentIndex() == 0) {
776+
qDebug() << "Validating VG size input...";
768777
double curSize = QString::number(m_selectSpaceLineEdit->text().toDouble(), 'f', 2).toDouble();
769778
double minSize = QString::number(m_minSize, 'f', 2).toDouble();
770779
double maxSize = QString::number(m_maxSize, 'f', 2).toDouble();
@@ -846,6 +855,7 @@ void CreateVGWidget::onDoneButtonClicked()
846855

847856
DMDbusHandler::instance()->resizeVG(vgName, pvDataList, m_curSize);
848857
} else {
858+
qInfo() << "Creating new VG:" << vgName << "with" << pvDataList.size() << "PVs";
849859
DMDbusHandler::instance()->createVG(vgName, pvDataList, m_curSize);
850860
}
851861

@@ -2056,7 +2066,7 @@ void CreateVGWidget::onTextChanged(const QString &text)
20562066

20572067
void CreateVGWidget::onVGCreateMessage(const QString &vgMessage)
20582068
{
2059-
qDebug() << vgMessage;
2069+
qDebug() << "Received VG create message:" << vgMessage;
20602070
if (m_waterLoadingWidget != nullptr) {
20612071
m_waterLoadingWidget->stopTimer();
20622072
}
@@ -2068,6 +2078,7 @@ void CreateVGWidget::onVGCreateMessage(const QString &vgMessage)
20682078
}
20692079

20702080
if (infoList.at(0) == "0") {
2081+
qWarning() << "VG operation failed with error code:" << infoList.at(1);
20712082
QString text = "";
20722083
switch (infoList.at(1).toInt()) {
20732084
case LVMError::LVM_ERR_VG_ALREADY_EXISTS: {
@@ -2094,11 +2105,14 @@ void CreateVGWidget::onVGCreateMessage(const QString &vgMessage)
20942105
}
20952106
}
20962107

2108+
qDebug() << "Closing CreateVGWidget";
20972109
close();
20982110
}
20992111

21002112
void CreateVGWidget::onUpdateUsb()
21012113
{
2114+
qDebug() << "USB device status changed, checking for updates...";
2115+
21022116
QStringList deviceNameList = DMDbusHandler::instance()->getDeviceNameList();
21032117
if (m_curDeviceNameList == deviceNameList) {
21042118
return;
@@ -2135,13 +2149,15 @@ void CreateVGWidget::onUpdateUsb()
21352149
tr("Refreshing the page to reload disks"));
21362150
DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20));
21372151

2152+
qDebug() << "Refreshing disk selection UI due to USB change";
21382153
updateData();
21392154
} else if (m_stackedWidget->currentIndex() == 1) {
21402155
if (!deleteIndexList.isEmpty()) {
21412156
DMessageManager::instance()->sendMessage(this, QIcon::fromTheme("://icons/deepin/builtin/ok.svg"),
21422157
tr("Refreshing the page to reload disks"));
21432158
DMessageManager::instance()->setContentMargens(this, QMargins(0, 0, 0, 20));
21442159

2160+
qDebug() << "Refreshing selected data UI due to USB change";
21452161
updateSelectedData();
21462162
}
21472163
}

application/widgets/customcontrol/buttonlabel.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@
33
// SPDX-License-Identifier: GPL-3.0-only
44

55
#include "buttonlabel.h"
6+
#include <QDebug>
7+
68

79
ButtonLabel::ButtonLabel(QWidget *parent) : QLabel(parent)
810
{
9-
11+
qDebug() << "ButtonLabel created";
1012
}
1113

1214
void ButtonLabel::mousePressEvent(QMouseEvent *event)
1315
{
16+
qDebug() << "ButtonLabel clicked";
1417
Q_UNUSED(event);
1518

1619
emit clicked();
20+
qDebug() << "ButtonLabel click signal emitted";
1721
}

application/widgets/customcontrol/ddbase.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
DDBase::DDBase(QWidget *parent)
1111
: DDialog(parent)
1212
{
13+
qDebug() << "Creating base dialog";
1314
setModal(true);
1415
setIcon(QIcon::fromTheme(appName));
1516

@@ -18,14 +19,17 @@ DDBase::DDBase(QWidget *parent)
1819
m_mainFrame->setFrameStyle(DFrame::NoFrame);
1920

2021
addContent(m_mainFrame);
22+
qDebug() << "Base dialog initialized with main frame";
2123
// updateGeometry();
2224
}
2325

2426
void DDBase::keyPressEvent(QKeyEvent *event)
2527
{
2628
if (event->key() == Qt::Key::Key_Escape) {
29+
qDebug() << "Ignoring Escape key press";
2730
event->ignore();
2831
} else {
32+
qDebug() << "Forwarding key press to base class";
2933
DDialog::keyPressEvent(event);
3034
}
3135
}

application/widgets/customcontrol/dmdiskinfobox.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,41 +29,52 @@ DmDiskinfoBox::DmDiskinfoBox(int level, QObject *parent, QString diskPath, QStri
2929
{
3030
m_childs.clear();
3131
m_id = 0;
32+
qDebug() << "DmDiskinfoBox initialized";
3233
}
3334

3435
DmDiskinfoBox::DmDiskinfoBox(QObject *parent)
3536
: QObject(parent)
3637
{
38+
qDebug() << "Creating empty DmDiskinfoBox";
3739
m_id = 0;
3840
m_level = 0;
3941
m_flag = 0;
42+
qDebug() << "Empty DmDiskinfoBox initialized";
4043
}
4144

4245
DmDiskinfoBox::~DmDiskinfoBox()
4346
{
47+
qDebug() << "Destroying DmDiskinfoBox, child count:" << m_childs.count();
4448
for (int i = 0; i < m_childs.length(); i++) {
4549
if (m_childs.at(i) != nullptr) {
50+
qDebug() << "Deleting child item:" << i;
4651
delete m_childs.at(i);
4752
}
4853
}
4954
m_childs.clear();
55+
qDebug() << "DmDiskinfoBox destroyed";
5056
}
5157

5258
int DmDiskinfoBox::addChild(DmDiskinfoBox *child)
5359
{
60+
qDebug() << "Adding child, current level:" << m_level
61+
<< "child id:" << child->m_id;
5462
child->m_level = m_level + 1;
5563
foreach (DmDiskinfoBox *item, m_childs) {
5664
if (item->m_id == child->m_id) {
65+
qDebug() << "Replacing existing child with same id";
5766
m_childs.removeOne(item);
5867
delete item;
5968
}
6069
}
6170
m_childs.append(child);
71+
qDebug() << "Child added, new child count:" << m_childs.count();
6272
return 0;
6373
}
6474

6575
int DmDiskinfoBox::childCount()
6676
{
77+
qDebug() << "Getting child count:" << m_childs.count();
6778
return m_childs.count();
6879
}
6980

0 commit comments

Comments
 (0)