diff --git a/application.qrc b/application.qrc
index 7ab9af5..bf9a3b9 100644
--- a/application.qrc
+++ b/application.qrc
@@ -38,9 +38,8 @@
res/message-icon.svg
res/lock.svg
res/lock.png
- res/lock_green.svg
- res/lock_blue.svg
- res/unlocked.svg
+ res/lock_green.png
+ res/unlocked.png
res/getAddrWhite.png
res/send-white.png
res/requestWhite.png
diff --git a/src/Chat/Chat.cpp b/src/Chat/Chat.cpp
index c7d6637..30a827d 100644
--- a/src/Chat/Chat.cpp
+++ b/src/Chat/Chat.cpp
@@ -6,12 +6,50 @@
#include "../DataStore/DataStore.h"
Chat::Chat() {}
-void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view)
+ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QTextEdit(parent) {
+ QObject::connect(this, &QTextEdit::textChanged, this, &ChatMemoEdit::updateDisplay);
+}
+
+void ChatMemoEdit::updateDisplay() {
+ QString txt = this->toPlainText();
+ if (lenDisplayLabel)
+ lenDisplayLabel->setText(QString::number(txt.toUtf8().size()) + "/" + QString::number(maxlen));
+
+ if (txt.toUtf8().size() <= maxlen) {
+ // Everything is fine
+ if (sendChatButton)
+ sendChatButton->setEnabled(true);
+
+ if (lenDisplayLabel)
+ lenDisplayLabel->setStyleSheet("");
+ }
+ else {
+ // Overweight
+ if (sendChatButton)
+ sendChatButton->setEnabled(false);
+
+ if (lenDisplayLabel)
+ lenDisplayLabel->setStyleSheet("color: red;");
+ }
+}
+
+void ChatMemoEdit::setMaxLen(int len) {
+ this->maxlen = len;
+ updateDisplay();
+}
+
+void ChatMemoEdit::SetSendChatButton(QPushButton* button) {
+ this->sendChatButton = button;
+}
+
+void ChatMemoEdit::setLenDisplayLabel(QLabel* label) {
+ this->lenDisplayLabel = label;
+}
+
+void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label)
{
+
QStandardItemModel *chat = new QStandardItemModel();
- // ui->lcdNumber->setStyleSheet("background-color: red");
- // ui->lcdNumber->setPalette(Qt::red);
- // ui->lcdNumber->display("1");
DataStore::getChatDataStore()->dump(); // test to see if the chat items in datastore are correctly dumped to json
for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
{
@@ -22,7 +60,7 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view)
if (
(p.getName() == ui->contactNameMemo->text().trimmed()) &&
(p.getPartnerAddress() == c.second.getAddress()) &&
- (c.second.isOutgoing() == true))
+ (c.second.isOutgoing() == true))
{
QStandardItem *Items = new QStandardItem(c.second.toChatLine());
@@ -40,8 +78,9 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view)
if (
(p.getName() == ui->contactNameMemo->text().trimmed()) &&
(p.getMyAddress() == c.second.getAddress()) &&
- (c.second.isOutgoing() == false))
-
+ (c.second.isOutgoing() == false) &&
+ (c.second.getCid() == p.getCid())
+ )
{
QStandardItem *Items1 = new QStandardItem(c.second.toChatLine());
Items1->setData(INCOMING, Qt::UserRole + 1);
diff --git a/src/Chat/Chat.h b/src/Chat/Chat.h
index 526aa36..efe5b56 100644
--- a/src/Chat/Chat.h
+++ b/src/Chat/Chat.h
@@ -28,7 +28,7 @@ class Chat // Chat Controller
public:
Chat();
//QString zaddr();
- void renderChatBox(Ui::MainWindow* ui, QListView *view); // action
+ void renderChatBox(Ui::MainWindow* ui, QListView *view, QLabel *label); // action
// void renderContactRequest();
/*void triggerRequest();
void showMessages();
diff --git a/src/Chat/Helper/ChatDelegator.h b/src/Chat/Helper/ChatDelegator.h
index 6e3e676..10b45e5 100644
--- a/src/Chat/Helper/ChatDelegator.h
+++ b/src/Chat/Helper/ChatDelegator.h
@@ -37,7 +37,7 @@ class ListViewDelegate : public QAbstractItemDelegate
inline QSize sizeHint(QStyleOptionViewItem const &option, QModelIndex const &index) const;
};
-inline ListViewDelegate::ListViewDelegate(QObject *parent): QAbstractItemDelegate(parent), d_radius(5), d_toppadding(5), d_bottompadding(3), d_leftpadding(5), d_rightpadding(5), d_verticalmargin(5), d_horizontalmargin(10), d_pointerwidth(10), d_pointerheight(17), d_widthfraction(.6)
+inline ListViewDelegate::ListViewDelegate(QObject *parent): QAbstractItemDelegate(parent), d_radius(5), d_toppadding(5), d_bottompadding(3), d_leftpadding(5), d_rightpadding(7), d_verticalmargin(5), d_horizontalmargin(10), d_pointerwidth(10), d_pointerheight(17), d_widthfraction(.7)
{
}
diff --git a/src/DataStore/ChatDataStore.cpp b/src/DataStore/ChatDataStore.cpp
index 1313103..21ddef9 100644
--- a/src/DataStore/ChatDataStore.cpp
+++ b/src/DataStore/ChatDataStore.cpp
@@ -96,6 +96,7 @@ std::map ChatDataStore::getAllMemos()
(c.second.getMemo().startsWith("{") == false) &&
(c.second.getMemo().isEmpty() == false)
+
)
{
diff --git a/src/Model/ChatItem.cpp b/src/Model/ChatItem.cpp
index 540c7ba..fff8f9a 100644
--- a/src/Model/ChatItem.cpp
+++ b/src/Model/ChatItem.cpp
@@ -137,10 +137,10 @@ QString ChatItem::toChatLine()
myDateTime.setTime_t(_timestamp);
if (_confirmations == 0){
- lock = " ";
+ lock = " ";
}else{
- lock = " ";
+ lock = " ";
}
diff --git a/src/Model/ContactRequest.cpp b/src/Model/ContactRequest.cpp
index 68b4ed3..9741ba0 100644
--- a/src/Model/ContactRequest.cpp
+++ b/src/Model/ContactRequest.cpp
@@ -5,12 +5,14 @@
ContactRequest::ContactRequest() {}
-ContactRequest::ContactRequest(QString sender, QString receiver, QString memo, QString cid)
+ContactRequest::ContactRequest(QString sender, QString receiver, QString memo, QString cid, QString label, QString avatar)
{
_senderAddress = sender;
_receiverAddress = receiver;
_memo = memo;
_cid = cid;
+ _label = label;
+ _avatar = avatar;
}
QString ContactRequest::getSenderAddress()
@@ -33,6 +35,16 @@ QString ContactRequest::getCid()
return _cid;
}
+QString ContactRequest::getLabel()
+{
+ return _label;
+}
+
+QString ContactRequest::getAvatar()
+{
+ return _avatar;
+}
+
void ContactRequest::setSenderAddress(QString address)
{
_senderAddress = address;
@@ -53,9 +65,19 @@ void ContactRequest::setCid(QString cid)
_cid = cid;
}
+void ContactRequest::setLabel(QString label)
+{
+ _label = label;
+}
+
+void ContactRequest::setAvatar(QString avatar)
+{
+ _avatar = avatar;
+}
+
QString ContactRequest::toString()
{
- return "sender: " + _senderAddress + " receiver: " + _receiverAddress + " memo: " + _memo + " cid: " + _cid;
+ return "sender: " + _senderAddress + " receiver: " + _receiverAddress + " memo: " + _memo + " cid: " + _cid + " label: " + _label + " avatar: " + _avatar;
}
ContactRequest::~ContactRequest()
@@ -64,4 +86,6 @@ ContactRequest::~ContactRequest()
_receiverAddress = "";
_memo = "";
_cid = "";
+ _label = "";
+ _avatar = "";
}
\ No newline at end of file
diff --git a/src/Model/ContactRequest.h b/src/Model/ContactRequest.h
index 5339d5c..5335434 100644
--- a/src/Model/ContactRequest.h
+++ b/src/Model/ContactRequest.h
@@ -14,18 +14,24 @@ class ContactRequest
QString _receiverAddress;
QString _memo;
QString _cid;
+ QString _label;
+ QString _avatar;
public:
ContactRequest();
- ContactRequest(QString sender, QString receiver, QString memo, QString cid);
+ ContactRequest(QString sender, QString receiver, QString memo, QString cid, QString label, QString avatar);
QString getSenderAddress();
QString getReceiverAddress();
QString getMemo();
QString getCid();
+ QString getLabel();
+ QString getAvatar();
void setSenderAddress(QString address);
void setReceiverAddress(QString contact);
void setMemo(QString memo);
void setCid(QString cid);
+ void setLabel(QString label);
+ void setAvatar(QString avatar);
QString toString();
~ContactRequest();
};
diff --git a/src/addressbook.cpp b/src/addressbook.cpp
index b557dd9..f51e279 100644
--- a/src/addressbook.cpp
+++ b/src/addressbook.cpp
@@ -144,22 +144,35 @@ void AddressBook::open(MainWindow* parent, QLineEdit* target)
// Connect the dialog's closing to updating the label address completor
QObject::connect(&d, &QDialog::finished, [=] (auto) { parent->updateLabels(); });
+
Controller* rpc = parent->getRPC();
bool sapling = true;
+ try
+ {
rpc->createNewZaddr(sapling, [=] (json reply) {
QString myAddr = QString::fromStdString(reply.get()[0]);
QString message = QString("New Chat Address for your partner: ") + myAddr;
QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
+
+ rpc->refreshAddresses();
parent->ui->listReceiveAddresses->insertItem(0, myAddr);
parent->ui->listReceiveAddresses->setCurrentIndex(0);
- qDebug() << "new generated myAddr" << myAddr;
+ qDebug() << " new Addr in Addressbook" << myAddr;
ab.cid->setText(cid);
ab.addr_chat->setText(myAddr);
});
- model.updateUi(); //todo fix updating gui after adding
- //rpc->refresh(true);
+ }
+
+ catch(...)
+ {
+
+
+ qDebug() << QString("Caught something nasty with myZaddr Addressbook");
+ }
+
+ // model.updateUi(); //todo fix updating gui after adding
// If there is a target then make it the addr for the "Add to" button
if (target != nullptr && Settings::isValidAddress(target->text()))
diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp
index e8f8015..d3abd34 100644
--- a/src/chatmodel.cpp
+++ b/src/chatmodel.cpp
@@ -125,9 +125,9 @@ void MainWindow::renderContactRequest(){
requestContact.requestMemo->setModel(contactMemo);
requestContact.requestMemo->show();
-
- requestContact.requestZaddr->setText(c.second.getRequestZaddr());
requestContact.requestCID->setText(c.second.getCid());
+ requestContact.requestCID->setVisible(false);
+ requestContact.requestZaddr->setText(c.second.getRequestZaddr());
requestContact.requestMyAddr->setText(c.second.getAddress());
}else{}
}
@@ -152,9 +152,9 @@ void MainWindow::renderContactRequest(){
requestContact.requestMemo->setModel(contactMemo);
requestContact.requestMemo->show();
-
- requestContact.requestZaddr->setText(c.second.getRequestZaddr());
requestContact.requestCID->setText(c.second.getCid());
+ requestContact.requestCID->setVisible(false);
+ requestContact.requestZaddr->setText(c.second.getRequestZaddr());
requestContact.requestMyAddr->setText(c.second.getAddress());
}else{}
}
@@ -310,7 +310,7 @@ Tx MainWindow::createTxFromChatPage() {
QString memo = ui->memoTxtChat->toPlainText().trimmed();
- // ui->memoSizeChat->setLenDisplayLabel();// Todo -> activate lendisplay for chat
+
tx.toAddrs.push_back(ToFields{addr, amt, hmemo});
tx.toAddrs.push_back(ToFields{addr, amt, memo});
@@ -328,7 +328,7 @@ Tx MainWindow::createTxFromChatPage() {
qDebug() << "ChatTx created";
}
-void MainWindow::sendChatButton() {
+void MainWindow::sendChat() {
////////////////////////////Todo: Check if a Contact is selected//////////
@@ -463,29 +463,59 @@ void::MainWindow::addContact()
QDialog dialog(this);
request.setupUi(&dialog);
Settings::saveRestore(&dialog);
+
+
bool sapling = true;
rpc->createNewZaddr(sapling, [=] (json reply) {
QString myAddr = QString::fromStdString(reply.get()[0]);
+ rpc->refreshAddresses();
request.myzaddr->setText(myAddr);
ui->listReceiveAddresses->insertItem(0, myAddr);
ui->listReceiveAddresses->setCurrentIndex(0);
- qDebug() << "new generated myAddr" << myAddr;
+ qDebug() << "new generated myAddr add Contact" << myAddr;
});
+
+ QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
+
+
+
- QString cid = QUuid::createUuid().toString(QUuid::WithoutBraces);
- request.cid->setText(cid);
-
QObject::connect(request.sendRequestButton, &QPushButton::clicked, [&] () {
- QString cid = request.cid->text();
- QString addr = request.zaddr->text().trimmed();
- QString getrequest = addr;
- QString newLabel = request.labelRequest->text().trimmed();
+
+ QString addr = request.zaddr->text();
QString myAddr = request.myzaddr->text().trimmed();
+ QString memo = request.memorequest->text().trimmed();
+ QString avatar = QString(":/icons/res/") + request.comboBoxAvatar->currentText() + QString(".png");
+ QString label = request.labelRequest->text().trimmed();
+
+
contactRequest.setSenderAddress(myAddr);
contactRequest.setReceiverAddress(addr);
- contactRequest.setMemo(newLabel);
+ contactRequest.setMemo(memo);
contactRequest.setCid(cid);
- QString avatar = QString(":/icons/res/") + request.comboBoxAvatar->currentText() + QString(".png");
+ contactRequest.setAvatar(avatar);
+ contactRequest.setLabel(label);
+
+ });
+
+ QObject::connect(request.sendRequestButton, &QPushButton::clicked, this, &MainWindow::saveandsendContact);
+ QObject::connect(request.onlyAdd, &QPushButton::clicked, this, &MainWindow::saveContact);
+
+ dialog.exec();
+
+ rpc->refreshContacts(ui->listContactWidget);
+
+}
+
+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(
@@ -520,42 +550,83 @@ void::MainWindow::addContact()
QMessageBox::Ok
);
return;
- });
-
- dialog.exec();
- rpc->refreshContacts(ui->listContactWidget);
+
+
+
}
+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
Tx MainWindow::createTxForSafeContactRequest()
{
Tx tx;
+{
CAmount totalAmt;
QString amtStr = "0";
CAmount amt;
amt = CAmount::fromDecimalString("0");
totalAmt = totalAmt + amt;
- for(auto &c : AddressBook::getInstance()->getAllAddressLabels())
- {
- if (ui->contactNameMemo->text().trimmed() == c.getName())
- {
- QString cid = c.getCid();
- QString myAddr = c.getMyAddress();
+
+ QString cid = contactRequest.getCid();
+ QString myAddr = contactRequest.getSenderAddress();
QString type = "Cont";
- QString addr = c.getPartnerAddress();
- qDebug() << contactRequest.toString();
+ QString addr = contactRequest.getReceiverAddress();
+
QString hmemo= createHeaderMemo(type,cid,myAddr);
- QString memo = ui->memoTxtChat->toPlainText().trimmed();
- // ui->memoSizeChat->setLenDisplayLabel();// Todo -> activate lendisplay for chat
+ QString memo = contactRequest.getMemo();
+
tx.toAddrs.push_back(ToFields{addr, amt, hmemo});
tx.toAddrs.push_back(ToFields{addr, amt, memo});
qDebug() << "pushback chattx";
tx.fee = Settings::getMinerFee();
- }
- }
+
+}
return tx;
qDebug() << "RequestTx created";
@@ -563,7 +634,7 @@ Tx MainWindow::createTxForSafeContactRequest()
void MainWindow::ContactRequest() {
- /* if (request.labelRequest->text().trimmed().isEmpty() || request.memorequest->toPlainText().trimmed().isEmpty()) {
+ if (contactRequest.getReceiverAddress().isEmpty() || contactRequest.getMemo().isEmpty()) {
// auto addr = "";
// if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) {
@@ -573,7 +644,7 @@ void MainWindow::ContactRequest() {
msg.exec();
return;
- }*/
+ }
Tx tx = createTxForSafeContactRequest();
diff --git a/src/contactrequest.ui b/src/contactrequest.ui
index e099111..8667057 100644
--- a/src/contactrequest.ui
+++ b/src/contactrequest.ui
@@ -10,25 +10,31 @@
427
+
+
+ 780
+ 427
+
+
Send a contact request
- -
+
-
- <html><head/><body><p align="right">Choose a avatar for your contact :</p></body></html>
+ <html><head/><body><p align="right"><span style=" font-weight:600; text-decoration: underline;">Choose a avatar for your contact :</span></p></body></html>
- -
+
-
- <html><head/><body><p>Please insert a Nickname for your contact :</p></body></html>
+ <html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Please insert a Nickname for your contact :</span></p></body></html>
- -
+
-
-
@@ -162,45 +168,126 @@
- -
+
-
- -
+
-
- <html><head/><body><p>Please insert the Address of your contact :</p></body></html>
+ <html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Please insert the Address of your contact :</span></p></body></html>
- -
-
+
-
+
+
+
+ 650
+ 25
+
+
+
+
+ 650
+ 25
+
+
+
- -
+
-
- Your HushChat Address
+ <html><head/><body><p><span style=" font-weight:600; text-decoration: underline;">Your HushChat Address :</span></p></body></html>
- -
-
-
- -
-
+
-
+
+
+
+ 650
+ 25
+
+
+
+
+ 650
+ 25
+
+
- The Conversation ID
+ <html><head/><body><p><span style=" color:#d3d7cf;">Generate your HushChat Address - please wait a second - </span></p></body></html>
- -
-
+
-
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 148
+
+
+
+
+ -
+
-
+ <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Insert a memo for your request</span></p></body></html>
- -
+
-
+
+
+
+ 500
+ 71
+
+
+
+
+ 500
+ 71
+
+
+
+ Qt::NoContextMenu
+
+
+ false
+
+
+ Qt::ImhSensitiveData
+
+
+ 512
+
+
+ Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop
+
+
+ false
+
+
+ Add some memo to your request
+
+
+ true
+
+
+
+ -
+
+
+ 80
+ 25
+
+
100
@@ -210,13 +297,60 @@
Cancel
+
+ false
+
false
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 278
+ 20
+
+
+
+
-
+
+
+
+ 152
+ 25
+
+
+
+
+ 100
+ 0
+
+
+
+ Only add this contact
+
+
+ false
+
+
+ false
+
+
+
+ -
+
+
+ 188
+ 25
+
+
100
@@ -224,7 +358,10 @@
- Add Contact
+ Add Contact & send request
+
+
+ false
false
diff --git a/src/controller.cpp b/src/controller.cpp
index db895a1..d3c05fe 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -1009,7 +1009,7 @@ void Controller::refreshTransactions() {
// Update model data, which updates the table view
transactionsTableModel->replaceData(txdata);
- chat->renderChatBox(ui, ui->listChat);
+ chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat);
// refreshContacts(
// ui->listContactWidget
@@ -1017,9 +1017,9 @@ void Controller::refreshTransactions() {
});
}
-void Controller::refreshChat(QListView *listWidget)
+void Controller::refreshChat(QListView *listWidget, QLabel *label)
{
- chat->renderChatBox(ui, listWidget);
+ chat->renderChatBox(ui, listWidget, label);
}
diff --git a/src/controller.h b/src/controller.h
index cfd3bbb..b34aeb4 100644
--- a/src/controller.h
+++ b/src/controller.h
@@ -74,7 +74,7 @@ public:
void refreshGBPCAP();
void refreshAUDCAP();
- void refreshChat(QListView *listWidget);
+ void refreshChat(QListView *listWidget, QLabel *label);
void refreshContacts(QListView *listWidget);
void executeStandardUITransaction(Tx tx);
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e895947..0e231f4 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -50,6 +50,8 @@ MainWindow::MainWindow(QWidget *parent) :
ui->memoTxtChat->setAutoFillBackground(false);
ui->memoTxtChat->setPlaceholderText("Send Message");
ui->memoTxtChat->setTextColor(Qt::white);
+
+
// Status Bar
setupStatusBar();
@@ -1053,7 +1055,7 @@ void MainWindow::setupchatTab() {
- QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton);
+ 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);
@@ -1078,45 +1080,16 @@ void MainWindow::setupchatTab() {
});
-
-}
-
-ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) {
- QObject::connect(this, &QPlainTextEdit::textChanged, this, &ChatMemoEdit::updateDisplay);
+ui->memoTxtChat->setLenDisplayLabel(ui->memoSizeChat);
}
-void ChatMemoEdit::updateDisplay() {
- QString txt = this->toPlainText();
- if (lenDisplayLabel)
- lenDisplayLabel->setText(QString::number(txt.toUtf8().size()) + "/" + QString::number(maxlen));
-
- if (txt.toUtf8().size() <= maxlen) {
- // Everything is fine
- if (sendChatButton)
- sendChatButton->setEnabled(true);
-
- if (lenDisplayLabel)
- lenDisplayLabel->setStyleSheet("");
- }
- else {
- // Overweight
- if (sendChatButton)
- sendChatButton->setEnabled(false);
-
- if (lenDisplayLabel)
- lenDisplayLabel->setStyleSheet("color: red;");
- }
-}
-void ChatMemoEdit::setMaxLen(int len) {
- this->maxlen = len;
- updateDisplay();
-}
void MainWindow::updateChat()
{
- rpc->refreshChat(ui->listChat);
+ rpc->refreshChat(ui->listChat,ui->memoSizeChat);
rpc->refresh(true);
+
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 4419fcb..85f4feb 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -56,6 +56,10 @@ public:
bool isWebsocketListening();
void createWebsocket(QString wormholecode);
void stopWebsocket();
+ void saveContact();
+ void saveandsendContact();
+ void setMaxLen(int len);
+ void updateDisplay();
void balancesReady();
@@ -106,7 +110,7 @@ private:
void setuphushdTab();
void setupchatTab();
void renderContactRequest();
- void setLenDisplayLabel(QLabel* label);
+ // void setLenDisplayLabel(QLabel* label);
void updateContacts();
void updateChat();
@@ -128,9 +132,11 @@ private:
void cancelButton();
void sendButton();
- void sendChatButton();
+ void sendChat();
void addContact();
void ContactRequest();
+
+
void addAddressSection();
void maxAmountChecked(int checked);
@@ -169,6 +175,7 @@ private:
WSServer* wsserver = nullptr;
WormholeClient* wormhole = nullptr;
+
Controller* rpc = nullptr;
QCompleter* labelCompleter = nullptr;
@@ -180,15 +187,14 @@ private:
QMovie* loadingMovie;
};
-class ChatMemoEdit : public QPlainTextEdit
+class ChatMemoEdit : public QTextEdit
{
public:
ChatMemoEdit(QWidget* parent);
void setMaxLen(int len);
-
- void setSendChatButton(QPushButton* button);
- void includeReplyTo(QString replyToAddress);
+ void setLenDisplayLabel(QLabel* label);
+ void SetSendChatButton(QPushButton* button);
void updateDisplay();
private:
@@ -197,4 +203,5 @@ private:
QPushButton* sendChatButton = nullptr;
};
+
#endif // MAINWINDOW_H
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 82b4260..2d85bd5 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1400,7 +1400,7 @@
<html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Contactlist</span></p></body></html>
-
+
340
@@ -1506,16 +1506,16 @@
- Qt::ScrollBarAlwaysOff
+ Qt::ScrollBarAsNeeded
- Qt::ScrollBarAlwaysOff
+ Qt::ScrollBarAsNeeded
QAbstractScrollArea::AdjustToContents
- QAbstractItemView::NoEditTriggers
+ QAbstractItemView::AllEditTriggers
QListView::Adjust
@@ -1533,12 +1533,24 @@
- 270
- 580
+ 10
+ 20
51
51
+
+
+ 51
+ 51
+
+
+
+
+ 51
+ 51
+
+
100
@@ -1569,12 +1581,24 @@
- 50
+ 80
20
- 61
+ 51
51
+
+
+ 51
+ 51
+
+
+
+
+ 51
+ 51
+
+
100
@@ -1607,12 +1631,24 @@
- 210
+ 150
20
- 61
+ 51
51
+
+
+ 51
+ 51
+
+
+
+
+ 51
+ 51
+
+
Get a new Address
@@ -1633,229 +1669,36 @@
true
-
+
- 90
- 10
- 21
- 16
+ 1140
+ 640
+ 91
+ 17
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 239
- 41
- 41
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 239
- 41
- 41
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
-
-
- 190
- 190
- 190
-
-
-
-
-
-
- 190
- 190
- 190
-
-
-
-
-
-
- 239
- 41
- 41
-
-
-
-
-
-
- 190
- 190
- 190
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 204
- 0
- 0
-
-
-
-
-
-
- 0
- 0
- 0
-
-
-
-
-
-
-
-
- 12
-
-
-
- Qt::LeftToRight
+
+ QFrame::Sunken
- 1
+ 0 / 512
-
- Qt::AutoText
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+ listContactWidget
+ label_39
+ contactNameMemo
+ contactNameMemo_3
+ safeContactRequest
+ pushContact
+ givemeZaddr
+ memoSizeChat
+ listChat
+ memoTxtChat
+ sendChatButton
@@ -2042,6 +1885,11 @@
QLabel
+
+ ChatMemoEdit
+ QTextEdit
+
+
Address1
diff --git a/src/requestContactDialog.ui b/src/requestContactDialog.ui
index d2a3b68..2eb4bc0 100644
--- a/src/requestContactDialog.ui
+++ b/src/requestContactDialog.ui
@@ -6,10 +6,16 @@
0
0
- 1025
- 562
+ 812
+ 495
+
+
+ 812
+ 495
+
+
Incoming contact request
@@ -21,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>
@@ -30,6 +36,12 @@
-
+
+
+ 256
+ 231
+
+
true
@@ -44,8 +56,14 @@
- -
+
-
+
+
+ 521
+ 231
+
+
Qt::ScrollBarAlwaysOff
@@ -79,15 +97,14 @@
- -
-
-
- <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html>
-
-
-
- -
+
-
+
+
+ 256
+ 192
+
+
true
@@ -102,55 +119,83 @@
- -
+
-
Request from :
- -
-
-
- -
-
-
- Cid :
+
-
+
+
+
+ 351
+ 25
+
+
+
+
+ 351
+ 25
+
- -
-
-
- -
+
-
My Zaddr :
- -
-
+
-
+
+
+
+ 351
+ 25
+
+
+
+
+ 351
+ 25
+
+
+
- -
+
-
- Nickname
+ Give a Nickname:
- -
+
-
- -
+
-
<html><head/><body><p align="right">Choose a avatar for your contact :</p></body></html>
- -
+
-
+
+
+ 106
+ 25
+
+
+
+
+ 106
+ 25
+
+
-
Stag
@@ -283,8 +328,14 @@
- -
+
-
+
+
+ 80
+ 25
+
+
100
@@ -294,16 +345,42 @@
Cancel
+
+ false
+
false
- -
+
-
+
+
+ 153
+ 25
+
+
Add this new Contact
+
+ false
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+ <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Details of the request</span></p></body></html>
+