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,184 +104,222 @@
<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"> <widget class="QLabel" name="logoLabel">
<item row="0" column="0" rowspan="2"> <property name="minimumSize">
<widget class="QLabel" name="logoLabel"> <size>
<property name="minimumSize"> <width>70</width>
<size> <height>70</height>
<width>70</width> </size>
<height>70</height> </property>
</size> <property name="maximumSize">
<size>
<width>70</width>
<height>70</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/icons/svg/circles.svg</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<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> </property>
</widget>
</item>
<item>
<widget class="QLabel" name="iconLabel">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>70</width> <width>20</width>
<height>70</height> <height>20</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string/> <string>TextLabel</string>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/icons/svg/circles.svg</pixmap>
</property> </property>
<property name="scaledContents"> <property name="scaledContents">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item>
<layout class="QHBoxLayout" name="nameHLayout"> <widget class="GxsIdLabel" name="gxsIdLabel">
<item> <property name="text">
<widget class="QLabel" name="titleLabel"> <string notr="true">name</string>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <property name="openExternalLinks">
<horstretch>0</horstretch> <bool>true</bool>
<verstretch>0</verstretch> </property>
</sizepolicy> </widget>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string notr="true">name</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="nameHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
<item row="1" column="1"> <item>
<layout class="QHBoxLayout" name="toolbarHLayout"> <spacer name="horizontalSpacer">
<item> <property name="orientation">
<widget class="QLabel" name="gxsIdLabel"> <enum>Qt::Horizontal</enum>
<property name="text"> </property>
<string notr="true">name</string> <property name="sizeHint" stdset="0">
</property> <size>
<property name="openExternalLinks"> <width>358</width>
<bool>true</bool> <height>20</height>
</property> </size>
</widget> </property>
</item> </spacer>
<item> </item>
<spacer name="tollbarHSpacer"> </layout>
<property name="orientation"> </item>
<enum>Qt::Horizontal</enum> <item row="2" column="1">
</property> <widget class="QPushButton" name="acceptButton">
<property name="sizeType"> <property name="sizePolicy">
<enum>QSizePolicy::Expanding</enum> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
</property> <horstretch>0</horstretch>
<property name="sizeHint" stdset="0"> <verstretch>0</verstretch>
<size> </sizepolicy>
<width>254</width> </property>
<height>28</height> <property name="focusPolicy">
</size> <enum>Qt::NoFocus</enum>
</property> </property>
</spacer> <property name="text">
</item> <string>Accept</string>
<item> </property>
<widget class="QPushButton" name="acceptButton"> <property name="icon">
<property name="sizePolicy"> <iconset resource="../images.qrc">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <normaloff>:/images/accepted16.png</normaloff>:/images/accepted16.png</iconset>
<horstretch>0</horstretch> </property>
<verstretch>0</verstretch> </widget>
</sizepolicy> </item>
</property> <item row="2" column="2">
<property name="focusPolicy"> <widget class="QPushButton" name="revokeButton">
<enum>Qt::NoFocus</enum> <property name="sizePolicy">
</property> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<property name="icon"> <horstretch>0</horstretch>
<iconset resource="../images.qrc"> <verstretch>0</verstretch>
<normaloff>:/images/accepted16.png</normaloff>:/images/accepted16.png</iconset> </sizepolicy>
</property> </property>
</widget> <property name="focusPolicy">
</item> <enum>Qt::NoFocus</enum>
<item> </property>
<widget class="QPushButton" name="revokeButton"> <property name="text">
<property name="sizePolicy"> <string>Revoke</string>
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> </property>
<horstretch>0</horstretch> <property name="icon">
<verstretch>0</verstretch> <iconset resource="../images.qrc">
</sizepolicy> <normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset>
</property> </property>
<property name="focusPolicy"> </widget>
<enum>Qt::NoFocus</enum> </item>
</property> <item row="2" column="3">
<property name="icon"> <widget class="QPushButton" name="expandButton">
<iconset resource="../images.qrc"> <property name="sizePolicy">
<normaloff>:/images/cancel.png</normaloff>:/images/cancel.png</iconset> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
</property> <horstretch>0</horstretch>
</widget> <verstretch>0</verstretch>
</item> </sizepolicy>
<item> </property>
<widget class="QPushButton" name="expandButton"> <property name="focusPolicy">
<property name="sizePolicy"> <enum>Qt::NoFocus</enum>
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> </property>
<horstretch>0</horstretch> <property name="toolTip">
<verstretch>0</verstretch> <string>Details</string>
</sizepolicy> </property>
</property> <property name="icon">
<property name="focusPolicy"> <iconset resource="../images.qrc">
<enum>Qt::NoFocus</enum> <normaloff>:/images/informations_24x24.png</normaloff>:/images/informations_24x24.png</iconset>
</property> </property>
<property name="toolTip"> </widget>
<string>Details</string> </item>
</property> <item row="2" column="4">
<property name="icon"> <spacer name="tollbarHSpacer">
<iconset resource="../images.qrc"> <property name="orientation">
<normaloff>:/images/edit_add24.png</normaloff>:/images/edit_add24.png</iconset> <enum>Qt::Horizontal</enum>
</property> </property>
</widget> <property name="sizeType">
</item> <enum>QSizePolicy::Expanding</enum>
<item> </property>
<widget class="QPushButton" name="clearButton"> <property name="sizeHint" stdset="0">
<property name="sizePolicy"> <size>
<sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <width>285</width>
<horstretch>0</horstretch> <height>18</height>
<verstretch>0</verstretch> </size>
</sizepolicy> </property>
</property> </spacer>
<property name="focusPolicy"> </item>
<enum>Qt::NoFocus</enum> <item row="2" column="5">
</property> <widget class="QPushButton" name="clearButton">
<property name="toolTip"> <property name="sizePolicy">
<string>Remove Item</string> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
</property> <horstretch>0</horstretch>
<property name="icon"> <verstretch>0</verstretch>
<iconset resource="../images.qrc"> </sizepolicy>
<normaloff>:/images/close_normal.png</normaloff>:/images/close_normal.png</iconset> </property>
</property> <property name="focusPolicy">
</widget> <enum>Qt::NoFocus</enum>
</item> </property>
</layout> <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">
<item>
<widget class="QLabel" name="titleLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<italic>true</italic>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="nameLabel">
<property name="text">
<string notr="true">name</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="nameHSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</item> </item>
@ -290,6 +328,13 @@
</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"/>