mirror of
https://github.com/monero-project/monero-gui.git
synced 2025-01-11 05:14:34 +00:00
Custom password dialog. fixes issue with standard dialog
This commit is contained in:
parent
6c6b10855f
commit
7973d0cbcc
3 changed files with 115 additions and 27 deletions
|
@ -31,37 +31,129 @@ import QtQuick.Controls 1.4
|
||||||
import QtQuick.Dialogs 1.2
|
import QtQuick.Dialogs 1.2
|
||||||
import QtQuick.Layouts 1.1
|
import QtQuick.Layouts 1.1
|
||||||
import QtQuick.Controls.Styles 1.4
|
import QtQuick.Controls.Styles 1.4
|
||||||
|
import QtQuick.Window 2.0
|
||||||
|
|
||||||
// import "../components"
|
import "../components" as MoneroComponents
|
||||||
|
|
||||||
Dialog {
|
Window {
|
||||||
id: root
|
id: root
|
||||||
|
modality: Qt.ApplicationModal
|
||||||
|
flags: Qt.Window | Qt.FramelessWindowHint
|
||||||
property alias password: passwordInput.text
|
property alias password: passwordInput.text
|
||||||
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
|
||||||
|
// same signals as Dialog has
|
||||||
|
signal accepted()
|
||||||
|
signal rejected()
|
||||||
|
|
||||||
|
|
||||||
|
function open() {
|
||||||
|
show()
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: implement without hardcoding sizes
|
||||||
|
width: 480
|
||||||
|
height: 200
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: column
|
id: mainLayout
|
||||||
anchors.fill: parent
|
spacing: 10
|
||||||
|
anchors { fill: parent; margins: 35 }
|
||||||
|
|
||||||
Label {
|
ColumnLayout {
|
||||||
text: qsTr("Please enter wallet password")
|
id: column
|
||||||
Layout.columnSpan: 2
|
//anchors {fill: parent; margins: 16 }
|
||||||
Layout.fillWidth: true
|
Layout.alignment: Qt.AlignHCenter
|
||||||
font.family: "Arial"
|
|
||||||
font.pixelSize: 32
|
Label {
|
||||||
|
text: qsTr("Please enter wallet password")
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
font.pixelSize: 24
|
||||||
|
font.family: "Arial"
|
||||||
|
color: "#555555"
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id : passwordInput
|
||||||
|
focus:true
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
horizontalAlignment: TextInput.AlignHCenter
|
||||||
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
font.family: "Arial"
|
||||||
|
font.pixelSize: 32
|
||||||
|
echoMode: TextInput.Password
|
||||||
|
style: TextFieldStyle {
|
||||||
|
renderType: Text.NativeRendering
|
||||||
|
textColor: "#35B05A"
|
||||||
|
passwordCharacter: "•"
|
||||||
|
// no background
|
||||||
|
background: Rectangle {
|
||||||
|
radius: 0
|
||||||
|
border.width: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// underline
|
||||||
|
Rectangle {
|
||||||
|
height: 1
|
||||||
|
color: "#DBDBDB"
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
anchors.bottomMargin: 3
|
||||||
|
|
||||||
|
}
|
||||||
|
// padding
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
height: 10
|
||||||
|
opacity: 0
|
||||||
|
color: "black"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// Ok/Cancel buttons
|
||||||
|
RowLayout {
|
||||||
|
id: buttons
|
||||||
|
spacing: 60
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
TextField {
|
MoneroComponents.StandardButton {
|
||||||
id : passwordInput
|
id: okButton
|
||||||
|
width: 120
|
||||||
|
fontSize: 14
|
||||||
|
shadowReleasedColor: "#FF4304"
|
||||||
|
shadowPressedColor: "#B32D00"
|
||||||
|
releasedColor: "#FF6C3C"
|
||||||
|
pressedColor: "#FF4304"
|
||||||
|
text: qsTr("Ok")
|
||||||
|
|
||||||
echoMode: TextInput.Password
|
onClicked: {
|
||||||
focus: true
|
accepted()
|
||||||
Layout.fillWidth: true
|
close()
|
||||||
font.family: "Arial"
|
}
|
||||||
font.pixelSize: 24
|
}
|
||||||
style: TextFieldStyle {
|
|
||||||
passwordCharacter: "•"
|
MoneroComponents.StandardButton {
|
||||||
|
id: cancelButton
|
||||||
|
width: 120
|
||||||
|
fontSize: 14
|
||||||
|
shadowReleasedColor: "#FF4304"
|
||||||
|
shadowPressedColor: "#B32D00"
|
||||||
|
releasedColor: "#FF6C3C"
|
||||||
|
pressedColor: "#FF4304"
|
||||||
|
text: qsTr("Cancel")
|
||||||
|
onClicked: {
|
||||||
|
rejected()
|
||||||
|
close()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
6
main.qml
6
main.qml
|
@ -495,7 +495,7 @@ ApplicationWindow {
|
||||||
|
|
||||||
PasswordDialog {
|
PasswordDialog {
|
||||||
id: passwordDialog
|
id: passwordDialog
|
||||||
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
appWindow.currentWallet = null
|
appWindow.currentWallet = null
|
||||||
appWindow.initialize();
|
appWindow.initialize();
|
||||||
|
@ -503,9 +503,7 @@ ApplicationWindow {
|
||||||
onRejected: {
|
onRejected: {
|
||||||
appWindow.enableUI(false)
|
appWindow.enableUI(false)
|
||||||
}
|
}
|
||||||
onDiscard: {
|
|
||||||
appWindow.enableUI(false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ Rectangle {
|
||||||
|
|
||||||
PasswordDialog {
|
PasswordDialog {
|
||||||
id: settingsPasswordDialog
|
id: settingsPasswordDialog
|
||||||
standardButtons: StandardButton.Ok + StandardButton.Cancel
|
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
if(appWindow.password === settingsPasswordDialog.password){
|
if(appWindow.password === settingsPasswordDialog.password){
|
||||||
memoTextInput.text = currentWallet.seed
|
memoTextInput.text = currentWallet.seed
|
||||||
|
@ -81,9 +81,7 @@ Rectangle {
|
||||||
onRejected: {
|
onRejected: {
|
||||||
|
|
||||||
}
|
}
|
||||||
onDiscard: {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue