summary refs log tree commit diff
path: root/src/TimelineItem.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2017-09-10 13:13:02 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-09-10 13:13:02 +0300
commit29e21e2970c2786eb1f6910c9da99a3dbbf0a49d (patch)
tree6b981d9167ef70a408fa395a720afb09ce7b5e21 /src/TimelineItem.cc
parentStyle change again (diff)
parentImplement image uploads (#24) (diff)
downloadnheko-29e21e2970c2786eb1f6910c9da99a3dbbf0a49d.tar.xz
Merge branch 'images'
Diffstat (limited to 'src/TimelineItem.cc')
-rw-r--r--src/TimelineItem.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/TimelineItem.cc b/src/TimelineItem.cc

index 9d24a96c..92351d63 100644 --- a/src/TimelineItem.cc +++ b/src/TimelineItem.cc
@@ -107,6 +107,39 @@ TimelineItem::TimelineItem(events::MessageEventType ty, mainLayout_->addWidget(body_); } +TimelineItem::TimelineItem(ImageItem *image, + const QString &userid, + bool withSender, + QWidget *parent) + : QWidget{ parent } +{ + init(); + + auto displayName = TimelineViewManager::displayName(userid); + auto timestamp = QDateTime::currentDateTime(); + + descriptionMsg_ = { "You", userid, " sent an image", descriptiveTime(timestamp) }; + + generateTimestamp(timestamp); + + auto imageLayout = new QHBoxLayout(); + imageLayout->setMargin(0); + imageLayout->addWidget(image); + imageLayout->addStretch(1); + + if (withSender) { + generateBody(displayName, ""); + setupAvatarLayout(displayName); + mainLayout_->addLayout(headerLayout_); + + AvatarProvider::resolve(userid, this); + } else { + setupSimpleLayout(); + } + + mainLayout_->addLayout(imageLayout); +} + /* * Used to display images. The avatar and the username are displayed. */