Merge pull request #2114 from defnax/count-comments-button

[Boards] Added back to display comments counts on the comments button
This commit is contained in:
csoler 2020-11-27 19:50:14 +01:00 committed by GitHub
commit f5d6415c0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,29 +60,25 @@ BoardPostDisplayWidgetBase::BoardPostDisplayWidgetBase(const RsPostedPost& post,
void BoardPostDisplayWidgetBase::setCommentsSize(int comNb) void BoardPostDisplayWidgetBase::setCommentsSize(int comNb)
{ {
QString sComButText ; QString sComButText = tr("Comment");
QString sComButTooltip ;
if (comNb == 1) if (comNb == 1)
sComButText = tr("1 comment"); sComButText = tr("1 comment");
else if(comNb > 1) else if(comNb > 1)
sComButText = tr("%1 comments").arg(comNb); sComButText = tr("%1 comments").arg(comNb);
else
sComButText = tr("No comments yet. Click to add one.");
commentButton()->setToolTip(sComButText); if (comNb == 0)
sComButTooltip = tr("No comments yet. Click to add one.");
commentButton()->setToolTip(sComButTooltip);
commentButton()->setText(sComButText);
if(comNb > 0) if(comNb > 0)
commentButton()->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/comments_blue.png")); commentButton()->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/comments_blue.png"));
else else
commentButton()->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/comments.png")); commentButton()->setIcon(FilesDefs::getIconFromQtResourcePath(":/images/comments.png"));
// QString sComButText = tr("Comment");
// if (comNb == 1)
// sComButText = sComButText.append("(1)");
// else if(comNb > 1)
// sComButText = tr("Comments ").append("(%1)").arg(comNb);
//
commentButton()->setText(tr("Comments"));
} }
void BoardPostDisplayWidgetBase::makeDownVote() void BoardPostDisplayWidgetBase::makeDownVote()