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 12:58:00 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2017-09-10 12:58:00 +0300
commitedff71bc2403c966bd61d5dde391184aa8822aac (patch)
treeb5bb03f52de228110bd30cb0be36183574358aa0 /src/TimelineItem.cc
parentAllow port number as part of the hostname (diff)
downloadnheko-edff71bc2403c966bd61d5dde391184aa8822aac.tar.xz
Implement image uploads (#24)
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. */