Skip to content

Commit a49c345

Browse files
committed
chore: More logs for client
Add more logs for client. Log: More logs for client.
1 parent 2367ef1 commit a49c345

93 files changed

Lines changed: 2906 additions & 188 deletions

File tree

Some content is hidden

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

calendar-client/src/KeyPress/calldaykeyleftdeal.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@
66

77
#include "graphicsItem/cweekdaybackgrounditem.h"
88
#include "cgraphicsscene.h"
9+
#include "commondef.h"
910

1011
CAllDayKeyLeftDeal::CAllDayKeyLeftDeal(QGraphicsScene *scene)
1112
: CKeyPressDealBase(Qt::Key_Left, scene)
1213
{
14+
qCDebug(ClientLogger) << "CAllDayKeyLeftDeal constructor initialized";
1315
}
1416

1517
bool CAllDayKeyLeftDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *scene)
1618
{
19+
qCDebug(ClientLogger) << "CAllDayKeyLeftDeal::focusItemDeal - Processing left key for date:" << item->getDate();
1720
CWeekDayBackgroundItem *backgroundItem = dynamic_cast<CWeekDayBackgroundItem *>(item);
1821
backgroundItem->initState();
1922
//如果是第一个则切换时间
2023
scene->setActiveSwitching(true);
2124
if (backgroundItem->getLeftItem() == nullptr) {
25+
qCDebug(ClientLogger) << "Left item is null, switching to previous page";
2226
scene->setPrePage(item->getDate().addDays(-1), true);
2327
} else {
28+
qCDebug(ClientLogger) << "Switching view to previous day";
2429
scene->signalSwitchView(backgroundItem->getDate().addDays(-1), true);
2530
}
2631
return true;

calendar-client/src/KeyPress/calldaykeyrightdeal.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@
66

77
#include "graphicsItem/cweekdaybackgrounditem.h"
88
#include "cgraphicsscene.h"
9+
#include "commondef.h"
910

1011
CAllDayKeyRightDeal::CAllDayKeyRightDeal(QGraphicsScene *scene)
1112
: CKeyPressDealBase(Qt::Key_Right, scene)
1213
{
14+
qCDebug(ClientLogger) << "CAllDayKeyRightDeal constructor initialized";
1315
}
1416

1517
bool CAllDayKeyRightDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *scene)
1618
{
19+
qCDebug(ClientLogger) << "CAllDayKeyRightDeal::focusItemDeal - Processing right key for date:" << item->getDate();
1720
CWeekDayBackgroundItem *backgroundItem = dynamic_cast<CWeekDayBackgroundItem *>(item);
1821
backgroundItem->initState();
1922
//如果没有下一个则切换时间
2023
scene->setActiveSwitching(true);
2124
if (backgroundItem->getRightItem() == nullptr) {
25+
qCDebug(ClientLogger) << "Right item is null, switching to next page";
2226
scene->setNextPage(item->getDate().addDays(1), true);
2327
} else {
28+
qCDebug(ClientLogger) << "Switching view to next day";
2429
scene->signalSwitchView(backgroundItem->getDate().addDays(1), true);
2530
}
2631
return true;

calendar-client/src/KeyPress/ckeydowndeal.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@
66

77
#include "graphicsItem/cscenebackgrounditem.h"
88
#include "cgraphicsscene.h"
9+
#include "commondef.h"
910

1011
#include <QDebug>
1112

1213
CKeyDownDeal::CKeyDownDeal(QGraphicsScene *scene)
1314
: CKeyPressDealBase(Qt::Key_Down, scene)
1415
{
16+
qCDebug(ClientLogger) << "CKeyDownDeal constructor initialized";
1517
}
1618

1719
bool CKeyDownDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *scene)
1820
{
21+
qCDebug(ClientLogger) << "CKeyDownDeal::focusItemDeal - Processing down key for date:" << item->getDate();
1922
item->initState();
2023
if (item->getDownItem() != nullptr) {
24+
qCDebug(ClientLogger) << "Down item exists, setting focus to down item";
2125
scene->setCurrentFocusItem(item->getDownItem());
2226
item->getDownItem()->setItemFocus(true);
2327
} else {
28+
qCDebug(ClientLogger) << "Down item is null, switching to next week";
2429
scene->setNextPage(item->getDate().addDays(7));
2530
}
2631
return true;

calendar-client/src/KeyPress/ckeyenabledeal.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88
#include "graphicsItem/cscenebackgrounditem.h"
99
#include "graphicsItem/draginfoitem.h"
1010
#include "myscheduleview.h"
11+
#include "commondef.h"
1112

1213
#include <QGraphicsView>
1314

1415
CKeyEnableDeal::CKeyEnableDeal(QGraphicsScene *scene)
1516
: CKeyPressDealBase(Qt::Key_Return, scene)
1617
{
18+
qCDebug(ClientLogger) << "CKeyEnableDeal constructor initialized";
1719
}
1820

1921
/**
@@ -24,13 +26,16 @@ CKeyEnableDeal::CKeyEnableDeal(QGraphicsScene *scene)
2426
*/
2527
bool CKeyEnableDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *scene)
2628
{
29+
qCDebug(ClientLogger) << "CKeyEnableDeal::focusItemDeal - Processing return key for date:" << item->getDate();
2730
bool result = false;
2831
CFocusItem *focusItem = item->getFocusItem();
2932
if (focusItem != nullptr) {
33+
qCDebug(ClientLogger) << "Focus item exists, type:" << focusItem->getItemType();
3034
result = true;
3135
QWidget *parentWidget = scene->views().at(0);
3236
switch (focusItem->getItemType()) {
3337
case CFocusItem::CBACK: {
38+
qCDebug(ClientLogger) << "Processing background item type";
3439
CSceneBackgroundItem *backgroundItem = dynamic_cast<CSceneBackgroundItem *>(focusItem);
3540
if (backgroundItem != nullptr) {
3641
QDateTime createDateTime;
@@ -39,26 +44,33 @@ bool CKeyEnableDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *s
3944
createDateTime.setTime(QTime(0, 0, 0));
4045
//如果为月视图背景则根据是否为当前时间设置不一样的创建时间
4146
if (backgroundItem->getItemOfView() == CSceneBackgroundItem::OnMonthView) {
47+
qCDebug(ClientLogger) << "Month view background item detected";
4248
QDateTime currentDateTime = QDateTime::currentDateTime();
4349
//如果为当前时间则设置创建开始时间为当前时间
4450
if (backgroundItem->getDate() == currentDateTime.date()) {
51+
qCDebug(ClientLogger) << "Setting create time to current time";
4552
createDateTime.setTime(currentDateTime.time());
4653
} else {
54+
qCDebug(ClientLogger) << "Setting create time to 8:00";
4755
createDateTime.setTime(QTime(8, 0, 0));
4856
}
4957
}
5058
createSchedule(createDateTime, parentWidget);
5159
}
5260
} break;
5361
case CFocusItem::CITEM: {
62+
qCDebug(ClientLogger) << "Processing schedule item type";
5463
DragInfoItem *scheduleItem = dynamic_cast<DragInfoItem *>(focusItem);
5564
CMyScheduleView dlg(scheduleItem->getData(), parentWidget);
5665
dlg.exec();
5766
} break;
5867
default: {
68+
qCDebug(ClientLogger) << "Processing default item type, going to day view for date:" << focusItem->getDate();
5969
scene->signalGotoDayView(focusItem->getDate());
6070
} break;
6171
}
72+
} else {
73+
qCDebug(ClientLogger) << "No focus item found";
6274
}
6375
return result;
6476
}
@@ -70,6 +82,7 @@ bool CKeyEnableDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *s
7082
*/
7183
void CKeyEnableDeal::createSchedule(const QDateTime &createDate, QWidget *parent)
7284
{
85+
qCDebug(ClientLogger) << "CKeyEnableDeal::createSchedule - Creating schedule for datetime:" << createDate;
7386
CScheduleDlg dlg(1, parent);
7487
dlg.setDate(createDate);
7588
dlg.setAllDay(true);

calendar-client/src/KeyPress/ckeyleftdeal.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@
66

77
#include "graphicsItem/cscenebackgrounditem.h"
88
#include "cgraphicsscene.h"
9+
#include "commondef.h"
910

1011
#include <QDebug>
1112

1213
CKeyLeftDeal::CKeyLeftDeal(QGraphicsScene *scene)
1314
: CKeyPressDealBase(Qt::Key_Left, scene)
1415
{
16+
qCDebug(ClientLogger) << "CKeyLeftDeal constructor initialized";
1517
}
1618

1719
bool CKeyLeftDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *scene)
1820
{
21+
qCDebug(ClientLogger) << "CKeyLeftDeal::focusItemDeal - Processing left key for date:" << item->getDate();
1922
item->initState();
2023
if (item->getLeftItem() != nullptr) {
24+
qCDebug(ClientLogger) << "Left item exists, setting focus to left item";
2125
scene->setCurrentFocusItem(item->getLeftItem());
2226
item->getLeftItem()->setItemFocus(true);
2327
} else {
28+
qCDebug(ClientLogger) << "Left item is null, switching to previous day";
2429
scene->setPrePage(item->getDate().addDays(-1));
2530
}
2631
return true;

calendar-client/src/KeyPress/ckeypressdealbase.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66

77
#include "cgraphicsscene.h"
88
#include "graphicsItem/cscenebackgrounditem.h"
9+
#include "commondef.h"
910

1011
CKeyPressDealBase::CKeyPressDealBase(Qt::Key key, QGraphicsScene *scene)
1112
: m_key(key)
1213
, m_scene(scene)
1314
{
15+
qCDebug(ClientLogger) << "CKeyPressDealBase constructor initialized with key:" << key;
1416
}
1517

1618
CKeyPressDealBase::~CKeyPressDealBase()
1719
{
20+
qCDebug(ClientLogger) << "CKeyPressDealBase destructor called for key:" << m_key;
1821
}
1922

2023
/**
@@ -28,14 +31,18 @@ Qt::Key CKeyPressDealBase::getKey() const
2831

2932
bool CKeyPressDealBase::dealEvent()
3033
{
34+
qCDebug(ClientLogger) << "CKeyPressDealBase::dealEvent - Processing key event for key:" << m_key;
3135
CGraphicsScene *scene = qobject_cast<CGraphicsScene *>(m_scene);
3236
if (scene != nullptr) {
3337
CSceneBackgroundItem *item = dynamic_cast<CSceneBackgroundItem *>(scene->getCurrentFocusItem());
3438
if (item != nullptr) {
39+
qCDebug(ClientLogger) << "Found focus item, delegating to focusItemDeal for date:" << item->getDate();
3540
return focusItemDeal(item, scene);
3641
} else {
42+
qCDebug(ClientLogger) << "No focus item found";
3743
return false;
3844
}
3945
}
46+
qCDebug(ClientLogger) << "Scene is null";
4047
return false;
4148
}

calendar-client/src/KeyPress/ckeypressprxy.cpp

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
// SPDX-License-Identifier: LGPL-3.0-or-later
44

55
#include "ckeypressprxy.h"
6+
#include "commondef.h"
67

78
#include <QDebug>
89

910
CKeyPressPrxy::CKeyPressPrxy()
1011
{
12+
qCDebug(ClientLogger) << "CKeyPressPrxy constructor initialized";
1113
}
1214

1315
CKeyPressPrxy::~CKeyPressPrxy()
1416
{
17+
qCDebug(ClientLogger) << "CKeyPressPrxy destructor called, cleaning up" << m_keyEventMap.size() << "key handlers";
1518
QMap<int, CKeyPressDealBase *>::iterator iter = m_keyEventMap.begin();
1619
for (; iter != m_keyEventMap.end(); ++iter) {
1720
delete iter.value();
@@ -26,10 +29,14 @@ CKeyPressPrxy::~CKeyPressPrxy()
2629
*/
2730
bool CKeyPressPrxy::keyPressDeal(int key)
2831
{
32+
qCDebug(ClientLogger) << "CKeyPressPrxy::keyPressDeal - Processing key:" << key;
2933
bool result = m_keyEventMap.contains(key);
3034
if (result) {
3135
//如果有注册对应的key事件 开始处理
36+
qCDebug(ClientLogger) << "Found registered handler for key, delegating to handler";
3237
result = m_keyEventMap[key]->dealEvent();
38+
} else {
39+
qCDebug(ClientLogger) << "No handler registered for key:" << key;
3340
}
3441
return result;
3542
}
@@ -40,8 +47,12 @@ bool CKeyPressPrxy::keyPressDeal(int key)
4047
*/
4148
void CKeyPressPrxy::addkeyPressDeal(CKeyPressDealBase *deal)
4249
{
43-
if (deal != nullptr)
50+
if (deal != nullptr) {
51+
qCDebug(ClientLogger) << "CKeyPressPrxy::addkeyPressDeal - Adding handler for key:" << deal->getKey();
4452
m_keyEventMap[deal->getKey()] = deal;
53+
} else {
54+
qCDebug(ClientLogger) << "CKeyPressPrxy::addkeyPressDeal - Attempted to add null handler";
55+
}
4556
}
4657

4758
/**
@@ -50,8 +61,16 @@ void CKeyPressPrxy::addkeyPressDeal(CKeyPressDealBase *deal)
5061
*/
5162
void CKeyPressPrxy::removeDeal(CKeyPressDealBase *deal)
5263
{
53-
if (m_keyEventMap.contains(deal->getKey())) {
54-
m_keyEventMap.remove(deal->getKey());
55-
delete deal;
64+
if (deal != nullptr) {
65+
qCDebug(ClientLogger) << "CKeyPressPrxy::removeDeal - Removing handler for key:" << deal->getKey();
66+
if (m_keyEventMap.contains(deal->getKey())) {
67+
m_keyEventMap.remove(deal->getKey());
68+
delete deal;
69+
qCDebug(ClientLogger) << "Handler removed and deleted";
70+
} else {
71+
qCDebug(ClientLogger) << "No handler found for key:" << deal->getKey();
72+
}
73+
} else {
74+
qCDebug(ClientLogger) << "CKeyPressPrxy::removeDeal - Attempted to remove null handler";
5675
}
5776
}

calendar-client/src/KeyPress/ckeyrightdeal.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@
66

77
#include "graphicsItem/cscenebackgrounditem.h"
88
#include "cgraphicsscene.h"
9+
#include "commondef.h"
910

1011
#include <QDebug>
1112

1213
CKeyRightDeal::CKeyRightDeal(QGraphicsScene *scene)
1314
: CKeyPressDealBase(Qt::Key_Right, scene)
1415
{
16+
qCDebug(ClientLogger) << "CKeyRightDeal constructor initialized";
1517
}
1618

1719
bool CKeyRightDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *scene)
1820
{
21+
qCDebug(ClientLogger) << "CKeyRightDeal::focusItemDeal - Processing right key for date:" << item->getDate();
1922
item->initState();
2023
if (item->getRightItem() != nullptr) {
24+
qCDebug(ClientLogger) << "Right item exists, setting focus to right item";
2125
scene->setCurrentFocusItem(item->getRightItem());
2226
item->getRightItem()->setItemFocus(true);
2327
} else {
28+
qCDebug(ClientLogger) << "Right item is null, switching to next day";
2429
scene->setNextPage(item->getDate().addDays(1));
2530
}
2631
return true;

calendar-client/src/KeyPress/ckeyupdeal.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,26 @@
66

77
#include "graphicsItem/cscenebackgrounditem.h"
88
#include "cgraphicsscene.h"
9+
#include "commondef.h"
910

1011
#include <QDebug>
1112

1213
CKeyUpDeal::CKeyUpDeal(QGraphicsScene *scene)
1314
: CKeyPressDealBase(Qt::Key_Up, scene)
1415
{
16+
qCDebug(ClientLogger) << "CKeyUpDeal constructor initialized";
1517
}
1618

1719
bool CKeyUpDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *scene)
1820
{
21+
qCDebug(ClientLogger) << "CKeyUpDeal::focusItemDeal - Processing up key for date:" << item->getDate();
1922
item->initState();
2023
if (item->getUpItem() != nullptr) {
24+
qCDebug(ClientLogger) << "Up item exists, setting focus to up item";
2125
scene->setCurrentFocusItem(item->getUpItem());
2226
item->getUpItem()->setItemFocus(true);
2327
} else {
28+
qCDebug(ClientLogger) << "Up item is null, switching to previous week";
2429
scene->setPrePage(item->getDate().addDays(-7));
2530
}
2631
return true;

calendar-client/src/KeyPress/cscenetabkeydeal.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,32 @@
66

77
#include "graphicsItem/cscenebackgrounditem.h"
88
#include "cgraphicsscene.h"
9+
#include "commondef.h"
910

1011
#include <QDebug>
1112
#include <QGraphicsView>
1213

1314
CSceneTabKeyDeal::CSceneTabKeyDeal(QGraphicsScene *scene)
1415
: CKeyPressDealBase(Qt::Key_Tab, scene)
1516
{
17+
qCDebug(ClientLogger) << "CSceneTabKeyDeal constructor initialized";
1618
}
1719

1820
bool CSceneTabKeyDeal::focusItemDeal(CSceneBackgroundItem *item, CGraphicsScene *scene)
1921
{
22+
qCDebug(ClientLogger) << "CSceneTabKeyDeal::focusItemDeal - Processing tab key for date:" << item->getDate();
2023
CSceneBackgroundItem *nextItem = qobject_cast<CSceneBackgroundItem *>(item->setNextItemFocusAndGetNextItem());
2124
if (nextItem == nullptr) {
25+
qCDebug(ClientLogger) << "No next item found, clearing focus";
2226
scene->setCurrentFocusItem(nullptr);
2327
item->setItemFocus(false);
2428
return false;
2529
} else {
30+
qCDebug(ClientLogger) << "Found next item for date:" << nextItem->getDate();
2631
CFocusItem *focusItem = nextItem->getFocusItem();
2732
//如果当前焦点显示不为背景则定位到当前焦点item位置
2833
if (focusItem->getItemType() != CFocusItem::CBACK) {
34+
qCDebug(ClientLogger) << "Focus item is not background, centering view on item";
2935
QGraphicsView *view = scene->views().at(0);
3036
QPointF point(scene->width() / 2, focusItem->rect().y());
3137
view->centerOn(point);

0 commit comments

Comments
 (0)