Browse Source

qml: many UI updates and additions

patch-4
Sander van Grieken 4 years ago
parent
commit
ba7bcbfcbc
  1. 31
      electrum/gui/qml/components/BalanceSummary.qml
  2. 34
      electrum/gui/qml/components/History.qml
  3. 4
      electrum/gui/qml/components/NetworkStats.qml
  4. 3
      electrum/gui/qml/components/Scan.qml
  5. 27
      electrum/gui/qml/components/Send.qml
  6. 82
      electrum/gui/qml/components/Wallets.qml
  7. 74
      electrum/gui/qml/components/landing.qml
  8. 82
      electrum/gui/qml/components/main.qml

31
electrum/gui/qml/components/BalanceSummary.qml

@ -0,0 +1,31 @@
import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.0
Item {
height: layout.height
GridLayout {
id: layout
columns: 3
Label {
Layout.columnSpan: 3
font.pointSize: 14
text: 'Balance: ' + Daemon.currentWallet.confirmedBalance //'5.6201 mBTC'
}
Label {
font.pointSize: 8
text: 'Confirmed: ' + Daemon.currentWallet.confirmedBalance
}
Label {
font.pointSize: 8
text: 'Unconfirmed: ' + Daemon.currentWallet.unconfirmedBalance
}
Label {
font.pointSize: 8
text: 'Lightning: ?'
}
}
}

34
electrum/gui/qml/components/History.qml

@ -2,19 +2,32 @@ import QtQuick 2.6
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
Item { import Electrum 1.0
id: rootItem
property string title: 'History' Pane {
id: rootItem
Column { visible: Daemon.currentWallet !== undefined
width: parent.width clip: true
ListView { ListView {
id: listview
width: parent.width width: parent.width
height: 200 height: parent.height
model: Daemon.currentWallet.historyModel model: Daemon.currentWallet.historyModel
header: Item {
id: header
width: ListView.view.width
height: balance.height
BalanceSummary {
id: balance
width: parent.width
}
}
delegate: Item { delegate: Item {
id: delegate id: delegate
width: ListView.view.width width: ListView.view.width
@ -55,8 +68,8 @@ Item {
"../../../gui/icons/confirmed.png" "../../../gui/icons/confirmed.png"
] ]
sourceSize.width: 32 sourceSize.width: 48
sourceSize.height: 32 sourceSize.height: 48
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
source: tx_icons[Math.min(6,model.confirmations)] source: tx_icons[Math.min(6,model.confirmations)]
} }
@ -65,6 +78,7 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
Label { Label {
font.pointSize: 12
text: model.label !== '' ? model.label : '<no label>' text: model.label !== '' ? model.label : '<no label>'
color: model.label !== '' ? 'black' : 'gray' color: model.label !== '' ? 'black' : 'gray'
font.bold: model.label !== '' ? true : false font.bold: model.label !== '' ? true : false
@ -78,6 +92,7 @@ Item {
Column { Column {
id: valuefee id: valuefee
Label { Label {
font.pointSize: 12
text: model.bc_value text: model.bc_value
font.bold: true font.bold: true
} }
@ -127,7 +142,6 @@ Item {
} }
} // delegate } // delegate
}
} }

4
electrum/gui/qml/components/NetworkStats.qml

@ -3,12 +3,14 @@ import QtQuick.Layouts 1.0
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
Item { Pane {
property string title: qsTr('Network') property string title: qsTr('Network')
GridLayout { GridLayout {
columns: 2 columns: 2
Label { text: qsTr("Network: "); color: Material.primaryHighlightedTextColor; font.bold: true }
Label { text: Network.networkName }
Label { text: qsTr("Server: "); color: Material.primaryHighlightedTextColor; font.bold: true } Label { text: qsTr("Server: "); color: Material.primaryHighlightedTextColor; font.bold: true }
Label { text: Network.server } Label { text: Network.server }
Label { text: qsTr("Local Height: "); color: Material.primaryHighlightedTextColor; font.bold: true } Label { text: qsTr("Local Height: "); color: Material.primaryHighlightedTextColor; font.bold: true }

3
electrum/gui/qml/components/Scan.qml

@ -4,11 +4,10 @@ import QtQuick.Controls 2.0
Item { Item {
property bool toolbar: false property bool toolbar: false
property string title: 'scan'
QRScan { QRScan {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: button.top anchors.bottom: parent.bottom
width: parent.width width: parent.width
} }

27
electrum/gui/qml/components/Send.qml

@ -2,20 +2,16 @@ import QtQuick 2.6
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
Item { Pane {
id: rootItem id: rootItem
property string title: 'Send'
GridLayout { GridLayout {
width: rootItem.width - 12 width: parent.width
anchors.horizontalCenter: parent.horizontalCenter
columns: 4 columns: 4
Label { BalanceSummary {
Layout.columnSpan: 4 Layout.columnSpan: 4
Layout.alignment: Qt.AlignHCenter //Layout.alignment: Qt.AlignHCenter
text: "Current Balance: 0 mBTC"
} }
Label { Label {
@ -47,13 +43,17 @@ Item {
placeholderText: 'sat/vB' placeholderText: 'sat/vB'
} }
Column { Item {
Layout.fillWidth: true Layout.fillWidth: true
Layout.columnSpan: 4 Layout.columnSpan: 4
Button { Row {
spacing: 10
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
Button {
// anchors.horizontalCenter: parent.horizontalCenter
text: 'Pay' text: 'Pay'
enabled: address.text != '' && amount.text != '' && fee.text != '' // TODO proper validation
onClicked: { onClicked: {
var i_amount = parseInt(amount.text) var i_amount = parseInt(amount.text)
if (isNaN(i_amount)) if (isNaN(i_amount))
@ -63,6 +63,13 @@ Item {
app.stack.pop() app.stack.pop()
} }
} }
Button {
text: 'Scan QR Code'
Layout.alignment: Qt.AlignHCenter
onClicked: app.stack.push(Qt.resolvedUrl('Scan.qml'))
}
}
} }
} }

82
electrum/gui/qml/components/Wallets.qml

@ -2,20 +2,73 @@ import QtQuick 2.6
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
Item { Pane {
id: rootItem
property string title: 'Wallets' property string title: 'Wallets'
anchors.fill: parent ColumnLayout {
id: layout
width: parent.width
height: parent.height
Item {
width: parent.width
height: detailsLayout.height
GridLayout {
id: detailsLayout
width: parent.width
columns: 4
Label { text: 'Wallet'; Layout.columnSpan: 2 }
Label { text: Daemon.walletName; Layout.columnSpan: 2 }
Label { text: 'txinType' }
Label { text: Daemon.currentWallet.txinType }
Label { text: 'is deterministic' }
Label { text: Daemon.currentWallet.isDeterministic }
Label { text: 'is watch only' }
Label { text: Daemon.currentWallet.isWatchOnly }
Label { text: 'is Encrypted' }
Label { text: Daemon.currentWallet.isEncrypted }
Label { text: 'is Hardware' }
Label { text: Daemon.currentWallet.isHardware }
Label { text: 'derivation path (BIP32)'; visible: Daemon.currentWallet.isDeterministic }
Label { text: Daemon.currentWallet.derivationPath; visible: Daemon.currentWallet.isDeterministic }
}
}
// }
Item {
width: parent.width
// height: detailsFrame.height
Layout.fillHeight: true
Frame {
id: detailsFrame
width: parent.width
height: parent.height
ListView { ListView {
id: listview
width: parent.width width: parent.width
// Layout.fillHeight: true
height: parent.height height: parent.height
clip:true
model: Daemon.availableWallets model: Daemon.availableWallets
delegate: Item { // header: sadly seems to be buggy
delegate: AbstractButton {
width: ListView.view.width width: ListView.view.width
height: 50 height: 50
onClicked: console.log('delegate clicked')
RowLayout { RowLayout {
x: 20 x: 20
spacing: 20 spacing: 20
@ -25,19 +78,28 @@ Item {
} }
Label { Label {
font.pointSize: model.active ? 14 : 13 font.pointSize: 12
font.bold: model.active
text: model.name text: model.name
Layout.fillWidth: true Layout.fillWidth: true
} }
Button {
text: 'Load'
onClicked: {
Daemon.load_wallet(model.path, null)
}
}
}
} }
}}}
MouseArea { Button {
anchors.fill: parent Layout.alignment: Qt.AlignHCenter
onClicked: openMenu() text: 'Create Wallet'
onClicked: {
var dialog = app.newWalletWizard.createObject(rootItem)
dialog.open()
} }
} }
} }
} }

74
electrum/gui/qml/components/landing.qml

@ -1,59 +1,87 @@
import QtQuick 2.6 import QtQuick 2.6
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.0
import QtQml 2.6 import QtQml 2.6
Item { Item {
id: rootItem id: rootItem
property string title: 'Network' property string title: Daemon.walletName
property QtObject menu: Menu { property QtObject menu: Menu {
MenuItem { text: 'Wallets'; onTriggered: stack.push(Qt.resolvedUrl('Wallets.qml')) } MenuItem { text: 'Wallets'; onTriggered: stack.push(Qt.resolvedUrl('Wallets.qml')) }
MenuItem { text: 'Network'; onTriggered: stack.push(Qt.resolvedUrl('NetworkStats.qml')) } MenuItem { text: 'Network'; onTriggered: stack.push(Qt.resolvedUrl('NetworkStats.qml')) }
} }
Column { ColumnLayout {
width: parent.width anchors.fill: parent
Button { TabBar {
text: 'Scan QR Code' id: tabbar
onClicked: app.stack.push(Qt.resolvedUrl('Scan.qml')) Layout.fillWidth: true
currentIndex: swipeview.currentIndex
TabButton {
text: qsTr('Receive')
}
TabButton {
text: qsTr('History')
}
TabButton {
enabled: !Daemon.currentWallet.isWatchOnly
text: qsTr('Send')
} }
Button {
text: 'Send'
onClicked: app.stack.push(Qt.resolvedUrl('Send.qml'))
} }
SwipeView {
id: swipeview
Layout.fillHeight: true
Layout.fillWidth: true
currentIndex: tabbar.currentIndex
Item {
ColumnLayout {
width: parent.width
y: 20
spacing: 20
Button { Button {
text: 'Show TX History' onClicked: stack.push(Qt.resolvedUrl('Wallets.qml'))
onClicked: app.stack.push(Qt.resolvedUrl('History.qml')) text: 'Wallets'
Layout.alignment: Qt.AlignHCenter
} }
Button { Button {
text: 'Create Wallet' text: 'Create Wallet'
Layout.alignment: Qt.AlignHCenter
onClicked: { onClicked: {
var dialog = newWalletWizard.createObject(rootItem) var dialog = app.newWalletWizard.createObject(rootItem)
dialog.open() dialog.open()
} }
} }
} }
}
Item {
History {
id: history
anchors.fill: parent
}
}
Component {
id: newWalletWizard
NewWalletWizard {
parent: Overlay.overlay
x: 12
y: 12
width: parent.width - 24
height: parent.height - 24
Overlay.modal: Rectangle { Item {
color: "#aa000000" enabled: !Daemon.currentWallet.isWatchOnly
Send {
anchors.fill: parent
}
} }
} }
} }
} }

82
electrum/gui/qml/components/main.qml

@ -1,5 +1,5 @@
import QtQuick 2.6 import QtQuick 2.6
import QtQuick.Controls 2.0 import QtQuick.Controls 2.3
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls.Material 2.0 import QtQuick.Controls.Material 2.0
@ -25,15 +25,50 @@ ApplicationWindow
anchors.fill: parent anchors.fill: parent
ToolButton { ToolButton {
text: qsTr("‹") text: qsTr("‹")
enabled: stack.currentItem.StackView.index > 0 enabled: stack.depth > 1
onClicked: stack.pop() onClicked: stack.pop()
} }
Item {
width: column.width
height: column.height
MouseArea {
anchors.fill: parent
onClicked: {
var dialog = app.messageDialog.createObject(app, {'message':
'Electrum is currently on ' + Network.networkName + ''
})
dialog.open()
}
}
Column {
id: column
visible: Network.isTestNet
Image {
anchors.horizontalCenter: parent.horizontalCenter
width: 16
height: 16
source: "../../icons/info.png"
}
Label {
id: networkNameLabel
text: Network.networkName
color: Material.accentColor //'orange'
font.pointSize: 5
}
}
}
Label { Label {
text: stack.currentItem.title text: stack.currentItem.title
elide: Label.ElideRight elide: Label.ElideRight
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
Layout.fillWidth: true Layout.fillWidth: true
font.pointSize: 10
font.bold: true
} }
ToolButton { ToolButton {
text: qsTr("⋮") text: qsTr("⋮")
@ -55,7 +90,7 @@ ApplicationWindow
Timer { Timer {
id: splashTimer id: splashTimer
interval: 1000 interval: 10
onTriggered: { onTriggered: {
splash.opacity = 0 splash.opacity = 0
} }
@ -73,8 +108,49 @@ ApplicationWindow
} }
} }
property alias newWalletWizard: _newWalletWizard
Component {
id: _newWalletWizard
NewWalletWizard {
parent: Overlay.overlay
x: 12
y: 12
width: parent.width - 24
height: parent.height - 24
Overlay.modal: Rectangle {
color: "#aa000000"
}
}
}
property alias messageDialog: _messageDialog
Component {
id: _messageDialog
Dialog {
parent: Overlay.overlay
modal: true
x: (parent.width - width) / 2
y: (parent.height - height) / 2
title: "Message"
property alias message: messageLabel.text
Label {
id: messageLabel
text: "Lorem ipsum dolor sit amet..."
}
}
}
Component.onCompleted: { Component.onCompleted: {
Daemon.load_wallet() Daemon.load_wallet()
splashTimer.start() splashTimer.start()
} }
onClosing: {
// destroy most GUI components so that we don't dump so many null reference warnings on exit
app.header.visible = false
mainStackView.clear()
}
} }

Loading…
Cancel
Save