Browse Source

qml: channels styling

patch-4
Sander van Grieken 2 years ago
parent
commit
725a05643e
  1. 81
      electrum/gui/qml/components/Channels.qml
  2. 15
      electrum/gui/qml/components/controls/ChannelDelegate.qml

81
electrum/gui/qml/components/Channels.qml

@ -9,45 +9,21 @@ import "controls"
Pane { Pane {
id: root id: root
padding: 0
property QtObject menu: Menu {
id: menu
parent: Overlay.overlay
dim: true
Overlay.modeless: Rectangle {
color: "#44000000"
}
MenuItem {
icon.color: 'transparent'
action: Action {
text: qsTr('Swap');
enabled: Daemon.currentWallet.lightningCanSend.satsInt > 0 || Daemon.currentWallet.lightningCanReceive.satInt > 0
onTriggered: {
var dialog = swapDialog.createObject(root)
dialog.open()
}
icon.source: '../../icons/status_waiting.png'
}
}
MenuSeparator {}
MenuItem {
icon.color: 'transparent'
action: Action {
text: qsTr('Open Channel');
onTriggered: app.stack.push(Qt.resolvedUrl('OpenChannel.qml'))
icon.source: '../../icons/lightning.png'
}
}
}
ColumnLayout { ColumnLayout {
id: layout id: layout
width: parent.width width: parent.width
height: parent.height height: parent.height
spacing: 0
GridLayout { GridLayout {
id: summaryLayout id: summaryLayout
Layout.preferredWidth: parent.width Layout.fillWidth: true
Layout.topMargin: constants.paddingLarge
Layout.leftMargin: constants.paddingLarge
Layout.rightMargin: constants.paddingLarge
columns: 2 columns: 2
Label { Label {
@ -116,8 +92,13 @@ Pane {
Frame { Frame {
id: channelsFrame id: channelsFrame
Layout.preferredWidth: parent.width Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
Layout.topMargin: constants.paddingLarge
Layout.bottomMargin: constants.paddingLarge
Layout.leftMargin: constants.paddingMedium
Layout.rightMargin: constants.paddingMedium
verticalPadding: 0 verticalPadding: 0
horizontalPadding: 0 horizontalPadding: 0
background: PaneInsetBackground {} background: PaneInsetBackground {}
@ -126,24 +107,6 @@ Pane {
spacing: 0 spacing: 0
anchors.fill: parent anchors.fill: parent
Item {
Layout.preferredHeight: hitem.height
Layout.preferredWidth: parent.width
Rectangle {
anchors.fill: parent
color: Qt.lighter(Material.background, 1.25)
}
RowLayout {
id: hitem
width: parent.width
Label {
text: qsTr('Channels')
font.pixelSize: constants.fontSizeLarge
color: Material.accentColor
}
}
}
ListView { ListView {
id: listview id: listview
Layout.preferredWidth: parent.width Layout.preferredWidth: parent.width
@ -162,13 +125,23 @@ Pane {
} }
} }
RowLayout {
Layout.alignment: Qt.AlignHCenter FlatButton {
Layout.fillWidth: true
text: qsTr('Swap');
visible: Daemon.currentWallet.lightningCanSend.satsInt > 0 || Daemon.currentWallet.lightningCanReceive.satInt > 0
icon.source: '../../icons/status_waiting.png'
onClicked: {
var dialog = swapDialog.createObject(root)
dialog.open()
}
}
FlatButton {
Layout.fillWidth: true Layout.fillWidth: true
Button {
text: qsTr('Open Channel') text: qsTr('Open Channel')
onClicked: app.stack.push(Qt.resolvedUrl('OpenChannel.qml')) onClicked: app.stack.push(Qt.resolvedUrl('OpenChannel.qml'))
} icon.source: '../../icons/lightning.png'
} }
} }

15
electrum/gui/qml/components/controls/ChannelDelegate.qml

@ -30,13 +30,13 @@ ItemDelegate {
Rectangle { Rectangle {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: constants.paddingTiny Layout.preferredHeight: constants.paddingXXSmall
color: 'transparent' color: 'transparent'
} }
Image { Image {
id: walleticon id: walleticon
source: "../../../icons/lightning.png" source: model.is_trampoline ? '../../../icons/kangaroo.png' : '../../../icons/lightning.png'
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
Layout.rowSpan: 3 Layout.rowSpan: 3
Layout.preferredWidth: constants.iconSizeLarge Layout.preferredWidth: constants.iconSizeLarge
@ -45,13 +45,13 @@ ItemDelegate {
Image { Image {
visible: model.is_trampoline visible: model.is_trampoline
source: "../../../icons/kangaroo.png" source: '../../../icons/lightning.png'
anchors { anchors {
right: parent.right right: parent.right
bottom: parent.bottom bottom: parent.bottom
} }
width: parent.width * 2/3 width: parent.width * 1/3
height: parent.height * 2/3 height: parent.height * 1/3
} }
} }
@ -136,11 +136,10 @@ ItemDelegate {
height: 1 height: 1
} }
Rectangle { Item {
Layout.columnSpan: 2 Layout.columnSpan: 2
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: constants.paddingTiny Layout.preferredHeight: constants.paddingXXSmall
color: 'transparent'
} }
} }

Loading…
Cancel
Save