From 1c7e374fcd9ae3b3ab7d538ee10bb23473fe5ddd Mon Sep 17 00:00:00 2001 From: thunder2 Date: Mon, 7 Jan 2013 00:00:46 +0000 Subject: [PATCH] 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 --- retroshare-gui/src/gui/GxsForumsDialog.cpp | 2 +- .../src/gui/Posted/PostedGroupDialog.cpp | 25 ++++++++++------ .../src/gui/Posted/PostedGroupDialog.h | 2 +- .../src/gui/WikiPoos/WikiDialog.cpp | 1 - retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp | 23 +++++++------- retroshare-gui/src/gui/gxs/GxsGroupDialog.h | 24 ++++++--------- retroshare-gui/src/gui/gxs/GxsGroupDialog.ui | 2 +- .../src/gui/gxs/WikiGroupDialog.cpp | 30 +++++++++++++------ retroshare-gui/src/gui/gxs/WikiGroupDialog.h | 2 +- .../GxsForumGroupDialog.cpp | 29 ++++++++++-------- .../{gxs => gxsforums}/GxsForumGroupDialog.h | 6 ++-- .../gui/gxsforums/GxsForumThreadWidget.cpp | 1 - retroshare-gui/src/retroshare-gui.pro | 4 +-- 13 files changed, 81 insertions(+), 70 deletions(-) rename retroshare-gui/src/gui/{gxs => gxsforums}/GxsForumGroupDialog.cpp (89%) rename retroshare-gui/src/gui/{gxs => gxsforums}/GxsForumGroupDialog.h (94%) diff --git a/retroshare-gui/src/gui/GxsForumsDialog.cpp b/retroshare-gui/src/gui/GxsForumsDialog.cpp index 9ebcddaac..74f4fb24c 100644 --- a/retroshare-gui/src/gui/GxsForumsDialog.cpp +++ b/retroshare-gui/src/gui/GxsForumsDialog.cpp @@ -23,7 +23,7 @@ #include #include "GxsForumsDialog.h" -#include "gxs/GxsForumGroupDialog.h" +#include "gxsforums/GxsForumGroupDialog.h" #include "gxsforums/GxsForumThreadWidget.h" #include "settings/rsharesettings.h" diff --git a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp index bf788971a..98dea1c41 100644 --- a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp @@ -51,22 +51,29 @@ PostedGroupDialog::PostedGroupDialog(const RsPostedGroup& grp, Mode mode, QWidge { } -QString PostedGroupDialog::serviceHeader() +QString PostedGroupDialog::uiText(UiType uiType) { - switch (mode()) + switch (uiType) { - case MODE_CREATE: - return tr("Create New Posted Topic"); - case MODE_SHOW: - return tr("Posted Topic"); - case MODE_EDIT: - return tr("Edit Posted Topic"); + case UITYPE_SERVICE_HEADER: + switch (mode()) + { + case MODE_CREATE: + return tr("Create New Posted Topic"); + case MODE_SHOW: + return tr("Posted Topic"); + 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"); diff --git a/retroshare-gui/src/gui/Posted/PostedGroupDialog.h b/retroshare-gui/src/gui/Posted/PostedGroupDialog.h index 495d1a330..e23a3b75e 100644 --- a/retroshare-gui/src/gui/Posted/PostedGroupDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedGroupDialog.h @@ -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); diff --git a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp index 289220fb8..afecb2cd6 100644 --- a/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp +++ b/retroshare-gui/src/gui/WikiPoos/WikiDialog.cpp @@ -141,7 +141,6 @@ void WikiDialog::OpenOrShowAddGroupDialog() void WikiDialog::newGroup() { WikiGroupDialog cf(mWikiQueue, this); - cf.wikitype(); cf.exec (); } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp index 7d32ede06..3f1e82a79 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp @@ -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")); -} diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h index beae5e965..ae8e14a20 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h @@ -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,18 +49,16 @@ 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 #define GXS_GROUP_FLAGS_DESCRIPTION 0x00000002 -#define GXS_GROUP_FLAGS_DISTRIBUTION 0x00000004 +#define GXS_GROUP_FLAGS_DISTRIBUTION 0x00000004 #define GXS_GROUP_FLAGS_PUBLISHSIGN 0x00000008 #define GXS_GROUP_FLAGS_SHAREKEYS 0x00000010 -#define GXS_GROUP_FLAGS_PERSONALSIGN 0x00000020 +#define GXS_GROUP_FLAGS_PERSONALSIGN 0x00000020 #define GXS_GROUP_FLAGS_COMMENTS 0x00000040 #define GXS_GROUP_FLAGS_EXTRA 0x00000100 @@ -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; /*! @@ -178,7 +178,6 @@ protected: * @return group description string */ virtual QString getDescription(); - private slots: @@ -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 mShareList; QPixmap picture; TokenQueue *mTokenQueue; @@ -221,4 +216,3 @@ private: }; #endif - diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.ui b/retroshare-gui/src/gui/gxs/GxsGroupDialog.ui index 6c30bc5eb..41782b322 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.ui +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.ui @@ -142,7 +142,7 @@ - Key recipients can publish to restricted-type Wiki Group, and can view and publish for private-type channels + Key recipients can publish to restricted-type group and can view and publish for private-type channels Share Publish Key diff --git a/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp b/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp index 95a1b4399..3a54a0a21 100644 --- a/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp @@ -24,7 +24,7 @@ #include #include -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,16 +117,28 @@ WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *pa } -QString WikiGroupDialog::serviceHeader() +QString WikiGroupDialog::uiText(UiType uiType) { - switch (mode()) + switch (uiType) { - case MODE_CREATE: - return tr("Create New Wiki Group"); - case MODE_SHOW: - return tr("Wiki Group"); - case MODE_EDIT: - return tr("Edit Wiki Group"); + case UITYPE_SERVICE_HEADER: + switch (mode()) + { + case MODE_CREATE: + return tr("Create New Wiki Group"); + case MODE_SHOW: + return tr("Wiki Group"); + 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 ""; diff --git a/retroshare-gui/src/gui/gxs/WikiGroupDialog.h b/retroshare-gui/src/gui/gxs/WikiGroupDialog.h index b35333065..5d71b9d9a 100644 --- a/retroshare-gui/src/gui/gxs/WikiGroupDialog.h +++ b/retroshare-gui/src/gui/gxs/WikiGroupDialog.h @@ -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); diff --git a/retroshare-gui/src/gui/gxs/GxsForumGroupDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp similarity index 89% rename from retroshare-gui/src/gui/gxs/GxsForumGroupDialog.cpp rename to retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp index d440c6c11..57aaceed8 100644 --- a/retroshare-gui/src/gui/gxs/GxsForumGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp @@ -52,32 +52,35 @@ 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 (mode()) + switch (uiType) { - case MODE_CREATE: - return tr("Create New Forum"); - case MODE_SHOW: - return tr("Forum"); - case MODE_EDIT: - return tr("Edit Forum"); + case UITYPE_SERVICE_HEADER: + switch (mode()) + { + case MODE_CREATE: + return tr("Create New Forum"); + case MODE_SHOW: + return tr("Forum"); + case MODE_EDIT: + return tr("Edit Forum"); + } + break; + default: + // remove compiler warnings + break; } - return ""; } diff --git a/retroshare-gui/src/gui/gxs/GxsForumGroupDialog.h b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h similarity index 94% rename from retroshare-gui/src/gui/gxs/GxsForumGroupDialog.h rename to retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h index 2277b38bd..2cc3b7b61 100644 --- a/retroshare-gui/src/gui/gxs/GxsForumGroupDialog.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h @@ -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 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 - diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp index e70cee75c..eda9c29a9 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumThreadWidget.cpp @@ -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" diff --git a/retroshare-gui/src/retroshare-gui.pro b/retroshare-gui/src/retroshare-gui.pro index 5b37736c8..6cda0ba1c 100644 --- a/retroshare-gui/src/retroshare-gui.pro +++ b/retroshare-gui/src/retroshare-gui.pro @@ -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 \