2023-11-30 18:28:55 +00:00
|
|
|
// Copyright (C) 2023 The Qt Company Ltd.
|
2022-05-13 13:12:05 +00:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
pragma ComponentBehavior: Bound
|
|
|
|
|
2020-03-26 16:01:51 +00:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls as QQC2
|
2023-05-11 02:27:08 +00:00
|
|
|
import WearableStyle
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [LauncherPage start]
|
2017-03-13 08:58:39 +00:00
|
|
|
PathView {
|
|
|
|
id: circularView
|
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
signal launched(string title, string page, string fallbackpage)
|
|
|
|
//! [LauncherPage start]
|
2017-03-13 08:58:39 +00:00
|
|
|
|
|
|
|
readonly property int cX: width / 2
|
|
|
|
readonly property int cY: height / 2
|
|
|
|
readonly property int size: Math.min(width - 80, height)
|
2023-11-30 18:28:55 +00:00
|
|
|
readonly property int itemSize: size / 5
|
|
|
|
readonly property int radius: size / 2 - itemSize / 4
|
2017-03-13 08:58:39 +00:00
|
|
|
|
|
|
|
snapMode: PathView.SnapToItem
|
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Model start]
|
2017-03-13 08:58:39 +00:00
|
|
|
model: ListModel {
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Model start]
|
2017-03-13 08:58:39 +00:00
|
|
|
ListElement {
|
|
|
|
title: qsTr("World Clock")
|
2023-11-30 18:28:55 +00:00
|
|
|
pageIcon: "clock"
|
2023-05-11 02:27:08 +00:00
|
|
|
page: "WorldClockPage.qml"
|
2023-11-30 18:28:55 +00:00
|
|
|
fallback: ""
|
2017-03-13 08:58:39 +00:00
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Model mid]
|
2017-03-13 08:58:39 +00:00
|
|
|
ListElement {
|
|
|
|
title: qsTr("Navigation")
|
2023-11-30 18:28:55 +00:00
|
|
|
pageIcon: "maps"
|
2023-05-11 02:27:08 +00:00
|
|
|
page: "NavigationPage.qml"
|
2023-11-30 18:28:55 +00:00
|
|
|
fallback: "NavigationFallbackPage.qml"
|
2017-03-13 08:58:39 +00:00
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Model mid]
|
2017-03-13 08:58:39 +00:00
|
|
|
ListElement {
|
|
|
|
title: qsTr("Weather")
|
2023-11-30 18:28:55 +00:00
|
|
|
pageIcon: "weather"
|
2023-05-11 02:27:08 +00:00
|
|
|
page: "WeatherPage.qml"
|
2023-11-30 18:28:55 +00:00
|
|
|
fallback: "WeatherPage.qml"
|
2017-03-13 08:58:39 +00:00
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
title: qsTr("Fitness")
|
2023-11-30 18:28:55 +00:00
|
|
|
pageIcon: "hearth"
|
2023-05-11 02:27:08 +00:00
|
|
|
page: "FitnessPage.qml"
|
2023-11-30 18:28:55 +00:00
|
|
|
fallback: ""
|
2017-03-13 08:58:39 +00:00
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
title: qsTr("Notifications")
|
2023-11-30 18:28:55 +00:00
|
|
|
pageIcon: "notification"
|
2023-05-11 02:27:08 +00:00
|
|
|
page: "NotificationsPage.qml"
|
2023-11-30 18:28:55 +00:00
|
|
|
fallback: ""
|
2017-03-13 08:58:39 +00:00
|
|
|
}
|
|
|
|
ListElement {
|
|
|
|
title: qsTr("Alarm")
|
2023-11-30 18:28:55 +00:00
|
|
|
pageIcon: "bell"
|
2023-05-11 02:27:08 +00:00
|
|
|
page: "AlarmsPage.qml"
|
2023-11-30 18:28:55 +00:00
|
|
|
fallback: ""
|
2017-03-13 08:58:39 +00:00
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Model end]
|
2017-03-13 08:58:39 +00:00
|
|
|
ListElement {
|
|
|
|
title: qsTr("Settings")
|
2023-11-30 18:28:55 +00:00
|
|
|
pageIcon: "settings"
|
2023-05-11 02:27:08 +00:00
|
|
|
page: "SettingsPage.qml"
|
2023-11-30 18:28:55 +00:00
|
|
|
fallback: ""
|
2017-03-13 08:58:39 +00:00
|
|
|
}
|
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Model end]
|
2017-03-13 08:58:39 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Delegate start]
|
2017-09-15 14:25:40 +00:00
|
|
|
delegate: QQC2.RoundButton {
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Delegate start]
|
2017-03-24 12:19:47 +00:00
|
|
|
width: circularView.itemSize
|
|
|
|
height: circularView.itemSize
|
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
required property string title
|
|
|
|
required property string pageIcon
|
|
|
|
required property string page
|
|
|
|
required property string fallback
|
|
|
|
required property int index
|
2017-09-15 14:25:40 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Delegate mid]
|
2017-09-15 14:25:40 +00:00
|
|
|
icon.width: 36
|
|
|
|
icon.height: 36
|
2023-11-30 18:28:55 +00:00
|
|
|
icon.source: UIStyle.iconPath(pageIcon)
|
|
|
|
icon.color: UIStyle.textColor
|
|
|
|
//! [Delegate mid]
|
2017-03-24 12:19:47 +00:00
|
|
|
padding: 12
|
2016-12-17 03:20:45 +00:00
|
|
|
|
2017-03-13 08:58:39 +00:00
|
|
|
background: Rectangle {
|
|
|
|
radius: width / 2
|
2023-11-30 18:28:55 +00:00
|
|
|
color: parent.PathView.isCurrentItem ? UIStyle.highlightColor : UIStyle.buttonBackground
|
|
|
|
border.width: 1
|
|
|
|
border.color: UIStyle.buttonGrayOutLine
|
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
radius: parent.radius
|
|
|
|
anchors.fill: parent
|
|
|
|
gradient: Gradient {
|
|
|
|
GradientStop {
|
|
|
|
position: 0.0
|
|
|
|
color: UIStyle.gradientOverlay1
|
|
|
|
}
|
|
|
|
GradientStop {
|
|
|
|
position: 1.0
|
|
|
|
color: UIStyle.gradientOverlay2
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//! [Delegate end]
|
2017-03-13 08:58:39 +00:00
|
|
|
onClicked: {
|
|
|
|
if (PathView.isCurrentItem)
|
2023-11-30 18:28:55 +00:00
|
|
|
circularView.launched(title, Qt.resolvedUrl(page), Qt.resolvedUrl(fallback))
|
2017-03-13 08:58:39 +00:00
|
|
|
else
|
|
|
|
circularView.currentIndex = index
|
|
|
|
}
|
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [Delegate end]
|
2017-03-13 08:58:39 +00:00
|
|
|
|
|
|
|
path: Path {
|
|
|
|
startX: circularView.cX
|
|
|
|
startY: circularView.cY
|
|
|
|
PathAttribute {
|
|
|
|
name: "itemOpacity"
|
|
|
|
value: 1.0
|
|
|
|
}
|
|
|
|
PathLine {
|
|
|
|
x: circularView.cX + circularView.radius
|
|
|
|
y: circularView.cY
|
|
|
|
}
|
|
|
|
PathAttribute {
|
|
|
|
name: "itemOpacity"
|
|
|
|
value: 0.7
|
|
|
|
}
|
|
|
|
PathArc {
|
|
|
|
x: circularView.cX - circularView.radius
|
|
|
|
y: circularView.cY
|
|
|
|
radiusX: circularView.radius
|
|
|
|
radiusY: circularView.radius
|
|
|
|
useLargeArc: true
|
|
|
|
direction: PathArc.Clockwise
|
|
|
|
}
|
|
|
|
PathAttribute {
|
|
|
|
name: "itemOpacity"
|
|
|
|
value: 0.5
|
|
|
|
}
|
|
|
|
PathArc {
|
|
|
|
x: circularView.cX + circularView.radius
|
|
|
|
y: circularView.cY
|
|
|
|
radiusX: circularView.radius
|
|
|
|
radiusY: circularView.radius
|
|
|
|
useLargeArc: true
|
|
|
|
direction: PathArc.Clockwise
|
|
|
|
}
|
|
|
|
PathAttribute {
|
|
|
|
name: "itemOpacity"
|
|
|
|
value: 0.3
|
2016-12-17 03:20:45 +00:00
|
|
|
}
|
|
|
|
}
|
2017-03-13 08:39:14 +00:00
|
|
|
|
|
|
|
Text {
|
|
|
|
id: appTitle
|
|
|
|
|
|
|
|
property Item currentItem: circularView.currentItem
|
|
|
|
|
|
|
|
visible: currentItem ? currentItem.PathView.itemOpacity === 1.0 : 0
|
|
|
|
|
2017-09-15 14:25:40 +00:00
|
|
|
text: currentItem ? currentItem.title : ""
|
2017-03-13 08:39:14 +00:00
|
|
|
anchors.centerIn: parent
|
2023-11-30 18:28:55 +00:00
|
|
|
anchors.verticalCenterOffset: circularView.itemSize / 2 + height / 2
|
2017-03-13 08:39:14 +00:00
|
|
|
|
2023-11-30 18:28:55 +00:00
|
|
|
font: UIStyle.h1
|
|
|
|
color: UIStyle.textColor
|
2017-03-13 08:39:14 +00:00
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [LauncherPage end]
|
2016-12-17 03:20:45 +00:00
|
|
|
}
|
2023-11-30 18:28:55 +00:00
|
|
|
//! [LauncherPage end]
|