chore: remove dead message element code (#5225)

This commit is contained in:
nerix 2024-03-02 22:09:54 +01:00 committed by GitHub
parent a041e13d21
commit 3c13e0c6d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 4 additions and 55 deletions

View file

@ -169,6 +169,7 @@
- Dev: Added the `launachable` entry to Linux AppData. (#5210)
- Dev: Cleaned up and optimized resources. (#5222)
- Dev: Refactor `StreamerMode`. (#5216)
- Dev: Cleaned up unused code in `MessageElement` and `MessageLayoutElement`. (#5225)
## 2.4.6

View file

@ -51,12 +51,6 @@ MessageElement *MessageElement::setLink(const Link &link)
return this;
}
MessageElement *MessageElement::setText(const QString &text)
{
this->text_ = text;
return this;
}
MessageElement *MessageElement::setTooltip(const QString &tooltip)
{
this->tooltip_ = tooltip;
@ -94,29 +88,11 @@ void MessageElement::addFlags(MessageElementFlags flags)
this->flags_.set(flags);
}
// Empty
EmptyElement::EmptyElement()
: MessageElement(MessageElementFlag::None)
{
}
void EmptyElement::addToContainer(MessageLayoutContainer &container,
MessageElementFlags flags)
{
}
EmptyElement &EmptyElement::instance()
{
static EmptyElement instance;
return instance;
}
// IMAGE
ImageElement::ImageElement(ImagePtr image, MessageElementFlags flags)
: MessageElement(flags)
, image_(image)
, image_(std::move(image))
{
// this->setTooltip(image->getTooltip());
}
void ImageElement::addToContainer(MessageLayoutContainer &container,
@ -136,7 +112,7 @@ CircularImageElement::CircularImageElement(ImagePtr image, int padding,
QColor background,
MessageElementFlags flags)
: MessageElement(flags)
, image_(image)
, image_(std::move(image))
, padding_(padding)
, background_(background)
{
@ -808,7 +784,7 @@ void LinebreakElement::addToContainer(MessageLayoutContainer &container,
ScalingImageElement::ScalingImageElement(ImageSet images,
MessageElementFlags flags)
: MessageElement(flags)
, images_(images)
, images_(std::move(images))
{
}

View file

@ -160,13 +160,6 @@ using MessageElementFlags = FlagsEnum<MessageElementFlag>;
class MessageElement
{
public:
enum UpdateFlags : char {
Update_Text = 1,
Update_Emotes = 2,
Update_Images = 4,
Update_All = Update_Text | Update_Emotes | Update_Images
};
virtual ~MessageElement();
MessageElement(const MessageElement &) = delete;
@ -176,7 +169,6 @@ public:
MessageElement &operator=(MessageElement &&) = delete;
MessageElement *setLink(const Link &link);
MessageElement *setText(const QString &text);
MessageElement *setTooltip(const QString &tooltip);
MessageElement *setTrailingSpace(bool value);
@ -195,27 +187,11 @@ protected:
bool trailingSpace = true;
private:
QString text_;
Link link_;
QString tooltip_;
MessageElementFlags flags_;
};
// used when layout element doesn't have a creator
class EmptyElement : public MessageElement
{
public:
EmptyElement();
void addToContainer(MessageLayoutContainer &container,
MessageElementFlags flags) override;
static EmptyElement &instance();
private:
ImagePtr image_;
};
// contains a simple image
class ImageElement : public MessageElement
{

View file

@ -162,8 +162,6 @@ public:
const QSize &size, QColor color_, FontStyle style_,
float scale_);
void listenToLinkChanges();
protected:
void addCopyTextToString(QString &str, uint32_t from = 0,
uint32_t to = UINT32_MAX) const override;
@ -176,8 +174,6 @@ protected:
QColor color_;
FontStyle style_;
float scale_;
pajlada::Signals::SignalHolder managedConnections_;
};
// TEXT ICON