Browse Source

dont refresh to often

pull/130/head
DenioD 4 years ago
parent
commit
8ffed6683c
  1. 3
      src/DataStore/ChatDataStore.cpp
  2. 2
      src/chatmodel.cpp
  3. 35
      src/controller.cpp
  4. 1
      src/controller.h
  5. 4
      src/mainwindow.cpp

3
src/DataStore/ChatDataStore.cpp

@ -60,7 +60,8 @@ std::map<QString, ChatItem> ChatDataStore::getAllNewContactRequests()
if ( if (
(c.second.isOutgoing() == false) && (c.second.isOutgoing() == false) &&
(c.second.getType() == "Cont") && (c.second.getType() == "Cont") &&
(c.second.isContact() == false) (c.second.isContact() == false) &&
(c.second.getMemo().isEmpty())
) )
{ {

2
src/chatmodel.cpp

@ -618,7 +618,7 @@ void MainWindow::sendChat() {
} }
); );
rpc->refresh(true); // rpc->refresh(true);
} }
QString MainWindow::doSendChatTxValidations(Tx tx) { QString MainWindow::doSendChatTxValidations(Tx tx) {

35
src/controller.cpp

@ -963,22 +963,12 @@ void Controller::refreshTransactions() {
}else{ }else{
publickey = ""; publickey = "";
} }
int lengthcid = cid.length();
char *cidchar = NULL;
cidchar = new char[lengthcid+1];
strncpy(cidchar, cid.toLocal8Bit(), lengthcid +1);
/////We need to filter out Memos smaller then the ciphertext size, or it will dump /////We need to filter out Memos smaller then the ciphertext size, or it will dump
if ((memo.startsWith("{") == false) && (headerbytes > 0)) if ((memo.startsWith("{") == false) && (headerbytes > 0))
{ {
//QString myAddr = p.getMyAddress();
QString passphrase = main->getPassword(); QString passphrase = main->getPassword();
QString hashEncryptionKey = passphrase; QString hashEncryptionKey = passphrase;
int length = hashEncryptionKey.length(); int length = hashEncryptionKey.length();
@ -1068,11 +1058,11 @@ void Controller::refreshTransactions() {
if (ui->decryptionMessage->isChecked()){ if (ui->decryptionMessage->isChecked()){
memodecrypt = QString::fromUtf8( decryptedMemo.data(), decryptedMemo.size()); memodecrypt = QString::fromUtf8( decryptedMemo.data(), decryptedMemo.size());
DataStore::getChatDataStore()->clear(); DataStore::getChatDataStore()->clear();
this->refresh(true); // this->refresh(true);
chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat); chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat);
}else{ memodecrypt = memo; }else{ memodecrypt = memo;
DataStore::getChatDataStore()->clear(); DataStore::getChatDataStore()->clear();
this->refresh(true); // this->refresh(true);
chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat); chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat);
} }
@ -1097,7 +1087,7 @@ void Controller::refreshTransactions() {
); );
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item); DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
updateUIBalances();
}else{ }else{
@ -1117,7 +1107,7 @@ void Controller::refreshTransactions() {
false false
); );
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item); DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
updateUIBalances();
} }
} }
@ -1181,7 +1171,7 @@ void Controller::refreshTransactions() {
chatModel->addAddressbylabel(address, requestZaddr); chatModel->addAddressbylabel(address, requestZaddr);
} else{} } else{}
}
if (chatModel->Addressbylabel(address) != QString("0xdeadbeef")){ if (chatModel->Addressbylabel(address) != QString("0xdeadbeef")){
isContact = true; isContact = true;
@ -1359,12 +1349,15 @@ void Controller::refreshTransactions() {
if (ui->decryptionMessage->isChecked()){ if (ui->decryptionMessage->isChecked()){
memodecrypt = QString::fromUtf8( decryptedMemo.data(), decryptedMemo.size()); memodecrypt = QString::fromUtf8( decryptedMemo.data(), decryptedMemo.size());
DataStore::getChatDataStore()->clear(); DataStore::getChatDataStore()->clear();
this->refresh(true); // this->refresh(true);
chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat);
}else{ memodecrypt = memo;
DataStore::getChatDataStore()->clear();
this->refresh(true);
chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat); chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat);
}else{
memodecrypt = memo;
DataStore::getChatDataStore()->clear();
//this->refresh(true);
chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat);
} }
@ -1415,7 +1408,7 @@ void Controller::refreshTransactions() {
} }
} // }
} }
} }
} }

1
src/controller.h

@ -80,6 +80,7 @@ public:
void refreshGBPCAP(); void refreshGBPCAP();
void refreshAUDCAP(); void refreshAUDCAP();
void refreshChat(QListView *listWidget, QLabel *label); void refreshChat(QListView *listWidget, QLabel *label);
void refreshContacts(QListView *listWidget); void refreshContacts(QListView *listWidget);

4
src/mainwindow.cpp

@ -1357,7 +1357,9 @@ void MainWindow::setupchatTab() {
ui->memoTxtChat->setTextColor("Black"); ui->memoTxtChat->setTextColor("Black");
} }
ui->decryptionMessage->setChecked(true);
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChat); QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChat);
QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact); QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact);
QObject::connect(ui->pushContact, &QPushButton::clicked, this , &MainWindow::renderContactRequest); QObject::connect(ui->pushContact, &QPushButton::clicked, this , &MainWindow::renderContactRequest);

Loading…
Cancel
Save