Skip to content

Conversation

@BLumia
Copy link
Member

@BLumia BLumia commented May 16, 2025

为后续多任务区域切换到新的合并模型做出准备。
目前的表现行为仍然和之前一致,无行为变化(taskmanager实际使用的仍然是原模型)。

Summary by Sourcery

Refactor TaskManager to build a new combined data-model pipeline through proxy models and an abstract interface, enabling future multi-task area support without altering current behavior.

Enhancements:

  • Introduce AbstractTaskManagerInterface and BoolFilterModel to standardize task activation and filtering operations.
  • Add DockCombineModel, DockGlobalElementModel, DockItemModel, and DockGroupModel to merge, group, and present application and dock elements.
  • Extend TaskManager to use the new models, route QML invocations through the abstract interface, and expose an updated roles enum.
  • Update TaskManagerSettings to load and persist a new ‘dockedElements’ configuration for global dock entries.

Build:

  • Add new model headers and source files to the taskmanager CMakeLists.txt for the combined-model refactor.

@BLumia BLumia requested review from 18202781743 and tsic404 May 16, 2025 05:30
@sourcery-ai
Copy link

sourcery-ai bot commented May 16, 2025

Reviewer's Guide

Refactor introduces a unified proxy‐model pipeline and an abstract interface to prepare for a combined model in TaskManager, without altering existing behavior.

File-Level Changes

Change Details Files
Introduce AbstractTaskManagerInterface for unified request forwarding
  • Add abstracttaskmanagerinterface.h with request* pure virtuals
  • Add callInterfaceMethod templates to map proxy calls to source models
  • Update TaskManager and proxy models to implement and use the interface
panels/dock/taskmanager/abstracttaskmanagerinterface.h
panels/dock/taskmanager/taskmanager.h
panels/dock/taskmanager/taskmanager.cpp
panels/dock/taskmanager/dockcombinemodel.cpp
panels/dock/taskmanager/dockitemmodel.cpp
panels/dock/taskmanager/dockgroupmodel.cpp
Reconstruct TaskManager to build model pipeline and expose interface
  • Define Roles enum and change dataModel property to QAbstractItemModel*
  • Create BoolFilterModel and use it to filter out skipped windows
  • Chain DockCombineModel, DockGlobalElementModel, DockItemModel
  • Implement Q_INVOKABLE request* methods forwarding to itemModel
panels/dock/taskmanager/taskmanager.h
panels/dock/taskmanager/taskmanager.cpp
Add new proxy models to support combined and grouped views
  • DockCombineModel merges major/minor models and remaps roles
  • DockGlobalElementModel aggregates active and docked elements
  • DockItemModel toggles between split and grouped source models
  • DockGroupModel groups multiple windows under one entry
panels/dock/taskmanager/dockcombinemodel.h
panels/dock/taskmanager/dockcombinemodel.cpp
panels/dock/taskmanager/dockglobalelementmodel.h
panels/dock/taskmanager/dockglobalelementmodel.cpp
panels/dock/taskmanager/dockitemmodel.h
panels/dock/taskmanager/dockitemmodel.cpp
panels/dock/taskmanager/dockgroupmodel.h
panels/dock/taskmanager/dockgroupmodel.cpp
Extend TaskManagerSettings to persist and signal dockedElements
  • Add TASKMANAGER_DOCKEDELEMENTS_KEY constant
  • Introduce m_dockedElements property with getter and signal
  • Load and emit dockedElementsChanged in constructor and on config changes
panels/dock/taskmanager/taskmanagersettings.h
panels/dock/taskmanager/taskmanagersettings.cpp
Add new constants for actions, settings keys, and model roles
  • Define DOCK_ACTION_* strings and TASKMANAGER_DOCKEDELEMENTS_KEY
  • Add MODEL_* role name constants and DEFAULT_APP_ICONNAME
panels/dock/taskmanager/globals.h
Update build configuration to include new model sources
  • Add dockcombinemodel, dockglobalelementmodel, dockitemmodel, dockgroupmodel files to CMakeLists
panels/dock/taskmanager/CMakeLists.txt

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @BLumia - I've reviewed your changes - here's some feedback:

  • The stubbed-out AbstractTaskManagerInterface methods in DockGlobalElementModel (e.g. requestOpenUrls, requestUpdateWindowGeometry, requestWindowsView) are currently no-ops—either implement them or remove them to avoid silent failures.
  • Avoid using synchronous QProcess::waitForFinished in DockGlobalElementModel::requestNewInstance since it blocks the UI thread; consider launching the process asynchronously or using a job API instead.
  • In BoolFilterModel::filterAcceptsRow, the check if (sourceRow > sourceModel()->rowCount()) should use >= to correctly guard against out-of-range row indices.
Here's what I looked at during the review
  • 🟡 General issues: 2 issues found
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@BLumia BLumia force-pushed the more-feature-branch-porting branch from 0adae88 to 145b6a0 Compare May 16, 2025 06:54
@BLumia BLumia force-pushed the more-feature-branch-porting branch 2 times, most recently from de92edc to 100ddf3 Compare May 16, 2025 08:26
@BLumia BLumia force-pushed the more-feature-branch-porting branch from 100ddf3 to dd30123 Compare May 16, 2025 09:53
@BLumia BLumia requested a review from 18202781743 May 16, 2025 09:54
为后续多任务区域切换到新的合并模型做出准备.
目前的表现行为仍然和之前一致,无行为变化(taskmanager实际使用的仍然是原模型).

Log:
@BLumia BLumia force-pushed the more-feature-branch-porting branch from dd30123 to 165193f Compare May 19, 2025 02:55
@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

@BLumia BLumia merged commit 181e6da into linuxdeepin:master May 19, 2025
7 of 10 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