Browse Source

add notification and different themes to buttons

pull/130/head
DenioD 4 years ago
parent
commit
494198995d
  1. 32
      src/chatmodel.cpp
  2. 29
      src/mainwindow.cpp
  3. 64
      src/mainwindow.ui

32
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());

29
src/mainwindow.cpp

@ -1018,6 +1018,35 @@ void MainWindow::setupchatTab() {
// qDebug() <<ui->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);
// }

64
src/mainwindow.ui

@ -1417,8 +1417,8 @@
</property>
<property name="iconSize">
<size>
<width>61</width>
<height>62</height>
<width>41</width>
<height>49</height>
</size>
</property>
<property name="default">
@ -1479,7 +1479,7 @@
<property name="geometry">
<rect>
<x>340</x>
<y>640</y>
<y>650</y>
<width>261</width>
<height>23</height>
</rect>
@ -1491,10 +1491,10 @@
<widget class="QPushButton" name="safeContactRequest">
<property name="geometry">
<rect>
<x>90</x>
<y>0</y>
<width>71</width>
<height>61</height>
<x>270</x>
<y>580</y>
<width>51</width>
<height>51</height>
</rect>
</property>
<property name="baseSize">
@ -1507,8 +1507,9 @@
<string/>
</property>
<property name="icon">
<iconset resource="../application.qrc">
<normaloff>:/icons/res/add_contact.png</normaloff>:/icons/res/add_contact.png</iconset>
<iconset theme="Dark">
<normalon>:/icons/res/add_contact.png</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
@ -1523,10 +1524,10 @@
<widget class="QPushButton" name="pushContact">
<property name="geometry">
<rect>
<x>170</x>
<y>0</y>
<width>71</width>
<height>61</height>
<x>10</x>
<y>30</y>
<width>41</width>
<height>41</height>
</rect>
</property>
<property name="baseSize">
@ -1547,14 +1548,47 @@
</property>
<property name="iconSize">
<size>
<width>43</width>
<height>49</height>
<width>33</width>
<height>35</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</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>
</item>

Loading…
Cancel
Save