2023-05-10 11:05:45 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
|
2024-01-30 13:15:58 +00:00
|
|
|
import StatusQ.Core 0.1
|
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
QtObject {
|
2023-12-18 10:12:57 +00:00
|
|
|
id: root
|
|
|
|
|
2023-09-26 13:45:44 +00:00
|
|
|
readonly property string currentCurrency: "USD"
|
|
|
|
property string currentCurrencySymbol: "$"
|
|
|
|
|
|
|
|
function formatCurrencyAmount(amount, symbol, options = null, locale = null) {
|
2024-01-30 13:15:58 +00:00
|
|
|
if (isNaN(amount)) {
|
|
|
|
return "N/A"
|
|
|
|
}
|
|
|
|
var currencyAmount = getCurrencyAmount(amount, symbol)
|
|
|
|
return LocaleUtils.currencyAmountToLocaleString(currencyAmount, options, locale)
|
2023-09-26 13:45:44 +00:00
|
|
|
}
|
|
|
|
|
2024-02-05 16:44:49 +00:00
|
|
|
function getFiatValue(balance, cryptoSymbol) {
|
2023-09-26 13:45:44 +00:00
|
|
|
return balance
|
|
|
|
}
|
2023-12-18 10:12:57 +00:00
|
|
|
|
|
|
|
function getCurrencyAmount(amount, symbol) {
|
|
|
|
return ({
|
|
|
|
amount: amount,
|
|
|
|
symbol: symbol ? symbol.toUpperCase() : root.currentCurrency,
|
|
|
|
displayDecimals: 2,
|
|
|
|
stripTrailingZeroes: false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
function getCurrentCurrencyAmount(amount) {
|
|
|
|
return ({
|
|
|
|
amount: amount,
|
|
|
|
symbol: root.currentCurrency,
|
|
|
|
displayDecimals: 2,
|
|
|
|
stripTrailingZeroes: false
|
|
|
|
})
|
|
|
|
}
|
2023-09-26 13:45:44 +00:00
|
|
|
}
|