refactor: Turn link-info into its own element and class (#5178)
This commit is contained in:
@@ -77,9 +77,9 @@ MessageLayoutElement *MessageLayoutElement::setTrailingSpace(bool value)
|
||||
return this;
|
||||
}
|
||||
|
||||
MessageLayoutElement *MessageLayoutElement::setLink(const Link &_link)
|
||||
MessageLayoutElement *MessageLayoutElement::setLink(const Link &link)
|
||||
{
|
||||
this->link_ = _link;
|
||||
this->link_ = link;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -89,9 +89,13 @@ MessageLayoutElement *MessageLayoutElement::setText(const QString &_text)
|
||||
return this;
|
||||
}
|
||||
|
||||
const Link &MessageLayoutElement::getLink() const
|
||||
Link MessageLayoutElement::getLink() const
|
||||
{
|
||||
return this->link_;
|
||||
if (this->link_)
|
||||
{
|
||||
return *this->link_;
|
||||
}
|
||||
return this->creator_.getLink();
|
||||
}
|
||||
|
||||
const QString &MessageLayoutElement::getText() const
|
||||
@@ -406,14 +410,6 @@ TextLayoutElement::TextLayoutElement(MessageElement &_creator, QString &_text,
|
||||
this->setText(_text);
|
||||
}
|
||||
|
||||
void TextLayoutElement::listenToLinkChanges()
|
||||
{
|
||||
this->managedConnections_.managedConnect(
|
||||
static_cast<TextElement &>(this->getCreator()).linkChanged, [this]() {
|
||||
this->setLink(this->getCreator().getLink());
|
||||
});
|
||||
}
|
||||
|
||||
void TextLayoutElement::addCopyTextToString(QString &str, uint32_t from,
|
||||
uint32_t to) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user