Redesigned shared ringdb panel

This commit is contained in:
Sander Ferdinand 2018-04-22 20:07:31 +02:00
parent 72541b6d51
commit c13b4cb7bd
4 changed files with 214 additions and 188 deletions

View file

@ -129,7 +129,7 @@ Rectangle {
}, State { }, State {
name: "SharedRingDB" name: "SharedRingDB"
PropertyChanges { target: root; currentView: sharedringdbView } PropertyChanges { target: root; currentView: sharedringdbView }
PropertyChanges { target: mainFlickable; contentHeight: minHeight } PropertyChanges { target: mainFlickable; contentHeight: sharedringdbView.panelHeight + 100 }
}, State { }, State {
name: "AddressBook" name: "AddressBook"
PropertyChanges { target: root; currentView: addressBookView } PropertyChanges { target: root; currentView: addressBookView }

View file

@ -32,7 +32,7 @@ import "../components" as MoneroComponents
Label { Label {
id: item id: item
fontSize: 17 * scaleRatio fontSize: 18 * scaleRatio
Rectangle { Rectangle {
anchors.top: item.bottom anchors.top: item.bottom

View file

@ -36,7 +36,7 @@ import "../components"
import moneroComponents.Clipboard 1.0 import moneroComponents.Clipboard 1.0
Rectangle { Rectangle {
property alias panelHeight: mainLayout.height
color: "transparent" color: "transparent"
Clipboard { id: clipboard } Clipboard { id: clipboard }
@ -70,37 +70,44 @@ Rectangle {
/* main layout */ /* main layout */
ColumnLayout { ColumnLayout {
id: mainLayout id: mainLayout
anchors.margins: 40 anchors.margins: (isMobile)? 17 : 20
anchors.topMargin: 40 * scaleRatio
anchors.left: parent.left anchors.left: parent.left
anchors.top: parent.top anchors.top: parent.top
anchors.right: parent.right anchors.right: parent.right
spacing: 20 spacing: 20 * scaleRatio
property int labelWidth: 120 property int labelWidth: 120
property int editWidth: 400 property int editWidth: 400
property int lineEditFontSize: 12 property int lineEditFontSize: 14 * scaleRatio
MessageDialog { MessageDialog {
id: sharedRingDBDialog id: sharedRingDBDialog
standardButtons: StandardButton.Ok standardButtons: StandardButton.Ok
} }
Text { Label {
text: qsTr("This page allows you to interact with the shared ring database.<br>" + id: signTitleLabel
"This database is meant for use by Monero wallets as well as wallets from Monero clones which reuse the Monero keys.") + translationManager.emptyString fontSize: 24 * scaleRatio
wrapMode: Text.Wrap text: qsTr("Shared RingDB") + translationManager.emptyString
Layout.fillWidth: true;
color: Style.defaultFontColor
} }
Text { Text {
text: qsTr("This page allows you to interact with the shared ring database. " +
"This database is meant for use by Monero wallets as well as wallets from Monero clones which reuse the Monero keys.") + translationManager.emptyString
wrapMode: Text.Wrap
Layout.fillWidth: true
font.family: Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
color: Style.defaultFontColor
}
LabelSubheader {
Layout.fillWidth: true
textFormat: Text.RichText textFormat: Text.RichText
text: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style>" + text: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style>" +
"<font size='+2'>" + qsTr("Blackballed outputs") + "</font>" + "<font size='2'> (</font><a href='#'>" + qsTr("help") + "</a><font size='2'>)</font><br>" + qsTr("Blackballed outputs") + " (<a href='#'>" + qsTr("help") + "</a>)" + translationManager.emptyString
qsTr("This sets which outputs are known to be spent, and thus not to be used as privacy placeholders in ring signatures.<br>") +
qsTr("You should only have to load a file when you want to refresh the list. Manual adding/removing is possible if needed.") + translationManager.emptyString
wrapMode: Text.Wrap
Layout.fillWidth: true;
onLinkActivated: { onLinkActivated: {
sharedRingDBDialog.title = qsTr("Blackballed outputs") + translationManager.emptyString; sharedRingDBDialog.title = qsTr("Blackballed outputs") + translationManager.emptyString;
sharedRingDBDialog.text = qsTr( sharedRingDBDialog.text = qsTr(
@ -118,14 +125,22 @@ Rectangle {
sharedRingDBDialog.icon = StandardIcon.Information sharedRingDBDialog.icon = StandardIcon.Information
sharedRingDBDialog.open() sharedRingDBDialog.open()
} }
}
Text {
textFormat: Text.RichText
font.family: Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
text: qsTr("This sets which outputs are known to be spent, and thus not to be used as privacy placeholders in ring signatures. ") +
qsTr("You should only have to load a file when you want to refresh the list. Manual adding/removing is possible if needed.") + translationManager.emptyString
wrapMode: Text.Wrap
Layout.fillWidth: true;
color: Style.defaultFontColor color: Style.defaultFontColor
} }
RowLayout { ColumnLayout {
id: loadBlackballFileRow Layout.fillWidth: true
anchors.topMargin: 17 Layout.topMargin: 12
anchors.left: parent.left
anchors.right: parent.right
FileDialog { FileDialog {
id: loadBlackballFileDialog id: loadBlackballFileDialog
@ -138,95 +153,93 @@ Rectangle {
} }
} }
StandardButton { RowLayout {
id: selectBlackballFileButton
anchors.rightMargin: 17 * scaleRatio
text: qsTr("Select") + translationManager.emptyString
enabled: true
small: true
onClicked: {
loadBlackballFileDialog.open()
}
}
LineEdit {
id: loadBlackballFileLine
anchors.left: selectBlackballFileButton.right
anchors.right: loadBlackballFileButton.left
placeholderText: qsTr("Filename with outputs to blackball") + translationManager.emptyString;
readOnly: false
Layout.fillWidth: true Layout.fillWidth: true
IconButton { LineEdit {
imageSource: "../images/copyToClipboard.png" id: loadBlackballFileLine
onClicked: { Layout.fillWidth: true
if (loadBlackballFileLine.text.length > 0) { fontSize: mainLayout.lineEditFontSize
clipboard.setText(loadBlackballFileLine.text) placeholderText: qsTr("Path to file") + "..." + translationManager.emptyString
} labelFontSize: 14 * scaleRatio
} labelText: qsTr("Filename with outputs to blackball") + ":" + translationManager.emptyString
copyButton: true
readOnly: false
} }
} }
StandardButton { RowLayout {
id: loadBlackballFileButton
anchors.right: parent.right
text: qsTr("Load") + translationManager.emptyString
small: true
enabled: !!appWindow.currentWallet
onClicked: appWindow.currentWallet.blackballOutputs(walletManager.urlToLocalPath(loadBlackballFileDialog.fileUrl), true)
}
}
Label {
fontSize: 14
text: qsTr("Or manually blackball or unblackball a single output:") + translationManager.emptyString
width: mainLayout.labelWidth
}
RowLayout {
LineEdit {
id: blackballOutputLine
fontSize: mainLayout.lineEditFontSize
placeholderText: qsTr("Paste output public key") + translationManager.emptyString
readOnly: false
width: mainLayout.editWidth
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 18
IconButton { StandardButton {
imageSource: "../images/copyToClipboard.png" id: selectBlackballFileButton
anchors.rightMargin: 17 * scaleRatio
text: qsTr("Browse") + translationManager.emptyString
enabled: true
small: true
onClicked: { onClicked: {
if (blackballOutputLine.text.length > 0) { loadBlackballFileDialog.open()
clipboard.setText(blackballOutputLine.text)
}
} }
} }
}
StandardButton { StandardButton {
id: blackballButton id: loadBlackballFileButton
text: qsTr("Blackball") + translationManager.emptyString anchors.right: parent.right
small: true text: qsTr("Load") + translationManager.emptyString
enabled: !!appWindow.currentWallet && validHex32(blackballOutputLine.text) small: true
onClicked: appWindow.currentWallet.blackballOutput(blackballOutputLine.text) enabled: !!appWindow.currentWallet && loadBlackballFileLine.text !== ""
} onClicked: appWindow.currentWallet.blackballOutputs(walletManager.urlToLocalPath(loadBlackballFileDialog.fileUrl), true)
}
StandardButton {
id: unblackballButton
anchors.right: parent.right
text: qsTr("Unblackball") + translationManager.emptyString
small: true
enabled: !!appWindow.currentWallet && validHex32(blackballOutputLine.text)
onClicked: appWindow.currentWallet.unblackballOutput(blackballOutputLine.text)
} }
} }
Text { ColumnLayout {
Layout.topMargin: 12
RowLayout {
LineEdit {
id: blackballOutputLine
fontSize: mainLayout.lineEditFontSize
labelFontSize: 14 * scaleRatio
labelText: qsTr("Or manually blackball/unblackball a single output:") + translationManager.emptyString
placeholderText: qsTr("Paste output public key") + "..." + translationManager.emptyString
readOnly: false
copyButton: true
width: mainLayout.editWidth
Layout.fillWidth: true
}
}
RowLayout {
Layout.fillWidth: true
Layout.topMargin: 18
StandardButton {
id: blackballButton
text: qsTr("Blackball") + translationManager.emptyString
small: true
enabled: !!appWindow.currentWallet && validHex32(blackballOutputLine.text)
onClicked: appWindow.currentWallet.blackballOutput(blackballOutputLine.text)
}
StandardButton {
id: unblackballButton
anchors.right: parent.right
text: qsTr("Unblackball") + translationManager.emptyString
small: true
enabled: !!appWindow.currentWallet && validHex32(blackballOutputLine.text)
onClicked: appWindow.currentWallet.unblackballOutput(blackballOutputLine.text)
}
}
}
LabelSubheader {
Layout.fillWidth: true
Layout.topMargin: 24 * scaleRatio
textFormat: Text.RichText textFormat: Text.RichText
text: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style>" + text: "<style type='text/css'>a {text-decoration: none; color: #FF6C3C; font-size: 14px;}</style>" +
"<font size='+2'>" + qsTr("Rings") + "</font>" + "<font size='2'> (</font><a href='#'>" + qsTr("help") + "</a><font size='2'>)</font><br>" + qsTr("Rings") + " (<a href='#'>" + qsTr("help") + "</a>)" + translationManager.emptyString
qsTr("This records rings used by outputs spent on Monero on a key reusing chain, so that the same ring may be reused to avoid privacy issues.") + translationManager.emptyString
wrapMode: Text.Wrap
Layout.fillWidth: true;
onLinkActivated: { onLinkActivated: {
sharedRingDBDialog.title = qsTr("Rings") + translationManager.emptyString; sharedRingDBDialog.title = qsTr("Rings") + translationManager.emptyString;
sharedRingDBDialog.text = qsTr( sharedRingDBDialog.text = qsTr(
@ -245,6 +258,15 @@ Rectangle {
sharedRingDBDialog.icon = StandardIcon.Information sharedRingDBDialog.icon = StandardIcon.Information
sharedRingDBDialog.open() sharedRingDBDialog.open()
} }
}
Text {
textFormat: Text.RichText
font.family: Style.fontRegular.name
font.pixelSize: 14 * scaleRatio
text: qsTr("This records rings used by outputs spent on Monero on a key reusing chain, so that the same ring may be reused to avoid privacy issues.") + translationManager.emptyString
wrapMode: Text.Wrap
Layout.fillWidth: true;
color: Style.defaultFontColor color: Style.defaultFontColor
} }
@ -252,60 +274,118 @@ Rectangle {
LineEdit { LineEdit {
id: keyImageLine id: keyImageLine
fontSize: mainLayout.lineEditFontSize fontSize: mainLayout.lineEditFontSize
placeholderText: qsTr("Paste key image") + translationManager.emptyString labelFontSize: 14 * scaleRatio
labelText: qsTr("Key image") + ":" + translationManager.emptyString
placeholderText: qsTr("Paste key image") + "..." + translationManager.emptyString
readOnly: false readOnly: false
copyButton: true
width: mainLayout.editWidth width: mainLayout.editWidth
Layout.fillWidth: true Layout.fillWidth: true
}
}
IconButton { GridLayout{
imageSource: "../images/copyToClipboard.png" Layout.topMargin: 12 * scaleRatio
onClicked: { columns: (isMobile) ? 1 : 2
if (keyImageLine.text.length > 0) { columnSpacing: 32 * scaleRatio
clipboard.setText(keyImageLine.text)
ColumnLayout {
RowLayout {
LineEdit {
id: getRingLine
Layout.fillWidth: true
fontSize: mainLayout.lineEditFontSize
labelFontSize: 14 * scaleRatio
labelText: qsTr("Get ring") + ":" + translationManager.emptyString
readOnly: true
copyButton: true
}
}
RowLayout {
Layout.fillWidth: true
Layout.topMargin: 18
StandardButton {
id: getRingButton
text: qsTr("Get Ring") + translationManager.emptyString
small: true
enabled: !!appWindow.currentWallet && validHex32(keyImageLine.text)
onClicked: {
var ring = appWindow.currentWallet.getRing(keyImageLine.text)
if (ring === "") {
getRingLine.text = qsTr("No ring found");
}
else {
getRingLine.text = ring;
}
}
}
}
}
ColumnLayout {
RowLayout {
LineEdit {
id: setRingLine
Layout.fillWidth: true
fontSize: mainLayout.lineEditFontSize
labelFontSize: 14 * scaleRatio
labelText: qsTr("Set ring") + ":" + translationManager.emptyString
readOnly: false
copyButton: true
}
}
RowLayout {
Layout.fillWidth: true
Layout.topMargin: 18
StandardButton {
id: setRingButton
text: qsTr("Set Ring") + translationManager.emptyString
small: true
enabled: !!appWindow.currentWallet && validHex32(keyImageLine.text) && validRing(setRingLine.text.trim(), setRingRelative.checked)
onClicked: {
var outs = setRingLine.text.trim()
appWindow.currentWallet.setRing(keyImageLine.text, outs, setRingRelative.checked)
} }
} }
} }
} }
} }
RowLayout { GridLayout {
StandardButton { columns: (isMobile) ? 1 : 2
id: getRingButton
text: qsTr("Get Ring") + translationManager.emptyString CheckBox {
small: true id: segregatePreForkOutputs
enabled: !!appWindow.currentWallet && validHex32(keyImageLine.text) checked: persistentSettings.segregatePreForkOutputs
text: qsTr("I intend to spend on key-reusing fork(s)") + translationManager.emptyString
checkedIcon: "../images/checkedIcon-black.png"
uncheckedIcon: "../images/uncheckedIcon.png"
onClicked: { onClicked: {
var ring = appWindow.currentWallet.getRing(keyImageLine.text) persistentSettings.segregatePreForkOutputs = segregatePreForkOutputs.checked
if (ring === "") if (appWindow.currentWallet) {
{ appWindow.currentWallet.segregatePreForkOutputs(segregatePreForkOutputs.checked)
getRingLine.text = qsTr("No ring found");
}
else
{
getRingLine.text = ring;
} }
} }
} }
LineEdit {
id: getRingLine
fontSize: mainLayout.lineEditFontSize
placeholderText: qsTr("") + translationManager.emptyString
readOnly: true
width: mainLayout.editWidth
Layout.fillWidth: true
IconButton { CheckBox {
imageSource: "../images/copyToClipboard.png" id: keyReuseMitigation2
onClicked: { checked: persistentSettings.keyReuseMitigation2
if (getRingLine.text.length > 0) { text: qsTr("I might want to spend on key-reusing fork(s)") + translationManager.emptyString
clipboard.setText(getRingLine.text) checkedIcon: "../images/checkedIcon-black.png"
} uncheckedIcon: "../images/uncheckedIcon.png"
onClicked: {
persistentSettings.keyReuseMitigation2 = keyReuseMitigation2.checked
if (appWindow.currentWallet) {
appWindow.currentWallet.keyReuseMitigation2(keyReuseMitigation2.checked)
} }
} }
} }
}
RowLayout {
CheckBox { CheckBox {
id: setRingRelative id: setRingRelative
checked: true checked: true
@ -313,73 +393,19 @@ Rectangle {
checkedIcon: "../images/checkedIcon-black.png" checkedIcon: "../images/checkedIcon-black.png"
uncheckedIcon: "../images/uncheckedIcon.png" uncheckedIcon: "../images/uncheckedIcon.png"
} }
LineEdit {
id: setRingLine
fontSize: mainLayout.lineEditFontSize
placeholderText: qsTr("") + translationManager.emptyString
readOnly: false
width: mainLayout.editWidth
IconButton {
imageSource: "../images/copyToClipboard.png"
onClicked: {
if (getRingLine.text.length > 0) {
clipboard.setText(getRingLine.text)
}
}
}
}
StandardButton {
id: setRingButton
text: qsTr("Set Ring") + translationManager.emptyString
enabled: !!appWindow.currentWallet && validHex32(keyImageLine.text) && validRing(setRingLine.text.trim(), setRingRelative.checked)
onClicked: {
var outs = setRingLine.text.trim()
appWindow.currentWallet.setRing(keyImageLine.text, outs, setRingRelative.checked)
}
}
} }
CheckBox {
id: segregatePreForkOutputs
checked: persistentSettings.segregatePreForkOutputs
text: qsTr("I intend to spend on key-reusing fork(s)") + translationManager.emptyString
checkedIcon: "../images/checkedIcon-black.png"
uncheckedIcon: "../images/uncheckedIcon.png"
onClicked: {
persistentSettings.segregatePreForkOutputs = segregatePreForkOutputs.checked
if (appWindow.currentWallet) {
appWindow.currentWallet.segregatePreForkOutputs(segregatePreForkOutputs.checked)
}
}
}
CheckBox {
id: keyReuseMitigation2
checked: persistentSettings.keyReuseMitigation2
text: qsTr("I might want to spend on key-reusing fork(s)") + translationManager.emptyString
checkedIcon: "../images/checkedIcon-black.png"
uncheckedIcon: "../images/uncheckedIcon.png"
onClicked: {
persistentSettings.keyReuseMitigation2 = keyReuseMitigation2.checked
if (appWindow.currentWallet) {
appWindow.currentWallet.keyReuseMitigation2(keyReuseMitigation2.checked)
}
}
}
RowLayout { RowLayout {
id: segregationHeightRow id: segregationHeightRow
anchors.topMargin: 17 anchors.topMargin: 17
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
Label {
id: segregationHeightLabel
fontSize: 14
text: qsTr("Segregation height:") + translationManager.emptyString
}
LineEdit { LineEdit {
id: segregationHeightLine id: segregationHeightLine
readOnly: false readOnly: false
labelFontSize: 14 * scaleRatio
labelText: qsTr("Segregation height:") + translationManager.emptyString
Layout.fillWidth: true Layout.fillWidth: true
validator: IntValidator { bottom: 0 } validator: IntValidator { bottom: 0 }
onEditingFinished: { onEditingFinished: {
@ -390,7 +416,6 @@ Rectangle {
} }
} }
} }
} }
function onPageCompleted() { function onPageCompleted() {
@ -400,5 +425,4 @@ Rectangle {
segregationHeightLine.text = persistentSettings.segregationHeight segregationHeightLine.text = persistentSettings.segregationHeight
appWindow.currentWallet.keyReuseMitigation2(persistentSettings.keyReuseMitigation2) appWindow.currentWallet.keyReuseMitigation2(persistentSettings.keyReuseMitigation2)
} }
} }

View file

@ -117,6 +117,7 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.topMargin: 17 * scaleRatio anchors.topMargin: 17 * scaleRatio
width: 60 * scaleRatio width: 60 * scaleRatio
small: true
text: qsTr("Generate") + translationManager.emptyString text: qsTr("Generate") + translationManager.emptyString
enabled: TxUtils.checkTxID(getProofTxIdLine.text) && (getProofAddressLine.text.length == 0 || TxUtils.checkAddress(getProofAddressLine.text, appWindow.persistentSettings.nettype)) enabled: TxUtils.checkTxID(getProofTxIdLine.text) && (getProofAddressLine.text.length == 0 || TxUtils.checkAddress(getProofAddressLine.text, appWindow.persistentSettings.nettype))
onClicked: { onClicked: {
@ -206,6 +207,7 @@ Rectangle {
anchors.left: parent.left anchors.left: parent.left
anchors.topMargin: 17 * scaleRatio anchors.topMargin: 17 * scaleRatio
width: 60 width: 60
small: true
text: qsTr("Check") + translationManager.emptyString text: qsTr("Check") + translationManager.emptyString
enabled: TxUtils.checkTxID(checkProofTxIdLine.text) && TxUtils.checkSignature(checkProofSignatureLine.text) && ((checkProofSignatureLine.text.indexOf("SpendProofV") === 0 && checkProofAddressLine.text.length == 0) || (checkProofSignatureLine.text.indexOf("SpendProofV") !== 0 && TxUtils.checkAddress(checkProofAddressLine.text, appWindow.persistentSettings.nettype))) enabled: TxUtils.checkTxID(checkProofTxIdLine.text) && TxUtils.checkSignature(checkProofSignatureLine.text) && ((checkProofSignatureLine.text.indexOf("SpendProofV") === 0 && checkProofAddressLine.text.length == 0) || (checkProofSignatureLine.text.indexOf("SpendProofV") !== 0 && TxUtils.checkAddress(checkProofAddressLine.text, appWindow.persistentSettings.nettype)))
onClicked: { onClicked: {