refactor & update currency modal to look and work like designs

update gitignore

display list of currencies
This commit is contained in:
Iuri Matias 2020-06-04 12:00:07 -04:00
parent 68047eb8fd
commit df9a6d0f07
11 changed files with 624 additions and 29 deletions

2
.gitignore vendored
View File

@ -1,4 +1,4 @@
data/ /data
noBackup/ noBackup/
.idea .idea
*.pro.user *.pro.user

View File

@ -4,6 +4,7 @@ import QtQuick.Layouts 1.3
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import "../../../../imports" import "../../../../imports"
import "../../../../shared" import "../../../../shared"
import "../data/"
Item { Item {
id: element id: element
@ -26,7 +27,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 16 anchors.rightMargin: 16
anchors.topMargin: 16 anchors.topMargin: 16
source: "../../../img/close.svg" source: "../../../../shared/img/close.svg"
MouseArea { MouseArea {
id: closeModalMouseArea id: closeModalMouseArea
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
@ -42,30 +43,56 @@ Item {
anchors.top: modalDialogTitle.bottom anchors.top: modalDialogTitle.bottom
} }
ButtonGroup {
id: currencyGroup
}
Item { Item {
id: modalBody id: modalBody
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 32 anchors.rightMargin: 32
anchors.top: headerSeparator.bottom anchors.top: headerSeparator.top
anchors.topMargin: Theme.padding anchors.topMargin: Theme.padding
anchors.bottom: footerSeparator.top anchors.bottom: footerSeparator.top
anchors.bottomMargin: 16 anchors.bottomMargin: Theme.padding
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 32 anchors.leftMargin: 32
Input { ListView {
id: txtCurrency
label: "Currency"
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 0 anchors.topMargin: 10
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: 0 anchors.right: parent.right
placeholderText: qsTr("USD") anchors.bottom: parent.bottom
text: currency 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 { Separator {
@ -81,8 +108,7 @@ Item {
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.padding anchors.bottomMargin: Theme.padding
onClicked: { onClicked: {
console.log(txtCurrency.textField.text) console.log("TODO: apply all accounts")
assetsModel.setDefaultCurrency(txtCurrency.textField.text)
popup.close() popup.close()
} }
} }

View File

@ -5,7 +5,7 @@ import Qt.labs.platform 1.1
import "../../../../imports" import "../../../../imports"
import "../../../../shared" import "../../../../shared"
import "../../Chat/ContactsColumn" import "../../Chat/ContactsColumn"
import "../tokens/" import "../data/"
Item { Item {
id: element id: element
@ -27,7 +27,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: Theme.padding anchors.rightMargin: Theme.padding
anchors.topMargin: Theme.padding anchors.topMargin: Theme.padding
source: "../../../img/close.svg" source: "../../../../shared/img/close.svg"
MouseArea { MouseArea {
id: closeModalMouseArea id: closeModalMouseArea
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor

View File

@ -1,4 +1,4 @@
SendModalContent 1.0 SendModalContent.qml SendModalContent 1.0 SendModalContent.qml
SettingsModalContent 1.0 SettingsModalContent.qml SetCurrencyModalContent 1.0 SetCurrencyModalContent.qml
TokenSettingsModalContent 1.0 TokenSettingsModalContent.qml TokenSettingsModalContent 1.0 TokenSettingsModalContent.qml
AddAccount 1.0 AddAccount.qml AddAccount 1.0 AddAccount.qml

View File

@ -9,7 +9,7 @@ import "./Components"
Item { Item {
function open() { function open() {
popup.open() popup.open()
settingsModalContent.currency = walletModel.defaultCurrency setCurrencyModalContent.currency = walletModel.defaultCurrency
} }
function close() { function close() {
@ -33,8 +33,8 @@ Item {
radius: Theme.radius radius: Theme.radius
} }
padding: 0 padding: 0
contentItem: SettingsModalContent { contentItem: SetCurrencyModalContent {
id: settingsModalContent id: setCurrencyModalContent
} }
} }
} }

View File

@ -69,8 +69,8 @@ Item {
id: sendModal id: sendModal
} }
SettingsModal{ SetCurrencyModal{
id: settingsModal id: setCurrencyModal
} }
TokenSettingsModal{ TokenSettingsModal{
@ -190,7 +190,7 @@ Item {
text: qsTr("Set Currency") text: qsTr("Set Currency")
icon.source: "../../img/set_currency.svg" icon.source: "../../img/set_currency.svg"
onTriggered: { onTriggered: {
settingsModal.open() setCurrencyModal.open()
} }
} }
} }

View File

@ -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}
}
##^##*/

View File

@ -0,0 +1,2 @@
Tokens 1.0 Tokens.qml
Currencies 1.0 Currencies.qml

View File

@ -1 +0,0 @@
Tokens 1.0 Tokens.qml

View File

@ -81,7 +81,7 @@ DISTFILES += \
app/AppLayouts/Wallet/CollectiblesTab.qml \ app/AppLayouts/Wallet/CollectiblesTab.qml \
app/AppLayouts/Wallet/Components/AddAccount.qml \ app/AppLayouts/Wallet/Components/AddAccount.qml \
app/AppLayouts/Wallet/Components/SendModalContent.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/TokenSettingsModalContent.qml \
app/AppLayouts/Wallet/Components/qmldir \ app/AppLayouts/Wallet/Components/qmldir \
app/AppLayouts/Wallet/HistoryTab.qml \ app/AppLayouts/Wallet/HistoryTab.qml \
@ -99,10 +99,11 @@ DISTFILES += \
app/AppLayouts/Profile/qmldir \ app/AppLayouts/Profile/qmldir \
app/AppLayouts/Wallet/LeftTab.qml \ app/AppLayouts/Wallet/LeftTab.qml \
app/AppLayouts/Wallet/SendModal.qml \ app/AppLayouts/Wallet/SendModal.qml \
app/AppLayouts/Wallet/SettingsModal.qml \ app/AppLayouts/Wallet/SetCurrencyModal.qml \
app/AppLayouts/Wallet/TokenSettingsModal.qml \ app/AppLayouts/Wallet/TokenSettingsModal.qml \
app/AppLayouts/Wallet/WalletHeader.qml \ app/AppLayouts/Wallet/WalletHeader.qml \
app/AppLayouts/Wallet/WalletLayout.qml \ app/AppLayouts/Wallet/WalletLayout.qml \
app/AppLayouts/Wallet/data/Currencies.qml \
app/AppLayouts/Wallet/qmldir \ app/AppLayouts/Wallet/qmldir \
app/AppLayouts/Wallet/tokens/Tokens.qml \ app/AppLayouts/Wallet/tokens/Tokens.qml \
app/AppLayouts/Wallet/tokens/qmldir \ app/AppLayouts/Wallet/tokens/qmldir \