mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
make the list of ignored usernames into a set instead, making it more maintanable
change "open twitch channel in new split" menu action text
This commit is contained in:
parent
9a6650b56c
commit
0b36f43611
|
@ -9,8 +9,8 @@
|
|||
#include "messages/Message.hpp"
|
||||
#include "messages/MessageElement.hpp"
|
||||
#include "messages/layouts/MessageLayout.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "messages/layouts/MessageLayoutElement.hpp"
|
||||
#include "providers/twitch/TwitchChannel.hpp"
|
||||
#include "providers/twitch/TwitchServer.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "singletons/Theme.hpp"
|
||||
|
@ -438,7 +438,8 @@ void ChannelView::setChannel(ChannelPtr newChannel)
|
|||
}
|
||||
|
||||
if (this->channel_->getType() != Channel::Type::TwitchMentions) {
|
||||
this->scrollBar_->addHighlight(message->getScrollBarHighlight());
|
||||
this->scrollBar_->addHighlight(
|
||||
message->getScrollBarHighlight());
|
||||
}
|
||||
|
||||
this->messageWasAdded_ = true;
|
||||
|
@ -1049,7 +1050,6 @@ void ChannelView::handleMouseClick(QMouseEvent *event,
|
|||
}
|
||||
} break;
|
||||
case Qt::RightButton: {
|
||||
|
||||
auto insertText = [=](QString text) {
|
||||
if (auto split = dynamic_cast<Split *>(this->parentWidget())) {
|
||||
split->insertTextToInput(text);
|
||||
|
@ -1131,15 +1131,18 @@ void ChannelView::addContextMenuItems(
|
|||
static QRegularExpression twitchChannelRegex(
|
||||
R"(^(?:https?:\/\/)?(?:www\.|go\.)?twitch\.tv\/(?<username>[a-z0-9_]+))",
|
||||
QRegularExpression::CaseInsensitiveOption);
|
||||
static QSet<QString> ignoredUsernames{
|
||||
"videos",
|
||||
"settings",
|
||||
};
|
||||
|
||||
auto twitchMatch = twitchChannelRegex.match(
|
||||
hoveredElement->getLink().value);
|
||||
auto twitchMatch =
|
||||
twitchChannelRegex.match(hoveredElement->getLink().value);
|
||||
auto twitchUsername = twitchMatch.captured("username");
|
||||
if (!twitchUsername.isEmpty() &&
|
||||
twitchUsername != "settings" &&
|
||||
twitchUsername != "videos") {
|
||||
!ignoredUsernames.contains(twitchUsername)) {
|
||||
menu->addSeparator();
|
||||
menu->addAction("Join to channel", [twitchUsername, this] {
|
||||
menu->addAction("Open in new split", [twitchUsername, this] {
|
||||
this->joinToChannel.invoke(twitchUsername);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue