FluentUI/example/qml/window/FluentInitializrWindow.qml

114 lines
3.3 KiB
QML
Raw Normal View History

2024-03-09 15:35:48 +08:00
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import FluentUI 1.0
import Qt.labs.platform 1.1
import "../component"
2024-03-15 18:16:01 +08:00
FluWindowDialog {
2024-03-09 15:35:48 +08:00
id:window
2024-04-03 11:19:35 +08:00
title:qsTr("FluentUI Initializr")
2024-03-09 15:35:48 +08:00
width: 600
height: 400
2024-03-15 18:16:01 +08:00
contentDelegate:Component{
Item{
Connections{
2024-04-03 11:19:35 +08:00
target: InitializrHelper
2024-03-15 18:16:01 +08:00
function onError(message){
showError(message)
}
function onSuccess(path){
2024-04-23 00:31:20 +08:00
FluTools.showFileInFolder(path)
2024-03-15 18:16:01 +08:00
window.close()
2024-03-09 15:35:48 +08:00
}
}
2024-03-15 18:16:01 +08:00
FluText{
id:text_title
2024-04-03 11:19:35 +08:00
text:qsTr("FluentUI Initializr")
2024-03-15 18:16:01 +08:00
font: FluTextStyle.Title
anchors{
left: parent.left
top: parent.top
leftMargin: 20
topMargin: 20
}
}
2024-03-09 15:35:48 +08:00
2024-03-15 18:16:01 +08:00
Column{
spacing: 14
anchors{
left: parent.left
top: text_title.bottom
leftMargin: 20
topMargin: 20
}
FluTextBox{
id:text_box_name
width: 180
placeholderText: qsTr("Name")
focus: true
}
Row{
spacing: 8
FluTextBox{
id:text_box_path
width: 300
placeholderText: qsTr("Create In")
anchors.verticalCenter: parent.verticalCenter
}
FluButton{
text:qsTr("Browse")
anchors.verticalCenter: parent.verticalCenter
onClicked: {
folder_dialog.open()
}
}
}
2024-03-09 15:35:48 +08:00
}
2024-03-15 18:16:01 +08:00
FolderDialog{
id:folder_dialog
onAccepted: {
text_box_path.text = FluTools.toLocalPath(currentFolder)
2024-03-09 15:35:48 +08:00
}
}
2024-03-15 18:16:01 +08:00
Rectangle{
id:layout_actions
width: parent.width
height: 60
anchors.bottom: parent.bottom
color: FluTheme.backgroundColor
Row{
height: parent.height
spacing: 20
anchors{
right: parent.right
rightMargin: 20
}
FluButton{
text:qsTr("Cancel")
width: 120
anchors.verticalCenter: parent.verticalCenter
onClicked: {
window.close()
}
}
FluFilledButton{
text:qsTr("Create")
width: 120
anchors.verticalCenter: parent.verticalCenter
onClicked: {
2024-04-03 11:19:35 +08:00
InitializrHelper.generate(text_box_name.text,text_box_path.text)
2024-03-15 18:16:01 +08:00
}
}
2024-03-09 15:35:48 +08:00
}
}
}
}
2024-03-15 18:16:01 +08:00
2024-03-09 15:35:48 +08:00
}