mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
switch from QHash to std::unordered_map
This commit is contained in:
parent
13d7692a89
commit
a2af8e791b
|
@ -305,22 +305,13 @@ bool NotebookTab::isSelected() const
|
|||
}
|
||||
|
||||
void NotebookTab::updateHighlightSources(
|
||||
const QHash<ChannelPtr, HighlightEvent> &removedHighlightSources)
|
||||
const std::unordered_map<ChannelPtr, HighlightEvent>
|
||||
&removedHighlightSources)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
|
||||
for (const auto &[otherChannel, otherEvent] :
|
||||
removedHighlightSources.asKeyValueRange())
|
||||
for (const auto &[otherChannel, otherEvent] : removedHighlightSources)
|
||||
{
|
||||
this->highlightSources_.remove(otherChannel);
|
||||
this->highlightSources_.erase(otherChannel);
|
||||
}
|
||||
#else
|
||||
for (auto it = removedHighlightSources.cbegin(),
|
||||
end = removedHighlightSources.cend();
|
||||
it != end; ++it)
|
||||
{
|
||||
this->highlightSources_.remove(it.key());
|
||||
}
|
||||
#endif
|
||||
|
||||
if (this->highlightSources_.empty())
|
||||
{
|
||||
|
@ -446,8 +437,12 @@ void NotebookTab::setHighlightState(HighlightState newHighlightStyle,
|
|||
return;
|
||||
}
|
||||
|
||||
this->highlightSources_.insert(channelViewSource.underlyingChannel(),
|
||||
HighlightEvent{});
|
||||
if (!this->highlightSources_.contains(
|
||||
channelViewSource.underlyingChannel()))
|
||||
{
|
||||
this->highlightSources_.emplace(channelViewSource.underlyingChannel(),
|
||||
HighlightEvent{});
|
||||
}
|
||||
|
||||
if (!this->highlightEnabled_ &&
|
||||
newHighlightStyle == HighlightState::NewMessage)
|
||||
|
|
|
@ -118,7 +118,8 @@ private:
|
|||
};
|
||||
|
||||
void updateHighlightSources(
|
||||
const QHash<ChannelPtr, HighlightEvent> &removedHighlightSources);
|
||||
const std::unordered_map<ChannelPtr, HighlightEvent>
|
||||
&removedHighlightSources);
|
||||
|
||||
QPropertyAnimation positionChangedAnimation_;
|
||||
QPoint positionAnimationDesiredPoint_;
|
||||
|
@ -148,7 +149,7 @@ private:
|
|||
|
||||
QMenu menu_;
|
||||
|
||||
QHash<ChannelPtr, HighlightEvent> highlightSources_;
|
||||
std::unordered_map<ChannelPtr, HighlightEvent> highlightSources_;
|
||||
|
||||
pajlada::Signals::SignalHolder managedConnections_;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue