From b7f1a1df09206cba5f5377846183826abf81f6d0 Mon Sep 17 00:00:00 2001
From: DenioD <41270280+DenioD@users.noreply.github.com>
Date: Tue, 22 Sep 2020 17:36:52 +0200
Subject: [PATCH] show number of new contact request
---
src/mainwindow.cpp | 33 +++-
src/mainwindow.ui | 421 +++++++++++++++++++++++----------------------
2 files changed, 244 insertions(+), 210 deletions(-)
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index b15b60c..a9f28fc 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1672,13 +1672,21 @@ if (-1 != pos)
QObject::connect(ui->listContactWidget, &QTableView::clicked, [=] () {
- ui->listContactWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
- ui->listContactWidget->addAction(HushAction);
- ui->listContactWidget->addAction(editAction);
+ ui->listContactWidget->setContextMenuPolicy(Qt::ActionsContextMenu);
+ ui->listContactWidget->addAction(HushAction);
+ ui->listContactWidget->addAction(editAction);
+ int requestsize = DataStore::getChatDataStore()->getAllNewContactRequests().size();
- ui->memoTxtChat->setEnabled(false);
- ui->emojiButton->setEnabled(false);
- ui->sendChatButton->setEnabled(false);
+ if (requestsize > 0)
+ {
+ ui->newRequest->setStyleSheet("color: red;");
+ }else{}
+
+ ui->newRequest->setNum(requestsize);
+
+ ui->memoTxtChat->setEnabled(false);
+ ui->emojiButton->setEnabled(false);
+ ui->sendChatButton->setEnabled(false);
QModelIndex index = ui->listContactWidget->currentIndex();
QString label_contact = index.data(Qt::DisplayRole).toString();
@@ -1778,6 +1786,19 @@ if (-1 != pos)
ui->memoTxtChat->setLenDisplayLabelChat(ui->memoSizeChat);
+ui->newRequest->setStyleSheet("color: red;");
+
+
+////get amount of new contact request as intervall
+
+QTimer* timer = new QTimer();
+timer->setInterval(30000);
+
+connect(timer, &QTimer::timeout, this, [=](){
+ int requestsize = DataStore::getChatDataStore()->getAllNewContactRequests().size();
+ ui->newRequest->setNum(requestsize);
+});
+timer->start();
}
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index f14a9fe..17386a2 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -66,210 +66,6 @@
HushChat
- -
-
-
-
-
-
- QLayout::SetDefaultConstraint
-
-
- 0
-
-
- 0
-
-
- 15
-
-
-
-
-
-
- 51
- 51
-
-
-
-
- 51
- 51
-
-
-
-
- 100
- 0
-
-
-
- Incoming contact request
-
-
- false
-
-
-
-
-
-
- :/icons/res/requestBlack.png:/icons/res/requestBlack.png
-
-
-
- 50
- 45
-
-
-
- true
-
-
-
- -
-
-
-
- 51
- 51
-
-
-
-
- 51
- 51
-
-
-
-
- 100
- 0
-
-
-
- Add a new contact
-
-
-
-
-
-
- :/icons/res/addContactBlack.png
-
-
-
-
- 50
- 45
-
-
-
- true
-
-
-
- -
-
-
-
- 51
- 51
-
-
-
-
- 51
- 51
-
-
-
- Get a new Address
-
-
-
-
-
-
- :/icons/res/getAddrBlack.png:/icons/res/getAddrBlack.png
-
-
-
- 50
- 45
-
-
-
- true
-
-
-
- -
-
-
- Qt::Horizontal
-
-
- QSizePolicy::Preferred
-
-
-
- 100
- 20
-
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 300
- 0
-
-
-
- <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Contactlist</span></p></body></html>
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
- true
-
-
- QAbstractItemView::NoEditTriggers
-
-
- false
-
-
- false
-
-
- QAbstractItemView::SingleSelection
-
-
- QAbstractItemView::SelectItems
-
-
-
-
-
-
@@ -547,6 +343,223 @@
+ -
+
+
-
+
+
+ QLayout::SetDefaultConstraint
+
+
+ 0
+
+
+ 0
+
+
+ 15
+
+
-
+
+
+
+ 51
+ 51
+
+
+
+
+ 51
+ 51
+
+
+
+
+ 100
+ 0
+
+
+
+ Incoming contact request
+
+
+ false
+
+
+
+
+
+
+ :/icons/res/requestBlack.png:/icons/res/requestBlack.png
+
+
+
+ 50
+ 45
+
+
+
+ true
+
+
+
+ -
+
+
+
+ 20
+ 20
+
+
+
+
+
+
+
+ -
+
+
+
+ 51
+ 51
+
+
+
+
+ 51
+ 51
+
+
+
+
+ 100
+ 0
+
+
+
+ Add a new contact
+
+
+
+
+
+
+ :/icons/res/addContactBlack.png
+
+
+
+
+ 50
+ 45
+
+
+
+ true
+
+
+
+ -
+
+
+
+ 51
+ 51
+
+
+
+
+ 51
+ 51
+
+
+
+ Get a new Address
+
+
+
+
+
+
+ :/icons/res/getAddrBlack.png:/icons/res/getAddrBlack.png
+
+
+
+ 50
+ 45
+
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Preferred
+
+
+
+ 100
+ 20
+
+
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 300
+ 0
+
+
+
+ <html><head/><body><p align="center"><span style=" font-weight:600; text-decoration: underline;">Contactlist</span></p></body></html>
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ true
+
+
+ QAbstractItemView::NoEditTriggers
+
+
+ false
+
+
+ false
+
+
+ QAbstractItemView::SingleSelection
+
+
+ QAbstractItemView::SelectItems
+
+
+
+
+