diff --git a/src/qml/+android/MainMenuMobile.qml b/src/qml/+android/MainMenuMobile.qml index bbef54cfc8d166dd143f90da52961962a96b806e..990a940f469f98001f8c60b7cc6e6d5bdc11bcba 100644 --- a/src/qml/+android/MainMenuMobile.qml +++ b/src/qml/+android/MainMenuMobile.qml @@ -21,9 +21,11 @@ import QtQuick.Controls 2.0 import QtGraphicalEffects 1.0 import QtQuick.Window 2.0 +import Nootka 1.0 Item { property Item toolBar: null // fake, for main window information + property alias scoreMenu: scoreMenu x: Screen.pixelDensity / 2 y: Screen.pixelDensity / 2 @@ -70,13 +72,14 @@ Item { Flickable { anchors.fill: parent clip: true - contentHeight: childrenRect.height + contentHeight: drawerColumn.height Column { + id: drawerColumn width: parent.width - spacing: Screen.pixelDensity + spacing: Screen.pixelDensity / 2 NootkaLabel { id: nooLabel - height: nootkaWindow.fontSize * 6.328125 // 0.3955078125 * 16 + height: nootkaWindow.fontSize * 6.328125 // (logo ratio) 0.3955078125 * 16 onClicked: { mainDrawer.close() nootkaWindow.aboutAct.trigger() @@ -85,6 +88,38 @@ Item { MenuButton { action: nootkaWindow.levelAct; onClicked: mainDrawer.close() } MenuButton { action: nootkaWindow.examAct; /*onClicked: mainDrawer.close()*/ } MenuButton { action: nootkaWindow.settingsAct; onClicked: mainDrawer.close() } + MenuButton { action: nootkaWindow.scoreAct } + Column { // drop-down menu with score actions + id: scoreMenu + function open() { visible ? state = "Invisible" : state = "Visible" } + spacing: Screen.pixelDensity / 2 + width: parent.width - nootkaWindow.fontSize / 2 + x: -parent.width + visible: false + MenuButton { action: score.extraAccidsAct; onClicked: mainDrawer.close() } + MenuButton { action: score.showNamesAct; onClicked: mainDrawer.close() } + MenuButton { action: score.zoomInAct; onClicked: mainDrawer.close() } + MenuButton { action: score.zoomOutAct; onClicked: mainDrawer.close() } + states: [ State { name: "Visible"; when: scoreMenu.visible }, State { name: "Invisible"; when: !scoreMenu.visible } ] + + transitions: [ + Transition { + from: "Invisible"; to: "Visible" + SequentialAnimation { + PropertyAction { target: scoreMenu; property: "visible"; value: true } + NumberAnimation { target: scoreMenu; property: "x"; to: nootkaWindow.fontSize / 2; duration: 300 } + } + }, + Transition { + from: "Visible"; to: "Invisible" + SequentialAnimation { + NumberAnimation { target: scoreMenu; property: "x"; to: -parent.width; duration: 300 } + PropertyAction { target: scoreMenu; property: "visible"; value: false } + } + } + ] + } + MenuButton { onClicked: nootkaWindow.close(); action: Taction { icon: "exit"; text: qsTr("exit") } } } } } diff --git a/src/qml/MainMenu.qml b/src/qml/MainMenu.qml index 7516e9ab03704c1b5bec1ff45d1a205bec9bd7b8..959fb8318abaae5824cafbec77e5a7acb8422f37 100644 --- a/src/qml/MainMenu.qml +++ b/src/qml/MainMenu.qml @@ -17,9 +17,44 @@ ***************************************************************************/ import QtQuick 2.7 +import QtQuick.Controls 2.0 Item { property alias toolBar: toolBar + property alias scoreMenu: scoreMenu + TtoolBar { id: toolBar } + + Menu { + id: scoreMenu + width: nootkaWindow.fontSize * 20 + x: toolBar.scoreAct.x + y: score.y + + MenuItem { + contentItem: MenuButton { + action: score.extraAccidsAct + onClicked: { scoreMenu.close() } + } + } + MenuItem { + contentItem: MenuButton { + action: score.showNamesAct + onClicked: { scoreMenu.close() } + } + } + MenuItem { + contentItem: MenuButton { + action: score.zoomInAct + onClicked: { scoreMenu.close() } + } + } + MenuItem { + contentItem: MenuButton { + action: score.zoomOutAct + onClicked: { scoreMenu.close() } + } + } + } } diff --git a/src/qml/MainScore.qml b/src/qml/MainScore.qml index 2a031e8d869455aa1da5b61dbfd5ae42596a66e5..e7391fc4c662dd65e85ce923aaa5e09b94f4bdca 100644 --- a/src/qml/MainScore.qml +++ b/src/qml/MainScore.qml @@ -20,6 +20,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.0 import Score 1.0 +import Nootka 1.0 Score { @@ -27,7 +28,10 @@ Score { width: parent.width - property alias scoreMenu: scoreMenu + property alias showNamesAct: showNamesAct + property alias extraAccidsAct: extraAccidsAct + property alias zoomInAct: zoomInAct + property alias zoomOutAct: zoomOutAct enableKeySign: true scoreObj.nameColor: GLOB.nameColor @@ -46,33 +50,33 @@ Score { radius: width / 3.0 } - Menu { - id: scoreMenu - width: nootkaWindow.fontSize * 15 - - MenuItem { - text: qsTr("Additional accidentals") - checkable: true - } - MenuItem { - text: qsTr("Show note names") - checkable: true - checked: GLOB.namesOnScore - onTriggered: scoreObj.showNoteNames = checked - } - MenuItem { - id: zoomOut - text: qsTr("Zoom score out") - onTriggered: scaleFactor = Math.max(0.4, scaleFactor - 0.2) - } - MenuItem { - id: zoomIn - text: qsTr("Zoom score in") - onTriggered: scaleFactor = Math.min(scaleFactor + 0.2, 1.4) - } + Taction { + id: extraAccidsAct + text: qsTr("Additional accidentals") + checkable: true } - Shortcut { sequence: StandardKey.ZoomOut; onActivated: zoomOut.triggered() } - Shortcut { sequence: StandardKey.ZoomIn; onActivated: zoomIn.triggered() } + Taction { + id: showNamesAct + text: qsTr("Show note names") + checkable: true + checked: GLOB.namesOnScore + onTriggered: { scoreObj.showNoteNames = checked } + } + Taction { + id: zoomOutAct + icon: "zoom-out" + text: qsTr("Zoom score out") + onTriggered: scaleFactor = Math.max(0.4, scaleFactor - 0.2) + shortcut: Shortcut { sequence: StandardKey.ZoomOut; onActivated: zoomOutAct.triggered() } + } + Taction { + id: zoomInAct + icon: "zoom-in" + text: qsTr("Zoom score in") + onTriggered: scaleFactor = scaleFactor = Math.min(scaleFactor + 0.2, 1.4) + shortcut: Shortcut { sequence: StandardKey.ZoomIn; onActivated: zoomInAct.triggered() } + } + Shortcut { sequence: StandardKey.MoveToNextChar; onActivated: { @@ -81,6 +85,7 @@ Score { currentNote = scoreObj.note(currentNote.index + 1) } else currentNote = scoreObj.note(0) + console.log(portableText) } } Shortcut { @@ -92,6 +97,7 @@ Score { } else { currentNote = scoreObj.note(0) } + console.log(portableText) } } diff --git a/src/qml/MainWindow.qml b/src/qml/MainWindow.qml index a7a58c89ccf5e9a31916523c919c863c29f2212b..fa15bcf008742be2174011d182999d0afd4a4237 100644 --- a/src/qml/MainWindow.qml +++ b/src/qml/MainWindow.qml @@ -53,12 +53,12 @@ ApplicationWindow { text: qsTranslate("TtoolBar", "Level") tip: qsTranslate("TtoolBar", "Levels creator") } - Taction { + Taction { // desktop only id: scoreAct icon: "score" text: qsTranslate("TtoolBar", "Score", "it could be 'notation', 'staff' or whatever is associated with that 'place to display musical notes' and this the name is quite short and looks well.") tip: qsTranslate("TtoolBar", "Manage and navigate the score.") - onTriggered: score.scoreMenu.open() + onTriggered: mainMenu.scoreMenu.open() } Taction { id: examAct @@ -105,7 +105,7 @@ ApplicationWindow { MainScore { id: score height: nootkaWindow.height * (Noo.isAndroid() ? 1.0 : 0.916667) - (header ? header.height : 0) - instrument.height - scoreMenu.x: header ? header.scoreAct.x : 0 +// scoreMenu.x: header ? header.scoreAct.x : 0 } Instrument {