2024-03-09 15:35:48 +08:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
|
|
|
import FluentUI
|
|
|
|
import Qt.labs.platform
|
|
|
|
import "../component"
|
|
|
|
|
|
|
|
FluWindow {
|
|
|
|
|
|
|
|
id:window
|
2024-03-09 18:26:54 +08:00
|
|
|
title:qsTr("FluentUI Initalizr")
|
2024-03-09 15:35:48 +08:00
|
|
|
width: 600
|
|
|
|
height: 400
|
|
|
|
fixSize: true
|
2024-03-11 00:02:11 +08:00
|
|
|
modality: Qt.ApplicationModal
|
2024-03-09 15:35:48 +08:00
|
|
|
launchMode: FluWindowType.SingleTask
|
|
|
|
showStayTop: false
|
|
|
|
|
|
|
|
Connections{
|
|
|
|
target: InitalizrHelper
|
|
|
|
function onError(message){
|
|
|
|
showError(message)
|
|
|
|
}
|
2024-03-11 00:02:11 +08:00
|
|
|
function onSuccess(path){
|
|
|
|
FluTools.showFileInFolder(path+"/CMakeLists.txt")
|
|
|
|
window.close()
|
2024-03-09 15:35:48 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FluText{
|
|
|
|
id:text_title
|
2024-03-09 18:26:54 +08:00
|
|
|
text:qsTr("FluentUI Initalizr")
|
2024-03-09 15:35:48 +08:00
|
|
|
font: FluTextStyle.Title
|
|
|
|
anchors{
|
|
|
|
left: parent.left
|
|
|
|
top: parent.top
|
|
|
|
leftMargin: 20
|
|
|
|
topMargin: 20
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Column{
|
|
|
|
spacing: 14
|
|
|
|
anchors{
|
|
|
|
left: parent.left
|
|
|
|
top: text_title.bottom
|
|
|
|
leftMargin: 20
|
|
|
|
topMargin: 20
|
|
|
|
}
|
|
|
|
FluTextBox{
|
|
|
|
id:text_box_name
|
|
|
|
width: 180
|
2024-03-09 18:26:54 +08:00
|
|
|
placeholderText: qsTr("Name")
|
2024-03-09 15:35:48 +08:00
|
|
|
focus: true
|
|
|
|
}
|
|
|
|
Row{
|
|
|
|
spacing: 8
|
|
|
|
FluTextBox{
|
|
|
|
id:text_box_path
|
|
|
|
width: 300
|
2024-03-09 18:26:54 +08:00
|
|
|
placeholderText: qsTr("Create In")
|
2024-03-09 15:35:48 +08:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
Component.onCompleted: {
|
|
|
|
text = FluTools.toLocalPath(StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0])
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluButton{
|
2024-03-09 18:26:54 +08:00
|
|
|
text:qsTr("Browse")
|
2024-03-09 15:35:48 +08:00
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
onClicked: {
|
|
|
|
folder_dialog.open()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FolderDialog{
|
|
|
|
id:folder_dialog
|
|
|
|
folder: StandardPaths.standardLocations(StandardPaths.DocumentsLocation)[0]
|
|
|
|
onAccepted: {
|
|
|
|
text_box_path.text = FluTools.toLocalPath(currentFolder)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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{
|
2024-03-09 18:26:54 +08:00
|
|
|
text:qsTr("Cancel")
|
2024-03-09 15:35:48 +08:00
|
|
|
width: 120
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
onClicked: {
|
|
|
|
window.close()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
FluFilledButton{
|
2024-03-09 18:26:54 +08:00
|
|
|
text:qsTr("Create")
|
2024-03-09 15:35:48 +08:00
|
|
|
width: 120
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
onClicked: {
|
|
|
|
InitalizrHelper.generate(text_box_name.text,text_box_path.text)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|