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/HandleRichText.h"
#include "util/DateTime.h" #include "util/DateTime.h"
#include <iostream>
/**** /****
* #define DEBUG_ITEM 1 * #define DEBUG_ITEM 1
****/ ****/
@ -105,6 +107,9 @@ void GxsChannelPostItem::setup()
connect( readButton, SIGNAL( toggled(bool) ), this, SLOT( readToggled(bool) ) ); 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( 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(); downloadButton->hide();
playButton->hide(); playButton->hide();
warn_image_label->hide(); warn_image_label->hide();
@ -199,6 +204,9 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
/* subject */ /* subject */
titleLabel->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str())); 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)); 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 */ /* disable buttons: deletion facility not enabled with cache services yet */
clearButton->setEnabled(false); clearButton->setEnabled(false);
@ -259,6 +267,35 @@ void GxsChannelPostItem::loadPost(const RsGxsChannelPost &post)
//newLabel->setVisible(false); //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)); msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
msgFrame->setVisible(!post.mMsg.empty()); msgFrame->setVisible(!post.mMsg.empty());
@ -539,3 +576,27 @@ void GxsChannelPostItem::copyLink()
#endif #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 unsubscribeChannel();
void updateItem(); void updateItem();
void makeUpVote();
void makeDownVote();
signals:
void vote(const RsGxsGrpMsgIdPair& msgId, bool up);
private: private:
void setup(); void setup();
void loadPost(const RsGxsChannelPost &post); void loadPost(const RsGxsChannelPost &post);

View File

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>629</width> <width>757</width>
<height>177</height> <height>177</height>
</rect> </rect>
</property> </property>
@ -224,6 +224,43 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </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> <item>
<widget class="QPushButton" name="downloadButton"> <widget class="QPushButton" name="downloadButton">
<property name="font"> <property name="font">
@ -239,6 +276,9 @@ p, li { white-space: pre-wrap; }
<iconset resource="../images.qrc"> <iconset resource="../images.qrc">
<normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset> <normaloff>:/images/download16.png</normaloff>:/images/download16.png</iconset>
</property> </property>
<property name="autoExclusive">
<bool>false</bool>
</property>
</widget> </widget>
</item> </item>
<item> <item>
@ -470,6 +510,9 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
<resources> <resources>
<include location="../images.qrc"/> <include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
<include location="../images.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>