From 5006a8c7d7069ccdbd3824ff65d2266606525742 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Fri, 8 May 2020 21:25:43 +0200 Subject: [PATCH] add incoming contact Request windows --- src/chatmodel.cpp | 17 +++++------------ src/chatmodel.h | 2 +- src/mainwindow.cpp | 1 + src/mainwindow.h | 1 + 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index 078a56f..6f80f37 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -100,10 +100,7 @@ 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(); // ui->lcdNumber->setStyleSheet("background-color: red"); @@ -149,17 +146,17 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) } -void ChatModel::renderContactRequest(){ +void MainWindow::renderContactRequest(){ Ui_requestDialog requestContact; - QDialog dialog(main); + QDialog dialog(this); requestContact.setupUi(&dialog); Settings::saveRestore(&dialog); { QStandardItemModel* contactRequest = new QStandardItemModel(); - + for (auto &c : DataStore::getChatDataStore()->getAllRawChatItems())//this->chatItems) { @@ -214,8 +211,6 @@ void ChatModel::renderContactRequest(){ } }); - - QObject::connect(requestContact.pushButton, &QPushButton::clicked, [&] () { QString cid = requestContact.requestCID->text(); @@ -228,7 +223,7 @@ void ChatModel::renderContactRequest(){ qDebug()<<"Beginn kopiert" <addAddressLabel(newLabel, addr, myAddr, cid, avatar); - QMessageBox::information(main, "Added Contact","successfully added your new contact. You can now Chat with this contact"); + QMessageBox::information(this, "Added Contact","successfully added your new contact. You can now Chat with this contact"); @@ -238,8 +233,6 @@ void ChatModel::renderContactRequest(){ dialog.exec(); } - - void ChatModel::addCid(QString tx, QString cid) { this->cidMap[tx] = cid; diff --git a/src/chatmodel.h b/src/chatmodel.h index 984ce56..493e744 100644 --- a/src/chatmodel.h +++ b/src/chatmodel.h @@ -329,7 +329,7 @@ class ChatModel void setItems(std::vector items); void renderChatBox(Ui::MainWindow* ui, QListView &view); void renderChatBox(Ui::MainWindow* ui, QListView *view); - void renderContactRequest(); + // void renderContactRequest(); void triggerRequest(); void showMessages(); void clear(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 694178f..2957dbb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1057,6 +1057,7 @@ void MainWindow::setupchatTab() { 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); + QObject::connect(ui->pushContact, &QPushButton::clicked, this , &MainWindow::renderContactRequest); ///////// Set selected Zaddr for Chat with Klick diff --git a/src/mainwindow.h b/src/mainwindow.h index 9e91245..ff4b76a 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -62,6 +62,7 @@ public: void updateLabels(); void updateTAddrCombo(bool checked); + // void renderContactRequest(); // void setChatItem(ChatItem* item); //void ChatItem* getChatItem();