-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Move Home > Scores > Cloud scores components into project module #33333
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
Merged
igorkorsukov
merged 1 commit into
musescore:master
from
cbjeukendrup:home-scores-cloud-move-into-project
May 8, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
src/project/qml/MuseScore/Project/internal/ScoresPage/CloudScoresGridView.qml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| /* | ||
| * SPDX-License-Identifier: GPL-3.0-only | ||
| * MuseScore-Studio-CLA-applies | ||
| * | ||
| * MuseScore Studio | ||
| * Music Composition & Notation | ||
| * | ||
| * Copyright (C) 2023 MuseScore Limited and others | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU General Public License version 3 as | ||
| * published by the Free Software Foundation. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| */ | ||
| import QtQuick | ||
|
|
||
| import Muse.Ui | ||
| import Muse.UiComponents | ||
| import MuseScore.Project | ||
|
|
||
| ScoresGridView { | ||
| id: root | ||
|
|
||
| navigation.name: "OnlineScoresGrid" | ||
| navigation.accessible.name: qsTrc("project", "Online scores grid") | ||
|
|
||
| isNoResultsMessageAllowed: model.state === CloudScoresModel.Fine | ||
|
|
||
| Component.onCompleted: { | ||
| prv.updateDesiredRowCount() | ||
| } | ||
|
|
||
| Connections { | ||
| target: root.model | ||
|
|
||
| function onStateChanged() { | ||
| if (root.model.state === CloudScoresModel.Fine) { | ||
| // After the model has loaded more, check if even more is needed | ||
| prv.updateDesiredRowCount(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
| QtObject { | ||
| id: prv | ||
|
|
||
| readonly property int remainingFullRowsBelowViewport: | ||
| Math.floor(root.view.count / root.view.columns) - Math.ceil((root.view.contentY + root.view.height) / root.view.cellHeight) | ||
|
|
||
| readonly property bool isSatisfied: remainingFullRowsBelowViewport >= 3 | ||
|
|
||
| onIsSatisfiedChanged: { | ||
| if (!isSatisfied) { | ||
| updateDesiredRowCount(); | ||
| } | ||
| } | ||
|
|
||
| property bool updateDesiredRowCountScheduled: false | ||
|
|
||
| function updateDesiredRowCount() { | ||
| if (updateDesiredRowCountScheduled) { | ||
| return | ||
| } | ||
|
|
||
| if (isSatisfied || !root.model.hasMore) { | ||
| return | ||
| } | ||
|
|
||
| updateDesiredRowCountScheduled = true | ||
|
|
||
| Qt.callLater(function() { | ||
| let newDesiredRowCount = root.model.rowCount + (3 - remainingFullRowsBelowViewport) * view.columns | ||
|
|
||
| if (root.model.desiredRowCount < newDesiredRowCount) { | ||
| root.model.desiredRowCount = newDesiredRowCount | ||
| } | ||
|
|
||
| updateDesiredRowCountScheduled = false | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| view.footer: root.model.state === CloudScoresModel.Loading | ||
| ? busyIndicatorComp : null | ||
|
|
||
| Component { | ||
| id: busyIndicatorComp | ||
|
|
||
| Item { | ||
| width: GridView.view ? GridView.view.width : 0 | ||
| height: indicator.implicitHeight + indicator.anchors.topMargin + indicator.anchors.bottomMargin | ||
|
|
||
| StyledBusyIndicator { | ||
| id: indicator | ||
|
|
||
| anchors.horizontalCenter: parent.horizontalCenter | ||
| anchors.top: parent.top | ||
| anchors.topMargin: root.view.spacingBetweenRows / 2 | ||
| anchors.bottomMargin: root.view.spacingBetweenRows / 2 | ||
| } | ||
| } | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick win
Add defensive guards for early grid geometry values.
Pagination currently assumes valid
cellHeight/columns. Guarding these values avoids unstable desired-row updates during early layout.Proposed patch
Component.onCompleted: { - prv.updateDesiredRowCount() + Qt.callLater(prv.updateDesiredRowCount) } Connections { target: root.model function onStateChanged() { if (root.model.state === CloudScoresModel.Fine) { // After the model has loaded more, check if even more is needed prv.updateDesiredRowCount(); } } } + Connections { + target: root.view + function onCellHeightChanged() { + if (root.view.cellHeight > 0 && root.view.columns > 0) { + prv.updateDesiredRowCount() + } + } + function onColumnsChanged() { + if (root.view.cellHeight > 0 && root.view.columns > 0) { + prv.updateDesiredRowCount() + } + } + } + QtObject { id: prv @@ function updateDesiredRowCount() { + if (root.view.cellHeight <= 0 || root.view.columns <= 0) { + return + } + if (updateDesiredRowCountScheduled) { return }Also applies to: 54-56, 67-87
🤖 Prompt for AI Agents