fixed author tooltip in ForumModel

This commit is contained in:
csoler 2018-11-25 21:12:26 +01:00
parent 114a11af75
commit 65f2d26651
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C
2 changed files with 36 additions and 12 deletions

View File

@ -4,7 +4,9 @@
#include <QIcon>
#include "util/qtthreadsutils.h"
#include "util/HandleRichText.h"
#include "util/DateTime.h"
#include "gui/gxs/GxsIdDetails.h"
#include "GxsForumModel.h"
#include "retroshare/rsgxsflags.h"
#include "retroshare/rsgxsforums.h"
@ -333,9 +335,7 @@ QVariant RsGxsForumModel::missingRole(const ForumModelPostEntry& fmpe,int column
QVariant RsGxsForumModel::toolTipRole(const ForumModelPostEntry& fmpe,int column) const
{
if(column != COLUMN_THREAD_DISTRIBUTION)
return QVariant();
if(column == COLUMN_THREAD_DISTRIBUTION)
switch(fmpe.mReputationWarningLevel)
{
case 3: return QVariant(tr("Information for this identity is currently missing.")) ;
@ -345,6 +345,26 @@ QVariant RsGxsForumModel::toolTipRole(const ForumModelPostEntry& fmpe,int column
default:
return QVariant("[ERROR: missing reputation level information - contact the developers]");
}
if(column == COLUMN_THREAD_AUTHOR)
{
QString str,comment ;
QList<QIcon> icons;
if(!GxsIdDetails::MakeIdDesc(fmpe.mAuthorId, true, str, icons, comment,GxsIdDetails::ICON_TYPE_AVATAR))
return QVariant();
int S = QFontMetricsF(QApplication::font()).height();
QImage pix( (*icons.begin()).pixmap(QSize(4*S,4*S)).toImage());
QString embeddedImage;
if(RsHtml::makeEmbeddedImage(pix.scaled(QSize(4*S,4*S), Qt::KeepAspectRatio, Qt::SmoothTransformation), embeddedImage, 8*S * 8*S))
comment = "<table><tr><td>" + embeddedImage + "</td><td>" + comment + "</td></table>";
return comment;
}
return QVariant();
}
QVariant RsGxsForumModel::pinnedRole(const ForumModelPostEntry& fmpe,int column) const
@ -474,8 +494,9 @@ void RsGxsForumModel::setPosts(const RsGxsForumGroup& group, const std::vector<F
bool has_unread_below,has_read_below ;
recursUpdateReadStatus(0,has_unread_below,has_read_below) ;
#ifdef DEBUG_FORUMMODEL
debug_dump();
#endif
emit layoutChanged();
}

View File

@ -2469,7 +2469,10 @@ void GxsForumThreadWidget::async_msg_action(const MsgMethod &action)
}
if(msgs.size() != 1)
{
std::cerr << __PRETTY_FUNCTION__ << " more than 1 or no msgs selected in forum " << groupId() << std::endl;
return;
}
// 2 - sort the messages into a proper hierarchy