From 0223d6def84a940a794979b4031554ccf2120f5c Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Sun, 3 May 2020 01:03:29 +0200 Subject: [PATCH 1/7] add chatbubbles to render chat --- src/chatmodel.cpp | 111 +++++++++++++++++-------------- src/chatmodel.h | 161 ++++++++++++++++++++++++++++++++++++++++++++- src/controller.cpp | 11 ++-- src/controller.h | 2 +- src/mainwindow.cpp | 95 +++++++++++++++++++++++++- src/mainwindow.h | 4 +- src/mainwindow.ui | 59 ++++++++++------- 7 files changed, 355 insertions(+), 88 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index c6dd75d..7ca3090 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -10,6 +10,7 @@ #include #include #include +#include using namespace std; using namespace boost; @@ -80,11 +81,11 @@ void ChatModel::showMessages() { for(auto &c : this->chatItems) { - qDebug() << "[" << c.second.getTimestamp() << "] " << "<" << c.second.getAddress() << "> :" << c.second.getMemo(); + qDebug() << c.second.toChatLine(); } } -void ChatModel::renderChatBox(Ui::MainWindow* ui, QListWidget &view) +void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView &view) { /*for(auto &c : this->chatItems) { @@ -94,66 +95,68 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListWidget &view) //todo render items to view } -void ChatModel::renderChatBox(Ui::MainWindow* ui, QListWidget *view) +void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) { - - while(view->count() > 0) + // QStandardItemModel mymodel; + // QStandardItem* Items = new QStandardItem(myString); + QStandardItemModel* myModel = new QStandardItemModel(); + for(auto &c : this->chatItems) { - view->takeItem(0); - } - - QString line = ""; - - for(auto &c : this->chatItems){ - - QDateTime myDateTime; - - myDateTime.setTime_t(c.second.getTimestamp()); - //////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid /// - if ((ui->ContactZaddr->text().trimmed() == c.second.getAddress()) && (c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false)) { - // if (c.second.getMemo.find()) - line += QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] "); - line += QString("<") + QString("Outgoing") + QString("> :\n"); - line += QString(c.second.getMemo()) + QString("\n"); - view->addItem(line); - line =""; - - - ////////////////////////////////// Todo : Render green checkmark for contacts if cid = cid - We have to search for cid in txid/cid list - // QString cid = c.second.getCid(); - - } - - if ((ui->MyZaddr->text().trimmed() == c.second.getAddress()) && (c.second.getMemo().startsWith("{") == false) && (c.second.getMemo().isEmpty() == false)){ - for(auto &p : AddressBook::getInstance()->getAllAddressLabels()){ - - if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid())) - { - - - }else{ - - // line+= QString("[") + "Warning. Not verified!" + QString("]"); - - - line += QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] "); - line += QString("<") + QString("incoming") + QString("> :\n"); - line += QString(c.second.getMemo()) + QString("\n"); - view->addItem(line); - line =""; - } - + if ( + (ui->ContactZaddr->text().trimmed() == c.second.getAddress()) && + (c.second.getMemo().startsWith("{") == false) && + (c.second.getMemo().isEmpty() == false) + ) + { + QStandardItem* Items = new QStandardItem(c.second.toChatLine()); + Items->setData("Incoming", Qt::UserRole +1); + myModel->appendRow(Items); + qDebug()<text(); + ui->listChat->setModel(myModel); + ui->listChat->setMinimumSize(200,350); + ui->listChat->setItemDelegate(new ListViewDelegate()); + ui->listChat->show(); } + + if ( + (ui->MyZaddr->text().trimmed() == c.second.getAddress()) && + (c.second.getMemo().startsWith("{") == false) && + (c.second.getMemo().isEmpty() == false) + + ) + { + + QStandardItem* Items1 = new QStandardItem(c.second.toChatLine()); + Items1->setData("Outgoing", Qt::UserRole +1); + myModel->appendRow(Items1); + qDebug()<text(); + } + ui->listChat->setModel(myModel); + ui->listChat->setMinimumSize(200,350); + ui->listChat->setItemDelegate(new ListViewDelegate()); + ui->listChat->show(); } + + + /////////////////////////Render only when CID=CID? + + // for(auto &p : AddressBook::getInstance()->getAllAddressLabels()) + // { - } - + // if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid())) + // { + + + //} + // + + } @@ -247,6 +250,9 @@ Tx MainWindow::createTxFromChatPage() { } void MainWindow::sendChatButton() { + + + ////////////////////////////Todo: Check if a Contact is selected////////// // Create a Tx from the values on the send tab. Note that this Tx object @@ -420,6 +426,9 @@ Tx MainWindow::createTxForSafeContactRequest() { //////////////////De-activated for now/////////////////// void MainWindow::safeContactRequest() { + + + ////////////////////////////Todo: Check if its a zaddr////////// // Create a Tx from the values on the send tab. Note that this Tx object diff --git a/src/chatmodel.h b/src/chatmodel.h index fcc68bf..a060530 100644 --- a/src/chatmodel.h +++ b/src/chatmodel.h @@ -1,15 +1,161 @@ #ifndef CHATMODEL_H #define CHATMODEL_H #include +#include +#include +#include #include #include -#include +#include #include "precompiled.h" #include "mainwindow.h" #include "controller.h" #include "settings.h" #include "camount.h" +class ListViewDelegate : public QAbstractItemDelegate +{ + int d_radius; + int d_toppadding; + int d_bottompadding; + int d_leftpadding; + int d_rightpadding; + int d_verticalmargin; + int d_horizontalmargin; + int d_pointerwidth; + int d_pointerheight; + float d_widthfraction; + public: + inline ListViewDelegate(QObject *parent = nullptr); + + protected: + inline void paint(QPainter *painter, QStyleOptionViewItem const &option, QModelIndex const &index) const; + 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(15), d_horizontalmargin(10), d_pointerwidth(10), d_pointerheight(17), d_widthfraction(.7) +{ + +} + +inline void ListViewDelegate::paint(QPainter *painter, QStyleOptionViewItem const &option, QModelIndex const &index) const +{ + QTextDocument bodydoc; + QTextOption textOption(bodydoc.defaultTextOption()); + textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + bodydoc.setDefaultTextOption(textOption); + bodydoc.setDefaultFont(QFont("Roboto", 12)); + QString bodytext(index.data(Qt::DisplayRole).toString()); + bodydoc.setHtml(bodytext); + qreal contentswidth = option.rect.width() * d_widthfraction - d_horizontalmargin - d_pointerwidth - d_leftpadding - d_rightpadding; + bodydoc.setTextWidth(contentswidth); + qreal bodyheight = bodydoc.size().height(); + bool outgoing = index.data(Qt::UserRole + 1).toString() == "Outgoing"; + painter->save(); + painter->setRenderHint(QPainter::Antialiasing); + + // uncomment to see the area provided to paint this item + + //painter->drawRect(option.rect); + + painter->translate(option.rect.left() + d_horizontalmargin, option.rect.top() + ((index.row() == 0) ? d_verticalmargin : 0)); + + // background color for chat bubble + QColor bgcolor("fbffff"); + if (outgoing) + bgcolor = "#fffcfb"; + + // create chat bubble + QPainterPath pointie; + + // left bottom + pointie.moveTo(0, bodyheight + d_toppadding + d_bottompadding); + + // right bottom + pointie.lineTo(0 + contentswidth + d_pointerwidth + d_leftpadding + d_rightpadding - d_radius, + bodyheight + d_toppadding + d_bottompadding); + pointie.arcTo(0 + contentswidth + d_pointerwidth + d_leftpadding + d_rightpadding - 2 * d_radius, + bodyheight + d_toppadding + d_bottompadding - 2 * d_radius, + 2 * d_radius, 2 * d_radius, 270, 90); + + // right top + pointie.lineTo(0 + contentswidth + d_pointerwidth + d_leftpadding + d_rightpadding, 0 + d_radius); + pointie.arcTo(0 + contentswidth + d_pointerwidth + d_leftpadding + d_rightpadding - 2 * d_radius, 0, + 2 * d_radius, 2 * d_radius, 0, 90); + + // left top + pointie.lineTo(0 + d_pointerwidth + d_radius, 0); + pointie.arcTo(0 + d_pointerwidth, 0, 2 * d_radius, 2 * d_radius, 90, 90); + + // left bottom almost (here is the pointie) + pointie.lineTo(0 + d_pointerwidth, bodyheight + d_toppadding + d_bottompadding - d_pointerheight); + pointie.closeSubpath(); + + // rotate bubble for outgoing messages + if (outgoing) + { + painter->translate(option.rect.width() - pointie.boundingRect().width() - d_horizontalmargin - d_pointerwidth, 0); + painter->translate(pointie.boundingRect().center()); + painter->rotate(180); + painter->translate(-pointie.boundingRect().center()); + } + + // now paint it! + painter->setPen(QPen(bgcolor)); + painter->drawPath(pointie); + painter->fillPath(pointie, QBrush(bgcolor)); + + // rotate back or painter is going to paint the text rotated... + if (outgoing) + { + painter->translate(pointie.boundingRect().center()); + painter->rotate(-180); + painter->translate(-pointie.boundingRect().center()); + } + + // set text color used to draw message body + QAbstractTextDocumentLayout::PaintContext ctx; + if (outgoing) + ctx.palette.setColor(QPalette::Text, QColor("black")); + else + ctx.palette.setColor(QPalette::Text, QColor("white")); + + // draw body text + painter->translate((outgoing ? 0 : d_pointerwidth) + d_leftpadding, 0); + bodydoc.documentLayout()->draw(painter, ctx); + + painter->restore(); +} + +inline QSize ListViewDelegate::sizeHint(QStyleOptionViewItem const &option, QModelIndex const &index) const +{ + QTextDocument bodydoc; + QTextOption textOption(bodydoc.defaultTextOption()); + textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + bodydoc.setDefaultTextOption(textOption); + bodydoc.setDefaultFont(QFont("Roboto", 12)); + QString bodytext(index.data(Qt::DisplayRole).toString()); + bodydoc.setHtml(bodytext); + + // the width of the contents are the (a fraction of the window width) minus (margins + padding + width of the bubble's tail) + qreal contentswidth = option.rect.width() * d_widthfraction - d_horizontalmargin - d_pointerwidth - d_leftpadding - d_rightpadding; + + // set this available width on the text document + bodydoc.setTextWidth(contentswidth); + + QSize size(bodydoc.idealWidth() + d_horizontalmargin + d_pointerwidth + d_leftpadding + d_rightpadding, + bodydoc.size().height() + d_bottompadding + d_toppadding + d_verticalmargin + 1); // I dont remember why +1, haha, might not be necessary + + if (index.row() == 0) // have extra margin at top of first item + size += QSize(0, d_verticalmargin); + + return size; +} + + + + + class ChatItem { private: @@ -117,6 +263,15 @@ class ChatItem _outgoing = true; } + QString toChatLine() + { + QDateTime myDateTime; + myDateTime.setTime_t(_timestamp); + QString line = QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] "); + line += QString(_memo) + QString("\n"); + return line; + } + ~ChatItem() { /*delete timestamp; @@ -145,8 +300,8 @@ class ChatModel void setItems(std::map items); QString zaddr(); void setItems(std::vector items); - void renderChatBox(Ui::MainWindow* ui, QListWidget &view); - void renderChatBox(Ui::MainWindow* ui, QListWidget *view); + void renderChatBox(Ui::MainWindow* ui, QListView &view); + void renderChatBox(Ui::MainWindow* ui, QListView *view); void showMessages(); void clear(); void addMessage(ChatItem item); diff --git a/src/controller.cpp b/src/controller.cpp index 2fe9b52..50db859 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -893,8 +893,8 @@ void Controller::refreshTransactions() { QString(""), memo, cid, // we have to set the cid here, its included in our Addressbook for this contact - txid - // true // is an outgoing message + txid, + true // is an outgoing message ); chatModel->addMessage(item); } @@ -964,7 +964,8 @@ void Controller::refreshTransactions() { QString(""), memo, cid, // we have to set the cid here, its included in the headermemo - txid + txid, + false ); // qDebug()<< "Message CID: " << cid; chatModel->addMessage(item); @@ -990,7 +991,7 @@ void Controller::refreshTransactions() { // Update model data, which updates the table view transactionsTableModel->replaceData(txdata); - chatModel->renderChatBox(ui, ui->listChatMemo); + chatModel->renderChatBox(ui, ui->listChat); refreshContacts( ui->listContactWidget @@ -998,7 +999,7 @@ void Controller::refreshTransactions() { }); } -void Controller::refreshChat(QListWidget *listWidget) +void Controller::refreshChat(QListView *listWidget) { chatModel->renderChatBox(ui, listWidget); diff --git a/src/controller.h b/src/controller.h index 4a0835f..59cfa40 100644 --- a/src/controller.h +++ b/src/controller.h @@ -72,7 +72,7 @@ public: void refreshGBPCAP(); void refreshAUDCAP(); - void refreshChat(QListWidget *listWidget); + void refreshChat(QListView *listWidget); void refreshContacts(QListWidget *listWidget); void executeStandardUITransaction(Tx tx); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f17bfc9..254798f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -993,6 +993,92 @@ void MainWindow::setupchatTab() { ///////// Set selected Zaddr for Chat with Doubleklick QObject::connect(ui->listContactWidget, &QTableView::clicked, [=] () { + + QStandardItemModel mymodel; + + // for(auto &c : this->chatItems) + //{ + //////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid + + /// + // if ( + // (ui->ContactZaddr->text().trimmed() == c.second.getAddress()) && + // (c.second.getMemo().startsWith("{") == false) && + // (c.second.getMemo().isEmpty() == false) + // ) + // { + // if (c.second.getMemo.find()) + + //view->addItem(line); + + // QStandardItem *item1 = new QStandardItem(c.second.toChatLine()); + // item1->setData("Incoming", Qt::UserRole + 1); + // model.appendRow(item1); + + QStandardItem *item1 = new QStandardItem("Kacke Hier"); + item1->setData("Incoming", Qt::UserRole +1); + mymodel.appendRow(item1); + qDebug()<text(); + + + QStandardItem *item2 = new QStandardItem("This is item one"); + item2->setData("Outgoing", Qt::UserRole +1); + mymodel.appendRow(item2); + qDebug()<text(); + + QStandardItem *item3 = new QStandardItem("This is item one"); + item3->setData("Outgoing", Qt::UserRole +1); + mymodel.appendRow(item3); + qDebug()<text(); + + // QStandardItem *item2 = new QStandardItem("Hallo"); + // item1->setData("Outgoing", Qt::UserRole + 1); + // mymodel.appendRow(item2); + // qDebug()<text(); + + ////////////////////////////////// Todo : Render green checkmark for contacts if cid = cid - We have to search for cid in txid/cid list + // QString cid = c.second.getCid(); + + // } + + // if ( + // (ui->MyZaddr->text().trimmed() == c.second.getAddress()) && + // (c.second.getMemo().startsWith("{") == false) && + // (c.second.getMemo().isEmpty() == false) + // ) + // { + + + // for(auto &p : AddressBook::getInstance()->getAllAddressLabels()) + // { + + // if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid())) + // { + + + //} + // else + // { + // line+= QString("[") + "Warning. Not verified!" + QString("]"); + // QStandardItem *item = new QStandardItem(c.second.toChatLine()); + //view->addItem(line); + // model.appendRow(item); + // } + +// } + + //} + + // } + + + + + ui->listChat->setModel(&mymodel); + ui->listChat->setItemDelegate(new ListViewDelegate()); + ui->listChat->show(); + //ui->listChat->update(); + QModelIndex index = ui->listContactWidget->currentIndex(); QString label_contact = index.data(Qt::DisplayRole).toString(); @@ -1005,8 +1091,12 @@ void MainWindow::setupchatTab() { ui->contactCid->setText(p.getCid()); rpc->refresh(true); + updateChat(); } }); + + + } ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) { @@ -1052,12 +1142,13 @@ void ChatMemoEdit::setSendChatButton(QPushButton* button) { void MainWindow::updateChat() { - rpc->refreshChat(ui->listChatMemo); + rpc->refreshChat(ui->listChat); + rpc->refresh(true); + } void MainWindow::updateContacts() { - qDebug() << "Called MainWindow::updateContacts()"; rpc->refreshContacts(ui->listContactWidget); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 7114eda..1110f67 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -54,6 +54,7 @@ public: bool isWebsocketListening(); void createWebsocket(QString wormholecode); void stopWebsocket(); + void balancesReady(); void payhushURI(QString uri = "", QString myAddr = ""); @@ -92,8 +93,9 @@ private: void setupBalancesTab(); void setuphushdTab(); void setupchatTab(); - void updateChat(); + void updateContacts(); + void updateChat(); void setupSettingsModal(); void setupStatusBar(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 3196dff..fb02214 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1390,31 +1390,6 @@ <html><head/><body><p align="center"><br/></p></body></html> - - - true - - - - 340 - 40 - 921 - 371 - - - - QAbstractItemView::NoEditTriggers - - - false - - - Qt::IgnoreAction - - - QAbstractItemView::NoSelection - - @@ -1563,6 +1538,40 @@ <html><head/><body><p align="center">Contact Name:</p></body></html> + + + + 340 + 40 + 921 + 371 + + + + Qt::ScrollBarAlwaysOff + + + Qt::ScrollBarAlwaysOff + + + QAbstractScrollArea::AdjustToContents + + + QAbstractItemView::NoEditTriggers + + + QListView::Adjust + + + 0 + + + false + + + true + + From 58bee815a54909be19a6bbb14ce7b1bd179240a2 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Sun, 3 May 2020 01:25:56 +0200 Subject: [PATCH 2/7] change color in chat --- src/chatmodel.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chatmodel.h b/src/chatmodel.h index a060530..b4caa95 100644 --- a/src/chatmodel.h +++ b/src/chatmodel.h @@ -61,9 +61,9 @@ inline void ListViewDelegate::paint(QPainter *painter, QStyleOptionViewItem cons painter->translate(option.rect.left() + d_horizontalmargin, option.rect.top() + ((index.row() == 0) ? d_verticalmargin : 0)); // background color for chat bubble - QColor bgcolor("fbffff"); + QColor bgcolor("#535353"); if (outgoing) - bgcolor = "#fffcfb"; + bgcolor = "#eeeeee"; // create chat bubble QPainterPath pointie; From 7b40755d42582e82a80bd2aa9c15bce2e0509758 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Sun, 3 May 2020 11:35:05 +0200 Subject: [PATCH 3/7] improve some UI elements --- src/chatmodel.cpp | 73 +++++++++++++------------- src/controller.cpp | 44 ++++++++++++---- src/mainwindow.cpp | 101 ++++------------------------------- src/mainwindow.ui | 128 +++++++++------------------------------------ 4 files changed, 105 insertions(+), 241 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 7ca3090..7b656f7 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -97,21 +97,39 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView &view) void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) { - // QStandardItemModel mymodel; - // QStandardItem* Items = new QStandardItem(myString); - QStandardItemModel* myModel = new QStandardItemModel(); - for(auto &c : this->chatItems) + + + QStandardItemModel* myModel = new QStandardItemModel(); + + + for (auto &c : this->chatItems) + for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) { + + + //////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid - /// if ( - (ui->ContactZaddr->text().trimmed() == c.second.getAddress()) && - (c.second.getMemo().startsWith("{") == false) && - (c.second.getMemo().isEmpty() == false) + (ui->contactNameMemo->text().trimmed() == c.second.getContact()) && + (c.second.getMemo().startsWith("{") == false) && + (c.second.getMemo().isEmpty() == false) && + (p.getPartnerAddress() == c.second.getAddress()) + ) - { + { + // for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) + + + // { + // if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid())) + + // { + + // } + + QStandardItem* Items = new QStandardItem(c.second.toChatLine()); Items->setData("Incoming", Qt::UserRole +1); myModel->appendRow(Items); @@ -120,14 +138,14 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) ui->listChat->setMinimumSize(200,350); ui->listChat->setItemDelegate(new ListViewDelegate()); ui->listChat->show(); - } - - + } + if ( - (ui->MyZaddr->text().trimmed() == c.second.getAddress()) && + (ui->contactNameMemo->text().trimmed() == c.second.getContact()) && (c.second.getMemo().startsWith("{") == false) && - (c.second.getMemo().isEmpty() == false) + (c.second.getMemo().isEmpty() == false) && + (p.getMyAddress() == c.second.getAddress()) ) { @@ -141,22 +159,9 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) ui->listChat->setMinimumSize(200,350); ui->listChat->setItemDelegate(new ListViewDelegate()); ui->listChat->show(); - } - - - /////////////////////////Render only when CID=CID? - - // for(auto &p : AddressBook::getInstance()->getAllAddressLabels()) - // { - // if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid())) - // { - - - //} - // - - + } + } @@ -223,7 +228,7 @@ Tx MainWindow::createTxFromChatPage() { for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) - if (ui->ContactZaddr->text().trimmed() == c.getPartnerAddress()) { + if (ui->contactNameMemo->text().trimmed() == c.getName()) { QString cid = c.getCid(); QString myAddr = c.getMyAddress(); @@ -233,6 +238,7 @@ Tx MainWindow::createTxFromChatPage() { QString hmemo= createHeaderMemo(type,cid,myAddr); QString memo = ui->memoTxtChat->toPlainText().trimmed(); + // ui->memoSizeChat->setLenDisplayLabel();// Todo -> activate lendisplay for chat tx.toAddrs.push_back(ToFields{addr, amt, hmemo}) ; @@ -261,7 +267,7 @@ void MainWindow::sendChatButton() { // Memos can only be used with zAddrs. So check that first // for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) - if (ui->ContactZaddr->text().trimmed().isEmpty() || ui->memoTxtChat->toPlainText().trimmed().isEmpty()) { + if (ui->contactNameMemo->text().trimmed().isEmpty() || ui->memoTxtChat->toPlainText().trimmed().isEmpty()) { // auto addr = ""; // if (! Settings::isZAddress(AddressBook::addressFromAddressLabel(addr->text()))) { @@ -397,7 +403,7 @@ Tx MainWindow::createTxForSafeContactRequest() { for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) - if (ui->ContactZaddr->text().trimmed() == c.getName()) { + if (ui->contactNameMemo->text().trimmed() == c.getName()) { // QString cid = c.getCid(); // This has to be a new cid for the contact // QString myAddr = c.getMyAddress(); // this should be a new HushChat zaddr @@ -426,9 +432,6 @@ Tx MainWindow::createTxForSafeContactRequest() { //////////////////De-activated for now/////////////////// void MainWindow::safeContactRequest() { - - - ////////////////////////////Todo: Check if its a zaddr////////// // Create a Tx from the values on the send tab. Note that this Tx object diff --git a/src/controller.cpp b/src/controller.cpp index 50db859..7db0ff0 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -881,24 +881,34 @@ void Controller::refreshTransactions() { memo = QString::fromStdString(o["memo"]); QString cid; + QString contact; + for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) - if ((ui->ContactZaddr->text().trimmed() == c.getPartnerAddress()) || (ui->MyZaddr->text().trimmed() == c.getMyAddress())) { + { + if (ui->contactNameMemo->text().trimmed() == c.getName()) { cid = c.getCid(); - }else {cid = "";} + }else {cid = "";} + + if (address == c.getPartnerAddress()){ + contact = c.getName(); + }else{ contact = "";} + ChatItem item = ChatItem( datetime, address, - QString(""), + contact, memo, cid, // we have to set the cid here, its included in our Addressbook for this contact txid, true // is an outgoing message ); chatModel->addMessage(item); - } - + + } + + } items.push_back(TransactionItemDetail{address, amount, memo}); total_amount = total_amount + amount; @@ -912,7 +922,6 @@ void Controller::refreshTransactions() { }else{ - addresses.push_back(item.address); } } @@ -957,19 +966,34 @@ void Controller::refreshTransactions() { else cid = ""; } - + + QString contact; + for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) + // for (auto &p : this->chatItems) + { + + if (address == c.getMyAddress()){ + contact = c.getName(); + qDebug()<< "Addressbuch Addresse: " << c.getMyAddress(); + qDebug()<< "Addresse: " << address; + + }else{ contact = "ELSE";} + ChatItem item = ChatItem( datetime, address, - QString(""), + contact, memo, cid, // we have to set the cid here, its included in the headermemo txid, false ); - // qDebug()<< "Message CID: " << cid; - chatModel->addMessage(item); + // qDebug()<< "KontaktName: " << contact; + + // qDebug()<< "Addressbuch Addresse: " << c.getMyAddress(); + chatModel->addMessage(item); +} } } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 254798f..0d1e984 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -39,8 +39,12 @@ MainWindow::MainWindow(QWidget *parent) : ui->setupUi(this); - ui->checkBox->setChecked(true); + // ui->checkBox->setChecked(true); logger = new Logger(this, QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)).filePath("silentdragonlite-wallet.log")); + ui->memoTxtChat->setAutoFillBackground(false); + // ui->memoTxtChat->setStyleSheet(QString::fromUtf8("background-color: rgb(224, 224, 224);")); + ui->memoTxtChat->setPlaceholderText("Send Message"); + ui->memoTxtChat->setTextColor(Qt::white); // Status Bar setupStatusBar(); @@ -994,109 +998,22 @@ void MainWindow::setupchatTab() { QObject::connect(ui->listContactWidget, &QTableView::clicked, [=] () { - QStandardItemModel mymodel; - - // for(auto &c : this->chatItems) - //{ - //////Render only Memos for selected contacts. Do not render empty Memos //// Render only memos where cid=cid - - /// - // if ( - // (ui->ContactZaddr->text().trimmed() == c.second.getAddress()) && - // (c.second.getMemo().startsWith("{") == false) && - // (c.second.getMemo().isEmpty() == false) - // ) - // { - // if (c.second.getMemo.find()) - - //view->addItem(line); - - // QStandardItem *item1 = new QStandardItem(c.second.toChatLine()); - // item1->setData("Incoming", Qt::UserRole + 1); - // model.appendRow(item1); - - QStandardItem *item1 = new QStandardItem("Kacke Hier"); - item1->setData("Incoming", Qt::UserRole +1); - mymodel.appendRow(item1); - qDebug()<text(); - - - QStandardItem *item2 = new QStandardItem("This is item one"); - item2->setData("Outgoing", Qt::UserRole +1); - mymodel.appendRow(item2); - qDebug()<text(); - - QStandardItem *item3 = new QStandardItem("This is item one"); - item3->setData("Outgoing", Qt::UserRole +1); - mymodel.appendRow(item3); - qDebug()<text(); - - // QStandardItem *item2 = new QStandardItem("Hallo"); - // item1->setData("Outgoing", Qt::UserRole + 1); - // mymodel.appendRow(item2); - // qDebug()<text(); - - ////////////////////////////////// Todo : Render green checkmark for contacts if cid = cid - We have to search for cid in txid/cid list - // QString cid = c.second.getCid(); - - // } - - // if ( - // (ui->MyZaddr->text().trimmed() == c.second.getAddress()) && - // (c.second.getMemo().startsWith("{") == false) && - // (c.second.getMemo().isEmpty() == false) - // ) - // { - - - // for(auto &p : AddressBook::getInstance()->getAllAddressLabels()) - // { - - // if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid())) - // { - - - //} - // else - // { - // line+= QString("[") + "Warning. Not verified!" + QString("]"); - // QStandardItem *item = new QStandardItem(c.second.toChatLine()); - //view->addItem(line); - // model.appendRow(item); - // } - -// } - - //} - - // } - - - - - ui->listChat->setModel(&mymodel); - ui->listChat->setItemDelegate(new ListViewDelegate()); - ui->listChat->show(); - //ui->listChat->update(); - 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->ContactZaddr->setText(p.getPartnerAddress()); - ui->MyZaddr->setText(p.getMyAddress()); + // ui->ContactZaddr->setText(p.getPartnerAddress()); + // ui->MyZaddr->setText(p.getMyAddress()); ui->contactNameMemo->setText(p.getName()); - ui->contactCid->setText(p.getCid()); + ui->memoTxtChat->clear(); rpc->refresh(true); - updateChat(); + // updateChat(); } }); - - } ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) { diff --git a/src/mainwindow.ui b/src/mainwindow.ui index fb02214..0c6d66b 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1351,21 +1351,24 @@ <html><head/><body><p align="center">Hushchat Contactlist</p></body></html> - + 340 - 410 + 460 921 - 128 + 131 + + font: 11pt "Noto Color Emoji"; + - 1200 - 540 + 1190 + 610 47 17 @@ -1393,8 +1396,8 @@ - 1130 - 590 + 710 + 610 114 25 @@ -1412,45 +1415,6 @@ false - - - - 350 - 550 - 81 - 17 - - - - Send To : - - - - - - 350 - 580 - 81 - 17 - - - - <html><head/><body><p>My zaddr :</p></body></html> - - - - - - 420 - 550 - 691 - 20 - - - - - - @@ -1473,58 +1437,6 @@ false - - - - 420 - 580 - 691 - 20 - - - - - - - - - - 720 - 20 - 331 - 20 - - - - <html><head/><body><p align="center"><br/></p></body></html> - - - - - - 590 - 20 - 131 - 20 - - - - <html><head/><body><p align="center">Conversation ID:</p></body></html> - - - - - - 980 - 0 - 271 - 23 - - - - Render only authenticated messages - - @@ -1544,7 +1456,7 @@ 340 40 921 - 371 + 421 @@ -1572,6 +1484,19 @@ true + + + + 340 + 430 + 911 + 31 + + + + Qt::Horizontal + + @@ -1743,11 +1668,6 @@ - - MemoEdit - QPlainTextEdit -
memoedit.h
-
AddressCombo QComboBox From dc4c386f3845142daf50efefdbe1aa43a2eb3aa3 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Sun, 3 May 2020 12:10:51 +0200 Subject: [PATCH 4/7] change datetime format in chatmodel --- src/chatmodel.cpp | 35 ++++++++++++++++++----------------- src/chatmodel.h | 5 +++-- src/mainwindow.ui | 13 ------------- 3 files changed, 21 insertions(+), 32 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 7b656f7..c139c03 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -117,27 +117,22 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) (p.getPartnerAddress() == c.second.getAddress()) ) - { - - // for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) - - - // { - // if ((ui->checkBox->isChecked() == true) && (p.getCid() != c.second.getCid())) - - // { - - // } - + { QStandardItem* Items = new QStandardItem(c.second.toChatLine()); Items->setData("Incoming", Qt::UserRole +1); myModel->appendRow(Items); - qDebug()<text(); - ui->listChat->setModel(myModel); - ui->listChat->setMinimumSize(200,350); - ui->listChat->setItemDelegate(new ListViewDelegate()); - ui->listChat->show(); + + + ui->listChat->setResizeMode(QListView::Adjust); + ui->listChat->setWordWrap(true); + ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); + ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui->listChat->setModel(myModel); + ui->listChat->setMinimumSize(200,350); + ui->listChat->setItemDelegate(new ListViewDelegate()); + ui->listChat->show(); } @@ -155,6 +150,12 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) myModel->appendRow(Items1); qDebug()<text(); } + + ui->listChat->setResizeMode(QListView::Adjust); + ui->listChat->setWordWrap(true); + ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); + ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui->listChat->setModel(myModel); ui->listChat->setMinimumSize(200,350); ui->listChat->setItemDelegate(new ListViewDelegate()); diff --git a/src/chatmodel.h b/src/chatmodel.h index b4caa95..490f336 100644 --- a/src/chatmodel.h +++ b/src/chatmodel.h @@ -13,6 +13,7 @@ #include "settings.h" #include "camount.h" + class ListViewDelegate : public QAbstractItemDelegate { int d_radius; @@ -267,8 +268,8 @@ class ChatItem { QDateTime myDateTime; myDateTime.setTime_t(_timestamp); - QString line = QString("[") + myDateTime.toString("dd.MM.yyyy hh:mm:ss ") + QString("] "); - line += QString(_memo) + QString("\n"); + QString line = QString("[") + myDateTime.toString("d.M.yy hh:mm") + QString("] ") ; + line += QString("") + QString(_memo) + QString("\n\n"); return line; } diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 0c6d66b..56b180b 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1484,19 +1484,6 @@ true - - - - 340 - 430 - 911 - 31 - - - - Qt::Horizontal - - From 765bedde8076fde7870c37286b18968137dc20c6 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Sun, 3 May 2020 12:36:18 +0200 Subject: [PATCH 5/7] add watermark to chatlist --- src/chatmodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index c139c03..679b0c5 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -132,6 +132,7 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) ui->listChat->setModel(myModel); ui->listChat->setMinimumSize(200,350); ui->listChat->setItemDelegate(new ListViewDelegate()); + // ui->listChat->setStyleSheet("background-image: url(res/hushdark.png)"); /////Todo set an png as Watermark backgroung in listChat ui->listChat->show(); } From c8b274ecfe195a1c7d6da448e76224753de63d57 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Sun, 3 May 2020 13:28:41 +0200 Subject: [PATCH 6/7] switch to listview for contacts --- src/chatmodel.cpp | 10 +++++----- src/contactmodel.cpp | 25 +++++++++++++++++++------ src/contactmodel.h | 2 +- src/controller.cpp | 2 +- src/controller.h | 2 +- src/mainwindow.ui | 2 +- 6 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 679b0c5..aad9a8d 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -99,7 +99,7 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) { - QStandardItemModel* myModel = new QStandardItemModel(); + QStandardItemModel* chat = new QStandardItemModel(); for (auto &c : this->chatItems) @@ -121,7 +121,7 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) QStandardItem* Items = new QStandardItem(c.second.toChatLine()); Items->setData("Incoming", Qt::UserRole +1); - myModel->appendRow(Items); + chat->appendRow(Items); ui->listChat->setResizeMode(QListView::Adjust); @@ -129,7 +129,7 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui->listChat->setModel(myModel); + ui->listChat->setModel(chat); ui->listChat->setMinimumSize(200,350); ui->listChat->setItemDelegate(new ListViewDelegate()); // ui->listChat->setStyleSheet("background-image: url(res/hushdark.png)"); /////Todo set an png as Watermark backgroung in listChat @@ -148,7 +148,7 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) QStandardItem* Items1 = new QStandardItem(c.second.toChatLine()); Items1->setData("Outgoing", Qt::UserRole +1); - myModel->appendRow(Items1); + chat->appendRow(Items1); qDebug()<text(); } @@ -157,7 +157,7 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui->listChat->setModel(myModel); + ui->listChat->setModel(chat); ui->listChat->setMinimumSize(200,350); ui->listChat->setItemDelegate(new ListViewDelegate()); ui->listChat->show(); diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp index 0e9a6ea..e4d32e1 100644 --- a/src/contactmodel.cpp +++ b/src/contactmodel.cpp @@ -2,15 +2,28 @@ #include "addressbook.h" #include "mainwindow.h" -void ContactModel::renderContactList(QListWidget* view) +void ContactModel::renderContactList(QListView* view) { - while(view->count() > 0) - { - view->takeItem(0); - } + QStandardItemModel* contact = new QStandardItemModel(); + //} for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) { - view->addItem(c.getName()); + // view->addItem(c.getName()); + + + QStandardItem* Items = new QStandardItem(c.getName()); + contact->appendRow(Items); + // view->setItemDelegate({text: contact}) + // width: view->width }) + // height: avatar.implicitHeight, + // leftPadding: avatar.implicitWidth + 32}) + + // Image { + // id: avatar + // source: "qrc:/" + modelData.replace(" ", "_") + ".png" + // } + //} + view->setModel(contact); } diff --git a/src/contactmodel.h b/src/contactmodel.h index 886b285..b97cc8a 100644 --- a/src/contactmodel.h +++ b/src/contactmodel.h @@ -74,7 +74,7 @@ class ContactModel { public: ContactModel() {} - void renderContactList(QListWidget* view); + void renderContactList(QListView* view); }; #endif \ No newline at end of file diff --git a/src/controller.cpp b/src/controller.cpp index 7db0ff0..577d438 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -1029,7 +1029,7 @@ void Controller::refreshChat(QListView *listWidget) } -void Controller::refreshContacts(QListWidget *listWidget) +void Controller::refreshContacts(QListView *listWidget) { contactModel->renderContactList(listWidget); } diff --git a/src/controller.h b/src/controller.h index 59cfa40..bc56587 100644 --- a/src/controller.h +++ b/src/controller.h @@ -73,7 +73,7 @@ public: void refreshAUDCAP(); void refreshChat(QListView *listWidget); - void refreshContacts(QListWidget *listWidget); + void refreshContacts(QListView *listWidget); void executeStandardUITransaction(Tx tx); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 56b180b..e58e4ad 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1328,7 +1328,7 @@ HushChat - + 0 From 0e2c8503fef816cbf6afd0264bd6d0e429b4ec57 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Sun, 3 May 2020 17:22:16 +0200 Subject: [PATCH 7/7] add new background images to chatlist --- application.qrc | 3 +++ src/chatmodel.cpp | 21 +++------------------ src/contactmodel.cpp | 24 +++++++++--------------- src/mainwindow.cpp | 15 ++++++++++++++- 4 files changed, 29 insertions(+), 34 deletions(-) diff --git a/application.qrc b/application.qrc index 0507184..e4cd3d2 100644 --- a/application.qrc +++ b/application.qrc @@ -8,6 +8,9 @@ res/paymentreq.gif res/icon.ico res/mail.png + res/darkwing.png + res/sdlogo.png + res/sdlogo2.png res/hushdlogo.gif diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index aad9a8d..68b496a 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -123,17 +123,9 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) Items->setData("Incoming", Qt::UserRole +1); chat->appendRow(Items); - - ui->listChat->setResizeMode(QListView::Adjust); - ui->listChat->setWordWrap(true); - ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); - ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui->listChat->setModel(chat); - ui->listChat->setMinimumSize(200,350); + ui->listChat->setModel(chat); ui->listChat->setItemDelegate(new ListViewDelegate()); - // ui->listChat->setStyleSheet("background-image: url(res/hushdark.png)"); /////Todo set an png as Watermark backgroung in listChat - ui->listChat->show(); + } @@ -149,18 +141,11 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) QStandardItem* Items1 = new QStandardItem(c.second.toChatLine()); Items1->setData("Outgoing", Qt::UserRole +1); chat->appendRow(Items1); - qDebug()<text(); } - ui->listChat->setResizeMode(QListView::Adjust); - ui->listChat->setWordWrap(true); - ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); - ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); ui->listChat->setModel(chat); - ui->listChat->setMinimumSize(200,350); ui->listChat->setItemDelegate(new ListViewDelegate()); - ui->listChat->show(); + } diff --git a/src/contactmodel.cpp b/src/contactmodel.cpp index e4d32e1..a19fe1c 100644 --- a/src/contactmodel.cpp +++ b/src/contactmodel.cpp @@ -3,27 +3,21 @@ #include "mainwindow.h" void ContactModel::renderContactList(QListView* view) -{ +{ // QStandardItem(const QIcon & icon, const QString & text) QStandardItemModel* contact = new QStandardItemModel(); //} for(auto &c : AddressBook::getInstance()->getAllAddressLabels()) { - // view->addItem(c.getName()); - - QStandardItem* Items = new QStandardItem(c.getName()); - contact->appendRow(Items); - // view->setItemDelegate({text: contact}) - // width: view->width }) - // height: avatar.implicitHeight, - // leftPadding: avatar.implicitWidth + 32}) - - // Image { - // id: avatar - // source: "qrc:/" + modelData.replace(" ", "_") + ".png" - // } - //} + //QStandardItem* Items = new QStandardItem(); + QStandardItem* Items1 = new QStandardItem(QIcon("res/darkwing.png"),c.getName()); + // contact->appendRow(Items); + contact->appendRow(Items1); view->setModel(contact); + view->setIconSize(QSize(80,100)); + view->setUniformItemSizes(true); + view->setDragDropMode(QAbstractItemView::DropOnly);; + } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 0d1e984..0104f56 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -905,6 +905,17 @@ void MainWindow::setupTransactionsTab() { }); // Set up context menu on transactions tab + auto theme = Settings::getInstance()->get_theme_name(); + if (theme == "dark"){ + ui->listChat->setStyleSheet("background-image: url(res/sdlogo.png) ;background-attachment: fixed ;background-position: center center ;background-repeat: no-repeat;background-size: cover"); + }else{ui->listChat->setStyleSheet("background-image: url(res/sdlogo2.png) ;background-attachment: fixed ;background-position: center center ;background-repeat: no-repeat;background-size: cover");} + ui->listChat->setResizeMode(QListView::Adjust); + ui->listChat->setWordWrap(true); + ui->listChat->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); + ui->listChat->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui->listChat->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + ui->listChat->setMinimumSize(200,350); + ui->listChat->show(); ui->transactionsTable->setContextMenuPolicy(Qt::CustomContextMenu); // Table right click QObject::connect(ui->transactionsTable, &QTableView::customContextMenuRequested, [=] (QPoint pos) { @@ -1014,6 +1025,8 @@ void MainWindow::setupchatTab() { } }); + + } ChatMemoEdit::ChatMemoEdit(QWidget* parent) : QPlainTextEdit(parent) { @@ -1066,7 +1079,7 @@ void MainWindow::updateChat() void MainWindow::updateContacts() { - rpc->refreshContacts(ui->listContactWidget); + //rpc->refreshContacts(ui->listContactWidget); } void MainWindow::addNewZaddr(bool sapling) {