From b1527b608f01535d25909e1b1ac324b4ef2259d6 Mon Sep 17 00:00:00 2001 From: defnax Date: Thu, 10 Sep 2015 17:37:42 +0200 Subject: [PATCH 1/3] Improved layout better look & feel for Circles View Added activity column --- retroshare-gui/src/gui/Identity/IdDialog.cpp | 63 +- retroshare-gui/src/gui/Identity/IdDialog.ui | 978 ++++++++++--------- 2 files changed, 559 insertions(+), 482 deletions(-) diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index d36ec3b1d..67e5b6279 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -68,7 +68,8 @@ #define RSID_COL_NICKNAME 0 #define RSID_COL_KEYID 1 -#define RSID_COL_IDTYPE 2 +#define RSID_COL_LASTUSED 2 +#define RSID_COL_IDTYPE 3 #define RSIDREP_COL_NAME 0 #define RSIDREP_COL_OPINION 1 @@ -164,9 +165,9 @@ IdDialog::IdDialog(QWidget *parent) : connect(ui->messageButton, SIGNAL(clicked()), this, SLOT(sendMsg())); -#ifdef UNFINISHED_CODE + ui->avlabel->setPixmap(QPixmap(":/images/user/friends64.png")); -#endif + ui->headerTextLabel->setText(tr("People")); /* Initialize splitter */ @@ -192,12 +193,20 @@ IdDialog::IdDialog(QWidget *parent) : ui->filterLineEdit->addFilter(QIcon(), headerText, RSID_COL_NICKNAME, QString("%1 %2").arg(tr("Search"), headerText)); headerText = headerItem->text(RSID_COL_KEYID); ui->filterLineEdit->addFilter(QIcon(), headerItem->text(RSID_COL_KEYID), RSID_COL_KEYID, QString("%1 %2").arg(tr("Search"), headerText)); + + /* Set initial section sizes */ + QHeaderView * circlesheader = ui->treeWidget_membership->header () ; + circlesheader->resizeSection (CIRCLEGROUP_CIRCLE_COL_GROUPNAME, 280); /* Setup tree */ ui->idTreeWidget->sortByColumn(RSID_COL_NICKNAME, Qt::AscendingOrder); ui->idTreeWidget->enableColumnCustomize(true); ui->idTreeWidget->setColumnCustomizable(RSID_COL_NICKNAME, false); + + ui->idTreeWidget->setColumnHidden(RSID_COL_IDTYPE, true); + ui->idTreeWidget->setColumnHidden(RSID_COL_LASTUSED, true); + /* Set initial column width */ int fontWidth = QFontMetricsF(ui->idTreeWidget->font()).width("W"); @@ -213,9 +222,6 @@ IdDialog::IdDialog(QWidget *parent) : // Hiding RepList until that part is finished. //ui->treeWidget_RepList->setVisible(false); ui->toolButton_Reputation->setVisible(false); -#ifdef UNFINISHED_CODE - ui->todoPushButton->hide() ; -#endif QString hlp_str = tr( "

  Identities

\ @@ -494,6 +500,24 @@ void IdDialog::todo() ""); } +static QString getHumanReadableDuration(uint32_t seconds) +{ + if(seconds < 60) + return QString(QObject::tr("%1 seconds ago")).arg(seconds) ; + else if(seconds < 120) + return QString(QObject::tr("%1 minute ago")).arg(seconds/60) ; + else if(seconds < 3600) + return QString(QObject::tr("%1 minutes ago")).arg(seconds/60) ; + else if(seconds < 7200) + return QString(QObject::tr("%1 hour ago")).arg(seconds/3600) ; + else if(seconds < 24*3600) + return QString(QObject::tr("%1 hours ago")).arg(seconds/3600) ; + else if(seconds < 2*24*3600) + return QString(QObject::tr("%1 day ago")).arg(seconds/86400) ; + else + return QString(QObject::tr("%1 days ago")).arg(seconds/86400) ; +} + void IdDialog::processSettings(bool load) { Settings->beginGroup("IdDialog"); @@ -617,8 +641,13 @@ bool IdDialog::fillIdListItem(const RsGxsIdGroup& data, QTreeWidgetItem *&item, item->setText(RSID_COL_NICKNAME, QString::fromUtf8(data.mMeta.mGroupName.c_str()).left(RSID_MAXIMUM_NICKNAME_SIZE)); item->setText(RSID_COL_KEYID, QString::fromStdString(data.mMeta.mGroupId.toStdString())); + + time_t now = time(NULL) ; + item->setText(RSID_COL_LASTUSED, getHumanReadableDuration(now - data.mLastUsageTS)) ; item->setData(RSID_COL_KEYID, Qt::UserRole,QVariant(item_flags)) ; + + item->setData(RSID_COL_LASTUSED, Qt::UserRole, QString::number(now - data.mLastUsageTS)); if(isOwnId) { @@ -770,24 +799,6 @@ void IdDialog::requestIdDetails() mIdQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, groupIds, IDDIALOG_IDDETAILS); } -static QString getHumanReadableDuration(uint32_t seconds) -{ - if(seconds < 60) - return QString(QObject::tr("%1 seconds ago")).arg(seconds) ; - else if(seconds < 120) - return QString(QObject::tr("%1 minute ago")).arg(seconds/60) ; - else if(seconds < 3600) - return QString(QObject::tr("%1 minutes ago")).arg(seconds/60) ; - else if(seconds < 7200) - return QString(QObject::tr("%1 hour ago")).arg(seconds/3600) ; - else if(seconds < 24*3600) - return QString(QObject::tr("%1 hours ago")).arg(seconds/3600) ; - else if(seconds < 2*24*3600) - return QString(QObject::tr("%1 day ago")).arg(seconds/86400) ; - else - return QString(QObject::tr("%1 days ago")).arg(seconds/86400) ; -} - void IdDialog::insertIdDetails(uint32_t token) { mStateHelper->setLoading(IDDIALOG_IDDETAILS, false); @@ -843,9 +854,9 @@ void IdDialog::insertIdDetails(uint32_t token) #ifdef ID_DEBUG std::cerr << "Setting header frame image : " << pix.width() << " x " << pix.height() << std::endl; #endif -#ifdef UNFINISHED_CODE + ui->avlabel->setPixmap(pixmap); -#endif + ui->avatarLabel->setPixmap(pixmap); if (data.mPgpKnown) diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui index cde80a882..1f0c5cd8c 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.ui +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -6,8 +6,8 @@ 0 0 - 1226 - 1085 + 826 + 579 @@ -19,8 +19,8 @@ - - + + @@ -103,7 +103,7 @@ - + Qt::Horizontal @@ -169,7 +169,7 @@ - + 0 0 @@ -193,6 +193,11 @@ Identity ID + + + Last Activity + + Owned by @@ -200,453 +205,521 @@ - - - - People - - - - - - - - 0 - 0 - - - - Identity info - - - - - - 6 - - - - - true - - - true - - - - - - - Identity name : - - - - - - - Identity ID : - - - - - - - Owner node ID : - - - - - - - true - - - true - - - - - - - true - - - true - - - - - - - Owner node name : - - - - - - - true - - - true - - - - - - - Type: - - - - - - - - - - Last used: - - - - - - - - - - - - - - - 0 - 0 - - - - - 128 - 128 - - - - - 128 - 128 - - - - QFrame::Box - - - QFrame::Sunken - - - Your Avatar - - - true - - - Qt::AlignCenter - - - - - - - - 48 - 48 - - - - - 48 - 48 - - - - Send message - - - - - - - :/images/mail-message-new.png:/images/mail-message-new.png - - - - 48 - 48 - - - - true - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - - - - - 0 - 0 - - - - Reputation - - - - - - - - - 75 - true - - - - Overall - - - - - - - true - - - - - - - Implicit - - - - - - - true - - - - - - - Opinion - - - - - - - true - - - - - - - Peers - - - - - - - true - - - - - - - - - Qt::NoFocus - - - Edit reputation - - - - :/images/edit_24.png:/images/edit_24.png - - - - 24 - 24 - - - - Qt::ToolButtonTextBesideIcon - - - true - - - - - - - - - - - 0 - 0 - - - - Tweak Opinion - - - - - - Accept (+100) - - - - - - - Positive (+10) - - - - - - - Negative (-10) - - - - - - - Ban (-100) - - - - - - - - - Custom - - - - - - - -100 - - - 100 - - - - - - - - - Modify - - - - - - - - - - - - - - Circles - - + + + 0 + + + + Circles + + + + - - - true + + + Create Circle - - - Name - - - - - IDs - - - - - Public Circles - - - - - Personal Circles - - - - - - - Edit Circle - - - - - - - Create External Circle - - - - + + + Edit Circle + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + - - - + + + + + true + + + + Name + + + + + IDs + + + + + Public Circles + + + + + Personal Circles + + + + + + + + + Person + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 12 + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + + + + + + true + + + + + + + People + + + + + + + + 48 + 48 + + + + + 48 + 48 + + + + Send message + + + + + + + :/images/mail-message-new.png:/images/mail-message-new.png + + + + 48 + 48 + + + + true + + + + + + + + + + Identity info + + + + + + 6 + + + + + Identity name : + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Identity ID : + + + + + + + Owner node ID : + + + + + + + true + + + true + + + + + + + true + + + true + + + + + + + true + + + true + + + + + + + Owner node name : + + + + + + + true + + + true + + + + + + + Type: + + + + + + + + + + Last used: + + + + + + + + + + + + + + + 0 + 0 + + + + + 128 + 128 + + + + + 128 + 128 + + + + QFrame::Box + + + QFrame::Sunken + + + Your Avatar + + + true + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + + + + + 0 + 0 + + + + Reputation + + + + + + + + + 75 + true + + + + Overall + + + + + + + true + + + + + + + Implicit + + + + + + + true + + + + + + + Opinion + + + + + + + true + + + + + + + Peers + + + + + + + true + + + + + + + + + Qt::NoFocus + + + Edit reputation + + + + :/images/edit_24.png:/images/edit_24.png + + + + 24 + 24 + + + + Qt::ToolButtonTextBesideIcon + + + true + + + + + + + + + + + 0 + 0 + + + + Tweak Opinion + + + + + + Accept (+100) + + + + + + + Positive (+10) + + + + + + + Negative (-10) + + + + + + + Ban (-100) + + + + + + + + + Custom + + + + + + + -100 + + + 100 + + + + + + + + + Modify + + + + + + + + + + detailsGroupBox + headerFrame + @@ -686,16 +759,16 @@ - - StyledLabel - QLabel -
gui/common/StyledLabel.h
-
StyledElidedLabel QLabel
gui/common/StyledElidedLabel.h
+ + StyledLabel + QLabel +
gui/common/StyledLabel.h
+
RSTreeWidget QTreeWidget @@ -709,13 +782,6 @@
idTreeWidget - lineEdit_Nickname - lineEdit_KeyId - lineEdit_GpgId - lineEdit_GpgName - line_RatingOverall - line_RatingImplicit - line_RatingOwn From cecaf31f7db663083ebd891c5712211f306c6b38 Mon Sep 17 00:00:00 2001 From: defnax Date: Fri, 11 Sep 2015 01:15:45 +0200 Subject: [PATCH 2/3] Clean up naming and added to display avatar icons. --- .../src/gui/Circles/CreateCircleDialog.cpp | 26 +++++++++++-------- .../src/gui/Circles/CreateCircleDialog.h | 4 +-- .../src/gui/Circles/CreateCircleDialog.ui | 8 ++++-- retroshare-gui/src/gui/Identity/IdDialog.cpp | 14 +++++----- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp b/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp index 36580c1fd..94403d384 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp @@ -25,6 +25,7 @@ #include #include "gui/Circles/CreateCircleDialog.h" +#include "gui/gxs/GxsIdDetails.h" #include #include @@ -50,10 +51,6 @@ CreateCircleDialog::CreateCircleDialog() /* Setup Queue */ mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this); mIdQueue = new TokenQueue(rsIdentity->getTokenService(), this); - - //QString text = pId.empty() ? tr("Start New Thread") : tr("Post Forum Message"); - //setWindowTitle(text); - //Settings->loadWidgetInformation(this); ui.headerFrame->setHeaderImage(QPixmap(":/images/circles/circles_64.png")); @@ -122,12 +119,12 @@ void CreateCircleDialog::editNewId(bool isExternal) if (isExternal) { setupForExternalCircle(); - ui.headerFrame->setHeaderText(tr("Create New External Circle")); + ui.headerFrame->setHeaderText(tr("Create New Circle")); } else { setupForPersonalCircle(); - ui.headerFrame->setHeaderText(tr("Create New Personal Circle")); + ui.headerFrame->setHeaderText(tr("Create New Circle")); } /* enable stuff that might be locked */ @@ -139,14 +136,14 @@ void CreateCircleDialog::setupForPersonalCircle() /* hide distribution line */ - ui.groupBox_title->setTitle(tr("Personal Circle Details")); + ui.groupBox_title->setTitle(tr("Circle Details")); ui.frame_PgpTypes->hide(); ui.frame_Distribution->hide(); ui.idChooserLabel->hide(); ui.idChooser->hide(); //ui.toolButton_NewId->hide(); - getPgpIdentities(); + //getPgpIdentities(); } void CreateCircleDialog::setupForExternalCircle() @@ -154,7 +151,7 @@ void CreateCircleDialog::setupForExternalCircle() mIsExternalCircle = true; /* show distribution line */ - ui.groupBox_title->setTitle(tr("External Circle Details")); + ui.groupBox_title->setTitle(tr("Circle Details")); ui.frame_PgpTypes->show(); ui.frame_Distribution->show(); ui.idChooserLabel->show(); @@ -220,6 +217,7 @@ void CreateCircleDialog::addMember(const QString& keyId, const QString& idtype, member->setText(RSCIRCLEID_COL_NICKNAME, nickname); member->setText(RSCIRCLEID_COL_KEYID, keyId); member->setText(RSCIRCLEID_COL_IDTYPE, idtype); + //member->setIcon(RSCIRCLEID_COL_NICKNAME, pixmap); tree->addTopLevelItem(member); } @@ -522,7 +520,7 @@ void CreateCircleDialog::loadCircle(uint32_t token) updateCircleGUI(); } -void CreateCircleDialog::getPgpIdentities() +/*void CreateCircleDialog::getPgpIdentities() { std::cerr << "CreateCircleDialog::getPgpIdentities()"; std::cerr << std::endl; @@ -556,7 +554,7 @@ void CreateCircleDialog::getPgpIdentities() } filterIds(); -} +}*/ void CreateCircleDialog::requestGxsIdentities() @@ -616,6 +614,11 @@ void CreateCircleDialog::loadIdentities(uint32_t token) QString keyId = QString::fromStdString(data.mMeta.mGroupId.toStdString()); QString nickname = QString::fromUtf8(data.mMeta.mGroupName.c_str()); QString idtype = tr("Anon Id"); + + QPixmap pixmap ; + + if(data.mImage.mSize == 0 || !pixmap.loadFromData(data.mImage.mData, data.mImage.mSize, "PNG")) + pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(RsGxsId(data.mMeta.mGroupId))) ; if (data.mMeta.mGroupFlags & RSGXSID_GROUPFLAG_REALID) { if (data.mPgpKnown) { @@ -629,6 +632,7 @@ void CreateCircleDialog::loadIdentities(uint32_t token) QTreeWidgetItem *item = new QTreeWidgetItem(); item->setText(RSCIRCLEID_COL_NICKNAME, nickname); + item->setIcon(RSCIRCLEID_COL_NICKNAME, QIcon(pixmap)); item->setText(RSCIRCLEID_COL_KEYID, keyId); item->setText(RSCIRCLEID_COL_IDTYPE, idtype); tree->addTopLevelItem(item); diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.h b/retroshare-gui/src/gui/Circles/CreateCircleDialog.h index fe08d0dab..d8a3865d4 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.h +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.h @@ -41,7 +41,7 @@ public: void editNewId(bool isExternal); void editExistingId(const RsGxsGroupId &circleId, const bool &clearList = true); - void addMember(const QString &keyId, const QString &idtype, const QString &nickname ); + void addMember(const QString &keyId, const QString &idtype, const QString &nickname); void addMember(const RsGxsIdGroup &idGroup); void addCircle(const RsGxsCircleDetails &cirDetails); @@ -73,7 +73,7 @@ private: void requestCircle(const RsGxsGroupId &groupId); void requestGxsIdentities(); - void getPgpIdentities(); + //void getPgpIdentities(); void filterIds(); diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui b/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui index 377d00c90..8abb10dd3 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui @@ -128,7 +128,7 @@ - Known Identities + Known People @@ -240,7 +240,11 @@ - + + + Circle name + + diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index 67e5b6279..151915d36 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -298,20 +298,20 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token) mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, true); /* add the top level item */ - QTreeWidgetItem *personalCirclesItem = new QTreeWidgetItem(); - personalCirclesItem->setText(0, tr("Personal Circles")); - ui->treeWidget_membership->addTopLevelItem(personalCirclesItem); + //QTreeWidgetItem *personalCirclesItem = new QTreeWidgetItem(); + //personalCirclesItem->setText(0, tr("Personal Circles")); + //ui->treeWidget_membership->addTopLevelItem(personalCirclesItem); QTreeWidgetItem *externalAdminCirclesItem = new QTreeWidgetItem(); - externalAdminCirclesItem->setText(0, tr("External Circles (Admin)")); + externalAdminCirclesItem->setText(0, tr("Circles (Admin)")); ui->treeWidget_membership->addTopLevelItem(externalAdminCirclesItem); QTreeWidgetItem *externalSubCirclesItem = new QTreeWidgetItem(); - externalSubCirclesItem->setText(0, tr("External Circles (Subscribed)")); + externalSubCirclesItem->setText(0, tr("Circles (Subscribed)")); ui->treeWidget_membership->addTopLevelItem(externalSubCirclesItem); QTreeWidgetItem *externalOtherCirclesItem = new QTreeWidgetItem(); - externalOtherCirclesItem->setText(0, tr("External Circles (Other)")); + externalOtherCirclesItem->setText(0, tr("Circles (Other)")); ui->treeWidget_membership->addTopLevelItem(externalOtherCirclesItem); for(vit = groupInfo.begin(); vit != groupInfo.end(); ++vit) @@ -327,7 +327,7 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token) if (vit->mCircleType == GXS_CIRCLE_TYPE_LOCAL) { - personalCirclesItem->addChild(groupItem); + //personalCirclesItem->addChild(groupItem); } else { From 4116f4b5cc88611927e4c422f89db6a77d8ea3b0 Mon Sep 17 00:00:00 2001 From: defnax Date: Fri, 11 Sep 2015 02:46:34 +0200 Subject: [PATCH 3/3] Added Context menus for Edit Circle or Add/Remove Member Changed for OK Button renaming to Create (New Mode) or Update(Edit Mode) --- .../src/gui/Circles/CreateCircleDialog.cpp | 37 ++++++++++++++++++- .../src/gui/Circles/CreateCircleDialog.h | 4 ++ .../src/gui/Circles/CreateCircleDialog.ui | 6 +++ retroshare-gui/src/gui/Identity/IdDialog.cpp | 16 ++++++++ retroshare-gui/src/gui/Identity/IdDialog.h | 1 + retroshare-gui/src/gui/Identity/IdDialog.ui | 3 ++ 6 files changed, 66 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp b/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp index 94403d384..34efb2638 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.cpp @@ -22,6 +22,7 @@ */ #include +#include #include #include "gui/Circles/CreateCircleDialog.h" @@ -64,6 +65,9 @@ CreateCircleDialog::CreateCircleDialog() connect(ui.treeWidget_membership, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedMember(QTreeWidgetItem*, QTreeWidgetItem*))); connect(ui.treeWidget_IdList, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(selectedId(QTreeWidgetItem*, QTreeWidgetItem*))); + connect(ui.treeWidget_IdList, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(IdListCustomPopupMenu(QPoint))); + connect(ui.treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(MembershipListCustomPopupMenu(QPoint))); + connect(ui.IdFilter, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString))); //connect(ui.toolButton_NewId, SIGNAL(clicked()), this, SLOT(createNewGxsId())); @@ -120,6 +124,7 @@ void CreateCircleDialog::editNewId(bool isExternal) { setupForExternalCircle(); ui.headerFrame->setHeaderText(tr("Create New Circle")); + ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create")); } else { @@ -152,6 +157,7 @@ void CreateCircleDialog::setupForExternalCircle() /* show distribution line */ ui.groupBox_title->setTitle(tr("Circle Details")); + ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Update")); ui.frame_PgpTypes->show(); ui.frame_Distribution->show(); ui.idChooserLabel->show(); @@ -697,10 +703,39 @@ void CreateCircleDialog::filterIds() ui.treeWidget_IdList->filterItems(filterColumn, text); } -void CreateCircleDialog::createNewGxsId() +void CreateCircleDialog::createNewGxsId() { IdEditDialog dlg(this); dlg.setupNewId(false); dlg.exec(); //ui.idChooser->setDefaultId(dlg.getLastIdName()); } + +void CreateCircleDialog::IdListCustomPopupMenu( QPoint ) +{ + QMenu contextMnu( this ); + + QTreeWidgetItem *item = ui.treeWidget_IdList->currentItem(); + if (item) { + + contextMnu.addAction(QIcon(":/images/edit_add24.png"), tr("Add Member"), this, SLOT(addMember())); + + } + + contextMnu.exec(QCursor::pos()); +} + +void CreateCircleDialog::MembershipListCustomPopupMenu( QPoint ) +{ + QMenu contextMnu( this ); + + QTreeWidgetItem *item = ui.treeWidget_membership->currentItem(); + if (item) { + + contextMnu.addAction(QIcon(":/images/delete.png"), tr("Remove Member"), this, SLOT(removeMember())); + + } + + contextMnu.exec(QCursor::pos()); +} + diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.h b/retroshare-gui/src/gui/Circles/CreateCircleDialog.h index d8a3865d4..a2c364ddb 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.h +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.h @@ -57,6 +57,10 @@ private slots: void createCircle(); void filterChanged(const QString &text); void createNewGxsId(); + + /** Create the context popup menu and it's submenus */ + void IdListCustomPopupMenu( QPoint point ); + void MembershipListCustomPopupMenu( QPoint point); private: diff --git a/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui b/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui index 8abb10dd3..057dad28b 100644 --- a/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui +++ b/retroshare-gui/src/gui/Circles/CreateCircleDialog.ui @@ -49,6 +49,9 @@ + + Qt::CustomContextMenu + true @@ -186,6 +189,9 @@ + + Qt::CustomContextMenu + true diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index 151915d36..8d7e3f8f1 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -248,6 +248,8 @@ IdDialog::IdDialog(QWidget *parent) : connect(ui->pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle())); connect(ui->pushButton_editCircle, SIGNAL(clicked()), this, SLOT(editExistingCircle())); connect(ui->treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected())); + connect(ui->treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CircleListCustomPopupMenu(QPoint))); + /* Setup TokenQueue */ mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this); @@ -370,6 +372,20 @@ void IdDialog::editExistingCircle() dlg.exec(); } +void IdDialog::CircleListCustomPopupMenu( QPoint ) +{ + QMenu contextMnu( this ); + + QTreeWidgetItem *item = ui->treeWidget_membership->currentItem(); + if (item) { + + contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Circle"), this, SLOT(editExistingCircle())); + + } + + contextMnu.exec(QCursor::pos()); +} + static void set_item_background(QTreeWidgetItem *item, uint32_t type) { QBrush brush; diff --git a/retroshare-gui/src/gui/Identity/IdDialog.h b/retroshare-gui/src/gui/Identity/IdDialog.h index 1400cc99a..53da66809 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.h +++ b/retroshare-gui/src/gui/Identity/IdDialog.h @@ -78,6 +78,7 @@ private slots: /** Create the context popup menu and it's submenus */ void IdListCustomPopupMenu( QPoint point ); + void CircleListCustomPopupMenu( QPoint point); void circle_selected(); private: diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui index 1f0c5cd8c..bd6b40043 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.ui +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -249,6 +249,9 @@ + + Qt::CustomContextMenu + true