diff --git a/.gitignore b/.gitignore index b89dcf032e..69b9ad758a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -data/ +/data noBackup/ .idea *.pro.user @@ -10,4 +10,4 @@ vendor/.nimble *.AppImage tmp nimcache -.DS_Store \ No newline at end of file +.DS_Store diff --git a/ui/app/AppLayouts/Wallet/Components/SettingsModalContent.qml b/ui/app/AppLayouts/Wallet/Components/SetCurrencyModalContent.qml similarity index 57% rename from ui/app/AppLayouts/Wallet/Components/SettingsModalContent.qml rename to ui/app/AppLayouts/Wallet/Components/SetCurrencyModalContent.qml index a101b2481e..4d038ac684 100644 --- a/ui/app/AppLayouts/Wallet/Components/SettingsModalContent.qml +++ b/ui/app/AppLayouts/Wallet/Components/SetCurrencyModalContent.qml @@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3 import Qt.labs.platform 1.1 import "../../../../imports" import "../../../../shared" +import "../data/" Item { id: element @@ -26,7 +27,7 @@ Item { anchors.right: parent.right anchors.rightMargin: 16 anchors.topMargin: 16 - source: "../../../img/close.svg" + source: "../../../../shared/img/close.svg" MouseArea { id: closeModalMouseArea cursorShape: Qt.PointingHandCursor @@ -42,30 +43,56 @@ Item { anchors.top: modalDialogTitle.bottom } + ButtonGroup { + id: currencyGroup + } + Item { id: modalBody anchors.right: parent.right anchors.rightMargin: 32 - anchors.top: headerSeparator.bottom + anchors.top: headerSeparator.top anchors.topMargin: Theme.padding anchors.bottom: footerSeparator.top - anchors.bottomMargin: 16 + anchors.bottomMargin: Theme.padding anchors.left: parent.left anchors.leftMargin: 32 - Input { - id: txtCurrency - label: "Currency" + ListView { anchors.top: parent.top - anchors.topMargin: 0 - anchors.right: parent.right - anchors.rightMargin: 0 + anchors.topMargin: 10 anchors.left: parent.left - anchors.leftMargin: 0 - placeholderText: qsTr("USD") - text: currency - } + anchors.right: parent.right + anchors.bottom: parent.bottom + spacing: 10 + id: tokenListView + model: Currencies {} + ScrollBar.vertical: ScrollBar { active: true } + delegate: Component { + Item { + id: element + anchors.right: parent.right + anchors.rightMargin: 0 + anchors.left: parent.left + anchors.leftMargin: 10 + width: parent.width + height: 52 + + Text { + text: name + " (" + code + ")" + font.pixelSize: 15 + } + + RadioButton { + checked: currency === key + anchors.right: parent.right + ButtonGroup.group: currencyGroup + onClicked: { walletModel.setDefaultCurrency(key) } + } + } + } + } } Separator { @@ -81,8 +108,7 @@ Item { anchors.bottom: parent.bottom anchors.bottomMargin: Theme.padding onClicked: { - console.log(txtCurrency.textField.text) - assetsModel.setDefaultCurrency(txtCurrency.textField.text) + console.log("TODO: apply all accounts") popup.close() } } diff --git a/ui/app/AppLayouts/Wallet/Components/TokenSettingsModalContent.qml b/ui/app/AppLayouts/Wallet/Components/TokenSettingsModalContent.qml index 92e20e39bd..6e1e9553b1 100644 --- a/ui/app/AppLayouts/Wallet/Components/TokenSettingsModalContent.qml +++ b/ui/app/AppLayouts/Wallet/Components/TokenSettingsModalContent.qml @@ -5,7 +5,7 @@ import Qt.labs.platform 1.1 import "../../../../imports" import "../../../../shared" import "../../Chat/ContactsColumn" -import "../tokens/" +import "../data/" Item { id: element @@ -27,7 +27,7 @@ Item { anchors.right: parent.right anchors.rightMargin: Theme.padding anchors.topMargin: Theme.padding - source: "../../../img/close.svg" + source: "../../../../shared/img/close.svg" MouseArea { id: closeModalMouseArea cursorShape: Qt.PointingHandCursor diff --git a/ui/app/AppLayouts/Wallet/Components/qmldir b/ui/app/AppLayouts/Wallet/Components/qmldir index 57ff9cf383..094f99577b 100644 --- a/ui/app/AppLayouts/Wallet/Components/qmldir +++ b/ui/app/AppLayouts/Wallet/Components/qmldir @@ -1,4 +1,4 @@ SendModalContent 1.0 SendModalContent.qml -SettingsModalContent 1.0 SettingsModalContent.qml +SetCurrencyModalContent 1.0 SetCurrencyModalContent.qml TokenSettingsModalContent 1.0 TokenSettingsModalContent.qml AddAccount 1.0 AddAccount.qml diff --git a/ui/app/AppLayouts/Wallet/SettingsModal.qml b/ui/app/AppLayouts/Wallet/SetCurrencyModal.qml similarity index 84% rename from ui/app/AppLayouts/Wallet/SettingsModal.qml rename to ui/app/AppLayouts/Wallet/SetCurrencyModal.qml index 0455b791ac..e973e7a250 100644 --- a/ui/app/AppLayouts/Wallet/SettingsModal.qml +++ b/ui/app/AppLayouts/Wallet/SetCurrencyModal.qml @@ -9,7 +9,7 @@ import "./Components" Item { function open() { popup.open() - settingsModalContent.currency = walletModel.defaultCurrency + setCurrencyModalContent.currency = walletModel.defaultCurrency } function close() { @@ -33,8 +33,8 @@ Item { radius: Theme.radius } padding: 0 - contentItem: SettingsModalContent { - id: settingsModalContent + contentItem: SetCurrencyModalContent { + id: setCurrencyModalContent } } } diff --git a/ui/app/AppLayouts/Wallet/WalletHeader.qml b/ui/app/AppLayouts/Wallet/WalletHeader.qml index 52570004e8..9973de5c5f 100644 --- a/ui/app/AppLayouts/Wallet/WalletHeader.qml +++ b/ui/app/AppLayouts/Wallet/WalletHeader.qml @@ -69,8 +69,8 @@ Item { id: sendModal } - SettingsModal{ - id: settingsModal + SetCurrencyModal{ + id: setCurrencyModal } TokenSettingsModal{ @@ -190,7 +190,7 @@ Item { text: qsTr("Set Currency") icon.source: "../../img/set_currency.svg" onTriggered: { - settingsModal.open() + setCurrencyModal.open() } } } diff --git a/ui/app/AppLayouts/Wallet/data/Currencies.qml b/ui/app/AppLayouts/Wallet/data/Currencies.qml new file mode 100644 index 0000000000..18260e581f --- /dev/null +++ b/ui/app/AppLayouts/Wallet/data/Currencies.qml @@ -0,0 +1,567 @@ +import QtQuick 2.3 +import QtQuick.Controls 2.3 +import QtQuick.Layouts 1.3 +import Qt.labs.platform 1.1 + +ListModel { + + ListElement { + key: "usd" + code: "USD" + name: qsTr("US Dollars") + symbol: "$" + } + + ListElement { + key: "eur" + code: "EUR" + name: qsTr("Euros") + symbol: "€" + } + + ListElement { + key: "aed" + code: "AED" + name: qsTr("") + symbol: "د.إ" + } + + ListElement { + key: "afn" + code: "AFN" + name: qsTr("") + symbol: "؋" + } + + ListElement { + key: "ars" + code: "ARS" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "aud" + code: "AUD" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "bbd" + code: "BBD" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "bdt" + code: "BDT" + name: qsTr("") + symbol: " Tk" + } + + ListElement { + key: "bgn" + code: "BGN" + name: qsTr("") + symbol: "лв" + } + + ListElement { + key: "bhd" + code: "BHD" + name: qsTr("") + symbol: "BD" + } + + ListElement { + key: "bnd" + code: "BND" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "bob" + code: "BOB" + name: qsTr("") + symbol: "$b" + } + + ListElement { + key: "brl" + code: "BRL" + name: qsTr("") + symbol: "R$" + } + + ListElement { + key: "btn" + code: "BTN" + name: qsTr("") + symbol: "Nu." + } + + ListElement { + key: "cad" + code: "CAD" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "chf" + code: "CHF" + name: qsTr("") + symbol: "CHF" + } + + ListElement { + key: "clp" + code: "CLP" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "cny" + code: "CNY" + name: qsTr("") + symbol: "¥" + } + + ListElement { + key: "cop" + code: "COP" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "crc" + code: "CRC" + name: qsTr("") + symbol: "₡" + } + + ListElement { + key: "czk" + code: "CZK" + name: qsTr("") + symbol: "Kč" + } + + ListElement { + key: "dkk" + code: "DKK" + name: qsTr("") + symbol: "kr" + } + + ListElement { + key: "dop" + code: "DOP" + name: qsTr("") + symbol: "RD$" + } + + ListElement { + key: "egp" + code: "EGP" + name: qsTr("") + symbol: "£" + } + + ListElement { + key: "etb" + code: "ETB" + name: qsTr("") + symbol: "Br" + } + + ListElement { + key: "gbp" + code: "GBP" + name: qsTr("") + symbol: "£" + } + + ListElement { + key: "gel" + code: "GEL" + name: qsTr("") + symbol: "₾" + } + + ListElement { + key: "ghs" + code: "GHS" + name: qsTr("") + symbol: "¢" + } + + ListElement { + key: "hkd" + code: "HKD" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "hrk" + code: "HRK" + name: qsTr("") + symbol: "kn" + } + + ListElement { + key: "huf" + code: "HUF" + name: qsTr("") + symbol: "Ft" + } + + ListElement { + key: "idr" + code: "IDR" + name: qsTr("") + symbol: "Rp" + } + + ListElement { + key: "ils" + code: "ILS" + name: qsTr("") + symbol: "₪" + } + + ListElement { + key: "inr" + code: "INR" + name: qsTr("") + symbol: "₹" + } + + ListElement { + key: "isk" + code: "ISK" + name: qsTr("") + symbol: "kr" + } + + ListElement { + key: "jmd" + code: "JMD" + name: qsTr("") + symbol: "J$" + } + + ListElement { + key: "jpy" + code: "JPY" + name: qsTr("") + symbol: "¥" + } + + ListElement { + key: "kes" + code: "KES" + name: qsTr("") + symbol: "KSh" + } + + ListElement { + key: "krw" + code: "KRW" + name: qsTr("") + symbol: "₩" + } + + ListElement { + key: "kwd" + code: "KWD" + name: qsTr("") + symbol: "د.ك" + } + + ListElement { + key: "kzt" + code: "KZT" + name: qsTr("") + symbol: "лв" + } + + ListElement { + key: "lkr" + code: "LKR" + name: qsTr("") + symbol: "₨" + } + + ListElement { + key: "mad" + code: "MAD" + name: qsTr("") + symbol: "MAD" + } + + ListElement { + key: "mdl" + code: "MDL" + name: qsTr("") + symbol: "MDL" + } + + ListElement { + key: "mur" + code: "MUR" + name: qsTr("") + symbol: "₨" + } + + ListElement { + key: "mwk" + code: "MWK" + name: qsTr("") + symbol: "MK" + } + + ListElement { + key: "mxn" + code: "MXN" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "myr" + code: "MYR" + name: qsTr("") + symbol: "RM" + } + + ListElement { + key: "mzn" + code: "MZN" + name: qsTr("") + symbol: "MT" + } + + ListElement { + key: "nad" + code: "NAD" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "ngn" + code: "NGN" + name: qsTr("") + symbol: "₦" + } + + ListElement { + key: "nok" + code: "NOK" + name: qsTr("") + symbol: "kr" + } + + ListElement { + key: "npr" + code: "NPR" + name: qsTr("") + symbol: "₨" + } + + ListElement { + key: "nzd" + code: "NZD" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "omr" + code: "OMR" + name: qsTr("") + symbol: "﷼" + } + + ListElement { + key: "pen" + code: "PEN" + name: qsTr("") + symbol: "S/." + } + + ListElement { + key: "pgk" + code: "PGK" + name: qsTr("") + symbol: "K" + } + + ListElement { + key: "php" + code: "PHP" + name: qsTr("") + symbol: "₱" + } + + ListElement { + key: "pkr" + code: "PKR" + name: qsTr("") + symbol: "₨" + } + + ListElement { + key: "pln" + code: "PLN" + name: qsTr("") + symbol: "zł" + } + + ListElement { + key: "pyg" + code: "PYG" + name: qsTr("") + symbol: "Gs" + } + + ListElement { + key: "qar" + code: "QAR" + name: qsTr("") + symbol: "﷼" + } + + ListElement { + key: "ron" + code: "RON" + name: qsTr("") + symbol: "lei" + } + + ListElement { + key: "rsd" + code: "RSD" + name: qsTr("") + symbol: "Дин." + } + + ListElement { + key: "rub" + code: "RUB" + name: qsTr("") + symbol: "₽" + } + + ListElement { + key: "sar" + code: "SAR" + name: qsTr("") + symbol: "﷼" + } + + ListElement { + key: "sek" + code: "SEK" + name: qsTr("") + symbol: "kr" + } + + ListElement { + key: "sgd" + code: "SGD" + name: qsTr("") + symbol: "$" + } + + ListElement { + key: "thb" + code: "THB" + name: qsTr("") + symbol: "฿" + } + + ListElement { + key: "ttd" + code: "TTD" + name: qsTr("") + symbol: "TT$" + } + + ListElement { + key: "twd" + code: "TWD" + name: qsTr("") + symbol: "NT$" + } + + ListElement { + key: "tzs" + code: "TZS" + name: qsTr("") + symbol: "TSh" + } + + ListElement { + key: "try" + code: "TRY" + name: qsTr("") + symbol: "₺" + } + + ListElement { + key: "uah" + code: "UAH" + name: qsTr("") + symbol: "₴" + } + + ListElement { + key: "ugx" + code: "UGX" + name: qsTr("") + symbol: "USh" + } + + ListElement { + key: "uyu" + code: "UYU" + name: qsTr("") + symbol: "$U" + } + + ListElement { + key: "vef" + code: "VEF" + name: qsTr("") + symbol: "Bs" + } + + ListElement { + key: "vnd" + code: "VND" + name: qsTr("") + symbol: "₫" + } + + ListElement { + key: "zar" + code: "ZAR" + name: qsTr("") + symbol: "R" + } + +} + +/*##^## +Designer { + D{i:0;autoSize:true;height:480;width:640} +} +##^##*/ diff --git a/ui/app/AppLayouts/Wallet/tokens/Tokens.qml b/ui/app/AppLayouts/Wallet/data/Tokens.qml similarity index 100% rename from ui/app/AppLayouts/Wallet/tokens/Tokens.qml rename to ui/app/AppLayouts/Wallet/data/Tokens.qml diff --git a/ui/app/AppLayouts/Wallet/data/qmldir b/ui/app/AppLayouts/Wallet/data/qmldir new file mode 100644 index 0000000000..4b2d05cbf3 --- /dev/null +++ b/ui/app/AppLayouts/Wallet/data/qmldir @@ -0,0 +1,2 @@ +Tokens 1.0 Tokens.qml +Currencies 1.0 Currencies.qml diff --git a/ui/app/AppLayouts/Wallet/tokens/qmldir b/ui/app/AppLayouts/Wallet/tokens/qmldir deleted file mode 100644 index f2dd8c3ffc..0000000000 --- a/ui/app/AppLayouts/Wallet/tokens/qmldir +++ /dev/null @@ -1 +0,0 @@ -Tokens 1.0 Tokens.qml \ No newline at end of file diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index 791b746fd0..f649480ffb 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -81,7 +81,7 @@ DISTFILES += \ app/AppLayouts/Wallet/CollectiblesTab.qml \ app/AppLayouts/Wallet/Components/AddAccount.qml \ app/AppLayouts/Wallet/Components/SendModalContent.qml \ - app/AppLayouts/Wallet/Components/SettingsModalContent.qml \ + app/AppLayouts/Wallet/Components/SetCurrencyModalContent.qml \ app/AppLayouts/Wallet/Components/TokenSettingsModalContent.qml \ app/AppLayouts/Wallet/Components/qmldir \ app/AppLayouts/Wallet/HistoryTab.qml \ @@ -99,10 +99,11 @@ DISTFILES += \ app/AppLayouts/Profile/qmldir \ app/AppLayouts/Wallet/LeftTab.qml \ app/AppLayouts/Wallet/SendModal.qml \ - app/AppLayouts/Wallet/SettingsModal.qml \ + app/AppLayouts/Wallet/SetCurrencyModal.qml \ app/AppLayouts/Wallet/TokenSettingsModal.qml \ app/AppLayouts/Wallet/WalletHeader.qml \ app/AppLayouts/Wallet/WalletLayout.qml \ + app/AppLayouts/Wallet/data/Currencies.qml \ app/AppLayouts/Wallet/qmldir \ app/AppLayouts/Wallet/tokens/Tokens.qml \ app/AppLayouts/Wallet/tokens/qmldir \