From 310504285bc605b7276d808f472e98b58d9630d9 Mon Sep 17 00:00:00 2001
From: DenioD <41270280+DenioD@users.noreply.github.com>
Date: Wed, 6 May 2020 22:55:23 +0200
Subject: [PATCH] add a new button to send contact request, some ui tweaks
---
application.qrc | 4 +++
res/message-icon.svg | 9 ++++++
res/rahmen-message.png | Bin 0 -> 2541 bytes
res/upload.png | Bin 0 -> 1369 bytes
res/upload.svg | 8 +++++
src/chatmodel.cpp | 22 ++++++++++---
src/mainwindow.cpp | 49 +++++++++++++++-------------
src/mainwindow.h | 6 +++-
src/mainwindow.ui | 71 +++++++++++++++++++++--------------------
9 files changed, 107 insertions(+), 62 deletions(-)
create mode 100644 res/message-icon.svg
create mode 100644 res/rahmen-message.png
create mode 100644 res/upload.png
create mode 100644 res/upload.svg
diff --git a/application.qrc b/application.qrc
index c93d249..29a1765 100644
--- a/application.qrc
+++ b/application.qrc
@@ -32,6 +32,10 @@
res/send-new-white.png
res/add_contact.png
res/notification.png
+ res/rahmen-message.png
+ res/upload.png
+ res/upload.svg
+ res/message-icon.svg
res/hushdlogo.gif
diff --git a/res/message-icon.svg b/res/message-icon.svg
new file mode 100644
index 0000000..fe61e44
--- /dev/null
+++ b/res/message-icon.svg
@@ -0,0 +1,9 @@
+
+
+
diff --git a/res/rahmen-message.png b/res/rahmen-message.png
new file mode 100644
index 0000000000000000000000000000000000000000..3b486a4b1103542e6c20d7d879a5503405ceaf92
GIT binary patch
literal 2541
zcmeAS@N?(olHy`uVBq!ia0y~yU;;9k7&zE~)R&4YzZe)8TQZ%U13aCb6$*;-(=u~X
z85lGs)=sqbIP4&EG(I@nRg14opzuUM=|%;uM=L@#oLU34x4cRydf9$qiK1s=p-2oj
zU!6{vY|Na}(gIPIgZu*O?&_}Mnjh;u7rOSaAOBlX{=V=#pTMisWs$PU4a;t)SCwL0T;)q
z2Y$!zd~#y4bK`^Mo0a%Bu%(xMUU~D-zBr(E(m}z>SMR<_FeFUd?hZ~y0t^fdKvP&4
z7!-gMBLf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@XW49sDkE{-7;x8B~}$jfZV!{Rvi
z_xs4cn5Oe}MQTA>T-;3aYxw$$-tV1XJZZ*>;)*rxZE6-919^N4k`_zMdT_+e(Bxoe
zZ&F5+u=LRjEb3-m3pxFAM4W}^+|a#23w$Lv5^yGzEqPiL;$4K
z8DgQD3DgN-t!)pWW^v?&Lrgz*>46ehiJ{gG4zQ^`TzX*5Qj43qF9-k~aBKyBC3hYH
z)f@q-*=}IA(9jZOj&7H4Mh*waAa0<$W`j(+^8l#q7)Y5pP}xSXvQnVL0^yhzwz)v@
z7cAln9o2!ltq!_oT;SAmYW6D-lq#XF5?OuahD&9)s|uz6+S^Ip$Z5FY0LBVt4ml7k
zAgy2q!5zE;(hz)vt%DbWlbDaNLGVV#BxW#fyuq*$f+0qMjHIz~z+{gDJfBkxOxed6
r?mzzzbOh8NXE|UlBE@s4HvF*8f8(*Ycx^~XAV|W~)z4*}Q$iB}e1!gF
literal 0
HcmV?d00001
diff --git a/res/upload.svg b/res/upload.svg
new file mode 100644
index 0000000..9f31b60
--- /dev/null
+++ b/res/upload.svg
@@ -0,0 +1,8 @@
+
+
+
diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp
index d800f95..6c426be 100644
--- a/src/chatmodel.cpp
+++ b/src/chatmodel.cpp
@@ -155,7 +155,7 @@ void ChatModel::renderContactRequest(){
requestContact.setupUi(&dialog);
Settings::saveRestore(&dialog);
- {
+ /* {
QStandardItemModel* contactRequest = new QStandardItemModel();
@@ -183,8 +183,7 @@ void ChatModel::renderContactRequest(){
}
-
- // }
+
QObject::connect(requestContact.requestContact, &QTableView::clicked, [&] () {
@@ -228,7 +227,7 @@ void ChatModel::renderContactRequest(){
qDebug()<<"Beginn kopiert" <addAddressLabel(newLabel, addr, myAddr, cid, avatar);
});
-
+ */
dialog.exec();
}
@@ -476,7 +475,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 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 3 confirmations before they can be spent")
.arg(available.toDecimalhushString(), total.toDecimalhushString());
}
@@ -601,6 +600,18 @@ Tx MainWindow::createTxForSafeContactRequest() {
void MainWindow::ContactRequest() {
+ 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);
+
+ msg.exec();
+ return;
+ }
+
Tx tx = createTxForSafeContactRequest();
QString error = doSendRequestTxValidations(tx);
@@ -659,6 +670,7 @@ void MainWindow::ContactRequest() {
// Force a UI update so we get the unconfirmed Tx
// rpc->refresh(true);
ui->memoTxtChat->clear();
+ rpc->refresh(true);
},
// Errored out
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 884a6a7..a691a56 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1,4 +1,4 @@
-// Copyright 2019-2020 The Hush developers
+// Copyright 2019-2020 The Hush developers
// GPLv3
#include "mainwindow.h"
#include "addressbook.h"
@@ -44,7 +44,7 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
- ui->request->setChecked(false);
+
logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log"));
ui->memoTxtChat->setAutoFillBackground(false);
ui->memoTxtChat->setPlaceholderText("Send Message");
@@ -1005,22 +1005,10 @@ void MainWindow::setupTransactionsTab() {
}
void MainWindow::setupchatTab() {
-
-// Send button
-
- // Is request Contact checked?
-
- // if (ui->request->isChecked()) {
-
- // QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::ContactRequest);
-
- // qDebug() <request->isChecked()->text();
- // }else{
-
- /////////////Setting Icons for Chattab and different themes
-
- auto theme = Settings::getInstance()->get_theme_name();
+ /////////////Setting Icons for Chattab and different themes
+
+ auto theme = Settings::getInstance()->get_theme_name();
if (theme == "dark" || theme == "midnight") {
QPixmap send(":/icons/res/send-new-white.png");
QIcon sendIcon(send);
@@ -1032,8 +1020,15 @@ void MainWindow::setupchatTab() {
QPixmap addContact(":/icons/res/add_contact.png");
QIcon addContactIcon(addContact);
- ui->safeContactRequest->setIcon(addContact);
+ ui->safeContactRequest->setIcon(addContactIcon);
+
+ /*QPixmap rahmen(":/icons/res/rahmen-message.png");
+ QIcon addRahmenIcon(rahmen);
+ ui->lcdNumber->setIcon(addRahmenIcon);*/
+ QPixmap sendContact(":/icons/res/upload.png");
+ QIcon addSendContactIcon(sendContact);
+ ui->sendContact->setIcon(addSendContactIcon);
}else{
QPixmap pixmap(":/icons/res/send-new.svg");
QIcon sendIcon(pixmap);
@@ -1046,11 +1041,21 @@ void MainWindow::setupchatTab() {
QPixmap addContact(":/icons/res/add_contact.svg");
QIcon addContactIcon(addContact);
ui->safeContactRequest->setIcon(addContact);
+
+ /*QPixmap rahmen(":/icons/res/message-icon.svg");
+ QIcon addRahmenIcon(rahmen);
+ ui->lcdNumber->setIcon(addRahmenIcon);*/
+
+ QPixmap sendContact(":/icons/res/upload.svg");
+ QIcon addSendContactIcon(sendContact);
+ ui->sendContact->setIcon(addSendContactIcon);
}
- QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton);
- // }
-
+
+
+
+ QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton);
+ QObject::connect(ui->sendContact, &QPushButton::clicked, this, &MainWindow::ContactRequest);
QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact);
///////// Set selected Zaddr for Chat with Klick
@@ -1549,4 +1554,4 @@ MainWindow::~MainWindow()
delete wsserver;
delete wormhole;
-}
+}
\ No newline at end of file
diff --git a/src/mainwindow.h b/src/mainwindow.h
index b077593..54f9dc8 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -92,10 +92,14 @@ public slots:
void slot_change_currency(const QString& currencyName);
-private:
+private slots:
+
+
+private:
void closeEvent(QCloseEvent* event);
+
void setupSendTab();
void setupTransactionsTab();
void setupReceiveTab();
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 85cefa3..6be3969 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -1360,7 +1360,7 @@
- <html><head/><body><p align="center">Hushchat Contactlist</p></body></html>
+ <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Contactlist</span></p></body></html>
@@ -1438,7 +1438,7 @@
- <html><head/><body><p align="center">Contact Name:</p></body></html>
+ <html><head/><body><p align="center"><span style=" font-weight:600;">Contact Name :</span></p></body></html>
@@ -1475,19 +1475,6 @@
true
-
-
-
- 340
- 650
- 261
- 23
-
-
-
- Is this message a contact request?
-
-
@@ -1578,6 +1565,39 @@
0.000000000000000
+
+
+
+ 270
+ 510
+ 51
+ 51
+
+
+
+
+ 100
+ 0
+
+
+
+
+
+
+
+ :/icons/res/add_contact.png
+
+
+
+
+ 43
+ 49
+
+
+
+ true
+
+
lcdNumber
listContactWidget
label_39
@@ -1586,9 +1606,9 @@
sendChatButton
contactNameMemo_3
listChat
- request
safeContactRequest
pushContact
+ sendContact
@@ -1799,22 +1819,5 @@
-
-
- request
- stateChanged(int)
- MainWindow
- update()
-
-
- 481
- 721
-
-
- 636
- 389
-
-
-
-
+