Коммит 3522b451 создал по автору Alexey Andreev's avatar Alexey Andreev
Просмотр файлов

[Project] Codestyle clean up. #3

According to clang-format and qml-format
владелец a50ec5eb
......@@ -21,42 +21,28 @@ Label {
id: textAnimation
objectName: "textAnimation"
property int xTo: animationMode === animationModes.CyclicMovement
? - root.contentWidth
: parent.width - root.contentWidth
property int xTo: animationMode === animationModes.CyclicMovement ? -root.contentWidth : parent.width - root.contentWidth
property int velocity: 25 * Theme.pixelRatio
property int pauseDuration: 1100
loops: Animation.Infinite
running: root.contentWidth > parent.width
PauseAnimation {
duration: animationMode === animationModes.CyclicMovement
? 0
: textAnimation.pauseDuration
duration: animationMode === animationModes.CyclicMovement ? 0 : textAnimation.pauseDuration
}
SmoothedAnimation {
to: textAnimation.xTo
velocity: textAnimation.velocity
maximumEasingTime: animationMode === animationModes.CyclicMovement
? 100
: -1
maximumEasingTime: animationMode === animationModes.CyclicMovement ? 100 : -1
}
PauseAnimation {
duration: animationMode === animationModes.CyclicMovement
? 0
: textAnimation.pauseDuration
duration: animationMode === animationModes.CyclicMovement ? 0 : textAnimation.pauseDuration
}
SmoothedAnimation {
to: animationMode === animationModes.CyclicMovement
? parent.width
: 0
to: animationMode === animationModes.CyclicMovement ? parent.width : 0
velocity: textAnimation.velocity
duration: animationMode === animationModes.ReverseAnimation
? -1
: 0
duration: animationMode === animationModes.ReverseAnimation ? -1 : 0
}
}
}
......@@ -15,7 +15,7 @@ Column {
property string iconRole: "icon"
property string descriptionRole: "description"
signal selectedValuesChanged()
signal selectedValuesChanged
function selectedValues() {
var selectedValues = new Array(children.length - 1);
......@@ -48,7 +48,7 @@ Column {
IconTextSwitch {
id: switchItem
readonly property var m: model.modelData || model
readonly property var value: m[root.valueRole] === undefined ? m : m[root.valueRole]
......
......@@ -13,7 +13,10 @@ CoverBackground {
text: qsTrId("ui-component-gallery-default-cover-ui-component-gallery")
icon {
source: Qt.resolvedUrl("../icons/ui-component-gallery.svg")
sourceSize { width: icon.width; height: icon.height }
sourceSize {
width: icon.width
height: icon.height
}
}
forceFit: true
}
......
......@@ -26,7 +26,11 @@ Page {
Label {
objectName: "descriptionText"
anchors { left: parent.left; right: parent.right; margins: Theme.horizontalPageMargin }
anchors {
left: parent.left
right: parent.right
margins: Theme.horizontalPageMargin
}
color: palette.highlightColor
font.pixelSize: Theme.fontSizeSmall
textFormat: Text.RichText
......@@ -43,7 +47,11 @@ Page {
Label {
objectName: "licenseText"
anchors { left: parent.left; right: parent.right; margins: Theme.horizontalPageMargin }
anchors {
left: parent.left
right: parent.right
margins: Theme.horizontalPageMargin
}
color: palette.highlightColor
font.pixelSize: Theme.fontSizeSmall
textFormat: Text.RichText
......
......@@ -13,7 +13,8 @@ Page {
// Why is this necessary?
contentWidth: parent.width
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
Column {
id: column
......@@ -122,7 +123,10 @@ Page {
}
Switch {
icon.source: "image://theme/icon-m-share"
onCheckedChanged: { busy = true; busyTimer.start() }
onCheckedChanged: {
busy = true;
busyTimer.start();
}
Timer {
id: busyTimer
interval: 4200
......@@ -162,7 +166,10 @@ Page {
TextSwitch {
//% "Switch with busy state"
text: qsTrId("ui-component-gallery-button-switch-with-busy-state")
onCheckedChanged: { busy = true; textBusyTimer.start() }
onCheckedChanged: {
busy = true;
textBusyTimer.start();
}
Timer {
id: textBusyTimer
interval: 4700
......
......@@ -13,5 +13,8 @@ IconButton {
height: icon.height
icon.source: "image://theme/icon-splus-clear"
opacity: editor.text.length > 0 ? 1.0 : 0.0
Behavior on opacity { FadeAnimation {} }
Behavior on opacity {
FadeAnimation {
}
}
}
......@@ -26,12 +26,21 @@ Page {
label: qsTrId("ui-component-gallery-combo-box-screen-brightness")
currentIndex: 1
menu: ContextMenu {
//% "automatic"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-automatic") }
//% "manual"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-manual") }
//% "Long Long Long Long selection"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-long-long-long-long-selection") }
MenuItem {
//% "automatic"
text: qsTrId("ui-component-gallery-combo-box-automatic")
}
MenuItem {
//% "manual"
text: qsTrId("ui-component-gallery-combo-box-manual")
}
MenuItem {
//% "Long Long Long Long selection"
text: qsTrId("ui-component-gallery-combo-box-long-long-long-long-selection")
}
}
}
......@@ -39,12 +48,21 @@ Page {
//% "A Long Long Long Long Long Label"
label: qsTrId("ui-component-gallery-combo-box-a-long-long-long-long-long-label")
menu: ContextMenu {
//% "Short"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-short") }
//% "Quite the Medium"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-quite-the-medium") }
//% "Long Long Long Long Long selection"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-long-long-long-long-long-selection") }
MenuItem {
//% "Short"
text: qsTrId("ui-component-gallery-combo-box-short")
}
MenuItem {
//% "Quite the Medium"
text: qsTrId("ui-component-gallery-combo-box-quite-the-medium")
}
MenuItem {
//% "Long Long Long Long Long selection"
text: qsTrId("ui-component-gallery-combo-box-long-long-long-long-long-selection")
}
}
}
......@@ -54,58 +72,136 @@ Page {
//% "Setting (many options)"
label: qsTrId("ui-component-gallery-combo-box-setting-many-options")
menu: ContextMenu {
//% "option a"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-a") }
//% "option b"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-b") }
//% "option c"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-c") }
//% "option d"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-d") }
//% "option e"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-e") }
//% "option f"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-f") }
//% "option g"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-g") }
//% "option h"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-h") }
//% "option i"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-i") }
//% "option j"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-j") }
//% "option k"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-k") }
//% "option l"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-l") }
//% "option m"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-m") }
//% "option n"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-n") }
//% "option o"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-o") }
//% "option p"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-p") }
//% "option q"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-q") }
//% "option r"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-r") }
//% "option s"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-s") }
//% "option t"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-t") }
//% "option u"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-u") }
//% "option v"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-v") }
//% "option w"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-w") }
//% "option x"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-x") }
//% "option y"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-y") }
//% "option z"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-option-z") }
MenuItem {
//% "option a"
text: qsTrId("ui-component-gallery-combo-box-option-a")
}
MenuItem {
//% "option b"
text: qsTrId("ui-component-gallery-combo-box-option-b")
}
MenuItem {
//% "option c"
text: qsTrId("ui-component-gallery-combo-box-option-c")
}
MenuItem {
//% "option d"
text: qsTrId("ui-component-gallery-combo-box-option-d")
}
MenuItem {
//% "option e"
text: qsTrId("ui-component-gallery-combo-box-option-e")
}
MenuItem {
//% "option f"
text: qsTrId("ui-component-gallery-combo-box-option-f")
}
MenuItem {
//% "option g"
text: qsTrId("ui-component-gallery-combo-box-option-g")
}
MenuItem {
//% "option h"
text: qsTrId("ui-component-gallery-combo-box-option-h")
}
MenuItem {
//% "option i"
text: qsTrId("ui-component-gallery-combo-box-option-i")
}
MenuItem {
//% "option j"
text: qsTrId("ui-component-gallery-combo-box-option-j")
}
MenuItem {
//% "option k"
text: qsTrId("ui-component-gallery-combo-box-option-k")
}
MenuItem {
//% "option l"
text: qsTrId("ui-component-gallery-combo-box-option-l")
}
MenuItem {
//% "option m"
text: qsTrId("ui-component-gallery-combo-box-option-m")
}
MenuItem {
//% "option n"
text: qsTrId("ui-component-gallery-combo-box-option-n")
}
MenuItem {
//% "option o"
text: qsTrId("ui-component-gallery-combo-box-option-o")
}
MenuItem {
//% "option p"
text: qsTrId("ui-component-gallery-combo-box-option-p")
}
MenuItem {
//% "option q"
text: qsTrId("ui-component-gallery-combo-box-option-q")
}
MenuItem {
//% "option r"
text: qsTrId("ui-component-gallery-combo-box-option-r")
}
MenuItem {
//% "option s"
text: qsTrId("ui-component-gallery-combo-box-option-s")
}
MenuItem {
//% "option t"
text: qsTrId("ui-component-gallery-combo-box-option-t")
}
MenuItem {
//% "option u"
text: qsTrId("ui-component-gallery-combo-box-option-u")
}
MenuItem {
//% "option v"
text: qsTrId("ui-component-gallery-combo-box-option-v")
}
MenuItem {
//% "option w"
text: qsTrId("ui-component-gallery-combo-box-option-w")
}
MenuItem {
//% "option x"
text: qsTrId("ui-component-gallery-combo-box-option-x")
}
MenuItem {
//% "option y"
text: qsTrId("ui-component-gallery-combo-box-option-y")
}
MenuItem {
//% "option z"
text: qsTrId("ui-component-gallery-combo-box-option-z")
}
}
}
......@@ -117,12 +213,21 @@ Page {
label: qsTrId("ui-component-gallery-combo-box-half-width-combo-1")
menu: ContextMenu {
//% "an option"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-an-option") }
//% "yet another option"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-yet-another-option") }
//% "yet another option with a long label"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-yet-another-option-with-a-long-label") }
MenuItem {
//% "an option"
text: qsTrId("ui-component-gallery-combo-box-an-option")
}
MenuItem {
//% "yet another option"
text: qsTrId("ui-component-gallery-combo-box-yet-another-option")
}
MenuItem {
//% "yet another option with a long label"
text: qsTrId("ui-component-gallery-combo-box-yet-another-option-with-a-long-label")
}
}
}
......@@ -132,12 +237,21 @@ Page {
label: qsTrId("ui-component-gallery-combo-box-half-width-combo-2")
menu: ContextMenu {
//% "an option"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-an-option") }
//% "yet another option"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-yet-another-option") }
//% "yet another option with a long label"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-yet-another-option-with-a-long-label") }
MenuItem {
//% "an option"
text: qsTrId("ui-component-gallery-combo-box-an-option")
}
MenuItem {
//% "yet another option"
text: qsTrId("ui-component-gallery-combo-box-yet-another-option")
}
MenuItem {
//% "yet another option with a long label"
text: qsTrId("ui-component-gallery-combo-box-yet-another-option-with-a-long-label")
}
}
}
}
......@@ -147,14 +261,26 @@ Page {
currentIndex: 1
menu: ContextMenu {
//% "Up"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-up") }
//% "Down"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-down") }
//% "Left"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-left") }
//% "Right"
MenuItem { text: qsTrId("ui-component-gallery-combo-box-right") }
MenuItem {
//% "Up"
text: qsTrId("ui-component-gallery-combo-box-up")
}
MenuItem {
//% "Down"
text: qsTrId("ui-component-gallery-combo-box-down")
}
MenuItem {
//% "Left"
text: qsTrId("ui-component-gallery-combo-box-left")
}
MenuItem {
//% "Right"
text: qsTrId("ui-component-gallery-combo-box-right")
}
}
//% "This combobox comes with an extra description."
description: qsTrId("ui-component-gallery-combo-box-this-combobox-comes-with-an-extra-description")
......
......@@ -12,16 +12,16 @@ Page {
property string message: qsTrId("ui-component-gallery-cover-hello-covers")
function displayAction(text) {
message = text
clearActionTimer.start()
message = text;
clearActionTimer.start();
}
onStatusChanged: {
if (status == PageStatus.Deactivating) {
applicationWindow.cover = "private/DefaultCover.qml"
oneCoverAction.enabled = false
twoCoverActions.enabled = false
changeCoverActionA.enabled = false
changeCoverActionB.enabled = false
applicationWindow.cover = "private/DefaultCover.qml";
oneCoverAction.enabled = false;
twoCoverActions.enabled = false;
changeCoverActionA.enabled = false;
changeCoverActionB.enabled = false;
}
}
......@@ -60,12 +60,12 @@ Page {
onTriggered: {
if (next) {
//% "Next"
displayAction(qsTrId("ui-component-gallery-cover-next"))
displayAction(qsTrId("ui-component-gallery-cover-next"));
} else {
//% "Pause"
displayAction(qsTrId("ui-component-gallery-cover-pause"))
displayAction(qsTrId("ui-component-gallery-cover-pause"));
}
next = !next
next = !next;
}
}
}
......@@ -78,10 +78,10 @@ Page {
CoverAction {
iconSource: "image://theme/icon-cover-next"
onTriggered: {
changeCoverActionA.enabled = false
changeCoverActionB.enabled = true
changeCoverActionA.enabled = false;
changeCoverActionB.enabled = true;
//% "A"
displayAction(qsTrId("ui-component-gallery-cover-a"))
displayAction(qsTrId("ui-component-gallery-cover-a"));
}
}
}
......@@ -94,10 +94,10 @@ Page {
CoverAction {
iconSource: "image://theme/icon-cover-pause"
onTriggered: {
changeCoverActionB.enabled = false
changeCoverActionA.enabled = true
changeCoverActionB.enabled = false;
changeCoverActionA.enabled = true;
//% "B"
displayAction(qsTrId("ui-component-gallery-cover-b"))
displayAction(qsTrId("ui-component-gallery-cover-b"));
}
}
}
......@@ -127,28 +127,28 @@ Page {
//% "Default cover (no actions)"
text: qsTrId("ui-component-gallery-cover-default-cover-no-actions")
onClicked: {
applicationWindow.cover = "private/DefaultCover.qml"
applicationWindow.cover = "private/DefaultCover.qml";
}
}
MenuItem {
//% "Component-based blue"
text: qsTrId("ui-component-gallery-cover-component-based-blue")
onClicked: {
applicationWindow.cover = blueCover
applicationWindow.cover = blueCover;
}
}
MenuItem {
//% "Inline green"
text: qsTrId("ui-component-gallery-cover-inline-green")
onClicked: {
applicationWindow.cover = greenCover
applicationWindow.cover = greenCover;
}
}
MenuItem {
//% "External file red (no actions)"
text: qsTrId("ui-component-gallery-cover-external-file-red-no-actions")
onClicked: {
applicationWindow.cover = Qt.resolvedUrl("CoverExample.qml")
applicationWindow.cover = Qt.resolvedUrl("CoverExample.qml");
}
}
MenuItem {
......@@ -160,7 +160,7 @@ Page {
//% "No cover"
text: qsTrId("ui-component-gallery-cover-no-cover")
onClicked: {
applicationWindow.cover = null
applicationWindow.cover = null;
}
}
}
......@@ -175,40 +175,40 @@ Page {
//% "No actions"
text: qsTrId("ui-component-gallery-cover-no-actions")
onClicked: {
oneCoverAction.enabled = false
twoCoverActions.enabled = false
changeCoverActionA.enabled = false
changeCoverActionB.enabled = false
oneCoverAction.enabled = false;
twoCoverActions.enabled = false;
changeCoverActionA.enabled = false;
changeCoverActionB.enabled = false;
}
}
MenuItem {
//% "One action (next)"
text: qsTrId("ui-component-gallery-cover-one-action-next")
onClicked: {
oneCoverAction.enabled = true
twoCoverActions.enabled = false
changeCoverActionA.enabled = false
changeCoverActionB.enabled = false
oneCoverAction.enabled = true;
twoCoverActions.enabled = false;
changeCoverActionA.enabled = false;
changeCoverActionB.enabled = false;
}
}
MenuItem {
//% "Two actions (pause, next)"
text: qsTrId("ui-component-gallery-cover-two-actions-pause-next")
onClicked: {
twoCoverActions.enabled = true
oneCoverAction.enabled = false
changeCoverActionA.enabled = false
changeCoverActionB.enabled = false
twoCoverActions.enabled = true;
oneCoverAction.enabled = false;
changeCoverActionA.enabled = false;
changeCoverActionB.enabled = false;
}
}
MenuItem {
//% "Dynamically changing actions"
text: qsTrId("ui-component-gallery-cover-dynamically-changing-actions")
onClicked: {
twoCoverActions.enabled = false
oneCoverAction.enabled = false
changeCoverActionB.enabled = false
changeCoverActionA.enabled = true
twoCoverActions.enabled = false;
oneCoverAction.enabled = false;
changeCoverActionB.enabled = false;
changeCoverActionA.enabled = true;
}
}
}
......@@ -222,14 +222,14 @@ Page {
triggeredOnStart: true
onActiveChanged: {
if (coverCombo.currentItem == changingCover)
running = !active
running = !active;
}
onTriggered: {
if (applicationWindow.cover !== greenCover)
applicationWindow.cover = greenCover
applicationWindow.cover = greenCover;
else
applicationWindow.cover = blueCover
applicationWindow.cover = blueCover;
}
}
......@@ -260,4 +260,3 @@ Page {
}
}
}
......@@ -7,8 +7,7 @@ import Sailfish.Silica 1.0
Page {
id: page
property bool checkInset: applicationWindow.displayMode === ApplicationDisplayMode.SafeZone ||
(applicationWindow.displayMode !== ApplicationDisplayMode.SafeZone && !pageInsets.checked)
property bool checkInset: applicationWindow.displayMode === ApplicationDisplayMode.SafeZone || (applicationWindow.displayMode !== ApplicationDisplayMode.SafeZone && !pageInsets.checked)
allowedOrientations: Orientation.All
......@@ -54,7 +53,8 @@ Page {
}
}
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
Column {
id: column
......@@ -76,12 +76,21 @@ Page {
label: qsTrId("ui-component-gallery-cutout-debug-display-cutout-mode")
currentIndex: applicationWindow.displayMode
menu: ContextMenu {
//% "FullPortrait"
MenuItem { text: qsTrId("ui-component-gallery-cutout-debug-full-portrait") }
//% "FillScreen"
MenuItem { text: qsTrId("ui-component-gallery-cutout-debug-fill-screen") }
//% "SafeZone"
MenuItem { text: qsTrId("ui-component-gallery-cutout-debug-safe-zone") }
MenuItem {
//% "FullPortrait"
text: qsTrId("ui-component-gallery-cutout-debug-full-portrait")
}
MenuItem {
//% "FillScreen"
text: qsTrId("ui-component-gallery-cutout-debug-fill-screen")
}
MenuItem {
//% "SafeZone"
text: qsTrId("ui-component-gallery-cutout-debug-safe-zone")
}
}
onCurrentIndexChanged: applicationWindow.displayMode = currentIndex
}
......@@ -96,8 +105,7 @@ Page {
//% "Consider indentation for page content"
text: qsTrId("ui-component-gallery-cutout-debug-consider-indentation-for-page-content")
enabled: applicationWindow.displayMode === ApplicationDisplayMode.FullPortrait ||
applicationWindow.displayMode === ApplicationDisplayMode.FillScreen
enabled: applicationWindow.displayMode === ApplicationDisplayMode.FullPortrait || applicationWindow.displayMode === ApplicationDisplayMode.FillScreen
}
TextSwitch {
id: pageAreaVisible
......@@ -116,7 +124,7 @@ Page {
text: qsTrId("ui-component-gallery-cutout-debug-status-bar-visible")
checked: applicationWindow.statusbarForceVisible
onCheckedChanged: {
applicationWindow.statusbarForceVisible = checked
applicationWindow.statusbarForceVisible = checked;
}
}
......@@ -161,11 +169,11 @@ Page {
BackgroundItem {
onClicked: {
var dialog = pageStack.push("Sailfish.Silica.ColorPickerDialog")
dialog.accepted.connect(function() {
colorIndicator.color = dialog.color
applicationWindow.statusbarBackgroundColor = dialog.color
})
var dialog = pageStack.push("Sailfish.Silica.ColorPickerDialog");
dialog.accepted.connect(function () {
colorIndicator.color = dialog.color;
applicationWindow.statusbarBackgroundColor = dialog.color;
});
}
Row {
......@@ -190,11 +198,11 @@ Page {
Button {
onClicked: {
applicationWindow.statusbarBackgroundColor = Theme.overlayBackgroundColor
applicationWindow.statusbarScheme = -1
colorIndicator.color = "red"
opacitySlider.value = 0.0
schemeComboBox.currentIndex = 0
applicationWindow.statusbarBackgroundColor = Theme.overlayBackgroundColor;
applicationWindow.statusbarScheme = -1;
colorIndicator.color = "red";
opacitySlider.value = 0.0;
schemeComboBox.currentIndex = 0;
}
anchors.horizontalCenter: parent.horizontalCenter
......
......@@ -34,75 +34,101 @@ Page {
description: qsTrId("ui-component-gallery-main-using-qml-only")
}
//% "Int Value"
SectionHeader { text: qsTrId("ui-component-gallery-declarative-radio-buttons-int-value") }
SectionHeader {
//% "Int Value"
text: qsTrId("ui-component-gallery-declarative-radio-buttons-int-value")
}
SwitchGroup {
id: intValueGroup
exclusive: root.exclusive
model: ListModel {
//% "It's negative"
ListElement { value: -1; description: qsTrId("ui-component-gallery-declarative-radio-buttons-its-negative") }
//% "Zero"
ListElement { value: 0; name: qsTrId("ui-component-gallery-declarative-radio-buttons-zero"); selected: true }
ListElement { value: 1; icon: "image://theme/icon-m-about" }
ListElement {
value: -1
//% "It's negative"
description: qsTrId("ui-component-gallery-declarative-radio-buttons-its-negative")
}
ListElement {
value: 0
//% "Zero"
name: qsTrId("ui-component-gallery-declarative-radio-buttons-zero")
selected: true
}
ListElement {
value: 1
icon: "image://theme/icon-m-about"
}
}
onSelectedValuesChanged: console.log("Int values:", selectedValues())
}
//% "String Value"
SectionHeader { text: qsTrId("ui-component-gallery-declarative-radio-buttons-string-value") }
SectionHeader {
//% "String Value"
text: qsTrId("ui-component-gallery-declarative-radio-buttons-string-value")
}
SwitchGroup {
id: stringValueGroup
exclusive: root.exclusive
model: [
//% "It's the first one"
{ value: "First", description: qsTrId("ui-component-gallery-declarative-radio-buttons-its-the-first-one") },
//% "2nd"
{ value: "Second", name: qsTrId("ui-component-gallery-declarative-radio-buttons-2-nd") },
{ value: "Third", icon: "image://theme/icon-m-accept" },
"Forth"
]
model: [{
"value": "First",
//% "It's the first one"
"description": qsTrId("ui-component-gallery-declarative-radio-buttons-its-the-first-one")
}, {
"value": "Second",
//% "2nd"
"name": qsTrId("ui-component-gallery-declarative-radio-buttons-2-nd")
}, {
"value": "Third",
"icon": "image://theme/icon-m-accept"
}, "Forth"]
onSelectedValuesChanged: console.log("String values:", selectedValues())
}
//% "Variable Value"
SectionHeader { text: qsTrId("ui-component-gallery-declarative-radio-buttons-variable-value") }
SectionHeader {
//% "Variable Value"
text: qsTrId("ui-component-gallery-declarative-radio-buttons-variable-value")
}
SwitchGroup {
id: variableValueGroup
exclusive: root.exclusive
model: [
//% "True"
{ value: true, name: qsTrId("ui-component-gallery-declarative-radio-buttons-true") },
5,
//% "Some text"
{ value: "Some text", name: qsTrId("ui-component-gallery-declarative-radio-buttons-some-text") },
//% "Values could be quite variable"
{ value: new Date(), name: (new Date()).toLocaleDateString(), description: qsTrId("ui-component-gallery-declarative-radio-buttons-values-could-be-quite-variable") }
]
model: [{
"value": true,
//% "True"
"name": qsTrId("ui-component-gallery-declarative-radio-buttons-true")
}, 5, {
"value": "Some text",
//% "Some text"
"name": qsTrId("ui-component-gallery-declarative-radio-buttons-some-text")
}, {
"value": new Date(),
"name": (new Date()).toLocaleDateString(),
//% "Values could be quite variable"
"description": qsTrId("ui-component-gallery-declarative-radio-buttons-values-could-be-quite-variable")
}]
onSelectedValuesChanged: console.log("Variable values:", selectedValues())
}
}
VerticalScrollDecorator { }
VerticalScrollDecorator {
}
PullDownMenu {
quickSelect: true
MenuItem {
text: root.exclusive
//% "Turn multiple selection on"
? qsTrId("ui-component-gallery-declarative-radio-buttons-turn-multiple-selection-on")
//% "Turn multiple selection off"
: qsTrId("ui-component-gallery-declarative-radio-buttons-turn-multiple-selection-off")
text: root.exclusive ?
//% "Turn multiple selection on"
qsTrId("ui-component-gallery-declarative-radio-buttons-turn-multiple-selection-on") :
//% "Turn multiple selection off"
qsTrId("ui-component-gallery-declarative-radio-buttons-turn-multiple-selection-off")
onClicked: root.exclusive = !root.exclusive
}
......
......@@ -12,28 +12,31 @@ Page {
anchors.fill: parent
contentHeight: column.height
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
Column {
id: column
width: parent.width
//% "Dialogs"
PageHeader { title: qsTrId("ui-component-gallery-dialog-dialogs") }
PageHeader {
//% "Dialogs"
title: qsTrId("ui-component-gallery-dialog-dialogs")
}
ValueButton {
property date selectedDate
function openDateDialog() {
var obj = pageStack.animatorPush("Sailfish.Silica.DatePickerDialog",
{ date: selectedDate })
obj.pageCompleted.connect(function(page) {
page.accepted.connect(function() {
value = page.dateText
selectedDate = page.date
})
})
var obj = pageStack.animatorPush("Sailfish.Silica.DatePickerDialog", {
"date": selectedDate
});
obj.pageCompleted.connect(function (page) {
page.accepted.connect(function () {
value = page.dateText;
selectedDate = page.date;
});
});
}
//% "Date"
......@@ -50,26 +53,24 @@ Page {
function openTimeDialog() {
var obj = pageStack.animatorPush("Sailfish.Silica.TimePickerDialog", {
hourMode: (comboBoxHoursMode.checked ? DateTime.TwentyFourHours : DateTime.TwelveHours),
hour: selectedHour,
minute: selectedMinute
})
obj.pageCompleted.connect(function(page) {
page.accepted.connect(function() {
selectedHour = page.hour
selectedMinute = page.minute
})
})
"hourMode": (comboBoxHoursMode.checked ? DateTime.TwentyFourHours : DateTime.TwelveHours),
"hour": selectedHour,
"minute": selectedMinute
});
obj.pageCompleted.connect(function (page) {
page.accepted.connect(function () {
selectedHour = page.hour;
selectedMinute = page.minute;
});
});
}
//% "Time"
label: qsTrId("ui-component-gallery-dialog-time")
value: {
var time = new Date(0, 0, 0, selectedHour, selectedMinute, 0)
var type = comboBoxHoursMode.checked ? Formatter.TimeValueTwentyFourHours
: Formatter.TimeValueTwelveHours
return Format.formatDate(time, type)
var time = new Date(0, 0, 0, selectedHour, selectedMinute, 0);
var type = comboBoxHoursMode.checked ? Formatter.TimeValueTwentyFourHours : Formatter.TimeValueTwelveHours;
return Format.formatDate(time, type);
}
width: parent.width
onClicked: openTimeDialog()
......@@ -82,8 +83,10 @@ Page {
text: qsTrId("ui-component-gallery-dialog-24-hours")
}
//% "Color"
SectionHeader { text: qsTrId("ui-component-gallery-dialog-color") }
SectionHeader {
//% "Color"
text: qsTrId("ui-component-gallery-dialog-color")
}
BackgroundItem {
id: colorPickerButton
......@@ -105,24 +108,32 @@ Page {
}
}
onClicked: {
var obj = pageStack.animatorPush("Sailfish.Silica.ColorPickerPage", { color: colorIndicator.color })
obj.pageCompleted.connect(function(page) {
page.colorClicked.connect(function(color) {
colorIndicator.color = color
pageStack.pop()
})
})
var obj = pageStack.animatorPush("Sailfish.Silica.ColorPickerPage", {
"color": colorIndicator.color
});
obj.pageCompleted.connect(function (page) {
page.colorClicked.connect(function (color) {
colorIndicator.color = color;
pageStack.pop();
});
});
}
Component {
id: colorPickerPage
ColorPickerPage {}
ColorPickerPage {
}
}
}
Item { width: parent.width; height: Theme.paddingLarge }
Item {
width: parent.width
height: Theme.paddingLarge
}
//% "Wizards"
SectionHeader { text: qsTrId("ui-component-gallery-dialog-wizards") }
SectionHeader {
//% "Wizards"
text: qsTrId("ui-component-gallery-dialog-wizards")
}
Column {
width: parent.width
......@@ -155,7 +166,7 @@ Page {
onAcceptPendingChanged: {
if (acceptPending) {
// Tell the destination page what the selected category is
acceptDestinationInstance.category = selector.value
acceptDestinationInstance.category = selector.value;
}
}
......@@ -184,7 +195,7 @@ Page {
menu: ContextMenu {
Repeater {
//% "Fruit"
model: [ qsTrId("ui-component-gallery-dialog-fruit") ]
model: [qsTrId("ui-component-gallery-dialog-fruit")]
MenuItem {
text: modelData
......@@ -275,7 +286,7 @@ Page {
}
onAccepted: {
wizard.selection = selector.value
wizard.selection = selector.value;
}
}
}
......@@ -283,4 +294,3 @@ Page {
}
}
}
......@@ -9,9 +9,10 @@ Page {
id: page
SilicaFlickable {
contentHeight: column.height + Theme.paddingLarge*2
contentHeight: column.height + Theme.paddingLarge * 2
anchors.fill: parent
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
Column {
id: column
spacing: Theme.paddingMedium
......@@ -45,8 +46,8 @@ Page {
}
GlassItem {
id: slidertrack
x: Math.round(Screen.width/8)
width: page.width-2*x
x: Math.round(Screen.width / 8)
width: page.width - 2 * x
height: 27
falloffRadius: Math.exp(fpixw.value)
radius: Math.exp(pixw.value)
......@@ -55,11 +56,11 @@ Page {
cache: false
GlassItem {
id: slider
property real _width : slidertrack.width
property real _width: slidertrack.width
on_WidthChanged: {
widthAnimation.stop()
widthAnimation.to = _width
widthAnimation.start()
widthAnimation.stop();
widthAnimation.to = _width;
widthAnimation.start();
}
NumberAnimation on width {
id: widthAnimation
......@@ -92,7 +93,9 @@ Page {
Row {
height: Theme.itemSizeMedium
anchors.horizontalCenter: parent.horizontalCenter
GlassItem { id: defaultItem }
GlassItem {
id: defaultItem
}
GlassItem {
scale: 0.2
rotation: 30
......@@ -154,8 +157,8 @@ Page {
onTriggered: blink.c++
}
onCChanged: {
var colors = ["red", "yellow", "green", "blue"]
blink.color = colors[c % colors.length]
var colors = ["red", "yellow", "green", "blue"];
blink.color = colors[c % colors.length];
}
falloffRadius: Math.exp(fpixw.value)
radius: Math.exp(pixw.value)
......
......@@ -10,25 +10,22 @@ Page {
property string fontFamilyGlobal: Theme.fontFamily
property var fontSizes: [
e("font_size_tiny"),
e("font_size_extra_small"),
e("font_size_small"),
e("font_size_medium"),
e("font_size_large"),
e("font_size_extra_large"),
e("font_size_huge")
]
property var fontSizes: [e("font_size_tiny"), e("font_size_extra_small"), e("font_size_small"), e("font_size_medium"), e("font_size_large"), e("font_size_extra_large"), e("font_size_huge")]
function snakeToCamel(string) {
var words = string.split('_')
var result = words.shift()
words.forEach(function (word) { result += (word.charAt(0).toUpperCase() + word.slice(1)) })
return result
var words = string.split('_');
var result = words.shift();
words.forEach(function (word) {
result += (word.charAt(0).toUpperCase() + word.slice(1));
});
return result;
}
function e(name) {
return { confKey: name, sizeCategory: snakeToCamel(name) }
return {
"confKey": name,
"sizeCategory": snakeToCamel(name)
};
}
anchors.fill: parent
......@@ -37,7 +34,8 @@ Page {
anchors.fill: parent
contentHeight: column.height + Theme.paddingLarge
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
Column {
id: column
......@@ -59,16 +57,14 @@ Page {
id: fontFamilyComboBox
property var model: Qt.fontFamilies()
function resetIndex() {
currentIndex = Theme.fontFamily === "Sail Sans Pro Light"
? model.indexOf("Sail Sans Pro")
: model.indexOf(Theme.fontFamily)
currentIndex = Theme.fontFamily === "Sail Sans Pro Light" ? model.indexOf("Sail Sans Pro") : model.indexOf(Theme.fontFamily);
}
//% "Font family"
label: qsTrId("ui-component-gallery-font-font-family")
menu: ContextMenu {
Repeater {
......@@ -82,7 +78,7 @@ Page {
}
}
}
Component.onCompleted: resetIndex()
}
......@@ -131,22 +127,19 @@ Page {
text: qsTrId("ui-component-gallery-font-save-values")
onClicked: {
var correction = confGroup.value("auto_scale_values") ? 1.0 / Theme.pixelRatio
: 1.0
var correction = confGroup.value("auto_scale_values") ? 1.0 / Theme.pixelRatio : 1.0;
for (var i = 0; i < fontSizes.length; ++i) {
var value = textEditRepeater.itemAt(i).text * correction
var modelData = fontSizes[i]
var value = textEditRepeater.itemAt(i).text * correction;
var modelData = fontSizes[i];
if (value != Theme[modelData.sizeCategory]) {
confGroup.setValue(modelData.confKey, value)
confGroup.setValue(modelData.confKey, value);
}
}
if (fontFamilyGlobal != Theme.fontFamily) {
confGroup.setValue("font_family", fontFamilyGlobal)
confGroup.setValue("font_family_heading", fontFamilyGlobal)
confGroup.setValue("font_family", fontFamilyGlobal);
confGroup.setValue("font_family_heading", fontFamilyGlobal);
}
confGroup.sync()
confGroup.sync();
}
}
......@@ -155,14 +148,12 @@ Page {
text: qsTrId("ui-component-gallery-font-reset-values")
onClicked: {
confGroup.clear()
confGroup.sync()
fontFamilyGlobal = Theme.fontFamily
fontFamilyComboBox.resetIndex()
confGroup.clear();
confGroup.sync();
fontFamilyGlobal = Theme.fontFamily;
fontFamilyComboBox.resetIndex();
for (var i = 0; i < fontSizes.length; ++i) {
textEditRepeater.itemAt(i).text = Theme[fontSizes[i].sizeCategory]
textEditRepeater.itemAt(i).text = Theme[fontSizes[i].sizeCategory];
}
}
}
......
......@@ -11,7 +11,8 @@ Dialog {
anchors.fill: parent
contentHeight: column.height
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
Column {
id: column
......
......@@ -27,11 +27,12 @@ Page {
}
}
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
delegate: Item {
x: Theme.horizontalPageMargin
width: parent.width - 2*Theme.horizontalPageMargin
width: parent.width - 2 * Theme.horizontalPageMargin
height: childrenRect.height
Label {
......@@ -71,13 +72,12 @@ Page {
}
}
Label {
id: timestampLabel
function timestamp() {
var txt = Format.formatDate(dateTime, Formatter.Timepoint)
var elapsed = Format.formatDate(dateTime, Formatter.DurationElapsed)
return txt + (elapsed ? ' (' + elapsed + ')' : '')
var txt = Format.formatDate(dateTime, Formatter.Timepoint);
var elapsed = Format.formatDate(dateTime, Formatter.DurationElapsed);
return txt + (elapsed ? ' (' + elapsed + ')' : '');
}
id: timestampLabel
text: timestamp()
font.pixelSize: Theme.fontSizeExtraSmall
font.italic: true
......@@ -101,39 +101,40 @@ Page {
}
Component.onCompleted: {
var offsets = [ 0,
3 * 60 * 1000, // 3 minutes ago
63 * 60 * 1000, // 63 minutes ago
6.5 * 60 * 60 * 1000, // 6 hours, 30 minutes ago
23.5 * 60 * 60 * 1000, // 23 hours, 30 minutes ago
24.25 * 60 * 60 * 1000, // 1 day, 15 minutes ago
50 * 60 * 60 * 1000, // 2 days, 2 hours ago
100 * 60 * 60 * 1000, // 4 days, 4 hours ago
6.25 * 24 * 60 * 60 * 1000, // 6 days, 6 hours ago
7.75 * 24 * 60 * 60 * 1000, // 7 days, 18 hours ago
20 * 24 * 60 * 60 * 1000, // 20 days ago
120 * 24 * 60 * 60 * 1000, // 120 days ago
364 * 24 * 60 * 60 * 1000, // 364 days ago
366 * 24 * 60 * 60 * 1000, // 366 days ago
1000 * 24 * 60 * 60 * 1000 ] // 1000 days ago
var fileSizes = [ 0, // 0 B
99, // 99 B
100, // 0.1 kB
102347, // 99.9 kB
102400, // 0.1 MB
104805170, // 99.9 MB
1048523570, // 999.95MB-1
1048523571, // 999.95MB
107320495307, // 99.9 GB
1073688136907, // 999.95GB-1
1073688136908 ] // 999.95GB
var offsets = [0, 3 * 60 * 1000 // 3 minutes ago
, 63 * 60 * 1000 // 63 minutes ago
, 6.5 * 60 * 60 * 1000 // 6 hours, 30 minutes ago
, 23.5 * 60 * 60 * 1000 // 23 hours, 30 minutes ago
, 24.25 * 60 * 60 * 1000 // 1 day, 15 minutes ago
, 50 * 60 * 60 * 1000 // 2 days, 2 hours ago
, 100 * 60 * 60 * 1000 // 4 days, 4 hours ago
, 6.25 * 24 * 60 * 60 * 1000 // 6 days, 6 hours ago
, 7.75 * 24 * 60 * 60 * 1000 // 7 days, 18 hours ago
, 20 * 24 * 60 * 60 * 1000 // 20 days ago
, 120 * 24 * 60 * 60 * 1000 // 120 days ago
, 364 * 24 * 60 * 60 * 1000 // 364 days ago
, 366 * 24 * 60 * 60 * 1000 // 366 days ago
, 1000 * 24 * 60 * 60 * 1000]; // 1000 days ago
var fileSizes = [0 // 0 B
, 99 // 99 B
, 100 // 0.1 kB
, 102347 // 99.9 kB
, 102400 // 0.1 MB
, 104805170 // 99.9 MB
, 1048523570 // 999.95MB-1
, 1048523571 // 999.95MB
, 107320495307 // 99.9 GB
, 1073688136907 // 999.95GB-1
, 1073688136908]; // 999.95GB
var now = new Date().getTime()
var now = new Date().getTime();
for (var i = 0, fileSize = 0; i < offsets.length; ++i) {
var dateTime = new Date(now - offsets[i])
model.append({ 'dateTime': dateTime,
'section': Format.formatDate(dateTime, Formatter.TimepointSectionRelative),
'fileSize': Format.formatFileSize(fileSizes[fileSize++]) })
var dateTime = new Date(now - offsets[i]);
model.append({
"dateTime": dateTime,
"section": Format.formatDate(dateTime, Formatter.TimepointSectionRelative),
"fileSize": Format.formatFileSize(fileSizes[fileSize++])
});
fileSize %= fileSizes.length;
}
}
......
Это отличие свёрнуто
......@@ -46,7 +46,8 @@ Page {
contentHeight: column.height + Theme.paddingLarge
contentWidth: parent.width
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
Column {
id: column
......
......@@ -10,7 +10,7 @@ Page {
onStatusChanged: {
if (status == PageStatus.Active) {
pageStack.pushAttached(attachedPage)
pageStack.pushAttached(attachedPage);
}
}
SilicaFlickable {
......@@ -21,10 +21,10 @@ Page {
//% "Clear"
text: qsTrId("ui-component-gallery-interaction-hint-clear")
onClicked: {
swipeCombobox.currentIndex = 0
flickCombobox.currentIndex = 0
pullCombobox.currentIndex = 0
tapCombobox.currentIndex = 0
swipeCombobox.currentIndex = 0;
flickCombobox.currentIndex = 0;
pullCombobox.currentIndex = 0;
tapCombobox.currentIndex = 0;
}
}
}
......@@ -32,8 +32,11 @@ Page {
Column {
id: column
width: root.width
//% "Touch hints"
PageHeader { title: qsTrId("ui-component-gallery-interaction-hint-touch-hints") }
PageHeader {
//% "Touch hints"
title: qsTrId("ui-component-gallery-interaction-hint-touch-hints")
}
ComboBox {
id: swipeCombobox
......@@ -42,53 +45,70 @@ Page {
label: qsTrId("ui-component-gallery-interaction-hint-swipe-hint")
menu: ContextMenu {
onActivated: {
flickCombobox.currentIndex = 0
pullCombobox.currentIndex = 0
tapCombobox.currentIndex = 0
flickCombobox.currentIndex = 0;
pullCombobox.currentIndex = 0;
tapCombobox.currentIndex = 0;
}
MenuItem {
//% "None"
text: qsTrId("ui-component-gallery-interaction-hint-none")
}
MenuItem {
//% "Top"
text: qsTrId("ui-component-gallery-interaction-hint-top")
}
MenuItem {
//% "Bottom"
text: qsTrId("ui-component-gallery-interaction-hint-bottom")
}
MenuItem {
//% "Left"
text: qsTrId("ui-component-gallery-interaction-hint-left")
}
//% "None"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-none") }
//% "Top"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-top") }
//% "Bottom"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-bottom") }
//% "Left"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-left") }
//% "Right"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-right") }
MenuItem {
//% "Right"
text: qsTrId("ui-component-gallery-interaction-hint-right")
}
}
onCurrentIndexChanged: update()
function update() {
hint.stop()
tapHint.stop()
hint.interactionMode = TouchInteraction.EdgeSwipe
hint.stop();
tapHint.stop();
hint.interactionMode = TouchInteraction.EdgeSwipe;
switch (currentIndex) {
case 0: // "None"
break
case 1: // "Top"
hint.direction = TouchInteraction.Down
hint.start()
break
case 2: // "Bottom"
hint.direction = TouchInteraction.Up
hint.start()
break
case 3: // "Left"
hint.direction = TouchInteraction.Right
hint.start()
break
case 4: // "Right"
hint.direction = TouchInteraction.Left
hint.start()
break
case 0 // "None"
:
break;
case 1 // "Top"
:
hint.direction = TouchInteraction.Down;
hint.start();
break;
case 2 // "Bottom"
:
hint.direction = TouchInteraction.Up;
hint.start();
break;
case 3 // "Left"
:
hint.direction = TouchInteraction.Right;
hint.start();
break;
case 4 // "Right"
:
hint.direction = TouchInteraction.Left;
hint.start();
break;
default:
console.log("Unknown option")
break
console.log("Unknown option");
break;
}
}
}
......@@ -101,55 +121,72 @@ Page {
label: qsTrId("ui-component-gallery-interaction-hint-flick-hint")
menu: ContextMenu {
onActivated: {
swipeCombobox.currentIndex = 0
pullCombobox.currentIndex = 0
tapCombobox.currentIndex = 0
swipeCombobox.currentIndex = 0;
pullCombobox.currentIndex = 0;
tapCombobox.currentIndex = 0;
}
MenuItem {
//% "None"
text: qsTrId("ui-component-gallery-interaction-hint-none")
}
MenuItem {
//% "Up"
text: qsTrId("ui-component-gallery-interaction-hint-up")
}
MenuItem {
//% "Down"
text: qsTrId("ui-component-gallery-interaction-hint-down")
}
MenuItem {
//% "Left"
text: qsTrId("ui-component-gallery-interaction-hint-left")
}
//% "None"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-none") }
//% "Up"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-up") }
//% "Down"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-down") }
//% "Left"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-left") }
//% "Right"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-right") }
MenuItem {
//% "Right"
text: qsTrId("ui-component-gallery-interaction-hint-right")
}
}
Component.onCompleted: update()
onCurrentIndexChanged: update()
function update() {
hint.stop()
tapHint.stop()
hint.interactionMode = TouchInteraction.Swipe
hint.stop();
tapHint.stop();
hint.interactionMode = TouchInteraction.Swipe;
switch (currentIndex) {
case 0: // "None"
break
case 1: // "Up"
hint.direction = TouchInteraction.Up
hint.start()
break
case 2: // "Down"
hint.direction = TouchInteraction.Down
hint.start()
break
case 3: // "Left"
hint.direction = TouchInteraction.Left
hint.start()
break
case 4: // "Right"
hint.direction = TouchInteraction.Right
hint.start()
break
case 0 // "None"
:
break;
case 1 // "Up"
:
hint.direction = TouchInteraction.Up;
hint.start();
break;
case 2 // "Down"
:
hint.direction = TouchInteraction.Down;
hint.start();
break;
case 3 // "Left"
:
hint.direction = TouchInteraction.Left;
hint.start();
break;
case 4 // "Right"
:
hint.direction = TouchInteraction.Right;
hint.start();
break;
default:
//% "Unknown option"
console.log(qsTrId("ui-component-gallery-interaction-hint-unknown-option"))
break
console.log(qsTrId("ui-component-gallery-interaction-hint-unknown-option"));
break;
}
}
}
......@@ -161,42 +198,51 @@ Page {
label: qsTrId("ui-component-gallery-interaction-hint-pull-hint")
menu: ContextMenu {
onActivated: {
swipeCombobox.currentIndex = 0
flickCombobox.currentIndex = 0
tapCombobox.currentIndex = 0
swipeCombobox.currentIndex = 0;
flickCombobox.currentIndex = 0;
tapCombobox.currentIndex = 0;
}
MenuItem {
//% "None"
text: qsTrId("ui-component-gallery-interaction-hint-none")
}
MenuItem {
//% "Up"
text: qsTrId("ui-component-gallery-interaction-hint-up")
}
//% "None"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-none") }
//% "Up"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-up") }
//% "Down"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-down") }
MenuItem {
//% "Down"
text: qsTrId("ui-component-gallery-interaction-hint-down")
}
}
onCurrentIndexChanged: update()
function update() {
hint.stop()
tapHint.stop()
hint.interactionMode = TouchInteraction.Pull
hint.stop();
tapHint.stop();
hint.interactionMode = TouchInteraction.Pull;
switch (currentIndex) {
case 0: // "None"
break
case 1: // "Up"
hint.direction = TouchInteraction.Up
hint.start()
break
case 2: // "Down"
hint.direction = TouchInteraction.Down
hint.start()
break
case 0 // "None"
:
break;
case 1 // "Up"
:
hint.direction = TouchInteraction.Up;
hint.start();
break;
case 2 // "Down"
:
hint.direction = TouchInteraction.Down;
hint.start();
break;
default:
//% "Unknown option"
console.log(qsTrId("ui-component-gallery-interaction-hint-unknown-option"))
break
console.log(qsTrId("ui-component-gallery-interaction-hint-unknown-option"));
break;
}
}
}
......@@ -208,33 +254,39 @@ Page {
label: qsTrId("ui-component-gallery-interaction-hint-tap-hint")
menu: ContextMenu {
onActivated: {
swipeCombobox.currentIndex = 0
flickCombobox.currentIndex = 0
pullCombobox.currentIndex = 0
swipeCombobox.currentIndex = 0;
flickCombobox.currentIndex = 0;
pullCombobox.currentIndex = 0;
}
MenuItem {
//% "None"
text: qsTrId("ui-component-gallery-interaction-hint-none")
}
//% "None"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-none") }
//% "Tap"
MenuItem { text: qsTrId("ui-component-gallery-interaction-hint-tap") }
MenuItem {
//% "Tap"
text: qsTrId("ui-component-gallery-interaction-hint-tap")
}
}
onCurrentIndexChanged: update()
function update() {
hint.stop()
tapHint.stop()
hint.stop();
tapHint.stop();
switch (currentIndex) {
case 0: // "None"
break
case 1: // "Tap"
tapHint.start()
break
case 0 // "None"
:
break;
case 1 // "Tap"
:
tapHint.start();
break;
default:
//% "Unknown option"
console.log(qsTrId("ui-component-gallery-interaction-hint-unknown-option"))
break
console.log(qsTrId("ui-component-gallery-interaction-hint-unknown-option"));
break;
}
}
}
......@@ -243,60 +295,67 @@ Page {
width: parent.width
height: Screen.height
}
//% "More content :)"
InfoLabel { text: qsTrId("ui-component-gallery-interaction-hint-more-content") }
InfoLabel {
//% "More content :)"
text: qsTrId("ui-component-gallery-interaction-hint-more-content")
}
Item {
width: parent.width
height: Screen.height/3
height: Screen.height / 3
}
}
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
}
InteractionHintLabel {
anchors.bottom: parent.bottom
opacity: (swipeCombobox._menuOpen || flickCombobox._menuOpen) ? 0.0 : 1.0
Behavior on opacity { FadeAnimation {} }
Behavior on opacity {
FadeAnimation {
}
}
text: {
switch (swipeCombobox.currentIndex) {
case 1:
//% "Swipe from top to close the application"
return qsTrId("ui-component-gallery-interaction-hint-swipe-from-top-to-close-the-application")
return qsTrId("ui-component-gallery-interaction-hint-swipe-from-top-to-close-the-application");
case 2:
//% "Swipe from bottom to access events view"
return qsTrId("ui-component-gallery-interaction-hint-swipe-from-bottom-to-access-events-view")
return qsTrId("ui-component-gallery-interaction-hint-swipe-from-bottom-to-access-events-view");
case 3:
case 4:
//% "Swipe from either edge to go back to home"
return qsTrId("ui-component-gallery-interaction-hint-swipe-from-either-edge-to-go-back-to-home")
return qsTrId("ui-component-gallery-interaction-hint-swipe-from-either-edge-to-go-back-to-home");
}
switch (flickCombobox.currentIndex) {
case 1:
case 2:
//% "Flick up and down to scroll for more content"
return qsTrId("ui-component-gallery-interaction-hint-flick-up-and-down-to-scroll-for-more-content")
return qsTrId("ui-component-gallery-interaction-hint-flick-up-and-down-to-scroll-for-more-content");
case 3:
//% "Flick left to access attached page"
return qsTrId("ui-component-gallery-interaction-hint-flick-left-to-access-attached-page")
return qsTrId("ui-component-gallery-interaction-hint-flick-left-to-access-attached-page");
case 4:
//% "Flick right to return to previous page"
return qsTrId("ui-component-gallery-interaction-hint-flick-right-to-return-to-previous-page")
return qsTrId("ui-component-gallery-interaction-hint-flick-right-to-return-to-previous-page");
}
switch (pullCombobox.currentIndex) {
case 1:
//% "Pull up to access pulley menu"
return qsTrId("ui-component-gallery-interaction-hint-pull-up-to-access-pulley-menu")
return qsTrId("ui-component-gallery-interaction-hint-pull-up-to-access-pulley-menu");
case 2:
//% "Pull down to access pulley menu"
return qsTrId("ui-component-gallery-interaction-hint-pull-down-to-access-pulley-menu")
return qsTrId("ui-component-gallery-interaction-hint-pull-down-to-access-pulley-menu");
}
switch (tapCombobox.currentIndex) {
case 1:
//% "Tap"
return qsTrId("ui-component-gallery-interaction-hint-tap")
return qsTrId("ui-component-gallery-interaction-hint-tap");
}
//% "Select example gesture hint"
return qsTrId("ui-component-gallery-interaction-hint-select-example-gesture-hint")
return qsTrId("ui-component-gallery-interaction-hint-select-example-gesture-hint");
}
}
TouchInteractionHint {
......
......@@ -15,7 +15,8 @@ Page {
contentWidth: parent.width
contentHeight: col.height + Theme.paddingLarge
VerticalScrollDecorator {}
VerticalScrollDecorator {
}
Column {
id: col
......@@ -109,7 +110,7 @@ Page {
Label {
//% "Text that should not be elided or faded out"
text: qsTrId("ui-component-gallery-label-text-that-should-not-be-elided-or-faded-out")
width: Math.min(page.width - 2*Theme.horizontalPageMargin, implicitWidth)
width: Math.min(page.width - 2 * Theme.horizontalPageMargin, implicitWidth)
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignLeft
color: palette.secondaryHighlightColor
......@@ -117,7 +118,7 @@ Page {
Label {
//% "Text that should be elided off the right end"
text: qsTrId("ui-component-gallery-label-text-that-should-be-elided-off-the-right-end")
width: Math.min(page.width - 2*Theme.horizontalPageMargin, implicitWidth*0.9)
width: Math.min(page.width - 2 * Theme.horizontalPageMargin, implicitWidth * 0.9)
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignLeft
truncationMode: TruncationMode.Elide
......@@ -126,7 +127,7 @@ Page {
Label {
//% "Text that should be elided off the left end"
text: qsTrId("ui-component-gallery-label-text-that-should-be-elided-off-the-left-end")
width: Math.min(page.width - 2*Theme.horizontalPageMargin, implicitWidth*0.9)
width: Math.min(page.width - 2 * Theme.horizontalPageMargin, implicitWidth * 0.9)
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignRight
truncationMode: TruncationMode.Elide
......@@ -135,7 +136,7 @@ Page {
Label {
//% "Text that should be faded out rather than elided"
text: qsTrId("ui-component-gallery-label-text-that-should-be-faded-out-rather-than-elided")
width: Math.min(page.width - 2*Theme.horizontalPageMargin, implicitWidth*0.9)
width: Math.min(page.width - 2 * Theme.horizontalPageMargin, implicitWidth * 0.9)
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignLeft
truncationMode: TruncationMode.Fade
......@@ -144,7 +145,7 @@ Page {
Label {
//% "Text that should be faded out from the left"
text: qsTrId("ui-component-gallery-label-text-that-should-be-faded-out-from-the-left")
width: Math.min(page.width - 2*Theme.horizontalPageMargin, implicitWidth*0.9)
width: Math.min(page.width - 2 * Theme.horizontalPageMargin, implicitWidth * 0.9)
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignRight
truncationMode: TruncationMode.Fade
......@@ -156,7 +157,7 @@ Page {
}
LinkedLabel {
x: Theme.horizontalPageMargin
width: parent.width - 2*x
width: parent.width - 2 * x
//% "A phone number is shown as 0123456789, an url as http://example.com and an email address as name@example.com."
plainText: qsTrId("ui-component-gallery-label-a-phone-number-is-shown-as-0123456789-an-url-as-httpexamplecom-and-an-email-address-as-nameexamplecom")
}
......@@ -167,7 +168,7 @@ Page {
}
Column {
x: Theme.paddingLarge
width: parent.width - 2*x
width: parent.width - 2 * x
spacing: Theme.paddingLarge
Repeater {
model: [
......@@ -198,8 +199,7 @@ Page {
// thai
"ภาษาไทยเป็นภาษาที่มีระดับเสียงของคำแน่นอนหรือวรรณยุกต์เช่นเดียวกับภาษาจีน และออกเสียงแยกคำต่อคำ",
// Emoticon
"😀 😁 😂 😃 😄 😅 😆 😇 😈 😉 😊 😋 😌 😍 😎 😏 😐 😑 😒 😓 😔 😕 😖 😗 😘 😙 😚 😛 😜 😝 😞 😟 😠 😡 😢 😣 😤 😥 😦 😧 😨 😩 😪 😫 😬 😭 😮 😯 😰 😱 😲 😳 😴 😵 😶 😷 😸 😹 😺 😻 😼 😽 😾 😿 🙀"
]
"😀 😁 😂 😃 😄 😅 😆 😇 😈 😉 😊 😋 😌 😍 😎 😏 😐 😑 😒 😓 😔 😕 😖 😗 😘 😙 😚 😛 😜 😝 😞 😟 😠 😡 😢 😣 😤 😥 😦 😧 😨 😩 😪 😫 😬 😭 😮 😯 😰 😱 😲 😳 😴 😵 😶 😷 😸 😹 😺 😻 😼 😽 😾 😿 🙀"]
Label {
text: modelData
color: palette.highlightColor
......
Это отличие свёрнуто
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать