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
This commit is contained in:
defnax 2014-04-04 13:55:00 +00:00
parent 9cfc9ecee1
commit 2bed14865f
3 changed files with 111 additions and 1 deletions

View File

@ -36,6 +36,8 @@
#include "util/HandleRichText.h"
#include "util/DateTime.h"
#include <iostream>
/****
* #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();
@ -200,6 +205,9 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
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);
unsubscribeButton->setEnabled(false);
@ -260,6 +268,35 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
}
}
// 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);
}

View File

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

View File

@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>629</width>
<width>757</width>
<height>177</height>
</rect>
</property>
@ -224,6 +224,43 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="scoreLabel">
<property name="font">
<font>
<family>Tahoma</family>
<pointsize>10</pointsize>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="voteUpButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/vote_up.png</normaloff>:/images/vote_up.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="voteDownButton">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/vote_down.png</normaloff>:/images/vote_down.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="downloadButton">
<property name="font">
@ -239,6 +276,9 @@ p, li { white-space: pre-wrap; }
<iconset resource="../images.qrc">
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
</property>
<property name="autoExclusive">
<bool>false</bool>
</property>
</widget>
</item>
<item>
@ -470,6 +510,9 @@ p, li { white-space: pre-wrap; }
</widget>
<resources>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources>
<connections/>
</ui>