Compare commits

..

No commits in common. "e537fca18615ae766cb3a9c4f49b59736d396000" and "417cdbc009a0469f1f19e1b8e64d062113eea0c3" have entirely different histories.

26 changed files with 134 additions and 169 deletions

View file

@ -62,7 +62,6 @@
- Bugfix: Fixed incorrect message being disabled in some cases upon approving or denying an automod caught message. (#5611) - Bugfix: Fixed incorrect message being disabled in some cases upon approving or denying an automod caught message. (#5611)
- Bugfix: Fixed double-click selection not working when clicking outside a message. (#5617) - Bugfix: Fixed double-click selection not working when clicking outside a message. (#5617)
- Bugfix: Fixed emotes starting with ":" not tab-completing. (#5603) - Bugfix: Fixed emotes starting with ":" not tab-completing. (#5603)
- Bugfix: Fixed 7TV emotes messing with Qt's HTML. (#5677)
- Dev: Update Windows build from Qt 6.5.0 to Qt 6.7.1. (#5420) - Dev: Update Windows build from Qt 6.5.0 to Qt 6.7.1. (#5420)
- Dev: Update vcpkg build Qt from 6.5.0 to 6.7.0, boost from 1.83.0 to 1.85.0, openssl from 3.1.3 to 3.3.0. (#5422) - Dev: Update vcpkg build Qt from 6.5.0 to 6.7.0, boost from 1.83.0 to 1.85.0, openssl from 3.1.3 to 3.3.0. (#5422)
- Dev: Unsingletonize `ISoundController`. (#5462) - Dev: Unsingletonize `ISoundController`. (#5462)
@ -114,7 +113,6 @@
- Dev: Refactored static `MessageBuilder` helpers to standalone functions. (#5652) - Dev: Refactored static `MessageBuilder` helpers to standalone functions. (#5652)
- Dev: Decoupled reply parsing from `MessageBuilder`. (#5660, #5668) - Dev: Decoupled reply parsing from `MessageBuilder`. (#5660, #5668)
- Dev: Refactored IRC message building. (#5663) - Dev: Refactored IRC message building. (#5663)
- Dev: Fixed some compiler warnings. (#5672)
- Dev: Unified parsing of historic and live IRC messages. (#5678) - Dev: Unified parsing of historic and live IRC messages. (#5678)
## 2.5.1 ## 2.5.1

View file

@ -1,9 +1,6 @@
cmake_minimum_required(VERSION 3.15) cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0087 NEW) # evaluates generator expressions in `install(CODE/SCRIPT)` cmake_policy(SET CMP0087 NEW) # evaluates generator expressions in `install(CODE/SCRIPT)`
cmake_policy(SET CMP0091 NEW) # select MSVC runtime library through `CMAKE_MSVC_RUNTIME_LIBRARY` cmake_policy(SET CMP0091 NEW) # select MSVC runtime library through `CMAKE_MSVC_RUNTIME_LIBRARY`
if (POLICY CMP0167)
cmake_policy(SET CMP0167 NEW) # find Boost's own CMake config file
endif ()
include(FeatureSummary) include(FeatureSummary)
list(APPEND CMAKE_MODULE_PATH list(APPEND CMAKE_MODULE_PATH

View file

@ -350,7 +350,7 @@ public:
// contains a comma // contains a comma
MOCK_METHOD( MOCK_METHOD(
void, getChatters, void, getChatters,
(QString broadcasterID, QString moderatorID, size_t maxChattersToFetch, (QString broadcasterID, QString moderatorID, int maxChattersToFetch,
ResultCallback<HelixChatters> successCallback, ResultCallback<HelixChatters> successCallback,
(FailureCallback<HelixGetChattersError, QString> failureCallback)), (FailureCallback<HelixGetChattersError, QString> failureCallback)),
(override)); // getChatters (override)); // getChatters

View file

@ -2,7 +2,6 @@ set(LIBRARY_PROJECT "${PROJECT_NAME}-lib")
set(VERSION_PROJECT "${LIBRARY_PROJECT}-version") set(VERSION_PROJECT "${LIBRARY_PROJECT}-version")
set(EXECUTABLE_PROJECT "${PROJECT_NAME}") set(EXECUTABLE_PROJECT "${PROJECT_NAME}")
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00) add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050F00)
add_compile_definitions(QT_WARN_DEPRECATED_UP_TO=0x050F00)
# registers the native messageing host # registers the native messageing host
option(CHATTERINO_DEBUG_NATIVE_MESSAGES "Debug native messages" OFF) option(CHATTERINO_DEBUG_NATIVE_MESSAGES "Debug native messages" OFF)

View file

@ -2,8 +2,6 @@
namespace chatterino { namespace chatterino {
enum class ProviderId { // NOLINT(performance-enum-size) enum class ProviderId { Twitch, Irc };
Twitch,
};
// //
} // namespace chatterino } // namespace chatterino

View file

@ -87,8 +87,7 @@ public:
} }
else else
{ {
assert(index >= 0 && assert(index >= 0 && index <= this->items_.size());
index <= static_cast<int>(this->items_.size()));
} }
this->items_.insert(this->items_.begin() + index, item); this->items_.insert(this->items_.begin() + index, item);
@ -117,7 +116,7 @@ public:
void removeAt(int index, void *caller = nullptr) void removeAt(int index, void *caller = nullptr)
{ {
assertInGuiThread(); assertInGuiThread();
assert(index >= 0 && index < static_cast<int>(this->items_.size())); assert(index >= 0 && index < int(this->items_.size()));
T item = this->items_[index]; T item = this->items_[index];
this->items_.erase(this->items_.begin() + index); this->items_.erase(this->items_.begin() + index);
@ -133,14 +132,13 @@ public:
{ {
assertInGuiThread(); assertInGuiThread();
for (size_t index = 0; index < this->items_.size(); ++index) for (int index = 0; index < this->items_.size(); ++index)
{ {
T item = this->items_[index]; T item = this->items_[index];
if (matcher(item)) if (matcher(item))
{ {
this->items_.erase(this->items_.begin() + index); this->items_.erase(this->items_.begin() + index);
SignalVectorItemEvent<T> args{item, static_cast<int>(index), SignalVectorItemEvent<T> args{item, index, caller};
caller};
this->itemRemoved.invoke(args); this->itemRemoved.invoke(args);
this->itemsChanged_(); this->itemsChanged_();
return true; return true;

View file

@ -43,7 +43,7 @@ public:
} }
// get row index // get row index
int index = this->getModelIndexFromVectorIndex(args.index); int index = this->getModelIndexFromVectorIndex(args.index);
assert(index >= 0 && index <= static_cast<int>(this->rows_.size())); assert(index >= 0 && index <= this->rows_.size());
// get row items // get row items
std::vector<QStandardItem *> row = this->createRow(); std::vector<QStandardItem *> row = this->createRow();
@ -75,7 +75,7 @@ public:
} }
int row = this->getModelIndexFromVectorIndex(args.index); int row = this->getModelIndexFromVectorIndex(args.index);
assert(row >= 0 && row <= static_cast<int>(this->rows_.size())); assert(row >= 0 && row <= this->rows_.size());
// remove row // remove row
std::vector<QStandardItem *> items = this->rows_[row].items; std::vector<QStandardItem *> items = this->rows_[row].items;
@ -130,8 +130,7 @@ public:
{ {
int row = index.row(); int row = index.row();
int column = index.column(); int column = index.column();
if (row < 0 || column < 0 || if (row < 0 || column < 0 || row >= this->rows_.size() ||
row >= static_cast<int>(this->rows_.size()) ||
column >= this->columnCount_) column >= this->columnCount_)
{ {
return QVariant(); return QVariant();
@ -145,8 +144,7 @@ public:
{ {
int row = index.row(); int row = index.row();
int column = index.column(); int column = index.column();
if (row < 0 || column < 0 || if (row < 0 || column < 0 || row >= this->rows_.size() ||
row >= static_cast<int>(this->rows_.size()) ||
column >= this->columnCount_) column >= this->columnCount_)
{ {
return false; return false;
@ -154,7 +152,7 @@ public:
Row &rowItem = this->rows_[row]; Row &rowItem = this->rows_[row];
assert(this->columnCount_ == static_cast<int>(rowItem.items.size())); assert(this->columnCount_ == rowItem.items.size());
auto &cell = rowItem.items[column]; auto &cell = rowItem.items[column];
@ -169,7 +167,7 @@ public:
int vecRow = this->getVectorIndexFromModelIndex(row); int vecRow = this->getVectorIndexFromModelIndex(row);
// TODO: This is only a safety-thing for when we modify data that's being modified right now. // TODO: This is only a safety-thing for when we modify data that's being modified right now.
// It should not be necessary, but it would require some rethinking about this surrounding logic // It should not be necessary, but it would require some rethinking about this surrounding logic
if (vecRow >= static_cast<int>(this->vector_->readOnly()->size())) if (vecRow >= this->vector_->readOnly()->size())
{ {
return false; return false;
} }
@ -226,19 +224,18 @@ public:
{ {
int row = index.row(), column = index.column(); int row = index.row(), column = index.column();
if (row < 0 || column < 0 || if (row < 0 || column < 0 || row >= this->rows_.size() ||
row >= static_cast<int>(this->rows_.size()) ||
column >= this->columnCount_) column >= this->columnCount_)
{ {
return Qt::NoItemFlags; return Qt::NoItemFlags;
} }
assert(row >= 0 && row < static_cast<int>(this->rows_.size()) && assert(row >= 0 && row < this->rows_.size() && column >= 0 &&
column >= 0 && column < this->columnCount_); column < this->columnCount_);
const auto &rowItem = this->rows_[row]; const auto &rowItem = this->rows_[row];
assert(this->columnCount_ == static_cast<int>(rowItem.items.size())); assert(this->columnCount_ == rowItem.items.size());
return rowItem.items[column]->flags(); return rowItem.items[column]->flags();
} }
@ -270,8 +267,7 @@ public:
return false; return false;
} }
assert(sourceRow >= 0 && assert(sourceRow >= 0 && sourceRow < this->rows_.size());
sourceRow < static_cast<int>(this->rows_.size()));
int signalVectorRow = this->getVectorIndexFromModelIndex(sourceRow); int signalVectorRow = this->getVectorIndexFromModelIndex(sourceRow);
this->beginMoveRows(sourceParent, sourceRow, sourceRow, this->beginMoveRows(sourceParent, sourceRow, sourceRow,
@ -298,7 +294,7 @@ public:
return false; return false;
} }
assert(row >= 0 && row < static_cast<int>(this->rows_.size())); assert(row >= 0 && row < this->rows_.size());
int signalVectorRow = this->getVectorIndexFromModelIndex(row); int signalVectorRow = this->getVectorIndexFromModelIndex(row);
this->vector_->removeAt(signalVectorRow); this->vector_->removeAt(signalVectorRow);
@ -341,10 +337,8 @@ public:
int from = data->data("chatterino_row_id").toInt(); int from = data->data("chatterino_row_id").toInt();
int to = parent.row(); int to = parent.row();
auto vectorFrom = int vectorFrom = this->getVectorIndexFromModelIndex(from);
static_cast<size_t>(this->getVectorIndexFromModelIndex(from)); int vectorTo = this->getVectorIndexFromModelIndex(to);
auto vectorTo =
static_cast<size_t>(this->getVectorIndexFromModelIndex(to));
if (vectorFrom < 0 || vectorFrom > this->vector_->raw().size() || if (vectorFrom < 0 || vectorFrom > this->vector_->raw().size() ||
vectorTo < 0 || vectorTo > this->vector_->raw().size()) vectorTo < 0 || vectorTo > this->vector_->raw().size())
@ -408,7 +402,7 @@ protected:
void insertCustomRow(std::vector<QStandardItem *> row, int index) void insertCustomRow(std::vector<QStandardItem *> row, int index)
{ {
assert(index >= 0 && index <= static_cast<int>(this->rows_.size())); assert(index >= 0 && index <= this->rows_.size());
this->beginInsertRows(QModelIndex(), index, index); this->beginInsertRows(QModelIndex(), index, index);
this->rows_.insert(this->rows_.begin() + index, this->rows_.insert(this->rows_.begin() + index,
@ -418,7 +412,7 @@ protected:
void removeCustomRow(int index) void removeCustomRow(int index)
{ {
assert(index >= 0 && index <= static_cast<int>(this->rows_.size())); assert(index >= 0 && index <= this->rows_.size());
assert(this->rows_[index].isCustomRow); assert(this->rows_[index].isCustomRow);
this->beginRemoveRows(QModelIndex(), index, index); this->beginRemoveRows(QModelIndex(), index, index);

View file

@ -37,7 +37,7 @@ void UnifiedSource::addToListModel(GenericListModel &model,
source->addToListModel(model, maxCount - used); source->addToListModel(model, maxCount - used);
// Calculate how many items have been added so far // Calculate how many items have been added so far
used = model.rowCount() - startingSize; used = model.rowCount() - startingSize;
if (used >= static_cast<int>(maxCount)) if (used >= maxCount)
{ {
// Used up all of limit // Used up all of limit
break; break;
@ -58,15 +58,15 @@ void UnifiedSource::addToStringList(QStringList &list, size_t maxCount,
} }
// Make sure to only add maxCount elements in total. // Make sure to only add maxCount elements in total.
auto startingSize = list.size(); int startingSize = list.size();
QStringList::size_type used = 0; int used = 0;
for (const auto &source : this->sources_) for (const auto &source : this->sources_)
{ {
source->addToStringList(list, maxCount - used, isFirstWord); source->addToStringList(list, maxCount - used, isFirstWord);
// Calculate how many items have been added so far // Calculate how many items have been added so far
used = list.size() - startingSize; used = list.size() - startingSize;
if (used >= static_cast<QStringList::size_type>(maxCount)) if (used >= maxCount)
{ {
// Used up all of limit // Used up all of limit
break; break;

View file

@ -196,12 +196,12 @@ public:
std::unique_lock lock(this->mutex_); std::unique_lock lock(this->mutex_);
Equals eq; Equals eq;
for (size_t i = 0; i < this->buffer_.size(); ++i) for (int i = 0; i < this->buffer_.size(); ++i)
{ {
if (eq(this->buffer_[i], needle)) if (eq(this->buffer_[i], needle))
{ {
this->buffer_[i] = replacement; this->buffer_[i] = replacement;
return static_cast<int>(i); return i;
} }
} }
return -1; return -1;

View file

@ -116,7 +116,7 @@ QString formatUpdatedEmoteList(const QString &platform,
text += QString(" %1 %2 emotes ").arg(emoteNames.size()).arg(platform); text += QString(" %1 %2 emotes ").arg(emoteNames.size()).arg(platform);
} }
size_t i = 0; auto i = 0;
for (const auto &emoteName : emoteNames) for (const auto &emoteName : emoteNames)
{ {
i++; i++;

View file

@ -1,17 +1,9 @@
#include "messages/MessageSimilarity.hpp" #include "messages/MessageSimilarity.hpp"
#include "Application.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "messages/LimitedQueueSnapshot.hpp" // IWYU pragma: keep
#include "providers/twitch/TwitchAccount.hpp"
#include "singletons/Settings.hpp"
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
namespace { namespace chatterino::similarity::detail {
using namespace chatterino;
float relativeSimilarity(QStringView str1, QStringView str2) float relativeSimilarity(QStringView str1, QStringView str2)
{ {
@ -56,66 +48,4 @@ float relativeSimilarity(QStringView str1, QStringView str2)
return float(z) / float(div); return float(z) / float(div);
} }
template <std::ranges::bidirectional_range T> } // namespace chatterino::similarity::detail
float inMessages(const MessagePtr &msg, const T &messages)
{
float similarityPercent = 0.0F;
for (const auto &prevMsg :
messages | std::views::reverse |
std::views::take(getSettings()->hideSimilarMaxMessagesToCheck))
{
if (prevMsg->parseTime.secsTo(QTime::currentTime()) >=
getSettings()->hideSimilarMaxDelay)
{
break;
}
if (getSettings()->hideSimilarBySameUser &&
msg->loginName != prevMsg->loginName)
{
continue;
}
similarityPercent = std::max(
similarityPercent,
relativeSimilarity(msg->messageText, prevMsg->messageText));
}
return similarityPercent;
}
} // namespace
namespace chatterino {
template <std::ranges::bidirectional_range T>
void setSimilarityFlags(const MessagePtr &message, const T &messages)
{
if (getSettings()->similarityEnabled)
{
bool isMyself =
message->loginName ==
getApp()->getAccounts()->twitch.getCurrent()->getUserName();
bool hideMyself = getSettings()->hideSimilarMyself;
if (isMyself && !hideMyself)
{
return;
}
if (inMessages(message, messages) > getSettings()->similarityPercentage)
{
message->flags.set(MessageFlag::Similar);
if (getSettings()->colorSimilarDisabled)
{
message->flags.set(MessageFlag::Disabled);
}
}
}
}
template void setSimilarityFlags<std::vector<MessagePtr>>(
const MessagePtr &msg, const std::vector<MessagePtr> &messages);
template void setSimilarityFlags<LimitedQueueSnapshot<MessagePtr>>(
const MessagePtr &msg, const LimitedQueueSnapshot<MessagePtr> &messages);
} // namespace chatterino

View file

@ -1,11 +1,73 @@
#pragma once #pragma once
#include "Application.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "messages/Message.hpp" #include "messages/Message.hpp"
#include "providers/twitch/TwitchAccount.hpp"
#include "singletons/Settings.hpp"
#include <ranges> #include <ranges>
namespace chatterino::similarity::detail {
float relativeSimilarity(QStringView str1, QStringView str2);
float inMessages(const MessagePtr &msg,
const std::ranges::bidirectional_range auto &messages)
{
float similarityPercent = 0.0F;
for (const auto &prevMsg :
messages | std::views::reverse |
std::views::take(getSettings()->hideSimilarMaxMessagesToCheck))
{
if (prevMsg->parseTime.secsTo(QTime::currentTime()) >=
getSettings()->hideSimilarMaxDelay)
{
break;
}
if (getSettings()->hideSimilarBySameUser &&
msg->loginName != prevMsg->loginName)
{
continue;
}
similarityPercent = std::max(
similarityPercent,
relativeSimilarity(msg->messageText, prevMsg->messageText));
}
return similarityPercent;
}
} // namespace chatterino::similarity::detail
namespace chatterino { namespace chatterino {
template <std::ranges::bidirectional_range T> void setSimilarityFlags(const MessagePtr &message,
void setSimilarityFlags(const MessagePtr &message, const T &messages); const std::ranges::bidirectional_range auto &messages)
{
if (getSettings()->similarityEnabled)
{
bool isMyself =
message->loginName ==
getApp()->getAccounts()->twitch.getCurrent()->getUserName();
bool hideMyself = getSettings()->hideSimilarMyself;
if (isMyself && !hideMyself)
{
return;
}
if (similarity::detail::inMessages(message, messages) >
getSettings()->similarityPercentage)
{
message->flags.set(MessageFlag::Similar);
if (getSettings()->colorSimilarDisabled)
{
message->flags.set(MessageFlag::Disabled);
}
}
}
}
} // namespace chatterino } // namespace chatterino

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "common/enums/MessageContext.hpp" #include "common/enums/MessageContext.hpp"
#include "common/FlagsEnum.hpp"
#include "messages/MessageFlag.hpp" #include "messages/MessageFlag.hpp"
#include <memory> #include <memory>
@ -16,14 +15,7 @@ using MessagePtr = std::shared_ptr<const Message>;
enum class MessageSinkTrait : uint8_t { enum class MessageSinkTrait : uint8_t {
None = 0, None = 0,
/// Messages with the `Highlighted` and `ShowInMentions` flags should be
/// added to the global mentions channel when encountered.
AddMentionsToGlobalChannel = 1 << 0, AddMentionsToGlobalChannel = 1 << 0,
/// A channel-point redemption whose reward is not yet known should not be
/// added to this sink, but queued in the corresponding TwitchChannel
/// (`addQueuedRedemption`).
RequiresKnownChannelPointReward = 1 << 1, RequiresKnownChannelPointReward = 1 << 1,
}; };
using MessageSinkTraits = FlagsEnum<MessageSinkTrait>; using MessageSinkTraits = FlagsEnum<MessageSinkTrait>;
@ -59,7 +51,7 @@ public:
/// If there is no message found, an empty shared-pointer is returned. /// If there is no message found, an empty shared-pointer is returned.
virtual MessagePtr findMessageByID(QStringView id) = 0; virtual MessagePtr findMessageByID(QStringView id) = 0;
/// Behaviour to be exercised when parsing/building messages for this sink. ///
virtual MessageSinkTraits sinkTraits() const = 0; virtual MessageSinkTraits sinkTraits() const = 0;
}; };

View file

@ -212,8 +212,7 @@ void MessageLayoutContainer::breakLine()
this->lineStart_ = this->elements_.size(); this->lineStart_ = this->elements_.size();
// this->currentX = (int)(this->scale * 8); // this->currentX = (int)(this->scale * 8);
if (this->canCollapse() && if (this->canCollapse() && this->line_ + 1 >= maxUncollapsedLines())
static_cast<int>(this->line_ + 1) >= maxUncollapsedLines())
{ {
this->canAddMessages_ = false; this->canAddMessages_ = false;
return; return;

View file

@ -514,10 +514,9 @@ int TextLayoutElement::getXFromIndex(size_t index)
else if (index < static_cast<size_t>(this->getText().size())) else if (index < static_cast<size_t>(this->getText().size()))
{ {
int x = 0; int x = 0;
for (size_t i = 0; i < index; i++) for (int i = 0; i < index; i++)
{ {
x += metrics.horizontalAdvance( x += metrics.horizontalAdvance(this->getText()[i]);
this->getText()[static_cast<QString::size_type>(i)]);
} }
return x + this->getRect().left(); return x + this->getRect().left();
} }

View file

@ -79,8 +79,7 @@ bool isZeroWidthRecommended(const QJsonObject &emoteData)
Tooltip createTooltip(const QString &name, const QString &author, bool isGlobal) Tooltip createTooltip(const QString &name, const QString &author, bool isGlobal)
{ {
return Tooltip{QString("%1<br>%2 7TV Emote<br>By: %3") return Tooltip{QString("%1<br>%2 7TV Emote<br>By: %3")
.arg(name.toHtmlEscaped(), .arg(name, isGlobal ? "Global" : "Channel",
isGlobal ? "Global" : "Channel",
author.isEmpty() ? "<deleted>" : author)}; author.isEmpty() ? "<deleted>" : author)};
} }
@ -88,8 +87,7 @@ Tooltip createAliasedTooltip(const QString &name, const QString &baseName,
const QString &author, bool isGlobal) const QString &author, bool isGlobal)
{ {
return Tooltip{QString("%1<br>Alias of %2<br>%3 7TV Emote<br>By: %4") return Tooltip{QString("%1<br>Alias of %2<br>%3 7TV Emote<br>By: %4")
.arg(name.toHtmlEscaped(), baseName.toHtmlEscaped(), .arg(name, baseName, isGlobal ? "Global" : "Channel",
isGlobal ? "Global" : "Channel",
author.isEmpty() ? "<deleted>" : author)}; author.isEmpty() ? "<deleted>" : author)};
} }

View file

@ -1356,6 +1356,8 @@ void TwitchChannel::loadRecentMessages()
{ {
msgs.push_back(msg); msgs.push_back(msg);
} }
tc->addRecentChatter(msg->displayName);
} }
getApp()->getTwitch()->getMentionsChannel()->fillInMissingMessages( getApp()->getTwitch()->getMentionsChannel()->fillInMissingMessages(

View file

@ -1909,7 +1909,7 @@ void Helix::updateChatSettings(
void Helix::onFetchChattersSuccess( void Helix::onFetchChattersSuccess(
std::shared_ptr<HelixChatters> finalChatters, QString broadcasterID, std::shared_ptr<HelixChatters> finalChatters, QString broadcasterID,
QString moderatorID, size_t maxChattersToFetch, QString moderatorID, int maxChattersToFetch,
ResultCallback<HelixChatters> successCallback, ResultCallback<HelixChatters> successCallback,
FailureCallback<HelixGetChattersError, QString> failureCallback, FailureCallback<HelixGetChattersError, QString> failureCallback,
HelixChatters chatters) HelixChatters chatters)
@ -2022,7 +2022,7 @@ void Helix::fetchChatters(
void Helix::onFetchModeratorsSuccess( void Helix::onFetchModeratorsSuccess(
std::shared_ptr<std::vector<HelixModerator>> finalModerators, std::shared_ptr<std::vector<HelixModerator>> finalModerators,
QString broadcasterID, size_t maxModeratorsToFetch, QString broadcasterID, int maxModeratorsToFetch,
ResultCallback<std::vector<HelixModerator>> successCallback, ResultCallback<std::vector<HelixModerator>> successCallback,
FailureCallback<HelixGetModeratorsError, QString> failureCallback, FailureCallback<HelixGetModeratorsError, QString> failureCallback,
HelixModerators moderators) HelixModerators moderators)
@ -2459,7 +2459,7 @@ void Helix::sendWhisper(
// https://dev.twitch.tv/docs/api/reference#get-chatters // https://dev.twitch.tv/docs/api/reference#get-chatters
void Helix::getChatters( void Helix::getChatters(
QString broadcasterID, QString moderatorID, size_t maxChattersToFetch, QString broadcasterID, QString moderatorID, int maxChattersToFetch,
ResultCallback<HelixChatters> successCallback, ResultCallback<HelixChatters> successCallback,
FailureCallback<HelixGetChattersError, QString> failureCallback) FailureCallback<HelixGetChattersError, QString> failureCallback)
{ {

View file

@ -1073,7 +1073,7 @@ public:
// This will follow the returned cursor and return up to `maxChattersToFetch` chatters // This will follow the returned cursor and return up to `maxChattersToFetch` chatters
// https://dev.twitch.tv/docs/api/reference#get-chatters // https://dev.twitch.tv/docs/api/reference#get-chatters
virtual void getChatters( virtual void getChatters(
QString broadcasterID, QString moderatorID, size_t maxChattersToFetch, QString broadcasterID, QString moderatorID, int maxChattersToFetch,
ResultCallback<HelixChatters> successCallback, ResultCallback<HelixChatters> successCallback,
FailureCallback<HelixGetChattersError, QString> failureCallback) = 0; FailureCallback<HelixGetChattersError, QString> failureCallback) = 0;
@ -1417,7 +1417,7 @@ public:
// This will follow the returned cursor and return up to `maxChattersToFetch` chatters // This will follow the returned cursor and return up to `maxChattersToFetch` chatters
// https://dev.twitch.tv/docs/api/reference#get-chatters // https://dev.twitch.tv/docs/api/reference#get-chatters
void getChatters( void getChatters(
QString broadcasterID, QString moderatorID, size_t maxChattersToFetch, QString broadcasterID, QString moderatorID, int maxChattersToFetch,
ResultCallback<HelixChatters> successCallback, ResultCallback<HelixChatters> successCallback,
FailureCallback<HelixGetChattersError, QString> failureCallback) final; FailureCallback<HelixGetChattersError, QString> failureCallback) final;
@ -1505,7 +1505,7 @@ protected:
// Recursive boy // Recursive boy
void onFetchChattersSuccess( void onFetchChattersSuccess(
std::shared_ptr<HelixChatters> finalChatters, QString broadcasterID, std::shared_ptr<HelixChatters> finalChatters, QString broadcasterID,
QString moderatorID, size_t maxChattersToFetch, QString moderatorID, int maxChattersToFetch,
ResultCallback<HelixChatters> successCallback, ResultCallback<HelixChatters> successCallback,
FailureCallback<HelixGetChattersError, QString> failureCallback, FailureCallback<HelixGetChattersError, QString> failureCallback,
HelixChatters chatters); HelixChatters chatters);
@ -1520,7 +1520,7 @@ protected:
// Recursive boy // Recursive boy
void onFetchModeratorsSuccess( void onFetchModeratorsSuccess(
std::shared_ptr<std::vector<HelixModerator>> finalModerators, std::shared_ptr<std::vector<HelixModerator>> finalModerators,
QString broadcasterID, size_t maxModeratorsToFetch, QString broadcasterID, int maxModeratorsToFetch,
ResultCallback<std::vector<HelixModerator>> successCallback, ResultCallback<std::vector<HelixModerator>> successCallback,
FailureCallback<HelixGetModeratorsError, QString> failureCallback, FailureCallback<HelixGetModeratorsError, QString> failureCallback,
HelixModerators moderators); HelixModerators moderators);

View file

@ -119,9 +119,9 @@ void TooltipWidget::set(const std::vector<TooltipEntry> &entries,
this->setVisibleEntries(entries.size()); this->setVisibleEntries(entries.size());
for (size_t i = 0; i < entries.size(); ++i) for (int i = 0; i < entries.size(); ++i)
{ {
if (auto *entryWidget = this->entryAt(static_cast<int>(i))) if (auto *entryWidget = this->entryAt(i))
{ {
const auto &entry = entries[i]; const auto &entry = entries[i];
entryWidget->setImage(entry.image); entryWidget->setImage(entry.image);

View file

@ -79,7 +79,7 @@ void EditHotkeyDialog::setFromHotkey(std::shared_ptr<Hotkey> hotkey)
this->ui_->easyArgsLabel->setText(def->argumentsPrompt); this->ui_->easyArgsLabel->setText(def->argumentsPrompt);
this->ui_->easyArgsLabel->setToolTip(def->argumentsPromptHover); this->ui_->easyArgsLabel->setToolTip(def->argumentsPromptHover);
int matchIdx = -1; int matchIdx = -1;
for (size_t i = 0; i < def->possibleArguments.size(); i++) for (int i = 0; i < def->possibleArguments.size(); i++)
{ {
const auto &[displayText, argData] = def->possibleArguments.at(i); const auto &[displayText, argData] = def->possibleArguments.at(i);
this->ui_->easyArgsPicker->addItem(displayText); this->ui_->easyArgsPicker->addItem(displayText);
@ -90,7 +90,7 @@ void EditHotkeyDialog::setFromHotkey(std::shared_ptr<Hotkey> hotkey)
continue; continue;
} }
bool matches = true; bool matches = true;
for (size_t j = 0; j < argData.size(); j++) for (int j = 0; j < argData.size(); j++)
{ {
if (argData.at(j) != hotkey->arguments().at(j)) if (argData.at(j) != hotkey->arguments().at(j))
{ {
@ -100,7 +100,7 @@ void EditHotkeyDialog::setFromHotkey(std::shared_ptr<Hotkey> hotkey)
} }
if (matches) if (matches)
{ {
matchIdx = static_cast<int>(i); matchIdx = i;
} }
} }
if (matchIdx != -1) if (matchIdx != -1)

View file

@ -219,13 +219,11 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, Split *split)
const auto &timeoutButtons = const auto &timeoutButtons =
getSettings()->timeoutButtons.getValue(); getSettings()->timeoutButtons.getValue();
if (static_cast<int>(timeoutButtons.size()) < buttonNum || if (timeoutButtons.size() < buttonNum || 0 >= buttonNum)
0 >= buttonNum)
{ {
return QString("Invalid argument for execModeratorAction: " return QString("Invalid argument for execModeratorAction: "
"%1. Integer out of usable range: [1, %2]") "%1. Integer out of usable range: [1, %2]")
.arg(buttonNum, .arg(buttonNum, timeoutButtons.size() - 1);
static_cast<int>(timeoutButtons.size()) - 1);
} }
const auto &button = timeoutButtons.at(buttonNum - 1); const auto &button = timeoutButtons.at(buttonNum - 1);
msg = QString("/timeout %1 %2") msg = QString("/timeout %1 %2")
@ -692,10 +690,9 @@ void UserInfoPopup::installEvents()
{ {
const auto &vector = getSettings()->blacklistedUsers.raw(); const auto &vector = getSettings()->blacklistedUsers.raw();
for (int i = 0; i < static_cast<int>(vector.size()); i++) for (int i = 0; i < vector.size(); i++)
{ {
if (this->userName_ == if (this->userName_ == vector[i].getPattern())
vector[static_cast<size_t>(i)].getPattern())
{ {
getSettings()->blacklistedUsers.removeAt(i); getSettings()->blacklistedUsers.removeAt(i);
i--; i--;
@ -902,9 +899,9 @@ void UserInfoPopup::updateUserData()
// get ignoreHighlights state // get ignoreHighlights state
bool isIgnoringHighlights = false; bool isIgnoringHighlights = false;
const auto &vector = getSettings()->blacklistedUsers.raw(); const auto &vector = getSettings()->blacklistedUsers.raw();
for (const auto &user : vector) for (int i = 0; i < vector.size(); i++)
{ {
if (this->userName_ == user.getPattern()) if (this->userName_ == vector[i].getPattern())
{ {
isIgnoringHighlights = true; isIgnoringHighlights = true;
break; break;

View file

@ -2204,7 +2204,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
{ {
this->isDoubleClick_ = false; this->isDoubleClick_ = false;
// Was actually not a wanted triple-click // Was actually not a wanted triple-click
if (std::abs(distanceBetweenPoints(this->lastDoubleClickPosition_, if (fabsf(distanceBetweenPoints(this->lastDoubleClickPosition_,
event->screenPos())) > 10.F) event->screenPos())) > 10.F)
{ {
this->clickTimer_.stop(); this->clickTimer_.stop();
@ -2215,7 +2215,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
{ {
this->isLeftMouseDown_ = false; this->isLeftMouseDown_ = false;
if (std::abs(distanceBetweenPoints(this->lastLeftPressPosition_, if (fabsf(distanceBetweenPoints(this->lastLeftPressPosition_,
event->screenPos())) > 15.F) event->screenPos())) > 15.F)
{ {
return; return;
@ -2223,7 +2223,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
// Triple-clicking a message selects the whole message // Triple-clicking a message selects the whole message
if (foundElement && this->clickTimer_.isActive() && if (foundElement && this->clickTimer_.isActive() &&
(std::abs(distanceBetweenPoints(this->lastDoubleClickPosition_, (fabsf(distanceBetweenPoints(this->lastDoubleClickPosition_,
event->screenPos())) < 10.F)) event->screenPos())) < 10.F))
{ {
this->selectWholeMessage(layout.get(), messageIndex); this->selectWholeMessage(layout.get(), messageIndex);
@ -2241,7 +2241,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
{ {
this->isRightMouseDown_ = false; this->isRightMouseDown_ = false;
if (std::abs(distanceBetweenPoints(this->lastRightPressPosition_, if (fabsf(distanceBetweenPoints(this->lastRightPressPosition_,
event->screenPos())) > 15.F) event->screenPos())) > 15.F)
{ {
return; return;

View file

@ -241,8 +241,10 @@ LimitedQueueSnapshot<MessagePtr> SearchPopup::buildSnapshot()
const LimitedQueueSnapshot<MessagePtr> &snapshot = const LimitedQueueSnapshot<MessagePtr> &snapshot =
sharedView.channel()->getMessageSnapshot(); sharedView.channel()->getMessageSnapshot();
for (const auto &message : snapshot) // TODO: implement iterator on LimitedQueueSnapshot?
for (auto i = 0; i < snapshot.size(); ++i)
{ {
const MessagePtr &message = snapshot[i];
if (filterSet && !filterSet->filter(message, sharedView.channel())) if (filterSet && !filterSet->filter(message, sharedView.channel()))
{ {
continue; continue;

View file

@ -19,7 +19,7 @@ QVariant GenericListModel::data(const QModelIndex &index, int /* role */) const
return {}; return {};
} }
if (index.row() >= static_cast<int>(this->items_.size())) if (index.row() >= this->items_.size())
{ {
return {}; return {};
} }

View file

@ -42,7 +42,7 @@ namespace {
using namespace chatterino; using namespace chatterino;
// 5 minutes // 5 minutes
constexpr const qint64 THUMBNAIL_MAX_AGE_MS = 5LL * 60 * 1000; constexpr const uint64_t THUMBNAIL_MAX_AGE_MS = 5ULL * 60 * 1000;
auto formatRoomModeUnclean( auto formatRoomModeUnclean(
const SharedAccessGuard<const TwitchChannel::RoomModes> &modes) -> QString const SharedAccessGuard<const TwitchChannel::RoomModes> &modes) -> QString