Browse Source

qml: ui swapdialog

master
Sander van Grieken 3 years ago
parent
commit
daffa1a731
  1. 210
      electrum/gui/qml/components/SwapDialog.qml

210
electrum/gui/qml/components/SwapDialog.qml

@ -22,147 +22,145 @@ ElDialog {
color: "#aa000000" color: "#aa000000"
} }
GridLayout { padding: 0
id: layout
ColumnLayout {
width: parent.width width: parent.width
height: parent.height height: parent.height
columns: 2 spacing: 0
Rectangle {
height: 1
Layout.fillWidth: true
Layout.columnSpan: 2
color: Material.accentColor
}
Label { GridLayout {
text: qsTr('You send') id: layout
color: Material.accentColor columns: 2
} Layout.preferredWidth: parent.width
Layout.leftMargin: constants.paddingLarge
Layout.rightMargin: constants.paddingLarge
RowLayout {
Label {
id: tosend
text: Config.formatSats(swaphelper.tosend)
font.family: FixedFont
visible: swaphelper.valid
}
Label { Label {
text: Config.baseUnit text: qsTr('You send')
color: Material.accentColor color: Material.accentColor
visible: swaphelper.valid
} }
Label {
text: swaphelper.isReverse ? qsTr('(offchain)') : qsTr('(onchain)')
visible: swaphelper.valid
}
}
Label { RowLayout {
text: qsTr('You receive') Label {
color: Material.accentColor id: tosend
} text: Config.formatSats(swaphelper.tosend)
font.family: FixedFont
RowLayout { visible: swaphelper.valid
Layout.fillWidth: true }
Label { Label {
id: toreceive text: Config.baseUnit
text: Config.formatSats(swaphelper.toreceive) color: Material.accentColor
font.family: FixedFont visible: swaphelper.valid
visible: swaphelper.valid }
Label {
text: swaphelper.isReverse ? qsTr('(offchain)') : qsTr('(onchain)')
visible: swaphelper.valid
}
} }
Label { Label {
text: Config.baseUnit text: qsTr('You receive')
color: Material.accentColor color: Material.accentColor
visible: swaphelper.valid
} }
Label {
text: swaphelper.isReverse ? qsTr('(onchain)') : qsTr('(offchain)')
visible: swaphelper.valid
}
}
Label { RowLayout {
text: qsTr('Server fee') Layout.fillWidth: true
color: Material.accentColor Label {
} id: toreceive
text: Config.formatSats(swaphelper.toreceive)
RowLayout { font.family: FixedFont
Label { visible: swaphelper.valid
text: swaphelper.serverfeeperc }
} Label {
Label { text: Config.baseUnit
text: Config.formatSats(swaphelper.serverfee) color: Material.accentColor
font.family: FixedFont visible: swaphelper.valid
}
Label {
text: swaphelper.isReverse ? qsTr('(onchain)') : qsTr('(offchain)')
visible: swaphelper.valid
}
} }
Label { Label {
text: Config.baseUnit text: qsTr('Server fee')
color: Material.accentColor color: Material.accentColor
} }
}
Label { RowLayout {
text: qsTr('Mining fee') Label {
color: Material.accentColor text: swaphelper.serverfeeperc
} }
Label {
RowLayout { text: Config.formatSats(swaphelper.serverfee)
Label { font.family: FixedFont
text: Config.formatSats(swaphelper.miningfee) }
font.family: FixedFont Label {
text: Config.baseUnit
color: Material.accentColor
}
} }
Label { Label {
text: Config.baseUnit text: qsTr('Mining fee')
color: Material.accentColor color: Material.accentColor
} }
}
Slider { RowLayout {
id: swapslider Label {
Layout.columnSpan: 2 text: Config.formatSats(swaphelper.miningfee)
Layout.preferredWidth: 2/3 * layout.width font.family: FixedFont
Layout.alignment: Qt.AlignHCenter }
Label {
text: Config.baseUnit
color: Material.accentColor
}
}
from: swaphelper.rangeMin Slider {
to: swaphelper.rangeMax id: swapslider
Layout.columnSpan: 2
Layout.preferredWidth: 2/3 * layout.width
Layout.alignment: Qt.AlignHCenter
onValueChanged: { from: swaphelper.rangeMin
if (activeFocus) to: swaphelper.rangeMax
swaphelper.sliderPos = value
} onValueChanged: {
Component.onCompleted: { if (activeFocus)
value = swaphelper.sliderPos swaphelper.sliderPos = value
} }
Connections { Component.onCompleted: {
target: swaphelper value = swaphelper.sliderPos
function onSliderPosChanged() { }
swapslider.value = swaphelper.sliderPos Connections {
target: swaphelper
function onSliderPosChanged() {
swapslider.value = swaphelper.sliderPos
}
} }
} }
}
InfoTextArea { InfoTextArea {
Layout.columnSpan: 2 Layout.columnSpan: 2
visible: swaphelper.userinfo != '' Layout.preferredWidth: swapslider.width
text: swaphelper.userinfo Layout.alignment: Qt.AlignHCenter
visible: swaphelper.userinfo != ''
text: swaphelper.userinfo
}
} }
Rectangle { Item { Layout.fillHeight: true; Layout.preferredWidth: 1 }
height: 1
Layout.fillWidth: true
Layout.columnSpan: 2
color: Material.accentColor
}
Button { FlatButton {
Layout.alignment: Qt.AlignHCenter
Layout.columnSpan: 2 Layout.columnSpan: 2
text: qsTr('Ok') Layout.fillWidth: true
text: qsTr('Swap')
icon.source: '../../icons/status_waiting.png'
enabled: swaphelper.valid enabled: swaphelper.valid
onClicked: swaphelper.executeSwap() onClicked: swaphelper.executeSwap()
} }
Item { Layout.fillHeight: true; Layout.preferredWidth: 1; Layout.columnSpan: 2 }
} }
SwapHelper { SwapHelper {

Loading…
Cancel
Save