Added new method to GxsGroupDialog to allow the service group dialogs to set own string for the gui elements.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6062 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-01-07 00:00:46 +00:00
parent 6d9782217b
commit 1c7e374fcd
13 changed files with 81 additions and 70 deletions

View File

@ -23,7 +23,7 @@
#include <QMessageBox>
#include "GxsForumsDialog.h"
#include "gxs/GxsForumGroupDialog.h"
#include "gxsforums/GxsForumGroupDialog.h"
#include "gxsforums/GxsForumThreadWidget.h"
#include "settings/rsharesettings.h"

View File

@ -51,8 +51,11 @@ PostedGroupDialog::PostedGroupDialog(const RsPostedGroup& grp, Mode mode, QWidge
{
}
QString PostedGroupDialog::serviceHeader()
QString PostedGroupDialog::uiText(UiType uiType)
{
switch (uiType)
{
case UITYPE_SERVICE_HEADER:
switch (mode())
{
case MODE_CREATE:
@ -62,11 +65,15 @@ QString PostedGroupDialog::serviceHeader()
case MODE_EDIT:
return tr("Edit Posted Topic");
}
break;
default:
// remove compiler warnings
break;
}
return "";
}
QPixmap PostedGroupDialog::serviceImage()
{
return QPixmap(":/images/posted_add_64.png");

View File

@ -43,7 +43,7 @@ public:
PostedGroupDialog(const RsPostedGroup& grp, Mode mode, QWidget *parent = NULL);
protected:
virtual QString serviceHeader();
virtual QString uiText(UiType uiType);
virtual QPixmap serviceImage();
bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);

View File

@ -141,7 +141,6 @@ void WikiDialog::OpenOrShowAddGroupDialog()
void WikiDialog::newGroup()
{
WikiGroupDialog cf(mWikiQueue, this);
cf.wikitype();
cf.exec ();
}

View File

@ -107,10 +107,20 @@ void GxsGroupDialog::init()
void GxsGroupDialog::showEvent(QShowEvent*)
{
QString header = serviceHeader();
QString header = uiText(UITYPE_SERVICE_HEADER);
ui.headerFrame->setHeaderText(header);
setWindowTitle(header);
ui.headerFrame->setHeaderImage(serviceImage());
QString text = uiText(UITYPE_KEY_SHARE_CHECKBOX);
if (!text.isEmpty()) {
ui.pubKeyShare_cb->setText(text);
}
text = uiText(UITYPE_CONTACTS_DOCK);
if (!text.isEmpty()) {
ui.contactsdockWidget->setWindowTitle(text);
}
}
void GxsGroupDialog::initMode()
@ -530,14 +540,3 @@ void GxsGroupDialog::setShareList()
this->resize(this->size().width() - ui.contactsdockWidget->size().width(), this->size().height());
}
}
void GxsGroupDialog::wikitype()
{
// hide logo Button/Label
ui.groupLogo->hide();
ui.addLogoButton->hide();
ui.headerFrame->setHeaderImage(QPixmap(":/images/resource-group-new_48.png")) ;
ui.pubKeyShare_cb->setText(tr("Add Wiki Moderators"));
ui.contactsdockWidget->setWindowTitle(tr("Select Wiki Moderators"));
}

View File

@ -19,7 +19,6 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _GXS_GROUP_DIALOG_H
#define _GXS_GROUP_DIALOG_H
@ -27,7 +26,6 @@
#include "util/TokenQueue.h"
/********
* Notes:
*
@ -51,10 +49,8 @@ class GxsGroupExtension: public QWidget
{
public:
GxsGroupExtension() : QWidget() { return; }
};
/*** Group flags affect what is visually enabled that gets input into the grpMeta ***/
#define GXS_GROUP_FLAGS_ICON 0x00000001
@ -70,7 +66,6 @@ public:
/*** Default flags are used to determine privacy of group, signatures required ***
*** whether publish or id and whether comments are allowed or not ***/
#define GXS_GROUP_DEFAULTS_DISTRIB_MASK 0x0000000f
#define GXS_GROUP_DEFAULTS_PUBLISH_MASK 0x000000f0
#define GXS_GROUP_DEFAULTS_PERSONAL_MASK 0x00000f00
@ -116,6 +111,12 @@ public:
MODE_EDIT
};
enum UiType {
UITYPE_SERVICE_HEADER,
UITYPE_KEY_SHARE_CHECKBOX,
UITYPE_CONTACTS_DOCK
};
public:
/*!
@ -137,7 +138,6 @@ public:
* @param parent
*/
GxsGroupDialog(const RsGroupMetaData& grpMeta, Mode mode, QWidget *parent = NULL);
void wikitype();
uint32_t mode() { return mMode; }
@ -155,7 +155,7 @@ protected slots:
protected:
virtual void showEvent(QShowEvent*);
virtual QString serviceHeader() = 0;
virtual QString uiText(UiType uiType) = 0;
virtual QPixmap serviceImage() = 0;
/*!
@ -179,7 +179,6 @@ protected:
*/
virtual QString getDescription();
private slots:
/* actions to take.... */
@ -191,11 +190,8 @@ private slots:
void updateCircleOptions();
private:
void setCircleParameters(RsGroupMetaData &meta);
void setGroupSignFlags(uint32_t signFlags);
uint32_t getGroupSignFlags();
void setupDefaults();
@ -205,7 +201,6 @@ private:
void sendShareList(std::string forumId);
void loadNewGroupId(const uint32_t &token);
std::list<std::string> mShareList;
QPixmap picture;
TokenQueue *mTokenQueue;
@ -221,4 +216,3 @@ private:
};
#endif

View File

@ -142,7 +142,7 @@
<item>
<widget class="QCheckBox" name="pubKeyShare_cb">
<property name="toolTip">
<string>Key recipients can publish to restricted-type Wiki Group, and can view and publish for private-type channels</string>
<string>Key recipients can publish to restricted-type group and can view and publish for private-type channels</string>
</property>
<property name="text">
<string>Share Publish Key</string>

View File

@ -24,7 +24,7 @@
#include <retroshare/rswiki.h>
#include <iostream>
const uint32_t WikiCreateEnabledFlags = ( GXS_GROUP_FLAGS_ICON |
const uint32_t WikiCreateEnabledFlags = ( // GXS_GROUP_FLAGS_ICON |
GXS_GROUP_FLAGS_DESCRIPTION |
GXS_GROUP_FLAGS_DISTRIBUTION |
// GXS_GROUP_FLAGS_PUBLISHSIGN |
@ -117,8 +117,11 @@ WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *pa
}
QString WikiGroupDialog::serviceHeader()
QString WikiGroupDialog::uiText(UiType uiType)
{
switch (uiType)
{
case UITYPE_SERVICE_HEADER:
switch (mode())
{
case MODE_CREATE:
@ -128,6 +131,15 @@ QString WikiGroupDialog::serviceHeader()
case MODE_EDIT:
return tr("Edit Wiki Group");
}
break;
case UITYPE_KEY_SHARE_CHECKBOX:
return tr("Add Wiki Moderators");
case UITYPE_CONTACTS_DOCK:
return tr("Select Wiki Moderators");
default:
// remove compiler warnings
break;
}
return "";
}

View File

@ -35,7 +35,7 @@ public:
WikiGroupDialog(const RsWikiCollection &collection, QWidget *parent);
protected:
virtual QString serviceHeader();
virtual QString uiText(UiType uiType);
virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);

View File

@ -52,22 +52,21 @@ const uint32_t ForumCreateDefaultsFlags = ( GXS_GROUP_DEFAULTS_DISTRIB_PUBLIC
GXS_GROUP_DEFAULTS_COMMENTS_NO |
0);
GxsForumGroupDialog::GxsForumGroupDialog(TokenQueue *tokenQueue, QWidget *parent)
:GxsGroupDialog(tokenQueue, ForumCreateEnabledFlags, ForumCreateDefaultsFlags, parent)
{
}
GxsForumGroupDialog::GxsForumGroupDialog(const RsGxsForumGroup &group, Mode mode, QWidget *parent)
:GxsGroupDialog(group.mMeta, mode, parent)
{
return;
}
QString GxsForumGroupDialog::serviceHeader()
QString GxsForumGroupDialog::uiText(UiType uiType)
{
switch (uiType)
{
case UITYPE_SERVICE_HEADER:
switch (mode())
{
case MODE_CREATE:
@ -77,7 +76,11 @@ QString GxsForumGroupDialog::serviceHeader()
case MODE_EDIT:
return tr("Edit Forum");
}
break;
default:
// remove compiler warnings
break;
}
return "";
}

View File

@ -19,11 +19,10 @@
* Boston, MA 02110-1301, USA.
****************************************************************/
#ifndef _GXSFORUM_GROUP_DIALOG_H
#define _GXSFORUM_GROUP_DIALOG_H
#include "GxsGroupDialog.h"
#include "gui/gxs/GxsGroupDialog.h"
#include <retroshare/rsgxsforums.h>
class GxsForumGroupDialog : public GxsGroupDialog
@ -35,10 +34,9 @@ public:
GxsForumGroupDialog(const RsGxsForumGroup &group, Mode mode, QWidget *parent);
protected:
virtual QString serviceHeader();
virtual QString uiText(UiType uiType);
virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
};
#endif

View File

@ -33,7 +33,6 @@
#include "gui/settings/rsharesettings.h"
#include "gui/gxs/GxsIdTreeWidgetItem.h"
#include "util/HandleRichText.h"
#include "gui/gxs/GxsForumGroupDialog.h"
#include "CreateGxsForumMsg.h"
#include "gui/msgs/MessageComposer.h"
#include "util/DateTime.h"

View File

@ -1021,6 +1021,7 @@ circles {
gxsforums {
HEADERS += gui/GxsForumsDialog.h \
gui/gxsforums/GxsForumGroupDialog.h \
gui/gxsforums/CreateGxsForumMsg.h \
gui/gxsforums/GxsForumThreadWidget.h \
gui/gxsforums/GxsForumsFillThread.h
@ -1030,6 +1031,7 @@ gxsforums {
gui/gxsforums/GxsForumThreadWidget.ui
SOURCES += gui/GxsForumsDialog.cpp \
gui/gxsforums/GxsForumGroupDialog.cpp \
gui/gxsforums/CreateGxsForumMsg.cpp \
gui/gxsforums/GxsForumThreadWidget.cpp \
gui/gxsforums/GxsForumsFillThread.cpp
@ -1070,7 +1072,6 @@ gxsgui {
HEADERS += gui/gxs/GxsGroupDialog.h \
gui/gxs/GxsCommentTreeWidget.h \
gui/gxs/WikiGroupDialog.h \
gui/gxs/GxsForumGroupDialog.h \
gui/gxs/GxsIdChooser.h \
gui/gxs/GxsIdLabel.h \
gui/gxs/GxsCircleChooser.h \
@ -1088,7 +1089,6 @@ gxsgui {
SOURCES += gui/gxs/GxsGroupDialog.cpp \
gui/gxs/GxsCommentTreeWidget.cpp \
gui/gxs/WikiGroupDialog.cpp \
gui/gxs/GxsForumGroupDialog.cpp \
gui/gxs/GxsIdChooser.cpp \
gui/gxs/GxsIdLabel.cpp \
gui/gxs/GxsCircleChooser.cpp \