Improved Circle Feed Item

This commit is contained in:
defnax 2019-11-24 17:32:51 +01:00
parent 9381cab3b1
commit 13b8fe77f9
2 changed files with 224 additions and 168 deletions

View file

@ -68,9 +68,13 @@ void GxsCircleItem::setup()
RsIdentityDetails idDetails ; RsIdentityDetails idDetails ;
QString idName ; QString idName ;
if(rsIdentity->getIdDetails(mGxsId, idDetails)) if(rsIdentity->getIdDetails(mGxsId, idDetails))
idName = tr("for identity ")+QString::fromUtf8(idDetails.mNickname.c_str()) + " (ID=" + QString::fromStdString(mGxsId.toStdString()) + ")" ; idName = QString::fromUtf8(idDetails.mNickname.c_str()) + " (ID=" + QString::fromStdString(mGxsId.toStdString()) + ")" ;
else else
idName = tr("for identity ")+QString::fromStdString(mGxsId.toStdString()) ; idName = QString::fromStdString(mGxsId.toStdString()) ;
QPixmap pixmap ;
if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL))
pixmap = GxsIdDetails::makeDefaultIcon(mGxsId,GxsIdDetails::SMALL);
/* update circle information */ /* update circle information */
@ -84,6 +88,10 @@ void GxsCircleItem::setup()
ui->titleLabel->setText(tr("You received a membership request for circle:")); ui->titleLabel->setText(tr("You received a membership request for circle:"));
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str())); ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
ui->gxsIdLabel->setText(idName); ui->gxsIdLabel->setText(idName);
ui->iconLabel->setPixmap(pixmap);
ui->gxsIdLabel->setId(mGxsId);
ui->acceptButton->setToolTip(tr("Grant membership request")); ui->acceptButton->setToolTip(tr("Grant membership request"));
ui->revokeButton->setToolTip(tr("Revoke membership request")); ui->revokeButton->setToolTip(tr("Revoke membership request"));
@ -95,6 +103,8 @@ void GxsCircleItem::setup()
ui->titleLabel->setText(tr("You received an invitation for circle:")); ui->titleLabel->setText(tr("You received an invitation for circle:"));
ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str())); ui->nameLabel->setText(QString::fromUtf8(circleDetails.mCircleName.c_str()));
ui->gxsIdLabel->setText(idName); ui->gxsIdLabel->setText(idName);
ui->iconLabel->setPixmap(pixmap);
ui->gxsIdLabel->setId(mGxsId);
ui->acceptButton->setToolTip(tr("Accept invitation")); ui->acceptButton->setToolTip(tr("Accept invitation"));
connect(ui->acceptButton, SIGNAL(clicked()), this, SLOT(acceptCircleSubscription())); connect(ui->acceptButton, SIGNAL(clicked()), this, SLOT(acceptCircleSubscription()));
@ -107,6 +117,7 @@ void GxsCircleItem::setup()
ui->titleLabel->setText(tr("Received event from unknown Circle:")); ui->titleLabel->setText(tr("Received event from unknown Circle:"));
ui->nameLabel->setText(QString::fromStdString(mCircleId.toStdString())); ui->nameLabel->setText(QString::fromStdString(mCircleId.toStdString()));
ui->gxsIdLabel->setText(idName); ui->gxsIdLabel->setText(idName);
ui->gxsIdLabel->setId(mGxsId);
} }
/* Setup TokenQueue */ /* Setup TokenQueue */

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>618</width> <width>618</width>
<height>96</height> <height>104</height>
</rect> </rect>
</property> </property>
<layout class="QGridLayout" name="GxsCircleItemGLayout"> <layout class="QGridLayout" name="GxsCircleItemGLayout">
@ -104,10 +104,8 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Sunken</enum> <enum>QFrame::Sunken</enum>
</property> </property>
<layout class="QGridLayout" name="frameGLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <item row="0" column="0" rowspan="3">
<layout class="QGridLayout" name="topGLayout">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="logoLabel"> <widget class="QLabel" name="logoLabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -132,7 +130,153 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="1" column="1" colspan="5">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="forLabel">
<property name="text">
<string>for identity</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="iconLabel">
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="GxsIdLabel" name="gxsIdLabel">
<property name="text">
<string notr="true">name</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>358</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="acceptButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Accept</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/accepted16.png</normaloff>:/images/accepted16.png</iconset>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QPushButton" name="revokeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="text">
<string>Revoke</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Details</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/informations_24x24.png</normaloff>:/images/informations_24x24.png</iconset>
</property>
</widget>
</item>
<item row="2" column="4">
<spacer name="tollbarHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>285</width>
<height>18</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="5">
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/png/exit2.png</normaloff>:/icons/png/exit2.png</iconset>
</property>
</widget>
</item>
<item row="0" column="1" colspan="5">
<layout class="QHBoxLayout" name="nameHLayout"> <layout class="QHBoxLayout" name="nameHLayout">
<item> <item>
<widget class="QLabel" name="titleLabel"> <widget class="QLabel" name="titleLabel">
@ -179,117 +323,18 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="toolbarHLayout">
<item>
<widget class="QLabel" name="gxsIdLabel">
<property name="text">
<string notr="true">name</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="tollbarHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>254</width>
<height>28</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="acceptButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/accepted16.png</normaloff>:/images/accepted16.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="revokeButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="expandButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Details</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="clearButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Remove Item</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../icons.qrc"/> <include location="../icons.qrc"/>