Files
purple-electrumwallet/electrum/gui/qml/components/Wallets.qml
T

130 lines
4.1 KiB
QML
Raw Normal View History

2021-04-05 12:24:45 +02:00
import QtQuick 2.6
import QtQuick.Layouts 1.0
2022-06-15 18:19:04 +02:00
import QtQuick.Controls 2.3
2022-03-16 22:32:16 +01:00
import QtQuick.Controls.Material 2.0
2021-04-05 12:24:45 +02:00
import org.electrum 1.0
import "controls"
2021-04-07 16:50:34 +02:00
Pane {
id: rootItem
objectName: 'Wallets'
2021-04-05 12:24:45 +02:00
padding: 0
2022-06-15 18:19:04 +02:00
function createWallet() {
var dialog = app.newWalletWizard.createObject(rootItem)
dialog.open()
dialog.walletCreated.connect(function() {
Daemon.availableWallets.reload()
// and load the new wallet
Daemon.load_wallet(dialog.path, dialog.wizard_data['password'])
})
}
2021-04-07 16:50:34 +02:00
ColumnLayout {
id: rootLayout
2021-04-05 12:24:45 +02:00
width: parent.width
2021-04-06 14:13:51 +02:00
height: parent.height
spacing: 0
2021-04-05 12:24:45 +02:00
ColumnLayout {
2022-05-10 19:31:25 +02:00
Layout.preferredWidth: parent.width
Layout.margins: constants.paddingLarge
2021-04-05 12:24:45 +02:00
Heading {
text: qsTr('Wallets')
2021-04-07 16:50:34 +02:00
}
2022-05-10 19:31:25 +02:00
Frame {
id: detailsFrame
Layout.preferredWidth: parent.width
Layout.fillHeight: true
verticalPadding: 0
horizontalPadding: 0
background: PaneInsetBackground {}
2022-03-24 21:10:01 +01:00
2022-05-10 19:31:25 +02:00
ListView {
id: listview
anchors.fill: parent
2022-05-10 19:31:25 +02:00
clip: true
model: Daemon.availableWallets
delegate: ItemDelegate {
2022-05-10 19:31:25 +02:00
width: ListView.view.width
height: row.height
onClicked: {
Daemon.load_wallet(model.path)
}
2022-05-10 19:31:25 +02:00
RowLayout {
id: row
spacing: 10
x: constants.paddingSmall
width: parent.width - 2 * constants.paddingSmall
Image {
id: walleticon
source: "../../icons/wallet.png"
fillMode: Image.PreserveAspectFit
Layout.preferredWidth: constants.iconSizeLarge
Layout.preferredHeight: constants.iconSizeLarge
Layout.topMargin: constants.paddingSmall
Layout.bottomMargin: constants.paddingSmall
2022-05-10 19:31:25 +02:00
}
Label {
font.pixelSize: constants.fontSizeLarge
text: model.name
color: model.active ? Material.foreground : Qt.darker(Material.foreground, 1.20)
2022-05-10 19:31:25 +02:00
Layout.fillWidth: true
}
Tag {
visible: Daemon.currentWallet && model.name == Daemon.currentWallet.name
text: qsTr('Current')
border.color: Material.foreground
font.bold: true
labelcolor: Material.foreground
}
Tag {
visible: model.active
text: qsTr('Active')
border.color: 'green'
labelcolor: 'green'
}
Tag {
visible: !model.active
text: qsTr('Not loaded')
border.color: 'grey'
labelcolor: 'grey'
2022-03-24 21:10:01 +01:00
}
2022-03-10 12:25:18 +01:00
}
2021-04-07 16:50:34 +02:00
}
2022-03-24 21:10:01 +01:00
2022-05-10 19:31:25 +02:00
ScrollIndicator.vertical: ScrollIndicator { }
}
2021-04-06 14:13:51 +02:00
}
2022-03-24 21:10:01 +01:00
}
2021-04-06 14:13:51 +02:00
FlatButton {
Layout.fillWidth: true
2021-04-07 16:50:34 +02:00
text: 'Create Wallet'
2023-02-07 14:16:29 +01:00
icon.source: '../../icons/add.png'
2022-06-15 18:19:04 +02:00
onClicked: rootItem.createWallet()
2021-04-05 12:24:45 +02:00
}
}
2022-03-10 12:25:18 +01:00
Connections {
target: Daemon
function onWalletLoaded() {
Daemon.availableWallets.reload()
2022-03-10 12:25:18 +01:00
app.stack.pop()
}
}
2021-04-05 12:24:45 +02:00
}