summaryrefslogtreecommitdiff
path: root/qml/pages
diff options
context:
space:
mode:
authorJavier S. Pedro <dev.git@javispedro.com>2014-09-14 14:11:26 +0200
committerJavier S. Pedro <dev.git@javispedro.com>2014-09-14 14:11:26 +0200
commitb9b1829dbc50534190c8b81f91ee477af6971834 (patch)
tree360f09061f43a247a5afdc2c83df2b9a03d86a4a /qml/pages
parent85fb48bc51fed06a50b6178727fdf9e96aea4fc4 (diff)
downloadsalmeta-b9b1829dbc50534190c8b81f91ee477af6971834.tar.gz
salmeta-b9b1829dbc50534190c8b81f91ee477af6971834.zip
addign watch properties, starting notification work
Diffstat (limited to 'qml/pages')
-rw-r--r--qml/pages/AddWidget.qml5
-rw-r--r--qml/pages/MainPage.qml137
-rw-r--r--qml/pages/WatchView.qml5
3 files changed, 143 insertions, 4 deletions
diff --git a/qml/pages/AddWidget.qml b/qml/pages/AddWidget.qml
index 50bf63d..d79ede9 100644
--- a/qml/pages/AddWidget.qml
+++ b/qml/pages/AddWidget.qml
@@ -22,13 +22,14 @@ Page {
contentHeight: Theme.itemSizeMedium
Label {
- text: url
+ x: Theme.paddingLarge
+ text: model.description
truncationMode: TruncationMode.Elide
color: highlighted ? Theme.highlightColor : Theme.primaryColor
}
onClicked: {
- curWidgets.addWidget(url, addToPage, addToPos, size);
+ curWidgets.addWidget(model.url, addToPage, addToPos, model.size);
pageStack.pop();
}
}
diff --git a/qml/pages/MainPage.qml b/qml/pages/MainPage.qml
index 5448754..9014a48 100644
--- a/qml/pages/MainPage.qml
+++ b/qml/pages/MainPage.qml
@@ -12,6 +12,18 @@ Page {
defaultValue: "Select"
}
+ ConfigurationValue {
+ id: curPageSetting
+ key: curSettingsPrefix + "/cur-page"
+ defaultValue: 0
+
+ onValueChanged: {
+ if (watchView.curPage !== value) {
+ watchView.switchToPage(value);
+ }
+ }
+ }
+
SilicaFlickable {
anchors.fill: parent
@@ -26,7 +38,7 @@ Page {
Column {
id: column
width: page.width
- spacing: Theme.paddingLarge
+ spacing: Theme.paddingMedium
PageHeader {
title: "Salmeta"
@@ -37,7 +49,6 @@ Page {
}
ValueButton {
- x: Theme.paddingLarge
label: "Device"
value: deviceAddress.value
@@ -52,6 +63,122 @@ Page {
}
}
+ ComboBox {
+ id: timeFormat
+ label: qsTr("Time format");
+
+ function load() {
+ if (showSecondsSetting.value) {
+ currentIndex = timeFormatSetting.value ? 3 : 2;
+ } else {
+ currentIndex = timeFormatSetting.value ? 1 : 0;
+ }
+ }
+
+ ConfigurationValue {
+ id: timeFormatSetting
+ key: curSettingsPrefix + "/24h-mode"
+ defaultValue: 0
+ }
+
+ ConfigurationValue {
+ id: showSecondsSetting
+ key: curSettingsPrefix + "/show-seconds"
+ defaultValue: 0
+ }
+
+ Component.onCompleted: {
+ load();
+ }
+
+ menu: ContextMenu {
+ MenuItem {
+ text: Qt.formatTime(new Date(), "hh:mm ap")
+ }
+ MenuItem {
+ text: Qt.formatTime(new Date(), "hh:mm")
+ }
+ MenuItem {
+ text: Qt.formatTime(new Date(), "hh:mm:ss ap")
+ }
+ MenuItem {
+ text: Qt.formatTime(new Date(), "hh:mm:ss")
+ }
+ }
+
+ onCurrentIndexChanged: {
+ timeFormatSetting.value = currentIndex === 1 || currentIndex === 3;
+ showSecondsSetting.value = currentIndex === 2 || currentIndex === 3;
+ }
+ }
+
+ ComboBox {
+ id: dateFormat
+ label: qsTr("Date format");
+
+ ConfigurationValue {
+ id: dateFormatSetting
+ key: curSettingsPrefix + "/ddmm-mode"
+ defaultValue: 0
+ }
+
+ menu: ContextMenu {
+ MenuItem {
+ text: Qt.formatDate(new Date(), "M/d")
+ }
+ MenuItem {
+ text: Qt.formatDate(new Date(), "d/M")
+ }
+ }
+
+ onCurrentIndexChanged: {
+ dateFormatSetting.value = currentIndex;
+ }
+
+ Component.onCompleted: {
+ currentIndex = dateFormatSetting.value ? 1 : 0;
+ }
+ }
+
+ TextSwitch {
+ id: separators
+ text: qsTr("Show separator lines");
+
+ ConfigurationValue {
+ id: separatorsSetting
+ key: curSettingsPrefix + "/show-separation-lines"
+ defaultValue: false
+ }
+
+ onCheckedChanged: {
+ separatorsSetting.value = checked;
+ }
+
+ Component.onCompleted: {
+ checked = separatorsSetting.value;
+ }
+ }
+
+ TextSwitch {
+ id: autobacklight
+ text: qsTr("Auto-backlight");
+
+ ConfigurationValue {
+ id: autobacklightSetting
+ key: curSettingsPrefix + "/auto-backlight"
+ defaultValue: false
+ }
+
+ onCheckedChanged: {
+ autobacklightSetting.value = checked;
+ }
+
+ Component.onCompleted: {
+ checked = autobacklightSetting.value;
+ }
+ }
+
+
SectionHeader {
text: qsTr("Widgets");
}
@@ -65,6 +192,12 @@ Page {
id: watchView
anchors.centerIn: parent
scale: 4
+
+ onCurPageChanged: {
+ if (curPageSetting.value !== curPage) {
+ curPageSetting.value = curPage;
+ }
+ }
}
}
diff --git a/qml/pages/WatchView.qml b/qml/pages/WatchView.qml
index e738f4e..a5d755e 100644
--- a/qml/pages/WatchView.qml
+++ b/qml/pages/WatchView.qml
@@ -42,4 +42,9 @@ Flickable {
curPage = Math.round(watchView.contentX / watchView.width)
pivotAnim.start()
}
+
+ function switchToPage(page) {
+ curPage = page;
+ pivotAnim.start();
+ }
}