FluentUI/example/qml/page/T_Settings.qml

192 lines
5.4 KiB
QML
Raw Normal View History

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-09-12 18:45:15 +08:00
import "../global"
2023-04-10 18:17:22 +08:00
FluScrollablePage{
2024-03-09 15:35:48 +08:00
title: qsTr("Settings")
2023-04-10 18:17:22 +08:00
2023-09-11 18:10:50 +08:00
FluEvent{
name: "checkUpdateFinish"
onTriggered: {
btn_checkupdate.loading = false
}
}
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
2024-03-29 16:23:16 +08:00
Layout.preferredHeight: 60
padding: 10
2023-09-11 18:10:50 +08:00
Row{
spacing: 20
anchors.verticalCenter: parent.verticalCenter
FluText{
2024-03-09 15:35:48 +08:00
text: "%1 v%2".arg(qsTr("Current Version")).arg(AppInfo.version)
2023-09-11 18:10:50 +08:00
font: FluTextStyle.Body
anchors.verticalCenter: parent.verticalCenter
}
FluLoadingButton{
2024-03-09 15:35:48 +08:00
id: btn_checkupdate
text: qsTr("Check for Updates")
2023-09-11 18:10:50 +08:00
anchors.verticalCenter: parent.verticalCenter
onClicked: {
loading = true
FluEventBus.post("checkUpdate")
}
}
}
}
2023-11-23 19:58:54 +08:00
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 50
2024-03-29 16:23:16 +08:00
padding: 10
2023-11-23 19:58:54 +08:00
FluCheckBox{
2024-03-09 15:35:48 +08:00
text: qsTr("Use System AppBar")
2023-11-23 19:58:54 +08:00
checked: FluApp.useSystemAppBar
anchors.verticalCenter: parent.verticalCenter
onClicked: {
FluApp.useSystemAppBar = !FluApp.useSystemAppBar
2024-01-02 14:53:53 +08:00
dialog_restart.open()
2023-11-23 19:58:54 +08:00
}
}
}
2023-10-15 17:24:33 +08:00
2023-11-27 16:45:37 +08:00
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 50
2024-03-29 16:23:16 +08:00
padding: 10
2023-11-27 16:45:37 +08:00
FluCheckBox{
2024-03-09 15:35:48 +08:00
text:qsTr("Fits AppBar Windows")
2023-11-27 16:45:37 +08:00
checked: window.fitsAppBarWindows
anchors.verticalCenter: parent.verticalCenter
onClicked: {
window.fitsAppBarWindows = !window.fitsAppBarWindows
}
}
}
2023-09-17 20:36:33 +08:00
FluContentDialog{
2024-03-09 15:35:48 +08:00
id: dialog_restart
title: qsTr("Friendly Reminder")
message: qsTr("This action requires a restart of the program to take effect, is it restarted?")
2023-09-17 20:36:33 +08:00
buttonFlags: FluContentDialogType.NegativeButton | FluContentDialogType.PositiveButton
2024-03-09 15:35:48 +08:00
negativeText: qsTr("Cancel")
positiveText: qsTr("OK")
onPositiveClicked: {
2024-03-27 00:36:56 +08:00
FluRouter.exit(931)
2023-09-17 20:36:33 +08:00
}
}
2023-09-11 18:10:50 +08:00
2023-04-10 18:17:22 +08:00
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
2023-06-20 18:02:15 +08:00
height: 128
2024-03-29 16:23:16 +08:00
padding: 10
2023-04-10 18:17:22 +08:00
ColumnLayout{
2023-06-20 18:02:15 +08:00
spacing: 5
2023-04-10 18:17:22 +08:00
anchors{
2023-04-14 17:07:54 +08:00
top: parent.top
2023-04-10 18:17:22 +08:00
left: parent.left
}
FluText{
2024-03-09 15:35:48 +08:00
text: qsTr("Dark Mode")
2023-05-10 00:27:53 +08:00
font: FluTextStyle.BodyStrong
2023-04-10 18:17:22 +08:00
Layout.bottomMargin: 4
}
Repeater{
2024-03-09 15:35:48 +08:00
model: [{title:qsTr("System"),mode:FluThemeType.System},{title:qsTr("Light"),mode:FluThemeType.Light},{title:qsTr("Dark"),mode:FluThemeType.Dark}]
delegate: FluRadioButton{
2023-05-31 15:39:59 +08:00
checked : FluTheme.darkMode === modelData.mode
2023-04-10 18:17:22 +08:00
text:modelData.title
2023-05-31 15:39:59 +08:00
clickListener:function(){
2023-04-19 23:53:00 +08:00
FluTheme.darkMode = modelData.mode
2023-04-10 18:17:22 +08:00
}
}
}
}
}
2023-04-14 17:07:54 +08:00
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
2023-06-20 18:02:15 +08:00
height: 160
2024-03-29 16:23:16 +08:00
padding: 10
2023-04-14 17:07:54 +08:00
ColumnLayout{
2023-06-20 18:02:15 +08:00
spacing: 5
2023-04-14 17:07:54 +08:00
anchors{
top: parent.top
left: parent.left
}
FluText{
2024-03-09 15:35:48 +08:00
text:qsTr("Navigation View Display Mode")
2023-05-10 00:27:53 +08:00
font: FluTextStyle.BodyStrong
2023-04-14 17:07:54 +08:00
Layout.bottomMargin: 4
}
2023-04-19 23:53:00 +08:00
Repeater{
2024-03-09 15:35:48 +08:00
model: [{title:qsTr("Open"),mode:FluNavigationViewType.Open},{title:qsTr("Compact"),mode:FluNavigationViewType.Compact},{title:qsTr("Minimal"),mode:FluNavigationViewType.Minimal},{title:qsTr("Auto"),mode:FluNavigationViewType.Auto}]
2023-05-31 15:39:59 +08:00
delegate: FluRadioButton{
2024-03-27 00:36:56 +08:00
text: modelData.title
checked: GlobalModel.displayMode === modelData.mode
2023-05-31 15:39:59 +08:00
clickListener:function(){
2024-03-27 00:36:56 +08:00
GlobalModel.displayMode = modelData.mode
2023-04-14 17:07:54 +08:00
}
}
}
}
}
2024-03-09 15:35:48 +08:00
ListModel{
id:model_language
ListElement{
name:"en"
}
ListElement{
name:"zh"
}
}
FluArea{
Layout.fillWidth: true
Layout.topMargin: 20
height: 80
2024-03-29 16:23:16 +08:00
padding: 10
ColumnLayout{
spacing: 10
anchors{
top: parent.top
left: parent.left
}
FluText{
2024-03-09 15:35:48 +08:00
text:qsTr("Language")
2023-05-10 00:27:53 +08:00
font: FluTextStyle.BodyStrong
Layout.bottomMargin: 4
}
Flow{
spacing: 5
2023-04-19 23:53:00 +08:00
Repeater{
2024-03-09 15:35:48 +08:00
model: TranslateHelper.languages
2023-05-31 15:39:59 +08:00
delegate: FluRadioButton{
2024-03-09 15:35:48 +08:00
checked: TranslateHelper.current === modelData
2023-04-19 23:53:00 +08:00
text:modelData
2023-05-31 15:39:59 +08:00
clickListener:function(){
2024-03-09 15:35:48 +08:00
TranslateHelper.current = modelData
dialog_restart.open()
2023-04-19 23:53:00 +08:00
}
}
}
}
}
}
2023-04-10 18:17:22 +08:00
}