Changed the Ranking list to the new retrival methods.

Modified data display to show real info,



git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-new_cache_system@5281 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
drbob 2012-07-08 01:31:23 +00:00
parent 2d31efd69b
commit 51d6396c9f
2 changed files with 46 additions and 10 deletions

View File

@ -46,10 +46,30 @@ PostedItem::PostedItem(PostedHolder *parent, const RsPostedPost &post)
setAttribute ( Qt::WA_DeleteOnClose, true ); setAttribute ( Qt::WA_DeleteOnClose, true );
titleLabel->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str())); titleLabel->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str()));
dateLabel->setText(QString("Whenever")); //dateLabel->setText(QString("Whenever"));
fromLabel->setText(QString::fromUtf8(post.mMeta.mAuthorId.c_str())); fromLabel->setText(QString::fromUtf8(post.mMeta.mAuthorId.c_str()));
siteLabel->setText(QString::fromUtf8(post.mMeta.mAuthorId.c_str())); //siteLabel->setText(QString::fromUtf8(post.mMeta.mAuthorId.c_str()));
scoreLabel->setText(QString("1140")); //scoreLabel->setText(QString("1140"));
// exposed for testing...
float score = rsPosted->calcPostScore(post.mMeta);
time_t now = time(NULL);
QString fromLabelTxt = QString(" Age: ") + QString::number(now - post.mMeta.mPublishTs);
fromLabelTxt += QString(" Score: ") + QString::number(score);
fromLabel->setText(fromLabelTxt);
uint32_t votes = 0;
uint32_t comments = 0;
rsPosted->extractPostedCache(post.mMeta.mServiceString, votes, comments);
scoreLabel->setText(QString::number(votes));
QString commentLabel = QString("Comments: ") + QString::number(comments);
commentLabel += QString(" Votes: ") + QString::number(votes);
siteLabel->setText(commentLabel);
QDateTime ts;
ts.setTime_t(post.mMeta.mPublishTs);
dateLabel->setText(ts.toString(QString("yyyy/MM/dd hh:mm:ss")));
return; return;
} }

View File

@ -281,6 +281,13 @@ void PostedListDialog::loadCurrentForumThreads(const std::string &forumId)
std::cerr << "PostedListDialog::loadCurrentForumThreads(" << forumId << ")"; std::cerr << "PostedListDialog::loadCurrentForumThreads(" << forumId << ")";
std::cerr << std::endl; std::cerr << std::endl;
if (forumId.empty())
{
std::cerr << "PostedListDialog::loadCurrentForumThreads() Empty GroupId .. ignoring Req";
std::cerr << std::endl;
return;
}
/* if already active -> kill current loading */ /* if already active -> kill current loading */
if (mThreadLoading) if (mThreadLoading)
{ {
@ -300,20 +307,26 @@ void PostedListDialog::loadCurrentForumThreads(const std::string &forumId)
void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &forumId) void PostedListDialog::requestGroupThreadData_InsertThreads(const std::string &groupId)
{ {
RsTokReqOptions opts; RsTokReqOptions opts;
opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST; opts.mOptions = RS_TOKREQOPT_MSG_THREAD | RS_TOKREQOPT_MSG_LATEST;
std::list<std::string> grpIds; std::list<std::string> grpIds;
grpIds.push_back(forumId); grpIds.push_back(groupId);
std::cerr << "PostedListDialog::requestGroupThreadData_InsertThreads(" << forumId << ")"; std::cerr << "PostedListDialog::requestGroupThreadData_InsertThreads(" << groupId << ")";
std::cerr << std::endl; std::cerr << std::endl;
uint32_t token; uint32_t token;
mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS); //mPostedQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, POSTEDDIALOG_INSERTTHREADS);
// Do specific Posted Request....
rsPosted->requestRanking(token, groupId);
// get the Queue to handle response.
mPostedQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_DATA, POSTEDDIALOG_INSERTTHREADS);
} }
@ -326,7 +339,10 @@ void PostedListDialog::loadGroupThreadData_InsertThreads(const uint32_t &token)
while(moreData) while(moreData)
{ {
RsPostedPost post; RsPostedPost post;
if (rsPosted->getPost(token, post)) // Old Format.
//if (rsPosted->getPost(token, post))
if (rsPosted->getRankedPost(token, post))
{ {
std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads() MsgId: " << post.mMeta.mMsgId; std::cerr << "PostedListDialog::loadGroupThreadData_InsertThreads() MsgId: " << post.mMeta.mMsgId;
std::cerr << std::endl; std::cerr << std::endl;
@ -471,9 +487,9 @@ void PostedListDialog::insertGroupData(const std::list<RsGroupMetaData> &groupLi
GroupItemInfo groupItemInfo; GroupItemInfo groupItemInfo;
groupInfoToGroupItemInfo(*it, groupItemInfo); groupInfoToGroupItemInfo(*it, groupItemInfo);
if (flags & RS_DISTRIB_ADMIN) { if (flags & RSGXS_GROUP_SUBSCRIBE_ADMIN) {
adminList.push_back(groupItemInfo); adminList.push_back(groupItemInfo);
} else if (flags & RS_DISTRIB_SUBSCRIBED) { } else if (flags & RSGXS_GROUP_SUBSCRIBE_SUBSCRIBED) {
/* subscribed forum */ /* subscribed forum */
subList.push_back(groupItemInfo); subList.push_back(groupItemInfo);
} else { } else {