diff --git a/src/messages/link.cpp b/src/messages/link.cpp index 37d1d095c..419bfaf77 100644 --- a/src/messages/link.cpp +++ b/src/messages/link.cpp @@ -2,7 +2,6 @@ namespace chatterino { namespace messages { - Link::Link() : type(None) , value(QString()) @@ -19,16 +18,5 @@ bool Link::isValid() const { return this->type != None; } - -Link::Type Link::getType() const -{ - return this->type; -} - -const QString &Link::getValue() const -{ - return this->value; -} - } // namespace messages } // namespace chatterino diff --git a/src/messages/link.hpp b/src/messages/link.hpp index 8a10dc21a..071a175fa 100644 --- a/src/messages/link.hpp +++ b/src/messages/link.hpp @@ -4,9 +4,7 @@ namespace chatterino { namespace messages { - -class Link -{ +struct Link { public: enum Type { None, @@ -23,14 +21,10 @@ public: Link(); Link(Type getType, const QString &getValue); - bool isValid() const; - Type getType() const; - const QString &getValue() const; - -private: Type type; QString value; -}; + bool isValid() const; +}; } // namespace messages } // namespace chatterino diff --git a/src/widgets/helper/channelview.cpp b/src/widgets/helper/channelview.cpp index 13b961732..7c7049027 100644 --- a/src/widgets/helper/channelview.cpp +++ b/src/widgets/helper/channelview.cpp @@ -862,9 +862,9 @@ void ChannelView::mouseDoubleClickEvent(QMouseEvent *event) void ChannelView::handleLinkClick(QMouseEvent *event, const messages::Link &link, messages::MessageLayout *layout) { - switch (link.getType()) { + switch (link.type) { case messages::Link::UserInfo: { - auto user = link.getValue(); + auto user = link.value; this->userPopupWidget.setName(user); this->userPopupWidget.moveTo(this, event->screenPos().toPoint()); this->userPopupWidget.show(); @@ -886,16 +886,16 @@ void ChannelView::handleLinkClick(QMouseEvent *event, const messages::Link &link [] { QApplication::clipboard()->setText(url); }); } - url = link.getValue(); + url = link.value; menu->move(QCursor::pos()); menu->show(); } else { - QDesktopServices::openUrl(QUrl(link.getValue())); + QDesktopServices::openUrl(QUrl(link.value)); } break; } case messages::Link::UserAction: { - QString value = link.getValue(); + QString value = link.value; value.replace("{user}", layout->getMessage()->loginName); this->channel->sendMessage(value); } diff --git a/src/widgets/helper/splitinput.cpp b/src/widgets/helper/splitinput.cpp index 569cae2e0..5915a1414 100644 --- a/src/widgets/helper/splitinput.cpp +++ b/src/widgets/helper/splitinput.cpp @@ -74,8 +74,8 @@ void SplitInput::initLayout() if (!this->emotePopup) { this->emotePopup = std::make_unique(this->themeManager); this->emotePopup->linkClicked.connect([this](const messages::Link &link) { - if (link.getType() == messages::Link::InsertText) { - this->insertText(link.getValue() + " "); + if (link.type == messages::Link::InsertText) { + this->insertText(link.value + " "); } }); }