mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-30 01:38:51 -04:00
added star for new posts
This commit is contained in:
parent
f40d7a75b3
commit
ebaf5e63c3
1 changed files with 12 additions and 8 deletions
|
@ -77,6 +77,7 @@ static const int CHANNEL_TABS_POSTS = 1;
|
||||||
|
|
||||||
// This variable determines the zoom factor on the text below thumbnails. 2.0 is mostly correct for all screen.
|
// This variable determines the zoom factor on the text below thumbnails. 2.0 is mostly correct for all screen.
|
||||||
#define THUMBNAIL_OVERSAMPLE_FACTOR 2.0
|
#define THUMBNAIL_OVERSAMPLE_FACTOR 2.0
|
||||||
|
#define STAR_OVERLAY_IMAGE ":icons/star_overlay_128.png"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(RsGxsFile)
|
Q_DECLARE_METATYPE(RsGxsFile)
|
||||||
|
|
||||||
|
@ -103,23 +104,19 @@ public:
|
||||||
|
|
||||||
// now fill the data
|
// now fill the data
|
||||||
|
|
||||||
if(post.mThumbnail.mSize > 0)
|
|
||||||
{
|
|
||||||
QPixmap thumbnail;
|
QPixmap thumbnail;
|
||||||
|
|
||||||
|
if(post.mThumbnail.mSize > 0)
|
||||||
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData, post.mThumbnail.mSize, thumbnail,GxsIdDetails::ORIGINAL);
|
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData, post.mThumbnail.mSize, thumbnail,GxsIdDetails::ORIGINAL);
|
||||||
lb->setPixmap(thumbnail);
|
|
||||||
}
|
|
||||||
else if(post.mMeta.mPublishTs > 0) // this is for testing that the post is not an empty post (happens at the end of the last row)
|
else if(post.mMeta.mPublishTs > 0) // this is for testing that the post is not an empty post (happens at the end of the last row)
|
||||||
{
|
thumbnail = FilesDefs::getPixmapFromQtResourcePath(CHAN_DEFAULT_IMAGE);
|
||||||
QPixmap thumbnail = FilesDefs::getPixmapFromQtResourcePath(CHAN_DEFAULT_IMAGE);
|
|
||||||
lb->setPixmap(thumbnail);
|
|
||||||
}
|
|
||||||
|
|
||||||
QFontMetricsF fm(font());
|
QFontMetricsF fm(font());
|
||||||
int W = THUMBNAIL_OVERSAMPLE_FACTOR * THUMBNAIL_W * fm.height() ;
|
int W = THUMBNAIL_OVERSAMPLE_FACTOR * THUMBNAIL_W * fm.height() ;
|
||||||
int H = THUMBNAIL_OVERSAMPLE_FACTOR * THUMBNAIL_H * fm.height() ;
|
int H = THUMBNAIL_OVERSAMPLE_FACTOR * THUMBNAIL_H * fm.height() ;
|
||||||
|
|
||||||
lb->setFixedSize(W,H);
|
lb->setFixedSize(W,H);
|
||||||
|
lb->setPixmap(thumbnail);
|
||||||
|
|
||||||
lt->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str()));
|
lt->setText(QString::fromUtf8(post.mMeta.mMsgName.c_str()));
|
||||||
|
|
||||||
|
@ -164,6 +161,13 @@ void ChannelPostDelegate::paint(QPainter * painter, const QStyleOptionViewItem &
|
||||||
|
|
||||||
w.render(&pixmap,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
w.render(&pixmap,QPoint(),QRegion(),QWidget::DrawChildren );// draw the widgets, not the background
|
||||||
|
|
||||||
|
if(IS_MSG_UNREAD(post.mMeta.mMsgStatus) || IS_MSG_NEW(post.mMeta.mMsgStatus))
|
||||||
|
{
|
||||||
|
QPainter p(&pixmap);
|
||||||
|
QFontMetricsF fm(option.font);
|
||||||
|
p.drawPixmap(QPoint(6.2*fm.height(),6.9*fm.height()),FilesDefs::getPixmapFromQtResourcePath(STAR_OVERLAY_IMAGE).scaled(7*fm.height(),7*fm.height(),Qt::KeepAspectRatio,Qt::SmoothTransformation));
|
||||||
|
}
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
// if(index.row()==0 && index.column()==0)
|
// if(index.row()==0 && index.column()==0)
|
||||||
// {
|
// {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue