summary refs log tree commit diff
path: root/include/timeline
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-14 12:29:54 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-01-14 12:29:54 +0200
commitdfeb0c833ab094969c5da7f1a5953b30b5960665 (patch)
treea7dcda0e2a891139120153306b335dddbaaa6745 /include/timeline
parentFix macOs ci (diff)
downloadnheko-dfeb0c833ab094969c5da7f1a5953b30b5960665.tar.xz
Move timestamps to the right
Diffstat (limited to 'include/timeline')
-rw-r--r--include/timeline/TimelineItem.h33
1 files changed, 26 insertions, 7 deletions
diff --git a/include/timeline/TimelineItem.h b/include/timeline/TimelineItem.h
index 9a0aee1d..15cbc714 100644
--- a/include/timeline/TimelineItem.h
+++ b/include/timeline/TimelineItem.h
@@ -122,10 +122,14 @@ private:
         QAction *showReadReceipts_;
 
         QHBoxLayout *topLayout_;
-        QVBoxLayout *sideLayout_; // Avatar or Timestamp
-        QVBoxLayout *mainLayout_; // Header & Message body
+        //! The message and the timestamp/checkmark.
+        QHBoxLayout *messageLayout_;
+        //! Avatar or Timestamp
+        QVBoxLayout *sideLayout_;
+        //! Header & Message body
+        QVBoxLayout *mainLayout_;
 
-        QHBoxLayout *headerLayout_; // Username (&) Timestamp
+        QVBoxLayout *headerLayout_; // Username (&) Timestamp
 
         Avatar *userAvatar_;
 
@@ -159,17 +163,25 @@ TimelineItem::setupLocalWidgetLayout(Widget *widget,
         widgetLayout->addWidget(widget);
         widgetLayout->addStretch(1);
 
+        messageLayout_->setContentsMargins(0, 0, 20, 4);
+        messageLayout_->setSpacing(20);
+
         if (withSender) {
                 generateBody(displayName, "");
                 setupAvatarLayout(displayName);
-                mainLayout_->addLayout(headerLayout_);
+
+                headerLayout_->addLayout(widgetLayout);
+                messageLayout_->addLayout(headerLayout_, 1);
 
                 AvatarProvider::resolve(userid, [=](const QImage &img) { setUserAvatar(img); });
         } else {
                 setupSimpleLayout();
+
+                messageLayout_->addLayout(widgetLayout, 1);
         }
 
-        mainLayout_->addLayout(widgetLayout);
+        messageLayout_->addWidget(timestamp_);
+        mainLayout_->addLayout(messageLayout_);
 }
 
 template<class Event, class Widget>
@@ -201,16 +213,23 @@ TimelineItem::setupWidgetLayout(Widget *widget,
         widgetLayout->addWidget(widget);
         widgetLayout->addStretch(1);
 
+        messageLayout_->setContentsMargins(0, 0, 20, 4);
+        messageLayout_->setSpacing(20);
+
         if (withSender) {
                 generateBody(displayName, "");
                 setupAvatarLayout(displayName);
 
-                mainLayout_->addLayout(headerLayout_);
+                headerLayout_->addLayout(widgetLayout);
+                messageLayout_->addLayout(headerLayout_, 1);
 
                 AvatarProvider::resolve(sender, [=](const QImage &img) { setUserAvatar(img); });
         } else {
                 setupSimpleLayout();
+
+                messageLayout_->addLayout(widgetLayout, 1);
         }
 
-        mainLayout_->addLayout(widgetLayout);
+        messageLayout_->addWidget(timestamp_);
+        mainLayout_->addLayout(messageLayout_);
 }