mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed performance problem in 8207
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8213 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
6c94ee2d34
commit
444730d19c
@ -686,43 +686,51 @@ void GxsForumThreadWidget::insertGroupData()
|
|||||||
#ifdef DEBUG_FORUMS
|
#ifdef DEBUG_FORUMS
|
||||||
std::cerr << "GxsForumThreadWidget::insertGroupData" << std::endl;
|
std::cerr << "GxsForumThreadWidget::insertGroupData" << std::endl;
|
||||||
#endif
|
#endif
|
||||||
const RsGxsForumGroup& group = mForumGroup;
|
GxsIdDetails::process(mForumGroup.mMeta.mAuthorId, &loadAuthorIdCallback, this);
|
||||||
|
calculateIconsAndFonts();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/ void GxsForumThreadWidget::loadAuthorIdCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &)
|
||||||
|
{
|
||||||
|
GxsForumThreadWidget *tw = dynamic_cast<GxsForumThreadWidget*>(object);
|
||||||
|
if(!tw)
|
||||||
|
return;
|
||||||
|
|
||||||
QString author;
|
QString author;
|
||||||
if(group.mMeta.mAuthorId.isNull())
|
switch (type) {
|
||||||
author = tr("no author");
|
case GXS_ID_DETAILS_TYPE_EMPTY:
|
||||||
else
|
author = GxsIdDetails::getEmptyIdText();
|
||||||
{
|
break;
|
||||||
RsIdentityDetails details;
|
case GXS_ID_DETAILS_TYPE_FAILED:
|
||||||
if(!rsIdentity->getIdDetails(group.mMeta.mAuthorId, details))
|
author = GxsIdDetails::getFailedText(details.mId);
|
||||||
{
|
break;
|
||||||
// try again later
|
case GXS_ID_DETAILS_TYPE_LOADING:
|
||||||
QTimer::singleShot(200, this, SLOT(insertGroupData()));
|
author = GxsIdDetails::getLoadingText(details.mId);
|
||||||
author = tr("loading...");
|
break;
|
||||||
}
|
case GXS_ID_DETAILS_TYPE_DONE:
|
||||||
else
|
author = GxsIdDetails::getName(details);
|
||||||
author = QString::fromUtf8(details.mNickname.c_str());
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
mSubscribeFlags = group.mMeta.mSubscribeFlags;
|
const RsGxsForumGroup& group = tw->mForumGroup;
|
||||||
ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
|
|
||||||
|
|
||||||
mForumDescription = QString("<b>%1: \t</b>%2<br/>").arg(tr("Forum name"), QString::fromUtf8( group.mMeta.mGroupName.c_str()));
|
tw->mSubscribeFlags = group.mMeta.mSubscribeFlags;
|
||||||
mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Subscribers")).arg(group.mMeta.mPop);
|
tw->ui->forumName->setText(QString::fromUtf8(group.mMeta.mGroupName.c_str()));
|
||||||
mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount);
|
|
||||||
mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Author"), author);
|
|
||||||
mForumDescription += QString("<b>%1: </b><br/><br/>%2").arg(tr("Description"), QString::fromUtf8(group.mDescription.c_str()));
|
|
||||||
|
|
||||||
ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(mSubscribeFlags));
|
tw->mForumDescription = QString("<b>%1: \t</b>%2<br/>").arg(tr("Forum name"), QString::fromUtf8( group.mMeta.mGroupName.c_str()));
|
||||||
mStateHelper->setWidgetEnabled(ui->newthreadButton, (IS_GROUP_SUBSCRIBED(mSubscribeFlags)));
|
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Subscribers")).arg(group.mMeta.mPop);
|
||||||
|
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Posts (at neighbor nodes)")).arg(group.mMeta.mVisibleMsgCount);
|
||||||
|
tw->mForumDescription += QString("<b>%1: \t</b>%2<br/>").arg(tr("Author"), author);
|
||||||
|
tw->mForumDescription += QString("<b>%1: </b><br/><br/>%2").arg(tr("Description"), QString::fromUtf8(group.mDescription.c_str()));
|
||||||
|
|
||||||
if (mThreadId.isNull() && !mStateHelper->isLoading(mTokenTypeMessageData))
|
tw->ui->subscribeToolButton->setSubscribed(IS_GROUP_SUBSCRIBED(tw->mSubscribeFlags));
|
||||||
{
|
tw->mStateHelper->setWidgetEnabled(tw->ui->newthreadButton, (IS_GROUP_SUBSCRIBED(tw->mSubscribeFlags)));
|
||||||
|
|
||||||
|
if (tw->mThreadId.isNull() && !tw->mStateHelper->isLoading(tw->mTokenTypeMessageData))
|
||||||
|
{
|
||||||
//ui->threadTitle->setText(tr("Forum Description"));
|
//ui->threadTitle->setText(tr("Forum Description"));
|
||||||
ui->postText->setText(mForumDescription);
|
tw->ui->postText->setText(tw->mForumDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
calculateIconsAndFonts();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GxsForumThreadWidget::fillThreadFinished()
|
void GxsForumThreadWidget::fillThreadFinished()
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "gui/gxs/GxsMessageFrameWidget.h"
|
#include "gui/gxs/GxsMessageFrameWidget.h"
|
||||||
#include <retroshare/rsgxsforums.h>
|
#include <retroshare/rsgxsforums.h>
|
||||||
|
#include "gui/gxs/GxsIdDetails.h"
|
||||||
|
|
||||||
class QTreeWidgetItem;
|
class QTreeWidgetItem;
|
||||||
class RSTreeWidgetItemCompareRole;
|
class RSTreeWidgetItemCompareRole;
|
||||||
@ -132,9 +133,9 @@ private:
|
|||||||
|
|
||||||
void requestGroupData();
|
void requestGroupData();
|
||||||
void loadGroupData(const uint32_t &token);
|
void loadGroupData(const uint32_t &token);
|
||||||
private slots:
|
|
||||||
void insertGroupData();
|
void insertGroupData();
|
||||||
private:
|
static void loadAuthorIdCallback(GxsIdDetailsType type, const RsIdentityDetails &details, QObject *object, const QVariant &/*data*/);
|
||||||
|
|
||||||
void requestMessageData(const RsGxsGrpMsgIdPair &msgId);
|
void requestMessageData(const RsGxsGrpMsgIdPair &msgId);
|
||||||
void loadMessageData(const uint32_t &token);
|
void loadMessageData(const uint32_t &token);
|
||||||
void requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &msgId);
|
void requestMsgData_ReplyMessage(const RsGxsGrpMsgIdPair &msgId);
|
||||||
|
Loading…
Reference in New Issue
Block a user