mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-28 02:24:18 -04:00
fixed display of group node restriction in GxsGroupDialog and info
This commit is contained in:
parent
45b189c080
commit
931c3df282
5 changed files with 120 additions and 83 deletions
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -392,87 +392,97 @@ void GxsGroupDialog::newGroup()
|
||||||
|
|
||||||
void GxsGroupDialog::updateFromExistingMeta(const QString &description)
|
void GxsGroupDialog::updateFromExistingMeta(const QString &description)
|
||||||
{
|
{
|
||||||
std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
|
std::cerr << "void GxsGroupDialog::updateFromExistingMeta()";
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::cerr << "void GxsGroupDialog::updateFromExistingMeta() mGrpMeta.mCircleType: ";
|
std::cerr << "void GxsGroupDialog::updateFromExistingMeta() mGrpMeta.mCircleType: ";
|
||||||
std::cerr << mGrpMeta.mCircleType << " Internal: " << mGrpMeta.mInternalCircle;
|
std::cerr << mGrpMeta.mCircleType << " Internal: " << mGrpMeta.mInternalCircle;
|
||||||
std::cerr << " External: " << mGrpMeta.mCircleId;
|
std::cerr << " External: " << mGrpMeta.mCircleId;
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
setupDefaults();
|
setupDefaults();
|
||||||
setupVisibility();
|
setupVisibility();
|
||||||
setupReadonly();
|
setupReadonly();
|
||||||
clearForm();
|
clearForm();
|
||||||
setGroupSignFlags(mGrpMeta.mSignFlags) ;
|
setGroupSignFlags(mGrpMeta.mSignFlags) ;
|
||||||
|
|
||||||
/* setup name */
|
/* setup name */
|
||||||
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
|
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
|
||||||
|
|
||||||
/* Show Mode */
|
/* Show Mode */
|
||||||
ui.nameline->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
|
ui.nameline->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
|
||||||
ui.popline->setText(QString::number( mGrpMeta.mPop)) ;
|
ui.popline->setText(QString::number( mGrpMeta.mPop)) ;
|
||||||
ui.postsline->setText(QString::number(mGrpMeta.mVisibleMsgCount));
|
ui.postsline->setText(QString::number(mGrpMeta.mVisibleMsgCount));
|
||||||
ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost));
|
ui.lastpostline->setText(DateTime::formatLongDateTime(mGrpMeta.mLastPost));
|
||||||
ui.authorLabel->setId(mGrpMeta.mAuthorId);
|
ui.authorLabel->setId(mGrpMeta.mAuthorId);
|
||||||
ui.IDline->setText(QString::fromStdString(mGrpMeta.mGroupId.toStdString()));
|
ui.IDline->setText(QString::fromStdString(mGrpMeta.mGroupId.toStdString()));
|
||||||
ui.descriptiontextEdit->setPlainText(description);
|
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]";
|
|
||||||
|
|
||||||
switch(mGrpMeta.mCircleType)
|
switch (mode())
|
||||||
{
|
{
|
||||||
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
|
case MODE_CREATE:{
|
||||||
ui.typeLocal->setChecked(true);
|
}
|
||||||
distribution_string = tr("Your friends only") ;
|
break;
|
||||||
ui.localComboBox->loadGroups(0, RsNodeGroupId(mGrpMeta.mInternalCircle));
|
case MODE_SHOW:{
|
||||||
ui.distributionCircleComboBox->setVisible(false) ;
|
ui.headerFrame->setHeaderText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
|
||||||
ui.localComboBox->setVisible(true) ;
|
if (!mPicture.isNull())
|
||||||
break;
|
ui.headerFrame->setHeaderImage(mPicture);
|
||||||
case GXS_CIRCLE_TYPE_PUBLIC:
|
}
|
||||||
ui.typePublic->setChecked(true);
|
break;
|
||||||
distribution_string = tr("Public") ;
|
case MODE_EDIT:{
|
||||||
ui.distributionCircleComboBox->setVisible(false) ;
|
}
|
||||||
ui.localComboBox->setVisible(false) ;
|
break;
|
||||||
break;
|
}
|
||||||
case GXS_CIRCLE_TYPE_EXTERNAL:
|
/* set description */
|
||||||
ui.typeGroup->setChecked(true);
|
ui.groupDesc->setPlainText(description);
|
||||||
distribution_string = tr("Restricted to circle:") ;
|
QString distribution_string = "[Unknown]";
|
||||||
ui.localComboBox->setVisible(false) ;
|
|
||||||
ui.distributionCircleComboBox->setVisible(true) ;
|
switch(mGrpMeta.mCircleType)
|
||||||
ui.distributionCircleComboBox->loadCircles(mGrpMeta.mCircleId);
|
{
|
||||||
ui.circleComboBox->loadCircles(mGrpMeta.mCircleId);
|
case GXS_CIRCLE_TYPE_YOUR_FRIENDS_ONLY:
|
||||||
break;
|
{
|
||||||
default:
|
ui.typeLocal->setChecked(true);
|
||||||
std::cerr << "CreateCircleDialog::updateCircleGUI() INVALID mCircleType";
|
distribution_string = tr("Only friends nodes in group ") ;
|
||||||
std::cerr << std::endl;
|
|
||||||
break;
|
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.distributionValueLabel->setText(distribution_string) ;
|
||||||
|
|
||||||
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
|
ui.idChooser->loadIds(0, mGrpMeta.mAuthorId);
|
||||||
|
|
||||||
if(!mGrpMeta.mAuthorId.isNull())
|
|
||||||
ui.idChooser->setChosenId(mGrpMeta.mAuthorId) ;
|
|
||||||
|
|
||||||
updateCircleOptions();
|
if(!mGrpMeta.mAuthorId.isNull())
|
||||||
|
ui.idChooser->setChosenId(mGrpMeta.mAuthorId) ;
|
||||||
|
|
||||||
|
updateCircleOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsGroupDialog::submitGroup()
|
void GxsGroupDialog::submitGroup()
|
||||||
|
|
|
@ -301,6 +301,9 @@
|
||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="toolTip">
|
||||||
|
<string><html><head/><body><p>Messsages will spread way beyond your friend nodes, as long as people subscribe to the channel/forum/posted you're creating.</p></body></html></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><html><head/><body><p>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. </p></body></html></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><html><head/><body><p>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.</p></body></html></string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Only For Your Friends</string>
|
<string>Only For Your Friends</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -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:
|
||||||
break ;
|
{
|
||||||
case GXS_CIRCLE_TYPE_LOCAL: distrib_string = tr("You and your friend nodes");
|
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 ;
|
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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue