Qt-Secret/Qt-Secret-GUI/EncryptDecryptPage.qml

68 lines
2.0 KiB
QML
Raw Normal View History

2019-07-21 13:34:42 +03:00
import QtQuick 2.0
import QtQuick.Controls 2.12
import QtQuick.Layouts 1.12
import "modules/"
2019-07-21 13:34:42 +03:00
Item {
id: parentItem
2019-07-30 21:55:17 +03:00
Connections {
target: appCore
function onQmlShowEncDecResult(message) {
outputText.setText(message)
}
2019-07-30 21:55:17 +03:00
}
ColumnLayout {
id: column
spacing: 20
anchors.fill: parent
anchors.leftMargin: 20
anchors.rightMargin: 20
2019-07-30 21:55:17 +03:00
function changeState() {
2019-08-07 19:53:43 +03:00
keyLabledText.labelText = (encryptDecryptMenu.state ? qsTr("Public key:") : qsTr("Private key:"))
inputText.labelText = (encryptDecryptMenu.state ? qsTr("Text to encrypt:") : qsTr("Text to decrypt:"))
outputText.labelText = (encryptDecryptMenu.state ? qsTr("Encrypted text:") : qsTr("Decrypted text:"))
}
2019-08-14 23:27:25 +03:00
DoubleStateMenu {
id: encryptDecryptMenu
2019-07-30 21:55:17 +03:00
verticalSize: 0.1
2019-08-07 19:53:43 +03:00
firstStateName: qsTr("Encrypt")
secondStateName: qsTr("Decrypt")
2019-07-30 21:55:17 +03:00
onChangeState: column.changeState()
2019-08-14 23:27:25 +03:00
onGetAction: appCore.getEncryptDecrypt(encryptDecryptMenu.state,
keyLabledText.textAreaText,
inputText.textAreaText)
}
2019-08-07 19:53:43 +03:00
RowElement {
id: keyLabledText
2019-08-14 23:27:25 +03:00
verticalSize: 0.3
2019-07-30 21:55:17 +03:00
labelText: qsTr("Public key:")
2019-08-07 19:53:43 +03:00
buttonImageSource: "../images/clear.png"
onButtonClicked: keyLabledText.setText("")
}
2019-08-07 19:53:43 +03:00
RowElement {
2019-07-30 21:55:17 +03:00
id: inputText
2019-08-14 23:27:25 +03:00
verticalSize: 0.3
2019-07-30 21:55:17 +03:00
labelText: qsTr("Text to encrypt:")
2019-08-07 19:53:43 +03:00
buttonImageSource: "../images/clear.png"
onButtonClicked: inputText.setText("")
2019-07-30 21:55:17 +03:00
}
RowElement {
id: outputText
2019-08-14 23:27:25 +03:00
verticalSize: 0.3
2019-07-30 21:55:17 +03:00
labelText: qsTr("Encrypted text:")
2019-08-07 19:53:43 +03:00
buttonImageSource: "../images/cpy.png"
2019-07-30 21:55:17 +03:00
onButtonClicked: appCore.copyToClipboard(outputText.textAreaText)
}
2019-08-23 12:07:31 +03:00
}
2019-07-21 13:34:42 +03:00
}