summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-29 20:39:22 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-29 20:39:22 +0300
commit62d54146a710bc9fdee77d29693e03383da1407a (patch)
tree6e21bb4aba7fcfbec019ca8919baa5ea1b486cf8
parentRefactor utils::getMessageDescription (diff)
downloadnheko-62d54146a710bc9fdee77d29693e03383da1407a.tar.xz
More consistent spacing between messages
-rw-r--r--include/Config.h10
-rw-r--r--src/timeline/TimelineItem.cc20
2 files changed, 17 insertions, 13 deletions
diff --git a/include/Config.h b/include/Config.h

index 1d05e82d..6e086f54 100644 --- a/include/Config.h +++ b/include/Config.h
@@ -84,10 +84,12 @@ static constexpr int roomDescription = 14; } // namespace topRoomBar namespace timeline { -static constexpr int msgMargin = 14; -static constexpr int avatarSize = 36; -static constexpr int headerSpacing = 7; -static constexpr int headerLeftMargin = 15; +static constexpr int msgAvatarTopMargin = 15; +static constexpr int msgTopMargin = 2; +static constexpr int msgLeftMargin = 14; +static constexpr int avatarSize = 36; +static constexpr int headerSpacing = 3; +static constexpr int headerLeftMargin = 15; namespace fonts { static constexpr int timestamp = 13; diff --git a/src/timeline/TimelineItem.cc b/src/timeline/TimelineItem.cc
index 2b5ffbf3..c6b6ab95 100644 --- a/src/timeline/TimelineItem.cc +++ b/src/timeline/TimelineItem.cc
@@ -31,9 +31,8 @@ constexpr const static char *CHECKMARK = "✓"; -constexpr int MSG_RIGHT_MARGIN = 7; -constexpr int MSG_BOTTOM_MARGIN = 4; -constexpr int MSG_PADDING = 20; +constexpr int MSG_RIGHT_MARGIN = 7; +constexpr int MSG_PADDING = 20; void TimelineItem::init() @@ -72,10 +71,11 @@ TimelineItem::init() topLayout_ = new QHBoxLayout(this); mainLayout_ = new QVBoxLayout; messageLayout_ = new QHBoxLayout; - messageLayout_->setContentsMargins(0, 0, MSG_RIGHT_MARGIN, MSG_BOTTOM_MARGIN); + messageLayout_->setContentsMargins(0, 0, MSG_RIGHT_MARGIN, 0); messageLayout_->setSpacing(MSG_PADDING); - topLayout_->setContentsMargins(conf::timeline::msgMargin, conf::timeline::msgMargin, 0, 0); + topLayout_->setContentsMargins( + conf::timeline::msgLeftMargin, conf::timeline::msgTopMargin, 0, 0); topLayout_->setSpacing(0); topLayout_->addLayout(mainLayout_, 1); @@ -498,7 +498,8 @@ TimelineItem::replaceEmoji(const QString &body) void TimelineItem::setupAvatarLayout(const QString &userName) { - topLayout_->setContentsMargins(conf::timeline::msgMargin, conf::timeline::msgMargin, 0, 0); + topLayout_->setContentsMargins( + conf::timeline::msgLeftMargin, conf::timeline::msgAvatarTopMargin, 0, 0); userAvatar_ = new Avatar(this); userAvatar_->setLetter(QChar(userName[0]).toUpper()); @@ -513,7 +514,7 @@ TimelineItem::setupAvatarLayout(const QString &userName) headerLayout_ = new QVBoxLayout; headerLayout_->setMargin(0); - headerLayout_->setSpacing(0); + headerLayout_->setSpacing(conf::timeline::headerSpacing); headerLayout_->addWidget(userName_); headerLayout_->addWidget(body_); @@ -522,8 +523,9 @@ TimelineItem::setupAvatarLayout(const QString &userName) void TimelineItem::setupSimpleLayout() { - topLayout_->setContentsMargins(conf::timeline::msgMargin + conf::timeline::avatarSize + 2, - conf::timeline::msgMargin, + topLayout_->setContentsMargins(conf::timeline::msgLeftMargin + conf::timeline::avatarSize + + 2, + conf::timeline::msgTopMargin, 0, 0); }