mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Compare commits
15 commits
69c87652ab
...
6c718d58bd
Author | SHA1 | Date | |
---|---|---|---|
6c718d58bd | |||
2ec8fa8723 | |||
45d2c292d0 | |||
439d21d009 | |||
8d9617df96 | |||
16042e7f8a | |||
d4c1ef5f80 | |||
5b2341aaa0 | |||
2d93ceed67 | |||
50b2decd1b | |||
2a9b8e15c4 | |||
e9bebfe788 | |||
5e25722d9a | |||
b38bfd4feb | |||
cd2ab5e0cd |
|
@ -110,7 +110,7 @@
|
||||||
- Dev: Emojis now use flags instead of a set of strings for capabilities. (#5616)
|
- Dev: Emojis now use flags instead of a set of strings for capabilities. (#5616)
|
||||||
- Dev: Move plugins to Sol2. (#5622)
|
- Dev: Move plugins to Sol2. (#5622)
|
||||||
- Dev: Refactored static `MessageBuilder` helpers to standalone functions. (#5652)
|
- Dev: Refactored static `MessageBuilder` helpers to standalone functions. (#5652)
|
||||||
- Dev: Decoupled reply parsing from `MessageBuilder`. (#5660)
|
- Dev: Decoupled reply parsing from `MessageBuilder`. (#5660, #5668)
|
||||||
- Dev: Refactored IRC message building. (#5663)
|
- Dev: Refactored IRC message building. (#5663)
|
||||||
|
|
||||||
## 2.5.1
|
## 2.5.1
|
||||||
|
|
|
@ -9,6 +9,8 @@ namespace {
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
// change made but removed in merge conflict
|
||||||
|
// QColor HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR = QColor(238, 97, 102, 65);
|
||||||
QColor HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR = QColor(127, 63, 73, 127);
|
QColor HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR = QColor(127, 63, 73, 127);
|
||||||
QColor HighlightPhrase::FALLBACK_SELF_MESSAGE_HIGHLIGHT_COLOR =
|
QColor HighlightPhrase::FALLBACK_SELF_MESSAGE_HIGHLIGHT_COLOR =
|
||||||
QColor(0, 118, 221, 115);
|
QColor(0, 118, 221, 115);
|
||||||
|
|
|
@ -2382,6 +2382,11 @@ void MessageBuilder::parseThread(const QString &messageContent,
|
||||||
this->message().replyParent = parent;
|
this->message().replyParent = parent;
|
||||||
thread->addToThread(std::weak_ptr{this->message_});
|
thread->addToThread(std::weak_ptr{this->message_});
|
||||||
|
|
||||||
|
if (thread->subscribed())
|
||||||
|
{
|
||||||
|
this->message().flags.set(MessageFlag::SubscribedThread);
|
||||||
|
}
|
||||||
|
|
||||||
// enable reply flag
|
// enable reply flag
|
||||||
this->message().flags.set(MessageFlag::ReplyMessage);
|
this->message().flags.set(MessageFlag::ReplyMessage);
|
||||||
|
|
||||||
|
|
|
@ -123,47 +123,34 @@ int stripLeadingReplyMention(const QVariantMap &tags, QString &content)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] bool shouldHighlightReplyThread(
|
void checkThreadSubscription(const QVariantMap &tags,
|
||||||
const QVariantMap &tags, const QString &senderLogin,
|
const QString &senderLogin,
|
||||||
std::shared_ptr<MessageThread> &thread, bool isNew)
|
std::shared_ptr<MessageThread> &thread)
|
||||||
{
|
{
|
||||||
const auto ¤tLogin =
|
if (thread->subscribed() || thread->unsubscribed())
|
||||||
getApp()->getAccounts()->twitch.getCurrent()->getUserName();
|
|
||||||
|
|
||||||
if (thread->subscribed())
|
|
||||||
{
|
{
|
||||||
return true;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (thread->unsubscribed())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getSettings()->autoSubToParticipatedThreads)
|
if (getSettings()->autoSubToParticipatedThreads)
|
||||||
{
|
{
|
||||||
if (isNew)
|
const auto ¤tLogin =
|
||||||
{
|
getApp()->getAccounts()->twitch.getCurrent()->getUserName();
|
||||||
if (const auto it = tags.find("reply-parent-user-login");
|
|
||||||
it != tags.end())
|
|
||||||
{
|
|
||||||
auto name = it.value().toString();
|
|
||||||
if (name == currentLogin)
|
|
||||||
{
|
|
||||||
thread->markSubscribed();
|
|
||||||
return true; // already marked as participated
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (senderLogin == currentLogin)
|
if (senderLogin == currentLogin)
|
||||||
{
|
{
|
||||||
thread->markSubscribed();
|
thread->markSubscribed();
|
||||||
// don't set the highlight here
|
}
|
||||||
|
else if (const auto it = tags.find("reply-parent-user-login");
|
||||||
|
it != tags.end())
|
||||||
|
{
|
||||||
|
auto name = it.value().toString();
|
||||||
|
if (name == currentLogin)
|
||||||
|
{
|
||||||
|
thread->markSubscribed();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChannelPtr channelOrEmptyByTarget(const QString &target,
|
ChannelPtr channelOrEmptyByTarget(const QString &target,
|
||||||
|
@ -243,7 +230,6 @@ QMap<QString, QString> parseBadges(const QString &badgesString)
|
||||||
struct ReplyContext {
|
struct ReplyContext {
|
||||||
std::shared_ptr<MessageThread> thread;
|
std::shared_ptr<MessageThread> thread;
|
||||||
MessagePtr parent;
|
MessagePtr parent;
|
||||||
bool highlight = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
[[nodiscard]] ReplyContext getReplyContext(
|
[[nodiscard]] ReplyContext getReplyContext(
|
||||||
|
@ -265,8 +251,7 @@ struct ReplyContext {
|
||||||
if (owned)
|
if (owned)
|
||||||
{
|
{
|
||||||
// Thread already exists (has a reply)
|
// Thread already exists (has a reply)
|
||||||
ctx.highlight = shouldHighlightReplyThread(
|
checkThreadSubscription(tags, message->nick(), owned);
|
||||||
tags, message->nick(), owned, false);
|
|
||||||
ctx.thread = owned;
|
ctx.thread = owned;
|
||||||
rootThread = owned;
|
rootThread = owned;
|
||||||
}
|
}
|
||||||
|
@ -301,8 +286,7 @@ struct ReplyContext {
|
||||||
{
|
{
|
||||||
std::shared_ptr<MessageThread> newThread =
|
std::shared_ptr<MessageThread> newThread =
|
||||||
std::make_shared<MessageThread>(foundMessage);
|
std::make_shared<MessageThread>(foundMessage);
|
||||||
ctx.highlight = shouldHighlightReplyThread(
|
checkThreadSubscription(tags, message->nick(), newThread);
|
||||||
tags, message->nick(), newThread, true);
|
|
||||||
|
|
||||||
ctx.thread = newThread;
|
ctx.thread = newThread;
|
||||||
rootThread = newThread;
|
rootThread = newThread;
|
||||||
|
@ -724,10 +708,6 @@ std::vector<MessagePtr> IrcMessageHandler::parseMessageWithReply(
|
||||||
|
|
||||||
if (built)
|
if (built)
|
||||||
{
|
{
|
||||||
if (replyCtx.highlight)
|
|
||||||
{
|
|
||||||
built->flags.set(MessageFlag::SubscribedThread);
|
|
||||||
}
|
|
||||||
builtMessages.emplace_back(built);
|
builtMessages.emplace_back(built);
|
||||||
MessageBuilder::triggerHighlights(channel, alert);
|
MessageBuilder::triggerHighlights(channel, alert);
|
||||||
}
|
}
|
||||||
|
@ -1552,8 +1532,7 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message,
|
||||||
{
|
{
|
||||||
// Thread already exists (has a reply)
|
// Thread already exists (has a reply)
|
||||||
auto thread = threadIt->second.lock();
|
auto thread = threadIt->second.lock();
|
||||||
replyCtx.highlight = shouldHighlightReplyThread(
|
checkThreadSubscription(tags, message->nick(), thread);
|
||||||
tags, message->nick(), thread, false);
|
|
||||||
replyCtx.thread = thread;
|
replyCtx.thread = thread;
|
||||||
rootThread = thread;
|
rootThread = thread;
|
||||||
}
|
}
|
||||||
|
@ -1565,8 +1544,7 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message,
|
||||||
{
|
{
|
||||||
// Found root reply message
|
// Found root reply message
|
||||||
auto newThread = std::make_shared<MessageThread>(root);
|
auto newThread = std::make_shared<MessageThread>(root);
|
||||||
replyCtx.highlight = shouldHighlightReplyThread(
|
checkThreadSubscription(tags, message->nick(), newThread);
|
||||||
tags, message->nick(), newThread, true);
|
|
||||||
|
|
||||||
replyCtx.thread = newThread;
|
replyCtx.thread = newThread;
|
||||||
rootThread = newThread;
|
rootThread = newThread;
|
||||||
|
@ -1621,10 +1599,6 @@ void IrcMessageHandler::addMessage(Communi::IrcMessage *message,
|
||||||
msg->flags.set(MessageFlag::Subscription);
|
msg->flags.set(MessageFlag::Subscription);
|
||||||
msg->flags.unset(MessageFlag::Highlighted);
|
msg->flags.unset(MessageFlag::Highlighted);
|
||||||
}
|
}
|
||||||
if (replyCtx.highlight)
|
|
||||||
{
|
|
||||||
msg->flags.set(MessageFlag::SubscribedThread);
|
|
||||||
}
|
|
||||||
|
|
||||||
IrcMessageHandler::setSimilarityFlags(msg, chan);
|
IrcMessageHandler::setSimilarityFlags(msg, chan);
|
||||||
|
|
||||||
|
|
|
@ -1190,11 +1190,13 @@ void ChannelView::messageAppended(MessagePtr &message,
|
||||||
(this->channel_->getType() == Channel::Type::TwitchAutomod &&
|
(this->channel_->getType() == Channel::Type::TwitchAutomod &&
|
||||||
getSettings()->enableAutomodHighlight))
|
getSettings()->enableAutomodHighlight))
|
||||||
{
|
{
|
||||||
this->tabHighlightRequested.invoke(HighlightState::Highlighted);
|
this->tabHighlightRequested.invoke(HighlightState::Highlighted,
|
||||||
|
message->highlightColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this->tabHighlightRequested.invoke(HighlightState::NewMessage);
|
this->tabHighlightRequested.invoke(HighlightState::NewMessage,
|
||||||
|
nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "widgets/TooltipWidget.hpp"
|
#include "widgets/TooltipWidget.hpp"
|
||||||
|
|
||||||
#include <pajlada/signals/signal.hpp>
|
#include <pajlada/signals/signal.hpp>
|
||||||
|
#include <QColor>
|
||||||
#include <QGestureEvent>
|
#include <QGestureEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPaintEvent>
|
#include <QPaintEvent>
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <unordered_set>
|
#include <unordered_set>
|
||||||
|
|
||||||
|
@ -214,7 +216,8 @@ public:
|
||||||
|
|
||||||
pajlada::Signals::Signal<QMouseEvent *> mouseDown;
|
pajlada::Signals::Signal<QMouseEvent *> mouseDown;
|
||||||
pajlada::Signals::NoArgSignal selectionChanged;
|
pajlada::Signals::NoArgSignal selectionChanged;
|
||||||
pajlada::Signals::Signal<HighlightState> tabHighlightRequested;
|
pajlada::Signals::Signal<HighlightState, std::shared_ptr<QColor>>
|
||||||
|
tabHighlightRequested;
|
||||||
pajlada::Signals::NoArgSignal liveStatusChanged;
|
pajlada::Signals::NoArgSignal liveStatusChanged;
|
||||||
pajlada::Signals::Signal<const Link &> linkClicked;
|
pajlada::Signals::Signal<const Link &> linkClicked;
|
||||||
pajlada::Signals::Signal<QString, FromTwitchLinkOpenChannelIn>
|
pajlada::Signals::Signal<QString, FromTwitchLinkOpenChannelIn>
|
||||||
|
|
|
@ -307,6 +307,7 @@ void NotebookTab::setSelected(bool value)
|
||||||
this->selected_ = value;
|
this->selected_ = value;
|
||||||
|
|
||||||
this->highlightState_ = HighlightState::None;
|
this->highlightState_ = HighlightState::None;
|
||||||
|
this->highlightColor_ = nullptr;
|
||||||
|
|
||||||
this->update();
|
this->update();
|
||||||
}
|
}
|
||||||
|
@ -397,6 +398,15 @@ bool NotebookTab::hasHighlightsEnabled() const
|
||||||
return this->highlightEnabled_;
|
return this->highlightEnabled_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NotebookTab::setHighlightColor(std::shared_ptr<QColor> color)
|
||||||
|
{
|
||||||
|
if (this->highlightColor_ != color)
|
||||||
|
{
|
||||||
|
this->highlightColor_ = color;
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QRect NotebookTab::getDesiredRect() const
|
QRect NotebookTab::getDesiredRect() const
|
||||||
{
|
{
|
||||||
return QRect(this->positionAnimationDesiredPoint_, size());
|
return QRect(this->positionAnimationDesiredPoint_, size());
|
||||||
|
@ -499,6 +509,14 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||||
: (windowFocused ? colors.line.regular
|
: (windowFocused ? colors.line.regular
|
||||||
: colors.line.unfocused);
|
: colors.line.unfocused);
|
||||||
|
|
||||||
|
if (this->highlightState_ == HighlightState::Highlighted &&
|
||||||
|
this->highlightColor_ != nullptr)
|
||||||
|
{
|
||||||
|
QColor col = *this->highlightColor_;
|
||||||
|
col.setAlpha(255);
|
||||||
|
lineColor = col;
|
||||||
|
}
|
||||||
|
|
||||||
QRect lineRect;
|
QRect lineRect;
|
||||||
switch (this->tabLocation_)
|
switch (this->tabLocation_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <pajlada/settings/setting.hpp>
|
#include <pajlada/settings/setting.hpp>
|
||||||
#include <pajlada/signals/signalholder.hpp>
|
#include <pajlada/signals/signalholder.hpp>
|
||||||
|
#include <QColor>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
|
||||||
|
@ -64,6 +65,7 @@ public:
|
||||||
|
|
||||||
void setHighlightsEnabled(const bool &newVal);
|
void setHighlightsEnabled(const bool &newVal);
|
||||||
bool hasHighlightsEnabled() const;
|
bool hasHighlightsEnabled() const;
|
||||||
|
void setHighlightColor(std::shared_ptr<QColor> color);
|
||||||
|
|
||||||
void moveAnimated(QPoint targetPos, bool animated = true);
|
void moveAnimated(QPoint targetPos, bool animated = true);
|
||||||
|
|
||||||
|
@ -127,6 +129,7 @@ private:
|
||||||
HighlightState highlightState_ = HighlightState::None;
|
HighlightState highlightState_ = HighlightState::None;
|
||||||
bool highlightEnabled_ = true;
|
bool highlightEnabled_ = true;
|
||||||
QAction *highlightNewMessagesAction_;
|
QAction *highlightNewMessagesAction_;
|
||||||
|
std::shared_ptr<QColor> highlightColor_;
|
||||||
|
|
||||||
bool isLive_{};
|
bool isLive_{};
|
||||||
bool isRerun_{};
|
bool isRerun_{};
|
||||||
|
|
|
@ -213,13 +213,19 @@ void SplitContainer::addSplit(Split *split)
|
||||||
|
|
||||||
auto &&conns = this->connectionsPerSplit_[split];
|
auto &&conns = this->connectionsPerSplit_[split];
|
||||||
|
|
||||||
conns.managedConnect(split->getChannelView().tabHighlightRequested,
|
conns.managedConnect(
|
||||||
[this](HighlightState state) {
|
split->getChannelView().tabHighlightRequested,
|
||||||
if (this->tab_ != nullptr)
|
[this](HighlightState state, std::shared_ptr<QColor> color) {
|
||||||
{
|
if (this->tab_ != nullptr)
|
||||||
this->tab_->setHighlightState(state);
|
{
|
||||||
}
|
this->tab_->setHighlightState(state);
|
||||||
});
|
|
||||||
|
if (color != nullptr)
|
||||||
|
{
|
||||||
|
this->tab_->setHighlightColor(color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
conns.managedConnect(split->getChannelView().liveStatusChanged, [this]() {
|
conns.managedConnect(split->getChannelView().liveStatusChanged, [this]() {
|
||||||
this->refreshTabLiveStatus();
|
this->refreshTabLiveStatus();
|
||||||
|
|
Loading…
Reference in a new issue