Merge 21c2302f75
into 4c00e64f3f
This commit is contained in:
commit
4e22027980
@ -80,8 +80,6 @@ private:
|
|||||||
void setupAvatarLayout(const QString &userName);
|
void setupAvatarLayout(const QString &userName);
|
||||||
void setupSimpleLayout();
|
void setupSimpleLayout();
|
||||||
|
|
||||||
QString replaceEmoji(const QString &body);
|
|
||||||
|
|
||||||
DescInfo descriptionMsg_;
|
DescInfo descriptionMsg_;
|
||||||
|
|
||||||
QHBoxLayout *topLayout_;
|
QHBoxLayout *topLayout_;
|
||||||
|
@ -303,12 +303,12 @@ TimelineItem::TimelineItem(const events::MessageEvent<msgs::Text> &event,
|
|||||||
void
|
void
|
||||||
TimelineItem::generateBody(const QString &body)
|
TimelineItem::generateBody(const QString &body)
|
||||||
{
|
{
|
||||||
QString content("<span style=\"color: black;\"> %1 </span>");
|
QString content("<span style=\"color: black; font-family: EmojiOne Color, Open Sans;\"> %1 </span>");
|
||||||
|
|
||||||
body_ = new QLabel(this);
|
body_ = new QLabel(this);
|
||||||
body_->setFont(font_);
|
body_->setFont(font_);
|
||||||
body_->setWordWrap(true);
|
body_->setWordWrap(true);
|
||||||
body_->setText(content.arg(replaceEmoji(body)));
|
body_->setText(content.arg(body));
|
||||||
body_->setMargin(0);
|
body_->setMargin(0);
|
||||||
|
|
||||||
body_->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
|
body_->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
|
||||||
@ -343,7 +343,7 @@ TimelineItem::generateBody(const QString &userid, const QString &body)
|
|||||||
body_ = new QLabel(this);
|
body_ = new QLabel(this);
|
||||||
body_->setFont(font_);
|
body_->setFont(font_);
|
||||||
body_->setWordWrap(true);
|
body_->setWordWrap(true);
|
||||||
body_->setText(bodyContent.arg(replaceEmoji(body)));
|
body_->setText(bodyContent.arg(body));
|
||||||
body_->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
|
body_->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextBrowserInteraction);
|
||||||
body_->setOpenExternalLinks(true);
|
body_->setOpenExternalLinks(true);
|
||||||
body_->setMargin(0);
|
body_->setMargin(0);
|
||||||
@ -366,27 +366,6 @@ TimelineItem::generateTimestamp(const QDateTime &time)
|
|||||||
timestamp_->setContentsMargins(0, topMargin, 0, 0);
|
timestamp_->setContentsMargins(0, topMargin, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
|
||||||
TimelineItem::replaceEmoji(const QString &body)
|
|
||||||
{
|
|
||||||
QString fmtBody = "";
|
|
||||||
|
|
||||||
for (auto &c : body) {
|
|
||||||
int code = c.unicode();
|
|
||||||
|
|
||||||
// TODO: Be more precise here.
|
|
||||||
if (code > 9000)
|
|
||||||
fmtBody += QString("<span style=\"font-family: Emoji "
|
|
||||||
"One; font-size: %1px\">")
|
|
||||||
.arg(conf::emojiSize) +
|
|
||||||
QString(c) + "</span>";
|
|
||||||
else
|
|
||||||
fmtBody += c;
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmtBody;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineItem::setupAvatarLayout(const QString &userName)
|
TimelineItem::setupAvatarLayout(const QString &userName)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user