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;
|
this->headerMap[tx] = headerbytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatModel::addMemo(QString tx, QString memo)
|
||||||
|
{
|
||||||
|
this->OldMemoByTx[tx] = memo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void ChatModel::addrequestZaddr(QString tx, QString requestZaddr)
|
void ChatModel::addrequestZaddr(QString tx, QString requestZaddr)
|
||||||
@@ -287,6 +292,21 @@ QString ChatModel::getCidByTx(QString tx)
|
|||||||
return QString("0xdeadbeef");
|
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();
|
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)
|
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<int, std::tuple<QString, QString, QString>> sendrequestMap;
|
||||||
std::map<QString, QString> headerMap;
|
std::map<QString, QString> headerMap;
|
||||||
std::map<QString, QString> AddressbyLabelMap;
|
std::map<QString, QString> AddressbyLabelMap;
|
||||||
|
std::map<QString, QString> OldMemoByTx;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -55,6 +56,7 @@ class ChatModel
|
|||||||
void addMessage(QString timestamp, ChatItem item);
|
void addMessage(QString timestamp, ChatItem item);
|
||||||
void addCid(QString tx, QString cid);
|
void addCid(QString tx, QString cid);
|
||||||
void addHeader(QString tx, QString headerbytes);
|
void addHeader(QString tx, QString headerbytes);
|
||||||
|
void addMemo(QString tx, QString memo);
|
||||||
void addrequestZaddr(QString tx, QString requestZaddr);
|
void addrequestZaddr(QString tx, QString requestZaddr);
|
||||||
void addconfirmations(QString tx, int confirmation);
|
void addconfirmations(QString tx, int confirmation);
|
||||||
void addSendRequest(int i, QString myAddr, QString cid, QString addr );
|
void addSendRequest(int i, QString myAddr, QString cid, QString addr );
|
||||||
@@ -62,10 +64,12 @@ class ChatModel
|
|||||||
QString getHeaderByTx(QString tx);
|
QString getHeaderByTx(QString tx);
|
||||||
QString getrequestZaddrByTx(QString tx);
|
QString getrequestZaddrByTx(QString tx);
|
||||||
QString getConfirmationByTx(QString tx);
|
QString getConfirmationByTx(QString tx);
|
||||||
|
QString getMemoByTx(QString tx);
|
||||||
QString Addressbylabel(QString addr);
|
QString Addressbylabel(QString addr);
|
||||||
void killCidCache();
|
void killCidCache();
|
||||||
void killConfirmationCache();
|
void killConfirmationCache();
|
||||||
void killrequestZaddrCache();
|
void killrequestZaddrCache();
|
||||||
|
void killMemoCache();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -905,6 +905,7 @@ void Controller::refreshTransactions() {
|
|||||||
if ((confirmations == 1) && (chatModel->getConfirmationByTx(txid) != QString("0xdeadbeef"))){
|
if ((confirmations == 1) && (chatModel->getConfirmationByTx(txid) != QString("0xdeadbeef"))){
|
||||||
DataStore::getChatDataStore()->clear();
|
DataStore::getChatDataStore()->clear();
|
||||||
chatModel->killConfirmationCache();
|
chatModel->killConfirmationCache();
|
||||||
|
chatModel->killMemoCache();
|
||||||
this->refresh(true);
|
this->refresh(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1107,11 +1108,7 @@ void Controller::refreshTransactions() {
|
|||||||
|
|
||||||
items.push_back(TransactionItemDetail{address, amount, memo});
|
items.push_back(TransactionItemDetail{address, amount, memo});
|
||||||
total_amount = total_amount + amount;
|
total_amount = total_amount + amount;
|
||||||
// }else{
|
|
||||||
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -1200,8 +1197,7 @@ void Controller::refreshTransactions() {
|
|||||||
if (publickey.length() > 10){
|
if (publickey.length() > 10){
|
||||||
main->addPubkey(requestZaddr, publickey);
|
main->addPubkey(requestZaddr, publickey);
|
||||||
}
|
}
|
||||||
qDebug()<<"Scane HM Incoming:";
|
|
||||||
qDebug()<<"Scane HM Incoming:"<<publickey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1251,9 +1247,23 @@ void Controller::refreshTransactions() {
|
|||||||
isNotarized = false;
|
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();
|
int lengthcid = cid.length();
|
||||||
QString passphrase = main->getPassword();
|
QString passphrase = main->getPassword();
|
||||||
QString hashEncryptionKey = passphrase;
|
QString hashEncryptionKey = passphrase;
|
||||||
@@ -1370,6 +1380,10 @@ void Controller::refreshTransactions() {
|
|||||||
|
|
||||||
}else{
|
}else{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
ChatItem item = ChatItem(
|
ChatItem item = ChatItem(
|
||||||
datetime,
|
datetime,
|
||||||
address,
|
address,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
<item row="0" column="0" colspan="2">
|
<item row="0" column="0" colspan="2">
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>1</number>
|
<number>5</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@@ -1502,9 +1502,21 @@
|
|||||||
<property name="sizeAdjustPolicy">
|
<property name="sizeAdjustPolicy">
|
||||||
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
<enum>QAbstractScrollArea::AdjustToContents</enum>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="autoScroll">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
<property name="editTriggers">
|
<property name="editTriggers">
|
||||||
<set>QAbstractItemView::NoEditTriggers</set>
|
<set>QAbstractItemView::NoEditTriggers</set>
|
||||||
</property>
|
</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">
|
<property name="resizeMode">
|
||||||
<enum>QListView::Adjust</enum>
|
<enum>QListView::Adjust</enum>
|
||||||
</property>
|
</property>
|
||||||
@@ -1517,6 +1529,9 @@
|
|||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="selectionRectVisible">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="safeContactRequest">
|
<widget class="QPushButton" name="safeContactRequest">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ QString Settings::getDonationAddr() {
|
|||||||
if (Settings::getInstance()->isTestnet())
|
if (Settings::getInstance()->isTestnet())
|
||||||
return "ztestsaplingXXX";
|
return "ztestsaplingXXX";
|
||||||
else
|
else
|
||||||
return "zs1kwp3h4rwz76zfqzmwqqextq696kndtjskg4fzc80l9ygfal4hchcsst83ua8tjwzzy9nja7v5rr";
|
return "zs1fq9f7vg797qaeac9lyx0njyjmjg4w7m60hwq6lhyhvdcqltl5hdkm8vwx9cxy60ehuuz2x49jxt";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user