aboutsummaryrefslogtreecommitdiffstats
path: root/DemoApplication
diff options
context:
space:
mode:
authorAlexandra Betouni <ABetouni@luxoft.com>2018-12-21 16:49:56 +0100
committerAntti Hölttä <AHoelttae@luxoft.com>2019-03-18 16:40:23 +0100
commit56f41aa762003d8285e66049edd0328dfd1e6189 (patch)
treef853d0570ee761a09f91b7a161bbe4b512cf08c7 /DemoApplication
parentf9f0abc7f29fe71c63407bb1f8c501d67cd9a962 (diff)
General minor fixes
* Added semicolons and curly brackets * Fixed typo
Diffstat (limited to 'DemoApplication')
-rw-r--r--DemoApplication/controls/CNCheckBox.qml2
-rw-r--r--DemoApplication/controls/CNFlipButton.qml27
-rw-r--r--DemoApplication/controls/CNItemDelegate.qml5
-rw-r--r--DemoApplication/controls/MessageDialog.qml6
-rw-r--r--DemoApplication/main.qml28
-rw-r--r--DemoApplication/pages/Page2.qml2
-rw-r--r--DemoApplication/pages/Page3.qml18
-rw-r--r--DemoApplication/pages/Page6.qml19
8 files changed, 53 insertions, 54 deletions
diff --git a/DemoApplication/controls/CNCheckBox.qml b/DemoApplication/controls/CNCheckBox.qml
index 3fd12e9..46ce189 100644
--- a/DemoApplication/controls/CNCheckBox.qml
+++ b/DemoApplication/controls/CNCheckBox.qml
@@ -8,6 +8,6 @@ CheckBox {
CNCursorIndicator { cursorItem : parent }
CursorNavigation.onActivated: {
- root.toggle()
+ root.toggle();
}
}
diff --git a/DemoApplication/controls/CNFlipButton.qml b/DemoApplication/controls/CNFlipButton.qml
index 319d10e..dfd7835 100644
--- a/DemoApplication/controls/CNFlipButton.qml
+++ b/DemoApplication/controls/CNFlipButton.qml
@@ -36,7 +36,6 @@ CNButton {
origin.y: root.height/2
}
-
NumberAnimation {
id: returnAnimation
target: rot
@@ -50,41 +49,41 @@ CNButton {
transform: rot
CursorNavigation.onHasCursorChanged: {
- if (!hasCursor)
- returnAnimation.start()
+ if (!hasCursor) {
+ returnAnimation.start();
+ }
}
function flip(angle, magnitude) {
rot.angle = magnitude*45.0;
- var a = angle * Math.PI/180.0
- rot.axis.x = -Math.sin(a)
- rot.axis.y = Math.cos(a)
- rot.axis.z = 0
+ var a = angle * Math.PI/180.0;
+ rot.axis.x = -Math.sin(a);
+ rot.axis.y = Math.cos(a);
+ rot.axis.z = 0;
}
CursorNavigation.onMagnitudeChanged: {
- flip(angle, magnitude)
+ flip(angle, magnitude);
}
-
CursorNavigation.onMovedUp: {
- console.log("moved up ffs")
+ console.log("moved up ffs");
flip(-90, 1);
- returnAnimation.start()
+ returnAnimation.start();
}
CursorNavigation.onMovedDown: {
flip(90, 1);
- returnAnimation.start()
+ returnAnimation.start();
}
CursorNavigation.onMovedRight: {
flip(0, 1);
- returnAnimation.start()
+ returnAnimation.start();
}
CursorNavigation.onMovedLeft: {
flip(180, 1);
- returnAnimation.start()
+ returnAnimation.start();
}
}
diff --git a/DemoApplication/controls/CNItemDelegate.qml b/DemoApplication/controls/CNItemDelegate.qml
index b99bee9..d938644 100644
--- a/DemoApplication/controls/CNItemDelegate.qml
+++ b/DemoApplication/controls/CNItemDelegate.qml
@@ -8,7 +8,8 @@ ItemDelegate {
//here we make sure the list's current index follows the cursor!
CursorNavigation.onHasCursorChanged: {
- if (CursorNavigation.hasCursor)
- parent.currentIndex = index
+ if (CursorNavigation.hasCursor) {
+ parent.currentIndex = index;
+ }
}
}
diff --git a/DemoApplication/controls/MessageDialog.qml b/DemoApplication/controls/MessageDialog.qml
index afb9ad7..762c9aa 100644
--- a/DemoApplication/controls/MessageDialog.qml
+++ b/DemoApplication/controls/MessageDialog.qml
@@ -22,15 +22,15 @@ Window {
CNButton {
text: "Yes"
focus: true
- onClicked: root.close()
+ onClicked: { root.close(); }
}
CNButton {
text: "Whatever"
- onClicked: root.close()
+ onClicked: { root.close(); }
}
CNButton {
text: "No"
- onClicked: root.close()
+ onClicked: { root.close(); }
}
}
}
diff --git a/DemoApplication/main.qml b/DemoApplication/main.qml
index 7eed033..7fcdf67 100644
--- a/DemoApplication/main.qml
+++ b/DemoApplication/main.qml
@@ -25,7 +25,7 @@ ApplicationWindow {
id: dialogSC
sequence: "p"
onActivated: {
- dialog.visible = true
+ dialog.visible = true;
}
}
@@ -135,13 +135,13 @@ ApplicationWindow {
deviceId: GamepadManager.connectedGamepads.length > 0 ? GamepadManager.connectedGamepads[0] : -1
function handleMove() {
- var v = Qt.vector2d(axisLeftX, axisLeftY)
+ var v = Qt.vector2d(axisLeftX, axisLeftY);
if (v.length() >= 0.99 && !cooldownTimer.running) {
//console.log("handle joystick move, v=" + v)
- contentItem.CursorNavigation.move(Qt.vector2d(axisLeftX, axisLeftY), 10)
- cooldownTimer.start()
+ contentItem.CursorNavigation.move(Qt.vector2d(axisLeftX, axisLeftY), 10);
+ cooldownTimer.start();
} else if (v.length() >= 0.1) {
- contentItem.CursorNavigation.setMagnitude(v)
+ contentItem.CursorNavigation.setMagnitude(v);
/*var item = parent.CursorNavigation.find(v, 10)
//cooldownTimer.start()
if (item != undefined) {
@@ -152,22 +152,20 @@ ApplicationWindow {
pointerRect.visible = true
}*/
} else {
- contentItem.CursorNavigation.setMagnitude(0,0)
- pointerRect.visible = false
+ contentItem.CursorNavigation.setMagnitude(0,0);
+ pointerRect.visible = false;
}
}
- onAxisLeftXChanged: handleMove()
- onAxisLeftYChanged: handleMove()
- onButtonAChanged: if (buttonA) contentItem.CursorNavigation.activate()
- onButtonBChanged: if (buttonB) contentItem.CursorNavigation.activate()
+ onAxisLeftXChanged: { handleMove(); }
+ onAxisLeftYChanged: { handleMove(); }
+ onButtonAChanged: { if (buttonA) { contentItem.CursorNavigation.activate(); } }
+ onButtonBChanged: { if (buttonB) { contentItem.CursorNavigation.activate(); } }
}
}
- //a trick that ensure the cursor can be moved on the tabbar without needing to click teh tabbar first
+ //a trick that ensures the cursor can be moved on the tabbar without needing to click teh tabbar first
Component.onCompleted: {
- defaultButton.forceActiveFocus()
+ defaultButton.forceActiveFocus();
}
-
-
}
diff --git a/DemoApplication/pages/Page2.qml b/DemoApplication/pages/Page2.qml
index a72d77d..aedbbd2 100644
--- a/DemoApplication/pages/Page2.qml
+++ b/DemoApplication/pages/Page2.qml
@@ -11,7 +11,7 @@ Item {
Text {
id: text
- text: "Lists and list items may also be defined cursor navigable. Try moving the cursor between the lists and the other controls. List on the left is defined as a navigable item and so are its items. A list like this will relay the cursor to its currently selected child. However, list on the right has only its children defines as navigables and this will mean cursor will move to the item based on cursor's and items' locations."
+ text: "Lists and list items may also be defined cursor navigable. Try moving the cursor between the lists and the other controls. List on the left is defined as a navigable item and so are its items. A list like this will relay the cursor to its currently selected child. However, list on the right has only its children defined as navigables and this will mean cursor will move to the item based on cursor's and item's locations."
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
diff --git a/DemoApplication/pages/Page3.qml b/DemoApplication/pages/Page3.qml
index aa8d4dc..2444f11 100644
--- a/DemoApplication/pages/Page3.qml
+++ b/DemoApplication/pages/Page3.qml
@@ -18,11 +18,11 @@ Item {
height: 100
text: "alone!"
- CursorNavigation.onMovedUp: text = "moved up"
- CursorNavigation.onMovedDown: text = "moved down"
- CursorNavigation.onMovedRight: text = "moved right"
- CursorNavigation.onMovedLeft: text = "moved left"
- CursorNavigation.onActivated: text = "Activated"
+ CursorNavigation.onMovedUp: { text = "moved up"; }
+ CursorNavigation.onMovedDown: { text = "moved down"; }
+ CursorNavigation.onMovedRight: { text = "moved right"; }
+ CursorNavigation.onMovedLeft: { text = "moved left"; }
+ CursorNavigation.onActivated: { text = "Activated"; }
}
Grid {
@@ -64,10 +64,10 @@ Item {
//redefine the controls for this scope
//(default arrow keys will still work as well, unless reassigned here)
- Keys.onDigit5Pressed: CursorNavigation.moveUp()
- Keys.onDigit2Pressed: CursorNavigation.moveDown()
- Keys.onDigit3Pressed: CursorNavigation.moveRight()
- Keys.onDigit1Pressed: CursorNavigation.moveLeft()
+ Keys.onDigit5Pressed: { CursorNavigation.moveUp(); }
+ Keys.onDigit2Pressed: { CursorNavigation.moveDown(); }
+ Keys.onDigit3Pressed: { CursorNavigation.moveRight(); }
+ Keys.onDigit1Pressed: { CursorNavigation.moveLeft(); }
Grid {
spacing: 5
diff --git a/DemoApplication/pages/Page6.qml b/DemoApplication/pages/Page6.qml
index efb5996..61d09bb 100644
--- a/DemoApplication/pages/Page6.qml
+++ b/DemoApplication/pages/Page6.qml
@@ -37,14 +37,14 @@ Item {
active: true
updateInterval: 120000 // 2 mins
onPositionChanged: {
- var currentPosition = positionSource.position.coordinate
- map.center = currentPosition
- var distance = currentPosition.distanceTo(lastSearchPosition)
+ var currentPosition = positionSource.position.coordinate;
+ map.center = currentPosition;
+ var distance = currentPosition.distanceTo(lastSearchPosition);
if (distance > 500) {
// 500m from last performed pizza search
- lastSearchPosition = currentPosition
- searchModel.searchArea = QtPositioning.circle(currentPosition)
- searchModel.update()
+ lastSearchPosition = currentPosition;
+ searchModel.searchArea = QtPositioning.circle(currentPosition);
+ searchModel.update();
}
}
}
@@ -59,7 +59,7 @@ Item {
searchTerm: "Pizza"
searchArea: QtPositioning.circle(locationOslo)
- Component.onCompleted: update()
+ Component.onCompleted: { update(); }
}
Map {
@@ -110,9 +110,10 @@ Item {
Connections {
target: searchModel
onStatusChanged: {
- if (searchModel.status == PlaceSearchModel.Error)
- console.log("Search error!")
+ if (searchModel.status == PlaceSearchModel.Error) {
+ console.log("Search error!");
console.log(searchModel.errorString());
+ }
}
}
}