Skip to content
Snippets Groups Projects
Commit eaf004a3 authored by SeeLook's avatar SeeLook
Browse files

Defined score actions and moved score menu to MainMenu of desktop. Implemented...

Defined score actions and moved score menu to MainMenu of desktop. Implemented drop-down menu in mobile drawer with score actions
parent 8857e648
Branches
Tags
No related merge requests found
......@@ -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") } }
}
}
}
......
......@@ -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() }
}
}
}
}
......@@ -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 {
Taction {
id: extraAccidsAct
text: qsTr("Additional accidentals")
checkable: true
}
MenuItem {
Taction {
id: showNamesAct
text: qsTr("Show note names")
checkable: true
checked: GLOB.namesOnScore
onTriggered: scoreObj.showNoteNames = checked
onTriggered: { scoreObj.showNoteNames = checked }
}
MenuItem {
id: zoomOut
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() }
}
MenuItem {
id: zoomIn
Taction {
id: zoomInAct
icon: "zoom-in"
text: qsTr("Zoom score in")
onTriggered: scaleFactor = Math.min(scaleFactor + 0.2, 1.4)
}
onTriggered: scaleFactor = scaleFactor = Math.min(scaleFactor + 0.2, 1.4)
shortcut: Shortcut { sequence: StandardKey.ZoomIn; onActivated: zoomInAct.triggered() }
}
Shortcut { sequence: StandardKey.ZoomOut; onActivated: zoomOut.triggered() }
Shortcut { sequence: StandardKey.ZoomIn; onActivated: zoomIn.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)
}
}
......
......@@ -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 {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment