fixed display of group node restriction in GxsGroupDialog and info

This commit is contained in:
csoler 2016-07-11 21:33:09 -04:00
parent 45b189c080
commit 931c3df282
5 changed files with 120 additions and 83 deletions

View File

@ -44,14 +44,20 @@ void GroupChooser::loadGroups(uint32_t chooserFlags, const RsNodeGroupId& defaul
} }
static bool MakeNodeGroupDesc(const RsGroupInfo& info, QString &desc) bool GroupChooser::makeNodeGroupDesc(const RsGroupInfo& info, QString &desc)
{ {
desc.clear(); desc.clear();
desc = QString::fromUtf8(info.name.c_str());
desc += " (Node group) ["; if(info.name.empty())
desc += QString::fromStdString(info.id.toStdString().substr(0,5)); desc = tr("[Unknown]") ;
desc += "...]"; else
desc = "\"" + QString::fromUtf8(info.name.c_str()) + "\"";
desc += " [" ;
desc += QString::fromStdString(info.id.toStdString().substr(0,3));
desc += "...";
desc += QString::fromStdString(info.id.toStdString().substr(info.id.toStdString().length()-2,2));
desc += "]";
return true; return true;
} }
@ -76,7 +82,7 @@ void GroupChooser::loadGroups()
{ {
/* add to Chooser */ /* add to Chooser */
QString str; QString str;
if (!MakeNodeGroupDesc(*it, str)) if (!makeNodeGroupDesc(*it, str))
{ {
std::cerr << "GroupChooser::loadGroups() ERROR Desc for Id: " << it->id; std::cerr << "GroupChooser::loadGroups() ERROR Desc for Id: " << it->id;
std::cerr << std::endl; std::cerr << std::endl;

View File

@ -25,7 +25,7 @@
#pragma once #pragma once
#include <QComboBox> #include <QComboBox>
#include <retroshare/rsgxscircles.h> #include <retroshare/rspeers.h>
class GroupChooser : public QComboBox class GroupChooser : public QComboBox
{ {
@ -35,6 +35,7 @@ public:
void loadGroups(uint32_t chooserFlags, const RsNodeGroupId& defaultId); void loadGroups(uint32_t chooserFlags, const RsNodeGroupId& defaultId);
bool getChosenGroup(RsNodeGroupId& id); bool getChosenGroup(RsNodeGroupId& id);
static bool makeNodeGroupDesc(const RsGroupInfo& info, QString &desc);
private: private:
void loadGroups(); void loadGroups();
uint32_t mFlags; uint32_t mFlags;

View File

@ -440,11 +440,21 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description)
switch(mGrpMeta.mCircleType) switch(mGrpMeta.mCircleType)
{ {
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY: case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
{
ui.typeLocal->setChecked(true); ui.typeLocal->setChecked(true);
distribution_string = tr("Your friends only") ; distribution_string = tr("Only friends nodes in group ") ;
RsGroupInfo ginfo ;
rsPeers->getGroupInfo(RsNodeGroupId(mGrpMeta.mInternalCircle),ginfo) ;
QString desc;
GroupChooser::makeNodeGroupDesc(ginfo, desc);
distribution_string += desc ;
ui.localComboBox->loadGroups(0, RsNodeGroupId(mGrpMeta.mInternalCircle)); ui.localComboBox->loadGroups(0, RsNodeGroupId(mGrpMeta.mInternalCircle));
ui.distributionCircleComboBox->setVisible(false) ; ui.distributionCircleComboBox->setVisible(false) ;
ui.localComboBox->setVisible(true) ; ui.localComboBox->setVisible(true) ;
}
break; break;
case GXS_CIRCLE_TYPE_PUBLIC: case GXS_CIRCLE_TYPE_PUBLIC:
ui.typePublic->setChecked(true); ui.typePublic->setChecked(true);

View File

@ -301,6 +301,9 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Messsages will spread way beyond your friend nodes, as long as people subscribe to the channel/forum/posted you're creating.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text"> <property name="text">
<string>Public</string> <string>Public</string>
</property> </property>
@ -326,6 +329,9 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Messages will spread among Retroshare nodes that host one of the identities listed as member of the circle and who also subscribe the media. Only these nodes will be able to see that this forum/channel/posted media exists. &lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text"> <property name="text">
<string>Restricted to Circle</string> <string>Restricted to Circle</string>
</property> </property>
@ -356,6 +362,9 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Messages will only be distributed to the selected subset of your friend nodes. They will not forward messages with each other, but only use your own node as a central hub to distribute them.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text"> <property name="text">
<string>Only For Your Friends</string> <string>Only For Your Friends</string>
</property> </property>

View File

@ -817,9 +817,20 @@ void GxsForumThreadWidget::insertGroupData()
distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ; distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ;
} }
break ; break ;
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY: distrib_string = tr("Your eyes only"); case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
{
distrib_string = tr("Only friends nodes in group ") ;
RsGroupInfo ginfo ;
rsPeers->getGroupInfo(RsNodeGroupId(group.mMeta.mInternalCircle),ginfo) ;
QString desc;
GroupChooser::makeNodeGroupDesc(ginfo, desc);
distrib_string += desc ;
}
break ; break ;
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("You and your friend nodes");
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("Your eyes only"); // this is not yet supported. If you see this, it is a bug!
break ; break ;
default: default:
std::cerr << "(EE) badly initialised group distribution ID = " << group.mMeta.mCircleType << std::endl; std::cerr << "(EE) badly initialised group distribution ID = " << group.mMeta.mCircleType << std::endl;