qml: balance piechart in walletdetails, fix menus to top header height
This commit is contained in:
@@ -9,10 +9,14 @@ import "controls"
|
|||||||
|
|
||||||
Pane {
|
Pane {
|
||||||
id: root
|
id: root
|
||||||
property string title: qsTr("Lightning Channels")
|
|
||||||
|
|
||||||
property QtObject menu: Menu {
|
property QtObject menu: Menu {
|
||||||
id: menu
|
id: menu
|
||||||
|
parent: Overlay.overlay
|
||||||
|
dim: true
|
||||||
|
Overlay.modeless: Rectangle {
|
||||||
|
color: "#44000000"
|
||||||
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: 'transparent'
|
||||||
action: Action {
|
action: Action {
|
||||||
@@ -46,6 +50,20 @@ Pane {
|
|||||||
Layout.preferredWidth: parent.width
|
Layout.preferredWidth: parent.width
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
text: qsTr('Lightning Channels')
|
||||||
|
font.pixelSize: constants.fontSizeLarge
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 1
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
text: qsTr('You have %1 open channels').arg(Daemon.currentWallet.channelModel.numOpenChannels)
|
text: qsTr('You have %1 open channels').arg(Daemon.currentWallet.channelModel.numOpenChannels)
|
||||||
|
|||||||
@@ -26,19 +26,6 @@ Pane {
|
|||||||
|
|
||||||
model: visualModel
|
model: visualModel
|
||||||
|
|
||||||
header: Item {
|
|
||||||
width: parent.width
|
|
||||||
height: headerLayout.height
|
|
||||||
ColumnLayout {
|
|
||||||
id: headerLayout
|
|
||||||
anchors.centerIn: parent
|
|
||||||
Item { height: constants.paddingXLarge; width: 1 }
|
|
||||||
BalanceSummary {}
|
|
||||||
Item { height: constants.paddingXLarge; width: 1 }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
headerPositioning: ListView.InlineHeader
|
|
||||||
|
|
||||||
readonly property variant sectionLabels: {
|
readonly property variant sectionLabels: {
|
||||||
'today': qsTr('Today'),
|
'today': qsTr('Today'),
|
||||||
'yesterday': qsTr('Yesterday'),
|
'yesterday': qsTr('Yesterday'),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Pane {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
property string title: qsTr("Lightning payment details")
|
// property string title: qsTr("Lightning payment details")
|
||||||
|
|
||||||
property string key
|
property string key
|
||||||
|
|
||||||
@@ -31,6 +31,20 @@ Pane {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
text: qsTr('Lightning payment details')
|
||||||
|
font.pixelSize: constants.fontSizeLarge
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 1
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: qsTr('Status')
|
text: qsTr('Status')
|
||||||
color: Material.accentColor
|
color: Material.accentColor
|
||||||
|
|||||||
@@ -13,6 +13,11 @@ Pane {
|
|||||||
|
|
||||||
property QtObject menu: Menu {
|
property QtObject menu: Menu {
|
||||||
id: menu
|
id: menu
|
||||||
|
parent: Overlay.overlay
|
||||||
|
dim: true
|
||||||
|
Overlay.modeless: Rectangle {
|
||||||
|
color: "#44000000"
|
||||||
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: 'transparent'
|
||||||
action: Action {
|
action: Action {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Pane {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
property string title: qsTr("Transaction details")
|
// property string title: qsTr("Transaction details")
|
||||||
|
|
||||||
property string txid
|
property string txid
|
||||||
property string rawtx
|
property string rawtx
|
||||||
@@ -27,6 +27,11 @@ Pane {
|
|||||||
|
|
||||||
property QtObject menu: Menu {
|
property QtObject menu: Menu {
|
||||||
id: menu
|
id: menu
|
||||||
|
parent: Overlay.overlay
|
||||||
|
dim: true
|
||||||
|
Overlay.modeless: Rectangle {
|
||||||
|
color: "#44000000"
|
||||||
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: 'transparent'
|
||||||
action: Action {
|
action: Action {
|
||||||
@@ -85,6 +90,20 @@ Pane {
|
|||||||
width: parent.width
|
width: parent.width
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|
||||||
|
Label {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
text: qsTr('Transaction Details')
|
||||||
|
font.pixelSize: constants.fontSizeLarge
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
Layout.fillWidth: true
|
||||||
|
height: 1
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import "controls"
|
|||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
clip: true
|
clip: true
|
||||||
Layout.fillWidth: true
|
|
||||||
implicitHeight: 0
|
implicitHeight: 0
|
||||||
|
|
||||||
function open() {
|
function open() {
|
||||||
@@ -56,36 +55,21 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
id: rootLayout
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
spacing: constants.paddingXLarge
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
id: detailsLayout
|
|
||||||
visible: Daemon.currentWallet
|
visible: Daemon.currentWallet
|
||||||
rowSpacing: constants.paddingSmall
|
rowSpacing: constants.paddingSmall
|
||||||
Layout.preferredWidth: parent.width
|
Layout.preferredWidth: parent.width
|
||||||
Layout.margins: constants.paddingXLarge
|
Layout.topMargin: constants.paddingXLarge
|
||||||
|
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|
||||||
// Label {
|
|
||||||
// text: qsTr('Wallet')
|
|
||||||
// color: Material.accentColor
|
|
||||||
// font.pixelSize: constants.fontSizeLarge
|
|
||||||
// }
|
|
||||||
Image {
|
|
||||||
source: '../../icons/wallet.png'
|
|
||||||
Layout.preferredWidth: constants.iconSizeLarge
|
|
||||||
Layout.preferredHeight: constants.iconSizeLarge
|
|
||||||
}
|
|
||||||
Label {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
text: Daemon.currentWallet.name;
|
|
||||||
font.bold: true;
|
|
||||||
font.pixelSize: constants.fontSizeXLarge
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 2
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
Tag {
|
Tag {
|
||||||
text: Daemon.currentWallet.walletType
|
text: Daemon.currentWallet.walletType
|
||||||
font.pixelSize: constants.fontSizeSmall
|
font.pixelSize: constants.fontSizeSmall
|
||||||
@@ -140,7 +124,71 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TextHighlightPane {
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
GridLayout {
|
||||||
|
columns: 3
|
||||||
|
|
||||||
|
Label {
|
||||||
|
font.pixelSize: constants.fontSizeXLarge
|
||||||
|
text: qsTr('Balance:')
|
||||||
|
color: Material.accentColor
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
font.pixelSize: constants.fontSizeXLarge
|
||||||
|
font.family: FixedFont
|
||||||
|
text: Config.formatSats(Daemon.currentWallet.totalBalance)
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
font.pixelSize: constants.fontSizeXLarge
|
||||||
|
color: Material.accentColor
|
||||||
|
text: Config.baseUnit
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
visible: Daemon.fx.enabled
|
||||||
|
Layout.preferredHeight: 1
|
||||||
|
Layout.preferredWidth: 1
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
visible: Daemon.fx.enabled
|
||||||
|
font.pixelSize: constants.fontSizeLarge
|
||||||
|
color: constants.mutedForeground
|
||||||
|
text: Daemon.fx.fiatValue(Daemon.currentWallet.totalBalance, false)
|
||||||
|
}
|
||||||
|
Label {
|
||||||
|
visible: Daemon.fx.enabled
|
||||||
|
font.pixelSize: constants.fontSizeLarge
|
||||||
|
color: constants.mutedForeground
|
||||||
|
text: Daemon.fx.fiatCurrency
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Piechart {
|
||||||
|
id: piechart
|
||||||
|
visible: Daemon.currentWallet.totalBalance.satsInt > 0
|
||||||
|
Layout.preferredWidth: parent.width
|
||||||
|
// Layout.preferredHeight: 200
|
||||||
|
implicitHeight: 200
|
||||||
|
innerOffset: 6
|
||||||
|
function updateSlices() {
|
||||||
|
console.log('update piechart, w='+width+',h='+height)
|
||||||
|
var totalB = Daemon.currentWallet.totalBalance.satsInt
|
||||||
|
var onchainB = Daemon.currentWallet.confirmedBalance.satsInt
|
||||||
|
var frozenB = Daemon.currentWallet.frozenBalance.satsInt
|
||||||
|
var lnB = Daemon.currentWallet.lightningBalance.satsInt
|
||||||
|
piechart.slices = [
|
||||||
|
{ v: (onchainB-frozenB)/totalB, color: constants.colorPiechartOnchain, text: 'On-chain' },
|
||||||
|
{ v: frozenB/totalB, color: constants.colorPiechartFrozen, text: 'On-chain (frozen)' },
|
||||||
|
{ v: lnB/totalB, color: constants.colorPiechartLightning, text: 'Lightning' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
@@ -159,4 +207,11 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: Daemon.currentWallet
|
||||||
|
function onBalanceChanged() {
|
||||||
|
piechart.updateSlices()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,12 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
property QtObject menu: Menu {
|
property QtObject menu: Menu {
|
||||||
|
parent: Overlay.overlay
|
||||||
|
dim: true
|
||||||
|
Overlay.modeless: Rectangle {
|
||||||
|
color: "#44000000"
|
||||||
|
}
|
||||||
|
|
||||||
id: menu
|
id: menu
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: 'transparent'
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ Pane {
|
|||||||
|
|
||||||
property QtObject menu: Menu {
|
property QtObject menu: Menu {
|
||||||
id: menu
|
id: menu
|
||||||
|
parent: Overlay.overlay
|
||||||
|
dim: true
|
||||||
|
Overlay.modeless: Rectangle {
|
||||||
|
color: "#44000000"
|
||||||
|
}
|
||||||
MenuItem {
|
MenuItem {
|
||||||
icon.color: 'transparent'
|
icon.color: 'transparent'
|
||||||
action: Action {
|
action: Action {
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ Canvas {
|
|||||||
property int innerOffset: 10
|
property int innerOffset: 10
|
||||||
property bool showLegend: true
|
property bool showLegend: true
|
||||||
|
|
||||||
|
onSlicesChanged: piechart.requestPaint()
|
||||||
|
|
||||||
onPaint: {
|
onPaint: {
|
||||||
var startR = -Math.PI/2
|
var startR = -Math.PI/2
|
||||||
|
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ ApplicationWindow
|
|||||||
stack.currentItem.menu.open()
|
stack.currentItem.menu.open()
|
||||||
// position the menu to the right
|
// position the menu to the right
|
||||||
stack.currentItem.menu.x = toolbar.width - stack.currentItem.menu.width
|
stack.currentItem.menu.x = toolbar.width - stack.currentItem.menu.width
|
||||||
|
stack.currentItem.menu.y = toolbarTopLayout.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user