qml: show 2FA status and billing info in WalletDetails, expose billing schedule setting in config
This commit is contained in:
@@ -163,13 +163,86 @@ Pane {
|
||||
}
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
visible: Daemon.currentWallet && Daemon.currentWallet.walletType == '2fa'
|
||||
Layout.preferredWidth: parent.width
|
||||
|
||||
columns: 2
|
||||
|
||||
Label {
|
||||
text: qsTr('2FA')
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: Daemon.currentWallet.canSignWithoutServer
|
||||
? qsTr('disabled (can sign without server')
|
||||
: qsTr('enabled')
|
||||
}
|
||||
|
||||
Label {
|
||||
visible: !Daemon.currentWallet.canSignWithoutServer
|
||||
text: qsTr('Remaining TX')
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
visible: !Daemon.currentWallet.canSignWithoutServer
|
||||
text: 'tx_remaining' in Daemon.currentWallet.billingInfo
|
||||
? Daemon.currentWallet.billingInfo['tx_remaining']
|
||||
: qsTr('unknown')
|
||||
}
|
||||
|
||||
Label {
|
||||
Layout.columnSpan: 2
|
||||
visible: !Daemon.currentWallet.canSignWithoutServer
|
||||
text: qsTr('Billing')
|
||||
color: Material.accentColor
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.columnSpan: 2
|
||||
Layout.leftMargin: constants.paddingMedium
|
||||
spacing: 0
|
||||
|
||||
ButtonGroup {
|
||||
id: billinggroup
|
||||
onCheckedButtonChanged: {
|
||||
Config.trustedcoinPrepay = checkedButton.value
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: AppController.plugin('trustedcoin').billingModel
|
||||
delegate: RowLayout {
|
||||
RadioButton {
|
||||
ButtonGroup.group: billinggroup
|
||||
property string value: modelData.value
|
||||
text: modelData.text
|
||||
checked: modelData.value == Config.trustedcoinPrepay
|
||||
}
|
||||
Label {
|
||||
text: Config.formatSats(modelData.sats_per_tx)
|
||||
font.family: FixedFont
|
||||
}
|
||||
Label {
|
||||
text: Config.baseUnit + '/tx'
|
||||
color: Material.accentColor
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GridLayout {
|
||||
id: detailsLayout
|
||||
visible: Daemon.currentWallet
|
||||
Layout.preferredWidth: parent.width
|
||||
|
||||
columns: 2
|
||||
|
||||
Label {
|
||||
text: qsTr('Derivation prefix')
|
||||
visible: Daemon.currentWallet.isDeterministic
|
||||
|
||||
@@ -166,6 +166,17 @@ class QEConfig(AuthMixin, QObject):
|
||||
self.config.set_key('use_recoverable_channels', useRecoverableChannels)
|
||||
self.useRecoverableChannelsChanged.emit()
|
||||
|
||||
trustedcoinPrepayChanged = pyqtSignal()
|
||||
@pyqtProperty(int, notify=trustedcoinPrepayChanged)
|
||||
def trustedcoinPrepay(self):
|
||||
return self.config.get('trustedcoin_prepay', 20)
|
||||
|
||||
@trustedcoinPrepay.setter
|
||||
def trustedcoinPrepay(self, num_prepay):
|
||||
if num_prepay != self.config.get('trustedcoin_prepay', 20):
|
||||
self.config.set_key('trustedcoin_prepay', num_prepay)
|
||||
self.trustedcoinPrepayChanged.emit()
|
||||
|
||||
@pyqtSlot('qint64', result=str)
|
||||
@pyqtSlot('qint64', bool, result=str)
|
||||
@pyqtSlot(QEAmount, result=str)
|
||||
|
||||
@@ -301,6 +301,11 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
||||
def isLightning(self):
|
||||
return bool(self.wallet.lnworker)
|
||||
|
||||
billingInfoChanged = pyqtSignal()
|
||||
@pyqtProperty('QVariantMap', notify=billingInfoChanged)
|
||||
def billingInfo(self):
|
||||
return {} if self.wallet.wallet_type != '2fa' else self.wallet.billing_info
|
||||
|
||||
@pyqtProperty(bool, notify=dataChanged)
|
||||
def canHaveLightning(self):
|
||||
return self.wallet.can_have_lightning()
|
||||
@@ -349,6 +354,10 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
|
||||
def masterPubkey(self):
|
||||
return self.wallet.get_master_public_key()
|
||||
|
||||
@pyqtProperty(bool, notify=dataChanged)
|
||||
def canSignWithoutServer(self):
|
||||
return self.wallet.can_sign_without_server() if self.wallet.wallet_type == '2fa' else True
|
||||
|
||||
balanceChanged = pyqtSignal()
|
||||
|
||||
@pyqtProperty(QEAmount, notify=balanceChanged)
|
||||
|
||||
Reference in New Issue
Block a user