From 747580151ac4999280391232d466b4d73a384692 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Thu, 21 May 2020 21:32:45 +0200 Subject: [PATCH] change some gui elements --- src/Chat/Chat.cpp | 10 ++--- src/Chat/Helper/ChatDelegator.h | 2 +- src/DataStore/ChatDataStore.cpp | 1 + src/chatmodel.cpp | 4 +- src/controller.cpp | 2 +- src/mainwindow.cpp | 4 +- src/mainwindow.ui | 76 +++++++++++++++++++++++++++------ 7 files changed, 74 insertions(+), 25 deletions(-) diff --git a/src/Chat/Chat.cpp b/src/Chat/Chat.cpp index d6c8445..30a827d 100644 --- a/src/Chat/Chat.cpp +++ b/src/Chat/Chat.cpp @@ -50,9 +50,6 @@ 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()) { @@ -63,7 +60,7 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label) 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()); @@ -81,8 +78,9 @@ void Chat::renderChatBox(Ui::MainWindow *ui, QListView *view, QLabel *label) 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/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/chatmodel.cpp b/src/chatmodel.cpp index 349f8be..28f7dfe 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -125,7 +125,7 @@ void MainWindow::renderContactRequest(){ requestContact.requestMemo->setModel(contactMemo); requestContact.requestMemo->show(); - + requestContact.requestCID->setText(c.second.getCid()); requestContact.requestZaddr->setText(c.second.getRequestZaddr()); requestContact.requestMyAddr->setText(c.second.getAddress()); }else{} @@ -617,7 +617,7 @@ Tx MainWindow::createTxForSafeContactRequest() QString hmemo= createHeaderMemo(type,cid,myAddr); QString memo = contactRequest.getMemo(); - // ui->memoSizeChat->setLenDisplayLabel();// Todo -> activate lendisplay for chat + tx.toAddrs.push_back(ToFields{addr, amt, hmemo}); tx.toAddrs.push_back(ToFields{addr, amt, memo}); diff --git a/src/controller.cpp b/src/controller.cpp index 8c3b603..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,ui->memoSize); + chat->renderChatBox(ui, ui->listChat,ui->memoSizeChat); // refreshContacts( // ui->listContactWidget diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4f0f08f..0e231f4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1080,14 +1080,14 @@ void MainWindow::setupchatTab() { }); -ui->memoTxtChat->setLenDisplayLabel(ui->memoSize);// Todo -> activate lendisplay for chat +ui->memoTxtChat->setLenDisplayLabel(ui->memoSizeChat); } void MainWindow::updateChat() { - rpc->refreshChat(ui->listChat,ui->memoSize); + rpc->refreshChat(ui->listChat,ui->memoSizeChat); rpc->refresh(true); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 399e3e9..2d85bd5 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -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 @@ - 0 + 80 20 - 61 + 51 51 + + + 51 + 51 + + + + + 51 + 51 + + 100 @@ -1607,12 +1631,24 @@ - 70 + 150 20 - 61 + 51 51 + + + 51 + 51 + + + + + 51 + 51 + + Get a new Address @@ -1633,15 +1669,18 @@ true - + - 1160 - 540 + 1140 + 640 91 17 + + QFrame::Sunken + 0 / 512 @@ -1649,6 +1688,17 @@ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + listContactWidget + label_39 + contactNameMemo + contactNameMemo_3 + safeContactRequest + pushContact + givemeZaddr + memoSizeChat + listChat + memoTxtChat + sendChatButton @@ -1838,7 +1888,7 @@ ChatMemoEdit QTextEdit -
mainwindow.h
+
mainwindow.h