From 2bed14865f06a4195a1acc1cd847511aae940e28 Mon Sep 17 00:00:00 2001 From: defnax Date: Fri, 4 Apr 2014 13:55:00 +0000 Subject: [PATCH] forget to commit this, vote buttons not yet done. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7229 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- .../src/gui/feeds/GxsChannelPostItem.cpp | 61 +++++++++++++++++++ .../src/gui/feeds/GxsChannelPostItem.h | 6 ++ .../src/gui/feeds/GxsChannelPostItem.ui | 45 +++++++++++++- 3 files changed, 111 insertions(+), 1 deletion(-) diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp index f47f257b2..ad627fb01 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.cpp @@ -36,6 +36,8 @@ #include "util/HandleRichText.h" #include "util/DateTime.h" +#include + /**** * #define DEBUG_ITEM 1 ****/ @@ -105,6 +107,9 @@ void GxsChannelPostItem::setup() connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) ); connect( NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)), Qt::QueuedConnection); + //connect( voteUpButton, SIGNAL(clicked()), this, SLOT(makeUpVote())); + //connect( voteDownButton, SIGNAL(clicked()), this, SLOT( makeDownVote())); + downloadButton->hide(); playButton->hide(); warn_image_label->hide(); @@ -199,6 +204,9 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post) /* subject */ titleLabel->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str())); subjectLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); + + //QString score = QString::number(post.mTopScore); + // scoreLabel->setText(score); /* disable buttons: deletion facility not enabled with cache services yet */ clearButton->setEnabled(false); @@ -259,6 +267,35 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post) //newLabel->setVisible(false); } } + + // differences between Feed or Top of Comment. + if (mParent) + { + commentButton->show(); + + if (post.mComments) + { + QString commentText = QString::number(post.mComments); + commentText += " "; + commentText += tr("Comments"); + commentButton->setText(commentText); + } + else + { + commentButton->setText(tr("Comment")); + } + } + else + { + commentButton->hide(); + } + + // disable voting buttons - if they have already voted. + /*if (post.mMeta.mMsgStatus & GXS_SERV::GXS_MSG_STATUS_VOTE_MASK) + { + voteUpButton->setEnabled(false); + voteDownButton->setEnabled(false); + }*/ msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS)); msgFrame->setVisible(!post.mMsg.empty()); @@ -539,3 +576,27 @@ void GxsChannelPostItem::copyLink() #endif } + +void GxsChannelPostItem::makeDownVote() +{ + RsGxsGrpMsgIdPair msgId; + msgId.first = mPost.mMeta.mGroupId; + msgId.second = mPost.mMeta.mMsgId; + + voteUpButton->setEnabled(false); + voteDownButton->setEnabled(false); + + emit vote(msgId, false); +} + +void GxsChannelPostItem::makeUpVote() +{ + RsGxsGrpMsgIdPair msgId; + msgId.first = mPost.mMeta.mGroupId; + msgId.second = mPost.mMeta.mMsgId; + + voteUpButton->setEnabled(false); + voteDownButton->setEnabled(false); + + emit vote(msgId, true); +} diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h index 4ce835eb3..827705f2f 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.h @@ -63,6 +63,12 @@ private slots: void unsubscribeChannel(); void updateItem(); + void makeUpVote(); + void makeDownVote(); + +signals: + void vote(const RsGxsGrpMsgIdPair& msgId, bool up); + private: void setup(); void loadPost(const RsGxsChannelPost &post); diff --git a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui index 5cd79009b..9db435085 100644 --- a/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui +++ b/retroshare-gui/src/gui/feeds/GxsChannelPostItem.ui @@ -6,7 +6,7 @@ 0 0 - 629 + 757 177 @@ -224,6 +224,43 @@ p, li { white-space: pre-wrap; } + + + + + Tahoma + 10 + 75 + true + + + + 0 + + + + + + + + + + + :/images/vote_up.png:/images/vote_up.png + + + + + + + + + + + :/images/vote_down.png:/images/vote_down.png + + + @@ -239,6 +276,9 @@ p, li { white-space: pre-wrap; } :/images/download16.png:/images/download16.png + + false + @@ -470,6 +510,9 @@ p, li { white-space: pre-wrap; } + + +