add notification and different themes to buttons

This commit is contained in:
DenioD
2020-05-06 20:49:48 +02:00
parent 6991743b5f
commit 494198995d
3 changed files with 100 additions and 25 deletions

View File

@@ -105,8 +105,10 @@ void ChatModel::renderChatBox(Ui::MainWindow* ui, QListView *view)
}); });
QStandardItemModel* chat = new QStandardItemModel(); 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 &c : this->chatItems)
for (auto &p : AddressBook::getInstance()->getAllAddressLabels()) for (auto &p : AddressBook::getInstance()->getAllAddressLabels())
{ {
@@ -157,23 +159,32 @@ void ChatModel::renderContactRequest(){
QStandardItemModel* contactRequest = new QStandardItemModel(); 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("{"))) { if ((c.second.getType() == "cont") && (c.second.isOutgoing() == false) && (c.second.getMemo().startsWith("{"))) {
QStandardItem* Items = new QStandardItem(c.second.getAddress()); QStandardItem* Items = new QStandardItem(c.second.getAddress());
contactRequest->appendRow(Items); contactRequest->appendRow(Items);
requestContact.requestContact->setModel(contactRequest); requestContact.requestContact->setModel(contactRequest);
// requestContact.requestContact->show(); requestContact.requestContact->show();
}
} }
} }
}
// }
// }
QObject::connect(requestContact.requestContact, &QTableView::clicked, [&] () { QObject::connect(requestContact.requestContact, &QTableView::clicked, [&] () {
@@ -187,10 +198,11 @@ void ChatModel::renderContactRequest(){
if(c.second.getMemo().startsWith("{")){ if(c.second.getMemo().startsWith("{")){
}else{ }else{
QStandardItem* Items = new QStandardItem(c.second.getMemo()); QStandardItem* Items = new QStandardItem(c.second.getMemo());
contactMemo->appendRow(Items); contactMemo->appendRow(Items);
requestContact.requestMemo->setModel(contactMemo); requestContact.requestMemo->setModel(contactMemo);
requestContact.requestMemo->show(); requestContact.requestMemo->show();
requestContact.requestZaddr->setText(c.second.getRequestZaddr()); requestContact.requestZaddr->setText(c.second.getRequestZaddr());
requestContact.requestCID->setText(c.second.getCid()); requestContact.requestCID->setText(c.second.getCid());

View File

@@ -1018,6 +1018,35 @@ void MainWindow::setupchatTab() {
// qDebug() <<ui->request->isChecked()->text(); // qDebug() <<ui->request->isChecked()->text();
// }else{ // }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); QObject::connect(ui->sendChatButton, &QPushButton::clicked, this, &MainWindow::sendChatButton);
// } // }

View File

@@ -1417,8 +1417,8 @@
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>61</width> <width>41</width>
<height>62</height> <height>49</height>
</size> </size>
</property> </property>
<property name="default"> <property name="default">
@@ -1479,7 +1479,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>340</x> <x>340</x>
<y>640</y> <y>650</y>
<width>261</width> <width>261</width>
<height>23</height> <height>23</height>
</rect> </rect>
@@ -1491,10 +1491,10 @@
<widget class="QPushButton" name="safeContactRequest"> <widget class="QPushButton" name="safeContactRequest">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>90</x> <x>270</x>
<y>0</y> <y>580</y>
<width>71</width> <width>51</width>
<height>61</height> <height>51</height>
</rect> </rect>
</property> </property>
<property name="baseSize"> <property name="baseSize">
@@ -1507,8 +1507,9 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../application.qrc"> <iconset theme="Dark">
<normaloff>:/icons/res/add_contact.png</normaloff>:/icons/res/add_contact.png</iconset> <normalon>:/icons/res/add_contact.png</normalon>
</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
@@ -1523,10 +1524,10 @@
<widget class="QPushButton" name="pushContact"> <widget class="QPushButton" name="pushContact">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>170</x> <x>10</x>
<y>0</y> <y>30</y>
<width>71</width> <width>41</width>
<height>61</height> <height>41</height>
</rect> </rect>
</property> </property>
<property name="baseSize"> <property name="baseSize">
@@ -1547,14 +1548,47 @@
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>43</width> <width>33</width>
<height>49</height> <height>35</height>
</size> </size>
</property> </property>
<property name="flat"> <property name="flat">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QLCDNumber" name="lcdNumber">
<property name="geometry">
<rect>
<x>30</x>
<y>20</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="digitCount">
<number>1</number>
</property>
<property name="segmentStyle">
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
<zorder>lcdNumber</zorder>
<zorder>listContactWidget</zorder>
<zorder>label_39</zorder>
<zorder>memoTxtChat</zorder>
<zorder>contactNameMemo</zorder>
<zorder>sendChatButton</zorder>
<zorder>contactNameMemo_3</zorder>
<zorder>listChat</zorder>
<zorder>request</zorder>
<zorder>safeContactRequest</zorder>
<zorder>pushContact</zorder>
</widget> </widget>
</widget> </widget>
</item> </item>