Browse Source

qml: ui

patch-4
Sander van Grieken 2 years ago
parent
commit
685f32750c
  1. 230
      electrum/gui/qml/components/InvoiceDialog.qml
  2. 65
      electrum/gui/qml/components/Preferences.qml
  3. 9
      electrum/gui/qml/components/ReceiveDialog.qml

230
electrum/gui/qml/components/InvoiceDialog.qml

@ -30,6 +30,113 @@ ElDialog {
height: parent.height
columns: 2
Label {
text: qsTr('Type')
color: Material.accentColor
}
RowLayout {
Layout.fillWidth: true
Image {
Layout.preferredWidth: constants.iconSizeSmall
Layout.preferredHeight: constants.iconSizeSmall
source: invoice.invoiceType == Invoice.LightningInvoice
? "../../icons/lightning.png"
: "../../icons/bitcoin.png"
}
Label {
text: invoice.invoiceType == Invoice.OnchainInvoice
? qsTr('On chain')
: invoice.invoiceType == Invoice.LightningInvoice
? qsTr('Lightning')
: ''
Layout.fillWidth: true
}
}
Label {
text: qsTr('Status')
color: Material.accentColor
}
Label {
text: invoice.status_str
}
Label {
visible: invoice.invoiceType == Invoice.OnchainInvoice
Layout.columnSpan: 2
text: qsTr('Address')
color: Material.accentColor
}
TextHighlightPane {
visible: invoice.invoiceType == Invoice.OnchainInvoice
Layout.columnSpan: 2
Layout.fillWidth: true
padding: 0
leftPadding: constants.paddingMedium
Label {
width: parent.width
text: invoice.address
font.family: FixedFont
wrapMode: Text.Wrap
}
}
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
text: qsTr('Remote Pubkey')
color: Material.accentColor
}
TextHighlightPane {
visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.columnSpan: 2
Layout.fillWidth: true
padding: 0
leftPadding: constants.paddingMedium
Label {
width: parent.width
text: invoice.lnprops ? invoice.lnprops.pubkey : ''
font.family: FixedFont
wrapMode: Text.Wrap
}
}
Label {
text: qsTr('Description')
visible: invoice.message
Layout.columnSpan: 2
color: Material.accentColor
}
TextHighlightPane {
visible: invoice.message
Layout.columnSpan: 2
Layout.preferredWidth: parent.width
Layout.alignment: Qt.AlignHCenter
padding: 0
leftPadding: constants.paddingMedium
Label {
text: invoice.message
width: parent.width
font.pixelSize: constants.fontSizeXLarge
wrapMode: Text.Wrap
elide: Text.ElideRight
}
}
Label {
text: qsTr('Amount to send')
color: Material.accentColor
@ -146,129 +253,6 @@ ElDialog {
}
Label {
text: qsTr('Description')
visible: invoice.message
Layout.columnSpan: 2
color: Material.accentColor
}
TextHighlightPane {
visible: invoice.message
Layout.columnSpan: 2
Layout.preferredWidth: parent.width
Layout.alignment: Qt.AlignHCenter
padding: 0
leftPadding: constants.paddingMedium
Label {
text: invoice.message
Layout.fillWidth: true
font.pixelSize: constants.fontSizeXLarge
wrapMode: Text.Wrap
elide: Text.ElideRight
}
}
Label {
text: qsTr('Type')
color: Material.accentColor
}
RowLayout {
Layout.fillWidth: true
Image {
Layout.preferredWidth: constants.iconSizeSmall
Layout.preferredHeight: constants.iconSizeSmall
source: invoice.invoiceType == Invoice.LightningInvoice
? "../../icons/lightning.png"
: "../../icons/bitcoin.png"
}
Label {
text: invoice.invoiceType == Invoice.OnchainInvoice
? qsTr('On chain')
: invoice.invoiceType == Invoice.LightningInvoice
? qsTr('Lightning')
: ''
Layout.fillWidth: true
}
}
Label {
visible: invoice.invoiceType == Invoice.OnchainInvoice
text: qsTr('Address')
color: Material.accentColor
}
Label {
visible: invoice.invoiceType == Invoice.OnchainInvoice
Layout.fillWidth: true
text: invoice.address
font.family: FixedFont
wrapMode: Text.Wrap
}
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
text: qsTr('Remote Pubkey')
color: Material.accentColor
}
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.fillWidth: true
text: invoice.lnprops ? invoice.lnprops.pubkey : ''
font.family: FixedFont
wrapMode: Text.Wrap
}
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
text: qsTr('Route via (t)')
color: Material.accentColor
}
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.fillWidth: true
text: invoice.lnprops ? invoice.lnprops.t : ''
font.family: FixedFont
wrapMode: Text.Wrap
}
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
text: qsTr('Route via (r)')
color: Material.accentColor
}
Label {
visible: invoice.invoiceType == Invoice.LightningInvoice
Layout.fillWidth: true
text: invoice.lnprops ? invoice.lnprops.r : ''
font.family: FixedFont
wrapMode: Text.Wrap
}
Label {
text: qsTr('Status')
color: Material.accentColor
}
Label {
text: invoice.status_str
}
Rectangle {
height: 1
Layout.fillWidth: true
Layout.columnSpan: 2
color: Material.accentColor
}
Item { Layout.preferredHeight: constants.paddingLarge; Layout.preferredWidth: 1 }
InfoTextArea {

65
electrum/gui/qml/components/Preferences.qml

@ -19,28 +19,10 @@ Pane {
ColumnLayout {
anchors.fill: parent
TabBar {
id: tabbar
Layout.fillWidth: true
currentIndex: swipeview.currentIndex
TabButton {
text: qsTr('Preferences')
font.pixelSize: constants.fontSizeLarge
}
TabButton {
text: qsTr('Plugins')
font.pixelSize: constants.fontSizeLarge
}
}
SwipeView {
id: swipeview
Flickable {
Layout.fillHeight: true
Layout.fillWidth: true
currentIndex: tabbar.currentIndex
Flickable {
contentHeight: prefsPane.height
interactive: height < contentHeight
clip: true
@ -258,14 +240,6 @@ Pane {
}
}
Pane {
ColumnLayout {
x: constants.paddingXXLarge
id: pluginsRootLayout
}
}
}
}
Component {
@ -273,30 +247,6 @@ Pane {
Pin {}
}
Component {
id: pluginHeader
RowLayout {
Layout.leftMargin: -constants.paddingXXLarge
property string name
property string fullname
property bool pluginEnabled
Switch {
checked: pluginEnabled
onCheckedChanged: {
if (activeFocus)
pluginEnabled = checked
}
}
Label {
text: fullname
}
onPluginEnabledChanged: {
console.log('!')
AppController.setPluginEnabled(name, pluginEnabled)
}
}
}
Component.onCompleted: {
baseUnit.currentIndex = _baseunits.indexOf(Config.baseUnit)
thousands.checked = Config.thousandsSeparator
@ -308,18 +258,5 @@ Pane {
lnRoutingType.currentIndex = Config.useGossip ? 0 : 1
useFallbackAddress.checked = Config.useFallbackAddress
useRbf.checked = Config.useRbf
var plugins = AppController.plugins
for (var i=0; i<plugins.length; i++) {
var p = plugins[i]
pluginHeader.createObject(pluginsRootLayout, { name: p['name'], fullname: p['fullname'], pluginEnabled: p['enabled'] })
var labelsPlugin = AppController.plugin(p['name'])
if (labelsPlugin) {
if (labelsPlugin.settingsComponent()) {
var component = Qt.createComponent(Qt.resolvedUrl(labelsPlugin.settingsComponent()))
component.createObject(pluginsRootLayout, { plugin: labelsPlugin })
}
}
}
}
}

9
electrum/gui/qml/components/ReceiveDialog.qml

@ -50,12 +50,6 @@ ElDialog {
}
]
Rectangle {
height: 1
Layout.fillWidth: true
color: Material.accentColor
}
Item {
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: constants.paddingSmall
@ -162,7 +156,8 @@ ElDialog {
Rectangle {
height: 1
Layout.fillWidth: true
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: qrloader.width
color: Material.accentColor
}

Loading…
Cancel
Save