From 494198995d1d84eb7befcdd92e4f8b6e6492ae76 Mon Sep 17 00:00:00 2001 From: DenioD <41270280+DenioD@users.noreply.github.com> Date: Wed, 6 May 2020 20:49:48 +0200 Subject: [PATCH] add notification and different themes to buttons --- src/chatmodel.cpp | 32 +++++++++++++++-------- src/mainwindow.cpp | 29 +++++++++++++++++++++ src/mainwindow.ui | 64 +++++++++++++++++++++++++++++++++++----------- 3 files changed, 100 insertions(+), 25 deletions(-) diff --git a/src/chatmodel.cpp b/src/chatmodel.cpp index b9133b8..d800f95 100644 --- a/src/chatmodel.cpp +++ b/src/chatmodel.cpp @@ -105,8 +105,10 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view) }); QStandardItemModel* chat = new QStandardItemModel(); - - + ui->lcdNumber->setStyleSheet("background-color: red"); + ui->lcdNumber->setPalette(Qt::red); + ui->lcdNumber->display("1"); + for (auto &c : this->chatItems) for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) { @@ -157,23 +159,32 @@ void ChatModel::renderContactRequest(){ QStandardItemModel* contactRequest = new QStandardItemModel(); - for (auto &c : this->chatItems) { + for (auto &c : this->chatItems) + for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) { + 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(); + requestContact.requestContact->show(); - + } + + } + + } - } - // } - + + + // } QObject::connect(requestContact.requestContact, &QTableView::clicked, [&] () { @@ -187,10 +198,11 @@ void ChatModel::renderContactRequest(){ if(c.second.getMemo().startsWith("{")){ }else{ - QStandardItem* Items = new QStandardItem(c.second.getMemo()); + 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()); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 8385b7a..884a6a7 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1018,6 +1018,35 @@ void MainWindow::setupchatTab() { // qDebug() <request->isChecked()->text(); // }else{ + /////////////Setting Icons for Chattab and different themes + + auto theme = Settings::getInstance()->get_theme_name(); + if (theme == "dark" || theme == "midnight") { + QPixmap send(":/icons/res/send-new-white.png"); + QIcon sendIcon(send); + ui->sendChatButton->setIcon(sendIcon); + + QPixmap notification(":/icons/res/notification.png"); + QIcon notificationIcon(notification); + ui->pushContact->setIcon(notificationIcon); + + QPixmap addContact(":/icons/res/add_contact.png"); + QIcon addContactIcon(addContact); + ui->safeContactRequest->setIcon(addContact); + + }else{ + QPixmap pixmap(":/icons/res/send-new.svg"); + QIcon sendIcon(pixmap); + ui->sendChatButton->setIcon(sendIcon); + + QPixmap notification(":/icons/res/notification.svg"); + QIcon notificationIcon(notification); + ui->pushContact->setIcon(notificationIcon); + + QPixmap addContact(":/icons/res/add_contact.svg"); + QIcon addContactIcon(addContact); + ui->safeContactRequest->setIcon(addContact); + } QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton); // } diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 045d7e0..85cefa3 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1417,8 +1417,8 @@ - 61 - 62 + 41 + 49 @@ -1479,7 +1479,7 @@ 340 - 640 + 650 261 23 @@ -1491,10 +1491,10 @@ - 90 - 0 - 71 - 61 + 270 + 580 + 51 + 51 @@ -1507,8 +1507,9 @@ - - :/icons/res/add_contact.png:/icons/res/add_contact.png + + :/icons/res/add_contact.png + @@ -1523,10 +1524,10 @@ - 170 - 0 - 71 - 61 + 10 + 30 + 41 + 41 @@ -1547,14 +1548,47 @@ - 43 - 49 + 33 + 35 true + + + + 30 + 20 + 31 + 21 + + + + QFrame::NoFrame + + + 1 + + + QLCDNumber::Flat + + + 0.000000000000000 + + + lcdNumber + listContactWidget + label_39 + memoTxtChat + contactNameMemo + sendChatButton + contactNameMemo_3 + listChat + request + safeContactRequest + pushContact