qml: ui swapdialog
This commit is contained in:
@@ -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 {
|
GridLayout {
|
||||||
height: 1
|
id: layout
|
||||||
Layout.fillWidth: true
|
columns: 2
|
||||||
Layout.columnSpan: 2
|
Layout.preferredWidth: parent.width
|
||||||
color: Material.accentColor
|
Layout.leftMargin: constants.paddingLarge
|
||||||
}
|
Layout.rightMargin: constants.paddingLarge
|
||||||
|
|
||||||
Label {
|
|
||||||
text: qsTr('You send')
|
|
||||||
color: Material.accentColor
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Label {
|
Label {
|
||||||
id: tosend
|
text: qsTr('You send')
|
||||||
text: Config.formatSats(swaphelper.tosend)
|
|
||||||
font.family: FixedFont
|
|
||||||
visible: swaphelper.valid
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: Config.baseUnit
|
|
||||||
color: Material.accentColor
|
|
||||||
visible: swaphelper.valid
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: swaphelper.isReverse ? qsTr('(offchain)') : qsTr('(onchain)')
|
|
||||||
visible: swaphelper.valid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: qsTr('You receive')
|
|
||||||
color: Material.accentColor
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Label {
|
|
||||||
id: toreceive
|
|
||||||
text: Config.formatSats(swaphelper.toreceive)
|
|
||||||
font.family: FixedFont
|
|
||||||
visible: swaphelper.valid
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: Config.baseUnit
|
|
||||||
color: Material.accentColor
|
|
||||||
visible: swaphelper.valid
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: swaphelper.isReverse ? qsTr('(onchain)') : qsTr('(offchain)')
|
|
||||||
visible: swaphelper.valid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
|
||||||
text: qsTr('Server fee')
|
|
||||||
color: Material.accentColor
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Label {
|
|
||||||
text: swaphelper.serverfeeperc
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: Config.formatSats(swaphelper.serverfee)
|
|
||||||
font.family: FixedFont
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
text: Config.baseUnit
|
|
||||||
color: Material.accentColor
|
color: Material.accentColor
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
Label {
|
RowLayout {
|
||||||
text: qsTr('Mining fee')
|
Label {
|
||||||
color: Material.accentColor
|
id: tosend
|
||||||
}
|
text: Config.formatSats(swaphelper.tosend)
|
||||||
|
font.family: FixedFont
|
||||||
RowLayout {
|
visible: swaphelper.valid
|
||||||
Label {
|
}
|
||||||
text: Config.formatSats(swaphelper.miningfee)
|
Label {
|
||||||
font.family: FixedFont
|
text: Config.baseUnit
|
||||||
}
|
color: Material.accentColor
|
||||||
Label {
|
visible: swaphelper.valid
|
||||||
text: Config.baseUnit
|
}
|
||||||
color: Material.accentColor
|
Label {
|
||||||
}
|
text: swaphelper.isReverse ? qsTr('(offchain)') : qsTr('(onchain)')
|
||||||
}
|
visible: swaphelper.valid
|
||||||
|
|
||||||
Slider {
|
|
||||||
id: swapslider
|
|
||||||
Layout.columnSpan: 2
|
|
||||||
Layout.preferredWidth: 2/3 * layout.width
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
|
|
||||||
from: swaphelper.rangeMin
|
|
||||||
to: swaphelper.rangeMax
|
|
||||||
|
|
||||||
onValueChanged: {
|
|
||||||
if (activeFocus)
|
|
||||||
swaphelper.sliderPos = value
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
|
||||||
value = swaphelper.sliderPos
|
|
||||||
}
|
|
||||||
Connections {
|
|
||||||
target: swaphelper
|
|
||||||
function onSliderPosChanged() {
|
|
||||||
swapslider.value = swaphelper.sliderPos
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr('You receive')
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Label {
|
||||||
|
id: toreceive
|
||||||
|
text: Config.formatSats(swaphelper.toreceive)
|
||||||
|
font.family: FixedFont
|
||||||
|
visible: swaphelper.valid
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: Config.baseUnit
|
||||||
|
color: Material.accentColor
|
||||||
|
visible: swaphelper.valid
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: swaphelper.isReverse ? qsTr('(onchain)') : qsTr('(offchain)')
|
||||||
|
visible: swaphelper.valid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr('Server fee')
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Label {
|
||||||
|
text: swaphelper.serverfeeperc
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: Config.formatSats(swaphelper.serverfee)
|
||||||
|
font.family: FixedFont
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: Config.baseUnit
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr('Mining fee')
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
Label {
|
||||||
|
text: Config.formatSats(swaphelper.miningfee)
|
||||||
|
font.family: FixedFont
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
text: Config.baseUnit
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Slider {
|
||||||
|
id: swapslider
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.preferredWidth: 2/3 * layout.width
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
|
||||||
|
from: swaphelper.rangeMin
|
||||||
|
to: swaphelper.rangeMax
|
||||||
|
|
||||||
|
onValueChanged: {
|
||||||
|
if (activeFocus)
|
||||||
|
swaphelper.sliderPos = value
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
value = swaphelper.sliderPos
|
||||||
|
}
|
||||||
|
Connections {
|
||||||
|
target: swaphelper
|
||||||
|
function onSliderPosChanged() {
|
||||||
|
swapslider.value = swaphelper.sliderPos
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InfoTextArea {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.preferredWidth: swapslider.width
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
visible: swaphelper.userinfo != ''
|
||||||
|
text: swaphelper.userinfo
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InfoTextArea {
|
Item { Layout.fillHeight: true; Layout.preferredWidth: 1 }
|
||||||
|
|
||||||
|
FlatButton {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
visible: swaphelper.userinfo != ''
|
|
||||||
text: swaphelper.userinfo
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
height: 1
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
text: qsTr('Swap')
|
||||||
color: Material.accentColor
|
icon.source: '../../icons/status_waiting.png'
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
Layout.columnSpan: 2
|
|
||||||
text: qsTr('Ok')
|
|
||||||
enabled: swaphelper.valid
|
enabled: swaphelper.valid
|
||||||
onClicked: swaphelper.executeSwap()
|
onClicked: swaphelper.executeSwap()
|
||||||
}
|
}
|
||||||
|
|
||||||
Item { Layout.fillHeight: true; Layout.preferredWidth: 1; Layout.columnSpan: 2 }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SwapHelper {
|
SwapHelper {
|
||||||
|
|||||||
Reference in New Issue
Block a user