add currencies to preferences
This commit is contained in:
@@ -56,6 +56,15 @@ Pane {
|
|||||||
text: qsTr('Write logs to file')
|
text: qsTr('Write logs to file')
|
||||||
enabled: false
|
enabled: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: qsTr('Fiat Currency')
|
||||||
|
}
|
||||||
|
|
||||||
|
ComboBox {
|
||||||
|
id: currencies
|
||||||
|
model: Daemon.currencies
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -73,11 +82,13 @@ Pane {
|
|||||||
function save() {
|
function save() {
|
||||||
Config.baseUnit = baseUnit.currentValue
|
Config.baseUnit = baseUnit.currentValue
|
||||||
Config.thousandsSeparator = thousands.checked
|
Config.thousandsSeparator = thousands.checked
|
||||||
|
Config.fiatCurrency = currencies.currentValue ? currencies.currentValue : ''
|
||||||
app.stack.pop()
|
app.stack.pop()
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
baseUnit.currentIndex = ['BTC','mBTC','bits','sat'].indexOf(Config.baseUnit)
|
baseUnit.currentIndex = ['BTC','mBTC','bits','sat'].indexOf(Config.baseUnit)
|
||||||
thousands.checked = Config.thousandsSeparator
|
thousands.checked = Config.thousandsSeparator
|
||||||
|
currencies.currentIndex = currencies.indexOfValue(Config.fiatCurrency)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,6 +68,15 @@ class QEConfig(QObject):
|
|||||||
self.config.amt_add_thousands_sep = checked
|
self.config.amt_add_thousands_sep = checked
|
||||||
self.thousandsSeparatorChanged.emit()
|
self.thousandsSeparatorChanged.emit()
|
||||||
|
|
||||||
|
fiatCurrencyChanged = pyqtSignal()
|
||||||
|
@pyqtProperty(str, notify=fiatCurrencyChanged)
|
||||||
|
def fiatCurrency(self):
|
||||||
|
return self.config.get('currency')
|
||||||
|
|
||||||
|
@fiatCurrency.setter
|
||||||
|
def fiatCurrency(self, currency):
|
||||||
|
self.config.set_key('currency', currency)
|
||||||
|
self.fiatCurrencyChanged.emit()
|
||||||
|
|
||||||
@pyqtSlot(int, result=str)
|
@pyqtSlot(int, result=str)
|
||||||
@pyqtSlot(int, bool, result=str)
|
@pyqtSlot(int, bool, result=str)
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ class QEDaemon(QObject):
|
|||||||
activeWalletsChanged = pyqtSignal()
|
activeWalletsChanged = pyqtSignal()
|
||||||
availableWalletsChanged = pyqtSignal()
|
availableWalletsChanged = pyqtSignal()
|
||||||
walletOpenError = pyqtSignal([str], arguments=["error"])
|
walletOpenError = pyqtSignal([str], arguments=["error"])
|
||||||
|
currenciesChanged = pyqtSignal()
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
@@ -150,3 +151,7 @@ class QEDaemon(QObject):
|
|||||||
self._available_wallets = QEAvailableWalletListModel(self.daemon)
|
self._available_wallets = QEAvailableWalletListModel(self.daemon)
|
||||||
|
|
||||||
return self._available_wallets
|
return self._available_wallets
|
||||||
|
|
||||||
|
@pyqtProperty('QVariantList', notify=currenciesChanged)
|
||||||
|
def currencies(self):
|
||||||
|
return [''] + self.daemon.fx.get_currencies(False)
|
||||||
|
|||||||
Reference in New Issue
Block a user