From 3324a4692f8cda5b9d48afb90d8c177977ac6fe0 Mon Sep 17 00:00:00 2001 From: SeeLook <945374+SeeLook@users.noreply.github.com> Date: Thu, 5 Oct 2017 22:19:14 +0200 Subject: [PATCH] Adjust QML score part for single note mode, scale staff properly, lock score actions --- src/qml/MainScore.qml | 34 ++++++++++++++++++++++++++++------ src/qml/NoteName.qml | 3 +++ src/qml/score/AddLine.qml | 2 +- src/qml/score/NoteCursor.qml | 5 +++-- src/qml/score/Score.qml | 1 + src/qml/score/Staff.qml | 3 ++- 6 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/qml/MainScore.qml b/src/qml/MainScore.qml index 8355e808a..34255df2c 100644 --- a/src/qml/MainScore.qml +++ b/src/qml/MainScore.qml @@ -25,7 +25,7 @@ Score { property alias recModeAct: recModeAct property alias playAct: playAct - scoreObj.meter: GLOB.rhythmsEnabled ? Tmeter.Meter_4_4 : Tmeter.NoMeter + scoreObj.meter: GLOB.rhythmsEnabled && !GLOB.singleNoteMode ? Tmeter.Meter_4_4 : Tmeter.NoMeter focus: true onFocusChanged: { @@ -41,7 +41,8 @@ Score { scoreObj.nameColor: GLOB.nameColor scoreObj.nameStyle: GLOB.noteNameStyle scoreObj.enableDoubleAccidentals: GLOB.enableDoubleAccids - scoreObj.allowAdding: true + scoreObj.allowAdding: !GLOB.singleNoteMode + Timer { id: zoomTimer; interval: 500 } MouseArea { @@ -73,15 +74,27 @@ Score { color: activPal.text font { family: "Sans"; pointSize: 1.5 } text: getKeyNameText() - Connections { - target: GLOB - onKeyNameChanged: keyName.text = Qt.binding(keyName.getKeyNameText) - } function getKeyNameText() { return enableKeySign && firstStaff.keySignature ? Noo.majAndMinKeyName(firstStaff.keySignature.key) : "" } } + Component.onCompleted: { + scoreObj.singleNote = GLOB.singleNoteMode + } + + Connections { + target: GLOB + onKeyNameChanged: keyName.text = Qt.binding(keyName.getKeyNameText) + onSingleNoteModeChanged: { + scoreObj.singleNote = GLOB.singleNoteMode + if (GLOB.singleNoteMode) { + recordMode = false + scoreObj.note(1).visible = Qt.binding(function() { return GLOB.showEnharmNotes }) + scoreObj.note(2).visible = Qt.binding(function() { return GLOB.showEnharmNotes && GLOB.enableDoubleAccids }) + } + } + } Rectangle { // note highlight id: noteHighlight @@ -134,11 +147,13 @@ Score { } Taction { id: extraAccidsAct + enabled: !GLOB.singleNoteMode text: qsTr("Additional accidentals") checkable: true } Taction { id: showNamesAct + enabled: !GLOB.singleNoteMode text: qsTr("Show note names") checkable: true checked: GLOB.namesOnScore @@ -146,6 +161,7 @@ Score { } Taction { id: zoomOutAct + enabled: !GLOB.singleNoteMode icon: "zoom-out" text: qsTr("Zoom score out") onTriggered: scaleFactor = Math.max(0.4, scaleFactor - 0.2) @@ -153,6 +169,7 @@ Score { } Taction { id: zoomInAct + enabled: !GLOB.singleNoteMode icon: "zoom-in" text: qsTr("Zoom score in") onTriggered: scaleFactor = scaleFactor = Math.min(scaleFactor + 0.2, 1.4) @@ -160,6 +177,7 @@ Score { } Taction { id: deleteLastAct + enabled: !GLOB.singleNoteMode icon: "delete" text: qsTr("Delete note") onTriggered: scoreObj.deleteLastNote() @@ -167,6 +185,7 @@ Score { } Taction { id: clearScoreAct + enabled: !GLOB.singleNoteMode icon: "clear-score" text: qsTr("Delete all notes") onTriggered: clearScore() @@ -174,6 +193,7 @@ Score { } Shortcut { + enabled: !GLOB.singleNoteMode sequence: StandardKey.MoveToNextChar; onActivated: { if (currentNote) @@ -183,6 +203,7 @@ Score { } } Shortcut { + enabled: !GLOB.singleNoteMode sequence: StandardKey.MoveToPreviousChar; onActivated: { if (currentNote) @@ -192,6 +213,7 @@ Score { } } Keys.onSpacePressed: { + enabled: !GLOB.singleNoteMode if (event.modifiers & Qt.ControlModifier) recModeAct.triggered() else diff --git a/src/qml/NoteName.qml b/src/qml/NoteName.qml index dbb70626f..9c97de710 100644 --- a/src/qml/NoteName.qml +++ b/src/qml/NoteName.qml @@ -11,6 +11,8 @@ import Nootka.name 1.0 TnameItem { id: noteName + nameStyle: GLOB.noteNameStyle + // private property real buttHeight: height / 12 property real buttWidth: width / 9 @@ -65,6 +67,7 @@ TnameItem { Repeater { model: [ "B", "b", "#", "x" ] TcuteButton { + visible: GLOB.enableDoubleAccids || (index > 0 && index < 3) width: buttWidth height: buttHeight * 1.1 checkable: step > 0 diff --git a/src/qml/score/AddLine.qml b/src/qml/score/AddLine.qml index 248842f67..e0c4ca0f1 100644 --- a/src/qml/score/AddLine.qml +++ b/src/qml/score/AddLine.qml @@ -5,7 +5,7 @@ import QtQuick 2.9 Rectangle { - x: - 1.0 + x: score.singleNote ? 0.5 : - 1.0 height: 0.2 width: 4.0 color: noteCursor.color diff --git a/src/qml/score/NoteCursor.qml b/src/qml/score/NoteCursor.qml index 6b486f751..3c7db0123 100644 --- a/src/qml/score/NoteCursor.qml +++ b/src/qml/score/NoteCursor.qml @@ -11,7 +11,7 @@ Item { id: noteCursor height: parent ? parent.height : 0 - width: parent ? parent.width - parent.alterWidth : 0 + width: parent ? parent.width - (score.singleNote ? 0 : parent.alterWidth) : 0 property alias headText: head.text property color color: GLOB.noteCursorColor @@ -35,12 +35,13 @@ Item { text: "\uf4be" y: yPos - 15 color: noteCursor.color + x: score.singleNote ? 1.5 : 0 Text { id: alter font { family: "Scorek"; pixelSize: 7 } color: noteCursor.color - x: head.x - width - 0.1 + x: -width - 0.1 } } diff --git a/src/qml/score/Score.qml b/src/qml/score/Score.qml index fa7c40878..ae05d1dcd 100644 --- a/src/qml/score/Score.qml +++ b/src/qml/score/Score.qml @@ -26,6 +26,7 @@ Flickable { property alias currentNote: scoreObj.selectedItem property alias note: scoreObj.selectedNote property alias readOnly: scoreObj.readOnly + property alias singleNote: scoreObj.singleNote property bool recordMode: false // private diff --git a/src/qml/score/Staff.qml b/src/qml/score/Staff.qml index 4b1963b82..08ba9b6d0 100644 --- a/src/qml/score/Staff.qml +++ b/src/qml/score/Staff.qml @@ -23,7 +23,8 @@ Item { signal destroing(var nr) height: linesCount - scale: (Math.min(score.height, Math.max(Screen.height / 4, Screen.pixelDensity * 70)) / linesCount) * score.scaleFactor + scale: score.singleNote ? score.height / linesCount : + (Math.min(score.height, Math.max(Screen.height / 4, Screen.pixelDensity * 70)) / linesCount) * score.scaleFactor width: score.width / scale transformOrigin: Item.TopLeft -- GitLab