Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the taskbar display incorrectly #503

Merged
merged 1 commit into from
Jul 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/dde-dock-plugins/recordtime/timewidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ TimeWidget::TimeWidget(DWidget *parent):
m_position(-1),
m_hover(false),
m_pressed(false),
m_systemVersion(0)
m_systemVersion(0),
m_timerCount(0)
{
m_systemVersion = DSysInfo::minorVersion().toInt() ;
qInfo() << "Current system version: " << m_systemVersion;
Expand Down Expand Up @@ -132,6 +133,7 @@ QSize TimeWidget::sizeHint() const

void TimeWidget::onTimeout()
{
m_timerCount++;
if (m_bRefresh) {
if (m_currentIcon == m_lightIcon)
m_currentIcon = m_shadeIcon;
Expand All @@ -140,8 +142,7 @@ void TimeWidget::onTimeout()
}
m_bRefresh = !m_bRefresh;
QTime showTime(0, 0, 0);
int time = m_baseTime.secsTo(QTime::currentTime());
showTime = showTime.addSecs(time);
showTime = showTime.addMSecs(m_timerCount * 400);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

自己计算时间的话,建议添加到多线程里面去,或者修改时间停止录制视频。

m_showTimeStr = showTime.toString("hh:mm:ss");
update();
}
Expand Down Expand Up @@ -411,6 +412,7 @@ void TimeWidget::start()
connect(m_timer, SIGNAL(timeout()), this, SLOT(onTimeout()));
m_baseTime = QTime::currentTime();
m_timer->start(400);
m_timerCount = 0;
}

void TimeWidget::stop()
Expand Down
2 changes: 1 addition & 1 deletion src/dde-dock-plugins/recordtime/timewidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private slots:
bool m_hover;
bool m_pressed;
int m_systemVersion;

int m_timerCount;
/**
* @brief m_lightIcon1070 1070下录屏计时图标icon
*/
Expand Down
Loading