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)
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;
}

View File

@ -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

View File

@ -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;
}
}

View File

@ -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
*

View File

@ -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()

View File

@ -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);

View File

@ -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()

View File

@ -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);
};