Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add watchface settings page #87

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 38 additions & 21 deletions src/qml/WatchfaceSelector.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2022 - Timo Könnecke <github.com/eLtMosen>
* Copyright (C) 2023 - Arseniy Movshev <[email protected]>
* 2022 - Timo Könnecke <github.com/eLtMosen>
* 2022 - Darrel Griët <[email protected]>
* 2015 - Florent Revest <[email protected]>
*
Expand Down Expand Up @@ -108,7 +109,7 @@ Item {

z: 2
visible: !previewPng.previewExists
active: visible
active: visible || (watchface === folderModel.folder + "/" + fileName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This watchface === folderModel.folder + "/" + fileName is used quite extensively, maybe we should extract it into a bool property selected so it's easier to understand what it means.

anchors.centerIn: parent
width: Math.min(parent.width, parent.height)
height: width
Expand All @@ -118,7 +119,11 @@ Item {

MouseArea {
anchors.fill: parent
onClicked: watchface = folderModel.folder + "/" + fileName
onClicked: if ((watchface === folderModel.folder + "/" + fileName) && (typeof previewQml.item.settingsPage !== "undefined")) {
layerStack.push(previewQml.item.settingsPage)
} else {
watchface = folderModel.folder + "/" + fileName
}
}

Image {
Expand Down Expand Up @@ -151,28 +156,16 @@ Item {
}

Icon {
name: "ios-checkmark-circle"
name: "ios-settings-outline"

z: 100
width: parent.width * .3
width: parent.width*0.8
height: width
visible: watchface === folderModel.folder + "/" + fileName
anchors {
bottom: parent.bottom
bottomMargin: DeviceInfo.hasRoundScreen ?
-parent.height * .03 :
-parent.height * .08
horizontalCenter: parent.horizontalCenter
horizontalCenterOffset: index % 2 ?
DeviceInfo.hasRoundScreen ?
-parent.height * .45 :
-parent.height * .40 :
DeviceInfo.hasRoundScreen ?
parent.height * .45 :
parent.height * .40
}

visible: (watchface === folderModel.folder + "/" + fileName) && (typeof previewQml.item.settingsPage !== "undefined")
anchors.centerIn: parent
layer.enabled: visible
opacity: visible ? 0.4 : 0
Behavior on opacity { NumberAnimation { duration: 100 } }
layer.effect: DropShadow {
transparentBorder: true
horizontalOffset: 2
Expand All @@ -182,6 +175,30 @@ Item {
color: "#88000000"
}
}
Rectangle {
id: textContainer
anchors {
bottom: parent.bottom
left: parent.left
right: parent.right
margins: parent.width*0.05
}
radius: height*0.4
height: parent.height*0.17
color: "#000000"
opacity: 0.6
visible: watchface === folderModel.folder + "/" + fileName
Marquee {
text: fileName.replace(".qml","")
color: "#FFFFFF"
anchors {
fill: parent
leftMargin: parent.width*0.05
rightMargin: parent.width*0.05
}
font.pixelSize: parent.height*0.7
}
}
}
}
}
Expand Down