Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions src/notationscene/qml/MuseScore/NotationScene/NoteInputBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Item {
}
}

FlatButton {
PopupButton {
id: customizeButton

anchors.margins: 4
Expand All @@ -198,15 +198,8 @@ Item {
navigation.order: 100
navigation.accessible.name: qsTrc("notation", "Customize toolbar")

onClicked: {
customizePopup.toggleOpened()
}

NoteInputBarCustomisePopup {
id: customizePopup

anchorItem: !root.floating ? ui.rootItem : null
}
popupAnchorItem: root.floating ? null : ui.rootItem
popupComponent: NoteInputBarCustomisePopup {}
}

states: [
Expand Down
75 changes: 19 additions & 56 deletions src/palette/qml/MuseScore/Palette/internal/PalettesPanelHeader.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Item {
readonly property bool isSearchFieldFocused: searchField.activeFocus
readonly property string searchText: searchField.searchText

property alias popupMaxHeight: addPalettesPopup.maxHeight
property int popupMaxHeight: 400
property var popupAnchorItem: null

property alias navigation: navPanel
Expand Down Expand Up @@ -68,46 +68,7 @@ Item {
}
}

QtObject {
id: prv

property var openedPopup: null
property bool isPopupOpened: Boolean(openedPopup) && openedPopup.isOpened

function openPopup(popup, model) {
if (isPopupOpened) {
if (openedPopup === popup) {
resetOpenedPopup()
return
}

resetOpenedPopup()
}

if (Boolean(popup)) {
openedPopup = popup

if (Boolean(model)) {
popup.model = model
}

popup.open()
}
}

function closeOpenedPopup() {
if (isPopupOpened) {
resetOpenedPopup()
}
}

function resetOpenedPopup() {
openedPopup.close()
openedPopup = null
}
}

FlatButton {
PopupButton {
id: addPalettesButton
objectName: "AddPalettesBtn"

Expand All @@ -122,30 +83,31 @@ Item {
visible: !root.isSearchOpened
enabled: visible

onClicked: {
prv.openPopup(addPalettesPopup, root.paletteProvider.availableExtraPalettesModel())
}
popupAnchorItem: root.popupAnchorItem

AddPalettesPopup {
id: addPalettesPopup
popupComponent: AddPalettesPopup {
paletteProvider: root.paletteProvider

model: root.paletteProvider ? root.paletteProvider.availableExtraPalettesModel() : null
popupAvailableWidth: root.width
anchorItem: root.popupAnchorItem
maxHeight: root.popupMaxHeight

onAddCustomPaletteRequested: {
prv.openPopup(createCustomPalettePopup)
addPalettesButton.close()
createCustomPalettePopupLoader.toggleOpened()
}
}

CreateCustomPalettePopup {
id: createCustomPalettePopup
StyledPopupLoader {
id: createCustomPalettePopupLoader

popupAvailableWidth: root.width
anchorItem: root.popupAnchorItem
popupAnchorItem: root.popupAnchorItem

sourceComponent: CreateCustomPalettePopup {
popupAvailableWidth: root.width

onAddCustomPaletteRequested: function(paletteName) {
root.addCustomPaletteRequested(paletteName)
onAddCustomPaletteRequested: function(paletteName) {
root.addCustomPaletteRequested(paletteName)
}
}
}
}
Expand All @@ -165,7 +127,8 @@ Item {
enabled: visible

onClicked: {
prv.closeOpenedPopup()
addPalettesButton.close()
createCustomPalettePopupLoader.close()
root.startSearch()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,13 @@ Item {
Component {
id: tempoButtonComponent

FlatButton {
PopupButton {
id: playbackSpeedButton

implicitWidth: tempoLoader.tempoViewWidth
implicitHeight: root.height

accentButton: playbackSpeedPopup.isOpened
transparent: !accentButton
transparent: !root.isPopupOpened

toolTipTitle: qsTrc("playback", "Speed")

Expand All @@ -236,14 +237,10 @@ Item {
tempoValueFont: timeField.font
}

onClicked: {
playbackSpeedPopup.toggleOpened()
}

PlaybackSpeedPopup {
id: playbackSpeedPopup
property PlaybackToolBarModel playbackModel: root.playbackModel

playbackModel: root.playbackModel
popupComponent: PlaybackSpeedPopup {
playbackModel: playbackSpeedButton.playbackModel
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,40 +19,29 @@
* 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 QtQuick
import QtQuick.Layouts

import Muse.Ui
import Muse.UiComponents
import MuseScore.Project

FlatButton {
PopupButton {
id: root

property var model: null
readonly property var mode: bar.currentIndex === 0 ? "major" : "minor"
property string mode: "major"
property string currentValueAccessibleName: title.text

property alias popupAnchorItem: popup.anchorItem

height: 96
accentButton: popup.isOpened

KeySignature {
id: title
icon: root.model.keySignature.icon
text: root.mode === "major" ? root.model.keySignature.titleMajor : root.model.keySignature.titleMinor
}

onClicked: {
if (!popup.isOpened) {
popup.open()
} else {
popup.close()
}
}

StyledPopupView {
popupComponent: StyledPopupView {
id: popup

margins: 20
Expand All @@ -73,6 +62,12 @@ FlatButton {
id: bar
Layout.alignment: Qt.AlignHCenter

currentIndex: root.mode === "major" ? 0 : 1

onCurrentIndexChanged: {
root.mode = currentIndex === 0 ? "major" : "minor"
}

onCurrentItemChanged: {
if (currentItem && currentItem.navigation) {
currentItemNavigationIndex = [currentItem.navigation.row, currentItem.navigation.column]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

pragma ComponentBehavior: Bound

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Expand All @@ -30,16 +27,13 @@ import Muse.Ui
import Muse.UiComponents
import MuseScore.Project

FlatButton {
PopupButton {
id: root

property var model: null
property string currentValueAccessibleName: title.text

property alias popupAnchorItem: popup.anchorItem

height: 96
accentButton: popup.isOpened

StyledTextLabel {
id: title
Expand All @@ -48,7 +42,7 @@ FlatButton {
anchors.verticalCenter: parent.verticalCenter

property string pickupMessage: {
if (withPickupMeasure.checked) {
if (root.model.withPickupMeasure) {
return qsTrc("project/newscore", "pickup:") + " " +
root.model.pickupTimeSignature.numerator + "/" + root.model.pickupTimeSignature.denominator
}
Expand All @@ -60,15 +54,7 @@ FlatButton {
text: qsTrc("project/newscore", "%Ln measure(s),", "", root.model.measureCount) + "\n" + pickupMessage
}

onClicked: {
if (!popup.isOpened) {
popup.open()
} else {
popup.close()
}
}

StyledPopupView {
popupComponent: StyledPopupView {
id: popup

margins: 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

pragma ComponentBehavior: Bound

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Expand All @@ -31,17 +28,14 @@ import Muse.UiComponents
import MuseScore.Project
import MuseScore.NotationScene

FlatButton {
PopupButton {
id: root

property AdditionalInfoModel model: null
property string currentValueAccessibleName: model.tempoAccessibleName(root.model.tempo.noteIcon,
root.model.tempo.withDot) + " " + root.model.tempo.value

property alias popupAnchorItem: popup.anchorItem

height: 96
accentButton: popup.isOpened

TempoView {
anchors.centerIn: parent
Expand All @@ -55,15 +49,7 @@ FlatButton {
noteSymbolTopPadding: 22
}

onClicked: {
if (!popup.isOpened) {
popup.open()
} else {
popup.close()
}
}

StyledPopupView {
popupComponent: StyledPopupView {
id: popup

margins: 0
Expand Down
Loading
Loading