Compare commits

...

14 commits

Author SHA1 Message Date
pajlada 98bddba9dd
Merge 439d21d009 into f66bc37368 2024-10-24 18:21:04 +02:00
pajlada f66bc37368
fix: use static version of 7tv badges (#5674) 2024-10-24 10:26:20 +02:00
Rasmus Karlsson 439d21d009
Merge remote-tracking branch 'origin/master' into custom-highlight-color-tabs 2024-08-31 12:52:20 +02:00
Rasmus Karlsson 8d9617df96 Remove unneccesary dereference of the highlightcolor 2022-08-28 12:56:59 +02:00
Rasmus Karlsson 16042e7f8a Change fallback highlight color
This makes the color look almost identical in highlights, but completely identical in tab highlights
2022-08-28 12:56:16 +02:00
Rasmus Karlsson d4c1ef5f80 Merge remote-tracking branch 'origin/master' into custom-highlight-color-tabs 2022-08-28 12:35:20 +02:00
pajlada 5b2341aaa0
Merge branch 'master' into custom-highlight-color-tabs 2020-08-09 06:00:09 -04:00
pajlada 2d93ceed67
Merge branch 'master' into custom-highlight-color-tabs 2020-08-09 05:55:53 -04:00
tuckerrrrrrrrrrrr 50b2decd1b Check tabHighlightRequested color in safer scope
The little bit that set the tab's highlight color never checked whether
the tab was a nullptr or not
i'm a little silly
2020-03-15 07:11:16 -07:00
tuckerrrrrrrrrrrr 2a9b8e15c4 Remove tabHighlightColorRequested signal
Moved the functionality to tabHighlightRequested instead of having two
signals that modify similar things
2020-03-14 09:40:23 -07:00
tuckerrrrrrrrrrrr e9bebfe788 clean up setting tab line color 2020-02-16 10:27:37 -08:00
tuckerrrrrrrrrrrr 5e25722d9a remove pointless condition in setHighlightState
I put it there last night and I think I forgot about it :)
2020-02-16 09:45:11 -08:00
tuckerrrrrrrrrrrr b38bfd4feb fix tab highlighting when focused 2020-02-15 22:40:41 -08:00
tuckerrrrrrrrrrrr cd2ab5e0cd flash highlight color instead of red in channel tab 2020-02-15 21:00:38 -08:00
10 changed files with 77 additions and 21 deletions

View file

@ -54,6 +54,7 @@
- Bugfix: Fixed event emotes not showing up in autocomplete and popups. (#5239, #5580, #5582, #5632) - 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 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 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 some tooltips not being readable. (#5578)
- Bugfix: Fixed log files being locked longer than needed. (#5592) - Bugfix: Fixed log files being locked longer than needed. (#5592)
- Bugfix: Fixed global badges not showing in anonymous mode. (#5599) - Bugfix: Fixed global badges not showing in anonymous mode. (#5599)

View file

@ -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);

View file

@ -59,7 +59,7 @@ void SeventvBadges::registerBadge(const QJsonObject &badgeJson)
auto emote = Emote{ auto emote = Emote{
.name = EmoteName{}, .name = EmoteName{},
.images = SeventvEmotes::createImageSet(badgeJson), .images = SeventvEmotes::createImageSet(badgeJson, true),
.tooltip = Tooltip{badgeJson["tooltip"].toString()}, .tooltip = Tooltip{badgeJson["tooltip"].toString()},
.homePage = Url{}, .homePage = Url{},
.id = EmoteId{badgeID}, .id = EmoteId{badgeID},

View file

@ -106,12 +106,18 @@ CreateEmoteResult createEmote(const QJsonObject &activeEmote,
? createAliasedTooltip(emoteName.string, baseEmoteName.string, ? createAliasedTooltip(emoteName.string, baseEmoteName.string,
author.string, isGlobal) author.string, isGlobal)
: createTooltip(emoteName.string, author.string, isGlobal); : createTooltip(emoteName.string, author.string, isGlobal);
auto imageSet = SeventvEmotes::createImageSet(emoteData); auto imageSet = SeventvEmotes::createImageSet(emoteData, false);
auto emote = auto emote = Emote({
Emote({emoteName, imageSet, tooltip, emoteName,
Url{EMOTE_LINK_FORMAT.arg(emoteId.string)}, zeroWidth, emoteId, imageSet,
author, makeConditionedOptional(aliasedName, baseEmoteName)}); tooltip,
Url{EMOTE_LINK_FORMAT.arg(emoteId.string)},
zeroWidth,
emoteId,
author,
makeConditionedOptional(aliasedName, baseEmoteName),
});
return {emote, emoteId, emoteName, !emote.images.getImage1()->isEmpty()}; 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(); auto host = emoteData["host"].toObject();
// "//cdn.7tv[...]" // "//cdn.7tv[...]"
@ -463,9 +470,21 @@ ImageSet SeventvEmotes::createImageSet(const QJsonObject &emoteData)
baseWidth = width; baseWidth = width;
} }
auto image = Image::fromUrl( auto name = [&] {
{QString("https:%1/%2").arg(baseUrl, file["name"].toString())}, if (useStatic)
scale, {static_cast<int>(width), file["height"].toInt(16)}); {
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; sizes.at(nextSize) = image;
nextSize++; nextSize++;

View file

@ -153,8 +153,10 @@ public:
* Creates an image set from a 7TV emote or badge. * Creates an image set from a 7TV emote or badge.
* *
* @param emoteData { host: { files: [], url } } * @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: private:
Atomic<std::shared_ptr<const EmoteMap>> global_; Atomic<std::shared_ptr<const EmoteMap>> global_;

View file

@ -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);
} }
} }

View file

@ -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>

View file

@ -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_)
{ {

View file

@ -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_{};

View file

@ -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();