fix: show loading page before delayed archive loading on Wayland#406
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideOn Wayland, ensure the loading page is shown immediately when opening an archive whose actual load is delayed by a QTimer, preventing a brief flash of the home page before the loading animation. Sequence diagram for delayed archive loading with immediate loading page on WaylandsequenceDiagram
actor User
participant MainWindow
participant UiTools
participant QTimer
participant UI
participant ArchiveLoader
User->>MainWindow: handleArguments_Open(listParam)
MainWindow->>UiTools: isWayland()
UiTools-->>MainWindow: true
MainWindow->>MainWindow: firstLoad check and set false
MainWindow->>MainWindow: path = listParam[0]
MainWindow->>MainWindow: m_ePageID = PI_Loading
MainWindow->>UI: refreshPage()
MainWindow->>QTimer: singleShot(200ms, callback)
QTimer-->>MainWindow: callback after 200ms
MainWindow->>ArchiveLoader: loadArchive(path)
ArchiveLoader-->>UI: display archive contents
Class diagram for MainWindow loading state handling on WaylandclassDiagram
class MainWindow {
- PageID m_ePageID
- bool firstLoad
+ bool handleArguments_Open(QStringList listParam)
+ void refreshPage()
+ void loadArchive(QString path)
}
class UiTools {
+ static bool isWayland()
}
class QTimer {
+ static void singleShot(int msec, Callable callback)
}
MainWindow ..> UiTools : uses
MainWindow ..> QTimer : schedules_delay
MainWindow ..> MainWindow : updates_m_ePageID_and_refreshPage
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
On Wayland, the window position is set by the compositor for non-first instances. Previously the archive loading was delayed unconditionally on Wayland, causing the home page to flash. Now only non-first instances delay loading, and show the loading animation before the delay to avoid flashing. Bug: https://pms.uniontech.com/bug-view-359077.html
deepin pr auto review这段代码的修改主要针对 Wayland 环境下的多实例弹窗显示问题,通过引入延迟加载机制来解决窗口位置设置的问题。以下是对这段代码的审查意见: 1. 语法逻辑审查优点:
问题与建议:
2. 代码质量审查优点:
问题与建议:
3. 代码性能审查优点:
问题与建议:
4. 代码安全审查问题与建议:
综合改进建议
这些改进将使代码更健壮、更易维护,同时保持原有功能不变。 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: LiHua000, max-lvs The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
On Wayland, loadArchive is deferred by 200ms via QTimer but the page ID was not set to PI_Loading beforehand, causing the home page to flash briefly before the loading animation appeared.
Bug: https://pms.uniontech.com/bug-view-359077.html
Summary by Sourcery
Bug Fixes: