fix(@desktop/wallet): move QML Wallet section to new architecture

fixes #3714
This commit is contained in:
Khushboo Mehta 2021-10-05 22:50:22 +02:00 committed by Iuri Matias
parent 49b6dd887a
commit 80de3f75eb
58 changed files with 1205 additions and 1087 deletions

View File

@ -5,7 +5,7 @@ import QtGraphicalEffects 1.13
import utils 1.0
import "../../../../shared"
import "../../../../shared/status"
import "../../Wallet"
import "../../Wallet/views"
import "../stores"
Popup {
@ -201,10 +201,10 @@ Popup {
anchors.bottom: parent.bottom
currentIndex: walletTabBar.currentIndex
AssetsTab {
AssetsView {
id: assetsTab
}
HistoryTab {
HistoryView {
id: historyTab
}
}

View File

@ -10,13 +10,14 @@ import StatusQ.Controls 0.1
import "../../../shared"
import "../../../shared/status"
import "../../../shared/popups"
import utils 1.0
import "./components"
import "./ChatColumn"
import "./ChatColumn/ChatComponents"
import "./data"
import "../Wallet"
Item {

View File

@ -6,7 +6,7 @@ import QtQuick.Dialogs 1.3
import utils 1.0
import "../../../../../shared"
import "../../../../../shared/status"
import "../../../Wallet/"
import "../../../../../shared/popups"
ModalPopup {
property var selectedAccount

View File

@ -5,7 +5,6 @@ import "../../../../../shared/status"
import utils 1.0
import "./TransactionComponents"
import "../../../Wallet/data"
Item {
property string communityId

View File

@ -3,7 +3,6 @@ import "../../../../../shared"
import utils 1.0
import "./TransactionComponents"
import "../../../Wallet/data"
Item {
property var commandParametersObject: {

View File

@ -1,107 +0,0 @@
import QtQuick 2.13
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.14
import utils 1.0
import "../../../shared"
Item {
height: assetListView.height
Component {
id: assetViewDelegate
Item {
id: element
anchors.right: parent.right
anchors.left: parent.left
height: 40
Image {
id: assetInfoImage
width: 36
height: 36
source: symbol ? Style.png("tokens/" + symbol) : ""
anchors.left: parent.left
anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter
onStatusChanged: {
if (assetInfoImage.status == Image.Error) {
assetInfoImage.source = Style.png("tokens/DEFAULT-TOKEN@3x")
}
}
}
StyledText {
id: assetSymbol
text: symbol
anchors.left: assetInfoImage.right
anchors.leftMargin: Style.current.smallPadding
anchors.top: assetInfoImage.top
anchors.topMargin: 0
font.pixelSize: 15
}
StyledText {
id: assetFullTokenName
text: name
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.left: assetInfoImage.right
anchors.leftMargin: Style.current.smallPadding
color: Style.current.secondaryText
font.pixelSize: 15
}
StyledText {
id: assetValue
text: value.toUpperCase() + " " + symbol
anchors.right: parent.right
anchors.rightMargin: 0
font.pixelSize: 15
font.strikeout: false
}
StyledText {
id: assetFiatValue
color: Style.current.secondaryText
text: Utils.toLocaleString(fiatBalance, globalSettings.locale) + " " + walletModel.balanceView.defaultCurrency.toUpperCase()
anchors.right: parent.right
anchors.rightMargin: 0
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
font.pixelSize: 15
}
}
}
ListModel {
id: exampleModel
ListElement {
value: "123 USD"
symbol: "ETH"
fullTokenName: "Ethereum"
fiatBalanceDisplay: "3423 ETH"
image: "token-icons/eth"
}
}
ScrollView {
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: assetListView.contentHeight > assetListView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
ListView {
id: assetListView
spacing: Style.current.padding * 2
anchors.fill: parent
// model: exampleModel
model: walletModel.tokensView.assets
delegate: assetViewDelegate
boundsBehavior: Flickable.StopAtBounds
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
}
##^##*/

View File

@ -1,292 +0,0 @@
import QtQuick 2.13
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import "./components"
import "./data"
import utils 1.0
import "../../../shared"
import "../../../shared/status/core"
import "../../../shared/status"
Item {
property int pageSize: 20 // number of transactions per page
property var tokens: {
let count = walletModel.tokensView.defaultTokenList.rowCount()
const toks = []
for (let i = 0; i < count; i++) {
toks.push({
"address": walletModel.tokensView.defaultTokenList.rowData(i, 'address'),
"symbol": walletModel.tokensView.defaultTokenList.rowData(i, 'symbol')
})
}
count = walletModel.tokensView.customTokenList.rowCount()
for (let j = 0; j < count; j++) {
toks.push({
"address": walletModel.customTokenList.rowData(j, 'address'),
"symbol": walletModel.customTokenList.rowData(j, 'symbol')
})
}
return toks
}
function fetchHistory() {
if (walletModel.historyView.isFetchingHistory(walletModel.accountsView.currentAccount.address)) {
loadingImg.active = true
} else {
walletModel.historyView.loadTransactionsForAccount(
walletModel.accountsView.currentAccount.address,
walletModel.transactionsView.transactions.getLastTxBlockNumber(),
pageSize,
true)
}
}
// function checkIfHistoryIsBeingFetched() {
// loadMoreButton.loadedMore = false;
// // prevent history from being fetched everytime you click on
// // the history tab
// if (walletModel.historyView.isHistoryFetched(walletModel.accountsView.currentAccount.account))
// return;
// fetchHistory();
// }
id: root
Loader {
id: loadingImg
active: false
sourceComponent: loadingImageComponent
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.top: parent.top
}
Component {
id: loadingImageComponent
StatusLoadingIndicator {}
}
Connections {
target: walletModel.historyView
// onHistoryWasFetched: checkIfHistoryIsBeingFetched()
onLoadingTrxHistoryChanged: {
if (walletModel.accountsView.currentAccount.address.toLowerCase() === address.toLowerCase()) {
loadingImg.active = isLoading
}
}
}
Component {
id: transactionListItemCmp
Rectangle {
id: transactionListItem
property bool isHovered: false
property string symbol: ""
property bool isIncoming: to === walletModel.accountsView.currentAccount.address
anchors.right: parent.right
anchors.left: parent.left
height: 64
color: isHovered ? Style.current.secondaryBackground : Style.current.transparent
radius: 8
Component.onCompleted: {
const count = root.tokens.length
for (var i = 0; i < count; i++) {
let token = root.tokens[i]
if (token.address === contract) {
transactionListItem.symbol = token.symbol
break
}
}
}
MouseArea {
anchors.fill: parent
onClicked: transactionModal.open()
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onEntered: {
transactionListItem.isHovered = true
}
onExited: {
transactionListItem.isHovered = false
}
}
TransactionModal {
id: transactionModal
}
Row {
anchors.left: parent.left
anchors.leftMargin: Style.current.smallPadding
anchors.verticalCenter: parent.verticalCenter
spacing: 5
Image {
id: assetIcon
width: 40
height: 40
source: Style.png("tokens/"
+ (transactionListItem.symbol
!= "" ? transactionListItem.symbol : "ETH"))
anchors.verticalCenter: parent.verticalCenter
onStatusChanged: {
if (assetIcon.status == Image.Error) {
assetIcon.source = Style.png("tokens/DEFAULT-TOKEN@3x")
}
}
anchors.leftMargin: Style.current.padding
}
StyledText {
id: transferIcon
anchors.verticalCenter: parent.verticalCenter
height: 15
width: 15
color: isIncoming ? Style.current.success : Style.current.danger
text: isIncoming ? "↓" : "↑"
}
StyledText {
id: transactionValue
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Style.current.primaryTextFontSize
text: utilsModel.hex2Eth(value) + " " + transactionListItem.symbol
}
}
Row {
anchors.right: timeInfo.left
anchors.rightMargin: Style.current.smallPadding
anchors.top: parent.top
anchors.topMargin: Style.current.bigPadding
spacing: 5
StyledText {
text: isIncoming ?
//% "From "
qsTrId("from-") :
//% "To "
qsTrId("to-")
color: Style.current.secondaryText
font.pixelSize: Style.current.primaryTextFontSize
font.strikeout: false
}
Address {
id: addressValue
text: isIncoming ? fromAddress : to
maxWidth: 120
width: 120
horizontalAlignment: Text.AlignRight
font.pixelSize: Style.current.primaryTextFontSize
color: Style.current.textColor
}
}
Row {
id: timeInfo
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
anchors.top: parent.top
anchors.topMargin: Style.current.bigPadding
spacing: 5
StyledText {
text: " • "
font.weight: Font.Bold
color: Style.current.secondaryText
font.pixelSize: Style.current.primaryTextFontSize
}
StyledText {
id: timeIndicator
//% "At "
text: qsTrId("at-")
color: Style.current.secondaryText
font.pixelSize: Style.current.primaryTextFontSize
font.strikeout: false
}
StyledText {
id: timeValue
text: new Date(timestamp).toLocaleString(globalSettings.locale)
font.pixelSize: Style.current.primaryTextFontSize
anchors.rightMargin: Style.current.smallPadding
}
}
}
}
StyledText {
id: nonArchivalNodeError
visible: walletModel.isNonArchivalNode
height: visible ? implicitHeight : 0
anchors.top: parent.top
//% "Status Desktop is connected to a non-archival node. Transaction history may be incomplete."
text: qsTrId("status-desktop-is-connected-to-a-non-archival-node--transaction-history-may-be-incomplete-")
font.pixelSize: Style.current.primaryTextFontSize
color: Style.current.danger
}
StyledText {
id: noTxs
anchors.top: nonArchivalNodeError.bottom
visible: transactionListRoot.count === 0
height: visible ? implicitHeight : 0
//% "No transactions found"
text: qsTrId("no-transactions-found")
font.pixelSize: Style.current.primaryTextFontSize
}
ListView {
id: transactionListRoot
anchors.top: noTxs.bottom
anchors.topMargin: Style.current.padding
anchors.bottom: loadMoreButton.top
anchors.bottomMargin: Style.current.padding
width: parent.width
clip: true
boundsBehavior: Flickable.StopAtBounds
model: walletModel.transactionsView.transactions
delegate: transactionListItemCmp
ScrollBar.vertical: ScrollBar {
id: scrollBar
}
onCountChanged: {
if (loadMoreButton.loadedMore)
transactionListRoot.positionViewAtEnd();
}
}
StatusButton {
id: loadMoreButton
//% "Load More"
text: qsTrId("load-more")
// TODO: handle case when requested limit === transaction count -- there
// is currently no way to know that there are no more results
enabled: !loadingImg.active && walletModel.transactionsView.transactions.hasMore
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.padding
property bool loadedMore: false
onClicked: {
fetchHistory()
loadMoreButton.loadedMore = true
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -1,224 +0,0 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../shared"
import "./components"
Rectangle {
property int selectedAccount: 0
property var changeSelectedAccount: function(newIndex) {
if (newIndex > walletModel.accountsView.accounts) {
return
}
selectedAccount = newIndex
walletModel.setCurrentAccountByIndex(newIndex)
walletTabBar.currentIndex = 0;
}
id: walletInfoContainer
color: Style.current.secondaryMenuBackground
StyledText {
id: title
//% "Wallet"
text: qsTrId("wallet")
anchors.top: parent.top
anchors.topMargin: Style.current.padding
anchors.horizontalCenter: parent.horizontalCenter
font.weight: Font.Bold
font.pixelSize: 17
}
Item {
id: walletValueTextContainer
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.top: title.bottom
anchors.topMargin: Style.current.padding
height: childrenRect.height
StyledTextEdit {
id: walletAmountValue
color: Style.current.textColor
text: Utils.toLocaleString(walletModel.balanceView.totalFiatBalance, globalSettings.locale, {"currency": true}) + " " + walletModel.balanceView.defaultCurrency.toUpperCase()
selectByMouse: true
cursorVisible: true
readOnly: true
anchors.left: parent.left
font.weight: Font.Medium
font.pixelSize: 30
}
StyledText {
id: totalValue
color: Style.current.secondaryText
//% "Total value"
text: qsTrId("wallet-total-value")
anchors.left: walletAmountValue.left
anchors.top: walletAmountValue.bottom
font.weight: Font.Medium
font.pixelSize: 13
}
AddAccount {
anchors.top: parent.top
anchors.right: parent.right
}
}
Component {
id: walletDelegate
Rectangle {
property bool selected: index === selectedAccount
property bool hovered
id: rectangle
height: 64
color: {
if (selected) {
return Style.current.menuBackgroundActive
}
if (hovered) {
return Style.current.backgroundHoverLight
}
return Style.current.transparent
}
radius: Style.current.radius
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
SVGImage {
id: walletIcon
width: 12
height: 12
anchors.top: parent.top
anchors.topMargin: Style.current.smallPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
source: Style.svg("walletIcon")
}
ColorOverlay {
anchors.fill: walletIcon
source: walletIcon
color: Utils.getCurrentThemeAccountColor(iconColor) || Style.current.accountColors[0]
}
StyledText {
id: walletName
text: name
elide: Text.ElideRight
anchors.right: walletBalance.left
anchors.rightMargin: Style.current.smallPadding
anchors.top: parent.top
anchors.topMargin: Style.current.smallPadding
anchors.left: walletIcon.right
anchors.leftMargin: Style.current.smallPadding
font.pixelSize: 15
font.weight: Font.Medium
color: Style.current.textColor
}
StyledText {
id: walletAddress
font.family: Style.current.fontHexRegular.name
text: address
anchors.right: parent.right
anchors.rightMargin: parent.width/2
elide: Text.ElideMiddle
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.smallPadding
anchors.left: walletIcon.left
font.pixelSize: 15
font.weight: Font.Medium
color: Style.current.secondaryText
opacity: selected ? 0.7 : 1
}
StyledText {
id: walletBalance
text: isLoading ? "..." : Utils.toLocaleString(fiatBalance, globalSettings.locale, {"currency": true}) + " " + walletModel.balanceView.defaultCurrency.toUpperCase()
anchors.top: parent.top
anchors.topMargin: Style.current.smallPadding
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
font.pixelSize: 15
font.weight: Font.Medium
color: Style.current.textColor
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: {
rectangle.hovered = true
}
onExited: {
rectangle.hovered = false
}
onClicked: {
changeSelectedAccount(index)
}
}
}
}
ScrollView {
anchors.bottom: parent.bottom
anchors.top: walletValueTextContainer.bottom
anchors.topMargin: Style.current.padding
anchors.right: parent.right
anchors.left: parent.left
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: listView.contentHeight > listView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
ListView {
id: listView
spacing: 5
anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds
delegate: walletDelegate
ListModel {
id: exampleWalletModel
ListElement {
name: "Status account"
address: "0xcfc9f08bbcbcb80760e8cb9a3c1232d19662fc6f"
balance: "12.00 USD"
iconColor: "#7CDA00"
}
ListElement {
name: "Test account 1"
address: "0x2Ef1...E0Ba"
balance: "12.00 USD"
iconColor: "#FA6565"
}
ListElement {
name: "Status account"
address: "0x2Ef1...E0Ba"
balance: "12.00 USD"
iconColor: "#7CDA00"
}
}
model: walletModel.accountsView.accounts
// model: exampleWalletModel
}
}
}
/*##^##
Designer {
D{i:0;formeditorColor:"#ffffff";formeditorZoom:0.75;height:770;width:340}
}
##^##*/

View File

@ -2,12 +2,15 @@ import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import "../../../shared"
import "../Profile/Sections"
import "."
import StatusQ.Layout 0.1
import utils 1.0
import "popups"
import "panels"
import "views"
import "stores"
Item {
id: walletView
@ -21,6 +24,8 @@ Item {
SignPhraseModal {
id: signPhrasePopup
onRemindLaterClicked: hideSignPhraseModal = true
onAcceptClicked: appSettings.hideSignPhraseModal = true
}
SeedPhraseBackupWarning {
@ -36,9 +41,9 @@ Item {
width: walletView.width
Component.onCompleted: {
if(onboardingModel.firstTimeLogin){
onboardingModel.firstTimeLogin = false
walletModel.setInitialRange()
if(RootStore.firstTimeLogin){
RootStore.firstTimeLogin = false
RootStore.setInitialRange()
}
}
@ -47,104 +52,25 @@ Item {
interval: Constants.walletFetchRecentHistoryInterval
running: true
repeat: true
onTriggered: walletModel.transactionsView.checkRecentHistory()
onTriggered: RootStore.checkRecentHistory()
}
leftPanel: LeftTab {
leftPanel: LeftTabView {
id: leftTab
anchors.fill: parent
changeSelectedAccount: function(newIndex) {
if (newIndex > RootStore.accounts) {
return
}
selectedAccountIndex = newIndex
RootStore.setCurrentAccountByIndex(newIndex)
walletContainer.currentTabIndex = 0;
}
}
rightPanel: Item {
anchors.fill: parent
rightPanel: RightTabView {
id: walletContainer
WalletHeader {
id: walletHeader
changeSelectedAccount: leftTab.changeSelectedAccount
}
RowLayout {
id: walletInfoContainer
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
anchors.right: parent.right
anchors.rightMargin: 0
anchors.top: walletHeader.bottom
anchors.topMargin: 23
Item {
id: walletInfoContent
Layout.fillHeight: true
Layout.fillWidth: true
TabBar {
id: walletTabBar
anchors.right: parent.right
anchors.rightMargin: Style.current.bigPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.bigPadding
anchors.top: parent.top
anchors.topMargin: Style.current.padding
height: assetBtn.height
background: Rectangle {
color: Style.current.transparent
}
StatusTabButton {
id: assetBtn
//% "Assets"
btnText: qsTrId("wallet-assets")
}
StatusTabButton {
id: collectiblesBtn
anchors.left: assetBtn.right
anchors.leftMargin: 32
//% "Collectibles"
btnText: qsTrId("wallet-collectibles")
}
StatusTabButton {
id: historyBtn
anchors.left: collectiblesBtn.right
anchors.leftMargin: 32
//% "History"
btnText: qsTrId("history")
}
}
StackLayout {
id: stackLayout
anchors.rightMargin: Style.current.bigPadding
anchors.leftMargin: Style.current.bigPadding
anchors.top: walletTabBar.bottom
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.topMargin: Style.current.bigPadding
currentIndex: walletTabBar.currentIndex
AssetsTab {
id: assetsTab
}
CollectiblesTab {
id: collectiblesTab
}
HistoryTab {
id: historyTab
}
}
}
}
anchors.fill: parent
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:770;width:1152}
}
##^##*/

View File

@ -1,104 +0,0 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../shared"
import "../../../../shared/status"
import utils 1.0
StatusRoundButton {
id: btnAdd
icon.name: "plusSign"
pressedIconRotation: 45
size: "medium"
type: "secondary"
width: 36
height: 36
readonly property var onAfterAddAccount: function() {
walletInfoContainer.changeSelectedAccount(walletModel.accountsView.accounts.rowCount() - 1)
}
onClicked: {
if (newAccountMenu.opened) {
newAccountMenu.close()
} else {
let x = btnAdd.iconX + btnAdd.icon.width / 2 - newAccountMenu.width / 2
newAccountMenu.popup(x, btnAdd.height + 4)
}
}
GenerateAccountModal {
id: generateAccountModal
onAfterAddAccount: function() { btnAdd.onAfterAddAccount() }
}
AddAccountWithSeed {
id: addAccountWithSeedModal
onAfterAddAccount: function() { btnAdd.onAfterAddAccount() }
}
AddAccountWithPrivateKey {
id: addAccountWithPrivateKeydModal
onAfterAddAccount: function() { btnAdd.onAfterAddAccount() }
}
AddWatchOnlyAccount {
id: addWatchOnlyAccountModal
onAfterAddAccount: function() { btnAdd.onAfterAddAccount() }
}
PopupMenu {
id: newAccountMenu
width: 260
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
Action {
//% "Generate an account"
text: qsTrId("generate-a-new-account")
icon.source: Style.svg("generate_account")
icon.width: 19
icon.height: 19
onTriggered: {
generateAccountModal.open()
}
}
Action {
//% "Add a watch-only address"
text: qsTrId("add-a-watch-account")
icon.source: Style.svg("eye")
icon.width: 19
icon.height: 19
onTriggered: {
addWatchOnlyAccountModal.open()
}
}
Action {
//% "Enter a seed phrase"
text: qsTrId("enter-a-seed-phrase")
icon.source: Style.svg("enter_seed_phrase")
icon.width: 19
icon.height: 19
onTriggered: {
addAccountWithSeedModal.open()
}
}
Action {
//% "Enter a private key"
text: qsTrId("enter-a-private-key")
icon.source: Style.svg("enter_private_key")
icon.width: 19
icon.height: 19
onTriggered: {
addAccountWithPrivateKeydModal.open()
}
}
onAboutToShow: {
btnAdd.state = "pressed"
}
onAboutToHide: {
btnAdd.state = "default"
}
}
}
/*##^##
Designer {
D{i:0;height:36;width:36}
}
##^##*/

View File

@ -1,9 +0,0 @@
SendModalContent 1.0 SendModalContent.qml
SetCurrencyModalContent 1.0 SetCurrencyModalContent.qml
TokenSettingsModalContent 1.0 TokenSettingsModalContent.qml
AddAccount 1.0 AddAccount.qml
GenerateAccountModal 1.0 GenerateAccountModal.qml
AddAccountWithSeed 1.0 AddAccountWithSeed.qml
AddAccountWithPrivateKey 1.0 AddAccountWithPrivateKey.qml
AddWatchOnlyAccount 1.0 AddWatchOnlyAccount.qml
TransactionModal 1.0 TransactionModal.qml

View File

@ -0,0 +1,15 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../shared/status"
StatusRoundButton {
id: btnAdd
width: 36
height: 36
icon.name: "plusSign"
pressedIconRotation: 45
size: "medium"
type: "secondary"
}

View File

@ -0,0 +1,68 @@
import QtQuick 2.13
import utils 1.0
import "../../../../shared"
Item {
id: assetDelegate
property string defaultCurrency: ""
anchors.right: parent.right
anchors.left: parent.left
height: 40
Image {
id: assetInfoImage
width: 36
height: 36
source: symbol ? Style.png("tokens/" + symbol) : ""
anchors.left: parent.left
anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter
onStatusChanged: {
if (assetInfoImage.status == Image.Error) {
assetInfoImage.source = Style.png("tokens/DEFAULT-TOKEN@3x")
}
}
}
StyledText {
id: assetSymbol
text: symbol
anchors.left: assetInfoImage.right
anchors.leftMargin: Style.current.smallPadding
anchors.top: assetInfoImage.top
anchors.topMargin: 0
font.pixelSize: 15
}
StyledText {
id: assetFullTokenName
text: name
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.left: assetInfoImage.right
anchors.leftMargin: Style.current.smallPadding
color: Style.current.secondaryText
font.pixelSize: 15
}
StyledText {
id: assetValue
text: value.toUpperCase() + " " + symbol
anchors.right: parent.right
anchors.rightMargin: 0
font.pixelSize: 15
font.strikeout: false
}
StyledText {
id: assetFiatValue
color: Style.current.secondaryText
text: Utils.toLocaleString(fiatBalance, globalSettings.locale) + " " + assetDelegate.defaultCurrency.toUpperCase()
anchors.right: parent.right
anchors.rightMargin: 0
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
font.pixelSize: 15
}
}

View File

@ -2,9 +2,9 @@ import QtQuick 2.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../../../shared"
import "../../../../../shared/status/core"
import "../../../../../shared/status"
import "../../../../shared"
import "../../../../shared/status/core"
import "../../../../shared/status"
Rectangle {
property url collectibleIconSource: "CryptoKitties"

View File

@ -6,14 +6,16 @@ import "../../../../shared"
Rectangle {
id: headerButton
property string text: ""
property url imageSource
property bool flipImage: false
property var onClicked: function () {}
property int margin: 8
id: headerButton
width: buttonImage.width + buttonText.width + Style.current.smallPadding * 2
+ (text === "" ? 0 : walletMenu.btnMargin)
+ (text === "" ? 0 : headerButton.margin)
height: buttonText.height + Style.current.smallPadding * 2
border.width: 0
color: Style.current.transparent
@ -41,7 +43,7 @@ Rectangle {
visible: !!headerButton.text
text: headerButton.text
anchors.left: buttonImage.right
anchors.leftMargin: walletMenu.btnMargin
anchors.leftMargin: headerButton.margin
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 13
font.family: Style.current.fontMedium.name

View File

@ -0,0 +1,149 @@
import QtQuick 2.13
import utils 1.0
import "../../../../shared"
Rectangle {
id: transactionListItem
property var tokens
property string currentAccountAddress: ""
property string ethValue: ""
property bool isHovered: false
property string symbol: ""
property bool isIncoming: to === currentAccountAddress
signal launchTransactionModal()
anchors.right: parent.right
anchors.left: parent.left
height: 64
color: isHovered ? Style.current.secondaryBackground : Style.current.transparent
radius: 8
Component.onCompleted: {
const count = transactionListItem.tokens.length
for (var i = 0; i < count; i++) {
let token = transactionListItem.tokens[i]
if (token.address === contract) {
transactionListItem.symbol = token.symbol
break
}
}
}
MouseArea {
anchors.fill: parent
onClicked: launchTransactionModal()
cursorShape: Qt.PointingHandCursor
hoverEnabled: true
onEntered: {
transactionListItem.isHovered = true
}
onExited: {
transactionListItem.isHovered = false
}
}
Row {
anchors.left: parent.left
anchors.leftMargin: Style.current.smallPadding
anchors.verticalCenter: parent.verticalCenter
spacing: 5
Image {
id: assetIcon
width: 40
height: 40
source: Style.png("tokens/"
+ (transactionListItem.symbol
!= "" ? transactionListItem.symbol : "ETH"))
anchors.verticalCenter: parent.verticalCenter
onStatusChanged: {
if (assetIcon.status == Image.Error) {
assetIcon.source = Style.png("tokens/DEFAULT-TOKEN@3x")
}
}
anchors.leftMargin: Style.current.padding
}
StyledText {
id: transferIcon
anchors.verticalCenter: parent.verticalCenter
height: 15
width: 15
color: isIncoming ? Style.current.success : Style.current.danger
text: isIncoming ? "↓" : "↑"
}
StyledText {
id: transactionValue
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: Style.current.primaryTextFontSize
text: ethValue + " " + transactionListItem.symbol
}
}
Row {
anchors.right: timeInfo.left
anchors.rightMargin: Style.current.smallPadding
anchors.top: parent.top
anchors.topMargin: Style.current.bigPadding
spacing: 5
StyledText {
text: isIncoming ?
//% "From "
qsTrId("from-") :
//% "To "
qsTrId("to-")
color: Style.current.secondaryText
font.pixelSize: Style.current.primaryTextFontSize
font.strikeout: false
}
Address {
id: addressValue
text: isIncoming ? fromAddress : to
maxWidth: 120
width: 120
horizontalAlignment: Text.AlignRight
font.pixelSize: Style.current.primaryTextFontSize
color: Style.current.textColor
}
}
Row {
id: timeInfo
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
anchors.top: parent.top
anchors.topMargin: Style.current.bigPadding
spacing: 5
StyledText {
text: " • "
font.weight: Font.Bold
color: Style.current.secondaryText
font.pixelSize: Style.current.primaryTextFontSize
}
StyledText {
id: timeIndicator
//% "At "
text: qsTrId("at-")
color: Style.current.secondaryText
font.pixelSize: Style.current.primaryTextFontSize
font.strikeout: false
}
StyledText {
id: timeValue
text: new Date(timestamp).toLocaleString(globalSettings.locale)
font.pixelSize: Style.current.primaryTextFontSize
anchors.rightMargin: Style.current.smallPadding
}
}
}

View File

@ -0,0 +1,104 @@
import QtQuick 2.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../../shared"
Rectangle {
id: walletDelegate
property string defaultCurrency: ""
property int selectedAccountIndex
property bool selected: index === selectedAccountIndex
property bool hovered
signal clicked(int index)
height: 64
color: {
if (selected) {
return Style.current.menuBackgroundActive
}
if (hovered) {
return Style.current.backgroundHoverLight
}
return Style.current.transparent
}
radius: Style.current.radius
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
SVGImage {
id: walletIcon
width: 12
height: 12
anchors.top: parent.top
anchors.topMargin: Style.current.smallPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
source: Style.svg("walletIcon")
}
ColorOverlay {
anchors.fill: walletIcon
source: walletIcon
color: Utils.getCurrentThemeAccountColor(iconColor) || Style.current.accountColors[0]
}
StyledText {
id: walletName
text: name
elide: Text.ElideRight
anchors.right: walletBalance.left
anchors.rightMargin: Style.current.smallPadding
anchors.top: parent.top
anchors.topMargin: Style.current.smallPadding
anchors.left: walletIcon.right
anchors.leftMargin: Style.current.smallPadding
font.pixelSize: 15
font.weight: Font.Medium
color: Style.current.textColor
}
StyledText {
id: walletAddress
font.family: Style.current.fontHexRegular.name
text: address
anchors.right: parent.right
anchors.rightMargin: parent.width/2
elide: Text.ElideMiddle
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.smallPadding
anchors.left: walletIcon.left
font.pixelSize: 15
font.weight: Font.Medium
color: Style.current.secondaryText
opacity: selected ? 0.7 : 1
}
StyledText {
id: walletBalance
text: isLoading ? "..." : Utils.toLocaleString(fiatBalance, globalSettings.locale, {"currency": true}) + " " + walletDelegate.defaultCurrency.toUpperCase()
anchors.top: parent.top
anchors.topMargin: Style.current.smallPadding
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
font.pixelSize: 15
font.weight: Font.Medium
color: Style.current.textColor
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onEntered: {
walletDelegate.hovered = true
}
onExited: {
walletDelegate.hovered = false
}
onClicked: {
walletDelegate.clicked(index)
}
}
}

View File

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

View File

@ -2,9 +2,12 @@ import QtQuick 2.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../../../shared"
import "../../../../shared"
import "../controls"
Item {
id: collectiblesContainer
property url collectibleIconSource: "CryptoKitties"
property string collectibleName: "CryptoKitties"
property bool collectiblesOpened: false
@ -32,36 +35,32 @@ Item {
// Adding active instead of just using visible, because visible counts as false when the parent is not visible
property bool active: !!loading || !!error || collectibles.length > 0
id: root
signal reloadCollectibles(string collectibleType)
visible: active
width: parent.width
height: visible ? collectiblesHeader.height + collectiblesContent.height : 0
CollectiblesHeader {
id: collectiblesHeader
collectibleName: root.collectibleName
collectibleIconSource: root.collectibleIconSource
collectibleName: collectiblesContainer.collectibleName
collectibleIconSource: collectiblesContainer.collectibleIconSource
collectiblesQty: collectibles.length
isLoading: loading
toggleCollectible: function () {
root.collectiblesOpened = !root.collectiblesOpened
collectiblesContainer.collectiblesOpened = !collectiblesContainer.collectiblesOpened
}
}
CollectiblesContent {
id: collectiblesContent
visible: root.collectiblesOpened
collectiblesModal: root.collectiblesModal
buttonText: root.buttonText
getLink: root.getLink
visible: collectiblesContainer.collectiblesOpened
collectiblesModal: collectiblesContainer.collectiblesModal
buttonText: collectiblesContainer.buttonText
getLink: collectiblesContainer.getLink()
anchors.top: collectiblesHeader.bottom
anchors.topMargin: Style.current.halfPadding
collectibles: root.collectibles
collectibles: collectiblesContainer.collectibles
onReloadCollectibles: reloadCollectibles(collectibleType)
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -4,17 +4,20 @@ import QtGraphicalEffects 1.13
import QtQml.Models 2.13
import utils 1.0
import "../../../../../shared"
import "../../../../../shared/status"
import "../../../../shared"
import "../../../../shared/status"
ScrollView {
id: collectiblesContent
readonly property int imageSize: 164
property var collectiblesModal
property string buttonText: "View in Cryptokitties"
property var getLink: function () {}
property var collectibles: []
id: root
signal reloadCollectibles(string collectibleType)
height: visible ? contentLoader.item.height : 0
width: parent.width
ScrollBar.vertical.policy: ScrollBar.AlwaysOff
@ -25,7 +28,7 @@ ScrollView {
id: contentLoader
active: true
width: parent.width
height: root.imageSize
height: collectiblesContent.imageSize
sourceComponent: !!error ? errorComponent : collectiblesContentComponent
}
@ -34,7 +37,7 @@ ScrollView {
Item {
width: parent.width
height: root.imageSize
height: collectiblesContent.imageSize
Item {
anchors.verticalCenter: parent.verticalCenter
@ -58,7 +61,7 @@ ScrollView {
anchors.top: somethingWentWrongText.bottom
anchors.topMargin: Style.current.halfPadding
onClicked: {
walletModel.collectiblesView.reloadCollectible(collectibleType)
reloadCollectibleClicked(collectibleType)
}
}
}
@ -84,8 +87,8 @@ ScrollView {
RoundedImage {
id: collectibleImage
width: root.imageSize
height: root.imageSize
width: collectiblesContent.imageSize
height: collectiblesContent.imageSize
border.width: 1
border.color: Style.current.border
radius: 16
@ -98,8 +101,8 @@ ScrollView {
name: modelData.name,
id: modelData.id,
description: modelData.description,
buttonText: root.buttonText,
link: root.getLink(modelData.id, modelData.externalUrl),
buttonText: collectiblesContent.buttonText,
link: collectiblesContent.getLink(modelData.id, modelData.externalUrl),
image: modelData.image
})
}

View File

@ -2,7 +2,7 @@ import QtQuick 2.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../../../shared"
import "../../../../shared"
Item {
property string collectibleName: "Furbeard"
@ -44,10 +44,3 @@ Item {
wrap: true
}
}
/*##^##
Designer {
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
}
##^##*/

View File

@ -4,13 +4,13 @@ import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../shared"
import "../Profile/Sections"
import "."
import "../../../../shared"
import "../../Profile/Sections"
import "../stores"
Rectangle {
id: root
visible: !profileModel.mnemonic.isBackedUp
visible: !RootStore.mnemonicBackedUp
height: visible ? 32 : 0
color: Style.current.red
@ -84,10 +84,7 @@ Rectangle {
PropertyAnimation { target: root; property: "y"; to: -1 * root.height }
}
}
BackupSeedModal {
id: backupSeedModal
}
}

View File

@ -2,13 +2,18 @@ import QtQuick 2.13
import QtQuick.Controls 2.13
import utils 1.0
import "../../../../shared"
import "../../../../shared/status"
import "../data/"
Item {
property string currency: "USD"
id: modalBody
property string currency: "USD"
property alias tokenListModel: tokenListView.model
signal setDefaultCurrency(string key)
anchors.fill: parent
ButtonGroup {
@ -16,6 +21,8 @@ Item {
}
ListView {
id: tokenListView
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
@ -23,8 +30,6 @@ Item {
clip: true
spacing: 10
id: tokenListView
model: Currencies {}
ScrollBar.vertical: ScrollBar {
active: true
policy: tokenListView.contentHeight > tokenListView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
@ -60,7 +65,7 @@ Item {
anchors.rightMargin: Style.current.padding
anchors.verticalCenter: parent.verticalCenter
ButtonGroup.group: currencyGroup
onClicked: { walletModel.balanceView.setDefaultCurrency(key) }
onClicked: setDefaultCurrency(key)
}
MouseArea {
@ -76,16 +81,10 @@ Item {
onClicked: {
currencyRadioBtn.checked = !currencyRadioBtn.checked
modalBody.currency = key
walletModel.balanceView.setDefaultCurrency(key)
setDefaultCurrency(key)
}
}
}
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -2,16 +2,20 @@ import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import "../../../../shared"
import "../../../../shared/status"
import "../../Chat/ContactsColumn"
import "../data/"
Item {
id: modalBody
property var defaultTokenList
property var customTokenList
property var hasAsset: function(symbol) {}
signal toggleAssetClicked(string symbol)
signal removeCustomTokenTriggered(string address)
SearchBox {
id: searchBox
customHeight: 36
@ -63,10 +67,10 @@ Item {
}
StatusCheckBox {
id: assetCheck
checked: walletModel.tokensView.hasAsset(symbol)
checked:modalBody.hasAsset(symbol)
anchors.right: parent.right
anchors.rightMargin: Style.current.smallPadding
onClicked: walletModel.tokensView.toggleAsset(symbol)
onClicked: toggleAssetClicked(symbol)
anchors.verticalCenter: parent.verticalCenter
}
@ -80,7 +84,7 @@ Item {
return contextMenu.popup(assetSymbol.x - 100, assetSymbol.y + 25)
}
assetCheck.checked = !assetCheck.checked
walletModel.tokensView.toggleAsset(symbol)
toggleAssetClicked(symbol)
}
onEntered: {
tokenContainer.hovered = true
@ -102,7 +106,7 @@ Item {
enabled: isCustom
//% "Remove token"
text: qsTrId("remove-token")
onTriggered: walletModel.tokensView.removeCustomToken(address)
onTriggered: removeCustomTokenTriggered(address)
}
}
}
@ -143,14 +147,14 @@ Item {
Repeater {
id: customTokensRepeater
model: walletModel.tokensView.customTokenList
model: modalBody.customTokenList
delegate: tokenComponent
anchors.top: customLbl.bottom
anchors.topMargin: Style.current.smallPadding
}
Connections {
target: walletModel.tokensView.customTokenList
target: modalBody.customTokenList
onTokensLoaded: {
customLbl.visible = cnt > 0
}
@ -173,7 +177,7 @@ Item {
}
Repeater {
model: walletModel.tokensView.defaultTokenList
model: modalBody.defaultTokenList
delegate: tokenComponent
anchors.top: defaultLbl.bottom
anchors.topMargin: Style.current.smallPadding
@ -184,9 +188,3 @@ Item {
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
}
##^##*/

View File

@ -3,15 +3,18 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import "../../../shared"
import "../../../shared/status"
import "./components"
import "../../../../shared"
import "../../../../shared/status"
import "../popups"
import "../controls"
Item {
property var currentAccount: walletModel.accountsView.currentAccount
id: walletHeader
property var currentAccount
property var changeSelectedAccount
id: walletHeader
height: walletAddress.y + walletAddress.height
anchors.right: parent.right
anchors.rightMargin: 0
@ -66,7 +69,7 @@ Item {
Component {
id: receiveModalComponent
ReceiveModal{
ReceiveModal {
onClosed: {
destroy();
}
@ -76,7 +79,7 @@ Item {
Component {
id: setCurrencyModalComponent
SetCurrencyModal{
SetCurrencyModal {
onClosed: {
destroy();
}
@ -85,7 +88,7 @@ Item {
Component {
id: tokenSettingsModalComponent
TokenSettingsModal{
TokenSettingsModal {
onClosed: {
destroy();
}
@ -94,10 +97,8 @@ Item {
Component {
id: accountSettingsModalComponent
AccountSettingsModal{
onClosed: {
destroy();
}
AccountSettingsModal {
onClosed: destroy()
changeSelectedAccount: walletHeader.changeSelectedAccount
}
}
@ -107,7 +108,6 @@ Item {
}
Item {
property int btnMargin: 8
property int btnOuterMargin: Style.current.bigPadding
id: walletMenu
width: sendBtn.width + receiveBtn.width + settingsBtn.width
@ -176,7 +176,6 @@ Item {
icon.height: 16
onTriggered: {
openPopup(tokenSettingsModalComponent)
walletModel.tokensView.loadCustomTokens()
}
}
Action {
@ -186,18 +185,10 @@ Item {
icon.width: 16
icon.height: 16
onTriggered: {
openPopup(setCurrencyModalComponent, {
defaultCurrency: walletModel.balanceView.defaultCurrency
})
openPopup(setCurrencyModalComponent)
}
}
}
}
}
}
/*##^##
Designer {
D{i:0;formeditorColor:"#ffffff"}
}
##^##*/

View File

@ -4,13 +4,16 @@ import QtQuick.Layouts 1.13
import QtQuick.Dialogs 1.3
import utils 1.0
import "../../../shared"
import "../../../shared/status"
import "../../../../shared"
import "../../../../shared/status"
import "../stores"
ModalPopup {
property var currentAccount: walletModel.accountsView.currentAccount
property var changeSelectedAccount
id: popup
property var currentAccount: RootStore.currentAccount
property var changeSelectedAccount
// TODO add icon when we have that feature
//% "Status account settings"
title: qsTrId("status-account-settings")
@ -139,7 +142,7 @@ ModalPopup {
icon: StandardIcon.Warning
standardButtons: StandardButton.Yes | StandardButton.No
onAccepted: {
const error = walletModel.accountsView.deleteAccount(currentAccount.address);
const error = RootStore.deleteAccount(currentAccount.address)
if (error) {
errorSound.play()
deleteError.text = error
@ -179,7 +182,7 @@ ModalPopup {
return
}
const error = walletModel.accountsView.changeAccountSettings(currentAccount.address, accountNameInput.text, accountColorInput.selectedColor);
const error = RootStore.changeAccountSettings(currentAccount.address, accountNameInput.text, accountColorInput.selectedColor);
if (error) {
errorSound.play()
@ -192,9 +195,3 @@ ModalPopup {
}
}
}
/*##^##
Designer {
D{i:0;formeditorColor:"#ffffff";height:500;width:400}
}
##^##*/

View File

@ -3,8 +3,10 @@ import QtQuick.Controls 2.13
import QtQuick.Dialogs 1.3
import utils 1.0
import "../../../../shared"
import "../../../../shared/status"
import "../stores"
ModalPopup {
id: popup
@ -17,7 +19,8 @@ ModalPopup {
property string privateKeyValidationError: ""
property string accountNameValidationError: ""
property bool loading: false
property var onAfterAddAccount: function() {}
signal afterAddAccount()
function validate() {
if (passwordInput.text === "") {
@ -128,7 +131,7 @@ ModalPopup {
return loading = false
}
const result = walletModel.accountsView.addAccountsFromPrivateKey(accountPKeyInput.text, passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
const result = RootStore.addAccountsFromPrivateKey(accountPKeyInput.text, passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
loading = false
if (result) {
@ -143,7 +146,7 @@ ModalPopup {
}
return
}
popup.onAfterAddAccount()
popup.afterAddAccount()
popup.close();
}
}

View File

@ -3,8 +3,10 @@ import QtQuick.Controls 2.13
import QtQuick.Dialogs 1.3
import utils 1.0
import "../../../../shared"
import "../../../../shared/status"
import "../stores"
ModalPopup {
id: popup
@ -15,7 +17,8 @@ ModalPopup {
property string seedValidationError: ""
property string accountNameValidationError: ""
property bool loading: false
property var onAfterAddAccount: function() {}
signal afterAddAccount()
function reset() {
passwordInput.text = ""
@ -130,7 +133,7 @@ ModalPopup {
return loading = false
}
const result = walletModel.accountsView.addAccountsFromSeed(seedPhraseTextArea.textArea.text, passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
const result = RootStore.addAccountsFromSeed(seedPhraseTextArea.textArea.text, passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
loading = false
if (result) {
let resultJson = JSON.parse(result);
@ -144,15 +147,9 @@ ModalPopup {
}
return
}
popup.onAfterAddAccount()
popup.afterAddAccount()
popup.reset()
popup.close();
}
}
}
/*##^##
Designer {
D{i:0;formeditorColor:"#ffffff";height:500;width:400}
}
##^##*/

View File

@ -3,8 +3,10 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import "../../../shared"
import "../../../shared/status"
import "../../../../shared"
import "../../../../shared/status"
import "../stores"
ModalPopup {
id: popup
@ -52,7 +54,7 @@ ModalPopup {
}
property var getTokenDetails: Backpressure.debounce(popup, 500, function (tokenAddress){
walletModel.tokensView.customTokenList.getTokenDetails(tokenAddress)
RootStore.customTokenList.getTokenDetails(tokenAddress)
});
function onKeyReleased(){
@ -65,7 +67,7 @@ ModalPopup {
Item {
Connections {
target: walletModel.tokensView.customTokenList
target: RootStore.customTokenList
onTokenDetailsWereResolved: {
const jsonObj = JSON.parse(tokenDetails)
if (jsonObj.error) {
@ -154,7 +156,7 @@ ModalPopup {
enabled: validationError === "" && addressInput.text !== "" && nameInput.text !== "" && symbolInput.text !== "" && decimalsInput.text !== ""
onClicked : {
const error = walletModel.tokensView.addCustomToken(addressInput.text, nameInput.text, symbolInput.text, decimalsInput.text);
const error = RootStore.addCustomToken(addressInput.text, nameInput.text, symbolInput.text, decimalsInput.text);
if (error) {
errorSound.play()
@ -163,15 +165,9 @@ ModalPopup {
return
}
walletModel.tokensView.loadCustomTokens()
RootStore.loadCustomTokens()
popup.close();
}
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -0,0 +1,53 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import "../../../../shared"
import utils 1.0
PopupMenu {
id: newAccountMenu
width: 260
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
Action {
//% "Generate an account"
text: qsTrId("generate-a-new-account")
icon.source: Style.svg("generate_account")
icon.width: 19
icon.height: 19
onTriggered: {
generateAccountModal.open()
}
}
Action {
//% "Add a watch-only address"
text: qsTrId("add-a-watch-account")
icon.source: Style.svg("eye")
icon.width: 19
icon.height: 19
onTriggered: {
addWatchOnlyAccountModal.open()
}
}
Action {
//% "Enter a seed phrase"
text: qsTrId("enter-a-seed-phrase")
icon.source: Style.svg("enter_seed_phrase")
icon.width: 19
icon.height: 19
onTriggered: {
addAccountWithSeedModal.open()
}
}
Action {
//% "Enter a private key"
text: qsTrId("enter-a-private-key")
icon.source: Style.svg("enter_private_key")
icon.width: 19
icon.height: 19
onTriggered: {
addAccountWithPrivateKeydModal.open()
}
}
}

View File

@ -3,8 +3,10 @@ import QtQuick.Controls 2.13
import QtQuick.Dialogs 1.3
import utils 1.0
import "../../../../shared"
import "../../../../shared/status"
import "../stores"
ModalPopup {
id: popup
@ -15,7 +17,8 @@ ModalPopup {
property string addressError: ""
property string accountNameValidationError: ""
property bool loading: false
property var onAfterAddAccount: function() {}
signal afterAddAccount()
function validate() {
if (addressInput.text === "") {
@ -102,21 +105,15 @@ ModalPopup {
return loading = false
}
const error = walletModel.accountsView.addWatchOnlyAccount(addressInput.text, accountNameInput.text, accountColorInput.selectedColor);
const error = RootStore.addWatchOnlyAccount(addressInput.text, accountNameInput.text, accountColorInput.selectedColor);
loading = false
if (error) {
errorSound.play()
accountError.text = error
return accountError.open()
}
popup.onAfterAddAccount()
popup.afterAddAccount()
popup.close();
}
}
}
/*##^##
Designer {
D{i:0;formeditorColor:"#ffffff";height:500;width:400}
}
##^##*/

View File

@ -2,8 +2,9 @@ import QtQuick 2.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../../../shared"
import "../../../../../shared/status"
import "../../../../shared"
import "../../../../shared/status"
import "../panels"
ModalPopup {
property string collectibleName: "Furbeard"

View File

@ -3,8 +3,10 @@ import QtQuick.Controls 2.13
import QtQuick.Dialogs 1.3
import utils 1.0
import "../../../../shared"
import "../../../../shared/status"
import "../stores"
ModalPopup {
id: popup
@ -15,7 +17,8 @@ ModalPopup {
property string passwordValidationError: ""
property string accountNameValidationError: ""
property bool loading: false
property var onAfterAddAccount: function() {}
signal afterAddAccount()
function validate() {
if (passwordInput.text === "") {
@ -102,7 +105,7 @@ ModalPopup {
return loading = false
}
const result = walletModel.accountsView.generateNewAccount(passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
const result = RootStore.generateNewAccount(passwordInput.text, accountNameInput.text, accountColorInput.selectedColor)
loading = false
if (result) {
let resultJson = JSON.parse(result);
@ -116,14 +119,8 @@ ModalPopup {
}
return
}
popup.onAfterAddAccount();
popup.afterAddAccount();
popup.close();
}
}
}
/*##^##
Designer {
D{i:0;formeditorColor:"#ffffff";height:500;width:400}
}
##^##*/

View File

@ -2,7 +2,9 @@ import QtQuick 2.13
import QtQuick.Controls 2.13
import utils 1.0
import "../../../shared"
import "../../../../shared"
import "../stores"
ModalPopup {
property alias selectedAccount: accountSelector.selectedAccount
@ -41,8 +43,8 @@ ModalPopup {
id: accountSelector
label: ""
showAccountDetails: false
accounts: walletModel.accountsView.accounts
currency: walletModel.balanceView.defaultCurrency
accounts: RootStore.accounts
currency: RootStore.defaultCurrency
anchors.top: qrCodeBox.bottom
anchors.topMargin: Style.current.padding
anchors.horizontalCenter: parent.horizontalCenter
@ -51,7 +53,7 @@ ModalPopup {
dropdownAlignment: Select.MenuAlignment.Center
onSelectedAccountChanged: {
if (selectedAccount.address) {
qrCodeImage.source = profileModel.qrCode(selectedAccount.address)
qrCodeImage.source = RootStore.getQrCode(selectedAccount.address)
txtWalletAddress.text = selectedAccount.address
}
}
@ -70,9 +72,3 @@ ModalPopup {
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -1,18 +1,18 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
//import QtQuick.Layouts 1.13
//import Qt.labs.platform 1.1
import utils 1.0
import "../../../shared"
import "../../../shared/status"
import "./components"
import "../../../../shared"
import "../../../../shared/status"
import "../panels"
import "../stores"
ModalPopup {
id: popup
width: 480
height: 510
property string defaultCurrency
property string defaultCurrency: RootStore.defaultCurrency
onDefaultCurrencyChanged: {
setCurrencyModalContent.currency = defaultCurrency
@ -23,6 +23,10 @@ ModalPopup {
SetCurrencyModalContent {
id: setCurrencyModalContent
tokenListModel: CurrenciesStore {}
onSetDefaultCurrency: {
RootStore.setDefaultCurrency(key)
}
}
footer: StatusButton {
@ -35,9 +39,3 @@ ModalPopup {
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -3,12 +3,16 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import "../../../shared"
import "../../../shared/status"
import "."
import "../../../../shared"
import "../../../../shared/status"
import "../stores"
ModalPopup {
id: signPhrasePopup
signal remindLaterClicked()
signal acceptClicked()
//% "Signing phrase"
title: qsTrId("signing-phrase")
height: 390
@ -48,7 +52,7 @@ ModalPopup {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
font.pixelSize: 15
text: walletModel.utilsView.signingPhrase
text: RootStore.signingPhrase
}
}
@ -91,20 +95,19 @@ ModalPopup {
text: qsTrId("ens-got-it")
type: "secondary"
onClicked: {
appSettings.hideSignPhraseModal = true;
close();
acceptClicked()
close()
}
}
StatusButton {
id: btnRemindLater
anchors.right: parent.right
//% "Remind me later"
text: qsTrId("remind-me-later")
onClicked: {
hideSignPhraseModal = true;
close();
remindLaterClicked()
close()
}
}
}

View File

@ -2,15 +2,19 @@ import QtQuick 2.13
import QtQuick.Controls 2.13
import utils 1.0
import "../../../shared"
import "../../../shared/status"
import "./components"
import "../../../../shared"
import "../../../../shared/status"
import "../panels"
import "../stores"
ModalPopup {
id: popup
//% "Manage Assets"
title: qsTrId("manage-assets")
onOpened: {
RootStore.loadCustomTokens()
}
TokenSettingsModalContent {
id: settingsModalContent
@ -20,6 +24,16 @@ ModalPopup {
anchors.top: parent.top
anchors.leftMargin: Style.current.padding
anchors.rightMargin: Style.current.padding
defaultTokenList: RootStore.defaultTokenList
customTokenList: RootStore.customTokenList
hasAsset: function(symbol) { return RootStore.hasAsset(symbol) }
onToggleAssetClicked: {
RootStore.toggleAsset(symbol)
}
onRemoveCustomTokenTriggered: {
RootStore.removeCustomToken(address)
}
}
footer: StatusButton {
@ -30,9 +44,3 @@ ModalPopup {
onClicked: addCustomTokenModal.openEditable()
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -2,10 +2,12 @@ import QtQuick 2.13
import utils 1.0
import "../../../../shared"
import "./"
import "../stores"
ModalPopup {
id: popup
property var transaction
//% "Transaction Details"
title: qsTrId("transaction-details")
@ -22,7 +24,10 @@ ModalPopup {
StyledText {
id: confirmationsCount
text: {
return walletModel.getLatestBlockNumber() - utilsModel.hex2Dec(blockNumber) + qsTrId(" confirmation(s)")
if(transaction !== undefined)
return RootStore.getLatestBlockNumber() - RootStore.hex2Dec(transaction.blockNumber) + qsTrId(" confirmation(s)")
else
return ""
}
font.pixelSize: 14
}
@ -37,7 +42,7 @@ ModalPopup {
color: Style.current.darkGrey
anchors.top: confirmationsCount.bottom
anchors.topMargin: Style.current.smallPadding
width:parent.width
width: parent.width
}
}
@ -70,7 +75,7 @@ ModalPopup {
StyledText {
id: valueBlock
text: utilsModel.hex2Dec(blockNumber)
text: transaction !== undefined ? RootStore.hex2Dec(transaction.blockNumber) : ""
font.pixelSize: 14
anchors.left: labelBlock.right
anchors.leftMargin: Style.current.padding
@ -98,7 +103,7 @@ ModalPopup {
Address {
id: valueHash
text: id
text: transaction !== undefined ? transaction.id : ""
width: 160
maxWidth: parent.width - labelHash.width - Style.current.padding
color: Style.current.textColor
@ -127,7 +132,7 @@ ModalPopup {
Address {
id: valueFrom
text: fromAddress
text: transaction !== undefined ? transaction.fromAddress: ""
color: Style.current.textColor
width: 160
font.pixelSize: 14
@ -155,7 +160,7 @@ ModalPopup {
Address {
id: valueTo
text: to
text: transaction !== undefined ? transaction.to: ""
color: Style.current.textColor
width: 160
font.pixelSize: 14
@ -183,7 +188,7 @@ ModalPopup {
StyledText {
id: valueGasLimit
text: utilsModel.hex2Dec(gasLimit)
text: transaction !== undefined ? RootStore.hex2Dec(transaction.gasLimit): ""
font.pixelSize: 14
anchors.left: labelGasLimit.right
anchors.leftMargin: Style.current.padding
@ -209,7 +214,7 @@ ModalPopup {
StyledText {
id: valueGasPrice
text: utilsModel.hex2Eth(gasPrice)
text: transaction !== undefined ? RootStore.hex2Eth(transaction.gasPrice): ""
font.pixelSize: 14
anchors.left: labelGasPrice.right
anchors.leftMargin: Style.current.padding
@ -235,7 +240,7 @@ ModalPopup {
StyledText {
id: valueGasUsed
text: utilsModel.hex2Dec(gasUsed)
text: transaction !== undefined ? RootStore.hex2Dec(transaction.gasUsed): ""
font.pixelSize: 14
anchors.left: labelGasUsed.right
anchors.leftMargin: Style.current.padding
@ -261,7 +266,7 @@ ModalPopup {
StyledText {
id: valueNonce
text: utilsModel.hex2Dec(nonce)
text: transaction !== undefined ? RootStore.hex2Dec(transaction.nonce) : ""
font.pixelSize: 14
anchors.left: labelNonce.right
anchors.leftMargin: Style.current.padding

View File

@ -1,4 +1,4 @@
LeftTab 1.0 LeftTab.qml
LeftTabView 1.0 LeftTabView.qml
WalletHeader 1.0 WalletHeader.qml
AssetsTab 1.0 AssetsTab.qml
CollectiblesTab 1.0 CollectiblesTab.qml
AssetsView 1.0 AssetsView.qml
CollectiblesView 1.0 CollectiblesView.qml

View File

@ -635,9 +635,3 @@ ListModel {
}
}
/*##^##
Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@ -0,0 +1,175 @@
pragma Singleton
import QtQuick 2.13
QtObject {
id: root
property var currentAccount: walletModel.accountsView.currentAccount
property var accounts: walletModel.accountsView.accounts
property string defaultCurrency: walletModel.balanceView.defaultCurrency
property string totalFiatBalance: walletModel.balanceView.totalFiatBalance
property var transactions: walletModel.transactionsView.transactions
property var defaultTokenList: walletModel.tokensView.defaultTokenList
property var customTokenList: walletModel.tokensView.customTokenList
property var assets: walletModel.tokensView.assets
property string signingPhrase: walletModel.utilsView.signingPhrase
property bool mnemonicBackedUp: profileModel.mnemonic.isBackedUp
property var collectiblesList: walletModel.collectiblesView.collectiblesLists
property var historyView: walletModel.historyView
property bool firstTimeLogin: onboardingModel.isFirstTimeLogin
property var tokens: {
let count = walletModel.tokensView.defaultTokenList.rowCount()
const toks = []
for (let i = 0; i < count; i++) {
toks.push({
"address": walletModel.tokensView.defaultTokenList.rowData(i, 'address'),
"symbol": walletModel.tokensView.defaultTokenList.rowData(i, 'symbol')
})
}
count = walletModel.tokensView.customTokenList.rowCount()
for (let j = 0; j < count; j++) {
toks.push({
"address": walletModel.tokensView.customTokenList.rowData(j, 'address'),
"symbol": walletModel.tokensView.customTokenList.rowData(j, 'symbol')
})
}
return toks
}
// example wallet model
property ListModel exampleWalletModel: ListModel {
ListElement {
name: "Status account"
address: "0xcfc9f08bbcbcb80760e8cb9a3c1232d19662fc6f"
balance: "12.00 USD"
iconColor: "#7CDA00"
}
ListElement {
name: "Test account 1"
address: "0x2Ef1...E0Ba"
balance: "12.00 USD"
iconColor: "#FA6565"
}
ListElement {
name: "Status account"
address: "0x2Ef1...E0Ba"
balance: "12.00 USD"
iconColor: "#7CDA00"
}
}
property ListModel exampleAssetModel: ListModel {
ListElement {
value: "123 USD"
symbol: "ETH"
fullTokenName: "Ethereum"
fiatBalanceDisplay: "3423 ETH"
image: "token-icons/eth"
}
}
function getLatestBlockNumber() {
return walletModel.getLatestBlockNumber()
}
function isNonArchivalNode() {
return walletModel.isNonArchivalNode
}
function setCurrentAccountByIndex(newIndex) {
walletModel.setCurrentAccountByIndex(newIndex)
}
function setInitialRange() {
walletModel.setInitialRange()
}
function generateNewAccount(password , accountName, color) {
return walletModel.accountsView.generateNewAccount(password, accountName, color)
}
function changeAccountSettings(address, accountName, color) {
return walletModel.accountsView.changeAccountSettings(address, accountName, color)
}
function deleteAccount(address) {
return walletModel.accountsView.deleteAccount(address)
}
function addAccountsFromPrivateKey(privateKey, password, accountName, color) {
return walletModel.accountsView.addAccountsFromPrivateKey(privateKey, password, accountName, color)
}
function addAccountsFromSeed(seedPhrase, password, accountName, color) {
return walletModel.accountsView.addAccountsFromSeed(seedPhrase, password, accountName, color)
}
function addWatchOnlyAccount(address, accountName, color) {
return walletModel.accountsView.addWatchOnlyAccount(address, accountName, color)
}
function setDefaultCurrency(key) {
walletModel.balanceView.setDefaultCurrency(key)
}
function addCustomToken(address, name, symbol, decimals) {
return walletModel.tokensView.addCustomToken(address, name, symbol, decimals)
}
function loadCustomTokens() {
walletModel.tokensView.loadCustomTokens()
}
function toggleAsset(symbol) {
walletModel.tokensView.toggleAsset(symbol)
}
function removeCustomToken(address) {
walletModel.tokensView.removeCustomToken(address)
}
function hasAsset(symbol) {
return walletModel.tokensView.hasAsset(symbol)
}
function getQrCode(address) {
return profileModel.qrCode(address)
}
function hex2Dec(value) {
return utilsModel.hex2Dec(value)
}
function hex2Eth(value) {
return utilsModel.hex2Eth(value)
}
function reloadCollectible(collectibleType) {
walletModel.collectiblesView.reloadCollectible(collectibleType)
}
function checkRecentHistory() {
walletModel.transactionsView.checkRecentHistory()
}
function isFetchingHistory() {
return walletModel.historyView.isFetchingHistory(walletModel.accountsView.currentAccount.address)
}
function loadTransactionsForAccount(pageSize) {
walletModel.historyView.loadTransactionsForAccount(walletModel.accountsView.currentAccount.address,
walletModel.transactionsView.transactions.getLastTxBlockNumber(),
pageSize, true)
}
}

View File

@ -0,0 +1 @@
singleton RootStore 1.0 RootStore.qml

View File

@ -0,0 +1,33 @@
import QtQuick 2.13
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.14
import utils 1.0
import "../../../../shared"
import "../stores"
import "../controls"
Item {
height: assetListView.height
ScrollView {
anchors.fill: parent
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: assetListView.contentHeight > assetListView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
ListView {
id: assetListView
spacing: Style.current.padding * 2
anchors.fill: parent
// model: RootStore.exampleAssetModel
model: RootStore.assets
delegate: AssetDelegate {
defaultCurrency: RootStore.defaultCurrency
}
boundsBehavior: Flickable.StopAtBounds
}
}
}

View File

@ -2,9 +2,12 @@ import QtQuick 2.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../shared"
import "./components/collectiblesComponents"
import "./components/collectiblesComponents/collectiblesData.js" as CollectiblesData
import "../../../../shared"
import "../helpers/collectiblesData.js" as CollectiblesData
import "../popups"
import "../panels"
import "../stores"
Item {
id: root
@ -46,7 +49,7 @@ Item {
Repeater {
id: collectiblesRepeater
model: walletModel.collectiblesView.collectiblesLists
model: RootStore.collectiblesList
CollectiblesContainer {
property var collectibleData: CollectiblesData.collectiblesData[model.collectibleType]
@ -59,20 +62,17 @@ Item {
onActiveChanged: {
checkCollectiblesVisibility()
}
onReloadCollectibles: {
RootStore.reloadCollectible(collectibleType)
}
}
}
}
Connections {
target: walletModel.collectiblesView.collectiblesLists
target: RootStore.collectiblesList
onDataChanged: {
checkCollectiblesVisibility()
}
}
}
/*##^##
Designer {
D{i:0;autoSize:true;formeditorColor:"#ffffff";height:480;width:640}
}
##^##*/

View File

@ -0,0 +1,122 @@
import QtQuick 2.13
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import utils 1.0
import "../../../../shared"
import "../../../../shared/status/core"
import "../../../../shared/status"
import "../popups"
import "../stores"
import "../controls"
Item {
id: historyView
property int pageSize: 20 // number of transactions per page
function fetchHistory() {
if (RootStore.isFetchingHistory()) {
loadingImg.active = true
} else {
RootStore.loadTransactionsForAccount(pageSize)
}
}
Loader {
id: loadingImg
active: false
sourceComponent: loadingImageComponent
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.top: parent.top
}
Component {
id: loadingImageComponent
StatusLoadingIndicator {}
}
Connections {
target: RootStore.historyView
onLoadingTrxHistoryChanged: {
if (RootStore.currentAccount.address.toLowerCase() === address.toLowerCase()) {
loadingImg.active = isLoading
}
}
}
StyledText {
id: nonArchivalNodeError
visible: RootStore.isNonArchivalNode
height: visible ? implicitHeight : 0
anchors.top: parent.top
//% "Status Desktop is connected to a non-archival node. Transaction history may be incomplete."
text: qsTrId("status-desktop-is-connected-to-a-non-archival-node--transaction-history-may-be-incomplete-")
font.pixelSize: Style.current.primaryTextFontSize
color: Style.current.danger
}
StyledText {
id: noTxs
anchors.top: nonArchivalNodeError.bottom
visible: transactionListRoot.count === 0
height: visible ? implicitHeight : 0
//% "No transactions found"
text: qsTrId("no-transactions-found")
font.pixelSize: Style.current.primaryTextFontSize
}
ListView {
id: transactionListRoot
anchors.top: noTxs.bottom
anchors.topMargin: Style.current.padding
anchors.bottom: loadMoreButton.top
anchors.bottomMargin: Style.current.padding
width: parent.width
clip: true
boundsBehavior: Flickable.StopAtBounds
model: RootStore.transactions
delegate: TransactionDelegate {
tokens: RootStore.tokens
currentAccountAddress: RootStore.currentAccount.address
ethValue: RootStore.hex2Eth(value)
onLaunchTransactionModal: {
transactionModal.transaction = model
transactionModal.open()
}
}
ScrollBar.vertical: ScrollBar {
id: scrollBar
}
onCountChanged: {
if (loadMoreButton.loadedMore)
transactionListRoot.positionViewAtEnd();
}
}
StatusButton {
id: loadMoreButton
//% "Load More"
text: qsTrId("load-more")
// TODO: handle case when requested limit === transaction count -- there
// is currently no way to know that there are no more results
enabled: !loadingImg.active && RootStore.transactions.hasMore
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: Style.current.padding
property bool loadedMore: false
onClicked: {
fetchHistory()
loadMoreButton.loadedMore = true
}
}
TransactionModal {
id: transactionModal
}
}

View File

@ -0,0 +1,139 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../../shared"
import "../controls"
import "../popups"
import "../stores"
Rectangle {
id: walletInfoContainer
property int selectedAccountIndex: 0
property var changeSelectedAccount: function(){}
function onAfterAddAccount () {
walletInfoContainer.changeSelectedAccount(RootStore.accounts.rowCount() - 1)
}
color: Style.current.secondaryMenuBackground
StyledText {
id: title
//% "Wallet"
text: qsTrId("wallet")
anchors.top: parent.top
anchors.topMargin: Style.current.padding
anchors.horizontalCenter: parent.horizontalCenter
font.weight: Font.Bold
font.pixelSize: 17
}
Item {
id: walletValueTextContainer
anchors.left: parent.left
anchors.leftMargin: Style.current.padding
anchors.right: parent.right
anchors.rightMargin: Style.current.padding
anchors.top: title.bottom
anchors.topMargin: Style.current.padding
height: childrenRect.height
StyledTextEdit {
id: walletAmountValue
color: Style.current.textColor
text: Utils.toLocaleString(RootStore.totalFiatBalance, globalSettings.locale, {"currency": true}) + " " + RootStore.defaultCurrency.toUpperCase()
selectByMouse: true
cursorVisible: true
readOnly: true
anchors.left: parent.left
font.weight: Font.Medium
font.pixelSize: 30
}
StyledText {
id: totalValue
color: Style.current.secondaryText
//% "Total value"
text: qsTrId("wallet-total-value")
anchors.left: walletAmountValue.left
anchors.top: walletAmountValue.bottom
font.weight: Font.Medium
font.pixelSize: 13
}
AddAccountButton {
id: addAccountButton
anchors.top: parent.top
anchors.right: parent.right
onClicked: {
if (newAccountMenu.opened) {
newAccountMenu.close()
} else {
newAccountMenu.popup(addAccountButton.x + addAccountButton.width/2 - newAccountMenu.width/2 ,
addAccountButton.y + addAccountButton.height + 55)
}
}
}
}
AddNewAccountMenu {
id: newAccountMenu
onAboutToShow: addAccountButton.state = "pressed"
onAboutToHide: addAccountButton.state = "default"
}
GenerateAccountModal {
id: generateAccountModal
onAfterAddAccount: walletInfoContainer.onAfterAddAccount()
}
AddAccountWithSeedModal {
id: addAccountWithSeedModal
onAfterAddAccount: walletInfoContainer.onAfterAddAccount()
}
AddAccountWithPrivateKeyModal {
id: addAccountWithPrivateKeydModal
onAfterAddAccount: walletInfoContainer.onAfterAddAccount()
}
AddWatchOnlyAccountModal {
id: addWatchOnlyAccountModal
onAfterAddAccount: walletInfoContainer.onAfterAddAccount()
}
ScrollView {
anchors.bottom: parent.bottom
anchors.top: walletValueTextContainer.bottom
anchors.topMargin: Style.current.padding
anchors.right: parent.right
anchors.left: parent.left
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: listView.contentHeight > listView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
ListView {
id: listView
spacing: 5
anchors.fill: parent
boundsBehavior: Flickable.StopAtBounds
delegate: WalletDelegate {
defaultCurrency: RootStore.defaultCurrency
selectedAccountIndex: walletInfoContainer.selectedAccountIndex
onClicked: {
changeSelectedAccount(index)
}
}
model: RootStore.accounts
// model: RootStore.exampleWalletModel
}
}
}

View File

@ -0,0 +1,97 @@
import QtQuick 2.13
import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import QtGraphicalEffects 1.13
import utils 1.0
import "../../../../shared"
import "../controls"
import "../stores"
import "../views"
import "../panels"
Item {
id: walletContainer
property alias currentTabIndex: walletTabBar.currentIndex
WalletHeader {
id: walletHeader
changeSelectedAccount: leftTab.changeSelectedAccount
currentAccount: RootStore.currentAccount
}
RowLayout {
id: walletInfoContainer
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
anchors.right: parent.right
anchors.rightMargin: 0
anchors.top: walletHeader.bottom
anchors.topMargin: 23
Item {
id: walletInfoContent
Layout.fillHeight: true
Layout.fillWidth: true
TabBar {
id: walletTabBar
anchors.right: parent.right
anchors.rightMargin: Style.current.bigPadding
anchors.left: parent.left
anchors.leftMargin: Style.current.bigPadding
anchors.top: parent.top
anchors.topMargin: Style.current.padding
height: assetBtn.height
background: Rectangle {
color: Style.current.transparent
}
StatusTabButton {
id: assetBtn
//% "Assets"
btnText: qsTrId("wallet-assets")
}
StatusTabButton {
id: collectiblesBtn
anchors.left: assetBtn.right
anchors.leftMargin: 32
//% "Collectibles"
btnText: qsTrId("wallet-collectibles")
}
StatusTabButton {
id: historyBtn
anchors.left: collectiblesBtn.right
anchors.leftMargin: 32
//% "History"
btnText: qsTrId("history")
}
}
StackLayout {
id: stackLayout
anchors.rightMargin: Style.current.bigPadding
anchors.leftMargin: Style.current.bigPadding
anchors.top: walletTabBar.bottom
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.topMargin: Style.current.bigPadding
currentIndex: walletTabBar.currentIndex
AssetsView {
id: assetsTab
}
CollectiblesView {
id: collectiblesTab
}
HistoryView {
id: historyTab
}
}
}
}
}

View File

@ -7,6 +7,7 @@ import utils 1.0
import "../sounds"
import "../shared"
import "../shared/status"
import "../shared/popups"
import "./AppLayouts"
import "./AppLayouts/Timeline"
import "./AppLayouts/Wallet"

View File

@ -48,7 +48,7 @@ Column {
sourceSize.width: width * 2
anchors.horizontalCenter: parent.horizontalCenter
fillMode: Image.PreserveAspectFit
source: "../app/img/exclamation_outline.svg"
source: Style.svg("exclamation_outline")
}
StyledText {
id: txtValidationError

View File

@ -45,7 +45,7 @@ Item {
sourceSize.width: width * 2
anchors.horizontalCenter: parent.horizontalCenter
fillMode: Image.PreserveAspectFit
source: "../app/img/exclamation_outline.svg"
source: Style.svg("exclamation_outline")
}
StyledText {
id: txtValidationError

View File

@ -26,7 +26,7 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectFit
source: "../app/img/arrow-right.svg"
source: Style.svg("arrow-right")
rotation: 90
ColorOverlay {

View File

@ -69,7 +69,7 @@ Item {
width: itmFromValue.needsRightPadding() ? (Style.current.halfPadding + sourceSize.width) : undefined // adding width to add addl spacing to image
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectFit
source: "../app/img/walletIcon.svg"
source: Style.svg("walletIcon")
ColorOverlay {
visible: parent.visible
anchors.fill: parent
@ -85,7 +85,7 @@ Item {
sourceSize.height: height * 2
sourceSize.width: width * 2
fillMode: Image.PreserveAspectFit
source: "../app/img/exclamation_outline.svg"
source: Style.svg("exclamation_outline")
visible: !root.fromValid
}
SVGImage {
@ -95,7 +95,7 @@ Item {
visible: root.isFromEditable
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectFit
source: "../app/img/caret.svg"
source: Style.svg("caret")
rotation: 270
ColorOverlay {
anchors.fill: parent
@ -240,7 +240,7 @@ Item {
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectFit
source: "../app/img/walletIcon.svg"
source: Style.svg("walletIcon")
}
ColorOverlay {
id: ovlToWallet
@ -266,7 +266,7 @@ Item {
sourceSize.height: height * 2
sourceSize.width: width * 2
fillMode: Image.PreserveAspectFit
source: "../app/img/exclamation_outline.svg"
source: Style.svg("exclamation_outline")
visible: !root.toValid || root.toWarn
}
}
@ -453,7 +453,7 @@ Item {
sourceSize.height: height * 2
sourceSize.width: width * 2
fillMode: Image.PreserveAspectFit
source: "../app/img/exclamation_outline.svg"
source: Style.svg("exclamation_outline")
visible: !root.gasValid
}
SVGImage {
@ -463,7 +463,7 @@ Item {
visible: root.isGasEditable
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectFit
source: "../app/img/caret.svg"
source: Style.svg("caret")
rotation: 270
ColorOverlay {
anchors.fill: parent
@ -512,7 +512,7 @@ Item {
visible: true
anchors.verticalCenter: parent.verticalCenter
fillMode: Image.PreserveAspectFit
source: "../app/img/caret.svg"
source: Style.svg("caret")
rotation: 270
ColorOverlay {
anchors.fill: parent

View File

@ -4,9 +4,8 @@ import QtQuick.Layouts 1.13
import QtQuick.Dialogs 1.3
import utils 1.0
import "../../../shared"
import "../../../shared/status"
import "./components"
import "../"
import "../status"
ModalPopup {
id: root

View File

@ -3,8 +3,8 @@ import QtQuick.Controls 2.13
import QtQuick.Layouts 1.13
import utils 1.0
import "../../../shared/status"
import "../../../shared"
import "../status"
import "../"
ModalPopup {
id: popup

View File

@ -17,7 +17,7 @@ CheckBox {
color: (control.down || control.checked) ? Style.current.primary : Style.current.inputBackground
SVGImage {
source: "../img/checkmark.svg"
source: Style.svg("checkmark")
width: 16
height: 16
anchors.centerIn: parent

View File

@ -6,7 +6,7 @@ import QtQuick.Dialogs 1.3
import utils 1.0
import "../../shared"
import "../../shared/status"
import "../../app/AppLayouts/Wallet/"
import "../../shared/popups"
ModalPopup {
id: root

View File

@ -6,7 +6,7 @@ import QtQuick.Dialogs 1.3
import utils 1.0
import "../../shared"
import "../../shared/status"
import "../../app/AppLayouts/Wallet/"
import "../../shared/popups"
ModalPopup {
id: root