Added a new StackedPage for the Show mode (GXS Group Dialog), clean up the code.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7798 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2014-12-27 23:51:45 +00:00
parent 51825d851c
commit 72daac10c1
6 changed files with 821 additions and 480 deletions

View File

@ -73,7 +73,7 @@ void PostedGroupDialog::initUi()
{ {
case MODE_CREATE: case MODE_CREATE:
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Topic")); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Topic"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Topic")); setUiText(UITYPE_BUTTONBOX_OK, tr("Create"));
break; break;
case MODE_SHOW: case MODE_SHOW:
setUiText(UITYPE_SERVICE_HEADER, tr("Posted Topic")); setUiText(UITYPE_SERVICE_HEADER, tr("Posted Topic"));

View File

@ -24,6 +24,7 @@
#include <QMessageBox> #include <QMessageBox>
#include "util/misc.h" #include "util/misc.h"
#include "util/DateTime.h"
#include "GxsGroupDialog.h" #include "GxsGroupDialog.h"
#include "gui/common/PeerDefs.h" #include "gui/common/PeerDefs.h"
#include "retroshare/rsgxsflags.h" #include "retroshare/rsgxsflags.h"
@ -96,6 +97,7 @@ void GxsGroupDialog::init()
connect(ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo())); connect(ui.addLogoButton, SIGNAL(clicked() ), this , SLOT(addGroupLogo()));
ui.typePublic->setChecked(true); ui.typePublic->setChecked(true);
ui.typePublic_3->setChecked(true);
updateCircleOptions(); updateCircleOptions();
connect(ui.typePublic, SIGNAL(clicked()), this , SLOT(updateCircleOptions())); connect(ui.typePublic, SIGNAL(clicked()), this , SLOT(updateCircleOptions()));
@ -163,13 +165,13 @@ void GxsGroupDialog::initMode()
case MODE_CREATE: case MODE_CREATE:
{ {
ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); ui.buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
ui.buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Create Forum"));
newGroup(); newGroup();
} }
break; break;
case MODE_SHOW: case MODE_SHOW:
{ {
ui.stackedWidget->setCurrentIndex(1);
mReadonlyFlags = 0xffffffff; // Force all to readonly. mReadonlyFlags = 0xffffffff; // Force all to readonly.
ui.buttonBox->setStandardButtons(QDialogButtonBox::Close); ui.buttonBox->setStandardButtons(QDialogButtonBox::Close);
requestGroup(mGrpMeta.mGroupId); requestGroup(mGrpMeta.mGroupId);
@ -202,19 +204,23 @@ void GxsGroupDialog::setupDefaults()
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC) if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC)
{ {
ui.typePublic->setChecked(true); ui.typePublic->setChecked(true);
ui.typePublic_3->setChecked(true);
} }
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_GROUP) else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_GROUP)
{ {
ui.typeGroup->setChecked(true); ui.typeGroup->setChecked(true);
ui.typeGroup_3->setChecked(true);
} }
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_LOCAL) else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_DISTRIB_LOCAL)
{ {
ui.typeLocal->setChecked(true); ui.typeLocal->setChecked(true);
ui.typeLocal_3->setChecked(true);
} }
else else
{ {
// default // default
ui.typePublic->setChecked(true); ui.typePublic->setChecked(true);
ui.typePublic_3->setChecked(true);
} }
} }
@ -265,20 +271,25 @@ void GxsGroupDialog::setupDefaults()
if (mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_YES) if (mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_YES)
{ {
ui.comments_allowed->setChecked(true); ui.comments_allowed->setChecked(true);
ui.comments_allowed_3->setChecked(true);
} }
else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_NO) else if (mDefaultsFlags & GXS_GROUP_DEFAULTS_COMMENTS_NO)
{ {
ui.comments_no->setChecked(true); ui.comments_no->setChecked(true);
ui.comments_no_3->setChecked(true);
} }
else else
{ {
// default // default
ui.comments_no->setChecked(true); ui.comments_no->setChecked(true);
ui.comments_no_3->setChecked(true);
} }
} }
#ifndef RS_USE_CIRCLES #ifndef RS_USE_CIRCLES
ui.typeGroup->setEnabled(false); ui.typeGroup->setEnabled(false);
ui.typeLocal->setEnabled(false); ui.typeLocal->setEnabled(false);
ui.typeGroup_3->setEnabled(false);
ui.typeLocal_3->setEnabled(false);
#endif #endif
} }
@ -290,9 +301,9 @@ void GxsGroupDialog::setupVisibility()
ui.addLogoButton->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON); ui.addLogoButton->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_ICON);
ui.groupDesc->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION); ui.groupDesc->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
ui.groupDescLabel->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DESCRIPTION);
ui.distribGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION); ui.distribGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION);
ui.distribGroupBox_2->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_DISTRIBUTION);
ui.publishGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PUBLISHSIGN); ui.publishGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PUBLISHSIGN);
@ -301,6 +312,8 @@ void GxsGroupDialog::setupVisibility()
ui.personalGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PERSONALSIGN); ui.personalGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_PERSONALSIGN);
ui.commentGroupBox->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_COMMENTS); 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.extraFrame->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_EXTRA); ui.extraFrame->setVisible(mEnabledFlags & GXS_GROUP_FLAGS_EXTRA);
} }
@ -317,24 +330,19 @@ void GxsGroupDialog::setAllReadonly()
void GxsGroupDialog::setupReadonly() void GxsGroupDialog::setupReadonly()
{ {
ui.groupName->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_NAME));
//ui.groupLogo->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
ui.addLogoButton->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON)); ui.addLogoButton->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_ICON));
ui.groupDesc->setReadOnly(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION);
//ui.groupDescLabel->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DESCRIPTION));
ui.distribGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_DISTRIBUTION));
ui.publishGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PUBLISHSIGN)); ui.publishGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PUBLISHSIGN));
ui.pubKeyShare_cb->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_SHAREKEYS)); ui.pubKeyShare_cb->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_SHAREKEYS));
ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN)); ui.personalGroupBox->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
ui.idChooser->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN)); ui.idChooser->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_PERSONALSIGN));
ui.commentGroupBox->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.extraFrame->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_EXTRA)); ui.extraFrame->setEnabled(!(mReadonlyFlags & GXS_GROUP_FLAGS_EXTRA));
#ifndef UNFINISHED #ifndef UNFINISHED
@ -367,8 +375,31 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description)
/* setup name */ /* setup name */
ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str())); ui.groupName->setText(QString::fromUtf8(mGrpMeta.mGroupName.c_str()));
ui.headerFrame->setHeaderText(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.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())
return;
ui.headerFrame->setHeaderImage(mPicture);
}
break;
case MODE_EDIT:{
}
break;
}
/* set description */ /* set description */
ui.groupDesc->setPlainText(description); ui.groupDesc->setPlainText(description);
@ -376,13 +407,16 @@ void GxsGroupDialog::updateFromExistingMeta(const QString &description)
{ {
case GXS_CIRCLE_TYPE_YOUREYESONLY: case GXS_CIRCLE_TYPE_YOUREYESONLY:
ui.typeLocal->setChecked(true); ui.typeLocal->setChecked(true);
ui.typeLocal_3->setChecked(true);
ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle); ui.localComboBox->loadCircles(GXS_CIRCLE_CHOOSER_PERSONAL, mGrpMeta.mInternalCircle);
break; break;
case GXS_CIRCLE_TYPE_PUBLIC: case GXS_CIRCLE_TYPE_PUBLIC:
ui.typePublic->setChecked(true); ui.typePublic->setChecked(true);
ui.typePublic_3->setChecked(true);
break; break;
case GXS_CIRCLE_TYPE_EXTERNAL: case GXS_CIRCLE_TYPE_EXTERNAL:
ui.typeGroup->setChecked(true); ui.typeGroup->setChecked(true);
ui.typeGroup_3->setChecked(true);
ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mGrpMeta.mCircleId); ui.circleComboBox->loadCircles(GXS_CIRCLE_CHOOSER_EXTERNAL, mGrpMeta.mCircleId);
break; break;
default: default:
@ -593,10 +627,12 @@ void GxsGroupDialog::setGroupSignFlags(uint32_t signFlags)
(signFlags & RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN)) (signFlags & RSGXS_GROUP_SIGN_AUTHOR_IFNOPUBSIGN))
{ {
ui.comments_allowed->setChecked(true); ui.comments_allowed->setChecked(true);
ui.comments_allowed_3->setChecked(true);
} }
else else
{ {
ui.comments_no->setChecked(true); ui.comments_no->setChecked(true);
ui.comments_no_3->setChecked(true);
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -96,7 +96,7 @@ void GroupShareKey::setTyp()
ui->headerFrame->setHeaderImage(QPixmap(":/images/posted_64.png")); ui->headerFrame->setHeaderImage(QPixmap(":/images/posted_64.png"));
ui->headerFrame->setHeaderText(tr("Share Posted")); ui->headerFrame->setHeaderText(tr("Share Posted"));
ui->sharekeyinfo_label->setText(tr("You can let your friends know about your Posted by sharing it with them. Select the Friends with which you want to Share your Posted.")); ui->sharekeyinfo_label->setText(tr("You can let your friends know about your Topic by sharing it with them. Select the Friends with which you want to Share your Topic."));
} }
else else

View File

@ -75,7 +75,7 @@ void GxsChannelGroupDialog::initUi()
{ {
case MODE_CREATE: case MODE_CREATE:
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Channel")); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Channel"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Channel")); setUiText(UITYPE_BUTTONBOX_OK, tr("Create"));
break; break;
case MODE_SHOW: case MODE_SHOW:
setUiText(UITYPE_SERVICE_HEADER, tr("Channel")); setUiText(UITYPE_SERVICE_HEADER, tr("Channel"));

View File

@ -73,7 +73,7 @@ void GxsForumGroupDialog::initUi()
{ {
case MODE_CREATE: case MODE_CREATE:
setUiText(UITYPE_SERVICE_HEADER, tr("Create New Forum")); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Forum"));
setUiText(UITYPE_BUTTONBOX_OK, tr("Create Forum")); setUiText(UITYPE_BUTTONBOX_OK, tr("Create"));
break; break;
case MODE_SHOW: case MODE_SHOW:
setUiText(UITYPE_SERVICE_HEADER, tr("Forum")); setUiText(UITYPE_SERVICE_HEADER, tr("Forum"));