enabled token expiration, 30 seconds

add new, and hot ranking, and fixed top ranking for posts (not comments yet)
top ranking decay period set at 4 seconds for testing
enabled ranking posts 
fixed comments generation


git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-gxs-b1@5989 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
chrisparker126 2012-12-16 00:43:15 +00:00
parent 7935c5547f
commit 17bdfa7cad
6 changed files with 124 additions and 24 deletions

View file

@ -80,7 +80,9 @@ PostedListDialog::PostedListDialog(CommentHolder *commentHolder, QWidget *parent
connect( ui.groupTreeWidget, SIGNAL( treeCurrentItemChanged(QString) ), this, SLOT( changedTopic(QString) ) );
connect(ui.hotSortButton, SIGNAL(clicked()), this, SLOT(getHotRankings()));
connect(ui.hotSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
connect(ui.newSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
connect(ui.topSortButton, SIGNAL(clicked()), this, SLOT(getRankings()));
/* create posted tree */
yourTopics = ui.groupTreeWidget->addCategoryItem(tr("Your Topics"), QIcon(IMAGE_FOLDER), true);
@ -89,13 +91,13 @@ PostedListDialog::PostedListDialog(CommentHolder *commentHolder, QWidget *parent
otherTopics = ui.groupTreeWidget->addCategoryItem(tr("Other Topics"), QIcon(IMAGE_FOLDERYELLOW), false);
ui.hotSortButton->setChecked(true);
mSortButton = ui.hotSortButton;
connect( ui.newTopicButton, SIGNAL( clicked() ), this, SLOT( newTopic() ) );
connect(ui.refreshButton, SIGNAL(clicked()), this, SLOT(refreshTopics()));
connect(ui.submitPostButton, SIGNAL(clicked()), this, SLOT(newPost()));
}
void PostedListDialog::getHotRankings()
void PostedListDialog::getRankings()
{
if(mCurrTopicId.empty())
@ -107,7 +109,21 @@ void PostedListDialog::getHotRankings()
RsTokReqOptions opts;
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
uint32_t token;
rsPosted->requestPostRankings(token, RsPosted::BestRankType, mCurrTopicId);
QObject* button = sender();
if(button == ui.hotSortButton)
{
rsPosted->requestPostRankings(token, RsPosted::HotRankType, mCurrTopicId);
}else if(button == ui.topSortButton)
{
rsPosted->requestPostRankings(token, RsPosted::TopRankType, mCurrTopicId);
}else if(button == ui.newSortButton)
{
rsPosted->requestPostRankings(token, RsPosted::NewRankType, mCurrTopicId);
}else{
return;
}
mPostedQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_DATA, TOKEN_USER_TYPE_POST_RANKINGS);
}
@ -172,6 +188,9 @@ void PostedListDialog::groupListCustomPopupMenu( QPoint /*point*/ )
void PostedListDialog::newPost()
{
if(mCurrTopicId.empty())
return;
PostedCreatePostDialog cp(mPostedQueue, rsPosted, mCurrTopicId, this);
cp.exec();
}

View file

@ -74,7 +74,7 @@ private slots:
void submitVote(const RsGxsGrpMsgIdPair& msgId, bool up);
void getHotRankings();
void getRankings();
private:
@ -133,7 +133,6 @@ private:
QTreeWidgetItem *popularTopics;
QTreeWidgetItem *otherTopics;
QAbstractButton *mSortButton;
bool mThreadLoading;
RsGxsGroupId mCurrTopicId;

View file

@ -139,7 +139,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="newPostButton">
<widget class="QPushButton" name="submitPostButton">
<property name="text">
<string>Submit Post</string>
</property>
@ -220,7 +220,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>472</width>
<width>426</width>
<height>327</height>
</rect>
</property>