removed Edit/New circles buttons, put them in context menu. Added header frame (needs a proper look)

This commit is contained in:
csoler 2016-04-10 10:53:21 -04:00
parent c9c15e58f2
commit 4fe66d67ef
5 changed files with 138 additions and 126 deletions

View File

@ -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<RsGxsId>(), 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)

View File

@ -126,7 +126,7 @@ private:
QTreeWidgetItem *ownItem;
QTreeWidgetItem *mExternalSubCircleItem;
QTreeWidgetItem *mExternalOtherCircleItem;
QTreeWidgetItem *mExternalAdminCircleItem;
QTreeWidgetItem *mExternalLocalCircleItem;
RsGxsUpdateBroadcastBase *mCirclesBroadcastBase ;
RsGxsGroupId mId;

View File

@ -20,16 +20,7 @@
<string/>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
@ -47,16 +38,7 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>2</number>
</property>
<item>
@ -147,18 +129,6 @@
<enum>QFrame::Sunken</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>2</number>
</property>
<property name="topMargin">
<number>2</number>
</property>
<property name="rightMargin">
<number>2</number>
</property>
<property name="bottomMargin">
<number>2</number>
</property>
<item>
<widget class="LineEditClear" name="filterLineEdit"/>
</item>
@ -197,6 +167,38 @@
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_NewCircle">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
<property name="toolTip">
<string>Create new circle</string>
</property>
<property name="text">
<string>New ID</string>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/icons/circles_new_128.png</normaloff>:/icons/circles_new_128.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -252,7 +254,7 @@
<string>Reputation</string>
</property>
<property name="textAlignment">
<set>AlignLeading|AlignVCenter</set>
<set>AlignLeft|AlignVCenter</set>
</property>
</column>
</widget>
@ -261,9 +263,13 @@
</widget>
<widget class="QTabWidget" name="tabWidget1">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_2">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/no_avatar_background.png</normaloff>:/images/no_avatar_background.png</iconset>
</attribute>
<attribute name="title">
<string>Person</string>
</attribute>
@ -325,16 +331,7 @@
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>6</number>
</property>
<property name="spacing">
@ -508,16 +505,7 @@
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>6</number>
</property>
<property name="topMargin">
<number>6</number>
</property>
<property name="rightMargin">
<number>6</number>
</property>
<property name="bottomMargin">
<property name="margin">
<number>6</number>
</property>
<item row="2" column="1">
@ -565,7 +553,7 @@ p, li { white-space: pre-wrap; }
</property>
<property name="icon">
<iconset>
<normaloff>../../../../../trunk/retroshare-gui/src/gui/icons/yellow_biohazard64.png</normaloff>../../../../../trunk/retroshare-gui/src/gui/icons/yellow_biohazard64.png</iconset>
<normaloff>../icons/yellow_biohazard64.png</normaloff>../icons/yellow_biohazard64.png</iconset>
</property>
</item>
<item>
@ -629,42 +617,62 @@ p, li { white-space: pre-wrap; }
</layout>
</widget>
<widget class="QWidget" name="tab">
<attribute name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/circles/circles_64.png</normaloff>:/images/circles/circles_64.png</iconset>
</attribute>
<attribute name="title">
<string>Circles</string>
</attribute>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_7">
<item>
<widget class="QPushButton" name="pushButton_extCircle">
<property name="text">
<string>Create Circle</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_editCircle">
<property name="text">
<string>Edit Circle</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<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>
<layout class="QVBoxLayout" name="verticalLayout_6">
<item>
<widget class="QFrame" name="headerFrame_2">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_5">
<property name="horizontalSpacing">
<number>12</number>
</property>
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="avlabel_Circles">
<property name="minimumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>64</width>
<height>64</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text">
<string/>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1" rowspan="2" colspan="2">
<widget class="StyledElidedLabel" name="headerTextLabel_Circles">
<property name="text">
<string>Circles</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<item>
<widget class="QTreeWidget" name="treeWidget_membership">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
@ -761,6 +769,7 @@ p, li { white-space: pre-wrap; }
</tabstops>
<resources>
<include location="../images.qrc"/>
<include location="../icons.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -19,6 +19,7 @@
<file>icons/chat_128.png</file>
<file>icons/chat_red_128.png</file>
<file>icons/circles_128.png</file>
<file>icons/circles_new_128.png</file>
<file>icons/friends_128.png</file>
<file>icons/global_switch_off_128.png</file>
<file>icons/global_switch_on_128.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB