Skip to content
Snippets Groups Projects
Commit 8d5bdbb3 authored by littletux89@gmail.com's avatar littletux89@gmail.com
Browse files

[*] Conflict resolution.

parents 669b02b0 9b9cb68e
No related branches found
No related tags found
No related merge requests found
...@@ -26,6 +26,7 @@ QVariant DapChainWalletsModel::data(const QModelIndex &index, int role) const ...@@ -26,6 +26,7 @@ QVariant DapChainWalletsModel::data(const QModelIndex &index, int role) const
case AddressWalletRole: return m_dapChainWallets.at(index.row())->getAddress(); case AddressWalletRole: return m_dapChainWallets.at(index.row())->getAddress();
case BalanceWalletRole: return m_dapChainWallets.at(index.row())->getBalance(); case BalanceWalletRole: return m_dapChainWallets.at(index.row())->getBalance();
case TokensWalletRole: return m_dapChainWallets.at(index.row())->getTokens(); case TokensWalletRole: return m_dapChainWallets.at(index.row())->getTokens();
case CountWalletRole: return m_dapChainWallets.at(index.row())->getCount();
default: default:
return QVariant(); return QVariant();
} }
...@@ -39,7 +40,8 @@ QHash<int, QByteArray> DapChainWalletsModel::roleNames() const ...@@ -39,7 +40,8 @@ QHash<int, QByteArray> DapChainWalletsModel::roleNames() const
{ NameWalletRole, "name" }, { NameWalletRole, "name" },
{ AddressWalletRole, "address" }, { AddressWalletRole, "address" },
{ BalanceWalletRole, "balance" }, { BalanceWalletRole, "balance" },
{ TokensWalletRole, "tokens" } { TokensWalletRole, "tokens" },
{ CountWalletRole, "count" }
}; };
return roles; return roles;
...@@ -48,10 +50,10 @@ QHash<int, QByteArray> DapChainWalletsModel::roleNames() const ...@@ -48,10 +50,10 @@ QHash<int, QByteArray> DapChainWalletsModel::roleNames() const
QVariantMap DapChainWalletsModel::get(int row) const QVariantMap DapChainWalletsModel::get(int row) const
{ {
if (m_dapChainWallets.count() == 0) { if (m_dapChainWallets.count() == 0) {
return { {"iconPath", ""}, {"name", ""}, {"address", ""}, {"balance", ""}, {"tokens", QStringList()} }; return { {"iconPath", ""}, {"name", ""}, {"address", ""}, {"balance", ""}, {"tokens", QStringList()}, {"count", 0} };
} }
const DapChainWallet *wallet = m_dapChainWallets.value(row); const DapChainWallet *wallet = m_dapChainWallets.value(row);
return { {"iconPath", wallet->getIconPath()}, {"name", wallet->getName()}, {"address", wallet->getAddress()}, {"balance", wallet->getBalance()}, {"tokens", wallet->getTokens()} }; return { {"iconPath", wallet->getIconPath()}, {"name", wallet->getName()}, {"address", wallet->getAddress()}, {"balance", wallet->getBalance()}, {"tokens", wallet->getTokens()}, {"count", wallet->getCount()} };
} }
void DapChainWalletsModel::append(const DapChainWallet &arWallet) void DapChainWalletsModel::append(const DapChainWallet &arWallet)
...@@ -80,7 +82,7 @@ void DapChainWalletsModel::set(int row, const QString& asIconPath, const QString ...@@ -80,7 +82,7 @@ void DapChainWalletsModel::set(int row, const QString& asIconPath, const QString
wallet->setAddress(asAddresss); wallet->setAddress(asAddresss);
wallet->setBalance(aBalance); wallet->setBalance(aBalance);
wallet->setTokens(aTokens); wallet->setTokens(aTokens);
dataChanged(index(row, 0), index(row, 0), { IconWalletRole, NameWalletRole, AddressWalletRole, BalanceWalletRole }); dataChanged(index(row, 0), index(row, 0), { IconWalletRole, NameWalletRole, AddressWalletRole, BalanceWalletRole, CountWalletRole });
} }
void DapChainWalletsModel::remove(int row) void DapChainWalletsModel::remove(int row)
......
...@@ -17,7 +17,8 @@ enum DapChainWalletRole { ...@@ -17,7 +17,8 @@ enum DapChainWalletRole {
NameWalletRole = Qt::UserRole, NameWalletRole = Qt::UserRole,
AddressWalletRole, AddressWalletRole,
BalanceWalletRole, BalanceWalletRole,
TokensWalletRole TokensWalletRole,
CountWalletRole
}; };
class DapChainWalletsModel : public QAbstractListModel class DapChainWalletsModel : public QAbstractListModel
......
...@@ -57,7 +57,7 @@ Dialog { ...@@ -57,7 +57,7 @@ Dialog {
delegate: ItemDelegate { delegate: ItemDelegate {
width: comboBoxToken.width width: comboBoxToken.width
contentItem: Text { contentItem: Text {
text: modelData text: token
font: comboBoxToken.font font: comboBoxToken.font
elide: Text.ElideRight elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
......
...@@ -27,33 +27,16 @@ DapUiQmlWidgetChainWalletForm { ...@@ -27,33 +27,16 @@ DapUiQmlWidgetChainWalletForm {
} }
} }
} }
listViewTokens.onCurrentItemChanged:
{
updateBalanceText();
console.log(textBalance.text);
}
buttonSaveWallet.onClicked: {
dialogAddWallet.show()
}
buttonDeleteWallet.onClicked: {
dialogRemoveWallet.show()
}
buttonSendToken.onClicked: {
dialogSendToken.show()
}
listViewWallet.onCurrentItemChanged: listViewWallet.onCurrentItemChanged:
{ {
// listViewTokens.model = listViewWallet.model.get(listViewWallet.currentIndex).tokens listViewTokens.model.clear()
for(var i = 0; i < listViewWallet.model.get(listViewWallet.currentIndex).count; i++)
{
var value = listViewWallet.model.get(listViewWallet.currentIndex).balance[i]
listViewTokens.model.append({token: listViewWallet.model.get(listViewWallet.currentIndex).tokens[i], balance: value.replace(/[^\d.-]/g, '')});
}
if(listViewWallet.currentIndex >= 0) if(listViewWallet.currentIndex >= 0)
{ {
indexWallet = listViewWallet.currentIndex indexWallet = listViewWallet.currentIndex
...@@ -65,7 +48,18 @@ DapUiQmlWidgetChainWalletForm { ...@@ -65,7 +48,18 @@ DapUiQmlWidgetChainWalletForm {
listViewWallet.currentIndex = 0 listViewWallet.currentIndex = 0
} }
// updateBalanceText(); addressWallet.text = listViewWallet.model.get(listViewWallet.currentIndex).address
// addressWallet.text = listViewWallet.model.get(listViewWallet.currentIndex).address }
buttonSaveWallet.onClicked: {
dialogAddWallet.show()
}
buttonDeleteWallet.onClicked: {
dialogRemoveWallet.show()
}
buttonSendToken.onClicked: {
dialogSendToken.show()
} }
} }
...@@ -14,7 +14,6 @@ Page { ...@@ -14,7 +14,6 @@ Page {
property alias dialogAddWallet: dialogAddWallet property alias dialogAddWallet: dialogAddWallet
property alias dialogSendToken: dialogSendToken property alias dialogSendToken: dialogSendToken
property alias addressWallet: addressWallet property alias addressWallet: addressWallet
property alias textBalance: textBalance
property alias listViewTokens: listViewTokens property alias listViewTokens: listViewTokens
property alias buttonSendToken: buttonSendToken property alias buttonSendToken: buttonSendToken
property alias buttonDeleteWallet: buttonDeleteWallet property alias buttonDeleteWallet: buttonDeleteWallet
...@@ -71,35 +70,101 @@ Page { ...@@ -71,35 +70,101 @@ Page {
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
TextEdit { Row
id: addressWallet {
font.pixelSize: 11 id: rowAddress
wrapMode: Text.Wrap
selectByMouse: true
color: "black"
selectionColor: "#008080"
clip: true
anchors.top: parent.top anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.left: parent.left anchors.left: parent.left
readOnly: true anchors.right: parent.right
height: 100
width: parent.width
Rectangle
{
id: rectangleLableAddress
color: "green"
width: 150
height: parent.height
Text
{
id: labelAddress
anchors.centerIn: parent
text: "Address"
font.pixelSize: 22
color: "white"
}
}
Column
{
id: columnAddress
width: rowAddress.width - rectangleLableAddress.width
height: parent.height
clip: true
TextEdit {
id: addressWallet
font.pixelSize: 16
wrapMode: TextEdit.WrapAnywhere
selectByMouse: true
color: "#353841"
selectionColor: "#353841"
clip: true
readOnly: true
height: parent.height - rectangleBottomBorder.height
width: parent.width
verticalAlignment: TextEdit.AlignVCenter
horizontalAlignment: TextEdit.AlignHCenter
}
Rectangle
{
id: rectangleBottomBorder
color: "green"
height: 1
width: columnAddress.width
}
}
} }
ListView { ListView {
id: listViewTokens id: listViewTokens
orientation: ListView.Vertical height: 100
anchors.top: addressWallet.bottom orientation: ListView.Horizontal
anchors.top: rowAddress.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.bottom: parent.bottom anchors.right: parent.right
width: parent.width * 2 / 3
flickableDirection: Flickable.VerticalFlick flickableDirection: Flickable.VerticalFlick
delegate: Item { preferredHighlightBegin: parent.width/2-width/3/2;
width: 200 preferredHighlightEnd: parent.width/2+width/3/2
height: 50 highlightRangeMode: ListView.StrictlyEnforceRange
Text { snapMode: ListView.SnapOneItem;
id: nameField model: ListModel {
text: modelData id: modelTokens
color: listViewTokens.currentIndex === index ? 'green' : 'black' }
delegate: Item {
id: delegateListViewTokens
width: listViewTokens.width/3; height: listViewTokens.height
Column
{
id: itemRectangleIfoWallet
anchors.centerIn: delegateListViewTokens
Text {
id: itemNameWallet;
anchors.horizontalCenter: parent.horizontalCenter
text: token;
color: listViewTokens.currentIndex === index ? 'green' : "#BBBEBF";
font.pixelSize: listViewTokens.currentIndex === index ? 40 : 30;
font.family: "Roboto"
font.weight: Font.Thin
}
Text {
id: itemBalanceWallet;
anchors.horizontalCenter: parent.horizontalCenter
text: balance
color: listViewTokens.currentIndex === index ? 'green' : "#BBBEBF";
font.pixelSize: listViewTokens.currentIndex === index ? 40 : 30;
font.family: "Roboto"
font.weight: Font.Thin
}
} }
MouseArea { MouseArea {
anchors.fill: parent anchors.fill: parent
...@@ -108,20 +173,26 @@ Page { ...@@ -108,20 +173,26 @@ Page {
} }
focus: true focus: true
clip: true
} }
Text { Rectangle
id: textBalance {
wrapMode: Text.NoWrap id: rectangleHistory
textFormat: Text.PlainText anchors.top: listViewTokens.bottom
clip: false anchors.left: parent.left
anchors.top: addressWallet.bottom
anchors.left: listViewTokens.right
anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
color: "green"
font.pixelSize: 30 width: parent.width
font.bold: true height: 30
Text
{
id: labelHistory
anchors.centerIn: parent
text: "History"
font.pixelSize: 22
color: "white"
}
} }
} }
......
...@@ -71,3 +71,8 @@ void DapChainWallet::setTokens(const QStringList &aTokens) ...@@ -71,3 +71,8 @@ void DapChainWallet::setTokens(const QStringList &aTokens)
emit tokensChanged(m_tokens); emit tokensChanged(m_tokens);
} }
int DapChainWallet::getCount() const
{
return m_tokens.count();
}
...@@ -13,6 +13,7 @@ class DapChainWallet : public QObject ...@@ -13,6 +13,7 @@ class DapChainWallet : public QObject
QString m_sAddress; QString m_sAddress;
QStringList m_balance; QStringList m_balance;
QStringList m_tokens; QStringList m_tokens;
int m_iCount;
public: public:
DapChainWallet(QObject *parent = nullptr) { Q_UNUSED(parent)} DapChainWallet(QObject *parent = nullptr) { Q_UNUSED(parent)}
...@@ -25,6 +26,7 @@ public: ...@@ -25,6 +26,7 @@ public:
Q_PROPERTY(QString address MEMBER m_sAddress READ getAddress WRITE setAddress NOTIFY addressChanged) Q_PROPERTY(QString address MEMBER m_sAddress READ getAddress WRITE setAddress NOTIFY addressChanged)
Q_PROPERTY(QStringList balance MEMBER m_balance READ getBalance WRITE setBalance NOTIFY balanceChanged) Q_PROPERTY(QStringList balance MEMBER m_balance READ getBalance WRITE setBalance NOTIFY balanceChanged)
Q_PROPERTY(QStringList tokens MEMBER m_tokens READ getTokens WRITE setTokens NOTIFY tokensChanged) Q_PROPERTY(QStringList tokens MEMBER m_tokens READ getTokens WRITE setTokens NOTIFY tokensChanged)
Q_PROPERTY(int count MEMBER m_iCount READ getCount)
QString getName() const; QString getName() const;
void setName(const QString &asName); void setName(const QString &asName);
...@@ -40,6 +42,8 @@ public: ...@@ -40,6 +42,8 @@ public:
QStringList getTokens() const; QStringList getTokens() const;
void setTokens(const QStringList& aTokens); void setTokens(const QStringList& aTokens);
int getCount() const;
signals: signals:
void iconPathChanged(const QString& asIconPath); void iconPathChanged(const QString& asIconPath);
void nameChanged(const QString& asName); void nameChanged(const QString& asName);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment