Skip to content

refactor: improve thememanager logging and date handling - #201

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master
Oct 20, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
18202781743:master

Conversation

@18202781743

@18202781743 18202781743 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
  1. Remove unused QDebug include from sunrisesunset.cpp
  2. Cache date.startOfDay() to avoid redundant computation
  3. Remove debug qInfo logging of raw sunrise/sunset calculations
  4. Add detailed structured logging when auto theme change is triggered
  5. Log includes theme transition, current time, coordinates, UTC offset,
    sunrise and sunset times

The changes reduce unnecessary debug output while adding more
informative logging at the point where theme changes are actually
applied, making it easier to diagnose auto-theme behavior.

Log: Improved auto theme switching diagnostics with detailed change
logging

Influence:

  1. Verify auto theme switching still works correctly at sunrise and
    sunset boundaries
  2. Confirm theme change logs contain accurate timestamps, coordinates,
    and theme names
  3. Test behavior across different UTC offsets and extreme latitudes
  4. Ensure no functional regression from removing the debug log line in
    sunrise/sunset calculation
  5. Verify sunrise/sunset datetime values remain correct after
    refactoring startOfDay caching

refactor: 改进主题管理器日志和日期处理

  1. 移除 sunrisesunset.cpp 中未使用的 QDebug 头文件
  2. 缓存 date.startOfDay() 避免重复计算
  3. 移除日出日落原始计算的调试日志
  4. 在自动主题切换触发时添加详细的结构化日志
  5. 日志包含主题切换、当前时间、坐标、UTC 偏移、日出和日落时间

这些改动减少了不必要的调试输出,同时在主题实际切换处添加了更有信息量的日
志,便于诊断自动主题切换行为。

Log: 通过详细的切换日志改进自动主题切换诊断能力

Influence:

  1. 验证自动主题切换在日出和日落边界仍能正常工作
  2. 确认主题切换日志包含准确的时间戳、坐标和主题名称
  3. 测试不同 UTC 偏移和极端纬度下的行为
  4. 确保移除日出日落计算中的调试日志未造成功能回归
  5. 验证重构 startOfDay 缓存后日出日落时间值仍然正确

Summary by Sourcery

Improve automatic theme switching diagnostics while simplifying sunrise and sunset date calculations.

Enhancements:

  • Improve automatic theme-switch diagnostics with structured logs that record the theme transition, current time, location, UTC offset, sunrise, and sunset.

Chores:

  • Reduce sunrise/sunset calculation noise and streamline date handling by removing unused logging support and reusing the day-start timestamp.

1. Remove unused QDebug include from sunrisesunset.cpp
2. Cache date.startOfDay() to avoid redundant computation
3. Remove debug qInfo logging of raw sunrise/sunset calculations
4. Add detailed structured logging when auto theme change is triggered
5. Log includes theme transition, current time, coordinates, UTC offset,
sunrise and sunset times

The changes reduce unnecessary debug output while adding more
informative logging at the point where theme changes are actually
applied, making it easier to diagnose auto-theme behavior.

Log: Improved auto theme switching diagnostics with detailed change
logging

Influence:
1. Verify auto theme switching still works correctly at sunrise and
sunset boundaries
2. Confirm theme change logs contain accurate timestamps, coordinates,
and theme names
3. Test behavior across different UTC offsets and extreme latitudes
4. Ensure no functional regression from removing the debug log line in
sunrise/sunset calculation
5. Verify sunrise/sunset datetime values remain correct after
refactoring startOfDay caching

refactor: 改进主题管理器日志和日期处理

1. 移除 sunrisesunset.cpp 中未使用的 QDebug 头文件
2. 缓存 date.startOfDay() 避免重复计算
3. 移除日出日落原始计算的调试日志
4. 在自动主题切换触发时添加详细的结构化日志
5. 日志包含主题切换、当前时间、坐标、UTC 偏移、日出和日落时间

这些改动减少了不必要的调试输出,同时在主题实际切换处添加了更有信息量的日
志,便于诊断自动主题切换行为。

Log: 通过详细的切换日志改进自动主题切换诊断能力

Influence:
1. 验证自动主题切换在日出和日落边界仍能正常工作
2. 确认主题切换日志包含准确的时间戳、坐标和主题名称
3. 测试不同 UTC 偏移和极端纬度下的行为
4. 确保移除日出日落计算中的调试日志未造成功能回归
5. 验证重构 startOfDay 缓存后日出日落时间值仍然正确
@18202781743
18202781743 requested review from BLumia and mhduiy October 20, 2026 13:17
@sourcery-ai

sourcery-ai Bot commented Oct 20, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

The PR refactors sunrise/sunset datetime calculation to reuse a cached start-of-day value and removes noisy raw-calculation logging, while adding a detailed ISO-formatted diagnostic record immediately before each automatic theme transition is applied.

Sequence diagram for automatic theme change diagnostics

sequenceDiagram
    participant ThemeManager
    participant SunriseSunset
    participant Logger
    participant SystemTheme

    ThemeManager->>SunriseSunset: getSunriseSunset(latitude, longitude, utcOffset)
    SunriseSunset-->>ThemeManager: sunrise, sunset
    ThemeManager->>Logger: qInfo Auto theme change requested
    ThemeManager->>SystemTheme: doSetGlobalTheme(themeType)
Loading

File-Level Changes

Change Details Files
Reduce redundant date computation and remove obsolete sunrise/sunset diagnostics while preserving calculated datetime values.
  • Remove the unused QDebug dependency.
  • Cache date.startOfDay() and reuse it for sunrise and sunset.
  • Remove raw calculation qInfo output.
src/plugin-qt/thememanager/sunrisesunset.cpp
Add structured diagnostic logging at the point an automatic theme transition is applied.
  • Log source and destination themes, using unset when no prior theme exists.
  • Include current time, coordinates, UTC offset, sunrise, and sunset in ISO-formatted fields.
  • Emit the log immediately before updating the current theme and applying the global theme.
src/plugin-qt/thememanager/thememanager.cpp
Update SPDX copyright ranges for the modified implementation files.
  • Extend the copyright year from 2025 to 2025–2026.
src/plugin-qt/thememanager/sunrisesunset.cpp
src/plugin-qt/thememanager/thememanager.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, mhduiy

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mhduiy

mhduiy commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 20, 2026

Copy link
Copy Markdown

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit a487d8e into linuxdeepin:master Oct 20, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants