1
0

add QEAddressListModel and initial Addresses.qml page.

show sane main view when no wallet loaded.
show error dialog when wallet could not be loaded.
show wallet up_to_date indicator in title bar.
refactor QETransactionListModel to be more self-contained.
This commit is contained in:
Sander van Grieken
2022-03-11 13:19:51 +01:00
parent 7e1606fe86
commit 17820b9346
5 changed files with 237 additions and 37 deletions

View File

@@ -0,0 +1,88 @@
import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
import org.electrum 1.0
Pane {
id: rootItem
anchors.fill: parent
property string title: Daemon.walletName + ' - ' + qsTr('Addresses')
ColumnLayout {
id: layout
width: parent.width
height: parent.height
Item {
width: parent.width
Layout.fillHeight: true
ListView {
id: listview
width: parent.width
height: parent.height
clip: true
model: Daemon.currentWallet.addressModel
delegate: AbstractButton {
id: delegate
width: ListView.view.width
height: 30
background: Rectangle {
color: model.held ? Qt.rgba(1,0,0,0.5) :
model.numtx > 0 && model.balance == 0 ? Qt.rgba(1,1,1,0.25) :
model.type == 'receive' ? Qt.rgba(0,1,0,0.25) :
Qt.rgba(1,0.93,0,0.25)
Rectangle {
height: 1
width: parent.width
anchors.top: parent.top
border.color: Material.accentColor
visible: model.index > 0
}
}
RowLayout {
x: 10
spacing: 5
width: parent.width - 20
anchors.verticalCenter: parent.verticalCenter
Label {
font.pixelSize: 12
text: model.type
}
Label {
font.pixelSize: 12
font.family: "Courier" // TODO: use system monospace font
text: model.address
elide: Text.ElideMiddle
Layout.maximumWidth: delegate.width / 4
}
Label {
font.pixelSize: 12
text: model.label
elide: Text.ElideRight
Layout.minimumWidth: delegate.width / 4
Layout.fillWidth: true
}
Label {
font.pixelSize: 12
text: model.balance
}
Label {
font.pixelSize: 12
text: model.numtx
}
}
}
}
}
}
Component.onCompleted: Daemon.currentWallet.addressModel.init_model()
}

View File

@@ -9,12 +9,35 @@ Item {
property string title: Daemon.walletName
property QtObject menu: Menu {
MenuItem { text: 'Wallets'; onTriggered: stack.push(Qt.resolvedUrl('Wallets.qml')) }
MenuItem { text: 'Network'; onTriggered: stack.push(Qt.resolvedUrl('NetworkStats.qml')) }
MenuItem { text: qsTr('Addresses'); onTriggered: stack.push(Qt.resolvedUrl('Addresses.qml')); visible: Daemon.currentWallet != null }
MenuItem { text: qsTr('Wallets'); onTriggered: stack.push(Qt.resolvedUrl('Wallets.qml')) }
MenuItem { text: qsTr('Network'); onTriggered: stack.push(Qt.resolvedUrl('NetworkStats.qml')) }
}
ColumnLayout {
anchors.centerIn: parent
width: parent.width
spacing: 40
visible: Daemon.currentWallet == null
Label {
text: qsTr('No wallet loaded')
font.pixelSize: 24
Layout.alignment: Qt.AlignHCenter
}
Button {
text: qsTr('Open/Create Wallet')
Layout.alignment: Qt.AlignHCenter
onClicked: {
stack.push(Qt.resolvedUrl('Wallets.qml'))
}
}
}
ColumnLayout {
anchors.fill: parent
visible: Daemon.currentWallet != null
TabBar {
id: tabbar

View File

@@ -31,6 +31,7 @@ ApplicationWindow
onClicked: stack.pop()
}
Item {
visible: Network.isTestNet
width: column.width
height: column.height
MouseArea {
@@ -46,7 +47,6 @@ ApplicationWindow
Column {
id: column
visible: Network.isTestNet
Image {
anchors.horizontalCenter: parent.horizontalCenter
width: 16
@@ -63,15 +63,22 @@ ApplicationWindow
}
}
Image {
Layout.preferredWidth: 16
Layout.preferredHeight: 16
source: Daemon.currentWallet.isUptodate ? "../../icons/status_connected.png" : "../../icons/status_lagging.png"
}
Label {
text: stack.currentItem.title
elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: true
font.pointSize: 10
font.pixelSize: 14
font.bold: true
}
ToolButton {
text: qsTr("⋮")
onClicked: {
@@ -203,5 +210,10 @@ ApplicationWindow
// var dialog = _openWallet.createObject(app)
//dialog.open()
}
function onWalletOpenError(error) {
console.log('wallet open error')
var dialog = app.messageDialog.createObject(app, {'text': error})
dialog.open()
}
}
}