Browse Source

show number of new contact request

pull/201/head
DenioD 4 years ago
parent
commit
b7f1a1df09
  1. 33
      src/mainwindow.cpp
  2. 421
      src/mainwindow.ui

33
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();
}

421
src/mainwindow.ui

@ -66,210 +66,6 @@
<string>HushChat</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>15</number>
</property>
<item>
<widget class="QPushButton" name="pushContact">
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="baseSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Incoming contact request</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../application.qrc">
<normaloff>:/icons/res/requestBlack.png</normaloff>:/icons/res/requestBlack.png</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>45</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="safeContactRequest">
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="baseSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Add a new contact</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="Dark">
<normalon>:/icons/res/addContactBlack.png</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>45</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="givemeZaddr">
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="toolTip">
<string>Get a new Address</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../application.qrc">
<normaloff>:/icons/res/getAddrBlack.png</normaloff>:/icons/res/getAddrBlack.png</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>45</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_39">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Contactlist&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="listContactWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectItems</enum>
</property>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<layout class="QVBoxLayout" name="verticalLayout_11">
<property name="sizeConstraint">
@ -547,6 +343,223 @@
</item>
</layout>
</item>
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_18" stretch="0,0,0,0,0">
<property name="sizeConstraint">
<enum>QLayout::SetDefaultConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>15</number>
</property>
<item>
<widget class="QPushButton" name="pushContact">
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="baseSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Incoming contact request</string>
</property>
<property name="autoFillBackground">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../application.qrc">
<normaloff>:/icons/res/requestBlack.png</normaloff>:/icons/res/requestBlack.png</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>45</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item alignment="Qt::AlignTop">
<widget class="QLabel" name="newRequest">
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="safeContactRequest">
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="baseSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Add a new contact</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="Dark">
<normalon>:/icons/res/addContactBlack.png</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>45</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="givemeZaddr">
<property name="minimumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>51</width>
<height>51</height>
</size>
</property>
<property name="toolTip">
<string>Get a new Address</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../application.qrc">
<normaloff>:/icons/res/getAddrBlack.png</normaloff>:/icons/res/getAddrBlack.png</iconset>
</property>
<property name="iconSize">
<size>
<width>50</width>
<height>45</height>
</size>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>100</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QLabel" name="label_39">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>300</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-weight:600; text-decoration: underline;&quot;&gt;Contactlist&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<widget class="QListView" name="listContactWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="showDropIndicator" stdset="0">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>false</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectItems</enum>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab">

Loading…
Cancel
Save