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 = QString::fromUtf8(info.name.c_str());
desc += " (Node group) [";
desc += QString::fromStdString(info.id.toStdString().substr(0,5));
desc += "...]";
if(info.name.empty())
desc = tr("[Unknown]") ;
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;
}
@ -76,7 +82,7 @@ void GroupChooser::loadGroups()
{
/* add to Chooser */
QString str;
if (!MakeNodeGroupDesc(*it, str))
if (!makeNodeGroupDesc(*it, str))
{
std::cerr << "GroupChooser::loadGroups() ERROR Desc for Id: " << it->id;
std::cerr << std::endl;

View File

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

View File

@ -392,87 +392,97 @@ void GxsGroupDialog::newGroup()
void GxsGroupDialog::updateFromExistingMeta(const QString &description)
{
std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
std::cerr << std::endl;
std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
std::cerr << std::endl;
std::cerr << "void GxsGroupDialog::updateFromExistingMeta() mGrpMeta.mCircleType: ";
std::cerr << mGrpMeta.mCircleType << " Internal: " << mGrpMeta.mInternalCircle;
std::cerr << " External: " << mGrpMeta.mCircleId;
std::cerr << std::endl;
std::cerr << "void GxsGroupDialog::updateFromExistingMeta() mGrpMeta.mCircleType: ";
std::cerr << mGrpMeta.mCircleType << " Internal: " << mGrpMeta.mInternalCircle;
std::cerr << " External: " << mGrpMeta.mCircleId;
std::cerr << std::endl;
setupDefaults();
setupVisibility();
setupReadonly();
clearForm();
setGroupSignFlags(mGrpMeta.mSignFlags) ;
setupDefaults();
setupVisibility();
setupReadonly();
clearForm();
setGroupSignFlags(mGrpMeta.mSignFlags) ;
/* setup name */
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
/* Show Mode */
ui.nameline->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
ui.popline->setText(QString::number( mGrpMeta.mPop)) ;
ui.postsline->setText(QString::number(mGrpMeta.mVisibleMsgCount));
ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost));
/* setup name */
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
/* Show Mode */
ui.nameline->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
ui.popline->setText(QString::number( mGrpMeta.mPop)) ;
ui.postsline->setText(QString::number(mGrpMeta.mVisibleMsgCount));
ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost));
ui.authorLabel->setId(mGrpMeta.mAuthorId);
ui.IDline->setText(QString::fromStdString(mGrpMeta.mGroupId.toStdString()));
ui.descriptiontextEdit->setPlainText(description);
switch (mode())
{
case MODE_CREATE:{
}
break;
case MODE_SHOW:{
ui.headerFrame->setHeaderText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
if (!mPicture.isNull())
ui.headerFrame->setHeaderImage(mPicture);
}
break;
case MODE_EDIT:{
}
break;
}
/* set description */
ui.groupDesc->setPlainText(description);
QString distribution_string = "[Unknown]";
ui.IDline->setText(QString::fromStdString(mGrpMeta.mGroupId.toStdString()));
ui.descriptiontextEdit->setPlainText(description);
switch(mGrpMeta.mCircleType)
{
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
ui.typeLocal->setChecked(true);
distribution_string = tr("Your friends only") ;
ui.localComboBox->loadGroups(0, RsNodeGroupId(mGrpMeta.mInternalCircle));
ui.distributionCircleComboBox->setVisible(false) ;
ui.localComboBox->setVisible(true) ;
break;
case GXS_CIRCLE_TYPE_PUBLIC:
ui.typePublic->setChecked(true);
distribution_string = tr("Public") ;
ui.distributionCircleComboBox->setVisible(false) ;
ui.localComboBox->setVisible(false) ;
break;
case GXS_CIRCLE_TYPE_EXTERNAL:
ui.typeGroup->setChecked(true);
distribution_string = tr("Restricted to circle:") ;
ui.localComboBox->setVisible(false) ;
ui.distributionCircleComboBox->setVisible(true) ;
ui.distributionCircleComboBox->loadCircles(mGrpMeta.mCircleId);
ui.circleComboBox->loadCircles(mGrpMeta.mCircleId);
break;
default:
std::cerr << "CreateCircleDialog::updateCircleGUI() INVALID mCircleType";
std::cerr << std::endl;
break;
}
switch (mode())
{
case MODE_CREATE:{
}
break;
case MODE_SHOW:{
ui.headerFrame->setHeaderText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
if (!mPicture.isNull())
ui.headerFrame->setHeaderImage(mPicture);
}
break;
case MODE_EDIT:{
}
break;
}
/* set description */
ui.groupDesc->setPlainText(description);
QString distribution_string = "[Unknown]";
switch(mGrpMeta.mCircleType)
{
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
{
ui.typeLocal->setChecked(true);
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.distributionCircleComboBox->setVisible(false) ;
ui.localComboBox->setVisible(true) ;
}
break;
case GXS_CIRCLE_TYPE_PUBLIC:
ui.typePublic->setChecked(true);
distribution_string = tr("Public") ;
ui.distributionCircleComboBox->setVisible(false) ;
ui.localComboBox->setVisible(false) ;
break;
case GXS_CIRCLE_TYPE_EXTERNAL:
ui.typeGroup->setChecked(true);
distribution_string = tr("Restricted to circle:") ;
ui.localComboBox->setVisible(false) ;
ui.distributionCircleComboBox->setVisible(true) ;
ui.distributionCircleComboBox->loadCircles(mGrpMeta.mCircleId);
ui.circleComboBox->loadCircles(mGrpMeta.mCircleId);
break;
default:
std::cerr << "CreateCircleDialog::updateCircleGUI() INVALID mCircleType";
std::cerr << std::endl;
break;
}
ui.distributionValueLabel->setText(distribution_string) ;
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
if(!mGrpMeta.mAuthorId.isNull())
ui.idChooser->setChosenId(mGrpMeta.mAuthorId) ;
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
updateCircleOptions();
if(!mGrpMeta.mAuthorId.isNull())
ui.idChooser->setChosenId(mGrpMeta.mAuthorId) ;
updateCircleOptions();
}
void GxsGroupDialog::submitGroup()

View File

@ -301,6 +301,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</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">
<string>Public</string>
</property>
@ -326,6 +329,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</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">
<string>Restricted to Circle</string>
</property>
@ -356,6 +362,9 @@
<verstretch>0</verstretch>
</sizepolicy>
</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">
<string>Only For Your Friends</string>
</property>

View File

@ -817,9 +817,20 @@ void GxsForumThreadWidget::insertGroupData()
distrib_string = tr("Restricted to members of circle ")+QString::fromStdString(group.mMeta.mCircleId.toStdString()) ;
}
break ;
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY: distrib_string = tr("Your eyes only");
break ;
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("You and your friend nodes");
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 ;
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 ;
default:
std::cerr << "(EE) badly initialised group distribution ID = " << group.mMeta.mCircleType << std::endl;