From b9b1829dbc50534190c8b81f91ee477af6971834 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 14 Sep 2014 14:11:26 +0200 Subject: addign watch properties, starting notification work --- qml/pages/AddWidget.qml | 5 +- qml/pages/MainPage.qml | 137 ++++++++++++++++++++++++++++++++++++++- qml/pages/WatchView.qml | 5 ++ qml/watch/faces/builtinface3.png | Bin 0 -> 892 bytes qml/watch/faces/builtinface3.qml | 11 ++++ 5 files changed, 154 insertions(+), 4 deletions(-) create mode 100644 qml/watch/faces/builtinface3.png create mode 100644 qml/watch/faces/builtinface3.qml (limited to 'qml') 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(); + } } diff --git a/qml/watch/faces/builtinface3.png b/qml/watch/faces/builtinface3.png new file mode 100644 index 0000000..9154c9d Binary files /dev/null and b/qml/watch/faces/builtinface3.png differ diff --git a/qml/watch/faces/builtinface3.qml b/qml/watch/faces/builtinface3.qml new file mode 100644 index 0000000..ca542d4 --- /dev/null +++ b/qml/watch/faces/builtinface3.qml @@ -0,0 +1,11 @@ +import QtQuick 2.0 + +Rectangle { + width: 96 + height: 96 + + Image { + anchors.fill: parent + source: "builtinface3.png" + } +} -- cgit v1.2.3