Skip to content
Open
Show file tree
Hide file tree
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
174 changes: 107 additions & 67 deletions Modules/ControlCenter/KeystonePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,66 +10,6 @@ Item {

property string currentSection: "overview"

component SearchSelectSettingRow: Item {
id: selectRow

property string title: ""
property string description: ""
property var options: []
property string value: ""
property string placeholder: ""
property int fieldWidth: 240

signal accepted(string value)

Layout.fillWidth: true
Layout.preferredHeight: Math.max(58, selectLabelColumn.implicitHeight + 16)

RowLayout {
anchors.fill: parent
spacing: 16

Column {
id: selectLabelColumn

Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
spacing: 3

Text {
width: parent.width
text: selectRow.title
color: Appearance.colors.colOnSurface
font.family: Fonts.ui
font.pixelSize: 15
font.weight: Font.Medium
elide: Text.ElideRight
}

Text {
width: parent.width
text: selectRow.description
color: Appearance.colors.colSubtext
font.family: Fonts.ui
font.pixelSize: 12
wrapMode: Text.WordWrap
}
}

SearchSelectMenuField {
Layout.preferredWidth: selectRow.fieldWidth
Layout.preferredHeight: 40
Layout.alignment: Qt.AlignVCenter
options: selectRow.options
value: selectRow.value
placeholder: selectRow.placeholder
textRole: "label"
valueRole: "value"
onAccepted: value => selectRow.accepted(value)
}
}
}

function openSection(section) {
root.currentSection = String(section || "overview");
}
Expand Down Expand Up @@ -120,7 +60,9 @@ Item {
options: PersonalizationConfig.keystoneStyles
value: PersonalizationConfig.keystoneStyle
placeholder: qsTr("选择钥石样式")
onAccepted: value => PersonalizationConfig.setKeystoneStyle(value)
onAccepted: (value) => {
return PersonalizationConfig.setKeystoneStyle(value);
}
}

SettingsRow {
Expand All @@ -129,10 +71,13 @@ Item {

trailing: EdgePositionSelector {
position: PersonalizationConfig.keystonePosition
onPositionSelected: position =>
PersonalizationConfig.setKeystonePosition(position)
onPositionSelected: (position) => {
return PersonalizationConfig.setKeystonePosition(position);
}
}

}

}

KeystoneSection {
Expand All @@ -141,8 +86,7 @@ Item {

Item {
Layout.fillWidth: true
Layout.preferredHeight: Math.max(
66, (width - 8) * 42 / 220 + 12)
Layout.preferredHeight: Math.max(66, (width - 8) * 42 / 220 + 12)

HorizontalClockPreview {
anchors.left: parent.left
Expand All @@ -154,6 +98,7 @@ Item {
anchors.topMargin: 6
anchors.bottomMargin: 6
}

}

SettingsRow {
Expand All @@ -165,6 +110,7 @@ Item {
Accessible.name: qsTr("隐藏日期")
onToggled: PersonalizationConfig.setKeystoneHideDate(checked)
}

}

SettingsActionRow {
Expand All @@ -175,13 +121,42 @@ Item {
trailingIconName: "chevron_right"
onClicked: root.openSection("horizontal-clock")
}

}

KeystoneSection {
title: qsTr("通知隐私")
iconName: "visibility_off"

SearchSelectSettingRow {
title: qsTr("锁屏通知")
description: qsTr("锁屏时通知内容的显示方式")
options: [{
"value": "show",
"label": qsTr("显示内容")
}, {
"value": "hide-content",
"label": qsTr("隐藏内容")
}, {
"value": "hide-all",
"label": qsTr("全部隐藏")
}]
value: UiPreferences.lockScreenNotificationPrivacy
placeholder: qsTr("选择显示方式")
onAccepted: (value) => {
return UiPreferences.setLockScreenNotificationPrivacy(value);
}
}

}

Item {
Layout.fillWidth: true
Layout.preferredHeight: 24
}

}

}

Loader {
Expand All @@ -192,7 +167,72 @@ Item {
anchors.top: subpageHeader.bottom
anchors.bottom: parent.bottom
visible: root.currentSection !== "overview"
source: root.currentSection === "horizontal-clock"
? Qt.resolvedUrl("HorizontalClockPage.qml") : ""
source: root.currentSection === "horizontal-clock" ? Qt.resolvedUrl("HorizontalClockPage.qml") : ""
}

component SearchSelectSettingRow: Item {
id: selectRow

property string title: ""
property string description: ""
property var options: []
property string value: ""
property string placeholder: ""
property int fieldWidth: 240

signal accepted(string value)

Layout.fillWidth: true
Layout.preferredHeight: Math.max(58, selectLabelColumn.implicitHeight + 16)

RowLayout {
anchors.fill: parent
spacing: 16

Column {
id: selectLabelColumn

Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
spacing: 3

Text {
width: parent.width
text: selectRow.title
color: Appearance.colors.colOnSurface
font.family: Fonts.ui
font.pixelSize: 15
font.weight: Font.Medium
elide: Text.ElideRight
}

Text {
width: parent.width
text: selectRow.description
color: Appearance.colors.colSubtext
font.family: Fonts.ui
font.pixelSize: 12
wrapMode: Text.WordWrap
}

}

SearchSelectMenuField {
Layout.preferredWidth: selectRow.fieldWidth
Layout.preferredHeight: 40
Layout.alignment: Qt.AlignVCenter
options: selectRow.options
value: selectRow.value
placeholder: selectRow.placeholder
textRole: "label"
valueRole: "value"
onAccepted: (value) => {
return selectRow.accepted(value);
}
}

}

}

}
Loading