Skip to content

Commit

Permalink
fix(C4456): shadowing declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
Nerixyz committed Dec 15, 2023
1 parent 453c331 commit 3e34748
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 30 deletions.
8 changes: 4 additions & 4 deletions src/controllers/notifications/NotificationController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,11 @@ void NotificationController::checkStream(bool live, QString channelName)

void NotificationController::removeFakeChannel(const QString channelName)
{
auto i = std::find(fakeTwitchChannels.begin(), fakeTwitchChannels.end(),
channelName);
if (i != fakeTwitchChannels.end())
auto it = std::find(fakeTwitchChannels.begin(), fakeTwitchChannels.end(),
channelName);
if (it != fakeTwitchChannels.end())
{
fakeTwitchChannels.erase(i);
fakeTwitchChannels.erase(it);
// "delete" old 'CHANNEL is live' message
LimitedQueueSnapshot<MessagePtr> snapshot =
getApp()->twitch->liveChannel->getMessageSnapshot();
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/sound/MiniaudioBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ void MiniaudioBackend::play(const QUrl &sound)
if (sound.isLocalFile())
{
auto soundPath = sound.toLocalFile();
auto result = ma_engine_play_sound(this->engine.get(),
qPrintable(soundPath), nullptr);
result = ma_engine_play_sound(this->engine.get(),
qPrintable(soundPath), nullptr);
if (result != MA_SUCCESS)
{
qCWarning(chatterinoSound) << "Failed to play sound" << sound
Expand Down
4 changes: 2 additions & 2 deletions src/providers/twitch/TwitchMessageBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,7 +1729,7 @@ void TwitchMessageBuilder::listOfUsersSystemMessage(
MessagePtr TwitchMessageBuilder::buildHypeChatMessage(
Communi::IrcPrivateMessage *message)
{
auto level = message->tag(u"pinned-chat-paid-level"_s).toString();
auto levelID = message->tag(u"pinned-chat-paid-level"_s).toString();
auto currency = message->tag(u"pinned-chat-paid-currency"_s).toString();
bool okAmount = false;
auto amount = message->tag(u"pinned-chat-paid-amount"_s).toInt(&okAmount);
Expand All @@ -1743,7 +1743,7 @@ MessagePtr TwitchMessageBuilder::buildHypeChatMessage(
// additionally, there's `pinned-chat-paid-is-system-message` which isn't used by Chatterino.

QString subtitle;
auto levelIt = HYPE_CHAT_PAID_LEVEL.find(level);
auto levelIt = HYPE_CHAT_PAID_LEVEL.find(levelID);
if (levelIt != HYPE_CHAT_PAID_LEVEL.end())
{
const auto &level = levelIt->second;
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/dialogs/ReplyThreadPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,11 @@ void ReplyThreadPopup::addMessagesFromThread()
this->ui_.threadView->setChannel(this->virtualChannel_);
this->ui_.threadView->setSourceChannel(sourceChannel);

auto overrideFlags =
auto rootOverrideFlags =
std::optional<MessageFlags>(this->thread_->root()->flags);
overrideFlags->set(MessageFlag::DoNotLog);
rootOverrideFlags->set(MessageFlag::DoNotLog);

this->virtualChannel_->addMessage(this->thread_->root(), overrideFlags);
this->virtualChannel_->addMessage(this->thread_->root(), rootOverrideFlags);
for (const auto &msgRef : this->thread_->replies())
{
if (auto msg = msgRef.lock())
Expand Down
10 changes: 6 additions & 4 deletions src/widgets/helper/ChannelView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2888,12 +2888,14 @@ void ChannelView::setInputReply(const MessagePtr &message)
if (!message->replyThread)
{
// Message did not already have a thread attached, try to find or create one
if (auto *tc =
dynamic_cast<TwitchChannel *>(this->underlyingChannel_.get()))
auto *tc =
dynamic_cast<TwitchChannel *>(this->underlyingChannel_.get());
if (!tc)
{
tc->getOrCreateThread(message);
tc = dynamic_cast<TwitchChannel *>(this->channel_.get());
}
else if (auto *tc = dynamic_cast<TwitchChannel *>(this->channel_.get()))

if (tc)
{
tc->getOrCreateThread(message);
}
Expand Down
26 changes: 14 additions & 12 deletions src/widgets/settingspages/SettingsPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,36 +21,38 @@ bool filterItemsRec(QObject *object, const QString &query)
widget->update();
};

if (auto x = dynamic_cast<SCheckBox *>(child); x)
if (auto *checkBox = dynamic_cast<SCheckBox *>(child))
{
setOpacity(x, x->text().contains(query, Qt::CaseInsensitive));
setOpacity(checkBox,
checkBox->text().contains(query, Qt::CaseInsensitive));
}
else if (auto x = dynamic_cast<SLabel *>(child); x)
else if (auto *lbl = dynamic_cast<SLabel *>(child))
{
setOpacity(x, x->text().contains(query, Qt::CaseInsensitive));
setOpacity(lbl, lbl->text().contains(query, Qt::CaseInsensitive));
}
else if (auto x = dynamic_cast<SComboBox *>(child); x)
else if (auto *comboBox = dynamic_cast<SComboBox *>(child))
{
setOpacity(x, [=]() {
for (int i = 0; i < x->count(); i++)
setOpacity(comboBox, [=]() {
for (int i = 0; i < comboBox->count(); i++)
{
if (x->itemText(i).contains(query, Qt::CaseInsensitive))
if (comboBox->itemText(i).contains(query,
Qt::CaseInsensitive))
return true;
}
return false;
}());
}
else if (auto x = dynamic_cast<QTabWidget *>(child); x)
else if (auto *tabs = dynamic_cast<QTabWidget *>(child))
{
for (int i = 0; i < x->count(); i++)
for (int i = 0; i < tabs->count(); i++)
{
bool tabAny{};

if (x->tabText(i).contains(query, Qt::CaseInsensitive))
if (tabs->tabText(i).contains(query, Qt::CaseInsensitive))
{
tabAny = true;
}
auto widget = x->widget(i);
auto widget = tabs->widget(i);
tabAny |= filterItemsRec(widget, query);

any |= tabAny;
Expand Down
6 changes: 3 additions & 3 deletions src/widgets/splits/SplitContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,12 +842,12 @@ void SplitContainer::applyFromDescriptorRecursively(
{
if (std::holds_alternative<SplitNodeDescriptor>(item))
{
const auto *n = std::get_if<SplitNodeDescriptor>(&item);
if (!n)
const auto *inner = std::get_if<SplitNodeDescriptor>(&item);
if (!inner)
{
return;
}
const auto &splitNode = *n;
const auto &splitNode = *inner;
auto *split = new Split(this);
split->setChannel(WindowManager::decodeChannel(splitNode));
split->setModerationMode(splitNode.moderationMode_);
Expand Down

0 comments on commit 3e34748

Please sign in to comment.