fixing routing.py bug, if time is 24:00
[pywienerlinien] / qml / LinePad.qml
index 1d6bd59..ba1cf44 100644 (file)
@@ -1,10 +1,13 @@
 
 import QtQuick 1.0
+import QtMobility.feedback 1.1
 
 Rectangle {
     id: linePad
     property alias currentLine: inputLine.text
 
+    signal accept
+
     /* List of available lines - will be filled w/ real data by LineSheet */
     property variant availableLines: ['59A', '63A', '58']
 
@@ -14,6 +17,7 @@ Rectangle {
         if (matches !== undefined) {
             if (matches.length == 1) {
                 inputLine.text = matches[0];
+                accept();
             }
         }
     }
@@ -34,6 +38,22 @@ Rectangle {
     height: 800
     width: 480
 
+     HapticsEffect {
+         id: buttonFeedback
+
+         /**
+          * Ideally we would use ThemeEffect here,
+          * but on Harmattan it has no effect (sic)
+          **/
+
+         attackIntensity: 0.5
+         attackTime: 100
+         intensity: 1.0
+         duration: 50
+         fadeTime: 0
+         fadeIntensity: 0.0
+     }
+
     Text {
         id: inputLine
         horizontalAlignment: Text.AlignHCenter
@@ -70,9 +90,12 @@ Rectangle {
             MouseArea {
                 anchors {
                     fill: parent
-                    margins: -(inputLine.height - height)/2
+                    margins: -30
+                }
+                onClicked: {
+                    buttonFeedback.start()
+                    inputLine.text = ''
                 }
-                onClicked: inputLine.text = ''
             }
         }
     }
@@ -122,7 +145,18 @@ Rectangle {
             x: width*(index%3)
             y: inputLine.height + height*parseInt(index/3)
 
+            Image {
+                source: 'ubahnicon.png'
+                anchors {
+                    horizontalCenter: parent.horizontalCenter
+                    bottom: parent.bottom
+                }
+                visible: (inputElement.ch === 'U')
+            }
+
             Text {
+                id: text
+                visible: (inputElement.ch !== 'U')
                 anchors.centerIn: parent
                 text: modelData
                 font {
@@ -130,7 +164,7 @@ Rectangle {
                     bold: true
                 }
                 color: {
-                    if (inputState.isMetro) {
+                    if (inputState.isMetro || ch == 'U') {
                         return 'white';
                     } else if (inputElement.isCandidate) {
                         return 'black';
@@ -143,7 +177,10 @@ Rectangle {
             MouseArea {
                 anchors.fill: parent
                 onClicked: {
-                    inputLine.text += modelData
+                    if( inputElement.isCandidate) {
+                        buttonFeedback.start()
+                        inputLine.text += modelData
+                    }
                 }
             }
         }