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

refactor: Implement tab state management with unique IDs #2540

Merged
merged 1 commit into from
Jan 7, 2025

Conversation

Lighto-Ku
Copy link
Contributor

This commit refactors the tab management system to use unique IDs instead of indices, and adds state persistence for tabs. Key changes include:

  • Add unique ID management for tabs with getter/setter methods
  • Refactor TabBar signals to use unique IDs and handle tab state changes
  • Add TitleBarState struct to store view mode, search state and text per tab
  • Implement state save/restore when switching between tabs
  • Refactor WorkspaceWidget to use page-based management with unique IDs
  • Update event system to handle tab creation, removal and changes with unique IDs

The changes improve tab state management by:

  1. Making tab identification more robust using unique IDs
  2. Preserving view mode, search state and text when switching tabs
  3. Better handling of tab lifecycle events through the workspace
  4. Cleaner separation of concerns between tab bar and workspace components

Log: refactor tab manage
Task: https://pms.uniontech.com/story-view-37823.html

@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • TitleBarEventCaller::sendTabChanged 函数中,uniqueId 参数的类型从 int 更改为 const QString &,但未检查 tabIndex 是否有效。
  • TabBar::removeTab 函数中,删除标签页的逻辑可能存在问题,特别是当当前标签页索引小于删除的标签页索引时。
  • TitleBarWidget::onTabCurrentChanged 函数中,保存和恢复标题栏状态时,未处理 oldIndex 超出范围的情况。
  • WorkspaceEventReceiver::handleTabCreatedhandleTabRemovedhandleTabChanged 函数中,未对 workspacetab 对象的有效性进行检查。
  • WorkspacePage::setUrl 函数中,未处理 viewsviewStackLayout 为空的情况。
  • WorkspaceWidget::createNewPageWorkspaceWidget::removePage 函数中,未处理 pagesviewStackLayout 为空的情况。
  • WorkspaceWidget::setCurrentPage 函数中,未处理 pagesviewStackLayout 为空的情况。

是否建议立即修改:

This commit refactors the tab management system to use unique IDs instead of indices,
and adds state persistence for tabs. Key changes include:

- Add unique ID management for tabs with getter/setter methods
- Refactor TabBar signals to use unique IDs and handle tab state changes
- Add TitleBarState struct to store view mode, search state and text per tab
- Implement state save/restore when switching between tabs
- Refactor WorkspaceWidget to use page-based management with unique IDs
- Update event system to handle tab creation, removal and changes with unique IDs

The changes improve tab state management by:
1. Making tab identification more robust using unique IDs
2. Preserving view mode, search state and text when switching tabs
3. Better handling of tab lifecycle events through the workspace
4. Cleaner separation of concerns between tab bar and workspace components

Log: refactor tab manage
Task: https://pms.uniontech.com/story-view-37823.html
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Johnson-zs, Lighto-Ku

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

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

@Johnson-zs
Copy link
Contributor

/forcemerge

@deepin-bot
Copy link
Contributor

deepin-bot bot commented Jan 7, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit e2ff584 into linuxdeepin:master Jan 7, 2025
18 of 20 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