From c3a234908df5f171388bcebd2bb5a2d81ba87698 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Cie=C5=9Blak?= Date: Tue, 24 Sep 2024 11:10:45 +0200 Subject: [PATCH] CurrenciesStore: static model removed from store --- storybook/pages/LanguageViewPage.qml | 27 - .../stubs/shared/stores/CurrenciesStore.qml | 3 +- .../Profile/views/CurrenciesModel.qml | 932 +++++++++++++++++ .../AppLayouts/Profile/views/LanguageView.qml | 27 +- ui/app/AppLayouts/Profile/views/qmldir | 3 +- ui/app/AppLayouts/Wallet/stores/RootStore.qml | 4 - .../Wallet/views/AssetsDetailView.qml | 6 +- ui/imports/shared/stores/CurrenciesStore.qml | 948 +----------------- 8 files changed, 961 insertions(+), 989 deletions(-) create mode 100644 ui/app/AppLayouts/Profile/views/CurrenciesModel.qml diff --git a/storybook/pages/LanguageViewPage.qml b/storybook/pages/LanguageViewPage.qml index f7ddc9a70c..94666a39e1 100644 --- a/storybook/pages/LanguageViewPage.qml +++ b/storybook/pages/LanguageViewPage.qml @@ -72,33 +72,6 @@ SplitView { currencyStore: CurrenciesStore { property string currentCurrency: "USD" - property string currentCurrencySymbol: "$" - - readonly property ListModel currenciesModel: ListModel { - ListElement { - key: "usd" - shortName: "USD" - name: "US Dollars" - symbol: "$" - category: "" - imageSource: "../../assets/twemoji/svg/1f1fa-1f1f8.svg" - selected: true - } - - ListElement { - key: "gbp" - shortName: "GBP" - name: "British Pound" - symbol: "£" - category: "" - imageSource: "../../assets/twemoji/svg/1f1ec-1f1e7.svg" - selected: false - } - } - - function updateCurrenciesModel() { - logs.logEvent("currencyStore::updateCurrenciesModel") - } function updateCurrency(currencyKey) { logs.logEvent("currencyStore::updateCurrency", ["currencyKey"], arguments) diff --git a/storybook/stubs/shared/stores/CurrenciesStore.qml b/storybook/stubs/shared/stores/CurrenciesStore.qml index ba3acdab67..827e5923ba 100644 --- a/storybook/stubs/shared/stores/CurrenciesStore.qml +++ b/storybook/stubs/shared/stores/CurrenciesStore.qml @@ -6,8 +6,7 @@ import StatusQ.Core.Utils 0.1 as SQUtils QtObject { id: root - readonly property string currentCurrency: "USD" - property string currentCurrencySymbol: "$" + /*readonly*/ property string currentCurrency: "USD" function formatCurrencyAmount(amount, symbol, options = null, locale = null) { if (isNaN(amount)) { diff --git a/ui/app/AppLayouts/Profile/views/CurrenciesModel.qml b/ui/app/AppLayouts/Profile/views/CurrenciesModel.qml new file mode 100644 index 0000000000..c0cf3831c6 --- /dev/null +++ b/ui/app/AppLayouts/Profile/views/CurrenciesModel.qml @@ -0,0 +1,932 @@ +import QtQuick 2.15 + +ListModel { + ListElement { + key: "usd" + shortName: "USD" + name: qsTr("US Dollars") + symbol: "$" + category: "" + imageSource: "../../assets/twemoji/svg/1f1fa-1f1f8.svg" + selected: false + isToken: false + } + + ListElement { + key: "gbp" + shortName: "GBP" + name: qsTr("British Pound") + symbol: "£" + category: "" + imageSource: "../../assets/twemoji/svg/1f1ec-1f1e7.svg" + selected: false + isToken: false + } + + ListElement { + key: "eur" + shortName: "EUR" + name: qsTr("Euros") + symbol: "€" + category: "" + imageSource: "../../assets/twemoji/svg/1f1ea-1f1fa.svg" + selected: false + isToken: false + } + + ListElement { + key: "rub" + shortName: "RUB" + name: qsTr("Russian ruble") + symbol: "₽" + category: "" + imageSource: "../../assets/twemoji/svg/1f1f7-1f1fa.svg" + selected: false + isToken: false + } + + ListElement { + key: "krw" + shortName: "KRW" + name: qsTr("South Korean won") + symbol: "₩" + category: "" + imageSource: "../../assets/twemoji/svg/1f1f0-1f1f7.svg" + selected: false + isToken: false + } + + ListElement { + key: "eth" + shortName: "ETH" + name: qsTr("Ethereum") + symbol: "Ξ" + category: qsTr("Tokens") + imageSource: "../../../../imports/assets/png/tokens/ETH.png" + selected: false + isToken: true + } + + ListElement { + key: "btc" + shortName: "BTC" + name: qsTr("Bitcoin") + symbol: "฿" + category: qsTr("Tokens") + imageSource: "../../../../imports/assets/png/tokens/WBTC.png" + selected: false + isToken: true + } + + ListElement { + key: "stn" + shortName: "SNT" + name: qsTr("Status Network Token") + symbol: "" + category: qsTr("Tokens") + imageSource: "../../../../imports/assets/png/tokens/SNT.png" + selected: false + isToken: true + } + + ListElement { + key: "dai" + shortName: "DAI" + name: qsTr("Dai") + symbol: "◈" + category: qsTr("Tokens") + imageSource: "../../../../imports/assets/png/tokens/DAI.png" + selected: false + isToken: true + } + + ListElement { + key: "aed" + shortName: "AED" + name: qsTr("United Arab Emirates dirham") + symbol: "د.إ" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e6-1f1ea.svg" + selected: false + isToken: false + } + + ListElement { + key: "afn" + shortName: "AFN" + name: qsTr("Afghan afghani") + symbol: "؋" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e6-1f1eb.svg" + selected: false + isToken: false + } + + ListElement { + key: "ars" + shortName: "ARS" + name: qsTr("Argentine peso") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e6-1f1f7.svg" + selected: false + isToken: false + } + + ListElement { + key: "aud" + shortName: "AUD" + name: qsTr("Australian dollar") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e6-1f1fa.svg" + selected: false + isToken: false + } + + ListElement { + key: "bbd" + shortName: "BBD" + name: qsTr("Barbadian dollar") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e7-1f1e7.svg" + selected: false + isToken: false + } + + ListElement { + key: "bdt" + shortName: "BDT" + name: qsTr("Bangladeshi taka") + symbol: "Tk" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e7-1f1e9.svg" + selected: false + isToken: false + } + + ListElement { + key: "bgn" + shortName: "BGN" + name: qsTr("Bulgarian lev") + symbol: "лв" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e7-1f1ec.svg" + selected: false + isToken: false + } + + ListElement { + key: "bhd" + shortName: "BHD" + name: qsTr("Bahraini dinar") + symbol: "BD" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e7-1f1ed.svg" + selected: false + isToken: false + } + + ListElement { + key: "bnd" + shortName: "BND" + name: qsTr("Brunei dollar") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e7-1f1f3.svg" + selected: false + isToken: false + } + + ListElement { + key: "bob" + shortName: "BOB" + name: qsTr("Bolivian boliviano") + symbol: "$b" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e7-1f1f4.svg" + selected: false + isToken: false + } + + ListElement { + key: "brl" + shortName: "BRL" + name: qsTr("Brazillian real") + symbol: "R$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e7-1f1f7.svg" + selected: false + isToken: false + } + + ListElement { + key: "btn" + shortName: "BTN" + name: qsTr("Bhutanese ngultrum") + symbol: "Nu." + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e7-1f1f9.svg" + selected: false + isToken: false + } + + ListElement { + key: "cad" + shortName: "CAD" + name: qsTr("Canadian dollar") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e8-1f1e6.svg" + selected: false + isToken: false + } + + ListElement { + key: "chf" + shortName: "CHF" + name: qsTr("Swiss franc") + symbol: "CHF" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e8-1f1ed.svg" + selected: false + isToken: false + } + + ListElement { + key: "clp" + shortName: "CLP" + name: qsTr("Chilean peso") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e8-1f1f1.svg" + selected: false + isToken: false + } + + ListElement { + key: "cny" + shortName: "CNY" + name: qsTr("Chinese yuan") + symbol: "¥" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e8-1f1f3.svg" + selected: false + isToken: false + } + + ListElement { + key: "cop" + shortName: "COP" + name: qsTr("Colombian peso") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e8-1f1f4.svg" + selected: false + isToken: false + } + + ListElement { + key: "crc" + shortName: "CRC" + name: qsTr("Costa Rican colón") + symbol: "₡" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e8-1f1f7.svg" + selected: false + isToken: false + } + + ListElement { + key: "czk" + shortName: "CZK" + name: qsTr("Czech koruna") + symbol: "Kč" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e8-1f1ff.svg" + selected: false + isToken: false + } + + ListElement { + key: "dkk" + shortName: "DKK" + name: qsTr("Danish krone") + symbol: "kr" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e9-1f1f0.svg" + selected: false + isToken: false + } + + ListElement { + key: "dop" + shortName: "DOP" + name: qsTr("Dominican peso") + symbol: "RD$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1e9-1f1f4.svg" + selected: false + isToken: false + } + + ListElement { + key: "egp" + shortName: "EGP" + name: qsTr("Egyptian pound") + symbol: "£" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ea-1f1ec.svg" + selected: false + isToken: false + } + + ListElement { + key: "etb" + shortName: "ETB" + name: qsTr("Ethiopian birr") + symbol: "Br" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ea-1f1f9.svg" + selected: false + isToken: false + } + + ListElement { + key: "gel" + shortName: "GEL" + name: qsTr("Georgian lari") + symbol: "₾" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ec-1f1ea.svg" + selected: false + isToken: false + } + + ListElement { + key: "ghs" + shortName: "GHS" + name: qsTr("Ghanaian cedi") + symbol: "¢" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ec-1f1ed.svg" + selected: false + isToken: false + } + + ListElement { + key: "hkd" + shortName: "HKD" + name: qsTr("Hong Kong dollar") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ed-1f1f0.svg" + selected: false + isToken: false + } + + ListElement { + key: "hrk" + shortName: "HRK" + name: qsTr("Croatian kuna") + symbol: "kn" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ed-1f1f7.svg" + selected: false + isToken: false + } + + ListElement { + key: "huf" + shortName: "HUF" + name: qsTr("Hungarian forint") + symbol: "Ft" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ed-1f1fa.svg" + selected: false + isToken: false + } + + ListElement { + key: "idr" + shortName: "IDR" + name: qsTr("Indonesian rupiah") + symbol: "Rp" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ee-1f1e9.svg" + selected: false + isToken: false + } + + ListElement { + key: "ils" + shortName: "ILS" + name: qsTr("Israeli new shekel") + symbol: "₪" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ee-1f1f1.svg" + selected: false + isToken: false + } + + ListElement { + key: "inr" + shortName: "INR" + name: qsTr("Indian rupee") + symbol: "₹" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ee-1f1f3.svg" + selected: false + isToken: false + } + + ListElement { + key: "isk" + shortName: "ISK" + name: qsTr("Icelandic króna") + symbol: "kr" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ee-1f1f8.svg" + selected: false + isToken: false + } + + ListElement { + key: "jmd" + shortName: "JMD" + name: qsTr("Jamaican dollar") + symbol: "J$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ef-1f1f2.svg" + selected: false + isToken: false + } + + ListElement { + key: "jpy" + shortName: "JPY" + name: qsTr("Japanese yen") + symbol: "¥" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ef-1f1f5.svg" + selected: false + isToken: false + } + + ListElement { + key: "kes" + shortName: "KES" + name: qsTr("Kenyan shilling") + symbol: "KSh" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f0-1f1ea.svg" + selected: false + isToken: false + } + + ListElement { + key: "kwd" + shortName: "KWD" + name: qsTr("Kuwaiti dinar") + symbol: "د.ك" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f0-1f1fc.svg" + selected: false + isToken: false + } + + ListElement { + key: "kzt" + shortName: "KZT" + name: qsTr("Kazakhstani tenge") + symbol: "лв" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f0-1f1ff.svg" + selected: false + isToken: false + } + + ListElement { + key: "lkr" + shortName: "LKR" + name: qsTr("Sri Lankan rupee") + symbol: "₨" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f1-1f1f0.svg" + selected: false + isToken: false + } + + ListElement { + key: "mad" + shortName: "MAD" + name: qsTr("Moroccan dirham") + symbol: "MAD" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f2-1f1e6.svg" + selected: false + isToken: false + } + + ListElement { + key: "mdl" + shortName: "MDL" + name: qsTr("Moldovan leu") + symbol: "MDL" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f2-1f1e9.svg" + selected: false + isToken: false + } + + ListElement { + key: "mur" + shortName: "MUR" + name: qsTr("Mauritian rupee") + symbol: "₨" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f2-1f1f7.svg" + selected: false + isToken: false + } + + ListElement { + key: "mwk" + shortName: "MWK" + name: qsTr("Malawian kwacha") + symbol: "MK" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f2-1f1fc.svg" + selected: false + isToken: false + } + + ListElement { + key: "mxn" + shortName: "MXN" + name: qsTr("Mexican peso") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f2-1f1fd.svg" + selected: false + isToken: false + } + + ListElement { + key: "myr" + shortName: "MYR" + name: qsTr("Malaysian ringgit") + symbol: "RM" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f2-1f1fe.svg" + selected: false + isToken: false + } + + ListElement { + key: "mzn" + shortName: "MZN" + name: qsTr("Mozambican metical") + symbol: "MT" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f2-1f1ff.svg" + selected: false + isToken: false + } + + ListElement { + key: "nad" + shortName: "NAD" + name: qsTr("Namibian dollar") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f3-1f1e6.svg" + selected: false + isToken: false + } + + ListElement { + key: "ngn" + shortName: "NGN" + name: qsTr("Nigerian naira") + symbol: "₦" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f3-1f1ec.svg" + selected: false + isToken: false + } + + ListElement { + key: "nok" + shortName: "NOK" + name: qsTr("Norwegian krone") + symbol: "kr" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f3-1f1f4.svg" + selected: false + isToken: false + } + + ListElement { + key: "npr" + shortName: "NPR" + name: qsTr("Nepalese rupee") + symbol: "₨" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f3-1f1f5.svg" + selected: false + isToken: false + } + + ListElement { + key: "nzd" + shortName: "NZD" + name: qsTr("New Zealand dollar") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f3-1f1ff.svg" + selected: false + isToken: false + } + + ListElement { + key: "omr" + shortName: "OMR" + name: qsTr("Omani rial") + symbol: "﷼" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f4-1f1f2.svg" + selected: false + } + + ListElement { + key: "pen" + shortName: "PEN" + name: qsTr("Peruvian sol") + symbol: "S/." + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f5-1f1ea.svg" + selected: false + isToken: false + } + + ListElement { + key: "pgk" + shortName: "PGK" + name: qsTr("Papua New Guinean kina") + symbol: "K" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f5-1f1ec.svg" + selected: false + isToken: false + } + + ListElement { + key: "php" + shortName: "PHP" + name: qsTr("Philippine peso") + symbol: "₱" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f5-1f1ed.svg" + selected: false + isToken: false + } + + ListElement { + key: "pkr" + shortName: "PKR" + name: qsTr("Pakistani rupee") + symbol: "₨" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f5-1f1f0.svg" + selected: false + isToken: false + } + + ListElement { + key: "pln" + shortName: "PLN" + name: qsTr("Polish złoty") + symbol: "zł" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f5-1f1f1.svg" + selected: false + isToken: false + } + + ListElement { + key: "pyg" + shortName: "PYG" + name: qsTr("Paraguayan guaraní") + symbol: "Gs" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f5-1f1fe.svg" + selected: false + isToken: false + } + + ListElement { + key: "qar" + shortName: "QAR" + name: qsTr("Qatari riyal") + symbol: "﷼" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f6-1f1e6.svg" + selected: false + isToken: false + } + + ListElement { + key: "ron" + shortName: "RON" + name: qsTr("Romanian leu") + symbol: "lei" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f7-1f1f4.svg" + selected: false + isToken: false + } + + ListElement { + key: "rsd" + shortName: "RSD" + name: qsTr("Serbian dinar") + symbol: "Дин." + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f7-1f1f8.svg" + selected: false + isToken: false + } + + ListElement { + key: "sar" + shortName: "SAR" + name: qsTr("Saudi riyal") + symbol: "﷼" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f8-1f1e6.svg" + selected: false + isToken: false + } + + ListElement { + key: "sek" + shortName: "SEK" + name: qsTr("Swedish krona") + symbol: "kr" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f8-1f1ea.svg" + selected: false + isToken: false + } + + ListElement { + key: "sgd" + shortName: "SGD" + name: qsTr("Singapore dollar") + symbol: "$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f8-1f1ec.svg" + selected: false + isToken: false + } + + ListElement { + key: "thb" + shortName: "THB" + name: qsTr("Thai baht") + symbol: "฿" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f9-1f1ed.svg" + selected: false + isToken: false + } + + ListElement { + key: "ttd" + shortName: "TTD" + name: qsTr("Trinidad and Tobago dollar") + symbol: "TT$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f9-1f1f9.svg" + selected: false + isToken: false + } + + ListElement { + key: "twd" + shortName: "TWD" + name: qsTr("New Taiwan dollar") + symbol: "NT$" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f9-1f1fc.svg" + selected: false + isToken: false + } + + ListElement { + key: "tzs" + shortName: "TZS" + name: qsTr("Tanzanian shilling") + symbol: "TSh" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f9-1f1ff.svg" + selected: false + isToken: false + } + + ListElement { + key: "try" + shortName: "TRY" + name: qsTr("Turkish lira") + symbol: "₺" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1f9-1f1f7.svg" + selected: false + isToken: false + } + + ListElement { + key: "uah" + shortName: "UAH" + name: qsTr("Ukrainian hryvnia") + symbol: "₴" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1fa-1f1e6.svg" + selected: false + isToken: false + } + + ListElement { + key: "ugx" + shortName: "UGX" + name: qsTr("Ugandan shilling") + symbol: "USh" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1fa-1f1ec.svg" + selected: false + isToken: false + } + + ListElement { + key: "uyu" + shortName: "UYU" + name: qsTr("Uruguayan peso") + symbol: "$U" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1fa-1f1fe.svg" + selected: false + isToken: false + } + + ListElement { + key: "vef" + shortName: "VEF" + name: qsTr("Venezuelan bolívar") + symbol: "Bs" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1fb-1f1ea.svg" + selected: false + isToken: false + } + + ListElement { + key: "vnd" + shortName: "VND" + name: qsTr("Vietnamese đồng") + symbol: "₫" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1fb-1f1f3.svg" + selected: false + isToken: false + } + + ListElement { + key: "zar" + shortName: "ZAR" + name: qsTr("South African rand") + symbol: "R" + category: qsTr("Other Fiat") + imageSource: "../../assets/twemoji/svg/1f1ff-1f1e6.svg" + selected: false + isToken: false + } + + function setSelected(shortName) { + let isSelected = false + + for(let i = 0; i < count; i++) { + if(shortName === get(i).shortName) { + get(i).selected = true + isSelected = true + } else { + get(i).selected = false + } + } + + // Set default: + if(!isSelected) + get(0).selected = true + } +} diff --git a/ui/app/AppLayouts/Profile/views/LanguageView.qml b/ui/app/AppLayouts/Profile/views/LanguageView.qml index ae9fa6b727..a04cc28572 100644 --- a/ui/app/AppLayouts/Profile/views/LanguageView.qml +++ b/ui/app/AppLayouts/Profile/views/LanguageView.qml @@ -31,9 +31,6 @@ SettingsContentBase { onVisibleChanged: { if(!visible) root.setViewIdleState()} onBaseAreaClicked: { root.setViewIdleState() } - Component.onCompleted: { - root.currencyStore.updateCurrenciesModel() - } function setViewIdleState() { currencyPicker.close() @@ -62,17 +59,35 @@ SettingsContentBase { property string newKey + // updateCurrency function operation blocks a little bit the UI + // so getting around it with a small pause (timer) in order to get + // the desired visual behavior Timer { id: currencyPause interval: 100 onTriggered: { - // updateCurrency function operation blocks a little bit the UI so getting around it with a small pause (timer) in order to get the desired visual behavior - root.currencyStore.updateCurrency(currencyPicker.newKey) + const idx = StatusQUtils.ModelUtils.indexOf(currenciesModel, "key", currencyPicker.newKey) + const shortName = currenciesModel.get(idx === -1 ? 0 : idx).shortName + root.currencyStore.updateCurrency(shortName) } } z: root.z + 2 - inputList: root.currencyStore.currenciesModel + + inputList: CurrenciesModel { + id: currenciesModel + + readonly property Connections connections: Connections { + target: root.currencyStore + + function onCurrentCurrencyChanged() { + currenciesModel.setSelected(root.currencyStore.currentCurrency) + } + } + + Component.onCompleted: setSelected(root.currencyStore.currentCurrency) + } + printSymbol: true placeholderSearchText: qsTr("Search Currencies") maxPickerHeight: 350 diff --git a/ui/app/AppLayouts/Profile/views/qmldir b/ui/app/AppLayouts/Profile/views/qmldir index 5b60d23ec1..ae9757614b 100644 --- a/ui/app/AppLayouts/Profile/views/qmldir +++ b/ui/app/AppLayouts/Profile/views/qmldir @@ -2,7 +2,8 @@ AboutView 1.0 AboutView.qml AppearanceView 1.0 AppearanceView.qml ChangePasswordView 1.0 ChangePasswordView.qml CommunitiesView 1.0 CommunitiesView.qml +CurrenciesModel 1.0 CurrenciesModel.qml LanguageView 1.0 LanguageView.qml NotificationsView 1.0 NotificationsView.qml -SyncingView 1.0 SyncingView.qml PrivacyAndSecurityView 1.0 PrivacyAndSecurityView.qml +SyncingView 1.0 SyncingView.qml diff --git a/ui/app/AppLayouts/Wallet/stores/RootStore.qml b/ui/app/AppLayouts/Wallet/stores/RootStore.qml index 65211e3b3f..0e8cf81666 100644 --- a/ui/app/AppLayouts/Wallet/stores/RootStore.qml +++ b/ui/app/AppLayouts/Wallet/stores/RootStore.qml @@ -231,10 +231,6 @@ QtObject { return walletSectionAccounts.deleteAccount(address) } - function updateCurrency(newCurrency) { - walletSection.updateCurrency(newCurrency) - } - function getQrCode(address) { return globalUtils.qrCode(address) } diff --git a/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml b/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml index 4cc4c3eb85..5ed691c6cb 100644 --- a/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml +++ b/ui/app/AppLayouts/Wallet/views/AssetsDetailView.qml @@ -228,7 +228,7 @@ Item { return graphDetail.dateToShortLabel(value) }, valueCallback: function(value) { - return LocaleUtils.currencyAmountToLocaleString({ amount: value, symbol: RootStore.currencyStore.currentCurrencySymbol, displayDecimals: 2 }) + return root.currencyStore.formatCurrencyAmount(value, root.currencyStore.currentCurrency) } }, intersect: false, @@ -243,7 +243,9 @@ Item { if (graphDetail.selectedGraphType === AssetsDetailView.GraphType.Balance) return label + tooltipItem.yLabel // already formatted in tooltips.value.callback - const value = LocaleUtils.currencyAmountToLocaleString({ amount: tooltipItem.yLabel, symbol: RootStore.currencyStore.currentCurrencySymbol, displayDecimals: 2 }) + const value = root.currencyStore.formatCurrencyAmount( + tooltipItem.yLabel, root.currencyStore.currentCurrency) + return label + value } } diff --git a/ui/imports/shared/stores/CurrenciesStore.qml b/ui/imports/shared/stores/CurrenciesStore.qml index 55a307d7e7..5cea43ecd0 100644 --- a/ui/imports/shared/stores/CurrenciesStore.qml +++ b/ui/imports/shared/stores/CurrenciesStore.qml @@ -13,955 +13,9 @@ QtObject { // We should probably refactor this and move those functions to some Wallet module. property var _profileSectionModuleInst: profileSectionModule - function getModelIndexForKey(key) { - const idx = SQUtils.ModelUtils.indexOf(currenciesModel, "key", key) - return idx === -1 ? 0 : idx - } - - function getModelIndexForShortName(shortName) { - const idx = SQUtils.ModelUtils.indexOf(currenciesModel, "shortName", shortName) - return idx === -1 ? 0 : idx - } - readonly property string currentCurrency: Global.appIsReady ? walletSection.currentCurrency : "" - readonly property int currentCurrencyModelIndex: getModelIndexForShortName(currentCurrency) - readonly property string currentCurrencySymbol: currenciesModel.get(currentCurrencyModelIndex).symbol ?? Qt.locale().currencySymbol(Locale.CurrencySymbol) - property ListModel currenciesModel: ListModel { - ListElement { - key: "usd" - shortName: "USD" - name: qsTr("US Dollars") - symbol: "$" - category: "" - imageSource: "../../assets/twemoji/svg/1f1fa-1f1f8.svg" - selected: false - isToken: false - } - - ListElement { - key: "gbp" - shortName: "GBP" - name: qsTr("British Pound") - symbol: "£" - category: "" - imageSource: "../../assets/twemoji/svg/1f1ec-1f1e7.svg" - selected: false - isToken: false - } - - ListElement { - key: "eur" - shortName: "EUR" - name: qsTr("Euros") - symbol: "€" - category: "" - imageSource: "../../assets/twemoji/svg/1f1ea-1f1fa.svg" - selected: false - isToken: false - } - - ListElement { - key: "rub" - shortName: "RUB" - name: qsTr("Russian ruble") - symbol: "₽" - category: "" - imageSource: "../../assets/twemoji/svg/1f1f7-1f1fa.svg" - selected: false - isToken: false - } - - ListElement { - key: "krw" - shortName: "KRW" - name: qsTr("South Korean won") - symbol: "₩" - category: "" - imageSource: "../../assets/twemoji/svg/1f1f0-1f1f7.svg" - selected: false - isToken: false - } - - ListElement { - key: "eth" - shortName: "ETH" - name: qsTr("Ethereum") - symbol: "Ξ" - category: qsTr("Tokens") - imageSource: "../../../../imports/assets/png/tokens/ETH.png" - selected: false - isToken: true - } - - ListElement { - key: "btc" - shortName: "BTC" - name: qsTr("Bitcoin") - symbol: "฿" - category: qsTr("Tokens") - imageSource: "../../../../imports/assets/png/tokens/WBTC.png" - selected: false - isToken: true - } - - ListElement { - key: "stn" - shortName: "SNT" - name: qsTr("Status Network Token") - symbol: "" - category: qsTr("Tokens") - imageSource: "../../../../imports/assets/png/tokens/SNT.png" - selected: false - isToken: true - } - - ListElement { - key: "dai" - shortName: "DAI" - name: qsTr("Dai") - symbol: "◈" - category: qsTr("Tokens") - imageSource: "../../../../imports/assets/png/tokens/DAI.png" - selected: false - isToken: true - } - - ListElement { - key: "aed" - shortName: "AED" - name: qsTr("United Arab Emirates dirham") - symbol: "د.إ" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e6-1f1ea.svg" - selected: false - isToken: false - } - - ListElement { - key: "afn" - shortName: "AFN" - name: qsTr("Afghan afghani") - symbol: "؋" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e6-1f1eb.svg" - selected: false - isToken: false - } - - ListElement { - key: "ars" - shortName: "ARS" - name: qsTr("Argentine peso") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e6-1f1f7.svg" - selected: false - isToken: false - } - - ListElement { - key: "aud" - shortName: "AUD" - name: qsTr("Australian dollar") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e6-1f1fa.svg" - selected: false - isToken: false - } - - ListElement { - key: "bbd" - shortName: "BBD" - name: qsTr("Barbadian dollar") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e7-1f1e7.svg" - selected: false - isToken: false - } - - ListElement { - key: "bdt" - shortName: "BDT" - name: qsTr("Bangladeshi taka") - symbol: "Tk" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e7-1f1e9.svg" - selected: false - isToken: false - } - - ListElement { - key: "bgn" - shortName: "BGN" - name: qsTr("Bulgarian lev") - symbol: "лв" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e7-1f1ec.svg" - selected: false - isToken: false - } - - ListElement { - key: "bhd" - shortName: "BHD" - name: qsTr("Bahraini dinar") - symbol: "BD" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e7-1f1ed.svg" - selected: false - isToken: false - } - - ListElement { - key: "bnd" - shortName: "BND" - name: qsTr("Brunei dollar") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e7-1f1f3.svg" - selected: false - isToken: false - } - - ListElement { - key: "bob" - shortName: "BOB" - name: qsTr("Bolivian boliviano") - symbol: "$b" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e7-1f1f4.svg" - selected: false - isToken: false - } - - ListElement { - key: "brl" - shortName: "BRL" - name: qsTr("Brazillian real") - symbol: "R$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e7-1f1f7.svg" - selected: false - isToken: false - } - - ListElement { - key: "btn" - shortName: "BTN" - name: qsTr("Bhutanese ngultrum") - symbol: "Nu." - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e7-1f1f9.svg" - selected: false - isToken: false - } - - ListElement { - key: "cad" - shortName: "CAD" - name: qsTr("Canadian dollar") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e8-1f1e6.svg" - selected: false - isToken: false - } - - ListElement { - key: "chf" - shortName: "CHF" - name: qsTr("Swiss franc") - symbol: "CHF" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e8-1f1ed.svg" - selected: false - isToken: false - } - - ListElement { - key: "clp" - shortName: "CLP" - name: qsTr("Chilean peso") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e8-1f1f1.svg" - selected: false - isToken: false - } - - ListElement { - key: "cny" - shortName: "CNY" - name: qsTr("Chinese yuan") - symbol: "¥" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e8-1f1f3.svg" - selected: false - isToken: false - } - - ListElement { - key: "cop" - shortName: "COP" - name: qsTr("Colombian peso") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e8-1f1f4.svg" - selected: false - isToken: false - } - - ListElement { - key: "crc" - shortName: "CRC" - name: qsTr("Costa Rican colón") - symbol: "₡" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e8-1f1f7.svg" - selected: false - isToken: false - } - - ListElement { - key: "czk" - shortName: "CZK" - name: qsTr("Czech koruna") - symbol: "Kč" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e8-1f1ff.svg" - selected: false - isToken: false - } - - ListElement { - key: "dkk" - shortName: "DKK" - name: qsTr("Danish krone") - symbol: "kr" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e9-1f1f0.svg" - selected: false - isToken: false - } - - ListElement { - key: "dop" - shortName: "DOP" - name: qsTr("Dominican peso") - symbol: "RD$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1e9-1f1f4.svg" - selected: false - isToken: false - } - - ListElement { - key: "egp" - shortName: "EGP" - name: qsTr("Egyptian pound") - symbol: "£" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ea-1f1ec.svg" - selected: false - isToken: false - } - - ListElement { - key: "etb" - shortName: "ETB" - name: qsTr("Ethiopian birr") - symbol: "Br" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ea-1f1f9.svg" - selected: false - isToken: false - } - - ListElement { - key: "gel" - shortName: "GEL" - name: qsTr("Georgian lari") - symbol: "₾" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ec-1f1ea.svg" - selected: false - isToken: false - } - - ListElement { - key: "ghs" - shortName: "GHS" - name: qsTr("Ghanaian cedi") - symbol: "¢" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ec-1f1ed.svg" - selected: false - isToken: false - } - - ListElement { - key: "hkd" - shortName: "HKD" - name: qsTr("Hong Kong dollar") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ed-1f1f0.svg" - selected: false - isToken: false - } - - ListElement { - key: "hrk" - shortName: "HRK" - name: qsTr("Croatian kuna") - symbol: "kn" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ed-1f1f7.svg" - selected: false - isToken: false - } - - ListElement { - key: "huf" - shortName: "HUF" - name: qsTr("Hungarian forint") - symbol: "Ft" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ed-1f1fa.svg" - selected: false - isToken: false - } - - ListElement { - key: "idr" - shortName: "IDR" - name: qsTr("Indonesian rupiah") - symbol: "Rp" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ee-1f1e9.svg" - selected: false - isToken: false - } - - ListElement { - key: "ils" - shortName: "ILS" - name: qsTr("Israeli new shekel") - symbol: "₪" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ee-1f1f1.svg" - selected: false - isToken: false - } - - ListElement { - key: "inr" - shortName: "INR" - name: qsTr("Indian rupee") - symbol: "₹" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ee-1f1f3.svg" - selected: false - isToken: false - } - - ListElement { - key: "isk" - shortName: "ISK" - name: qsTr("Icelandic króna") - symbol: "kr" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ee-1f1f8.svg" - selected: false - isToken: false - } - - ListElement { - key: "jmd" - shortName: "JMD" - name: qsTr("Jamaican dollar") - symbol: "J$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ef-1f1f2.svg" - selected: false - isToken: false - } - - ListElement { - key: "jpy" - shortName: "JPY" - name: qsTr("Japanese yen") - symbol: "¥" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ef-1f1f5.svg" - selected: false - isToken: false - } - - ListElement { - key: "kes" - shortName: "KES" - name: qsTr("Kenyan shilling") - symbol: "KSh" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f0-1f1ea.svg" - selected: false - isToken: false - } - - ListElement { - key: "kwd" - shortName: "KWD" - name: qsTr("Kuwaiti dinar") - symbol: "د.ك" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f0-1f1fc.svg" - selected: false - isToken: false - } - - ListElement { - key: "kzt" - shortName: "KZT" - name: qsTr("Kazakhstani tenge") - symbol: "лв" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f0-1f1ff.svg" - selected: false - isToken: false - } - - ListElement { - key: "lkr" - shortName: "LKR" - name: qsTr("Sri Lankan rupee") - symbol: "₨" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f1-1f1f0.svg" - selected: false - isToken: false - } - - ListElement { - key: "mad" - shortName: "MAD" - name: qsTr("Moroccan dirham") - symbol: "MAD" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f2-1f1e6.svg" - selected: false - isToken: false - } - - ListElement { - key: "mdl" - shortName: "MDL" - name: qsTr("Moldovan leu") - symbol: "MDL" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f2-1f1e9.svg" - selected: false - isToken: false - } - - ListElement { - key: "mur" - shortName: "MUR" - name: qsTr("Mauritian rupee") - symbol: "₨" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f2-1f1f7.svg" - selected: false - isToken: false - } - - ListElement { - key: "mwk" - shortName: "MWK" - name: qsTr("Malawian kwacha") - symbol: "MK" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f2-1f1fc.svg" - selected: false - isToken: false - } - - ListElement { - key: "mxn" - shortName: "MXN" - name: qsTr("Mexican peso") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f2-1f1fd.svg" - selected: false - isToken: false - } - - ListElement { - key: "myr" - shortName: "MYR" - name: qsTr("Malaysian ringgit") - symbol: "RM" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f2-1f1fe.svg" - selected: false - isToken: false - } - - ListElement { - key: "mzn" - shortName: "MZN" - name: qsTr("Mozambican metical") - symbol: "MT" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f2-1f1ff.svg" - selected: false - isToken: false - } - - ListElement { - key: "nad" - shortName: "NAD" - name: qsTr("Namibian dollar") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f3-1f1e6.svg" - selected: false - isToken: false - } - - ListElement { - key: "ngn" - shortName: "NGN" - name: qsTr("Nigerian naira") - symbol: "₦" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f3-1f1ec.svg" - selected: false - isToken: false - } - - ListElement { - key: "nok" - shortName: "NOK" - name: qsTr("Norwegian krone") - symbol: "kr" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f3-1f1f4.svg" - selected: false - isToken: false - } - - ListElement { - key: "npr" - shortName: "NPR" - name: qsTr("Nepalese rupee") - symbol: "₨" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f3-1f1f5.svg" - selected: false - isToken: false - } - - ListElement { - key: "nzd" - shortName: "NZD" - name: qsTr("New Zealand dollar") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f3-1f1ff.svg" - selected: false - isToken: false - } - - ListElement { - key: "omr" - shortName: "OMR" - name: qsTr("Omani rial") - symbol: "﷼" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f4-1f1f2.svg" - selected: false - } - - ListElement { - key: "pen" - shortName: "PEN" - name: qsTr("Peruvian sol") - symbol: "S/." - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f5-1f1ea.svg" - selected: false - isToken: false - } - - ListElement { - key: "pgk" - shortName: "PGK" - name: qsTr("Papua New Guinean kina") - symbol: "K" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f5-1f1ec.svg" - selected: false - isToken: false - } - - ListElement { - key: "php" - shortName: "PHP" - name: qsTr("Philippine peso") - symbol: "₱" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f5-1f1ed.svg" - selected: false - isToken: false - } - - ListElement { - key: "pkr" - shortName: "PKR" - name: qsTr("Pakistani rupee") - symbol: "₨" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f5-1f1f0.svg" - selected: false - isToken: false - } - - ListElement { - key: "pln" - shortName: "PLN" - name: qsTr("Polish złoty") - symbol: "zł" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f5-1f1f1.svg" - selected: false - isToken: false - } - - ListElement { - key: "pyg" - shortName: "PYG" - name: qsTr("Paraguayan guaraní") - symbol: "Gs" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f5-1f1fe.svg" - selected: false - isToken: false - } - - ListElement { - key: "qar" - shortName: "QAR" - name: qsTr("Qatari riyal") - symbol: "﷼" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f6-1f1e6.svg" - selected: false - isToken: false - } - - ListElement { - key: "ron" - shortName: "RON" - name: qsTr("Romanian leu") - symbol: "lei" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f7-1f1f4.svg" - selected: false - isToken: false - } - - ListElement { - key: "rsd" - shortName: "RSD" - name: qsTr("Serbian dinar") - symbol: "Дин." - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f7-1f1f8.svg" - selected: false - isToken: false - } - - ListElement { - key: "sar" - shortName: "SAR" - name: qsTr("Saudi riyal") - symbol: "﷼" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f8-1f1e6.svg" - selected: false - isToken: false - } - - ListElement { - key: "sek" - shortName: "SEK" - name: qsTr("Swedish krona") - symbol: "kr" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f8-1f1ea.svg" - selected: false - isToken: false - } - - ListElement { - key: "sgd" - shortName: "SGD" - name: qsTr("Singapore dollar") - symbol: "$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f8-1f1ec.svg" - selected: false - isToken: false - } - - ListElement { - key: "thb" - shortName: "THB" - name: qsTr("Thai baht") - symbol: "฿" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f9-1f1ed.svg" - selected: false - isToken: false - } - - ListElement { - key: "ttd" - shortName: "TTD" - name: qsTr("Trinidad and Tobago dollar") - symbol: "TT$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f9-1f1f9.svg" - selected: false - isToken: false - } - - ListElement { - key: "twd" - shortName: "TWD" - name: qsTr("New Taiwan dollar") - symbol: "NT$" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f9-1f1fc.svg" - selected: false - isToken: false - } - - ListElement { - key: "tzs" - shortName: "TZS" - name: qsTr("Tanzanian shilling") - symbol: "TSh" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f9-1f1ff.svg" - selected: false - isToken: false - } - - ListElement { - key: "try" - shortName: "TRY" - name: qsTr("Turkish lira") - symbol: "₺" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1f9-1f1f7.svg" - selected: false - isToken: false - } - - ListElement { - key: "uah" - shortName: "UAH" - name: qsTr("Ukrainian hryvnia") - symbol: "₴" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1fa-1f1e6.svg" - selected: false - isToken: false - } - - ListElement { - key: "ugx" - shortName: "UGX" - name: qsTr("Ugandan shilling") - symbol: "USh" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1fa-1f1ec.svg" - selected: false - isToken: false - } - - ListElement { - key: "uyu" - shortName: "UYU" - name: qsTr("Uruguayan peso") - symbol: "$U" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1fa-1f1fe.svg" - selected: false - isToken: false - } - - ListElement { - key: "vef" - shortName: "VEF" - name: qsTr("Venezuelan bolívar") - symbol: "Bs" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1fb-1f1ea.svg" - selected: false - isToken: false - } - - ListElement { - key: "vnd" - shortName: "VND" - name: qsTr("Vietnamese đồng") - symbol: "₫" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1fb-1f1f3.svg" - selected: false - isToken: false - } - - ListElement { - key: "zar" - shortName: "ZAR" - name: qsTr("South African rand") - symbol: "R" - category: qsTr("Other Fiat") - imageSource: "../../assets/twemoji/svg/1f1ff-1f1e6.svg" - selected: false - isToken: false - } - } - - onCurrentCurrencyChanged: { updateCurrenciesModel() } - - function updateCurrenciesModel() { - var isSelected = false - for(var i = 0; i < currenciesModel.count; i++) { - if(root.currentCurrency === root.currenciesModel.get(i).shortName) { - root.currenciesModel.get(i).selected = isSelected = true - } - else { - root.currenciesModel.get(i).selected = false - } - } - - // Set default: - if(!isSelected) - root.currenciesModel.get(0).selected = true - } - - function updateCurrency(newCurrencyKey) { - let index = getModelIndexForKey(newCurrencyKey) - let shortName = root.currenciesModel.get(index).shortName + function updateCurrency(shortName) { walletSection.updateCurrency(shortName) }