More consistent spacing between messages

This commit is contained in:
Konstantinos Sideris 2018-04-29 20:39:22 +03:00
parent 95120c602b
commit 62d54146a7
2 changed files with 17 additions and 13 deletions

View file

@ -84,9 +84,11 @@ static constexpr int roomDescription = 14;
} // namespace topRoomBar } // namespace topRoomBar
namespace timeline { namespace timeline {
static constexpr int msgMargin = 14; static constexpr int msgAvatarTopMargin = 15;
static constexpr int msgTopMargin = 2;
static constexpr int msgLeftMargin = 14;
static constexpr int avatarSize = 36; static constexpr int avatarSize = 36;
static constexpr int headerSpacing = 7; static constexpr int headerSpacing = 3;
static constexpr int headerLeftMargin = 15; static constexpr int headerLeftMargin = 15;
namespace fonts { namespace fonts {

View file

@ -32,7 +32,6 @@
constexpr const static char *CHECKMARK = ""; constexpr const static char *CHECKMARK = "";
constexpr int MSG_RIGHT_MARGIN = 7; constexpr int MSG_RIGHT_MARGIN = 7;
constexpr int MSG_BOTTOM_MARGIN = 4;
constexpr int MSG_PADDING = 20; constexpr int MSG_PADDING = 20;
void void
@ -72,10 +71,11 @@ TimelineItem::init()
topLayout_ = new QHBoxLayout(this); topLayout_ = new QHBoxLayout(this);
mainLayout_ = new QVBoxLayout; mainLayout_ = new QVBoxLayout;
messageLayout_ = new QHBoxLayout; 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); 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_->setSpacing(0);
topLayout_->addLayout(mainLayout_, 1); topLayout_->addLayout(mainLayout_, 1);
@ -498,7 +498,8 @@ TimelineItem::replaceEmoji(const QString &body)
void void
TimelineItem::setupAvatarLayout(const QString &userName) 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_ = new Avatar(this);
userAvatar_->setLetter(QChar(userName[0]).toUpper()); userAvatar_->setLetter(QChar(userName[0]).toUpper());
@ -513,7 +514,7 @@ TimelineItem::setupAvatarLayout(const QString &userName)
headerLayout_ = new QVBoxLayout; headerLayout_ = new QVBoxLayout;
headerLayout_->setMargin(0); headerLayout_->setMargin(0);
headerLayout_->setSpacing(0); headerLayout_->setSpacing(conf::timeline::headerSpacing);
headerLayout_->addWidget(userName_); headerLayout_->addWidget(userName_);
headerLayout_->addWidget(body_); headerLayout_->addWidget(body_);
@ -522,8 +523,9 @@ TimelineItem::setupAvatarLayout(const QString &userName)
void void
TimelineItem::setupSimpleLayout() TimelineItem::setupSimpleLayout()
{ {
topLayout_->setContentsMargins(conf::timeline::msgMargin + conf::timeline::avatarSize + 2, topLayout_->setContentsMargins(conf::timeline::msgLeftMargin + conf::timeline::avatarSize +
conf::timeline::msgMargin, 2,
conf::timeline::msgTopMargin,
0, 0,
0); 0);
} }