From bdf8d68c341a18aad832cfc8212af1b8849a6e46 Mon Sep 17 00:00:00 2001 From: defnax Date: Mon, 25 Feb 2019 20:23:47 +0100 Subject: [PATCH] Added more actions to People V2 Thumbed View Added action for send invite Added action for add to contacts Added action for person details view Added menu for circles Added to display votes on Identity widget --- .../src/gui/People/IdentityWidget.cpp | 35 ++- .../src/gui/People/IdentityWidget.h | 2 + .../src/gui/People/IdentityWidget.ui | 249 ++++++++++++------ .../src/gui/People/PeopleDialog.cpp | 59 ++++- retroshare-gui/src/gui/People/PeopleDialog.h | 9 +- 5 files changed, 257 insertions(+), 97 deletions(-) diff --git a/retroshare-gui/src/gui/People/IdentityWidget.cpp b/retroshare-gui/src/gui/People/IdentityWidget.cpp index 77d08c038..15eed8852 100644 --- a/retroshare-gui/src/gui/People/IdentityWidget.cpp +++ b/retroshare-gui/src/gui/People/IdentityWidget.cpp @@ -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); } /* diff --git a/retroshare-gui/src/gui/People/IdentityWidget.h b/retroshare-gui/src/gui/People/IdentityWidget.h index a5e7b7771..03f980683 100644 --- a/retroshare-gui/src/gui/People/IdentityWidget.h +++ b/retroshare-gui/src/gui/People/IdentityWidget.h @@ -82,6 +82,8 @@ private: QString _idtype; QString _nickname; QString _gxsId; + QString _postiveVotes; + QString _negativeVotes; Ui::IdentityWidget *ui; }; diff --git a/retroshare-gui/src/gui/People/IdentityWidget.ui b/retroshare-gui/src/gui/People/IdentityWidget.ui index 9a9ed0e90..adf4668d5 100644 --- a/retroshare-gui/src/gui/People/IdentityWidget.ui +++ b/retroshare-gui/src/gui/People/IdentityWidget.ui @@ -6,18 +6,96 @@ 0 0 - 102 - 170 + 101 + 272 - - + + 0 - - 1 + + 0 - + + 0 + + + 0 + + + 0 + + + + + + 0 + 15 + + + + + 100 + 16777215 + + + + Name + + + true + + + Qt::AlignCenter + + + + + + + + 0 + 15 + + + + + 100 + 16777215 + + + + KeyId + + + Qt::AlignCenter + + + + + + + + 0 + 15 + + + + + 100 + 16777215 + + + + GXSId + + + Qt::AlignCenter + + + + @@ -53,76 +131,89 @@ - - - - - 0 - 15 - + + + + 6 - - - 100 - 16777215 - - - - Name - - - true - - - Qt::AlignCenter - - + + + + + 24 + 24 + + + + + + + :/icons/png/thumbs-up.png + + + true + + + + + + + + 16 + + + + Positive votes + + + 0 + + + + + + + Qt::Vertical + + + + + + + + 24 + 24 + + + + + + + :/icons/png/thumbs-down.png + + + true + + + + + + + + 16 + + + + Negative votes + + + 0 + + + + - - - - - 0 - 15 - - - - - 100 - 16777215 - - - - KeyId - - - Qt::AlignCenter - - - - - - - - 0 - 15 - - - - - 100 - 16777215 - - - - GXSId - - - Qt::AlignCenter - - - - + Add @@ -135,12 +226,18 @@ ElidedLabel QLabel -
gui/common/ElidedLabel.h
+
gui/common/ElidedLabel.h
1
+ + GxsIdLabel + QLabel +
gui/gxs/GxsIdLabel.h
+
+ diff --git a/retroshare-gui/src/gui/People/PeopleDialog.cpp b/retroshare-gui/src/gui/People/PeopleDialog.cpp index 5944d5c34..e97ad3c98 100644 --- a/retroshare-gui/src/gui/People/PeopleDialog.cpp +++ b/retroshare-gui/src/gui/People/PeopleDialog.cpp @@ -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(QObject::sender()); if (dest) { QMenu contextMnu( this ); + + QMenu *mnu = contextMnu.addMenu(QIcon(":/icons/png/circles.png"),tr("Invite to Circle")) ; std::map::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(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(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(MainWindow::getPage(MainWindow::People)); - /* Dialog will destroy itself */ + if (!idDialog) + return ; + + MainWindow::showWindow(MainWindow::People); + idDialog->navigate(RsGxsId(gxs_id)); } diff --git a/retroshare-gui/src/gui/People/PeopleDialog.h b/retroshare-gui/src/gui/People/PeopleDialog.h index 0a29dec6d..bf8e7b1ea 100644 --- a/retroshare-gui/src/gui/People/PeopleDialog.h +++ b/retroshare-gui/src/gui/People/PeopleDialog.h @@ -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();