summary refs log tree commit diff
path: root/src/TimelineItem.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/TimelineItem.cc')
-rw-r--r--src/TimelineItem.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/TimelineItem.cc b/src/TimelineItem.cc

index 607522a3..4d33db70 100644 --- a/src/TimelineItem.cc +++ b/src/TimelineItem.cc
@@ -18,6 +18,7 @@ #include <QDateTime> #include <QDebug> +#include "ImageItem.h" #include "TimelineItem.h" TimelineItem::TimelineItem(const QString &userid, const QString &color, const QString &body, QWidget *parent) @@ -36,6 +37,42 @@ TimelineItem::TimelineItem(const QString &body, QWidget *parent) setupLayout(); } +TimelineItem::TimelineItem(ImageItem *image, const Event &event, const QString &color, QWidget *parent) + : QWidget(parent) +{ + auto timestamp = QDateTime::fromMSecsSinceEpoch(event.timestamp()); + generateTimestamp(timestamp); + generateBody(event.sender(), color, ""); + + top_layout_ = new QHBoxLayout(); + top_layout_->setMargin(0); + top_layout_->addWidget(time_label_); + + auto right_layout = new QVBoxLayout(); + right_layout->addWidget(content_label_); + right_layout->addWidget(image); + + top_layout_->addLayout(right_layout); + top_layout_->addStretch(1); + + setLayout(top_layout_); +} + +TimelineItem::TimelineItem(ImageItem *image, const Event &event, QWidget *parent) + : QWidget(parent) +{ + auto timestamp = QDateTime::fromMSecsSinceEpoch(event.timestamp()); + generateTimestamp(timestamp); + + top_layout_ = new QHBoxLayout(); + top_layout_->setMargin(0); + top_layout_->addWidget(time_label_); + top_layout_->addWidget(image, 1); + top_layout_->addStretch(1); + + setLayout(top_layout_); +} + TimelineItem::TimelineItem(const Event &event, bool with_sender, const QString &color, QWidget *parent) : QWidget(parent) {