summaryrefslogtreecommitdiff
path: root/rockwork/qml/MainMenuPage.qml
diff options
context:
space:
mode:
Diffstat (limited to 'rockwork/qml/MainMenuPage.qml')
-rw-r--r--rockwork/qml/MainMenuPage.qml455
1 files changed, 215 insertions, 240 deletions
diff --git a/rockwork/qml/MainMenuPage.qml b/rockwork/qml/MainMenuPage.qml
index 32c7b96..6713d70 100644
--- a/rockwork/qml/MainMenuPage.qml
+++ b/rockwork/qml/MainMenuPage.qml
@@ -1,311 +1,286 @@
-import QtQuick 2.4
-import QtQuick.Layouts 1.1
-import Ubuntu.Components 1.3
+import QtQuick 2.0
+import Sailfish.Silica 1.0
Page {
id: root
- title: pebble.name
property var pebble: null
- head {
- actions: [
- Action {
- iconName: "info"
- text: i18n.tr("About")
- onTriggered: {
+ SilicaFlickable {
+ id: flickable
+ anchors.fill: parent
+ contentHeight: column.height
+
+ VerticalScrollDecorator { flickable: flickable }
+
+ PullDownMenu {
+ MenuItem {
+ text: qsTr("About")
+ onClicked: {
pageStack.push(Qt.resolvedUrl("InfoPage.qml"))
}
- },
- Action {
- iconName: "ubuntu-sdk-symbolic"
- text: i18n.tr("Developer tools")
- onTriggered: {
+ }
+ MenuItem {
+ text: qsTr("Developer tools")
+ onClicked: {
pageStack.push(Qt.resolvedUrl("DeveloperToolsPage.qml"), {pebble: root.pebble})
}
}
- ]
- }
-
- //Creating the menu list this way to allow the text field to be translatable (http://askubuntu.com/a/476331)
- ListModel {
- id: mainMenuModel
- dynamicRoles: true
- }
-
- Component.onCompleted: {
- populateMainMenu();
- }
-
- Connections {
- target: root.pebble
- onFirmwareUpgradeAvailableChanged: {
- populateMainMenu();
}
- }
+ Column {
+ id: column
+ width: root.width
+ spacing: Theme.paddingLarge
+ PageHeader {
+ title: qsTr("RockPool")
+ }
- function populateMainMenu() {
- mainMenuModel.clear();
-
- mainMenuModel.append({
- icon: "stock_notification",
- text: i18n.tr("Manage notifications"),
- page: "NotificationsPage.qml",
- color: "blue"
- });
-
- mainMenuModel.append({
- icon: "stock_application",
- text: i18n.tr("Manage Apps"),
- page: "InstalledAppsPage.qml",
- showWatchApps: true,
- color: UbuntuColors.green
- });
-
- mainMenuModel.append({
- icon: "clock-app-symbolic",
- text: i18n.tr("Manage Watchfaces"),
- page: "InstalledAppsPage.qml",
- showWatchFaces: true,
- color: "black"
- });
-
- mainMenuModel.append({
- icon: "settings",
- text: i18n.tr("Settings"),
- page: "SettingsPage.qml",
- showWatchFaces: true,
- color: "gold"
- });
-
- if (root.pebble.firmwareUpgradeAvailable) {
- mainMenuModel.append({
- icon: "preferences-system-updates-symbolic",
- text: i18n.tr("Firmware upgrade"),
- page: "FirmwareUpgradePage.qml",
- color: "red"
- });
- }
+ ListView {
+ model: mainMenuModel
+ }
- }
+ //Creating the menu list this way to allow the text field to be translatable (http://askubuntu.com/a/476331)
+ ListModel {
+ id: mainMenuModel
+ dynamicRoles: true
+ }
- PebbleModels {
- id: modelModel
- }
+ Component.onCompleted: {
+ populateMainMenu();
+ }
- GridLayout {
- anchors.fill: parent
- columns: parent.width > parent.height ? 2 : 1
+ Connections {
+ target: root.pebble
+ onFirmwareUpgradeAvailableChanged: {
+ populateMainMenu();
+ }
+ }
- Item {
- Layout.fillWidth: true
- Layout.fillHeight: true
- Layout.maximumHeight: units.gu(30)
+ function populateMainMenu() {
+ mainMenuModel.clear();
+
+ mainMenuModel.append({
+ icon: "stock_notification",
+ text: qsTr("Manage notifications"),
+ page: "NotificationsPage.qml",
+ color: "blue"
+ });
+
+ mainMenuModel.append({
+ icon: "stock_application",
+ text: qsTr("Manage Apps"),
+ page: "InstalledAppsPage.qml",
+ showWatchApps: true,
+ color: "green"
+ });
+
+ mainMenuModel.append({
+ icon: "clock-app-symbolic",
+ text: qsTr("Manage Watchfaces"),
+ page: "InstalledAppsPage.qml",
+ showWatchFaces: true,
+ color: "black"
+ });
+
+ mainMenuModel.append({
+ icon: "settings",
+ text: qsTr("Settings"),
+ page: "SettingsPage.qml",
+ showWatchFaces: true,
+ color: "gold"
+ });
+
+ if (root.pebble.firmwareUpgradeAvailable) {
+ mainMenuModel.append({
+ icon: "preferences-system-updates-symbolic",
+ text: qsTr("Firmware upgrade"),
+ page: "FirmwareUpgradePage.qml",
+ color: "red"
+ });
+ }
+ }
- RowLayout {
- anchors.fill: parent
- anchors.margins: units.gu(1)
- spacing: units.gu(1)
+ PebbleModels {
+ id: modelModel
+ }
+ Column {
+ anchors.fill: parent
Item {
- Layout.alignment: Qt.AlignHCenter
- Layout.fillHeight: true
- Layout.fillWidth: true
- Layout.minimumWidth: watchImage.width
+ //Layout.alignment: Qt.AlignHCenter
+ width: root.width
Image {
id: watchImage
width: implicitWidth * height / implicitHeight
height: parent.height
anchors.horizontalCenter: parent.horizontalCenter
- source: modelModel.get(root.pebble.model).image
+ source: Qt.resolvedUrl("qrc:///"+modelModel.get(root.pebble.model).image)
fillMode: Image.PreserveAspectFit
+ }
+ Item {
+ id: watchFace
+ height: parent.height * (modelModel.get(root.pebble.model - 1).shape === "rectangle" ? .5 : .515)
+ width: height * (modelModel.get(root.pebble.model - 1).shape === "rectangle" ? .85 : 1)
+ anchors.centerIn: parent
+ anchors.horizontalCenterOffset: units.dp(1)
+ anchors.verticalCenterOffset: units.dp(modelModel.get(root.pebble.model - 1).shape === "rectangle" ? 0 : 1)
+
+ Image {
+ id: image
+ anchors.fill: parent
+ source: "file://" + root.pebble.screenshots.latestScreenshot
+ visible: false
+ }
- Item {
- id: watchFace
- height: parent.height * (modelModel.get(root.pebble.model - 1).shape === "rectangle" ? .5 : .515)
- width: height * (modelModel.get(root.pebble.model - 1).shape === "rectangle" ? .85 : 1)
- anchors.centerIn: parent
- anchors.horizontalCenterOffset: units.dp(1)
- anchors.verticalCenterOffset: units.dp(modelModel.get(root.pebble.model - 1).shape === "rectangle" ? 0 : 1)
-
- Image {
- id: image
- anchors.fill: parent
- source: "file://" + root.pebble.screenshots.latestScreenshot
- visible: false
- }
-
- Component.onCompleted: {
- if (!root.pebble.screenshots.latestScreenshot) {
- root.pebble.requestScreenshot();
- }
+ Component.onCompleted: {
+ if (!root.pebble.screenshots.latestScreenshot) {
+ root.pebble.requestScreenshot();
}
+ }
- Rectangle {
- id: textItem
- anchors.fill: parent
- layer.enabled: true
- radius: modelModel.get(root.pebble.model - 1).shape === "rectangle" ? units.gu(.5) : height / 2
- // This item should be used as the 'mask'
- layer.samplerName: "maskSource"
- layer.effect: ShaderEffect {
- property var colorSource: image;
- fragmentShader: "
- uniform lowp sampler2D colorSource;
- uniform lowp sampler2D maskSource;
- uniform lowp float qt_Opacity;
- varying highp vec2 qt_TexCoord0;
- void main() {
- gl_FragColor =
- texture2D(colorSource, qt_TexCoord0)
- * texture2D(maskSource, qt_TexCoord0).a
- * qt_Opacity;
- }
- "
- }
+ Rectangle {
+ id: textItem
+ anchors.fill: parent
+ layer.enabled: true
+ radius: modelModel.get(root.pebble.model - 1).shape === "rectangle" ? units.gu(.5) : height / 2
+ // This item should be used as the 'mask'
+ layer.samplerName: "maskSource"
+ layer.effect: ShaderEffect {
+ property var colorSource: image;
+ fragmentShader: "
+ uniform lowp sampler2D colorSource;
+ uniform lowp sampler2D maskSource;
+ uniform lowp float qt_Opacity;
+ varying highp vec2 qt_TexCoord0;
+ void main() {
+ gl_FragColor =
+ texture2D(colorSource, qt_TexCoord0)
+ * texture2D(maskSource, qt_TexCoord0).a
+ * qt_Opacity;
+ }
+ "
}
}
}
}
- ColumnLayout {
- Layout.fillWidth: true
- Layout.fillHeight: true
+ Column {
+ width: root.width
spacing: units.gu(2)
Rectangle {
height: units.gu(10)
width: height
radius: height / 2
- color: root.pebble.connected ? UbuntuColors.green : UbuntuColors.red
+ color: root.pebble.connected ? "green" : "red"
- Icon {
+ IconButton {
anchors.fill: parent
anchors.margins: units.gu(2)
- color: "white"
- name: root.pebble.connected ? "tick" : "dialog-error-symbolic"
+ icon.source: root.pebble.connected ? "image://theme/icon-m-acknowledge" : "image://theme/icon-m-reset"
}
}
Label {
- text: root.pebble.connected ? i18n.tr("Connected") : i18n.tr("Disconnected")
- Layout.fillWidth: true
+ text: root.pebble.connected ? qsTr("Connected") : qsTr("Disconnected")
+ width: root.width
}
}
}
- }
- Column {
- Layout.fillWidth: true
- Layout.preferredHeight: childrenRect.height
- spacing: menuRepeater.count > 0 ? 0 : units.gu(2)
- Label {
- text: i18n.tr("Your Pebble smartwatch is disconnected. Please make sure it is powered on, within range and it is paired properly in the Bluetooth System Settings.")
- width: parent.width - units.gu(4)
- anchors.horizontalCenter: parent.horizontalCenter
- wrapMode: Text.WordWrap
- visible: !root.pebble.connected
- fontSize: "large"
- horizontalAlignment: Text.AlignHCenter
- }
-
- Button {
- text: i18n.tr("Open System Settings")
- visible: !root.pebble.connected
- onClicked: Qt.openUrlExternally("settings://system/bluetooth")
- color: UbuntuColors.orange
- anchors.horizontalCenter: parent.horizontalCenter
- }
+ Column {
+ width: root.width
+ //Layout.preferredHeight: childrenRect.height
+ spacing: menuRepeater.count > 0 ? 0 : units.gu(2)
+ Label {
+ text: qsTr("Your Pebble smartwatch is disconnected. Please make sure it is powered on, within range and it is paired properly in the Bluetooth System Settings.")
+ width: parent.width - units.gu(4)
+ anchors.horizontalCenter: parent.horizontalCenter
+ wrapMode: Text.WordWrap
+ visible: !root.pebble.connected
+ font.pixelSize: Theme.fontSizeLarge
+ horizontalAlignment: Text.AlignHCenter
+ }
- Label {
- text: i18n.tr("Your Pebble smartwatch is in factory mode and needs to be initialized.")
- width: parent.width - units.gu(4)
- anchors.horizontalCenter: parent.horizontalCenter
- wrapMode: Text.WordWrap
- visible: root.pebble.connected && root.pebble.recovery && !root.pebble.upgradingFirmware
- fontSize: "large"
- horizontalAlignment: Text.AlignHCenter
- }
- Button {
- text: i18n.tr("Initialize Pebble")
- onClicked: root.pebble.performFirmwareUpgrade();
- visible: root.pebble.connected && root.pebble.recovery && !root.pebble.upgradingFirmware
- color: UbuntuColors.orange
- anchors.horizontalCenter: parent.horizontalCenter
- }
+ Label {
+ text: qsTr("Your Pebble smartwatch is in factory mode and needs to be initialized.")
+ width: parent.width - units.gu(4)
+ anchors.horizontalCenter: parent.horizontalCenter
+ wrapMode: Text.WordWrap
+ visible: root.pebble.connected && root.pebble.recovery && !root.pebble.upgradingFirmware
+ font.pixelSize: Theme.fontSizeLarge
+ horizontalAlignment: Text.AlignHCenter
+ }
+ Button {
+ text: qsTr("Initialize Pebble")
+ onClicked: root.pebble.performFirmwareUpgrade();
+ visible: root.pebble.connected && root.pebble.recovery && !root.pebble.upgradingFirmware
+ color: "orange"
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
- Rectangle {
- id: upgradeIcon
- height: units.gu(10)
- width: height
- radius: width / 2
- color: UbuntuColors.orange
- anchors.horizontalCenter: parent.horizontalCenter
- Icon {
- anchors.fill: parent
- anchors.margins: units.gu(1)
- name: "preferences-system-updates-symbolic"
- color: "white"
+ Rectangle {
+ id: upgradeIcon
+ height: units.gu(10)
+ width: height
+ radius: width / 2
+ color: Theme.highlightColor
+ anchors.horizontalCenter: parent.horizontalCenter
+ BusyIndicator {
+ anchors.horizontalCenter: parent.horizontalCenter
+ running: upgradeInProgress
+ size: BusyIndicatorSize.Large
+ }
+ visible: root.pebble.connected && root.pebble.upgradingFirmware
}
- RotationAnimation on rotation {
- duration: 2000
- loops: Animation.Infinite
- from: 0
- to: 360
- running: upgradeIcon.visible
+ Label {
+ text: qsTr("Upgrading...")
+ font.pixelSize: Theme.fontSizeLarge
+ anchors.horizontalCenter: parent.horizontalCenter
+ visible: root.pebble.connected && root.pebble.upgradingFirmware
}
- visible: root.pebble.connected && root.pebble.upgradingFirmware
- }
- Label {
- text: i18n.tr("Upgrading...")
- fontSize: "large"
- anchors.horizontalCenter: parent.horizontalCenter
- visible: root.pebble.connected && root.pebble.upgradingFirmware
- }
+ Repeater {
+ id: menuRepeater
+ model: root.pebble.connected && !root.pebble.recovery && !root.pebble.upgradingFirmware ? mainMenuModel : null
+ delegate: ListItem {
+
+ Row {
+ anchors.fill: parent
+ anchors.margins: units.gu(1)
- Repeater {
- id: menuRepeater
- model: root.pebble.connected && !root.pebble.recovery && !root.pebble.upgradingFirmware ? mainMenuModel : null
- delegate: ListItem {
-
- RowLayout {
- anchors.fill: parent
- anchors.margins: units.gu(1)
-
- UbuntuShape {
- Layout.fillHeight: true
- Layout.preferredWidth: height
- backgroundColor: model.color
- Icon {
- anchors.fill: parent
- anchors.margins: units.gu(.5)
- name: model.icon
- color: "white"
+ Rectangle {
+ //Layout.fillHeight: true
+ //Layout.preferredWidth: height
+ //backgroundColor: model.color
+ Image {
+ anchors.fill: parent
+ anchors.margins: units.gu(.5)
+ source: model.icon
+ }
}
- }
- Label {
- text: model.text
- Layout.fillWidth: true
+ Label {
+ text: model.text
+ width: page.width
+ }
}
- }
- onClicked: {
- var options = {};
- options["pebble"] = root.pebble
- var modelItem = mainMenuModel.get(index)
- options["showWatchApps"] = modelItem.showWatchApps
- options["showWatchFaces"] = modelItem.showWatchFaces
- pageStack.push(Qt.resolvedUrl(model.page), options)
+ onClicked: {
+ var options = {};
+ options["pebble"] = root.pebble
+ var modelItem = mainMenuModel.get(index)
+ options["showWatchApps"] = modelItem.showWatchApps
+ options["showWatchFaces"] = modelItem.showWatchFaces
+ pageStack.push(Qt.resolvedUrl(model.page), options)
+ }
}
}
}
}
}
-
Connections {
target: pebble
onOpenURL: {