mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Compare commits
14 commits
0ff71a3a3e
...
98bddba9dd
Author | SHA1 | Date | |
---|---|---|---|
|
98bddba9dd | ||
|
f66bc37368 | ||
|
439d21d009 | ||
|
8d9617df96 | ||
|
16042e7f8a | ||
|
d4c1ef5f80 | ||
|
5b2341aaa0 | ||
|
2d93ceed67 | ||
|
50b2decd1b | ||
|
2a9b8e15c4 | ||
|
e9bebfe788 | ||
|
5e25722d9a | ||
|
b38bfd4feb | ||
|
cd2ab5e0cd |
10 changed files with 77 additions and 21 deletions
|
@ -54,6 +54,7 @@
|
|||
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580, #5582, #5632)
|
||||
- Bugfix: Fixed tab visibility being controllable in the emote popup. (#5530)
|
||||
- Bugfix: Fixed account switch not being saved if no other settings were changed. (#5558)
|
||||
- Bugfix: Fixed 7TV badges being inadvertently animated. (#5674)
|
||||
- Bugfix: Fixed some tooltips not being readable. (#5578)
|
||||
- Bugfix: Fixed log files being locked longer than needed. (#5592)
|
||||
- Bugfix: Fixed global badges not showing in anonymous mode. (#5599)
|
||||
|
|
|
@ -9,6 +9,8 @@ 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_SELF_MESSAGE_HIGHLIGHT_COLOR =
|
||||
QColor(0, 118, 221, 115);
|
||||
|
|
|
@ -59,7 +59,7 @@ void SeventvBadges::registerBadge(const QJsonObject &badgeJson)
|
|||
|
||||
auto emote = Emote{
|
||||
.name = EmoteName{},
|
||||
.images = SeventvEmotes::createImageSet(badgeJson),
|
||||
.images = SeventvEmotes::createImageSet(badgeJson, true),
|
||||
.tooltip = Tooltip{badgeJson["tooltip"].toString()},
|
||||
.homePage = Url{},
|
||||
.id = EmoteId{badgeID},
|
||||
|
|
|
@ -106,12 +106,18 @@ CreateEmoteResult createEmote(const QJsonObject &activeEmote,
|
|||
? createAliasedTooltip(emoteName.string, baseEmoteName.string,
|
||||
author.string, isGlobal)
|
||||
: createTooltip(emoteName.string, author.string, isGlobal);
|
||||
auto imageSet = SeventvEmotes::createImageSet(emoteData);
|
||||
auto imageSet = SeventvEmotes::createImageSet(emoteData, false);
|
||||
|
||||
auto emote =
|
||||
Emote({emoteName, imageSet, tooltip,
|
||||
Url{EMOTE_LINK_FORMAT.arg(emoteId.string)}, zeroWidth, emoteId,
|
||||
author, makeConditionedOptional(aliasedName, baseEmoteName)});
|
||||
auto emote = Emote({
|
||||
emoteName,
|
||||
imageSet,
|
||||
tooltip,
|
||||
Url{EMOTE_LINK_FORMAT.arg(emoteId.string)},
|
||||
zeroWidth,
|
||||
emoteId,
|
||||
author,
|
||||
makeConditionedOptional(aliasedName, baseEmoteName),
|
||||
});
|
||||
|
||||
return {emote, emoteId, emoteName, !emote.images.getImage1()->isEmpty()};
|
||||
}
|
||||
|
@ -427,7 +433,8 @@ void SeventvEmotes::getEmoteSet(
|
|||
});
|
||||
}
|
||||
|
||||
ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData)
|
||||
ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData,
|
||||
bool useStatic)
|
||||
{
|
||||
auto host = emoteData["host"].toObject();
|
||||
// "//cdn.7tv[...]"
|
||||
|
@ -463,9 +470,21 @@ ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData)
|
|||
baseWidth = width;
|
||||
}
|
||||
|
||||
auto image = Image::fromUrl(
|
||||
{QString("https:%1/%2").arg(baseUrl, file["name"].toString())},
|
||||
scale, {static_cast<int>(width), file["height"].toInt(16)});
|
||||
auto name = [&] {
|
||||
if (useStatic)
|
||||
{
|
||||
auto staticName = file["static_name"].toString();
|
||||
if (!staticName.isEmpty())
|
||||
{
|
||||
return staticName;
|
||||
}
|
||||
}
|
||||
return file["name"].toString();
|
||||
}();
|
||||
|
||||
auto image =
|
||||
Image::fromUrl({QString("https:%1/%2").arg(baseUrl, name)}, scale,
|
||||
{static_cast<int>(width), file["height"].toInt(16)});
|
||||
|
||||
sizes.at(nextSize) = image;
|
||||
nextSize++;
|
||||
|
|
|
@ -153,8 +153,10 @@ public:
|
|||
* Creates an image set from a 7TV emote or badge.
|
||||
*
|
||||
* @param emoteData { host: { files: [], url } }
|
||||
* @param useStatic use static version if possible
|
||||
*/
|
||||
static ImageSet createImageSet(const QJsonObject &emoteData);
|
||||
static ImageSet createImageSet(const QJsonObject &emoteData,
|
||||
bool useStatic);
|
||||
|
||||
private:
|
||||
Atomic<std::shared_ptr<const EmoteMap>> global_;
|
||||
|
|
|
@ -1190,11 +1190,13 @@ void ChannelView::messageAppended(MessagePtr &message,
|
|||
(this->channel_->getType() == Channel::Type::TwitchAutomod &&
|
||||
getSettings()->enableAutomodHighlight))
|
||||
{
|
||||
this->tabHighlightRequested.invoke(HighlightState::Highlighted);
|
||||
this->tabHighlightRequested.invoke(HighlightState::Highlighted,
|
||||
message->highlightColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->tabHighlightRequested.invoke(HighlightState::NewMessage);
|
||||
this->tabHighlightRequested.invoke(HighlightState::NewMessage,
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "widgets/TooltipWidget.hpp"
|
||||
|
||||
#include <pajlada/signals/signal.hpp>
|
||||
#include <QColor>
|
||||
#include <QGestureEvent>
|
||||
#include <QMenu>
|
||||
#include <QPaintEvent>
|
||||
|
@ -21,6 +22,7 @@
|
|||
#include <QWheelEvent>
|
||||
#include <QWidget>
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
|
@ -214,7 +216,8 @@ public:
|
|||
|
||||
pajlada::Signals::Signal<QMouseEvent *> mouseDown;
|
||||
pajlada::Signals::NoArgSignal selectionChanged;
|
||||
pajlada::Signals::Signal<HighlightState> tabHighlightRequested;
|
||||
pajlada::Signals::Signal<HighlightState, std::shared_ptr<QColor>>
|
||||
tabHighlightRequested;
|
||||
pajlada::Signals::NoArgSignal liveStatusChanged;
|
||||
pajlada::Signals::Signal<const Link &> linkClicked;
|
||||
pajlada::Signals::Signal<QString, FromTwitchLinkOpenChannelIn>
|
||||
|
|
|
@ -307,6 +307,7 @@ void NotebookTab::setSelected(bool value)
|
|||
this->selected_ = value;
|
||||
|
||||
this->highlightState_ = HighlightState::None;
|
||||
this->highlightColor_ = nullptr;
|
||||
|
||||
this->update();
|
||||
}
|
||||
|
@ -397,6 +398,15 @@ bool NotebookTab::hasHighlightsEnabled() const
|
|||
return this->highlightEnabled_;
|
||||
}
|
||||
|
||||
void NotebookTab::setHighlightColor(std::shared_ptr<QColor> color)
|
||||
{
|
||||
if (this->highlightColor_ != color)
|
||||
{
|
||||
this->highlightColor_ = color;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
QRect NotebookTab::getDesiredRect() const
|
||||
{
|
||||
return QRect(this->positionAnimationDesiredPoint_, size());
|
||||
|
@ -499,6 +509,14 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||
: (windowFocused ? colors.line.regular
|
||||
: colors.line.unfocused);
|
||||
|
||||
if (this->highlightState_ == HighlightState::Highlighted &&
|
||||
this->highlightColor_ != nullptr)
|
||||
{
|
||||
QColor col = *this->highlightColor_;
|
||||
col.setAlpha(255);
|
||||
lineColor = col;
|
||||
}
|
||||
|
||||
QRect lineRect;
|
||||
switch (this->tabLocation_)
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <pajlada/settings/setting.hpp>
|
||||
#include <pajlada/signals/signalholder.hpp>
|
||||
#include <QColor>
|
||||
#include <QMenu>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
|
@ -64,6 +65,7 @@ public:
|
|||
|
||||
void setHighlightsEnabled(const bool &newVal);
|
||||
bool hasHighlightsEnabled() const;
|
||||
void setHighlightColor(std::shared_ptr<QColor> color);
|
||||
|
||||
void moveAnimated(QPoint targetPos, bool animated = true);
|
||||
|
||||
|
@ -127,6 +129,7 @@ private:
|
|||
HighlightState highlightState_ = HighlightState::None;
|
||||
bool highlightEnabled_ = true;
|
||||
QAction *highlightNewMessagesAction_;
|
||||
std::shared_ptr<QColor> highlightColor_;
|
||||
|
||||
bool isLive_{};
|
||||
bool isRerun_{};
|
||||
|
|
|
@ -213,11 +213,17 @@ void SplitContainer::addSplit(Split *split)
|
|||
|
||||
auto &&conns = this->connectionsPerSplit_[split];
|
||||
|
||||
conns.managedConnect(split->getChannelView().tabHighlightRequested,
|
||||
[this](HighlightState state) {
|
||||
conns.managedConnect(
|
||||
split->getChannelView().tabHighlightRequested,
|
||||
[this](HighlightState state, std::shared_ptr<QColor> color) {
|
||||
if (this->tab_ != nullptr)
|
||||
{
|
||||
this->tab_->setHighlightState(state);
|
||||
|
||||
if (color != nullptr)
|
||||
{
|
||||
this->tab_->setHighlightColor(color);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue