From 85fb48bc51fed06a50b6178727fdf9e96aea4fc4 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sat, 13 Sep 2014 22:40:39 +0200 Subject: UI can now add some widgets around --- qml/pages/AddWidget.qml | 36 +++++++++++++++++ qml/pages/FirstPage.qml | 69 -------------------------------- qml/pages/MainPage.qml | 102 ++++++++++++++++++++++++++++++++++++++++++++++++ qml/pages/WatchView.qml | 45 +++++++++++++++++++++ 4 files changed, 183 insertions(+), 69 deletions(-) create mode 100644 qml/pages/AddWidget.qml delete mode 100644 qml/pages/FirstPage.qml create mode 100644 qml/pages/MainPage.qml create mode 100644 qml/pages/WatchView.qml (limited to 'qml/pages') diff --git a/qml/pages/AddWidget.qml b/qml/pages/AddWidget.qml new file mode 100644 index 0000000..50bf63d --- /dev/null +++ b/qml/pages/AddWidget.qml @@ -0,0 +1,36 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import com.javispedro.salmeta 1.0 + +Page { + id: page + + property int addToPage + property int addToPos + + SilicaListView { + id: allWidgetsListView + anchors.fill: parent + + model: allWidgets + + header: PageHeader { + title: "Add widget" + } + + delegate : BackgroundItem { + contentHeight: Theme.itemSizeMedium + + Label { + text: url + truncationMode: TruncationMode.Elide + color: highlighted ? Theme.highlightColor : Theme.primaryColor + } + + onClicked: { + curWidgets.addWidget(url, addToPage, addToPos, size); + pageStack.pop(); + } + } + } +} diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml deleted file mode 100644 index b86029e..0000000 --- a/qml/pages/FirstPage.qml +++ /dev/null @@ -1,69 +0,0 @@ -import QtQuick 2.0 -import Sailfish.Silica 1.0 -import Sailfish.Bluetooth 1.0 -import org.nemomobile.configuration 1.0 -import com.javispedro.salmeta 1.0 - -Page { - id: page - - ConfigurationValue { - id: deviceAddress - key: settingsPrefix + "/address" - defaultValue: "Select" - } - - SilicaFlickable { - anchors.fill: parent - - PullDownMenu { - MenuItem { - text: qsTr("Not done yet") - } - } - - contentHeight: column.height - - Column { - id: column - width: page.width - spacing: Theme.paddingLarge - - PageHeader { - title: "Salmeta" - } - - SectionHeader { - text: qsTr("Device settings"); - } - - ValueButton { - x: Theme.paddingLarge - label: "Device" - value: deviceAddress.value - - onClicked: { - var dialog = pageStack.push("Sailfish.Bluetooth.BluetoothDevicePickerDialog"); - - dialog.selectedDeviceChanged.connect(function() { - if (dialog.selectedDevice != "") { - deviceAddress.value = dialog.selectedDevice - } - }); - } - } - - SectionHeader { - text: qsTr("Widgets"); - } - - WatchView { - anchors.horizontalCenter: parent.horizontalCenter - width: 96 * 4 - height: 96 * 4 - } - } - } -} - - diff --git a/qml/pages/MainPage.qml b/qml/pages/MainPage.qml new file mode 100644 index 0000000..5448754 --- /dev/null +++ b/qml/pages/MainPage.qml @@ -0,0 +1,102 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 +import Sailfish.Bluetooth 1.0 +import org.nemomobile.configuration 1.0 + +Page { + id: page + + ConfigurationValue { + id: deviceAddress + key: curSettingsPrefix + "/address" + defaultValue: "Select" + } + + SilicaFlickable { + anchors.fill: parent + + PullDownMenu { + MenuItem { + text: qsTr("Not done yet") + } + } + + contentHeight: column.height + + Column { + id: column + width: page.width + spacing: Theme.paddingLarge + + PageHeader { + title: "Salmeta" + } + + SectionHeader { + text: qsTr("Device settings"); + } + + ValueButton { + x: Theme.paddingLarge + label: "Device" + value: deviceAddress.value + + onClicked: { + var dialog = pageStack.push("Sailfish.Bluetooth.BluetoothDevicePickerDialog"); + + dialog.selectedDeviceChanged.connect(function() { + if (dialog.selectedDevice !== "") { + deviceAddress.value = dialog.selectedDevice + } + }); + } + } + + SectionHeader { + text: qsTr("Widgets"); + } + + Item { + width: 96 * 4 + height: 96 * 4 + anchors.horizontalCenter: parent.horizontalCenter + + WatchView { + id: watchView + anchors.centerIn: parent + scale: 4 + } + } + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 8 + + Repeater { + model: 4 + + Rectangle { + // TODO These should be GlassItem. + width: 16 + height: 16 + radius: 8 + + color: "white" + opacity: watchView.curPage == index ? 0.9 : 0.3 + } + } + } + + SectionHeader { + text: qsTr("Notifications"); + } + + Label { + x: Theme.paddingLarge + text: "TODO" + } + } + } +} + + diff --git a/qml/pages/WatchView.qml b/qml/pages/WatchView.qml new file mode 100644 index 0000000..e738f4e --- /dev/null +++ b/qml/pages/WatchView.qml @@ -0,0 +1,45 @@ +import QtQuick 2.0 +import "../watch" + +Flickable { + id: watchView + width: 96 + height: 96 + clip: true + flickableDirection: Flickable.HorizontalFlick + + property int curPage: 0 + + WidgetView { + id: widgetView + model: curWidgets + editMode: true + onEmptyWidgetClicked: { + pageStack.push(Qt.resolvedUrl("AddWidget.qml"), { + 'addToPage': page, + 'addToPos': pos + }); + } + } + + contentWidth: widgetView.width + contentHeight: widgetView.height + + NumberAnimation { + id: pivotAnim + targets: watchView + property: "contentX" + to: curPage * watchView.width + duration: 100 + easing.type: Easing.InOutQuad + } + + onMovementStarted: { + pivotAnim.stop() + } + + onMovementEnded: { + curPage = Math.round(watchView.contentX / watchView.width) + pivotAnim.start() + } +} -- cgit v1.2.3