use chatitems instead of decryption every time
This commit is contained in:
@@ -260,6 +260,11 @@ void ChatModel::addHeader(QString tx, QString headerbytes)
|
||||
this->headerMap[tx] = headerbytes;
|
||||
}
|
||||
|
||||
void ChatModel::addMemo(QString tx, QString memo)
|
||||
{
|
||||
this->OldMemoByTx[tx] = memo;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void ChatModel::addrequestZaddr(QString tx, QString requestZaddr)
|
||||
@@ -287,6 +292,21 @@ QString ChatModel::getCidByTx(QString tx)
|
||||
return QString("0xdeadbeef");
|
||||
}
|
||||
|
||||
QString ChatModel::getMemoByTx(QString tx)
|
||||
{
|
||||
for(auto& pair : this->OldMemoByTx)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if(this->OldMemoByTx.count(tx) > 0)
|
||||
{
|
||||
return this->OldMemoByTx[tx];
|
||||
}
|
||||
|
||||
return QString("0xdeadbeef");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -349,6 +369,10 @@ void ChatModel::killConfirmationCache()
|
||||
{
|
||||
this->confirmationsMap.clear();
|
||||
}
|
||||
void ChatModel::killMemoCache()
|
||||
{
|
||||
this->OldMemoByTx.clear();
|
||||
}
|
||||
|
||||
QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr, QString headerbytes, QString publickey, int version=0, int headerNumber=1)
|
||||
{
|
||||
|
||||
@@ -37,6 +37,7 @@ class ChatModel
|
||||
std::map<int, std::tuple<QString, QString, QString>> sendrequestMap;
|
||||
std::map<QString, QString> headerMap;
|
||||
std::map<QString, QString> AddressbyLabelMap;
|
||||
std::map<QString, QString> OldMemoByTx;
|
||||
|
||||
|
||||
public:
|
||||
@@ -55,6 +56,7 @@ class ChatModel
|
||||
void addMessage(QString timestamp, ChatItem item);
|
||||
void addCid(QString tx, QString cid);
|
||||
void addHeader(QString tx, QString headerbytes);
|
||||
void addMemo(QString tx, QString memo);
|
||||
void addrequestZaddr(QString tx, QString requestZaddr);
|
||||
void addconfirmations(QString tx, int confirmation);
|
||||
void addSendRequest(int i, QString myAddr, QString cid, QString addr );
|
||||
@@ -62,10 +64,12 @@ class ChatModel
|
||||
QString getHeaderByTx(QString tx);
|
||||
QString getrequestZaddrByTx(QString tx);
|
||||
QString getConfirmationByTx(QString tx);
|
||||
QString getMemoByTx(QString tx);
|
||||
QString Addressbylabel(QString addr);
|
||||
void killCidCache();
|
||||
void killConfirmationCache();
|
||||
void killrequestZaddrCache();
|
||||
void killMemoCache();
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -905,6 +905,7 @@ void Controller::refreshTransactions() {
|
||||
if ((confirmations == 1) && (chatModel->getConfirmationByTx(txid) != QString("0xdeadbeef"))){
|
||||
DataStore::getChatDataStore()->clear();
|
||||
chatModel->killConfirmationCache();
|
||||
chatModel->killMemoCache();
|
||||
this->refresh(true);
|
||||
}
|
||||
|
||||
@@ -1107,11 +1108,7 @@ void Controller::refreshTransactions() {
|
||||
|
||||
items.push_back(TransactionItemDetail{address, amount, memo});
|
||||
total_amount = total_amount + amount;
|
||||
// }else{
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
{
|
||||
@@ -1200,8 +1197,7 @@ void Controller::refreshTransactions() {
|
||||
if (publickey.length() > 10){
|
||||
main->addPubkey(requestZaddr, publickey);
|
||||
}
|
||||
qDebug()<<"Scane HM Incoming:";
|
||||
qDebug()<<"Scane HM Incoming:"<<publickey;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1251,9 +1247,23 @@ void Controller::refreshTransactions() {
|
||||
isNotarized = false;
|
||||
}
|
||||
|
||||
if ((memo.startsWith("{") == false) && (headerbytes > 20))
|
||||
int position = it["position"].get<json::number_integer_t>();
|
||||
|
||||
if ((memo.startsWith("{") == false) && (headerbytes > 0))
|
||||
{
|
||||
|
||||
if (chatModel->getMemoByTx(txid) == QString("0xdeadbeef")){
|
||||
|
||||
|
||||
if (position == 1)
|
||||
{
|
||||
|
||||
chatModel->addMemo(txid, headerbytes);
|
||||
}else{}
|
||||
|
||||
|
||||
qDebug()<<"Position message :"<<position;
|
||||
|
||||
int lengthcid = cid.length();
|
||||
QString passphrase = main->getPassword();
|
||||
QString hashEncryptionKey = passphrase;
|
||||
@@ -1369,6 +1379,10 @@ void Controller::refreshTransactions() {
|
||||
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
ChatItem item = ChatItem(
|
||||
datetime,
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>5</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@@ -1502,9 +1502,21 @@
|
||||
<property name="sizeAdjustPolicy">
|
||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||
</property>
|
||||
<property name="autoScroll">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ContiguousSelection</enum>
|
||||
</property>
|
||||
<property name="verticalScrollMode">
|
||||
<enum>QAbstractItemView::ScrollPerItem</enum>
|
||||
</property>
|
||||
<property name="movement">
|
||||
<enum>QListView::Snap</enum>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
@@ -1517,6 +1529,9 @@
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionRectVisible">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="safeContactRequest">
|
||||
<property name="geometry">
|
||||
|
||||
@@ -302,7 +302,7 @@ QString Settings::getDonationAddr() {
|
||||
if (Settings::getInstance()->isTestnet())
|
||||
return "ztestsaplingXXX";
|
||||
else
|
||||
return "zs1kwp3h4rwz76zfqzmwqqextq696kndtjskg4fzc80l9ygfal4hchcsst83ua8tjwzzy9nja7v5rr";
|
||||
return "zs1fq9f7vg797qaeac9lyx0njyjmjg4w7m60hwq6lhyhvdcqltl5hdkm8vwx9cxy60ehuuz2x49jxt";
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user