diff --git a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp index 98dea1c41..bccabdb6b 100644 --- a/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp +++ b/retroshare-gui/src/gui/Posted/PostedGroupDialog.cpp @@ -51,27 +51,20 @@ PostedGroupDialog::PostedGroupDialog(const RsPostedGroup& grp, Mode mode, QWidge { } -QString PostedGroupDialog::uiText(UiType uiType) +void PostedGroupDialog::initUi() { - switch (uiType) + switch (mode()) { - 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"); - } + case MODE_CREATE: + setUiText(UITYPE_SERVICE_HEADER, tr("Create New Posted Topic")); break; - default: - // remove compiler warnings + case MODE_SHOW: + setUiText(UITYPE_SERVICE_HEADER, tr("Posted Topic")); + break; + case MODE_EDIT: + setUiText(UITYPE_SERVICE_HEADER, tr("Edit Posted Topic")); break; } - - return ""; } QPixmap PostedGroupDialog::serviceImage() @@ -89,9 +82,3 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa rsPosted->submitGroup(token, grp); return true; } - - - - - - diff --git a/retroshare-gui/src/gui/Posted/PostedGroupDialog.h b/retroshare-gui/src/gui/Posted/PostedGroupDialog.h index e23a3b75e..2cd592eb1 100644 --- a/retroshare-gui/src/gui/Posted/PostedGroupDialog.h +++ b/retroshare-gui/src/gui/Posted/PostedGroupDialog.h @@ -43,16 +43,13 @@ public: PostedGroupDialog(const RsPostedGroup& grp, Mode mode, QWidget *parent = NULL); protected: - virtual QString uiText(UiType uiType); + virtual void initUi(); virtual QPixmap serviceImage(); bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); private: - RsPostedGroup mGrp; RsPosted* mPosted; - }; #endif - diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp index 3f1e82a79..3f3e34a61 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.cpp @@ -107,19 +107,25 @@ void GxsGroupDialog::init() void GxsGroupDialog::showEvent(QShowEvent*) { - 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); - } + initUi(); +} - text = uiText(UITYPE_CONTACTS_DOCK); - if (!text.isEmpty()) { +void GxsGroupDialog::setUiText(UiType uiType, const QString &text) +{ + switch (uiType) + { + case UITYPE_SERVICE_HEADER: + setWindowTitle(text); + ui.headerFrame->setHeaderText(text); + break; + case UITYPE_KEY_SHARE_CHECKBOX: + ui.pubKeyShare_cb->setText(text); + break; + case UITYPE_CONTACTS_DOCK: ui.contactsdockWidget->setWindowTitle(text); + break; } } diff --git a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h index ae8e14a20..e85a992c9 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupDialog.h +++ b/retroshare-gui/src/gui/gxs/GxsGroupDialog.h @@ -155,9 +155,11 @@ protected slots: protected: virtual void showEvent(QShowEvent*); - virtual QString uiText(UiType uiType) = 0; + virtual void initUi() = 0; virtual QPixmap serviceImage() = 0; + void setUiText(UiType uiType, const QString &text); + /*! * Main purpose is to help tansfer meta data to service * diff --git a/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp b/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp index 3a54a0a21..596dfe318 100644 --- a/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxs/WikiGroupDialog.cpp @@ -117,31 +117,23 @@ WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *pa } -QString WikiGroupDialog::uiText(UiType uiType) +void WikiGroupDialog::initUi() { - switch (uiType) + switch (mode()) { - 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"); - } + case MODE_CREATE: + setUiText(UITYPE_SERVICE_HEADER, tr("Create New 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 + case MODE_SHOW: + setUiText(UITYPE_SERVICE_HEADER, tr("Wiki Group")); + break; + case MODE_EDIT: + setUiText(UITYPE_SERVICE_HEADER, tr("Edit Wiki Group")); break; } - return ""; + setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Wiki Moderators")); + setUiText(UITYPE_CONTACTS_DOCK, tr("Select Wiki Moderators")); } QPixmap WikiGroupDialog::serviceImage() diff --git a/retroshare-gui/src/gui/gxs/WikiGroupDialog.h b/retroshare-gui/src/gui/gxs/WikiGroupDialog.h index 5d71b9d9a..f8549587e 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 uiText(UiType uiType); + virtual void initUi(); virtual QPixmap serviceImage(); virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp index 57aaceed8..36351363b 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp +++ b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.cpp @@ -62,26 +62,20 @@ GxsForumGroupDialog::GxsForumGroupDialog(const RsGxsForumGroup &group, Mode mode { } -QString GxsForumGroupDialog::uiText(UiType uiType) +void GxsForumGroupDialog::initUi() { - switch (uiType) + switch (mode()) { - 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"); - } + case MODE_CREATE: + setUiText(UITYPE_SERVICE_HEADER, tr("Create New Forum")); break; - default: - // remove compiler warnings + case MODE_SHOW: + setUiText(UITYPE_SERVICE_HEADER, tr("Forum")); + break; + case MODE_EDIT: + setUiText(UITYPE_SERVICE_HEADER, tr("Edit Forum")); break; } - return ""; } QPixmap GxsForumGroupDialog::serviceImage() diff --git a/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h index 2cc3b7b61..96d431319 100644 --- a/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h +++ b/retroshare-gui/src/gui/gxsforums/GxsForumGroupDialog.h @@ -34,7 +34,7 @@ public: GxsForumGroupDialog(const RsGxsForumGroup &group, Mode mode, QWidget *parent); protected: - virtual QString uiText(UiType uiType); + virtual void initUi(); virtual QPixmap serviceImage(); virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); };