From 6a3b644a0a436a8d90d1105714c840f3ef325216 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Wed, 6 May 2020 15:40:55 +0200 Subject: [PATCH 1/3] first implementation of automated contact request detection - work in progress --- reuqestDialog.ui | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 reuqestDialog.ui diff --git a/reuqestDialog.ui b/reuqestDialog.ui new file mode 100644 index 0000000..fb923db --- /dev/null +++ b/reuqestDialog.ui @@ -0,0 +1,72 @@ + + + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 30 + 240 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + + From 5ff2d1ba47261e37100f15be70a7faa4e2397f78 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Wed, 6 May 2020 15:41:40 +0200 Subject: [PATCH 2/3] first implementation of automated contact request detection - work in progress --- res/css/dark.css | 2 +- reuqestDialog.ui | 72 -------- silentdragon-lite.pro | 1 + src/addressbook.cpp | 2 + src/chatmodel.cpp | 113 +++++++++++- src/chatmodel.h | 44 ++++- src/connection.h | 1 + src/contactmodel.cpp | 11 +- src/contactrequest.ui | 2 +- src/controller.cpp | 48 +++-- src/mainwindow.cpp | 28 ++- src/mainwindow.h | 14 ++ src/mainwindow.ui | 21 ++- src/requestContactDialog.ui | 355 ++++++++++++++++++++++++++++++++++++ 14 files changed, 599 insertions(+), 115 deletions(-) delete mode 100644 reuqestDialog.ui create mode 100644 src/requestContactDialog.ui diff --git a/res/css/dark.css b/res/css/dark.css index 7846b25..6dc6cfe 100644 --- a/res/css/dark.css +++ b/res/css/dark.css @@ -1,5 +1,5 @@ -QWidget, QMainWindow, QMenuBar, QMenu, QDialog, QTabWidget, QTableView, QTableView::item, QScrollArea, QGroupBox, QPlainTextEdit, QLineEdit, QLabel, MainWindow +QWidget, QMainWindow, QMenuBar, QMenu, QDialog, QTabWidget, QTableView, QTableView::item, QScrollArea, QGroupBox, QPlainTextEdit, QLineEdit, QLabel, MainWindow, ChatModel, requestDialog { background-color: #303335; color: #ffffff; diff --git a/reuqestDialog.ui b/reuqestDialog.ui deleted file mode 100644 index fb923db..0000000 --- a/reuqestDialog.ui +++ /dev/null @@ -1,72 +0,0 @@ - - - - - Dialog - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - - diff --git a/silentdragon-lite.pro b/silentdragon-lite.pro index 5e745f4..a3364d2 100644 --- a/silentdragon-lite.pro +++ b/silentdragon-lite.pro @@ -126,6 +126,7 @@ FORMS += \ src/mobileappconnector.ui \ src/createhushconfdialog.ui \ src/recurringdialog.ui \ + src/requestContactDialog.ui \ src/newrecurring.ui \ src/requestdialog.ui \ src/recurringmultiple.ui \ diff --git a/src/addressbook.cpp b/src/addressbook.cpp index 1dd1a8f..a16d7c8 100644 --- a/src/addressbook.cpp +++ b/src/addressbook.cpp @@ -1,3 +1,5 @@ +// Copyright 2019-2020 The Hush developers +// GPLv3 #include "addressbook.h" #include "ui_addressbook.h" #include "ui_mainwindow.h" diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index b55dd5c..b9133b8 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -6,6 +6,7 @@ #include "controller.h" #include "mainwindow.h" #include "ui_mainwindow.h" +#include "ui_requestContactDialog.h" #include "addressbook.h" #include "ui_memodialog.h" #include "ui_contactrequest.h" @@ -83,6 +84,7 @@ void ChatModel::showMessages() { qDebug() << c.second.toChatLine(); } + } void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView &view) @@ -97,7 +99,10 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView &view) void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) { - + QObject::connect(ui->pushContact, &QPushButton::clicked,[&] () + { + renderContactRequest(); + }); QStandardItemModel* chat = new QStandardItemModel(); @@ -136,15 +141,98 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) ui->listChat->setModel(chat); } - + + } + } + +void ChatModel::renderContactRequest(){ + + Ui_requestDialog requestContact; + QDialog dialog(main); + requestContact.setupUi(&dialog); + Settings::saveRestore(&dialog); + + { + QStandardItemModel* contactRequest = new QStandardItemModel(); + + + for (auto &c : this->chatItems) { + if ((c.second.getType() == "cont") && (c.second.isOutgoing() == false) && (c.second.getMemo().startsWith("{"))) { + + + + QStandardItem* Items = new QStandardItem(c.second.getAddress()); + contactRequest->appendRow(Items); + requestContact.requestContact->setModel(contactRequest); + // requestContact.requestContact->show(); + + + + } + } + } + // } + + + QObject::connect(requestContact.requestContact, &QTableView::clicked, [&] () { + + for (auto &c : this->chatItems){ + QModelIndex index = requestContact.requestContact->currentIndex(); + QString label_contact = index.data(Qt::DisplayRole).toString(); + QStandardItemModel* contactMemo = new QStandardItemModel(); + + if (c.second.isOutgoing() == false) { + if (label_contact == c.second.getAddress()) { + if(c.second.getMemo().startsWith("{")){ + + }else{ + QStandardItem* Items = new QStandardItem(c.second.getMemo()); + contactMemo->appendRow(Items); + requestContact.requestMemo->setModel(contactMemo); + requestContact.requestMemo->show(); + + requestContact.requestZaddr->setText(c.second.getRequestZaddr()); + requestContact.requestCID->setText(c.second.getCid()); + requestContact.requestMyAddr->setText(c.second.getAddress()); + } + } + } + + } + }); + + + + QObject::connect(requestContact.pushButton, &QPushButton::clicked, [&] () { + + QString cid = requestContact.requestCID->text(); + auto addr = requestContact.requestZaddr->text().trimmed(); + QString newLabel = requestContact.requestLabel->text().trimmed(); + auto myAddr = requestContact.requestMyAddr->text().trimmed(); + + QString avatar = QString("res/") + requestContact.comboBoxAvatar->currentText() + QString(".png"); + + qDebug()<<"Beginn kopiert" <addAddressLabel(newLabel, addr, myAddr, cid, avatar); + }); + + + dialog.exec(); } + + void ChatModel::addCid(QString tx, QString cid) { this->cidMap[tx] = cid; } +void ChatModel::addrequestZaddr(QString tx, QString requestZaddr) +{ + this->requestZaddrMap[tx] = requestZaddr; +} + QString ChatModel::getCidByTx(QString tx) { for(auto& pair : this->cidMap) @@ -160,11 +248,31 @@ QString ChatModel::getCidByTx(QString tx) return QString("0xdeadbeef"); } +QString ChatModel::getrequestZaddrByTx(QString tx) +{ + for(auto& pair : this->requestZaddrMap) + { + + } + + if(this->requestZaddrMap.count(tx) > 0) + { + return this->requestZaddrMap[tx]; + } + + return QString("0xdeadbeef"); +} + void ChatModel::killCidCache() { this->cidMap.clear(); } +void ChatModel::killrequestZaddrCache() +{ + this->requestZaddrMap.clear(); +} + QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr, int version=0, int headerNumber=1) { @@ -183,6 +291,7 @@ QString MainWindow::createHeaderMemo(QString type, QString cid, QString zaddr, header = j.toJson(); qDebug() << "made header=" << header; return header; + } diff --git a/src/chatmodel.h b/src/chatmodel.h index cde16cb..945c27c 100644 --- a/src/chatmodel.h +++ b/src/chatmodel.h @@ -14,6 +14,7 @@ #include "camount.h" + class ListViewDelegate : public QAbstractItemDelegate { int d_radius; @@ -163,7 +164,9 @@ class ChatItem long _timestamp; QString _address; QString _contact; - QString _memo; + QString _memo; + QString _requestZaddr; + QString _type; QString _cid; QString _txid; bool _outgoing = false; @@ -171,24 +174,28 @@ class ChatItem public: ChatItem() {} - ChatItem(long timestamp, QString address, QString contact, QString memo, QString cid, QString txid) + ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid) { _timestamp = timestamp; _address = address; _contact = contact; _memo = memo; + _requestZaddr = requestZaddr; + _type = type; _cid = cid; _txid = txid; _outgoing = false; } - ChatItem(long timestamp, QString address, QString contact, QString memo, QString cid, QString txid, bool outgoing) + ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, bool outgoing) { _timestamp = timestamp; _address = address; _contact = contact; _memo = memo; + _requestZaddr = requestZaddr; + _type = type; _cid = cid; _txid = txid; _outgoing = outgoing; @@ -215,6 +222,15 @@ class ChatItem return _memo; } + QString getRequestZaddr() + { + return _requestZaddr; + } + QString getType() + { + return _type; + } + QString getCid() { return _cid; @@ -224,6 +240,7 @@ class ChatItem { return _txid; } + bool isOutgoing() { @@ -244,12 +261,22 @@ class ChatItem { _contact = contact; } - + void setMemo(QString memo) { _memo = memo; } + void setRequestZaddr(QString requestZaddr) + { + _requestZaddr = requestZaddr; + } + + void setType(QString type) + { + _type = type; + } + void setCid(QString cid) { _cid = cid; @@ -258,7 +285,7 @@ class ChatItem { _txid = txid; } - + void toggleOutgo() { _outgoing = true; @@ -291,6 +318,7 @@ class ChatModel Ui::MainWindow* ui; MainWindow* main; std::map cidMap; + std::map requestZaddrMap; public: ChatModel() {}; @@ -303,13 +331,19 @@ class ChatModel void setItems(std::vector items); void renderChatBox(Ui::MainWindow* ui, QListView &view); void renderChatBox(Ui::MainWindow* ui, QListView *view); + void renderContactRequest(); + void triggerRequest(); void showMessages(); void clear(); + //void renderContactRequest(Ui::MainWindow* ui, QListView *view); void addMessage(ChatItem item); void addMessage(QString timestamp, ChatItem item); void addCid(QString tx, QString cid); + void addrequestZaddr(QString tx, QString requestZaddr); QString getCidByTx(QString tx); + QString getrequestZaddrByTx(QString tx); void killCidCache(); + void killrequestZaddrCache(); }; diff --git a/src/connection.h b/src/connection.h index 5ed3a09..7130710 100644 --- a/src/connection.h +++ b/src/connection.h @@ -5,6 +5,7 @@ #include "ui_connection.h" #include "precompiled.h" + using json = nlohmann::json; class Controller; diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp index 17d3fd4..adeeb45 100644 --- a/src/contactmodel.cpp +++ b/src/contactmodel.cpp @@ -1,6 +1,9 @@ +// Copyright 2019-2020 The Hush developers +// GPLv3 #include "contactmodel.h" #include "addressbook.h" #include "mainwindow.h" +#include "chatmodel.h" void ContactModel::renderContactList(QListView* view) { @@ -12,7 +15,7 @@ void ContactModel::renderContactList(QListView* view) auto theme = Settings::getInstance()->get_theme_name(); if ((theme == "dark" || theme == "midnight")) { - QString avatar = c.getAvatar(); + QString avatar = c.getAvatar(); QStandardItem* Items1 = new QStandardItem(QIcon(avatar) ,c.getName()); contact->appendRow(Items1); @@ -22,10 +25,8 @@ void ContactModel::renderContactList(QListView* view) view->setDragDropMode(QAbstractItemView::DropOnly); view->show(); + } + } - - - - } } \ No newline at end of file diff --git a/src/contactrequest.ui b/src/contactrequest.ui index e2939ee..d2ae8ef 100644 --- a/src/contactrequest.ui +++ b/src/contactrequest.ui @@ -11,7 +11,7 @@ - Dialog + Send a contact request diff --git a/src/controller.cpp b/src/controller.cpp index fd1189f..4566827 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -1,3 +1,6 @@ +// Copyright 2019-2020 The Hush developers +// GPLv3 + #include "controller.h" #include "mainwindow.h" #include "addressbook.h" @@ -6,6 +9,7 @@ #include "camount.h" #include "websockets.h" #include "DataStore.h" + template<> DataStore* DataStore::instance = nullptr; template<> @@ -860,7 +864,8 @@ void Controller::refreshTransactions() { QString memo; if (!o["memo"].is_null()) { memo = QString::fromStdString(o["memo"]); -} + } + QString cid; QString contact; @@ -876,6 +881,8 @@ void Controller::refreshTransactions() { address, contact, memo, + QString(""), + QString(""), cid, // we have to set the cid here, its included in our Addressbook for this contact txid, true // is an outgoing message @@ -930,37 +937,40 @@ void Controller::refreshTransactions() { QString type; QString cid; + QString requestZaddr1; + QString requestZaddr; + if (memo.startsWith("{")) { type = memo.mid(75,4); cid = memo.mid(14,36); + requestZaddr1 = memo.right(82); + requestZaddr = requestZaddr1.left(78); - qDebug()<addCid(txid, cid); + chatModel->addrequestZaddr(txid, requestZaddr); } - if (type == "cont") - - { - - qDebug()<< "Als Request erkannt"; - - - } - - + if (chatModel->getCidByTx(txid) != QString("0xdeadbeef")){ cid = chatModel->getCidByTx(txid); } - - else{ cid = ""; } + + if (chatModel->getrequestZaddrByTx(txid) != QString("0xdeadbeef")){ + + requestZaddr = chatModel->getrequestZaddrByTx(txid); + + } + + else{ + requestZaddr = ""; + } QString contact; for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) @@ -968,23 +978,23 @@ void Controller::refreshTransactions() { if (address == c.getMyAddress()){ contact = c.getName(); - qDebug()<< "Addressbuch Addresse: " << c.getMyAddress(); - qDebug()<< "Addresse: " << address; }else{ contact = "";} - + } ChatItem item = ChatItem( datetime, address, contact, memo, + requestZaddr, + type, cid, // we have to set the cid here, its included in the headermemo txid, false ); chatModel->addMessage(item); -} + } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5b71245..eb7b244 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1,3 +1,5 @@ +// Copyright 2019-2020 The Hush developers +// GPLv3 #include "mainwindow.h" #include "addressbook.h" #include "viewalladdresses.h" @@ -15,6 +17,8 @@ #include "version.h" #include "connection.h" #include "ui_contactrequest.h" +#include "ui_requestContactDialog.h" +#include "chatmodel.h" #include "requestdialog.h" #include "websockets.h" #include @@ -1006,22 +1010,21 @@ void MainWindow::setupchatTab() { // Is request Contact checked? - if (ui->request->isChecked()) { + // if (ui->request->isChecked()) { QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::ContactRequest); // qDebug() <request->isChecked()->text(); - }else{ + // }else{ - QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton); + // QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton); - } + // } QObject::connect(ui->safeContactRequest, &QPushButton::clicked, this, &MainWindow::addContact); - -///////// Set selected Zaddr for Chat with Doubleklick +///////// Set selected Zaddr for Chat with Klick QObject::connect(ui->listContactWidget, &QTableView::clicked, [=] () { @@ -1046,6 +1049,19 @@ void MainWindow::setupchatTab() { } + +/* +void MainWindow::setChatItem(ChatItem * item) +{ + this->currentChatItem = item; +} + +ChatItem* MainWindow::getChatItem() +{ + return this->currentChatItem; +}*/ + + ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) { QObject::connect(this, &QPlainTextEdit::textChanged, this, &ChatMemoEdit::updateDisplay); } diff --git a/src/mainwindow.h b/src/mainwindow.h index ee2e5ee..b077593 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -6,6 +6,7 @@ #include "logger.h" #include "recurring.h" + // Forward declare to break circular dependency. class Controller; class Settings; @@ -61,6 +62,10 @@ public: void updateLabels(); void updateTAddrCombo(bool checked); + // void setChatItem(ChatItem* item); + //void ChatItem* getChatItem(); + + // Disable recurring on mainnet void disableRecurring(); @@ -74,6 +79,8 @@ public: QLabel* statusIcon; QLabel* loadingLabel; QWidget* hushdtab; + //ChatItem* currentChatItem; + Logger* logger; @@ -83,8 +90,10 @@ public: public slots: void slot_change_theme(const QString& themeName); void slot_change_currency(const QString& currencyName); + private: + void closeEvent(QCloseEvent* event); void setupSendTab(); @@ -93,6 +102,7 @@ private: void setupBalancesTab(); void setuphushdTab(); void setupchatTab(); + void renderContactRequest(); void setLenDisplayLabel(QLabel* label); void updateContacts(); @@ -147,6 +157,9 @@ private: void restoreSavedStates(); bool eventFilter(QObject *object, QEvent *event); + + + bool uiPaymentsReady = false; QString pendingURIPayment; @@ -154,6 +167,7 @@ private: WormholeClient* wormhole = nullptr; Controller* rpc = nullptr; + QCompleter* labelCompleter = nullptr; QRegExpValidator* amtValidator = nullptr; QRegExpValidator* feesValidator = nullptr; diff --git a/src/mainwindow.ui b/src/mainwindow.ui index b5f3539..74739f7 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1414,9 +1414,9 @@ - 30 + 0 640 - 211 + 91 25 @@ -1427,7 +1427,7 @@ - Add conversation contact + Add contact false @@ -1493,6 +1493,19 @@ Is this message a contact request? + + + + 110 + 640 + 191 + 25 + + + + Incoming contact request + + @@ -1667,7 +1680,7 @@ AddressCombo QComboBox -
addresscombo.h
+
addresscombo.h
QRCodeLabel diff --git a/src/requestContactDialog.ui b/src/requestContactDialog.ui new file mode 100644 index 0000000..b862cda --- /dev/null +++ b/src/requestContactDialog.ui @@ -0,0 +1,355 @@ + + + requestDialog + + + + 0 + 0 + 1011 + 503 + + + + Incoming contact request + + + + + 9 + 9 + 256 + 461 + + + + true + + + QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + + + false + + + QAbstractItemView::SingleSelection + + + + + + 263 + 9 + 741 + 271 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + QAbstractItemView::NoEditTriggers + + + QListView::Adjust + + + 0 + + + false + + + true + + + + + + 276 + 296 + 101 + 17 + + + + Request from : + + + + + + 393 + 296 + 601 + 25 + + + + + + + 276 + 327 + 30 + 17 + + + + Cid : + + + + + + 393 + 327 + 601 + 25 + + + + + + + 276 + 358 + 71 + 17 + + + + My Zaddr : + + + + + + 393 + 358 + 601 + 25 + + + + + + + 276 + 389 + 68 + 17 + + + + Nickname + + + + + + 393 + 389 + 221 + 25 + + + + + + + 276 + 420 + 228 + 17 + + + + <html><head/><body><p align="right">Choose a avatar for your contact :</p></body></html> + + + + + + 510 + 420 + 106 + 25 + + + + + Stag + + + + :/icons/res/Stag.png + + + + + + Elsa + + + + :/icons/res/Elsa.png + + + + + + Denio + + + + :/icons/res/Denio.png + + + + + + Duke + + + + :/icons/res/Duke.png + + + + + + Yoda + + + + :/icons/res/Yoda.png + + + + + + Berg + + + + :/icons/res/Berg.png + + + + + + Sharpee + + + + :/icons/res/Sharpee.png + + + + + + Garfield + + + + :/icons/res/Garfield.png + + + + + + Snoopy + + + + :/icons/res/Snoopy.png + + + + + + Popey + + + + :/icons/res/Popey.png + + + + + + Pinguin + + + + :/icons/res/Pinguin.png + + + + + + Mickey + + + + :/icons/res/Mickey.png + + + + + + SDLogo + + + + :/icons/res/sdlogo2.png + + + + + + + + 300 + 470 + 80 + 25 + + + + + 100 + 0 + + + + Cancel + + + false + + + + + + 400 + 470 + 101 + 25 + + + + Add Contact + + + + + + From 6991743b5f41fb2107a684c2847083e18f923bb7 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Wed, 6 May 2020 16:54:15 +0200 Subject: [PATCH 3/3] new Button Design, only for darkmode atm --- application.qrc | 9 +++ res/add_contact.png | Bin 0 -> 1889 bytes res/add_contact.svg | 9 +++ res/addcontact.svg | 7 +++ res/notification.png | Bin 0 -> 1479 bytes res/notification.svg | 10 ++++ res/send-new-white.png | Bin 0 -> 1714 bytes res/send-new.svg | 19 +++++++ res/send.png | Bin 0 -> 4178 bytes res/send.svg | 6 ++ src/controller.cpp | 8 +-- src/mainwindow.cpp | 18 +----- src/mainwindow.ui | 121 +++++++++++++++++++++++++++++------------ 13 files changed, 151 insertions(+), 56 deletions(-) create mode 100644 res/add_contact.png create mode 100644 res/add_contact.svg create mode 100644 res/addcontact.svg create mode 100644 res/notification.png create mode 100644 res/notification.svg create mode 100644 res/send-new-white.png create mode 100644 res/send-new.svg create mode 100644 res/send.png create mode 100644 res/send.svg diff --git a/application.qrc b/application.qrc index 51a4cc4..c93d249 100644 --- a/application.qrc +++ b/application.qrc @@ -23,6 +23,15 @@ res/Pinguin.png res/Stag.png res/Elsa.png + res/send.png + res/send.svg + res/addcontact.svg + res/send-new.svg + res/add_contact.svg + res/notification.svg + res/send-new-white.png + res/add_contact.png + res/notification.png res/hushdlogo.gif diff --git a/res/add_contact.png b/res/add_contact.png new file mode 100644 index 0000000000000000000000000000000000000000..c00a055a21402dca0832a1bf5b8553ba5dde3601 GIT binary patch literal 1889 zcmZ9M3s4hx9>+J2C7T5ygf$@LkLoAg?QkXa%1U1d^DP zKx6=W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l%A6Y*Xj9=3`(k3Y#1J z|1$#r-lssoPk(wG)4WK~_pg;sJnEtL=aUPkvp0L1p{T;MVkaa*396r&-V=h}6To2G zSrzY^Nr>v`xkl<8Y%S(FuIoNHCyi0k&;^jUM|sSoL<-Jy^41-2YCwvybnZfn_i8b4 z;#v%S#F8Y6P|qk$gjyyT_DCKa_wcDJ79{ME(cNIZc|4%^WrhIbgEZ}Yu%|Ecbiy+z zID#UX(4e$+KBEex&jsdq^0m#q3jrmZ7x(y6j{IKom-HUbH zt>>z9oE-np-l)b~SU%9s_e8wxK$_mg7QeH~)1)mcl_WVfF9i8}&8}ESUsGc^$cHyj z@6rE~eQ)MX^m*YIE;?hh3 z_M3EdH7p439%T8Q%)~x{KQV)*3pd^ + + + + + + diff --git a/res/addcontact.svg b/res/addcontact.svg new file mode 100644 index 0000000..1a71008 --- /dev/null +++ b/res/addcontact.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/res/notification.png b/res/notification.png new file mode 100644 index 0000000000000000000000000000000000000000..f746609c5cffa2681e15dfee53173638f8cf0848 GIT binary patch literal 1479 zcmeAS@N?(olHy`uVBq!ia0vp^j~EyjWjNS?tXuyxfD(+Yna<7up3cq+1x5L3nK`Kp z3>p(_C)#=(c91z5ADr#FswqsM@I=5|osKSxEYYq2#VcHEt!BjhQZ&i*2#S$mz24L; z-yO;>o*pY3!|M2f`N+wOo)=xc{=^4m2);g8Xn*f+^_{)UEm;#Y!){9~c)4w6&+#KA zX|6o`lp4xP7R&E7+T0WA>9yeLk6rEk>&pY@UHx@u{$lU5Q9K_yj~JgZ$bD4$Xr=G% z2YdWw(pV!^?bPK=Up5`-j|sP_dpxH+^1;kRK}G(Q~#Y&Aj^lWW2Ky#7;k0bRgOd|{Z%+MV(i+28VZS*46hrNHhv%!VN7u?P z=XdDZ<#mUFz5Rg4yiM1m_UvA~b9?>yE5Cm;a`6_`W+eWp2gVCqlDE4H!+#K5uy^@n zpa^GyM`STD3a^7Oqm#z$3ZNi+iKnkC`x90+J_+5#3#axmFfbqXba4!+xb^m~V_uS@ zfQzI0_x;7c8R8;tJW4MuKT@@1qJ(`qW6}xn+Y#Ao%m39(s<`s)f&8lj46K?iY^)j{ zibfg^j$9KH1-k+}csc`moKieml0=l8l|&W`ND3{KNUx~mIG_}D*wdaTEU*J8dRat3 z$-=jAnw7t4lHr@c&wbs-^c#;brv-;ULA*omk9{Y*J#zSbL0|a>q3Sq>Ih01`0d3T#mVO1pMQ=<^0PG>I(Y5PW=Bu?y%p5rw8b<}M)RN-jO+ z?HW!XwH+Vd3Ak#wDRv1M-jiL#aa6-aQ0driXAwp9BNBp2VDWcSi#RNGk97zbe*0PH zvZ3Re!0H{L9ZFB0NX%W9Ah=dBtgu_a^#re>mG90&U*ccr^UGQIx^@U(&EyihD3v6t zs}$jq-4QwmXv$7gx8<5(-jI+RLr17;NiE+S0cMUUr}mu-O?7} z+Rd?;L$HP8$~@(&x{l|aVuEv)9cU1kyEH*C@ks=SpbjtuB_3V;?!71Aa9E+ukGe&! zEXy?!AuI80<9E+J?I)%++I)#alfxDIv=n#fP;kMG4Pxj0@V*vx+WG9Zi7GekKrvAS zimRuf*gOr2qG`a0NzwsE-H`}BVBBq#0mg2!rHkO9|H(ZZ3+0ntIQ~i~JH0qAA?Rce zjIdvZZY>x34V7BzdIS}}5TWF!{&&ZY1_4}{5txghz)Y0?VEUY2bCvejirdsbzAO&& zm_bMQ0lODl!u|FpWeI`|I#}#t4#YF;3h1~ayO^WZ!_b3~YhqE4l8Dk$jic%=UV&ZwF#Dmj#c}hs(n}}r Sf1{rb67h8Pb6Mw<&;$U?F(3#4 literal 0 HcmV?d00001 diff --git a/res/notification.svg b/res/notification.svg new file mode 100644 index 0000000..3db8333 --- /dev/null +++ b/res/notification.svg @@ -0,0 +1,10 @@ + + + + + + + diff --git a/res/send-new-white.png b/res/send-new-white.png new file mode 100644 index 0000000000000000000000000000000000000000..4c7461c389f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1&sI!{Fkz!C}IWcM*sR^AzDoVgWU|AW!IZeY+4J-^aq*DlF z$RZY?A=4BbfrhAhP2jo;^t{If{;Qz}g;aN#2klJY6xw4QQViq?teOerbX*D9;KJFG zr3N(5$y8J)kZIy9{%HY?0c(G6<8@fV!Y!b6kZGZi4jQwC3oeSu6wqYhhKfR&PAhyI zH#jU2&=JsL;a=#3&IBulh+;AYGzD~^qEM#O3Wp82nG2Z?!W3XKUATbuLli)nLRtB)Jtzcp=0YYG?-dQJn^l7j)NE+sngI+*#>+sN z1iJ_))-&utxtBma2J%3K&zga{N`N+l6@3QUl3*2~1X1)efm0M%K;Z}ZpP6l!m!Am} RyPO76=;`X`vd$@?2>?mlX@UR% literal 0 HcmV?d00001 diff --git a/res/send-new.svg b/res/send-new.svg new file mode 100644 index 0000000..ce2df0a --- /dev/null +++ b/res/send-new.svg @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + diff --git a/res/send.png b/res/send.png new file mode 100644 index 0000000000000000000000000000000000000000..f0fce109a66c1332bbafc5c1abcb952c4d3f4ad2 GIT binary patch literal 4178 zcmV-Y5UuZtP)aoaT0cTXv9nYZ6R)C~o-)i&Tj%K31C4K z>kqy*8erFn4YswR)G~V@P6$)Rv)yHaP8#;3N{ZP;3T!J6z;$>45(mVyPsl`V8A5jj zQTm}UY1>H#ZXq6M!8?i|O%w1Atf0B!IPq^ja{Pj-3W{S(rAKymh^vwrX$qp0wo6anjVR+@Q$7Zk^ZU>%t}@#69K!Lg|idK5aA z3w4|-ktbYS6+Jf2vr#;p9FZqloSD7gSSHXjOT0F{Cl(6I6D``eewRl?9I(Xea&4TUllajlPmZC> zbA03Lp+xRxxs^Y}C_{8&yuN%RO4|MdD*velEiWiR{xg>%h>^VfbLcL*Rm73r$yLvc zAxW8NL4GN!ICTzTtFNy|XU?2K!xGk_rzgdse$y5qm1cvNe=c^C>w0(@s@3sAVmg|$ zaW~p?;xuY&zr_P@Z*NB@Po6}F4jn?Z7cTSA4Wr+b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ZIh6mQQ4#k2R5s>pR!#UnCF)hfVnm%V3$zG#p^-zexlob0mOi;U&;Tx-X zeCE?9XwP{)n6qEIXGco?YEokrk1rzl-e1lds1T!pKy#+#;YX(UBs1st)x6gfVm8?3 zO_e%)V-=6befk8d2}-T6D@ZVCkNPR}#%+@{{JASV@6*R?&Oa5V9;6`20%O@wfPY=e z@bLw}9;~fbKlSmn00oK0chb@_jgp2B*MbNymZZy{{9OIGf@D)_xn9sbaj#_I<68bK z;clVw8>?CU*hiBeR7k->l9TU)iXJU#_%oKc8N|_7`-Vr2^jR9#(|%vFOFs|awHqt? zMraTFjhdrUNZC|zx+meD`fTZ{c#<4n)+bV}06nS4n_oPj=qkpic{NOJS5@)!j#yCA zH*C(cimqrK-8Zeg{Gmtg`mx?9qLe`h16J`?Gy zeiNugJx8j$D`Yc&0B{?Y09tobGAf=4@t6F@#n62|n*2wZupJwq(ft|Ukp?S3Gr3Vd zQx9>>M5TJkLo!ikR{+iWZXNg9>qt4fcY}9X6!XRqbtK_Rw*w9XGERvoC}PKd5l zOLIH09w9`_JtC9xl)>p;to4J0Nf`9$;ow2I;C;}#AF(TfD&%n7|5t|M3*%4s=z}3E zI35y1E8)iEodGm=P9Vtb0W@ \ No newline at end of file diff --git a/src/controller.cpp b/src/controller.cpp index 4566827..0a0913a 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -874,7 +874,7 @@ void Controller::refreshTransactions() { if (address == c.getPartnerAddress()){ contact = c.getName(); }else{ contact = "";} - } + ChatItem item = ChatItem( datetime, @@ -889,7 +889,7 @@ void Controller::refreshTransactions() { ); chatModel->addMessage(item); - + } items.push_back(TransactionItemDetail{address, amount, memo}); total_amount = total_amount + amount; @@ -980,7 +980,7 @@ void Controller::refreshTransactions() { contact = c.getName(); }else{ contact = "";} - } + ChatItem item = ChatItem( datetime, address, @@ -994,7 +994,7 @@ void Controller::refreshTransactions() { ); chatModel->addMessage(item); - + } } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index eb7b244..8385b7a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1013,12 +1013,12 @@ void MainWindow::setupchatTab() { // if (ui->request->isChecked()) { - QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::ContactRequest); + // QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::ContactRequest); // qDebug() <request->isChecked()->text(); // }else{ - // QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton); + QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton); // } @@ -1048,20 +1048,6 @@ void MainWindow::setupchatTab() { } - - -/* -void MainWindow::setChatItem(ChatItem * item) -{ - this->currentChatItem = item; -} - -ChatItem* MainWindow::getChatItem() -{ - return this->currentChatItem; -}*/ - - ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) { QObject::connect(this, &QPlainTextEdit::textChanged, this, &ChatMemoEdit::updateDisplay); } diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 74739f7..045d7e0 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1332,9 +1332,9 @@ 0 - 40 + 90 341 - 601 + 551 @@ -1354,7 +1354,7 @@ 0 - 20 + 60 341 20 @@ -1392,32 +1392,10 @@ - 720 - 640 - 114 - 25 - - - - - 100 - 0 - - - - Send - - - false - - - - - - 0 - 640 + 1170 + 560 91 - 25 + 81 @@ -1426,11 +1404,28 @@ 0 + + false + - Add contact + + + + + :/icons/res/send-new-white.png + + + + + 61 + 62 + + + + false - false + true @@ -1484,7 +1479,7 @@ 340 - 650 + 640 261 23 @@ -1493,17 +1488,71 @@ Is this message a contact request? + + + + 90 + 0 + 71 + 61 + + + + + 100 + 0 + + + + + + + + :/icons/res/add_contact.png:/icons/res/add_contact.png + + + + 43 + 49 + + + + true + + - 110 - 640 - 191 - 25 + 170 + 0 + 71 + 61 + + + 100 + 0 + + + + false + - Incoming contact request + + + + + :/icons/res/notification.png:/icons/res/notification.png + + + + 43 + 49 + + + + true