readContacts(QString file);
diff --git a/src/Model/ChatItem.cpp b/src/Model/ChatItem.cpp
index fff8f9a..6a30f56 100644
--- a/src/Model/ChatItem.cpp
+++ b/src/Model/ChatItem.cpp
@@ -5,7 +5,7 @@
ChatItem::ChatItem() {}
-ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations)
+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;
_address = address;
@@ -17,9 +17,11 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
_txid = txid;
_confirmations = confirmations;
_outgoing = false;
+ _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)
+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;
_address = address;
@@ -31,6 +33,9 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
_txid = txid;
_confirmations = confirmations;
_outgoing = outgoing;
+ _notarize = notarize;
+ _iscontact = iscontact;
+
}
long ChatItem::getTimestamp()
@@ -81,6 +86,16 @@ bool ChatItem::isOutgoing()
return _outgoing;
}
+bool ChatItem::isNotarized()
+{
+ return _notarize;
+}
+
+bool ChatItem::isContact()
+{
+ return _iscontact;
+}
+
void ChatItem::setTimestamp(long timestamp)
{
_timestamp = timestamp;
@@ -128,6 +143,15 @@ void ChatItem::toggleOutgo()
{
_outgoing = true;
}
+void ChatItem::notarized()
+{
+ _notarize = false;
+}
+
+void ChatItem::contact(bool iscontact)
+{
+ _iscontact = iscontact;
+}
QString ChatItem::toChatLine()
@@ -136,14 +160,25 @@ QString ChatItem::toChatLine()
QString lock;
myDateTime.setTime_t(_timestamp);
- if (_confirmations == 0){
+ if (_notarize == true)
+
+ {
+
+ lock = " ";
+
+ }else{
+
lock = " ";
- }else{
+ }
+ if ((_confirmations > 0) && (_notarize == false))
+
+ {
lock = " ";
+ }
+
- }
-
+qDebug()<<_notarize;
QString line = QString("") + myDateTime.toString("dd.MM.yyyy hh:mm");
line += QString(lock) + QString("");
line += QString("") + _memo.toHtmlEscaped() + QString("
");
diff --git a/src/Model/ChatItem.h b/src/Model/ChatItem.h
index be8a807..900c994 100644
--- a/src/Model/ChatItem.h
+++ b/src/Model/ChatItem.h
@@ -20,11 +20,13 @@ class ChatItem
QString _txid;
int _confirmations;
bool _outgoing = false;
+ bool _notarize = false;
+ bool _iscontact = false;
public:
ChatItem();
- ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations);
- ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing);
+ 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, bool iscontact);
long getTimestamp();
QString getAddress();
QString getContact();
@@ -35,6 +37,9 @@ class ChatItem
QString getTxid();
int getConfirmations();
bool isOutgoing();
+ bool isdouble();
+ bool isNotarized();
+ bool isContact();
void setTimestamp(long timestamp);
void setAddress(QString address);
void setContact(QString contact);
@@ -45,6 +50,8 @@ class ChatItem
void setTxid(QString txid);
void setConfirmations(int confirmations);
void toggleOutgo();
+ void notarized();
+ void contact(bool iscontact);
QString toChatLine();
json toJson();
~ChatItem();
diff --git a/src/Model/ContactItem.cpp b/src/Model/ContactItem.cpp
index d38c1c5..589ca9f 100644
--- a/src/Model/ContactItem.cpp
+++ b/src/Model/ContactItem.cpp
@@ -1,14 +1,33 @@
+// Copyright 2019-2020 The Hush developers
+// GPLv3
#include "ContactItem.h"
+#include "chatmodel.h"
+#include "Model/ChatItem.h"
+#include "controller.h"
ContactItem::ContactItem() {}
+ContactItem::ContactItem(QString name, QString partnerAddress)
+{
+ _name = name;
+ _partnerAddress = partnerAddress;
+}
+
+ContactItem::ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid)
+{
+ _name = name;
+ _myAddress = myAddress;
+ _partnerAddress = partnerAddress;
+ _cid = cid;
+}
+
ContactItem::ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid, QString avatar)
{
_name = name;
_myAddress = myAddress;
_partnerAddress = partnerAddress;
_cid = cid;
- _avatar = avatar;
+ _avatar = avatar;
}
QString ContactItem::getName() const
diff --git a/src/Model/ContactItem.h b/src/Model/ContactItem.h
index f066740..edb512d 100644
--- a/src/Model/ContactItem.h
+++ b/src/Model/ContactItem.h
@@ -1,21 +1,26 @@
+// Copyright 2019-2020 The Hush developers
+// GPLv3
#ifndef CONTACTITEM_H
#define CONTACTITEM_H
#include
#include
+#include "mainwindow.h"
using json = nlohmann::json;
class ContactItem
{
private:
- QString _myAddress;
- QString _partnerAddress;
- QString _name;
- QString _cid;
- QString _avatar;
-
+ QString _myAddress = "";
+ QString _partnerAddress = "";
+ QString _name = "";
+ QString _cid = "";
+ QString _avatar = ":/icons/res/sdlogo.png";
+
public:
ContactItem();
+ ContactItem(QString name, QString partnerAddress);
+ ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid);
ContactItem(QString name, QString partnerAddress, QString myAddress, QString cid, QString avatar);
QString getName() const;
QString getMyAddress() const;
diff --git a/src/Model/ContactRequest.cpp b/src/Model/ContactRequest.cpp
index 9741ba0..3ad804f 100644
--- a/src/Model/ContactRequest.cpp
+++ b/src/Model/ContactRequest.cpp
@@ -80,7 +80,7 @@ QString ContactRequest::toString()
return "sender: " + _senderAddress + " receiver: " + _receiverAddress + " memo: " + _memo + " cid: " + _cid + " label: " + _label + " avatar: " + _avatar;
}
-ContactRequest::~ContactRequest()
+void ContactRequest::clear()
{
_senderAddress = "";
_receiverAddress = "";
@@ -88,4 +88,9 @@ ContactRequest::~ContactRequest()
_cid = "";
_label = "";
_avatar = "";
+}
+
+ContactRequest::~ContactRequest()
+{
+ clear();
}
\ No newline at end of file
diff --git a/src/Model/ContactRequest.h b/src/Model/ContactRequest.h
index 5335434..930ad56 100644
--- a/src/Model/ContactRequest.h
+++ b/src/Model/ContactRequest.h
@@ -33,6 +33,7 @@ class ContactRequest
void setLabel(QString label);
void setAvatar(QString avatar);
QString toString();
+ void clear();
~ContactRequest();
};
diff --git a/src/addressbook.cpp b/src/addressbook.cpp
index f51e279..6d7f913 100644
--- a/src/addressbook.cpp
+++ b/src/addressbook.cpp
@@ -40,7 +40,10 @@ void AddressBookModel::loadData()
QSettings().value(
"addresstablegeometry"
).toByteArray()
+
+
);
+
}
void AddressBookModel::addNewLabel(QString label, QString addr, QString myAddr, QString cid, QString avatar)
@@ -414,12 +417,7 @@ void AddressBook::readFromStorage()
allLabels = FileSystem::getInstance()->readContacts(AddressBook::writeableFile());
// test to see if the contact items in datastore are correctly dumped to json
- for(ContactItem item: allLabels)
- {
- DataStore::getContactDataStore()->setData(item.getCid(), item);
- }
DataStore::getContactDataStore()->dump();
- AddressBook::writeToStorage();
}
void AddressBook::writeToStorage()
diff --git a/src/addressbook.h b/src/addressbook.h
index 8e32fe8..fbd361b 100644
--- a/src/addressbook.h
+++ b/src/addressbook.h
@@ -23,6 +23,7 @@ public:
int columnCount(const QModelIndex &parent) const;
QVariant data(const QModelIndex &index, int role) const;
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
+
private:
@@ -32,7 +33,8 @@ private:
QTableView* parent;
//QList> labels;
QList labels;
- QStringList headers;
+ QStringList headers;
+
};
class AddressBook {
@@ -63,6 +65,10 @@ public:
QString get_avatar_name();
void set_avatar_name(QString avatar_name);
+
+
+
+
@@ -76,6 +82,7 @@ private:
QString writeableFile();
QList allLabels;
+
static AddressBook* instance;
};
diff --git a/src/addressbook.ui b/src/addressbook.ui
index f7877bf..1bcf214 100644
--- a/src/addressbook.ui
+++ b/src/addressbook.ui
@@ -65,21 +65,21 @@
-
- Stag
+ SDLogo
- :/icons/res/Stag.png
+ :/icons/res/sdlogo.png
-
- Elsa
+ Duke
- :/icons/res/Elsa.png
+ :/icons/res/Duke.png
@@ -95,41 +95,41 @@
-
- Duke
+ Berg
- :/icons/res/Duke.png
+ :/icons/res/Berg.png
-
- Yoda
+ Sharpee
- :/icons/res/Yoda.png
+ :/icons/res/Sharpee.png
-
- Berg
+ Elsa
- :/icons/res/Berg.png
+ :/icons/res/Elsa.png
-
- Sharpee
+ Yoda
- :/icons/res/Sharpee.png
+ :/icons/res/Yoda.png
@@ -185,11 +185,11 @@
-
- SDLogo
+ Stag
- :/icons/res/sdlogo2.png
+ :/icons/res/Stag.png
diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp
index d3abd34..ee3fe6d 100644
--- a/src/chatmodel.cpp
+++ b/src/chatmodel.cpp
@@ -8,7 +8,6 @@
#include "ui_mainwindow.h"
#include "ui_requestContactDialog.h"
#include "addressbook.h"
-#include "ui_memodialog.h"
#include "ui_contactrequest.h"
#include
#include
@@ -54,7 +53,6 @@ void ChatModel::clear()
void ChatModel::addMessage(ChatItem item)
{
QString key = ChatIDGenerator::getInstance()->generateID(item); //this->generateChatItemID(item);
- // qDebug() << "inserting chatitem with id: " << key;
this->chatItems[key] = item;
}
@@ -74,8 +72,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(){
Ui_requestDialog requestContact;
@@ -83,27 +99,53 @@ void MainWindow::renderContactRequest(){
requestContact.setupUi(&dialog);
Settings::saveRestore(&dialog);
+ QString icon;
+ auto theme = Settings::getInstance()->get_theme_name();
+ if (theme == "dark" || theme == "midnight") {
+ icon = ":/icons/res/unknownWhite.png";
+ }else{
+ icon = ":/icons/res/unknownBlack.png";
+ }
+
+ QPixmap unknownWhite(icon);
+ QIcon addnewAddrIcon(unknownWhite);
+
+
+
+
QStandardItemModel* contactRequest = new QStandardItemModel();
for (auto &c : DataStore::getChatDataStore()->getAllNewContactRequests())
+
+
{
- QStandardItem* Items = new QStandardItem(c.second.getAddress());
+ QStandardItem* Items = new QStandardItem(QString("Unknown Sender"));
contactRequest->appendRow(Items);
requestContact.requestContact->setModel(contactRequest);
+
+ Items->setData(QIcon(addnewAddrIcon),Qt::DecorationRole);
+ requestContact.requestContact->setIconSize(QSize(40,50));
+ requestContact.requestContact->setUniformItemSizes(true);
requestContact.requestContact->show();
+ requestContact.zaddrnew->setVisible(false);
+ requestContact.zaddrnew->setText(c.second.getAddress());
+
}
QStandardItemModel* contactRequestOld = new QStandardItemModel();
+
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
for (auto &c : DataStore::getChatDataStore()->getAllOldContactRequests())
{
if (p.getPartnerAddress() == c.second.getRequestZaddr())
{
- QStandardItem* Items = new QStandardItem(c.second.getAddress());
+ QStandardItem* Items = new QStandardItem(p.getName());
contactRequestOld->appendRow(Items);
requestContact.requestContactOld->setModel(contactRequestOld);
+ requestContact.zaddrold->setVisible(false);
+ requestContact.zaddrold->setText(c.second.getAddress());
requestContact.requestContactOld->show();
}else{}
}
@@ -116,7 +158,7 @@ void MainWindow::renderContactRequest(){
QString label_contact = index.data(Qt::DisplayRole).toString();
QStandardItemModel* contactMemo = new QStandardItemModel();
- if ((c.second.isOutgoing() == false) && (label_contact == c.second.getAddress()) && (c.second.getType() != "Cont"))
+ if ((c.second.isOutgoing() == false) && (requestContact.zaddrnew->text() == c.second.getAddress()) && (c.second.getType() != "Cont"))
{
@@ -139,11 +181,11 @@ void MainWindow::renderContactRequest(){
QObject::connect(requestContact.requestContactOld, &QTableView::clicked, [&] () {
for (auto &c : DataStore::getChatDataStore()->getAllRawChatItems()){
- QModelIndex index = requestContact.requestContactOld->currentIndex();
- QString label_contactold = index.data(Qt::DisplayRole).toString();
+ /* QModelIndex index = requestContact.requestContactOld->currentIndex();
+ QString label_contactold = index.data(Qt::DisplayRole).toString();*/
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"))
{
@@ -220,6 +262,11 @@ void ChatModel::addrequestZaddr(QString tx, QString requestZaddr)
this->requestZaddrMap[tx] = requestZaddr;
}
+void ChatModel::addconfirmations(QString tx, int confirmation)
+{
+ this->confirmationsMap[tx] = confirmation;
+}
+
QString ChatModel::getCidByTx(QString tx)
{
for(auto& pair : this->cidMap)
@@ -235,6 +282,21 @@ QString ChatModel::getCidByTx(QString tx)
return QString("0xdeadbeef");
}
+QString ChatModel::getConfirmationByTx(QString tx)
+{
+ for(auto& pair : this->confirmationsMap)
+ {
+
+ }
+
+ if(this->confirmationsMap.count(tx) > 0)
+ {
+ return this->confirmationsMap[tx];
+ }
+
+ return QString("0xdeadbeef");
+}
+
QString ChatModel::getrequestZaddrByTx(QString tx)
{
for(auto& pair : this->requestZaddrMap)
@@ -260,6 +322,11 @@ void ChatModel::killrequestZaddrCache()
this->requestZaddrMap.clear();
}
+void ChatModel::killConfirmationCache()
+{
+ this->confirmationsMap.clear();
+}
+
QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr, int version=0, int headerNumber=1)
{
@@ -334,14 +401,12 @@ void MainWindow::sendChat() {
// Create a Tx from the values on the send tab. Note that this Tx object
// might not be valid yet.
-
- // Memos can only be used with zAddrs. So check that first
- // for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
-
+
+ QString Name = ui->contactNameMemo->text();
+ int sizename = Name.size();
+ qDebug()<< sizename;
if (ui->contactNameMemo->text().trimmed().isEmpty() || ui->memoTxtChat->toPlainText().trimmed().isEmpty()) {
- // auto addr = "";
- // if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
QMessageBox msg(QMessageBox::Critical, tr("You have to select a contact and insert a Memo"),
tr("You have selected no Contact from Contactlist,\n") + tr("\nor your Memo is empty"),
QMessageBox::Ok, this);
@@ -350,6 +415,20 @@ void MainWindow::sendChat() {
return;
}
+ int max = 512;
+ QString chattext = ui->memoTxtChat->toPlainText();
+ int size = chattext.size();
+
+ if (size > max){
+
+ QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"),
+ tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."),
+ QMessageBox::Ok, this);
+
+ msg.exec();
+ return;
+ }
+
Tx tx = createTxFromChatPage();
QString error = doSendChatTxValidations(tx);
@@ -384,10 +463,11 @@ void MainWindow::sendChat() {
}
connD->status->setText(tr("Please wait..."));
- connD->statusDetail->setText(tr("Your Message will be send"));
+ connD->statusDetail->setText(tr("Your Message will be sent"));
d->show();
ui->memoTxtChat->clear();
+
// And send the Tx
rpc->executeTransaction(tx,
@@ -396,6 +476,7 @@ void MainWindow::sendChat() {
connD->status->setText(tr("Done!"));
connD->statusDetail->setText(txid);
+
QTimer::singleShot(1000, [=]() {
d->accept();
@@ -406,7 +487,7 @@ void MainWindow::sendChat() {
});
// Force a UI update so we get the unconfirmed Tx
- // rpc->refresh(true);
+ rpc->refresh(true);
ui->memoTxtChat->clear();
},
@@ -425,6 +506,8 @@ void MainWindow::sendChat() {
QMessageBox::critical(this, QObject::tr("Transaction Error"), errStr, QMessageBox::Ok);
}
);
+
+ // rpc->refresh(true);
}
QString MainWindow::doSendChatTxValidations(Tx tx) {
@@ -450,7 +533,7 @@ QString MainWindow::doSendChatTxValidations(Tx tx) {
auto available = rpc->getModel()->getAvailableBalance();
if (available < total) {
- return tr("Not enough available funds to send this transaction\n\nHave: %1\nNeed: %2\n\nNote: Funds need 3 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());
}
@@ -499,7 +582,7 @@ void::MainWindow::addContact()
});
QObject::connect(request.sendRequestButton, &QPushButton::clicked, this, &MainWindow::saveandsendContact);
- QObject::connect(request.onlyAdd, &QPushButton::clicked, this, &MainWindow::saveContact);
+ // QObject::connect(request.onlyAdd, &QPushButton::clicked, this, &MainWindow::saveContact);
dialog.exec();
@@ -510,95 +593,7 @@ void::MainWindow::addContact()
void MainWindow::saveandsendContact()
{
this->ContactRequest();
- QString addr = contactRequest.getReceiverAddress();
- QString newLabel = contactRequest.getLabel();
- QString myAddr = contactRequest.getSenderAddress();
- QString cid = contactRequest.getCid();
- QString avatar = contactRequest.getAvatar();
-
- if (addr.isEmpty() || newLabel.isEmpty())
- {
- QMessageBox::critical(
- this,
- QObject::tr("Address or Label Error"),
- QObject::tr("Address or Label cannot be empty"),
- QMessageBox::Ok
- );
- return;
- }
-
- // Test if address is valid.
- if (!Settings::isValidAddress(addr))
- {
- QMessageBox::critical(
- this,
- QObject::tr("Address Format Error"),
- QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
- QMessageBox::Ok
- );
- return;
- }
-
- ///////Todo: Test if label allready exist!
-
- ////// Success, so show it
- AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
- QMessageBox::information(
- this,
- QObject::tr("Added Contact"),
- QObject::tr("successfully added your new contact").arg(newLabel),
- QMessageBox::Ok
- );
- return;
-
-
-}
-
-void MainWindow::saveContact()
-{
-
- QString addr = contactRequest.getReceiverAddress();
- QString newLabel = contactRequest.getLabel();
- QString myAddr = contactRequest.getSenderAddress();
- QString cid = contactRequest.getCid();
- QString avatar = contactRequest.getAvatar();
-
- if (addr.isEmpty() || newLabel.isEmpty())
- {
- QMessageBox::critical(
- this,
- QObject::tr("Address or Label Error"),
- QObject::tr("Address or Label cannot be empty"),
- QMessageBox::Ok
- );
- return;
- }
-
- // Test if address is valid.
- if (!Settings::isValidAddress(addr))
- {
- QMessageBox::critical(
- this,
- QObject::tr("Address Format Error"),
- QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
- QMessageBox::Ok
- );
- return;
- }
-
- ///////Todo: Test if label allready exist!
-
- ////// Success, so show it
- AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
- QMessageBox::information(
- this,
- QObject::tr("Added Contact"),
- QObject::tr("successfully added your new contact").arg(newLabel),
- QMessageBox::Ok
- );
- return;
-
}
// Create a Tx for a contact Request
@@ -646,6 +641,22 @@ void MainWindow::ContactRequest() {
return;
}
+ int max = 512;
+ QString chattext = contactRequest.getMemo();;
+ int size = chattext.size();
+
+ if (size > max){
+
+ // auto addr = "";
+ // if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
+ QMessageBox msg(QMessageBox::Critical, tr("Your Message is too long"),
+ tr("You can only write messages with 512 character maximum \n") + tr("\n Please reduce your message to 512 character."),
+ QMessageBox::Ok, this);
+
+ msg.exec();
+ return;
+ }
+
Tx tx = createTxForSafeContactRequest();
QString error = doSendRequestTxValidations(tx);
@@ -680,7 +691,7 @@ void MainWindow::ContactRequest() {
}
connD->status->setText(tr("Please wait..."));
- connD->statusDetail->setText(tr("Your Contact will be send"));
+ connD->statusDetail->setText(tr("Your contact request will be sent"));
d->show();
ui->memoTxtChat->clear();
@@ -700,7 +711,46 @@ void MainWindow::ContactRequest() {
delete d;
});
-
+ QString addr = contactRequest.getReceiverAddress();
+ QString newLabel = contactRequest.getLabel();
+ QString myAddr = contactRequest.getSenderAddress();
+ QString cid = contactRequest.getCid();
+ QString avatar = contactRequest.getAvatar();
+
+ if (addr.isEmpty() || newLabel.isEmpty())
+ {
+ QMessageBox::critical(
+ this,
+ QObject::tr("Address or Label Error"),
+ QObject::tr("Address or Label cannot be empty"),
+ QMessageBox::Ok
+ );
+ return;
+ }
+
+ // Test if address is valid.
+ if (!Settings::isValidAddress(addr))
+ {
+ QMessageBox::critical(
+ this,
+ QObject::tr("Address Format Error"),
+ QObject::tr("%1 doesn't seem to be a valid hush address.").arg(addr),
+ QMessageBox::Ok
+ );
+ return;
+ }
+
+ ///////Todo: Test if label allready exist!
+
+ ////// Success, so show it
+ AddressBook::getInstance()->addAddressLabel(newLabel, addr, myAddr, cid, avatar);
+ QMessageBox::information(
+ this,
+ QObject::tr("Added Contact"),
+ QObject::tr("successfully added your new contact").arg(newLabel),
+ QMessageBox::Ok
+ );
+ return;
// Force a UI update so we get the unconfirmed Tx
// rpc->refresh(true);
ui->memoTxtChat->clear();
@@ -749,9 +799,11 @@ QString MainWindow::doSendRequestTxValidations(Tx tx) {
auto available = rpc->getModel()->getAvailableBalance();
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());
}
return "";
}
+
+
diff --git a/src/chatmodel.h b/src/chatmodel.h
index e8bc3e7..1768b9f 100644
--- a/src/chatmodel.h
+++ b/src/chatmodel.h
@@ -20,6 +20,7 @@
#include "Chat/Helper/ChatDelegator.h"
#include "Chat/Helper/ChatIDGenerator.h"
+
namespace Ui {
class MainWindow;
}
@@ -32,7 +33,9 @@ class ChatModel
MainWindow* main;
std::map cidMap;
std::map requestZaddrMap;
+ std::map confirmationsMap;
std::map> sendrequestMap;
+ std::map AddressbyLabelMap;
public:
ChatModel() {};
@@ -45,16 +48,21 @@ class ChatModel
void triggerRequest();
void showMessages();
void clear();
+ void addAddressbylabel(QString addr, QString label);
void addMessage(ChatItem item);
void addMessage(QString timestamp, ChatItem item);
void addCid(QString tx, QString cid);
void addrequestZaddr(QString tx, QString requestZaddr);
+ void addconfirmations(QString tx, int confirmation);
void addSendRequest(int i, QString myAddr, QString cid, QString addr );
QString getCidByTx(QString tx);
QString getrequestZaddrByTx(QString tx);
+ QString getConfirmationByTx(QString tx);
+ QString Addressbylabel(QString addr);
void killCidCache();
+ void killConfirmationCache();
void killrequestZaddrCache();
-
+
};
#endif
\ No newline at end of file
diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp
index 6f452fa..7f9d097 100644
--- a/src/contactmodel.cpp
+++ b/src/contactmodel.cpp
@@ -5,11 +5,18 @@
#include "addressbook.h"
#include "mainwindow.h"
#include "chatmodel.h"
+#include "requestdialog.h"
+#include "ui_requestdialog.h"
+#include "ui_hushrequest.h"
+#include "settings.h"
+#include "controller.h"
+
+
void ContactModel::renderContactList(QListView* view)
{
QStandardItemModel* contact = new QStandardItemModel();
-
+
for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
{
@@ -18,14 +25,119 @@ void ContactModel::renderContactList(QListView* view)
QStandardItem* Items1 = new QStandardItem(c.getName());
Items1->setData(QIcon(avatar),Qt::DecorationRole);
+
contact->appendRow(Items1);
view->setModel(contact);
view->setIconSize(QSize(60,70));
view->setUniformItemSizes(true);
view->setDragDropMode(QAbstractItemView::DropOnly);
view->show();
-
+
+
}
+}
+
+void MainWindow::showRequesthush() {
+
+ Ui_hushrequest req;
+ QDialog d(this);
+ req.setupUi(&d);
+ Settings::saveRestore(&d);
+
+ QString label = ui->contactNameMemo->text();
+ for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
+ {
+
+ if (p.getName() == label)
+
+ {
+
+ QString addr = p.getPartnerAddress();
+ QString myzaddr = p.getMyAddress();
+
+ req.txtFrom->setText(addr);
+ req.lblAddressInfo->setText(myzaddr);
+ // Amount textbox
+ req.txtAmount->setValidator(this->getAmountValidator());
+ QObject::connect(req.txtAmount, &QLineEdit::textChanged, [=] (auto text) {
+ CAmount amount = CAmount::fromDecimalString(text);
+ if (Settings::getInstance()->get_currency_name() == "USD") {
+ req.txtAmountUSD->setText(amount.toDecimalUSDString());
+ } else if (Settings::getInstance()->get_currency_name() == "EUR") {
+ req.txtAmountUSD->setText(amount.toDecimalEURString());
+ } else if (Settings::getInstance()->get_currency_name() == "BTC") {
+ req.txtAmountUSD->setText(amount.toDecimalBTCString());
+ } else if (Settings::getInstance()->get_currency_name() == "CNY") {
+ req.txtAmountUSD->setText(amount.toDecimalCNYString());
+ } else if (Settings::getInstance()->get_currency_name() == "RUB") {
+ req.txtAmountUSD->setText(amount.toDecimalRUBString());
+ } else if (Settings::getInstance()->get_currency_name() == "CAD") {
+ req.txtAmountUSD->setText(amount.toDecimalCADString());
+ } else if (Settings::getInstance()->get_currency_name() == "SGD") {
+ req.txtAmountUSD->setText(amount.toDecimalSGDString());
+ } else if (Settings::getInstance()->get_currency_name() == "CHF") {
+ req.txtAmountUSD->setText(amount.toDecimalCHFString());
+ } else if (Settings::getInstance()->get_currency_name() == "INR") {
+ req.txtAmountUSD->setText(amount.toDecimalINRString());
+ } else if (Settings::getInstance()->get_currency_name() == "GBP") {
+ req.txtAmountUSD->setText(amount.toDecimalGBPString());
+ } else if (Settings::getInstance()->get_currency_name() == "AUD") {
+ req.txtAmountUSD->setText(amount.toDecimalBTCString());
+ }
+ });
+ CAmount amount = CAmount::fromDecimalString(req.txtAmount->text());
+ if (Settings::getInstance()->get_currency_name() == "USD") {
+ req.txtAmountUSD->setText(amount.toDecimalUSDString());
+ } else if (Settings::getInstance()->get_currency_name() == "EUR") {
+ req.txtAmountUSD->setText(amount.toDecimalEURString());
+ } else if (Settings::getInstance()->get_currency_name() == "BTC") {
+ req.txtAmountUSD->setText(amount.toDecimalBTCString());
+ } else if (Settings::getInstance()->get_currency_name() == "CNY") {
+ req.txtAmountUSD->setText(amount.toDecimalCNYString());
+ } else if (Settings::getInstance()->get_currency_name() == "RUB") {
+ req.txtAmountUSD->setText(amount.toDecimalRUBString());
+ } else if (Settings::getInstance()->get_currency_name() == "CAD") {
+ req.txtAmountUSD->setText(amount.toDecimalCADString());
+ } else if (Settings::getInstance()->get_currency_name() == "SGD") {
+ req.txtAmountUSD->setText(amount.toDecimalSGDString());
+ } else if (Settings::getInstance()->get_currency_name() == "CHF") {
+ req.txtAmountUSD->setText(amount.toDecimalCHFString());
+ } else if (Settings::getInstance()->get_currency_name() == "INR") {
+ req.txtAmountUSD->setText(amount.toDecimalINRString());
+ } else if (Settings::getInstance()->get_currency_name() == "GBP") {
+ req.txtAmountUSD->setText(amount.toDecimalGBPString());
+ } else if (Settings::getInstance()->get_currency_name() == "AUD") {
+ req.txtAmountUSD->setText(amount.toDecimalBTCString());
+ }
+ req.txtMemo->setAcceptButton(req.buttonBox->button(QDialogButtonBox::Ok));
+ req.txtMemo->setLenDisplayLabel(req.lblMemoLen);
+ req.txtMemo->setMaxLen(400);
+
+ req.txtFrom->setFocus();
+
+
+ }
+ }
+ if (d.exec() == QDialog::Accepted) {
+ // Construct a hush Payment URI with the data and pay it immediately.
+ CAmount amount = CAmount::fromDecimalString(req.txtAmount->text());
+ QString memoURI = "hush:" + req.lblAddressInfo->text()
+ + "?amt=" + amount.toDecimalString()
+ + "&memo=" + QUrl::toPercentEncoding(req.txtMemo->toPlainText());
+
+ QString sendURI = "hush:" + AddressBook::addressFromAddressLabel(req.txtFrom->text())
+ + "?amt=0.0001"
+ + "&memo=" + QUrl::toPercentEncoding(memoURI);
+
+ // If the disclosed address in the memo doesn't have a balance, it will automatically fallback to the default
+ // sapling address
+ this->payhushURI(sendURI, req.lblAddressInfo->text());
+
+
+
+ }
+
+}
+
-}
\ No newline at end of file
diff --git a/src/contactmodel.h b/src/contactmodel.h
index fcdf7a3..5f79c47 100644
--- a/src/contactmodel.h
+++ b/src/contactmodel.h
@@ -5,13 +5,17 @@
#include "Model/ContactItem.h"
#include
+#include "mainwindow.h"
class ContactModel
+
{
public:
+
ContactModel() {}
void renderContactList(QListView* view);
+
};
#endif
\ No newline at end of file
diff --git a/src/contactrequest.ui b/src/contactrequest.ui
index 8667057..cd4120b 100644
--- a/src/contactrequest.ui
+++ b/src/contactrequest.ui
@@ -6,7 +6,7 @@
0
0
- 777
+ 780
427
@@ -38,21 +38,21 @@
-
- Stag
+ SDLogo
- :/icons/res/Stag.png
+ :/icons/res/sdlogo.png
-
- Elsa
+ Duke
- :/icons/res/Elsa.png
+ :/icons/res/Duke.png
@@ -68,41 +68,51 @@
-
- Duke
+ Berg
- :/icons/res/Duke.png
+ :/icons/res/Berg.png
-
- Yoda
+ Stag
- :/icons/res/Yoda.png
+ :/icons/res/Stag.png
-
- Berg
+ Sharpee
- :/icons/res/Berg.png
+ :/icons/res/Sharpee.png
-
- Sharpee
+ Elsa
- :/icons/res/Sharpee.png
+ :/icons/res/Elsa.png
+
+
+
+ -
+
+ Yoda
+
+
+
+ :/icons/res/Yoda.png
@@ -156,16 +166,6 @@
- -
-
- SDLogo
-
-
-
- :/icons/res/sdlogo2.png
-
-
-
-
@@ -233,7 +233,7 @@
- -
+
-
<html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Insert a memo for your request</span></p></body></html>
@@ -318,36 +318,11 @@
- -
-
-
-
- 152
- 25
-
-
-
-
- 100
- 0
-
-
-
- Only add this contact
-
-
- false
-
-
- false
-
-
-
-
- 188
+ 300
25
@@ -358,7 +333,7 @@
- Add Contact & send request
+ Add Contact and send request
false
diff --git a/src/controller.cpp b/src/controller.cpp
index 8007205..17f80bc 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -237,12 +237,15 @@ void Controller::getInfoThenRefresh(bool force)
zrpc->fetchInfo([=] (const json& reply) {
prevCallSucceeded = true;
int curBlock = reply["latest_block_height"].get();
- int longestchain = reply["longestchain"].get();
- int notarized = reply["notarized"].get();
+ bool doUpdate = force || (model->getLatestBlock() != curBlock);
int difficulty = reply["difficulty"].get();
int blocks_until_halving= 340000 - curBlock;
int halving_days = (blocks_until_halving * 150) / (60*60*24) ;
- bool doUpdate = force || (model->getLatestBlock() != curBlock);
+ int longestchain = reply["longestchain"].get();
+ int notarized = reply["notarized"].get();
+
+
+
model->setLatestBlock(curBlock);
if (
Settings::getInstance()->get_currency_name() == "EUR" ||
@@ -258,7 +261,11 @@ void Controller::getInfoThenRefresh(bool force)
);
ui->longestchain->setText(
"Block: " + QLocale(QLocale::German).toString(longestchain)
+
);
+
+
+
ui->difficulty->setText(
QLocale(QLocale::German).toString(difficulty)
);
@@ -540,8 +547,12 @@ void Controller::getInfoThenRefresh(bool force)
refreshAddresses(); // This calls refreshZSentTransactions() and refreshReceivedZTrans()
refreshTransactions();
}
+
+ int lag = longestchain - notarized ;
+ this->setLag(lag);
}, [=](QString err) {
// hushd has probably disappeared.
+
this->noConnection();
// Prevent multiple dialog boxes, because these are called async
@@ -552,7 +563,7 @@ void Controller::getInfoThenRefresh(bool force)
QMessageBox::critical(
main,
QObject::tr("Connection Error"),
- QObject::tr("There was an error connecting to hushd. The error was") + ": \n\n"+ err,
+ QObject::tr("There was an error connecting to the server. Please check your internet connection. The error was") + ": \n\n"+ err,
QMessageBox::StandardButton::Ok
);
shown = false;
@@ -562,6 +573,20 @@ void Controller::getInfoThenRefresh(bool force)
});
}
+int Controller::getLag()
+{
+
+ return _lag;
+
+}
+
+void Controller::setLag(int lag)
+{
+
+ _lag = lag;
+
+}
+
void Controller::refreshAddresses()
{
if (!zrpc->haveConnection())
@@ -871,12 +896,33 @@ void Controller::refreshTransactions() {
CAmount amount = CAmount::fromqint64(-1* o["value"].get());
// Check for Memos
+
+ if (confirmations == 0) {
+ chatModel->addconfirmations(txid, confirmations);
+ }
+
+ if ((confirmations == 1) && (chatModel->getConfirmationByTx(txid) != QString("0xdeadbeef"))){
+ DataStore::getChatDataStore()->clear();
+ chatModel->killConfirmationCache();
+ this->refresh(true);
+ }
QString memo;
if (!o["memo"].is_null()) {
memo = QString::fromStdString(o["memo"]);
QString cid;
+ bool isNotarized;
+
+ if (confirmations > getLag())
+ {
+ isNotarized = true;
+ }else{
+
+ isNotarized = false;
+ }
+
+ qDebug()<<"Conf : " << confirmations;
ChatItem item = ChatItem(
datetime,
@@ -888,15 +934,17 @@ void Controller::refreshTransactions() {
cid,
txid,
confirmations,
- true
+ true,
+ isNotarized,
+ false
);
- // qDebug()<<"Memo : " <setData(ChatIDGenerator::getInstance()->generateID(item), item);
-
- }
-
+
+
+
+ }
+
+
items.push_back(TransactionItemDetail{address, amount, memo});
total_amount = total_amount + amount;
}
@@ -944,6 +992,28 @@ void Controller::refreshTransactions() {
QString cid;
int position;
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()) {
@@ -958,7 +1028,8 @@ void Controller::refreshTransactions() {
chatModel->addCid(txid, cid);
chatModel->addrequestZaddr(txid, requestZaddr);
- }
+ }
+
if (chatModel->getCidByTx(txid) != QString("0xdeadbeef")){
@@ -973,8 +1044,20 @@ void Controller::refreshTransactions() {
requestZaddr = chatModel->getrequestZaddrByTx(txid);
}else{
requestZaddr = "";
- }
+ }
+
position = it["position"].get();
+
+ bool isNotarized;
+
+ if (confirmations > getLag())
+ {
+ isNotarized = true;
+ }else{
+
+ isNotarized = false;
+ }
+
ChatItem item = ChatItem(
datetime,
address,
@@ -985,16 +1068,17 @@ void Controller::refreshTransactions() {
cid,
txid,
confirmations,
- false
+ false,
+ isNotarized,
+ isContact
);
- // qDebug()<< "Position : " << position;
- // qDebug()<<"Confirmation :" << confirmations;
-
+
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
}
}
-
+ }
}
+ qDebug()<<"get Lag" << getLag();
// 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
diff --git a/src/controller.h b/src/controller.h
index b34aeb4..9fd445b 100644
--- a/src/controller.h
+++ b/src/controller.h
@@ -1,3 +1,6 @@
+// Copyright 2019-2020 The Hush developers
+// GPLv3
+
#ifndef RPCCLIENT_H
#define RPCCLIENT_H
@@ -37,7 +40,10 @@ public:
Connection* getConnection() { return zrpc->getConnection(); }
void setConnection(Connection* c);
void refresh(bool force = false);
- void refreshAddresses();
+ void refreshAddresses();
+ int getLag();
+ void setLag(int lag);
+ int _lag;
void checkForUpdate(bool silent = true);
void refreshZECPrice();
diff --git a/src/hushrequest.ui b/src/hushrequest.ui
new file mode 100644
index 0000000..d0b0ca7
--- /dev/null
+++ b/src/hushrequest.ui
@@ -0,0 +1,156 @@
+
+
+ hushrequest
+
+
+
+ 0
+ 0
+ 663
+ 529
+
+
+
+ Dialog
+
+
+
-
+
+
+ TextLabel
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+ Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.
+
+
+ true
+
+
+
+ -
+
+
+ Request From
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 541
+ 20
+
+
+
+
+ -
+
+
+ zaddr
+
+
+
+ -
+
+
+ Amount in
+
+
+
+ -
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ Amount
+
+
+
+ -
+
+
+ Amount USD
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Memo
+
+
+
+ -
+
+
+ 0 / 512
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ -
+
+
+ My Address
+
+
+
+ -
+
+
+ The recipient will see this address in the "to" field when they pay your request.
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
+
+
+
+
+
+ MemoEdit
+ QPlainTextEdit
+
+
+
+
+
+
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 1f16a60..27c567e 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -59,7 +59,7 @@ MainWindow::MainWindow(QWidget *parent) :
}
catch (...)
{
- theme_name = "default";
+ theme_name = "dark";
}
this->slot_change_theme(theme_name);
@@ -1208,6 +1208,7 @@ void MainWindow::setupTransactionsTab() {
ui->listChat->setMinimumSize(200,350);
ui->listChat->setItemDelegate(new ListViewDelegate());
ui->listChat->show();
+
ui->transactionsTable->setContextMenuPolicy(Qt::CustomContextMenu);
// Table right click
QObject::connect(ui->transactionsTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) {
@@ -1337,9 +1338,6 @@ void MainWindow::setupchatTab() {
ui->memoTxtChat->setTextColor("Black");
}
-
-
-
QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChat);
QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact);
QObject::connect(ui->pushContact, &QPushButton::clicked, this , &MainWindow::renderContactRequest);
@@ -1354,18 +1352,67 @@ void MainWindow::setupchatTab() {
for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
if (label_contact == p.getName()) {
- // ui->ContactZaddr->setText(p.getPartnerAddress());
- // ui->MyZaddr->setText(p.getMyAddress());
- ui->contactNameMemo->setText(p.getName());
- ui->memoTxtChat->clear();
-
- rpc->refresh(true);
- // updateChat();
+ ui->contactNameMemo->setText(p.getName());
+ rpc->refresh(true);
+
}
});
+ QMenu* contextMenu;
+ QAction* requestAction;
+ QAction* editAction;
+ QAction* HushAction;
+ QAction* requestHushAction;
+ QAction* subatomicAction;
+ contextMenu = new QMenu(ui->listContactWidget);
+ requestAction = new QAction("Send a contact request - coming soon",contextMenu);
+ editAction = new QAction("Delete this contact",contextMenu);
+ HushAction = new QAction("Send a friend some Hush - coming soon",contextMenu);
+ requestHushAction = new QAction("Request some Hush - coming soon",contextMenu);
+ subatomicAction = new QAction("Make a subatomic swap with a friend- coming soon",contextMenu);
+ ui->listContactWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+ ui->listContactWidget->addAction(requestAction);
+ ui->listContactWidget->addAction(editAction);
+ ui->listContactWidget->addAction(HushAction);
+ ui->listContactWidget->addAction(requestHushAction);
+ ui->listContactWidget->addAction(subatomicAction);
+ QObject::connect(requestHushAction, &QAction::triggered, [=]() {
+ QModelIndex index = ui->listContactWidget->currentIndex();
+ QString label_contact = index.data(Qt::DisplayRole).toString();
+
+ for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
+ if (label_contact == p.getName()) {
+ ui->contactNameMemo->setText(p.getName());
+ rpc->refresh(true);
+
+ }
+
+ MainWindow::showRequesthush();
+ });
+
+ QObject::connect(editAction, &QAction::triggered, [=]() {
+ QModelIndex index = ui->listContactWidget->currentIndex();
+ QString label_contact = index.data(Qt::DisplayRole).toString();
+
+ for(auto &p : AddressBook::getInstance()->getAllAddressLabels())
+ if (label_contact == p.getName()) {
+
+ QString label1 = p.getName();
+ QString addr = p.getPartnerAddress();
+ QString myzaddr = p.getMyAddress();
+ QString cid = p.getCid();
+ QString avatar = p.getAvatar();
+
+
+ AddressBook::getInstance()->removeAddressLabel(label1, addr, myzaddr, cid,avatar);
+ rpc->refreshContacts(
+ ui->listContactWidget);
+ rpc->refresh(true);
+ }
+ });
+
-ui->memoTxtChat->setLenDisplayLabel(ui->memoSizeChat);
+ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat);
}
@@ -1374,13 +1421,11 @@ void MainWindow::updateChat()
{
rpc->refreshChat(ui->listChat,ui->memoSizeChat);
rpc->refresh(true);
-
-
}
void MainWindow::updateContacts()
{
- //rpc->refreshContacts(ui->listContactWidget);
+
}
void MainWindow::addNewZaddr(bool sapling) {
@@ -1778,7 +1823,7 @@ void MainWindow::slot_change_theme(const QString& theme_name)
}
catch (...)
{
- saved_theme_name = "default";
+ saved_theme_name = "dark";
}
QFile qFile(":/css/res/css/" + saved_theme_name +".css");
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 7ec42ba..56bfbc6 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -60,8 +60,9 @@ public:
void stopWebsocket();
void saveContact();
void saveandsendContact();
- void setMaxLen(int len);
- void updateDisplay();
+ void showRequesthush();
+ // void setmaxlenChat(int len);
+ // void updateDisplay();
void balancesReady();
@@ -199,14 +200,14 @@ class ChatMemoEdit : public QTextEdit
public:
ChatMemoEdit(QWidget* parent);
- void setMaxLen(int len);
- void setLenDisplayLabel(QLabel* label);
+ void setMaxLenChat(int len);
+ void setLenDisplayLabelChat(QLabel* label);
void SetSendChatButton(QPushButton* button);
- void updateDisplay();
+ void updateDisplayChat();
private:
- int maxlen = 512;
- QLabel* lenDisplayLabel = nullptr;
+ int maxlenchat = 512;
+ QLabel* lenDisplayLabelchat = nullptr;
QPushButton* sendChatButton = nullptr;
};
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 2d85bd5..de58411 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1378,7 +1378,10 @@
true
- QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked
+ QAbstractItemView::NoEditTriggers
+
+
+ false
false
@@ -1386,6 +1389,9 @@
QAbstractItemView::SingleSelection
+
+ QAbstractItemView::SelectItems
+
@@ -1419,10 +1425,16 @@
QTextEdit::AutoNone
- QTextEdit::FixedColumnWidth
+ QTextEdit::FixedPixelWidth
- 80
+ 600
+
+
+ false
+
+
+ Qt::TextEditorInteraction
@@ -1505,6 +1517,9 @@
521
+
+ The locks shows you the status of the message. Red lock = unconfirmed, green lock = min. 1 confirmations, orange lock = message is notarized
+
Qt::ScrollBarAsNeeded
@@ -1515,7 +1530,7 @@
QAbstractScrollArea::AdjustToContents
- QAbstractItemView::AllEditTriggers
+ QAbstractItemView::NoEditTriggers
QListView::Adjust
diff --git a/src/memodialog.ui b/src/memodialog.ui
index 1c144e0..d365221 100644
--- a/src/memodialog.ui
+++ b/src/memodialog.ui
@@ -74,7 +74,7 @@
MemoEdit
QPlainTextEdit
-
+
diff --git a/src/requestContactDialog.ui b/src/requestContactDialog.ui
index 2eb4bc0..f8cb244 100644
--- a/src/requestContactDialog.ui
+++ b/src/requestContactDialog.ui
@@ -6,7 +6,7 @@
0
0
- 812
+ 850
495
@@ -27,7 +27,7 @@
- -
+
-
<html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Memo of the request</span></p></body></html>
@@ -97,12 +97,12 @@
- -
+
-
256
- 192
+ 190
@@ -119,14 +119,21 @@
- -
+
-
+
+
+ <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html>
+
+
+
+ -
Request from :
- -
+
-
@@ -142,14 +149,14 @@
- -
+
-
My Zaddr :
- -
+
-
@@ -165,24 +172,24 @@
- -
+
-
Give a Nickname:
- -
+
-
- -
+
-
<html><head/><body><p align="right">Choose a avatar for your contact :</p></body></html>
- -
+
-
@@ -198,21 +205,21 @@
-
- Stag
+ SDLogo
- :/icons/res/Stag.png
+ :/icons/res/sdlogo.png
-
- Elsa
+ Duke
- :/icons/res/Elsa.png
+ :/icons/res/Duke.png
@@ -228,41 +235,41 @@
-
- Duke
+ Berg
- :/icons/res/Duke.png
+ :/icons/res/Berg.png
-
- Yoda
+ Sharpee
- :/icons/res/Yoda.png
+ :/icons/res/Sharpee.png
-
- Berg
+ Elsa
- :/icons/res/Berg.png
+ :/icons/res/Elsa.png
-
- Sharpee
+ Yoda
- :/icons/res/Sharpee.png
+ :/icons/res/Yoda.png
@@ -318,17 +325,17 @@
-
- SDLogo
+ Stag
- :/icons/res/sdlogo2.png
+ :/icons/res/Stag.png
- -
+
-
@@ -353,7 +360,7 @@
- -
+
-
@@ -369,17 +376,24 @@
- -
-
+
-
+
+
+
+
+
+
+ -
+
- -
-
+
-
+
- <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html>
+
diff --git a/src/requestdialog.ui b/src/requestdialog.ui
index 952f780..e52c475 100644
--- a/src/requestdialog.ui
+++ b/src/requestdialog.ui
@@ -14,37 +14,10 @@
Payment Request
- -
-
-
- -
-
-
-
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
- AddressBook
-
-
-
-
-
- -
-
-
- Qt::Horizontal
+
-
+
+
+
@@ -55,171 +28,198 @@
- -
-
+
-
+
- My Address
+ The recipient will see this address in the "to" field when they pay your request.
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
-
- color: red;
-
-
-
+
-
+
+
+
+ 0
+ 0
+
- -
-
+
-
+
- Amount in
+ TextLabel
+
+
+ Qt::AlignCenter
- -
-
+
-
+
+
+ -
+
- -
-
-
- Qt::Horizontal
+
-
+
+
+ color: red;
-
- QDialogButtonBox::Cancel|QDialogButtonBox::Ok
+
+
- -
-
+
-
+
-
+ Memo
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ Qt::Vertical
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ 20
+ 40
+
-
- z address
+
+
+ -
+
+
+ 0 / 512
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
+
-
+
Qt::Horizontal
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ Amount USD
-
-
- -
-
Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
-
- Amount
-
- -
-
+
-
+
Qt::Horizontal
- -
-
+
-
+
+
-
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ AddressBook
+
+
+
+
+
+ -
+
- The recipient will see this address in the "to" field when they pay your request.
+ Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+ true
- -
-
-
- 0 / 512
+
-
+
+
+
+ 0
+ 0
+
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ z address
- -
-
+
-
+
- Amount USD
-
-
- Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+ My Address
- -
-
+
-
+
- Qt::Vertical
-
-
-
- 20
- 40
-
+ Qt::Horizontal
-
-
- -
-
-
- Memo
+
+ QDialogButtonBox::Cancel|QDialogButtonBox::Ok
- -
-
-
- TextLabel
-
+
-
+
- Qt::AlignCenter
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
+
+
+ Amount
- -
-
+
-
+
- Request payment from a Sapling address. You'll send a hush 0.0001 transaction to the address with a hush payment URI. The memo will be included in the transaction when the address pays you.
+ Amount in
-
- true
+
+
+ -
+
+
+ Qt::Horizontal
diff --git a/src/sendtab.cpp b/src/sendtab.cpp
index de61cf2..ce04a54 100644
--- a/src/sendtab.cpp
+++ b/src/sendtab.cpp
@@ -937,7 +937,7 @@ QString MainWindow::doSendTxValidations(Tx tx) {
auto available = rpc->getModel()->getAvailableBalance();
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());
}