From c304a3a86a58159bafe8c33fc38c48890fc645cb Mon Sep 17 00:00:00 2001 From: csoler Date: Sun, 20 Mar 2016 22:21:09 -0400 Subject: [PATCH] fixed display of properties in restricted groups --- TODO.circles.txt | 4 +- retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp | 77 ++-- retroshare-gui/src/gui/gxs/GxsGroupDialog.ui | 426 +++++------------- 3 files changed, 159 insertions(+), 348 deletions(-) diff --git a/TODO.circles.txt b/TODO.circles.txt index b032cb623..d793dbed8 100644 --- a/TODO.circles.txt +++ b/TODO.circles.txt @@ -13,8 +13,8 @@ GUI [ ] update TS of groups linked to a modified circle, so as to cause updates when a new member is addded to the group [ ] forums GUI should show correct restriction options for restricted forums - [ ] changing a circle's name should update the GUI - [ ] make sure we canot post in forums using IDs that are not in the circle + [X] changing a circle's name should update the GUI + [ ] make sure we cannot post in forums using IDs that are not in the circle [ ] make sure unauthorised ids are rejected when validating posts from a circle restricted group [ ] add GUI for local circles in circle GUI [ ] share publish rights between circles diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp index 353f509c0..dfa80dbe8 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp @@ -103,7 +103,7 @@ void GxsGroupDialog::init() connect(ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo())); ui.typePublic->setChecked(true); - ui.typePublic_3->setChecked(true); + ui.distributionValueLabel->setText(tr("Public")); updateCircleOptions(); connect(ui.typePublic, SIGNAL(clicked()), this , SLOT(updateCircleOptions())); @@ -218,23 +218,25 @@ void GxsGroupDialog::setupDefaults() if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC) { ui.typePublic->setChecked(true); - ui.typePublic_3->setChecked(true); + ui.distributionValueLabel->setText(tr("Public")); + ui.distributionCircleComboBox->setVisible(false) ; } else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_GROUP) { ui.typeGroup->setChecked(true); - ui.typeGroup_3->setChecked(true); + ui.distributionValueLabel->setText(tr("Restricted to circle:")); + ui.distributionCircleComboBox->setVisible(true) ; } else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_LOCAL) { ui.typeLocal->setChecked(true); - ui.typeLocal_3->setChecked(true); + ui.distributionValueLabel->setText(tr("Limited to your friends")); + ui.distributionCircleComboBox->setVisible(false) ; } else { // default ui.typePublic->setChecked(true); - ui.typePublic_3->setChecked(true); } } @@ -285,24 +287,28 @@ void GxsGroupDialog::setupDefaults() if (mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_YES) { ui.comments_allowed->setChecked(true); - ui.comments_allowed_3->setChecked(true); + ui.commentsValueLabel->setText(tr("Allowed")); } else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_NO) { ui.comments_no->setChecked(true); - ui.comments_no_3->setChecked(true); + ui.commentsValueLabel->setText(tr("Disallowed")); } else { // default ui.comments_no->setChecked(true); - ui.comments_no_3->setChecked(true); + ui.commentsValueLabel->setText(tr("Allowed")); } } ui.antiSpam_trackMessages->setChecked((bool)(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_TRACK)); ui.antiSpam_signedIds->setChecked((bool)(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP)); - ui.antiSpam_trackMessages_2->setChecked((bool)(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_TRACK)); - ui.antiSpam_signedIds_2->setChecked((bool)(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP)); + + QString antispam_string ; + if(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_TRACK) antispam_string += tr("Message tracking") ; + if(mDefaultsFlags & GXS_GROUP_DEFAULTS_ANTISPAM_FAVOR_PGP) antispam_string += (antispam_string.isNull()?"":" and ")+tr("PGP signature required") ; + + ui.antiSpamValueLabel->setText(antispam_string) ; #ifndef RS_USE_CIRCLES ui.typeGroup->setEnabled(false); @@ -322,10 +328,12 @@ void GxsGroupDialog::setupVisibility() ui.groupDesc->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION); ui.distribGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION); - ui.distribGroupBox_2->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION); + ui.distributionLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION); + ui.distributionValueLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION); ui.spamProtection_GB->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ANTI_SPAM); - ui.spamProtection_GB_2->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ANTI_SPAM); + ui.antiSpamLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ANTI_SPAM); + ui.antiSpamValueLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ANTI_SPAM); ui.publishGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PUBLISHSIGN); @@ -334,8 +342,9 @@ void GxsGroupDialog::setupVisibility() ui.personalGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PERSONALSIGN); ui.commentGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS); - ui.commentGroupBox_2->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS); - ui.commentslabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS); + ui.commentsLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS); + ui.commentsValueLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS); + //ui.commentslabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS); ui.extraFrame->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_EXTRA); } @@ -363,10 +372,10 @@ void GxsGroupDialog::setupReadonly() ui.idChooser->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN)); - ui.distribGroupBox_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION)); - ui.commentGroupBox_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_COMMENTS)); + //ui.distribGroupBox_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION)); + //ui.commentGroupBox_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_COMMENTS)); ui.spamProtection_GB->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ANTI_SPAM)); - ui.spamProtection_GB_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ANTI_SPAM)); + //ui.spamProtection_GB_2->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ANTI_SPAM)); ui.extraFrame->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_EXTRA)); #ifndef UNFINISHED @@ -417,9 +426,8 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description) break; case MODE_SHOW:{ ui.headerFrame->setHeaderText(QString::fromUtf8(mGrpMeta.mGroupName.c_str())); - if (mPicture.isNull()) - return; - ui.headerFrame->setHeaderImage(mPicture); + if (!mPicture.isNull()) + ui.headerFrame->setHeaderImage(mPicture); } break; case MODE_EDIT:{ @@ -428,21 +436,27 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description) } /* set description */ ui.groupDesc->setPlainText(description); + QString distribution_string = "[Unknown]"; switch(mGrpMeta.mCircleType) { case GXS_CIRCLE_TYPE_YOUREYESONLY: ui.typeLocal->setChecked(true); - ui.typeLocal_3->setChecked(true); + distribution_string = tr("Your friends only") ; ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle); + ui.distributionCircleComboBox->setVisible(true) ; + ui.distributionCircleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle); break; case GXS_CIRCLE_TYPE_PUBLIC: ui.typePublic->setChecked(true); - ui.typePublic_3->setChecked(true); + distribution_string = tr("Public") ; + ui.distributionCircleComboBox->setVisible(false) ; break; case GXS_CIRCLE_TYPE_EXTERNAL: ui.typeGroup->setChecked(true); - ui.typeGroup_3->setChecked(true); + distribution_string = tr("Restricted to circle:") ; + ui.distributionCircleComboBox->setVisible(true) ; + ui.distributionCircleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mGrpMeta.mCircleId); ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mGrpMeta.mCircleId); break; default: @@ -450,6 +464,7 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description) std::cerr << std::endl; break; } + ui.distributionValueLabel->setText(distribution_string) ; ui.idChooser->loadIds(0, mGrpMeta.mAuthorId); @@ -642,8 +657,14 @@ void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags) ui.antiSpam_trackMessages ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) ); ui.antiSpam_signedIds ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) ); - ui.antiSpam_trackMessages_2->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) ); - ui.antiSpam_signedIds_2 ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) ); + + QString antispam_string ; + if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) antispam_string += tr("Message tracking") ; + if(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) antispam_string += (antispam_string.isNull()?"":" and ")+tr("PGP signature required") ; + + ui.antiSpamValueLabel->setText(antispam_string) ; + //ui.antiSpam_trackMessages_2->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) ); + //ui.antiSpam_signedIds_2 ->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) ); //ui.SignEdIds->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_GPG) ); //ui.trackmessagesradioButton->setChecked((bool)(signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_TRACK_MESSAGES) ); @@ -651,13 +672,15 @@ void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags) if ((signFlags & GXS_SERV::FLAG_GROUP_SIGN_PUBLISH_THREADHEAD) && (signFlags & GXS_SERV::FLAG_AUTHOR_AUTHENTICATION_IFNOPUBSIGN)) { + // (cyril) very weird piece of code. Need to clear this up. + ui.comments_allowed->setChecked(true); - ui.comments_allowed_3->setChecked(true); + ui.commentsValueLabel->setText("Allowed") ; } else { ui.comments_no->setChecked(true); - ui.comments_no_3->setChecked(true); + ui.commentsValueLabel->setText("Allowed") ; } } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.ui b/retroshare-gui/src/gui/gxs/GxsGroupDialog.ui index 4e2cb03bd..0c6d5074f 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.ui +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.ui @@ -7,31 +7,22 @@ 0 0 928 - 400 + 769 Create New - - 0 - - - 0 - - - 0 - - - 0 - 6 0 + + 0 + @@ -44,7 +35,7 @@ QFrame::Raised - 0 + 1 @@ -57,16 +48,7 @@ 0 - - 4 - - - 4 - - - 4 - - + 4 @@ -130,16 +112,7 @@ 9 - - 3 - - - 3 - - - 3 - - + 3 @@ -239,16 +212,7 @@ - - 0 - - - 0 - - - 0 - - + 0 @@ -635,188 +599,12 @@ - - - - Description - - - - - - true - - - - - - Info - - - - - - 0 - 0 - - - - - - - - 6 - - - 6 - - - 6 - - - 6 - - - - - - 0 - 0 - - - - Restricted to Group - - - - :/images/user/agt_forum24.png:/images/user/agt_forum24.png - - - - 16 - 16 - - - - - - - - - 0 - 0 - - - - Public - - - - :/images/network.png:/images/network.png - - - - 16 - 16 - - - - - - - - - 0 - 0 - - - - Only For Your Friends - - - - :/images/user/friends24.png:/images/user/friends24.png - - - - 16 - 16 - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - - - - - - - 6 - - - 6 - - - 6 - - - 6 - - - 6 - - - - - Comments allowed - - - - - - - Comments not allowed - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - + @@ -824,48 +612,13 @@ - + true - - - - true - - - - - - - true - - - - - - - true - - - - - - - ID - - - - - - - Last Post - - - @@ -873,11 +626,8 @@ - - - - - + + true @@ -890,20 +640,27 @@ - - + + - Comments + + + + true - - + + - Type + Last Post - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + true @@ -914,66 +671,97 @@ - + GxsIdLabel - - + + - Anti spam + ID - - - - + + + + true + + + + + + + Comments: + + + + + + + TextLabel + + + + + + + + + TextLabel + + + + + + + + 0 + 0 + + + + + + + + + + Distribution: + + + + + + + Anti Spam: + + + + + + + TextLabel + + + + + + + + + + Description + + + + + + true - - - 6 - - - 6 - - - 6 - - - 6 - - - - - PGP-signed ids - - - - - - - Track of Posts - - - - - - - Qt::Horizontal - - - - 718 - 20 - - - - -