Changed direction of the new text method on GxsGroupDialog. Now the service group dialogs can set the string for the gui elements.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@6063 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
thunder2 2013-01-07 11:40:05 +00:00
parent 1c7e374fcd
commit 70e9b08bb0
8 changed files with 50 additions and 72 deletions

View File

@ -51,27 +51,20 @@ PostedGroupDialog::PostedGroupDialog(const RsPostedGroup& grp, Mode mode, QWidge
{ {
} }
QString PostedGroupDialog::uiText(UiType uiType) void PostedGroupDialog::initUi()
{ {
switch (uiType)
{
case UITYPE_SERVICE_HEADER:
switch (mode()) switch (mode())
{ {
case MODE_CREATE: case MODE_CREATE:
return tr("Create New Posted Topic"); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Posted Topic"));
break;
case MODE_SHOW: case MODE_SHOW:
return tr("Posted Topic"); setUiText(UITYPE_SERVICE_HEADER, tr("Posted Topic"));
break;
case MODE_EDIT: case MODE_EDIT:
return tr("Edit Posted Topic"); setUiText(UITYPE_SERVICE_HEADER, tr("Edit Posted Topic"));
}
break;
default:
// remove compiler warnings
break; break;
} }
return "";
} }
QPixmap PostedGroupDialog::serviceImage() QPixmap PostedGroupDialog::serviceImage()
@ -89,9 +82,3 @@ bool PostedGroupDialog::service_CreateGroup(uint32_t &token, const RsGroupMetaDa
rsPosted->submitGroup(token, grp); rsPosted->submitGroup(token, grp);
return true; return true;
} }

View File

@ -43,16 +43,13 @@ public:
PostedGroupDialog(const RsPostedGroup& grp, Mode mode, QWidget *parent = NULL); PostedGroupDialog(const RsPostedGroup& grp, Mode mode, QWidget *parent = NULL);
protected: protected:
virtual QString uiText(UiType uiType); virtual void initUi();
virtual QPixmap serviceImage(); virtual QPixmap serviceImage();
bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
private: private:
RsPostedGroup mGrp; RsPostedGroup mGrp;
RsPosted* mPosted; RsPosted* mPosted;
}; };
#endif #endif

View File

@ -107,19 +107,25 @@ void GxsGroupDialog::init()
void GxsGroupDialog::showEvent(QShowEvent*) void GxsGroupDialog::showEvent(QShowEvent*)
{ {
QString header = uiText(UITYPE_SERVICE_HEADER);
ui.headerFrame->setHeaderText(header);
setWindowTitle(header);
ui.headerFrame->setHeaderImage(serviceImage()); ui.headerFrame->setHeaderImage(serviceImage());
QString text = uiText(UITYPE_KEY_SHARE_CHECKBOX); initUi();
if (!text.isEmpty()) {
ui.pubKeyShare_cb->setText(text);
} }
text = uiText(UITYPE_CONTACTS_DOCK); void GxsGroupDialog::setUiText(UiType uiType, const QString &text)
if (!text.isEmpty()) { {
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); ui.contactsdockWidget->setWindowTitle(text);
break;
} }
} }

View File

@ -155,9 +155,11 @@ protected slots:
protected: protected:
virtual void showEvent(QShowEvent*); virtual void showEvent(QShowEvent*);
virtual QString uiText(UiType uiType) = 0; virtual void initUi() = 0;
virtual QPixmap serviceImage() = 0; virtual QPixmap serviceImage() = 0;
void setUiText(UiType uiType, const QString &text);
/*! /*!
* Main purpose is to help tansfer meta data to service * Main purpose is to help tansfer meta data to service
* *

View File

@ -117,31 +117,23 @@ WikiGroupDialog::WikiGroupDialog(const RsWikiCollection &collection, QWidget *pa
} }
QString WikiGroupDialog::uiText(UiType uiType) void WikiGroupDialog::initUi()
{ {
switch (uiType)
{
case UITYPE_SERVICE_HEADER:
switch (mode()) switch (mode())
{ {
case MODE_CREATE: case MODE_CREATE:
return tr("Create New Wiki Group"); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Wiki Group"));
case MODE_SHOW:
return tr("Wiki Group");
case MODE_EDIT:
return tr("Edit Wiki Group");
}
break; break;
case UITYPE_KEY_SHARE_CHECKBOX: case MODE_SHOW:
return tr("Add Wiki Moderators"); setUiText(UITYPE_SERVICE_HEADER, tr("Wiki Group"));
case UITYPE_CONTACTS_DOCK: break;
return tr("Select Wiki Moderators"); case MODE_EDIT:
default: setUiText(UITYPE_SERVICE_HEADER, tr("Edit Wiki Group"));
// remove compiler warnings
break; break;
} }
return ""; setUiText(UITYPE_KEY_SHARE_CHECKBOX, tr("Add Wiki Moderators"));
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Wiki Moderators"));
} }
QPixmap WikiGroupDialog::serviceImage() QPixmap WikiGroupDialog::serviceImage()

View File

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

View File

@ -62,26 +62,20 @@ GxsForumGroupDialog::GxsForumGroupDialog(const RsGxsForumGroup &group, Mode mode
{ {
} }
QString GxsForumGroupDialog::uiText(UiType uiType) void GxsForumGroupDialog::initUi()
{ {
switch (uiType)
{
case UITYPE_SERVICE_HEADER:
switch (mode()) switch (mode())
{ {
case MODE_CREATE: case MODE_CREATE:
return tr("Create New Forum"); setUiText(UITYPE_SERVICE_HEADER, tr("Create New Forum"));
break;
case MODE_SHOW: case MODE_SHOW:
return tr("Forum"); setUiText(UITYPE_SERVICE_HEADER, tr("Forum"));
break;
case MODE_EDIT: case MODE_EDIT:
return tr("Edit Forum"); setUiText(UITYPE_SERVICE_HEADER, tr("Edit Forum"));
}
break;
default:
// remove compiler warnings
break; break;
} }
return "";
} }
QPixmap GxsForumGroupDialog::serviceImage() QPixmap GxsForumGroupDialog::serviceImage()

View File

@ -34,7 +34,7 @@ public:
GxsForumGroupDialog(const RsGxsForumGroup &group, Mode mode, QWidget *parent); GxsForumGroupDialog(const RsGxsForumGroup &group, Mode mode, QWidget *parent);
protected: protected:
virtual QString uiText(UiType uiType); virtual void initUi();
virtual QPixmap serviceImage(); virtual QPixmap serviceImage();
virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta); virtual bool service_CreateGroup(uint32_t &token, const RsGroupMetaData &meta);
}; };