render only new requests
This commit is contained in:
@@ -55,7 +55,6 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
|
|||||||
{
|
{
|
||||||
for (auto &c : DataStore::getChatDataStore()->getAllMemos())
|
for (auto &c : DataStore::getChatDataStore()->getAllMemos())
|
||||||
{
|
{
|
||||||
//////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid
|
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(p.getName() == ui->contactNameMemo->text().trimmed()) &&
|
(p.getName() == ui->contactNameMemo->text().trimmed()) &&
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "ChatDataStore.h"
|
#include "ChatDataStore.h"
|
||||||
#include "addressbook.h"
|
#include "addressbook.h"
|
||||||
|
#include "chatmodel.h"
|
||||||
|
|
||||||
|
|
||||||
ChatDataStore* ChatDataStore::getInstance()
|
ChatDataStore* ChatDataStore::getInstance()
|
||||||
{
|
{
|
||||||
@@ -53,15 +55,14 @@ std::map<QString, ChatItem> ChatDataStore::getAllNewContactRequests()
|
|||||||
{
|
{
|
||||||
std::map<QString, ChatItem> filteredItems;
|
std::map<QString, ChatItem> filteredItems;
|
||||||
|
|
||||||
for(auto &c: this->data)
|
for(auto &c: this->data)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
(c.second.isOutgoing() == false) &&
|
(c.second.isOutgoing() == false) &&
|
||||||
(c.second.getType() == "Cont") &&
|
(c.second.getType() == "Cont") &&
|
||||||
(c.second.getContact() == "")
|
(c.second.isContact() == false)
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
{
|
{
|
||||||
filteredItems[c.first] = c.second;
|
filteredItems[c.first] = c.second;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
#include "FileSystem.h"
|
// Copyright 2019-2020 The Hush developers
|
||||||
|
// GPLv3
|
||||||
|
|
||||||
|
#include "FileSystem.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
#include "../Crypto/passwd.h"
|
#include "../Crypto/passwd.h"
|
||||||
|
#include "addressbook.h"
|
||||||
|
|
||||||
FileSystem::FileSystem()
|
FileSystem::FileSystem()
|
||||||
{
|
{
|
||||||
@@ -99,7 +102,6 @@ QList<ContactItem> FileSystem::readContactsOldFormat(QString file)
|
|||||||
qDebug() << "Detected old addressbook format";
|
qDebug() << "Detected old addressbook format";
|
||||||
QList<QList<QString>> stuff;
|
QList<QList<QString>> stuff;
|
||||||
in >> stuff;
|
in >> stuff;
|
||||||
//qDebug() << "Stuff: " << stuff;
|
|
||||||
for (int i=0; i < stuff.size(); i++)
|
for (int i=0; i < stuff.size(); i++)
|
||||||
{
|
{
|
||||||
ContactItem contact = ContactItem(stuff[i][0],stuff[i][1], stuff[i][2], stuff[i][3],stuff[i][4]);
|
ContactItem contact = ContactItem(stuff[i][0],stuff[i][1], stuff[i][2], stuff[i][3],stuff[i][4]);
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
// Copyright 2019-2020 The Hush developers
|
||||||
|
// GPLv3
|
||||||
#ifndef FILESYSTEM_H
|
#ifndef FILESYSTEM_H
|
||||||
#define FILESYSTEM_H
|
#define FILESYSTEM_H
|
||||||
|
|
||||||
@@ -13,7 +15,7 @@ class FileSystem
|
|||||||
static bool instanced;
|
static bool instanced;
|
||||||
static FileSystem* instance;
|
static FileSystem* instance;
|
||||||
FileSystem();
|
FileSystem();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static FileSystem* getInstance();
|
static FileSystem* getInstance();
|
||||||
QList<ContactItem> readContacts(QString file);
|
QList<ContactItem> readContacts(QString file);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
ChatItem::ChatItem() {}
|
ChatItem::ChatItem() {}
|
||||||
|
|
||||||
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize)
|
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize, bool iscontact)
|
||||||
{
|
{
|
||||||
_timestamp = timestamp;
|
_timestamp = timestamp;
|
||||||
_address = address;
|
_address = address;
|
||||||
@@ -18,9 +18,10 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
|
|||||||
_confirmations = confirmations;
|
_confirmations = confirmations;
|
||||||
_outgoing = false;
|
_outgoing = false;
|
||||||
_notarize = notarize;
|
_notarize = notarize;
|
||||||
|
_iscontact = iscontact;
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize)
|
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize, bool iscontact)
|
||||||
{
|
{
|
||||||
_timestamp = timestamp;
|
_timestamp = timestamp;
|
||||||
_address = address;
|
_address = address;
|
||||||
@@ -33,6 +34,8 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
|
|||||||
_confirmations = confirmations;
|
_confirmations = confirmations;
|
||||||
_outgoing = outgoing;
|
_outgoing = outgoing;
|
||||||
_notarize = notarize;
|
_notarize = notarize;
|
||||||
|
_iscontact = iscontact;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long ChatItem::getTimestamp()
|
long ChatItem::getTimestamp()
|
||||||
@@ -88,6 +91,11 @@ bool ChatItem::isNotarized()
|
|||||||
return _notarize;
|
return _notarize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ChatItem::isContact()
|
||||||
|
{
|
||||||
|
return _iscontact;
|
||||||
|
}
|
||||||
|
|
||||||
void ChatItem::setTimestamp(long timestamp)
|
void ChatItem::setTimestamp(long timestamp)
|
||||||
{
|
{
|
||||||
_timestamp = timestamp;
|
_timestamp = timestamp;
|
||||||
@@ -140,6 +148,11 @@ void ChatItem::notarized()
|
|||||||
_notarize = false;
|
_notarize = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatItem::contact(bool iscontact)
|
||||||
|
{
|
||||||
|
_iscontact = iscontact;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString ChatItem::toChatLine()
|
QString ChatItem::toChatLine()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,11 +21,12 @@ class ChatItem
|
|||||||
int _confirmations;
|
int _confirmations;
|
||||||
bool _outgoing = false;
|
bool _outgoing = false;
|
||||||
bool _notarize = false;
|
bool _notarize = false;
|
||||||
|
bool _iscontact = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatItem();
|
ChatItem();
|
||||||
ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize);
|
ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize, bool iscontact);
|
||||||
ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize);
|
ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize, bool iscontact);
|
||||||
long getTimestamp();
|
long getTimestamp();
|
||||||
QString getAddress();
|
QString getAddress();
|
||||||
QString getContact();
|
QString getContact();
|
||||||
@@ -38,6 +39,7 @@ class ChatItem
|
|||||||
bool isOutgoing();
|
bool isOutgoing();
|
||||||
bool isdouble();
|
bool isdouble();
|
||||||
bool isNotarized();
|
bool isNotarized();
|
||||||
|
bool isContact();
|
||||||
void setTimestamp(long timestamp);
|
void setTimestamp(long timestamp);
|
||||||
void setAddress(QString address);
|
void setAddress(QString address);
|
||||||
void setContact(QString contact);
|
void setContact(QString contact);
|
||||||
@@ -49,6 +51,7 @@ class ChatItem
|
|||||||
void setConfirmations(int confirmations);
|
void setConfirmations(int confirmations);
|
||||||
void toggleOutgo();
|
void toggleOutgo();
|
||||||
void notarized();
|
void notarized();
|
||||||
|
void contact(bool iscontact);
|
||||||
QString toChatLine();
|
QString toChatLine();
|
||||||
json toJson();
|
json toJson();
|
||||||
~ChatItem();
|
~ChatItem();
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
|
// Copyright 2019-2020 The Hush developers
|
||||||
|
// GPLv3
|
||||||
#include "ContactItem.h"
|
#include "ContactItem.h"
|
||||||
|
#include "chatmodel.h"
|
||||||
|
#include "Model/ChatItem.h"
|
||||||
|
#include "controller.h"
|
||||||
|
|
||||||
ContactItem::ContactItem() {}
|
ContactItem::ContactItem() {}
|
||||||
|
|
||||||
@@ -8,7 +13,7 @@ ContactItem::ContactItem(QString name, QString partnerAddress, QString myAddress
|
|||||||
_myAddress = myAddress;
|
_myAddress = myAddress;
|
||||||
_partnerAddress = partnerAddress;
|
_partnerAddress = partnerAddress;
|
||||||
_cid = cid;
|
_cid = cid;
|
||||||
_avatar = avatar;
|
_avatar = avatar;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ContactItem::getName() const
|
QString ContactItem::getName() const
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
// Copyright 2019-2020 The Hush developers
|
||||||
|
// GPLv3
|
||||||
#ifndef CONTACTITEM_H
|
#ifndef CONTACTITEM_H
|
||||||
#define CONTACTITEM_H
|
#define CONTACTITEM_H
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
#include "mainwindow.h"
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
class ContactItem
|
class ContactItem
|
||||||
@@ -13,7 +16,7 @@ private:
|
|||||||
QString _name;
|
QString _name;
|
||||||
QString _cid;
|
QString _cid;
|
||||||
QString _avatar;
|
QString _avatar;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ContactItem();
|
ContactItem();
|
||||||
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid, QString avatar);
|
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid, QString avatar);
|
||||||
|
|||||||
@@ -40,7 +40,10 @@ void AddressBookModel::loadData()
|
|||||||
QSettings().value(
|
QSettings().value(
|
||||||
"addresstablegeometry"
|
"addresstablegeometry"
|
||||||
).toByteArray()
|
).toByteArray()
|
||||||
|
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddressBookModel::addNewLabel(QString label, QString addr, QString myAddr, QString cid, QString avatar)
|
void AddressBookModel::addNewLabel(QString label, QString addr, QString myAddr, QString cid, QString avatar)
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public:
|
|||||||
int columnCount(const QModelIndex &parent) const;
|
int columnCount(const QModelIndex &parent) const;
|
||||||
QVariant data(const QModelIndex &index, int role) const;
|
QVariant data(const QModelIndex &index, int role) const;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -32,7 +33,8 @@ private:
|
|||||||
QTableView* parent;
|
QTableView* parent;
|
||||||
//QList<QPair<QString, QString>> labels;
|
//QList<QPair<QString, QString>> labels;
|
||||||
QList<ContactItem> labels;
|
QList<ContactItem> labels;
|
||||||
QStringList headers;
|
QStringList headers;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class AddressBook {
|
class AddressBook {
|
||||||
@@ -63,6 +65,10 @@ public:
|
|||||||
|
|
||||||
QString get_avatar_name();
|
QString get_avatar_name();
|
||||||
void set_avatar_name(QString avatar_name);
|
void set_avatar_name(QString avatar_name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -76,6 +82,7 @@ private:
|
|||||||
|
|
||||||
QString writeableFile();
|
QString writeableFile();
|
||||||
QList<ContactItem> allLabels;
|
QList<ContactItem> allLabels;
|
||||||
|
|
||||||
|
|
||||||
static AddressBook* instance;
|
static AddressBook* instance;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -71,6 +71,26 @@ void ChatModel::showMessages()
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ChatModel::addAddressbylabel(QString address, QString label)
|
||||||
|
{
|
||||||
|
this->AddressbyLabelMap[address] = label;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString ChatModel::Addressbylabel(QString address)
|
||||||
|
{
|
||||||
|
for(auto& pair : this->AddressbyLabelMap)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this->AddressbyLabelMap.count(address) > 0)
|
||||||
|
{
|
||||||
|
return this->AddressbyLabelMap[address];
|
||||||
|
}
|
||||||
|
|
||||||
|
return QString("0xdeadbeef");
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::renderContactRequest(){
|
void MainWindow::renderContactRequest(){
|
||||||
|
|
||||||
@@ -89,17 +109,22 @@ void MainWindow::renderContactRequest(){
|
|||||||
contactRequest->appendRow(Items);
|
contactRequest->appendRow(Items);
|
||||||
requestContact.requestContact->setModel(contactRequest);
|
requestContact.requestContact->setModel(contactRequest);
|
||||||
requestContact.requestContact->show();
|
requestContact.requestContact->show();
|
||||||
|
requestContact.zaddrnew->setVisible(false);
|
||||||
|
requestContact.zaddrnew->setText(c.second.getAddress());
|
||||||
}
|
}
|
||||||
|
|
||||||
QStandardItemModel* contactRequestOld = new QStandardItemModel();
|
QStandardItemModel* contactRequestOld = new QStandardItemModel();
|
||||||
|
|
||||||
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
for (auto &c : DataStore::getChatDataStore()->getAllOldContactRequests())
|
for (auto &c : DataStore::getChatDataStore()->getAllOldContactRequests())
|
||||||
{
|
{
|
||||||
if (p.getPartnerAddress() == c.second.getRequestZaddr())
|
if (p.getPartnerAddress() == c.second.getRequestZaddr())
|
||||||
{
|
{
|
||||||
QStandardItem* Items = new QStandardItem(c.second.getAddress());
|
QStandardItem* Items = new QStandardItem(p.getName());
|
||||||
contactRequestOld->appendRow(Items);
|
contactRequestOld->appendRow(Items);
|
||||||
requestContact.requestContactOld->setModel(contactRequestOld);
|
requestContact.requestContactOld->setModel(contactRequestOld);
|
||||||
|
requestContact.zaddrold->setVisible(false);
|
||||||
|
requestContact.zaddrold->setText(c.second.getAddress());
|
||||||
requestContact.requestContactOld->show();
|
requestContact.requestContactOld->show();
|
||||||
}else{}
|
}else{}
|
||||||
}
|
}
|
||||||
@@ -135,11 +160,11 @@ void MainWindow::renderContactRequest(){
|
|||||||
QObject::connect(requestContact.requestContactOld, &QTableView::clicked, [&] () {
|
QObject::connect(requestContact.requestContactOld, &QTableView::clicked, [&] () {
|
||||||
|
|
||||||
for (auto &c : DataStore::getChatDataStore()->getAllRawChatItems()){
|
for (auto &c : DataStore::getChatDataStore()->getAllRawChatItems()){
|
||||||
QModelIndex index = requestContact.requestContactOld->currentIndex();
|
/* QModelIndex index = requestContact.requestContactOld->currentIndex();
|
||||||
QString label_contactold = index.data(Qt::DisplayRole).toString();
|
QString label_contactold = index.data(Qt::DisplayRole).toString();*/
|
||||||
QStandardItemModel* contactMemo = new QStandardItemModel();
|
QStandardItemModel* contactMemo = new QStandardItemModel();
|
||||||
|
|
||||||
if ((c.second.isOutgoing() == false) && (label_contactold == c.second.getAddress()) && (c.second.getType() != "Cont"))
|
if ((c.second.isOutgoing() == false) && (requestContact.zaddrold->text() == c.second.getAddress()) && (c.second.getType() != "Cont"))
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -809,7 +834,7 @@ QString MainWindow::doSendRequestTxValidations(Tx tx) {
|
|||||||
auto available = rpc->getModel()->getAvailableBalance();
|
auto available = rpc->getModel()->getAvailableBalance();
|
||||||
|
|
||||||
if (available < total) {
|
if (available < total) {
|
||||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 5 confirmations before they can be spent")
|
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
|
||||||
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
#include "Chat/Helper/ChatDelegator.h"
|
#include "Chat/Helper/ChatDelegator.h"
|
||||||
#include "Chat/Helper/ChatIDGenerator.h"
|
#include "Chat/Helper/ChatIDGenerator.h"
|
||||||
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
@@ -34,6 +35,7 @@ class ChatModel
|
|||||||
std::map<QString, QString> requestZaddrMap;
|
std::map<QString, QString> requestZaddrMap;
|
||||||
std::map<QString, QString> confirmationsMap;
|
std::map<QString, QString> confirmationsMap;
|
||||||
std::map<int, std::tuple<QString, QString, QString>> sendrequestMap;
|
std::map<int, std::tuple<QString, QString, QString>> sendrequestMap;
|
||||||
|
std::map<QString, QString> AddressbyLabelMap;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ChatModel() {};
|
ChatModel() {};
|
||||||
@@ -46,6 +48,7 @@ class ChatModel
|
|||||||
void triggerRequest();
|
void triggerRequest();
|
||||||
void showMessages();
|
void showMessages();
|
||||||
void clear();
|
void clear();
|
||||||
|
void addAddressbylabel(QString addr, QString label);
|
||||||
void addMessage(ChatItem item);
|
void addMessage(ChatItem item);
|
||||||
void addMessage(QString timestamp, ChatItem item);
|
void addMessage(QString timestamp, ChatItem item);
|
||||||
void addCid(QString tx, QString cid);
|
void addCid(QString tx, QString cid);
|
||||||
@@ -55,10 +58,11 @@ class ChatModel
|
|||||||
QString getCidByTx(QString tx);
|
QString getCidByTx(QString tx);
|
||||||
QString getrequestZaddrByTx(QString tx);
|
QString getrequestZaddrByTx(QString tx);
|
||||||
QString getConfirmationByTx(QString tx);
|
QString getConfirmationByTx(QString tx);
|
||||||
|
QString Addressbylabel(QString addr);
|
||||||
void killCidCache();
|
void killCidCache();
|
||||||
void killConfirmationCache();
|
void killConfirmationCache();
|
||||||
void killrequestZaddrCache();
|
void killrequestZaddrCache();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -15,8 +15,7 @@ class ContactModel
|
|||||||
|
|
||||||
ContactModel() {}
|
ContactModel() {}
|
||||||
void renderContactList(QListView* view);
|
void renderContactList(QListView* view);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -935,7 +935,8 @@ void Controller::refreshTransactions() {
|
|||||||
txid,
|
txid,
|
||||||
confirmations,
|
confirmations,
|
||||||
true,
|
true,
|
||||||
isNotarized
|
isNotarized,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||||
|
|
||||||
@@ -991,6 +992,28 @@ void Controller::refreshTransactions() {
|
|||||||
QString cid;
|
QString cid;
|
||||||
int position;
|
int position;
|
||||||
QString requestZaddr;
|
QString requestZaddr;
|
||||||
|
bool isContact;
|
||||||
|
|
||||||
|
|
||||||
|
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
|
{
|
||||||
|
|
||||||
|
if (p.getPartnerAddress() == requestZaddr)
|
||||||
|
{
|
||||||
|
|
||||||
|
chatModel->addAddressbylabel(address, requestZaddr);
|
||||||
|
} else{}
|
||||||
|
|
||||||
|
|
||||||
|
if (chatModel->Addressbylabel(address) != QString("0xdeadbeef")){
|
||||||
|
|
||||||
|
isContact = true;
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
|
isContact = false;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (!it["memo"].is_null()) {
|
if (!it["memo"].is_null()) {
|
||||||
|
|
||||||
@@ -1005,7 +1028,8 @@ 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")){
|
||||||
|
|
||||||
@@ -1045,16 +1069,16 @@ void Controller::refreshTransactions() {
|
|||||||
txid,
|
txid,
|
||||||
confirmations,
|
confirmations,
|
||||||
false,
|
false,
|
||||||
isNotarized
|
isNotarized,
|
||||||
|
isContact
|
||||||
);
|
);
|
||||||
qDebug()<< "Notarized : " << isNotarized;
|
|
||||||
|
|
||||||
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
qDebug()<< getLag();
|
qDebug()<<"get Lag" << getLag();
|
||||||
|
|
||||||
// Calculate the total unspent amount that's pending. This will need to be
|
// Calculate the total unspent amount that's pending. This will need to be
|
||||||
// shown in the UI so the user can keep track of pending funds
|
// shown in the UI so the user can keep track of pending funds
|
||||||
|
|||||||
@@ -1,3 +1,6 @@
|
|||||||
|
// Copyright 2019-2020 The Hush developers
|
||||||
|
// GPLv3
|
||||||
|
|
||||||
#ifndef RPCCLIENT_H
|
#ifndef RPCCLIENT_H
|
||||||
#define RPCCLIENT_H
|
#define RPCCLIENT_H
|
||||||
|
|
||||||
|
|||||||
@@ -1358,7 +1358,6 @@ void MainWindow::setupchatTab() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
QMenu* contextMenu;
|
QMenu* contextMenu;
|
||||||
QAction* requestAction;
|
QAction* requestAction;
|
||||||
QAction* editAction;
|
QAction* editAction;
|
||||||
@@ -1397,7 +1396,6 @@ void MainWindow::setupchatTab() {
|
|||||||
|
|
||||||
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
|
||||||
if (label_contact == p.getName()) {
|
if (label_contact == p.getName()) {
|
||||||
|
|
||||||
|
|
||||||
QString label1 = p.getName();
|
QString label1 = p.getName();
|
||||||
QString addr = p.getPartnerAddress();
|
QString addr = p.getPartnerAddress();
|
||||||
@@ -1407,7 +1405,6 @@ void MainWindow::setupchatTab() {
|
|||||||
|
|
||||||
|
|
||||||
AddressBook::getInstance()->removeAddressLabel(label1, addr, myzaddr, cid,avatar);
|
AddressBook::getInstance()->removeAddressLabel(label1, addr, myzaddr, cid,avatar);
|
||||||
// QList<ContactItem> labels = AddressBook::getInstance()->getAllAddressLabels();
|
|
||||||
rpc->refreshContacts(
|
rpc->refreshContacts(
|
||||||
ui->listContactWidget);
|
ui->listContactWidget);
|
||||||
rpc->refresh(true);
|
rpc->refresh(true);
|
||||||
@@ -1424,13 +1421,11 @@ void MainWindow::updateChat()
|
|||||||
{
|
{
|
||||||
rpc->refreshChat(ui->listChat,ui->memoSizeChat);
|
rpc->refreshChat(ui->listChat,ui->memoSizeChat);
|
||||||
rpc->refresh(true);
|
rpc->refresh(true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateContacts()
|
void MainWindow::updateContacts()
|
||||||
{
|
{
|
||||||
//rpc->refreshContacts(ui->listContactWidget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::addNewZaddr(bool sapling) {
|
void MainWindow::addNewZaddr(bool sapling) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>812</width>
|
<width>850</width>
|
||||||
<height>495</height>
|
<height>495</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="3" colspan="2">
|
<item row="0" column="2" colspan="3">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Memo of the request</span></p></body></html></string>
|
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Memo of the request</span></p></body></html></string>
|
||||||
@@ -97,12 +97,12 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" rowspan="6" colspan="2">
|
<item row="3" column="0" rowspan="8">
|
||||||
<widget class="QListView" name="requestContactOld">
|
<widget class="QListView" name="requestContactOld">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>256</width>
|
<width>256</width>
|
||||||
<height>192</height>
|
<height>190</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="mouseTracking">
|
<property name="mouseTracking">
|
||||||
@@ -119,14 +119,21 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="2" colspan="2">
|
<item row="3" column="1" colspan="3">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" colspan="3">
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Request from :</string>
|
<string>Request from :</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="4" colspan="3">
|
<item row="4" column="4" colspan="3">
|
||||||
<widget class="QLineEdit" name="requestZaddr">
|
<widget class="QLineEdit" name="requestZaddr">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -142,14 +149,14 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="2">
|
<item row="5" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="label_7">
|
<widget class="QLabel" name="label_7">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>My Zaddr :</string>
|
<string>My Zaddr :</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="4" colspan="3">
|
<item row="5" column="4" colspan="3">
|
||||||
<widget class="QLineEdit" name="requestMyAddr">
|
<widget class="QLineEdit" name="requestMyAddr">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -165,24 +172,24 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="2" colspan="2">
|
<item row="6" column="1" colspan="3">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Give a Nickname:</string>
|
<string>Give a Nickname:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="4" colspan="2">
|
<item row="6" column="4" colspan="2">
|
||||||
<widget class="QLineEdit" name="requestLabel"/>
|
<widget class="QLineEdit" name="requestLabel"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="2" colspan="3">
|
<item row="7" column="1" colspan="4">
|
||||||
<widget class="QLabel" name="label_6">
|
<widget class="QLabel" name="label_6">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p align="right">Choose a avatar for your contact :</p></body></html></string>
|
<string><html><head/><body><p align="right">Choose a avatar for your contact :</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="2" colspan="2">
|
<item row="8" column="1" rowspan="2" colspan="3">
|
||||||
<widget class="QComboBox" name="comboBoxAvatar">
|
<widget class="QComboBox" name="comboBoxAvatar">
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -328,7 +335,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="5" rowspan="2">
|
<item row="8" column="5" rowspan="2">
|
||||||
<widget class="QPushButton" name="cancel">
|
<widget class="QPushButton" name="cancel">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -353,7 +360,7 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="6" rowspan="2">
|
<item row="8" column="6" rowspan="2">
|
||||||
<widget class="QPushButton" name="pushButton">
|
<widget class="QPushButton" name="pushButton">
|
||||||
<property name="maximumSize">
|
<property name="maximumSize">
|
||||||
<size>
|
<size>
|
||||||
@@ -369,17 +376,24 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="3" colspan="2">
|
<item row="9" column="2">
|
||||||
<widget class="QLabel" name="requestCID">
|
<widget class="QLabel" name="requestCID">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2" colspan="5">
|
<item row="10" column="1">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="zaddrold">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html></string>
|
<string notr="true"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="3">
|
||||||
|
<widget class="QLabel" name="zaddrnew">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -937,7 +937,7 @@ QString MainWindow::doSendTxValidations(Tx tx) {
|
|||||||
auto available = rpc->getModel()->getAvailableBalance();
|
auto available = rpc->getModel()->getAvailableBalance();
|
||||||
|
|
||||||
if (available < total) {
|
if (available < total) {
|
||||||
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 5 confirmations before they can be spent")
|
return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 1 confirmations before they can be spent")
|
||||||
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
.arg(available.toDecimalhushString(), total.toDecimalhushString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user