fix Balance render problems

This commit is contained in:
DenioD
2020-06-25 09:40:42 +02:00
parent 825e1926c3
commit 3edf50f39f
5 changed files with 245 additions and 86 deletions

View File

@@ -638,7 +638,7 @@ void Controller::getInfoThenRefresh(bool force)
refreshAddresses(); // This calls refreshZSentTransactions() and refreshReceivedZTrans()
refreshTransactions();
}
refreshBalances();
int lag = longestchain - notarized ;
this->setLag(lag);
}, [=](QString err) {
@@ -730,7 +730,7 @@ void Controller::processUnspent(const QJsonValue& reply, QMap<QString, CAmount>*
QString qsAddr = it["address"].toString();
int block = it["created_in_block"].toInt();
QString txid = it["created_in_txid"].toString();
CAmount amount = CAmount::fromqint64(it["value"].toInt());
CAmount amount = CAmount::fromqint64(it["value"].toDouble());
bool spendable = it["unconfirmed_spent"].isNull() && it["spent"].isNull(); // TODO: Wait for 1 confirmations
bool pending = !it["unconfirmed_spent"].isNull();
@@ -741,7 +741,7 @@ void Controller::processUnspent(const QJsonValue& reply, QMap<QString, CAmount>*
if (spendable)
{
(*balancesMap)[qsAddr] = (*balancesMap)[qsAddr] +
CAmount::fromqint64(it["value"].toInt());
CAmount::fromqint64(it["value"].toDouble());
}
}
};
@@ -906,9 +906,9 @@ void Controller::refreshBalances()
// 1. Get the Balances
zrpc->fetchBalance([=] (QJsonValue reply) {
CAmount balT = CAmount::fromqint64(reply["tbalance"].toInt());
CAmount balZ = CAmount::fromqint64(reply["zbalance"].toInt());
CAmount balVerified = CAmount::fromqint64(reply["verified_zbalance"].toInt());
CAmount balT = CAmount::fromqint64(reply["tbalance"].toDouble());
CAmount balZ = CAmount::fromqint64(reply["zbalance"].toDouble());
CAmount balVerified = CAmount::fromqint64(reply["verified_zbalance"].toDouble());
model->setBalT(balT);
model->setBalZ(balZ);
@@ -985,7 +985,7 @@ void Controller::refreshTransactions() {
address = o.toObject()["address"].toString();
// Sent items are -ve
CAmount amount = CAmount::fromqint64(-1* o.toObject()["value"].toInt());
CAmount amount = CAmount::fromqint64(-1* o.toObject()["value"].toDouble());
// Check for Memos
@@ -1169,7 +1169,7 @@ void Controller::refreshTransactions() {
);
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
updateUIBalances();
// updateUIBalances();
}
}
@@ -1194,18 +1194,18 @@ void Controller::refreshTransactions() {
}
else
{
// Incoming Transaction
{ // Incoming Transaction
address = (it.toObject()["address"].isNull() ? "" : it.toObject()["address"].toString());
model->markAddressUsed(address);
QString memo;
if (!it.toObject()["memo"].isNull()) {
if (!it.toObject()["memo"].isNull())
memo = it.toObject()["memo"].toString();
}
items.push_back(TransactionItemDetail{
address,
CAmount::fromqint64(it.toObject()["amount"].toInt()),
CAmount::fromqint64(it.toObject()["amount"].toDouble()),
memo
});
@@ -1214,7 +1214,14 @@ void Controller::refreshTransactions() {
};
txdata.push_back(tx);
}
address = (it.toObject()["address"].isNull() ? "" : it.toObject()["address"].toString());
model->markAddressUsed(address);
QString memo;
if (!it.toObject()["memo"].isNull())
memo = it.toObject()["memo"].toString();
QString type;
QString publickey;
QString headerbytes;
@@ -1470,8 +1477,9 @@ void Controller::refreshTransactions() {
chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat);
ui->listChat->verticalScrollBar()->setValue(
ui->listChat->verticalScrollBar()->maximum());
});
}
void Controller::refreshChat(QListView *listWidget, QLabel *label)