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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/plugin-qt/thememanager/sunrisesunset.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

#include "sunrisesunset.h"

#include <QDebug>
#include <QtMath>

Check warning on line 7 in src/plugin-qt/thememanager/sunrisesunset.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtMath> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QTime>

Check warning on line 8 in src/plugin-qt/thememanager/sunrisesunset.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QTime> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#define ZENITH -0.833333333333333333
enum CalcSunType:int{
Expand Down Expand Up @@ -96,8 +95,9 @@
if (sunsetUT <= -100) // 长昼 返回的sunrise-sunset区间用于判断当前是否为白天
sunsetUT = 100;

sunrise = date.startOfDay().addMSecs(static_cast<int>(sunriseUT * 3600 * 1000));
sunset = date.startOfDay().addMSecs(static_cast<int>(sunsetUT * 3600 * 1000));
qInfo() << __FUNCTION__ << date << latitude << longitude << sunriseUT << sunrise << sunsetUT << sunset;
const QDateTime startOfDay = date.startOfDay();
sunrise = startOfDay.addMSecs(static_cast<int>(sunriseUT * 3600 * 1000));
sunset = startOfDay.addMSecs(static_cast<int>(sunsetUT * 3600 * 1000));

return true;
}
12 changes: 11 additions & 1 deletion src/plugin-qt/thememanager/thememanager.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2025 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: LGPL-3.0-or-later

Expand Down Expand Up @@ -158,6 +158,16 @@ void ThemeManager::autoSetTheme(double latitude, double longitude)
}

if (m_curThemeType != themeType) {
qInfo().noquote().nospace()
<< "[thememanager] Auto theme change requested: from="
<< (m_curThemeType.isEmpty() ? QStringLiteral("unset") : m_curThemeType)
<< ", to=" << themeType
<< ", current_time=" << curr.toString(Qt::ISODate)
<< ", latitude=" << latitude
<< ", longitude=" << longitude
<< ", utc_offset_hours=" << utcOffset
<< ", sunrise=" << sunrise.toString(Qt::ISODate)
<< ", sunset=" << sunset.toString(Qt::ISODate);
m_curThemeType = themeType;
doSetGlobalTheme(themeType);
}
Expand Down
Loading