mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Live streams that are marked as reruns now mark a tab as yellow instead of red (#5176)
This commit is contained in:
parent
641cb26a76
commit
5c51ec8382
9 changed files with 71 additions and 5 deletions
|
@ -32,6 +32,7 @@
|
|||
- Minor: Added support for the `{input.text}` placeholder in the **Split** -> **Run a command** hotkey. (#5130)
|
||||
- Minor: Add a new Channel API for experimental plugins feature. (#5141)
|
||||
- Minor: Added the ability to change the top-most status of a window regardless of the _Always on top_ setting (right click the notebook). (#5135)
|
||||
- Minor: Live streams that are marked as reruns now mark a tab as yellow instead of red. (#5176)
|
||||
- Minor: Updated to Emoji v15.1. Google emojis are now used as the fallback instead of Twitter emojis. (#5182)
|
||||
- Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840)
|
||||
- Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848)
|
||||
|
|
|
@ -328,6 +328,11 @@ bool Channel::isLive() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Channel::isRerun() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Channel::shouldIgnoreHighlights() const
|
||||
{
|
||||
return this->type_ == Type::TwitchAutomod ||
|
||||
|
|
|
@ -104,6 +104,7 @@ public:
|
|||
virtual bool hasModRights() const;
|
||||
virtual bool hasHighRateLimit() const;
|
||||
virtual bool isLive() const;
|
||||
virtual bool isRerun() const;
|
||||
virtual bool shouldIgnoreHighlights() const;
|
||||
virtual bool canReconnect() const;
|
||||
virtual void reconnect();
|
||||
|
|
|
@ -471,6 +471,15 @@ void TwitchChannel::updateStreamStatus(
|
|||
|
||||
status->rerun = false;
|
||||
status->streamType = stream.type;
|
||||
for (const auto &tag : stream.tags)
|
||||
{
|
||||
if (QString::compare(tag, "Rerun", Qt::CaseInsensitive) == 0)
|
||||
{
|
||||
status->rerun = true;
|
||||
status->streamType = "rerun";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this->setLive(true))
|
||||
{
|
||||
|
@ -797,6 +806,11 @@ bool TwitchChannel::isLive() const
|
|||
return this->streamStatus_.accessConst()->live;
|
||||
}
|
||||
|
||||
bool TwitchChannel::isRerun() const
|
||||
{
|
||||
return this->streamStatus_.accessConst()->rerun;
|
||||
}
|
||||
|
||||
SharedAccessGuard<const TwitchChannel::StreamStatus>
|
||||
TwitchChannel::accessStreamStatus() const
|
||||
{
|
||||
|
|
|
@ -138,6 +138,7 @@ public:
|
|||
const QString &popoutPlayerUrl();
|
||||
int chatterCount() const;
|
||||
bool isLive() const override;
|
||||
bool isRerun() const override;
|
||||
QString roomId() const;
|
||||
SharedAccessGuard<const RoomModes> accessRoomModes() const;
|
||||
SharedAccessGuard<const StreamStatus> accessStreamStatus() const;
|
||||
|
|
|
@ -69,6 +69,9 @@ struct HelixStream {
|
|||
QString language;
|
||||
QString thumbnailUrl;
|
||||
|
||||
// This is the names, the IDs are now always empty
|
||||
std::vector<QString> tags;
|
||||
|
||||
HelixStream()
|
||||
: id("")
|
||||
, userId("")
|
||||
|
@ -99,6 +102,11 @@ struct HelixStream {
|
|||
, language(jsonObject.value("language").toString())
|
||||
, thumbnailUrl(jsonObject.value("thumbnail_url").toString())
|
||||
{
|
||||
const auto jsonTags = jsonObject.value("tags").toArray();
|
||||
for (const auto &tag : jsonTags)
|
||||
{
|
||||
this->tags.push_back(tag.toString());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -327,6 +327,18 @@ void NotebookTab::setTabLocation(NotebookTabLocation location)
|
|||
}
|
||||
}
|
||||
|
||||
bool NotebookTab::setRerun(bool isRerun)
|
||||
{
|
||||
if (this->isRerun_ != isRerun)
|
||||
{
|
||||
this->isRerun_ = isRerun;
|
||||
this->update();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NotebookTab::setLive(bool isLive)
|
||||
{
|
||||
if (this->isLive_ != isLive)
|
||||
|
@ -514,12 +526,22 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||
painter.fillRect(lineRect, lineColor);
|
||||
|
||||
// draw live indicator
|
||||
if (this->isLive_ && getSettings()->showTabLive)
|
||||
if ((this->isLive_ || this->isRerun_) && getSettings()->showTabLive)
|
||||
{
|
||||
painter.setPen(QColor(Qt::GlobalColor::red));
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
// Live overrides rerun
|
||||
QBrush b;
|
||||
b.setColor(QColor(Qt::GlobalColor::red));
|
||||
if (this->isLive_)
|
||||
{
|
||||
painter.setPen(QColor(Qt::GlobalColor::red));
|
||||
b.setColor(QColor(Qt::GlobalColor::red));
|
||||
}
|
||||
else
|
||||
{
|
||||
painter.setPen(QColor(Qt::GlobalColor::yellow));
|
||||
b.setColor(QColor(Qt::GlobalColor::yellow));
|
||||
}
|
||||
|
||||
painter.setRenderHint(QPainter::Antialiasing);
|
||||
b.setStyle(Qt::SolidPattern);
|
||||
painter.setBrush(b);
|
||||
|
||||
|
|
|
@ -47,6 +47,13 @@ public:
|
|||
**/
|
||||
bool setLive(bool isLive);
|
||||
|
||||
/**
|
||||
* @brief Sets the rerun status of this tab
|
||||
*
|
||||
* Returns true if the rerun status was changed, false if nothing changed.
|
||||
**/
|
||||
bool setRerun(bool isRerun);
|
||||
|
||||
/**
|
||||
* @brief Returns true if any split in this tab is live
|
||||
**/
|
||||
|
@ -121,6 +128,7 @@ private:
|
|||
QAction *highlightNewMessagesAction_;
|
||||
|
||||
bool isLive_{};
|
||||
bool isRerun_{};
|
||||
|
||||
int growWidth_ = 0;
|
||||
|
||||
|
|
|
@ -926,9 +926,15 @@ void SplitContainer::refreshTabLiveStatus()
|
|||
}
|
||||
|
||||
bool liveStatus = false;
|
||||
bool rerunStatus = false;
|
||||
for (const auto &s : this->splits_)
|
||||
{
|
||||
auto c = s->getChannel();
|
||||
if (c->isRerun())
|
||||
{
|
||||
rerunStatus = true;
|
||||
continue; // reruns are also marked as live, SKIP
|
||||
}
|
||||
if (c->isLive())
|
||||
{
|
||||
liveStatus = true;
|
||||
|
@ -936,7 +942,7 @@ void SplitContainer::refreshTabLiveStatus()
|
|||
}
|
||||
}
|
||||
|
||||
if (this->tab_->setLive(liveStatus))
|
||||
if (this->tab_->setLive(liveStatus) || this->tab_->setRerun(rerunStatus))
|
||||
{
|
||||
auto *notebook = dynamic_cast<Notebook *>(this->parentWidget());
|
||||
if (notebook)
|
||||
|
|
Loading…
Reference in a new issue