Commit 81d1b83c authored by Sandro Andrade's avatar Sandro Andrade

Adhere to Qt's QML coding conventions

parent 996718d4
......@@ -87,6 +87,7 @@ Item {
Column {
anchors.centerIn: parent
spacing: 20
Text {
id: messageText
......@@ -100,6 +101,7 @@ Item {
Row {
anchors { horizontalCenter: parent.horizontalCenter }
spacing: 20
Button {
id: newQuestionButton
......@@ -154,6 +156,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
width: answerGrid.width + 20
height: answerGrid.height + 20
Grid {
id: answerGrid
......@@ -170,6 +173,7 @@ Item {
width: (userMessage != "the rhythm") ? 120:119
height: (userMessage != "the rhythm") ? 40:59
Text {
id: option
......@@ -185,8 +189,8 @@ Item {
}
Image {
id: rhythmImage
anchors.centerIn: parent
anchors.centerIn: parent
visible: userMessage == "the rhythm"
source: (userMessage == "the rhythm") ? "exercise-images/" + model.name + ".png":""
fillMode: Image.Pad
......@@ -277,6 +281,7 @@ Item {
id: animation
loops: 2
SequentialAnimation {
PropertyAnimation { target: answerRectangle; property: "rotation"; to: -45; duration: 200 }
PropertyAnimation { target: answerRectangle; property: "rotation"; to: 45; duration: 200 }
......
......@@ -60,14 +60,14 @@ Item {
PianoView {
id: pianoView
anchors { bottom: parent.bottom; bottomMargin: 5; horizontalCenter: parent.horizontalCenter }
anchors { bottom: parent.bottom; bottomMargin: 5; horizontalCenter: parent.horizontalCenter }
visible: false
}
RhythmAnswerView {
id: rhythmAnswerView
anchors { bottom: parent.bottom; bottomMargin: 14; horizontalCenter: parent.horizontalCenter }
visible: false
exerciseView: exerciseView
}
......@@ -78,38 +78,32 @@ Item {
anchors { top: background.top; horizontalCenter: background.horizontalCenter }
}
}
Connections {
target: midiPlayer
onPlayActivated: sequencer.play()
onPauseActivated: sequencer.pause()
onStopActivated: sequencer.stop()
}
Binding {
target: sequencer
property: "pitch"
value: midiPlayer.pitch
}
Binding {
target: sequencer
property: "volume"
value: midiPlayer.volume
}
Binding {
target: sequencer
property: "tempo"
value: midiPlayer.tempo
}
Binding {
target: midiPlayer
property: "playbackLabel"
value: sequencer.playbackLabel
}
Binding {
target: midiPlayer
property: "sequencerState"
......
......@@ -38,9 +38,11 @@ ButtonStyle {
background: Item {
property color borderColor: blendColors(sysPalette.windowText, sysPalette.window, 0.75)
opacity: control.enabled ? 1.0 : 0.5
implicitHeight: 32
implicitWidth: 96
Rectangle {
anchors.centerIn: parent
implicitHeight: parent.height - 2
......@@ -77,8 +79,11 @@ ButtonStyle {
opacity: control.enabled ? 1.0 : 0.5
implicitWidth: buttonText.implicitWidth + 16
implicitHeight: buttonText.implicitHeight + 8
transform: Translate {x: control.pressed ? 1 : 0; y: control.pressed ? 1 : 0}
Text {
id: buttonText
width: parent.width
anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: 10; right: parent.right; rightMargin: 10 }
text: control.text
......@@ -86,6 +91,5 @@ ButtonStyle {
horizontalAlignment: labelHorizontalAlignment
wrapMode: Text.Wrap
}
transform: Translate {x: control.pressed ? 1 : 0; y: control.pressed ? 1 : 0}
}
}
......@@ -46,11 +46,12 @@ Item {
Button {
id: breadcrumb
width: (stackView.depth > 1) ? 24:0; height: parent.height
iconName: "go-previous"
onClicked: {
sequencer.allNotesOff()
sequencer.clearSong()
sequencer.clearSong()
minuetMenu.breadcrumbPressed()
selectedMenuItem = null
stackView.pop()
......@@ -72,8 +73,8 @@ Item {
Button {
id: delegateRect
width: parent.width; height: 55
width: parent.width; height: 55
text: i18nc("technical term, do you have a musician friend?", modelData.name)
checkable: (!delegateRect.ListView.view.model[index].children) ? true:false
onClicked: {
......@@ -106,15 +107,18 @@ Item {
}
}
}
style: MinuetButtonStyle{}
style: MinuetButtonStyle {}
}
}
Component {
id: categoryMenu
Rectangle {
property alias model: listView.model
width: stackView.width; height: parent.height
color: theme.viewBackgroundColor
property alias model: listView.model
ListView {
id: listView
anchors.fill: parent
......
......@@ -48,9 +48,8 @@ Column {
if (currentAnswer == 4) {
answerCompleted(answers)
correctColors = exerciseView.chosenColors
for (var i = 0; i < 4; ++i) {
for (var i = 0; i < 4; ++i)
correctAnswerGrid.children[i].opacity = answers[i].toString().split("/").pop().split(".")[0] != correctAnswers[i] ? 1:0
}
}
else {
tempAnswers[currentAnswer] = "exercise-images/current-rhythm.png"
......@@ -85,6 +84,7 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter
spacing: 10
Repeater {
model: 4
......@@ -94,10 +94,11 @@ Column {
width: 119; height: 59
color: correctColors[index]
opacity: 0
Image {
id: correctRhythmImage
anchors.centerIn: parent
anchors.centerIn: parent
source: (correctAnswers != undefined && exerciseView.userMessage == "the rhythm") ? "exercise-images/" + correctAnswers[index] + ".png":""
fillMode: Image.Pad
}
......@@ -112,6 +113,7 @@ Column {
radius: 5
anchors.horizontalCenter: parent.horizontalCenter
width: answerGrid.width + 20; height: answerGrid.height + 20
Row {
id: answerGrid
......@@ -126,6 +128,7 @@ Column {
width: 119
height: 59
color: colors[index]
Text {
id: option
......@@ -156,7 +159,6 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter
text: i18n("backspace")
enabled: currentAnswer > 0 && currentAnswer < 4
onClicked: {
if (currentAnswer > 0) {
var tempAnswers = answers
......
......@@ -49,7 +49,6 @@ Rectangle {
width: parent.width
anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: 15 }
Text {
id: tempoLabel
width: parent.width / 3
font.pointSize: 8
horizontalAlignment: Text.AlignLeft
......@@ -57,7 +56,6 @@ Rectangle {
text: i18n("Tempo: %1 bpm").arg(Math.round(tempo))
}
Text {
id: volumeLabel
width: parent.width / 3
font.pointSize: 8
horizontalAlignment: Text.AlignLeft
......@@ -65,7 +63,6 @@ Rectangle {
text: i18n("Volume: %1%").arg(Math.round(volume))
}
Text {
id: pitchLabel
width: parent.width / 3
font.pointSize: 8
horizontalAlignment: Text.AlignLeft
......@@ -83,13 +80,12 @@ Rectangle {
Text {
id: playbackLabelText
width: item1.width
width: parent.width
horizontalAlignment: Text.AlignHCenter
font.pointSize: 24
color: "#008000"
}
MultimediaButton {
id: item12
width: playbackLabelText.contentWidth / 2
anchors.horizontalCenterOffset: -30
anchors { top: playbackLabelText.bottom; horizontalCenter: playbackLabelText.horizontalCenter }
......@@ -112,8 +108,6 @@ Rectangle {
}
}
Item {
id: item2
width: parent.width / 2 - 15; height: item1.height
anchors { right: parent.right; rightMargin: 15; verticalCenter: item1.verticalCenter }
......
......@@ -74,8 +74,8 @@ Rectangle {
Item {
id: keyboard
anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 5 }
anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 5 }
width: 3*keyWidth+7*(7*keyWidth); height: keyHeight
WhiteKey { id: whiteKeyA }
......@@ -89,7 +89,6 @@ Rectangle {
Octave { id: octave6; initialAnchor: octave5 }
Octave { id: octave7; initialAnchor: octave6 }
WhiteKey { id: whiteKeyC; anchor: octave7 }
Rectangle {
width: 3*keyWidth+7*(7*keyWidth); height: 2
anchors { left: whiteKeyA.left; bottom: whiteKeyA.top }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment