Browse Source

dont scan transactions to often

pull/130/head
DenioD 4 years ago
parent
commit
96a073cacf
  1. 2
      src/addressbook.cpp
  2. 36
      src/controller.cpp

2
src/addressbook.cpp

@ -156,7 +156,7 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
ab.addr_chat->setText(myAddr); ab.addr_chat->setText(myAddr);
}); });
model.updateUi(); //todo fix updating gui after adding model.updateUi(); //todo fix updating gui after adding
rpc->refresh(true); //rpc->refresh(true);
// If there is a target then make it the addr for the "Add to" button // If there is a target then make it the addr for the "Add to" button
if (target != nullptr && Settings::isValidAddress(target->text())) if (target != nullptr && Settings::isValidAddress(target->text()))

36
src/controller.cpp

@ -867,22 +867,14 @@ void Controller::refreshTransactions() {
QString memo; QString memo;
if (!o["memo"].is_null()) { if (!o["memo"].is_null()) {
memo = QString::fromStdString(o["memo"]); memo = QString::fromStdString(o["memo"]);
}
QString cid; QString cid;
QString contact;
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
{
if (address == c.getPartnerAddress()){
contact = c.getName();
}else{ contact = "";}
}
ChatItem item = ChatItem( ChatItem item = ChatItem(
datetime, datetime,
address, address,
contact, QString(""),
memo, memo,
QString(""), QString(""),
QString(""), QString(""),
@ -890,12 +882,11 @@ void Controller::refreshTransactions() {
txid, txid,
true true
); );
qDebug()<<"Kontaktname : " <<contact;
qDebug()<<"Memo : " <<memo; qDebug()<<"Memo : " <<memo;
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item); DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
// } }
items.push_back(TransactionItemDetail{address, amount, memo}); items.push_back(TransactionItemDetail{address, amount, memo});
total_amount = total_amount + amount; total_amount = total_amount + amount;
@ -947,7 +938,7 @@ void Controller::refreshTransactions() {
// int position; // int position;
QString requestZaddr; QString requestZaddr;
if (memo.startsWith("{")) { if ((memo.startsWith("{")) && (!it["memo"].is_null())) {
QJsonDocument headermemo = QJsonDocument::fromJson(memo.toUtf8()); QJsonDocument headermemo = QJsonDocument::fromJson(memo.toUtf8());
@ -958,7 +949,7 @@ void Controller::refreshTransactions() {
chatModel->addCid(txid, cid); chatModel->addCid(txid, cid);
chatModel->addrequestZaddr(txid, requestZaddr); chatModel->addrequestZaddr(txid, requestZaddr);
} // }
if (chatModel->getCidByTx(txid) != QString("0xdeadbeef")){ if (chatModel->getCidByTx(txid) != QString("0xdeadbeef")){
@ -980,22 +971,13 @@ void Controller::refreshTransactions() {
requestZaddr = ""; requestZaddr = "";
} }
QString contact;
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
{
if (address == c.getMyAddress()){
contact = c.getName();
}else{ contact = "";}
}
// position = it["position"].get<json::number_integer_t>(); // position = it["position"].get<json::number_integer_t>();
ChatItem item = ChatItem( ChatItem item = ChatItem(
datetime, datetime,
address, address,
contact, QString(""),
memo, memo,
requestZaddr, requestZaddr,
type, type,
@ -1003,10 +985,10 @@ void Controller::refreshTransactions() {
txid, txid,
false false
); );
qDebug()<<"Kontaktname : " <<contact; qDebug()<<"CID : " <<cid;
qDebug()<<"Memo : " <<memo; qDebug()<<"Memo : " <<memo;
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item); DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
// } }
} }
} }

Loading…
Cancel
Save