Merge pull request #1487 from defnax2k/People-V2-improvements

Added more actions to People V2 Thumbed View
This commit is contained in:
csoler 2019-03-28 19:59:59 +01:00 committed by GitHub
commit 8b3f3fe717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 257 additions and 97 deletions

View File

@ -51,6 +51,11 @@ IdentityWidget::IdentityWidget(QString name/*=QString()*/, QWidget *parent/*=0*/
ui->labelGXSId->setText(_keyId);
ui->labelGXSId->setToolTip(_keyId);
ui->labelGXSId->setVisible(false);
ui->labelPositive->setVisible(false);
ui->labelNegative->setVisible(false);
ui->label_PosIcon_2->setVisible(false);
ui->label_NegIcon_2->setVisible(false);
ui->pbAdd->setVisible(false);
QObject::connect(ui->pbAdd, SIGNAL(clicked()), this, SLOT(pbAdd_clicked()));
@ -80,19 +85,19 @@ void IdentityWidget::updateData(const RsGxsIdGroup &gxs_group_info)
_group_info = gxs_group_info;
_haveGXSId = true;
RsReputations::ReputationInfo info ;
rsReputations->getReputationInfo(RsGxsId(_group_info.mMeta.mGroupId),_group_info.mPgpId,info) ;
m_myName = QString::fromUtf8(_group_info.mMeta.mGroupName.c_str());
//ui->labelName->setId(RsGxsId(_group_info.mMeta.mGroupId));
ui->labelName->setText(m_myName);
if (_havePGPDetail) {
ui->labelName->setToolTip(tr("GXS name:").append(" "+m_myName).append("\n")
.append(tr("PGP name:").append(" "+_nickname)));
} else {//if (m_myName != _nickname)
ui->labelName->setToolTip(tr("GXS name:").append(" "+m_myName));
}//else (m_myName != _nickname)
_gxsId = QString::fromStdString(_group_info.mMeta.mGroupId.toStdString());
ui->labelGXSId->setId(RsGxsId(_group_info.mMeta.mGroupId));
ui->labelGXSId->setText(_gxsId);
ui->labelGXSId->setToolTip(tr("GXS id:").append(" "+_gxsId));
ui->labelPositive->setText(QString::number(info.mFriendsPositiveVotes));
ui->labelNegative->setText(QString::number(info.mFriendsNegativeVotes));
if (!_havePGPDetail) {
QFont font = ui->labelName->font();
@ -100,8 +105,8 @@ void IdentityWidget::updateData(const RsGxsIdGroup &gxs_group_info)
ui->labelName->setFont(font);
_keyId=QString::fromStdString(_group_info.mMeta.mGroupId.toStdString());
ui->labelKeyId->setId(RsGxsId(_group_info.mMeta.mGroupId));
ui->labelKeyId->setText(_keyId);
ui->labelKeyId->setToolTip(tr("GXS id:").append(" "+_keyId));
ui->labelKeyId->setVisible(false);
/// (TODO) Get real ident icon
@ -133,10 +138,10 @@ void IdentityWidget::updateData(const RsPeerDetails &pgp_details)
if (!_haveGXSId) m_myName = _nickname;
ui->labelName->setText(m_myName);
if (_haveGXSId) {
ui->labelName->setToolTip(tr("GXS name:").append(" "+m_myName).append("\n")
.append(tr("PGP name:").append(" "+_nickname)));
ui->labelName->setToolTip(tr("GXS name:") + (" "+m_myName) + ("\n")
+(tr("PGP name:")+(" "+_nickname)));
} else {//if (m_myName != _nickname)
ui->labelName->setToolTip(tr("PGP name:").append(" "+_nickname));
ui->labelName->setToolTip(tr("PGP name:")+(" "+_nickname));
}//else (m_myName != _nickname)
QFont font = ui->labelName->font();
@ -145,7 +150,7 @@ void IdentityWidget::updateData(const RsPeerDetails &pgp_details)
_keyId = QString::fromStdString(_details.gpg_id.toStdString());
ui->labelKeyId->setText(_keyId);
ui->labelKeyId->setToolTip(tr("PGP id:").append(" "+_keyId));
ui->labelKeyId->setToolTip(tr("PGP id:")+(" "+_keyId));
if (!_haveGXSId) {
QPixmap avatar;
@ -217,6 +222,10 @@ void IdentityWidget::setIsCurrent(bool value)
m_isCurrent=value;
ui->labelKeyId->setVisible(value);
ui->labelGXSId->setVisible(value && (_haveGXSId && _havePGPDetail));
ui->labelPositive->setVisible(value);
ui->labelNegative->setVisible(value);
ui->label_PosIcon_2->setVisible(value);
ui->label_NegIcon_2->setVisible(value);
ui->pbAdd->setVisible(value);
}
/*

View File

@ -82,6 +82,8 @@ private:
QString _idtype;
QString _nickname;
QString _gxsId;
QString _postiveVotes;
QString _negativeVotes;
Ui::IdentityWidget *ui;
};

View File

@ -6,18 +6,96 @@
<rect>
<x>0</x>
<y>0</y>
<width>102</width>
<height>170</height>
<width>101</width>
<height>272</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="margin">
<number>1</number>
<property name="topMargin">
<number>0</number>
</property>
<item>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<item row="1" column="0">
<widget class="ElidedLabel" name="labelName">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Name</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="GxsIdLabel" name="labelKeyId">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>KeyId</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="GxsIdLabel" name="labelGXSId">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>GXSId</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QGraphicsView" name="graphicsView">
<property name="minimumSize">
<size>
@ -53,76 +131,89 @@
</property>
</widget>
</item>
<item>
<widget class="ElidedLabel" name="labelName">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
</size>
<item row="2" column="0">
<layout class="QHBoxLayout" name="avatarOpinionHLayout_2">
<property name="spacing">
<number>6</number>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Name</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<item>
<widget class="QLabel" name="label_PosIcon_2">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/icons/png/thumbs-up.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelPositive">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="toolTip">
<string>Positive votes</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_Opinion_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_NegIcon_2">
<property name="maximumSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/icons/png/thumbs-down.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelNegative">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="toolTip">
<string>Negative votes</string>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="ElidedLabel" name="labelKeyId">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>KeyId</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="ElidedLabel" name="labelGXSId">
<property name="minimumSize">
<size>
<width>0</width>
<height>15</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>100</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>GXSId</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<item row="5" column="0" colspan="2">
<widget class="QPushButton" name="pbAdd">
<property name="text">
<string>Add</string>
@ -135,12 +226,18 @@
<customwidget>
<class>ElidedLabel</class>
<extends>QLabel</extends>
<header location="global">gui/common/ElidedLabel.h</header>
<header>gui/common/ElidedLabel.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>GxsIdLabel</class>
<extends>QLabel</extends>
<header>gui/gxs/GxsIdLabel.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -23,9 +23,12 @@
#include "gui/common/FlowLayout.h"
#include "gui/settings/rsharesettings.h"
#include "gui/msgs/MessageComposer.h"
#include "gui/RetroShareLink.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/RsGxsUpdateBroadcastBase.h"
#include "gui/Identity/IdDetailsDialog.h"
#include "gui/Identity/IdDialog.h"
#include "gui/MainWindow.h"
#include "retroshare/rspeers.h"
#include "retroshare/rsidentity.h"
@ -63,6 +66,8 @@ PeopleDialog::PeopleDialog(QWidget *parent)
tabWidget->removeTab(1);
//hide circle flow widget not functional yet
pictureFlowWidgetExternal->hide();
//need erase QtCreator Layout first(for Win)
delete idExternal->layout();
@ -423,6 +428,8 @@ void PeopleDialog::iw_AddButtonClickedExt()
qobject_cast<IdentityWidget *>(QObject::sender());
if (dest) {
QMenu contextMnu( this );
QMenu *mnu = contextMnu.addMenu(QIcon(":/icons/png/circles.png"),tr("Invite to Circle")) ;
std::map<RsGxsGroupId, CircleWidget*>::iterator itCurs;
for( itCurs =_ext_circles_widgets.begin();
@ -432,7 +439,7 @@ void PeopleDialog::iw_AddButtonClickedExt()
QIcon icon = QIcon(curs->getImage());
QString name = curs->getName();
QAction *action = contextMnu.addAction(icon, name, this, SLOT(addToCircleExt()));
QAction *action = mnu->addAction(icon, name, this, SLOT(addToCircleExt()));
action->setData(QString::fromStdString(curs->groupInfo().mGroupId.toStdString())
+ ";" + QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
}//for( itCurs =_ext_circles_widgets.begin();
@ -468,9 +475,17 @@ void PeopleDialog::iw_AddButtonClickedExt()
}
}
QAction *actionsendmsg = contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMessage()));
QAction *actionsendmsg = contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message"), this, SLOT(sendMessage()));
actionsendmsg->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
QAction *actionsendinvite = contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send invite"), this, SLOT(sendInvite()));
actionsendinvite->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
contextMnu.addSeparator();
QAction *actionaddcontact = contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Add to Contacts"), this, SLOT(addtoContacts()));
actionaddcontact->setData( QString::fromStdString(dest->groupInfo().mMeta.mGroupId.toStdString()));
contextMnu.addSeparator();
QAction *actionDetails = contextMnu.addAction(QIcon(":/images/info16.png"), tr("Person details"), this, SLOT(personDetails()));
@ -607,6 +622,36 @@ void PeopleDialog::sendMessage()
}
void PeopleDialog::sendInvite()
{
QAction *action =
qobject_cast<QAction *>(QObject::sender());
if (action) {
QString data = action->data().toString();
RsGxsId gxs_id = RsGxsId(data.toStdString());;
MessageComposer::sendInvite(gxs_id,false);
}
}
void PeopleDialog::addtoContacts()
{
QAction *action =
qobject_cast<QAction *>(QObject::sender());
if (action) {
QString data = action->data().toString();
RsGxsId gxs_id = RsGxsId(data.toStdString());;
rsIdentity->setAsRegularContact(RsGxsId(gxs_id),true);
}
}
void PeopleDialog::personDetails()
{
QAction *action =
@ -620,10 +665,14 @@ void PeopleDialog::personDetails()
return;
}
IdDetailsDialog *dialog = new IdDetailsDialog(RsGxsGroupId(gxs_id));
dialog->show();
/* window will destroy itself! */
IdDialog *idDialog = dynamic_cast<IdDialog*>(MainWindow::getPage(MainWindow::People));
/* Dialog will destroy itself */
if (!idDialog)
return ;
MainWindow::showWindow(MainWindow::People);
idDialog->navigate(RsGxsId(gxs_id));
}

View File

@ -31,7 +31,7 @@
#include "ui_PeopleDialog.h"
#define IMAGE_IDENTITY ":/icons/friends_128.png"
#define IMAGE_IDENTITY ":/icons/png/people.png"
class PeopleDialog : public RsGxsUpdateBroadcastPage, public Ui::PeopleDialog, public TokenResponse
{
@ -84,8 +84,11 @@ private slots:
void pf_dropEventOccursInt(QDropEvent *event);
void chatIdentity();
void sendMessage();
void personDetails();
void sendMessage();
void personDetails();
void sendInvite();
void addtoContacts();
private:
void reloadAll();