2024-08-24 22:35:35 +08:00
|
|
|
|
import QtQuick 2.15
|
|
|
|
|
import QtQuick.Controls 2.15
|
2024-08-30 14:47:03 +08:00
|
|
|
|
import QtQuick.Layouts 1.15
|
2024-08-21 09:26:06 +08:00
|
|
|
|
|
|
|
|
|
Dialog {
|
|
|
|
|
id: control
|
|
|
|
|
width: 320
|
2024-08-30 14:47:03 +08:00
|
|
|
|
padding: 30
|
2024-08-21 09:26:06 +08:00
|
|
|
|
parent: Overlay.overlay
|
|
|
|
|
anchors.centerIn: Overlay.overlay
|
|
|
|
|
modal: true
|
|
|
|
|
property alias titleText: titleLabel.text
|
|
|
|
|
property alias text: textLabel.text
|
|
|
|
|
property alias textFontSize: textLabel.font.pixelSize
|
|
|
|
|
property int type: MessageDialog.Type.Successful
|
2024-12-04 15:23:42 +08:00
|
|
|
|
property var callback
|
2024-08-21 09:26:06 +08:00
|
|
|
|
closePolicy: Popup.CloseOnEscap | Popup.NoAutoClose
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
radius: 8
|
|
|
|
|
}
|
|
|
|
|
enum Type {
|
|
|
|
|
Ok,
|
|
|
|
|
Successful,
|
|
|
|
|
Warning,
|
|
|
|
|
Failed
|
|
|
|
|
}
|
2024-08-30 14:47:03 +08:00
|
|
|
|
contentItem: ColumnLayout {
|
|
|
|
|
id: layout
|
|
|
|
|
IconButton {
|
|
|
|
|
Layout.leftMargin: 30
|
|
|
|
|
Layout.rightMargin: 6
|
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
source: "../resources/popup_close.svg"
|
|
|
|
|
onClicked: control.close()
|
|
|
|
|
}
|
|
|
|
|
RowLayout {
|
|
|
|
|
Layout.leftMargin: 30
|
|
|
|
|
Image {
|
|
|
|
|
id: image
|
|
|
|
|
Layout.rightMargin: 6
|
|
|
|
|
width: 18
|
|
|
|
|
height: 18
|
|
|
|
|
source: "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg"
|
|
|
|
|
}
|
|
|
|
|
Text {
|
|
|
|
|
id: titleLabel
|
|
|
|
|
font.family: control.font.family
|
|
|
|
|
font.pixelSize: 16
|
|
|
|
|
color: "#0A1F44"
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
Label {
|
|
|
|
|
id: textLabel
|
|
|
|
|
Layout.leftMargin: 30 + image.width+image.Layout.rightMargin+layout.spacing
|
|
|
|
|
Layout.maximumWidth: control.width-Layout.leftMargin-control.rightPadding-control.rightInset-50
|
|
|
|
|
font.family: control.font.family
|
|
|
|
|
font.pixelSize: 14
|
|
|
|
|
color: "#53627C"
|
|
|
|
|
horizontalAlignment: Text.AlignLeft
|
2024-08-21 09:26:06 +08:00
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
2024-08-30 14:47:03 +08:00
|
|
|
|
wrapMode: Text.WordWrap
|
2024-08-21 09:26:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-12-04 15:23:42 +08:00
|
|
|
|
Row {
|
2024-08-30 14:47:03 +08:00
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
Layout.rightMargin: 6
|
2024-12-04 15:23:42 +08:00
|
|
|
|
spacing: 10
|
|
|
|
|
Button {
|
|
|
|
|
id: okButton
|
|
|
|
|
width: 72
|
|
|
|
|
height: 40
|
|
|
|
|
font.family: control.font.family
|
|
|
|
|
text: "好的"
|
|
|
|
|
font.pixelSize: 14
|
|
|
|
|
contentItem: Text {
|
|
|
|
|
text: parent.text
|
|
|
|
|
font: parent.font
|
|
|
|
|
color: parent.down ? "#FFFFFF" : "#53627C"
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
}
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
border.color: "#E1E4E8"
|
|
|
|
|
border.width: 1
|
|
|
|
|
color: parent.down ? "#F25959" : "#FFFFFF"
|
|
|
|
|
radius: 2
|
|
|
|
|
}
|
|
|
|
|
onClicked: {
|
|
|
|
|
if(callback !== undefined){
|
|
|
|
|
callback()
|
|
|
|
|
}
|
|
|
|
|
control.accept()
|
|
|
|
|
}
|
2024-08-30 14:47:03 +08:00
|
|
|
|
}
|
2024-12-04 15:23:42 +08:00
|
|
|
|
Button {
|
|
|
|
|
id: cancelButton
|
|
|
|
|
visible: callback !== undefined
|
|
|
|
|
width: 72
|
|
|
|
|
height: 40
|
|
|
|
|
font.family: control.font.family
|
|
|
|
|
text: "取消"
|
|
|
|
|
font.pixelSize: 14
|
|
|
|
|
contentItem: Text {
|
|
|
|
|
text: parent.text
|
|
|
|
|
font: parent.font
|
|
|
|
|
color: parent.down ? "#FFFFFF" : "#53627C"
|
|
|
|
|
horizontalAlignment: Text.AlignHCenter
|
|
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
|
|
}
|
|
|
|
|
background: Rectangle {
|
|
|
|
|
border.color: "#E1E4E8"
|
|
|
|
|
border.width: 1
|
|
|
|
|
color: parent.down ? "#F25959" : "#FFFFFF"
|
|
|
|
|
radius: 2
|
|
|
|
|
}
|
|
|
|
|
onClicked: control.reject()
|
2024-08-30 14:47:03 +08:00
|
|
|
|
}
|
2024-08-21 09:26:06 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
onTypeChanged: {
|
|
|
|
|
if (type === MessageDialog.Type.Successful || type === MessageDialog.Type.Ok) {
|
|
|
|
|
image.source = "qrc:/qt/qml/AntiClipSettings/resources/successfull.svg"
|
|
|
|
|
} else if (type === MessageDialog.Type.Warning) {
|
|
|
|
|
image.source = "qrc:/qt/qml/AntiClipSettings/resources/warning.svg"
|
2024-08-30 14:47:03 +08:00
|
|
|
|
} else if (type === MessageDialog.Type.Failed) {
|
2024-08-22 10:48:28 +08:00
|
|
|
|
image.source = "qrc:/qt/qml/AntiClipSettings/resources/prompt_delete.svg"
|
2024-08-21 09:26:06 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|