Skip to content

added playback commands state#33850

Closed
igorkorsukov wants to merge 1 commit into
musescore:mainfrom
igorkorsukov:w/rcmd/rcmd_step4
Closed

added playback commands state#33850
igorkorsukov wants to merge 1 commit into
musescore:mainfrom
igorkorsukov:w/rcmd/rcmd_step4

Conversation

@igorkorsukov

@igorkorsukov igorkorsukov commented Jun 17, 2026

Copy link
Copy Markdown
Member

Key points:

  • Like with the register, there is a single interface for obtaining the state of any command; it uses the states of specific modules.
  • The implementation of calculating the states of specific commands is located in the module that processes these commands.
  • We need to manage all state changes ourselves to notify about state changes. (For simplicity, we can think of this as the availability of menu items, although in reality it's not directly related to menus.)
  • I added constants for the commands there, and I'm still confused by this decision, since it will lead to one module being dependent on another... But in our case, they are already linked at the compiler level; the main thing is not to link them at the link level.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR splits the existing monolithic PlaybackCommands class into three distinct components. The public playbackcommands.h header is changed to define three inline muse::rcommand::Command constants (PLAY_COMMAND, PAUSE_COMMAND, STOP_COMMAND) instead of a class. A new PlaybackCommandsRegister class implements IModuleCommandsRegister to provide the command and command-info lists. A new PlaybackCommandsState class implements IModuleCommandsState, wiring to IPlaybackController, IGlobalContext, and IInteractive signals to reactively compute and publish per-command enable states. playbackmodule.cpp is updated to register both new components in the IoC container, and CMakeLists.txt is updated to include the new source files. Additionally, the muse_framework submodule URL is switched from HTTPS to SSH, and the muse submodule commit pointer is advanced.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete, missing the required GitHub issue reference, CLA signature confirmation, and most of the checklist items. Only key technical points are provided without addressing template requirements. Complete the required template sections: add GitHub issue number under 'Resolves:', check all applicable checkboxes, and provide details on testing and compliance with coding rules.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change—adding a playback commands state system—which is reflected in the multiple new files and modifications related to command state management.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Review ran into problems

🔥 Problems

Linked repositories: Your configuration references 1 linked repositories, but your current plan allows 0. Analyzed ``, skipped musescore/muse_framework.git.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.gitmodules:
- Line 3: The SSH URL format in the `.gitmodules` file for the muse_framework
submodule conflicts with the HTTPS URL validation logic in the
`check_submodules.yml` CI workflow. Either revert the submodule URL back to
HTTPS format in `.gitmodules` or update the URL validation check in
`check_submodules.yml` to accept the SSH format. Choose one approach and ensure
both the submodule configuration and the CI verification contract are aligned.

In `@src/playback/internal/playbackcommandsstate.cpp`:
- Around line 52-54: The isPlayingChanged() signal subscription in the
playbackController is currently commented out at lines 52-54, but the PLAY
command state at line 97 depends on the isPlaying() status. This means when
playback starts or stops, updateCommandStates() is never called and
commandStateChanged notifications become stale. Uncomment the
playbackController()->isPlayingChanged().onNotify() block to re-enable the
signal connection so that updateCommandStates() is triggered whenever the
playing state changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4b82f1b3-b706-4f28-92af-64d5cef66bf4

📥 Commits

Reviewing files that changed from the base of the PR and between 683e084 and 5fa1cfc.

📒 Files selected for processing (9)
  • .gitmodules
  • muse
  • src/playback/CMakeLists.txt
  • src/playback/internal/playbackcommandsregister.cpp
  • src/playback/internal/playbackcommandsregister.h
  • src/playback/internal/playbackcommandsstate.cpp
  • src/playback/internal/playbackcommandsstate.h
  • src/playback/playbackcommands.h
  • src/playback/playbackmodule.cpp

Comment thread .gitmodules
[submodule "muse_framework"]
path = muse
url = https://github.com/musescore/muse_framework.git
url = git@github.com:igorkorsukov/muse_framework.git

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Keep the submodule URL aligned with CI.

check_submodules.yml still validates the HTTPS URL, so this SSH change breaks the submodule verification job and fails the build. Either revert this line or update the workflow contract in the same PR.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.gitmodules at line 3, The SSH URL format in the `.gitmodules` file for the
muse_framework submodule conflicts with the HTTPS URL validation logic in the
`check_submodules.yml` CI workflow. Either revert the submodule URL back to
HTTPS format in `.gitmodules` or update the URL validation check in
`check_submodules.yml` to accept the SSH format. Choose one approach and ensure
both the submodule configuration and the CI verification contract are aligned.

Source: Pipeline failures

Comment on lines +52 to +54
// playbackController()->isPlayingChanged().onNotify(this, [this]() {
// updateCommandStates();
// });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Re-enable isPlayingChanged() updates for PLAY state.

Line 97 derives PLAY state from isPlaying(), but Lines 52-54 disable the isPlayingChanged() subscription. Playback start/stop can therefore leave command state and commandStateChanged notifications stale.

Suggested fix
-    // playbackController()->isPlayingChanged().onNotify(this, [this]() {
-    //     updateCommandStates();
-    // });
+    playbackController()->isPlayingChanged().onNotify(this, [this]() {
+        updateCommandStates();
+    });

Also applies to: 96-99

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/playback/internal/playbackcommandsstate.cpp` around lines 52 - 54, The
isPlayingChanged() signal subscription in the playbackController is currently
commented out at lines 52-54, but the PLAY command state at line 97 depends on
the isPlaying() status. This means when playback starts or stops,
updateCommandStates() is never called and commandStateChanged notifications
become stale. Uncomment the playbackController()->isPlayingChanged().onNotify()
block to re-enable the signal connection so that updateCommandStates() is
triggered whenever the playing state changes.

@igorkorsukov

Copy link
Copy Markdown
Member Author

replaced by #33854

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.

1 participant