summaryrefslogtreecommitdiff
path: root/qml/pages/MainPage.qml
diff options
context:
space:
mode:
Diffstat (limited to 'qml/pages/MainPage.qml')
-rw-r--r--qml/pages/MainPage.qml137
1 files changed, 135 insertions, 2 deletions
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;
+ }
+ }
}
}