diff --git a/retroshare-gui/src/gui/Identity/IdDialog.cpp b/retroshare-gui/src/gui/Identity/IdDialog.cpp index e4670297c..22c8571e5 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.cpp +++ b/retroshare-gui/src/gui/Identity/IdDialog.cpp @@ -93,6 +93,8 @@ #define RSID_FILTER_ALL 0xffff #define IMAGE_EDIT ":/images/edit_16.png" +#define IMAGE_CREATE ":/icons/circle_new_128.png" + // quick solution for RSID_COL_VOTES sorting class TreeWidgetItem : public QTreeWidgetItem { public: @@ -139,7 +141,6 @@ IdDialog::IdDialog(QWidget *parent) : mExternalOtherCircleItem = NULL ; mExternalSubCircleItem = NULL ; - mExternalAdminCircleItem = NULL ; /* Setup UI helper */ mStateHelper = new UIStateHelper(this); @@ -182,6 +183,7 @@ IdDialog::IdDialog(QWidget *parent) : /* Connect signals */ connect(ui->toolButton_NewId, SIGNAL(clicked()), this, SLOT(addIdentity())); + connect(ui->toolButton_NewCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle())); connect(ui->removeIdentity, SIGNAL(triggered()), this, SLOT(removeIdentity())); connect(ui->editIdentity, SIGNAL(triggered()), this, SLOT(editIdentity())); @@ -198,8 +200,10 @@ IdDialog::IdDialog(QWidget *parent) : ui->avlabel->setPixmap(QPixmap(":/images/user/friends64.png")); + ui->avlabel_Circles->setPixmap(QPixmap(":/icons/circles_128.png")); ui->headerTextLabel->setText(tr("People")); + ui->headerTextLabel_Circles->setText(tr("Circles")); /* Initialize splitter */ ui->splitter->setStretchFactor(0, 0); @@ -271,8 +275,8 @@ IdDialog::IdDialog(QWidget *parent) : // circles stuff - connect(ui->pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle())); - connect(ui->pushButton_editCircle, SIGNAL(clicked()), this, SLOT(showEditExistingCircle())); +// connect(ui->pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle())); +// connect(ui->pushButton_editCircle, SIGNAL(clicked()), this, SLOT(showEditExistingCircle())); connect(ui->treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected())); connect(ui->treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CircleListCustomPopupMenu(QPoint))); @@ -375,11 +379,11 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token) ui->treeWidget_membership->addTopLevelItem(mExternalSubCircleItem); } - if(!mExternalAdminCircleItem) + if(!mExternalLocalCircleItem) { - mExternalAdminCircleItem = new QTreeWidgetItem(); - mExternalAdminCircleItem->setText(0, tr("Circles I admin")); - ui->treeWidget_membership->addTopLevelItem(mExternalAdminCircleItem); + mExternalLocalCircleItem = new QTreeWidgetItem(); + mExternalLocalCircleItem->setText(0, tr("Local circles")); + ui->treeWidget_membership->addTopLevelItem(mExternalLocalCircleItem); } for(vit = groupInfo.begin(); vit != groupInfo.end();) @@ -408,17 +412,8 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token) QTreeWidgetItem *item = clist.front() ; bool subscribed = vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED ; - bool admin = vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN ; - if(admin && item->parent() != mExternalAdminCircleItem) - { - std::cerr << " (EE) weird. Existing group is not in admin sub-items although it is admin." << std::endl; - delete item ; - ++vit ; - continue ; - } - - if(subscribed && !admin && item->parent() != mExternalSubCircleItem) + if(subscribed && item->parent() != mExternalSubCircleItem) { #ifdef ID_DEBUG std::cerr << " Existing group is not in subscribed items although it is subscribed. Removing." << std::endl; @@ -427,7 +422,7 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token) ++vit ; continue ; } - if(!subscribed && !admin && item->parent() != mExternalOtherCircleItem) + if(!subscribed && item->parent() != mExternalOtherCircleItem) { #ifdef ID_DEBUG std::cerr << " Existing group is not in subscribed items although it is subscribed. Removing." << std::endl; @@ -465,14 +460,7 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token) groupItem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPID, QString::fromStdString(vit->mGroupId.toStdString())); groupItem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(vit->mSubscribeFlags)); - if (vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) - { -#ifdef ID_DEBUG - std::cerr << " adding item for group " << vit->mGroupId << " to admin"<< std::endl; -#endif - mExternalAdminCircleItem->addChild(groupItem); - } - else if (vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) + if (vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) { #ifdef ID_DEBUG std::cerr << " adding item for group " << vit->mGroupId << " to subscribed"<< std::endl; @@ -486,6 +474,15 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token) #endif mExternalOtherCircleItem->addChild(groupItem); } + + if (vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) + { + QFont font = groupItem->font(CIRCLEGROUP_CIRCLE_COL_GROUPNAME) ; + font.setBold(true) ; + groupItem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,font) ; + groupItem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPID,font) ; + groupItem->setFont(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS,font) ; + } } } @@ -580,19 +577,24 @@ void IdDialog::showEditExistingCircle() void IdDialog::CircleListCustomPopupMenu( QPoint ) { - // (cyril) Removed this because we have a edit button already. -#ifdef SUSPENDED QMenu contextMnu( this ); QTreeWidgetItem *item = ui->treeWidget_membership->currentItem(); - if (item) { + + contextMnu.addAction(QIcon(IMAGE_CREATE), tr("Create Circle"), this, SLOT(createExternalCircle())); + + if (item) + { + uint32_t subscribe_flags = item->data(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole).toUInt(); - contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Circle"), this, SLOT(editExistingCircle())); - + if(item->parent() != NULL) + if(subscribe_flags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) + contextMnu.addAction(QIcon(IMAGE_EDIT), tr("Edit Circle"), this, SLOT(showEditExistingCircle())); + else + contextMnu.addAction(QIcon(IMAGE_EDIT), tr("See details"), this, SLOT(showEditExistingCircle())); } - + contextMnu.exec(QCursor::pos()); -#endif } static void set_item_background(QTreeWidgetItem *item, uint32_t type) @@ -675,13 +677,13 @@ void IdDialog::circle_selected() if ((!item) || (!item->parent())) { - mStateHelper->setWidgetEnabled(ui->pushButton_editCircle, false); - ui->pushButton_editCircle->setText(tr("Show details")) ; - ui->pushButton_editCircle->setEnabled(false) ; + //mStateHelper->setWidgetEnabled(ui->pushButton_editCircle, false); + //ui->pushButton_editCircle->setText(tr("Show details")) ; + //ui->pushButton_editCircle->setEnabled(false) ; mark_matching_tree(ui->idTreeWidget, std::set(), RSID_COL_KEYID) ; return; } - +#ifdef TO_REMOVE uint32_t subscribe_flags = item->data(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole).toUInt(); ui->pushButton_editCircle->setEnabled(true) ; @@ -689,6 +691,7 @@ void IdDialog::circle_selected() ui->pushButton_editCircle->setText(tr("Edit circle")) ; else ui->pushButton_editCircle->setText(tr("Show details")) ; +#endif //set_item_background(item, BLUE_BACKGROUND); @@ -1120,7 +1123,6 @@ void IdDialog::insertIdDetails(uint32_t token) #endif ui->avlabel->setPixmap(pixmap); - ui->avatarLabel->setPixmap(pixmap); if (data.mPgpKnown) diff --git a/retroshare-gui/src/gui/Identity/IdDialog.h b/retroshare-gui/src/gui/Identity/IdDialog.h index 6ffac2c6f..a550301d1 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.h +++ b/retroshare-gui/src/gui/Identity/IdDialog.h @@ -126,7 +126,7 @@ private: QTreeWidgetItem *ownItem; QTreeWidgetItem *mExternalSubCircleItem; QTreeWidgetItem *mExternalOtherCircleItem; - QTreeWidgetItem *mExternalAdminCircleItem; + QTreeWidgetItem *mExternalLocalCircleItem; RsGxsUpdateBroadcastBase *mCirclesBroadcastBase ; RsGxsGroupId mId; diff --git a/retroshare-gui/src/gui/Identity/IdDialog.ui b/retroshare-gui/src/gui/Identity/IdDialog.ui index 70746c5f0..cff96f3cd 100644 --- a/retroshare-gui/src/gui/Identity/IdDialog.ui +++ b/retroshare-gui/src/gui/Identity/IdDialog.ui @@ -20,16 +20,7 @@ - - 0 - - - 0 - - - 0 - - + 0 @@ -47,16 +38,7 @@ QFrame::Sunken - - 2 - - - 2 - - - 2 - - + 2 @@ -147,18 +129,6 @@ QFrame::Sunken - - 2 - - - 2 - - - 2 - - - 2 - @@ -197,6 +167,38 @@ + + + + + 0 + 0 + + + + Qt::NoFocus + + + Create new circle + + + New ID + + + + :/icons/circles_new_128.png:/icons/circles_new_128.png + + + + 24 + 24 + + + + true + + + @@ -252,7 +254,7 @@ Reputation - AlignLeading|AlignVCenter + AlignLeft|AlignVCenter @@ -261,9 +263,13 @@ - 0 + 1 + + + :/images/no_avatar_background.png:/images/no_avatar_background.png + Person @@ -325,16 +331,7 @@ - - 6 - - - 6 - - - 6 - - + 6 @@ -508,16 +505,7 @@ - - 6 - - - 6 - - - 6 - - + 6 @@ -565,7 +553,7 @@ p, li { white-space: pre-wrap; } - ../../../../../trunk/retroshare-gui/src/gui/icons/yellow_biohazard64.png../../../../../trunk/retroshare-gui/src/gui/icons/yellow_biohazard64.png + ../icons/yellow_biohazard64.png../icons/yellow_biohazard64.png @@ -629,42 +617,62 @@ p, li { white-space: pre-wrap; } + + + :/images/circles/circles_64.png:/images/circles/circles_64.png + Circles - - - - - - - Create Circle - - - - - - - Edit Circle - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + 12 + + + + + + 64 + 64 + + + + + 64 + 64 + + + + + + + + + + true + + + + + + + Circles + + + + + - + Qt::CustomContextMenu @@ -761,6 +769,7 @@ p, li { white-space: pre-wrap; } + diff --git a/retroshare-gui/src/gui/icons.qrc b/retroshare-gui/src/gui/icons.qrc index 0a7f8342a..1c5d42952 100644 --- a/retroshare-gui/src/gui/icons.qrc +++ b/retroshare-gui/src/gui/icons.qrc @@ -19,6 +19,7 @@ icons/chat_128.png icons/chat_red_128.png icons/circles_128.png + icons/circles_new_128.png icons/friends_128.png icons/global_switch_off_128.png icons/global_switch_on_128.png diff --git a/retroshare-gui/src/gui/icons/circles_new_128.png b/retroshare-gui/src/gui/icons/circles_new_128.png new file mode 100644 index 000000000..7c2c1099c Binary files /dev/null and b/retroshare-gui/src/gui/icons/circles_new_128.png differ