2023-08-24 15:50:37 +08:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
|
|
|
import QtQuick.Window 2.15
|
|
|
|
import QtQuick.Controls 2.15
|
|
|
|
import FluentUI 1.0
|
2023-08-26 17:20:30 +08:00
|
|
|
import "../component"
|
2023-03-06 12:09:06 +08:00
|
|
|
|
2023-03-10 18:08:32 +08:00
|
|
|
FluScrollablePage{
|
|
|
|
|
2024-03-07 13:58:23 +08:00
|
|
|
property var colorData: [FluColors.Yellow,FluColors.Orange,FluColors.Red,FluColors.Magenta,FluColors.Purple,FluColors.Blue,FluColors.Teal,FluColors.Green]
|
2024-03-09 15:35:48 +08:00
|
|
|
id: root
|
|
|
|
title: qsTr("Theme")
|
2023-03-10 18:08:32 +08:00
|
|
|
|
2024-03-29 16:56:09 +08:00
|
|
|
FluFrame{
|
2023-04-06 17:32:21 +08:00
|
|
|
Layout.fillWidth: true
|
2024-08-21 16:12:35 +08:00
|
|
|
Layout.fillHeight: true
|
2024-03-29 16:23:16 +08:00
|
|
|
padding: 10
|
2024-03-07 13:58:23 +08:00
|
|
|
|
2023-04-06 17:32:21 +08:00
|
|
|
ColumnLayout{
|
|
|
|
spacing:0
|
|
|
|
anchors{
|
|
|
|
left: parent.left
|
|
|
|
}
|
2024-03-07 13:58:23 +08:00
|
|
|
FluText{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Theme colors")
|
2023-04-06 17:32:21 +08:00
|
|
|
Layout.topMargin: 10
|
2024-03-07 13:58:23 +08:00
|
|
|
}
|
|
|
|
RowLayout{
|
|
|
|
Layout.topMargin: 5
|
2023-04-06 17:32:21 +08:00
|
|
|
Repeater{
|
2024-03-07 13:58:23 +08:00
|
|
|
model: root.colorData
|
|
|
|
delegate: Rectangle{
|
2023-04-06 17:32:21 +08:00
|
|
|
width: 42
|
|
|
|
height: 42
|
2024-03-07 13:58:23 +08:00
|
|
|
radius: 4
|
2023-04-06 17:32:21 +08:00
|
|
|
color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal
|
2024-03-12 22:59:56 +08:00
|
|
|
border.color: modelData.darker
|
2023-04-06 17:32:21 +08:00
|
|
|
FluIcon {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
iconSource: FluentIcons.AcceptMedium
|
|
|
|
iconSize: 15
|
2024-03-07 13:58:23 +08:00
|
|
|
visible: modelData === FluTheme.accentColor
|
2023-04-06 17:32:21 +08:00
|
|
|
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
|
|
|
}
|
|
|
|
MouseArea{
|
|
|
|
id:mouse_item
|
|
|
|
anchors.fill: parent
|
|
|
|
hoverEnabled: true
|
|
|
|
onClicked: {
|
2024-03-07 13:58:23 +08:00
|
|
|
FluTheme.accentColor = modelData
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Row{
|
|
|
|
Layout.topMargin: 10
|
|
|
|
spacing: 10
|
|
|
|
FluText{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Customize the Theme Color")
|
2024-03-07 13:58:23 +08:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
}
|
|
|
|
FluColorPicker{
|
|
|
|
id:color_picker
|
|
|
|
current: FluTheme.accentColor.normal
|
|
|
|
onAccepted: {
|
|
|
|
FluTheme.accentColor = FluColors.createAccentColor(current)
|
|
|
|
}
|
|
|
|
FluIcon {
|
|
|
|
anchors.centerIn: parent
|
|
|
|
iconSource: FluentIcons.AcceptMedium
|
|
|
|
iconSize: 15
|
|
|
|
visible: {
|
|
|
|
for(var i =0 ;i< root.colorData.length; i++){
|
|
|
|
if(root.colorData[i] === FluTheme.accentColor){
|
|
|
|
return false
|
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
2024-03-07 13:58:23 +08:00
|
|
|
return true
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
2024-03-07 13:58:23 +08:00
|
|
|
color: FluTheme.dark ? Qt.rgba(0,0,0,1) : Qt.rgba(1,1,1,1)
|
2023-03-10 18:08:32 +08:00
|
|
|
}
|
2023-03-09 11:50:40 +08:00
|
|
|
}
|
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
FluText{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Dark Mode")
|
2023-04-06 17:32:21 +08:00
|
|
|
Layout.topMargin: 20
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
|
|
|
Layout.topMargin: 5
|
2023-05-26 13:49:32 +08:00
|
|
|
checked: FluTheme.dark
|
|
|
|
onClicked: {
|
2023-04-20 09:15:28 +08:00
|
|
|
if(FluTheme.dark){
|
2023-07-18 18:24:06 +08:00
|
|
|
FluTheme.darkMode = FluThemeType.Light
|
2023-04-20 09:15:28 +08:00
|
|
|
}else{
|
2023-07-18 18:24:06 +08:00
|
|
|
FluTheme.darkMode = FluThemeType.Dark
|
2023-04-20 09:15:28 +08:00
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
FluText{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Native Text")
|
2023-04-06 17:32:21 +08:00
|
|
|
Layout.topMargin: 20
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
|
|
|
Layout.topMargin: 5
|
2023-05-26 13:49:32 +08:00
|
|
|
checked: FluTheme.nativeText
|
|
|
|
onClicked: {
|
2023-04-06 17:32:21 +08:00
|
|
|
FluTheme.nativeText = !FluTheme.nativeText
|
|
|
|
}
|
|
|
|
}
|
2023-07-07 16:04:17 +08:00
|
|
|
FluText{
|
2024-03-09 15:35:48 +08:00
|
|
|
text: qsTr("Open Animation")
|
2023-07-07 16:04:17 +08:00
|
|
|
Layout.topMargin: 20
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
|
|
|
Layout.topMargin: 5
|
2024-03-29 16:23:16 +08:00
|
|
|
checked: FluTheme.animationEnabled
|
2023-07-07 16:04:17 +08:00
|
|
|
onClicked: {
|
2024-03-29 16:23:16 +08:00
|
|
|
FluTheme.animationEnabled = !FluTheme.animationEnabled
|
2023-07-07 16:04:17 +08:00
|
|
|
}
|
|
|
|
}
|
2024-04-12 16:26:32 +08:00
|
|
|
FluText{
|
|
|
|
text: qsTr("Open Blur Window")
|
|
|
|
Layout.topMargin: 20
|
|
|
|
}
|
|
|
|
FluToggleSwitch{
|
2024-08-21 16:12:35 +08:00
|
|
|
id: toggle_blur
|
2024-04-12 16:26:32 +08:00
|
|
|
Layout.topMargin: 5
|
|
|
|
checked: FluTheme.blurBehindWindowEnabled
|
|
|
|
onClicked: {
|
|
|
|
FluTheme.blurBehindWindowEnabled = !FluTheme.blurBehindWindowEnabled
|
|
|
|
}
|
|
|
|
}
|
2024-08-21 16:12:35 +08:00
|
|
|
FluText{
|
|
|
|
visible: FluTheme.blurBehindWindowEnabled || window.effect === "dwm-blur"
|
|
|
|
text: qsTr("window tintOpacity")
|
|
|
|
Layout.topMargin: 20
|
|
|
|
}
|
|
|
|
FluSlider{
|
|
|
|
visible: FluTheme.blurBehindWindowEnabled || window.effect === "dwm-blur"
|
|
|
|
Layout.topMargin: 5
|
|
|
|
to:1
|
|
|
|
stepSize:0.1
|
|
|
|
onValueChanged: {
|
|
|
|
window.tintOpacity = value
|
|
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
|
|
value = window.tintOpacity
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluText{
|
|
|
|
visible: FluTheme.blurBehindWindowEnabled
|
|
|
|
text: qsTr("window blurRadius")
|
|
|
|
Layout.topMargin: 20
|
|
|
|
}
|
|
|
|
FluSlider{
|
|
|
|
visible: FluTheme.blurBehindWindowEnabled
|
|
|
|
Layout.topMargin: 5
|
|
|
|
to:100
|
|
|
|
stepSize:1
|
|
|
|
onValueChanged: {
|
|
|
|
window.blurRadius = value
|
|
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
|
|
value = window.blurRadius
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluText{
|
|
|
|
text: qsTr("window effect")
|
|
|
|
Layout.topMargin: 20
|
|
|
|
}
|
|
|
|
Row{
|
|
|
|
spacing: 10
|
|
|
|
Repeater{
|
|
|
|
model: window.availableEffects
|
|
|
|
delegate: FluRadioButton{
|
|
|
|
checked: window.effect === modelData
|
|
|
|
text: qsTr(`${modelData}`)
|
|
|
|
clickListener:function(){
|
|
|
|
window.effect = modelData
|
|
|
|
if(window.effective){
|
|
|
|
FluTheme.blurBehindWindowEnabled = false
|
|
|
|
toggle_blur.checked = Qt.binding( function() {return FluTheme.blurBehindWindowEnabled})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2023-03-06 12:09:06 +08:00
|
|
|
}
|
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
CodeExpander{
|
|
|
|
Layout.fillWidth: true
|
2024-03-29 16:23:16 +08:00
|
|
|
Layout.topMargin: -6
|
2024-03-07 13:58:23 +08:00
|
|
|
code:'FluTheme.accentColor = FluColors.Orange
|
2023-04-06 17:32:21 +08:00
|
|
|
|
|
|
|
FluTheme.dark = true
|
|
|
|
|
2023-04-19 17:25:46 +08:00
|
|
|
FluTheme.nativeText = true'
|
2023-03-11 21:15:36 +08:00
|
|
|
}
|
2023-04-06 17:32:21 +08:00
|
|
|
|
|
|
|
|
2023-03-06 12:09:06 +08:00
|
|
|
}
|