refactor: add explicit this-> where possible

I have knowingly skipped some files/portions of files where this would
create merge conflicts for other open PRs.
This commit is contained in:
Rasmus Karlsson
2025-12-30 13:30:57 +01:00
committed by pajlada
parent e0101f71c2
commit 57d6583a2b
64 changed files with 180 additions and 177 deletions
+1 -1
View File
@@ -451,7 +451,7 @@ IndirectChannel::IndirectChannel(ChannelPtr channel, Channel::Type type)
ChannelPtr IndirectChannel::get() const
{
return data_->channel;
return this->data_->channel;
}
void IndirectChannel::reset(ChannelPtr channel)
+1 -1
View File
@@ -138,7 +138,7 @@ public:
return QVariant();
}
return rows_[row].items[column]->data(role);
return this->rows_[row].items[column]->data(role);
}
bool setData(const QModelIndex &index, const QVariant &value,
+1 -1
View File
@@ -300,7 +300,7 @@ void WindowLayout::activateOrAddChannel(ProviderId provider,
this->score += 2;
if (split.channelName_ == this->spec)
{
hasChannel = true;
this->hasChannel = true;
if (!split.filters_.empty())
{
this->score += 1;
@@ -23,7 +23,7 @@ void CommandStrategy::apply(const std::vector<CommandItem> &items,
{
QString normalizedQuery = normalizeQuery(query);
if (startsWithOnly_)
if (this->startsWithOnly_)
{
std::copy_if(items.begin(), items.end(),
std::back_insert_iterator(output),
+1 -1
View File
@@ -37,7 +37,7 @@ struct ActionDefinition {
uint8_t minCountArguments = 0;
// maxCountArguments is the maximum amount of arguments the action accepts
uint8_t maxCountArguments = minCountArguments;
uint8_t maxCountArguments = this->minCountArguments;
// possibleArguments is empty or contains all possible argument values,
// it is an ordered mapping from option name (what the user sees) to
+2 -2
View File
@@ -17,12 +17,12 @@ IgnorePhrase::IgnorePhrase(const QString &pattern, bool isRegex, bool isBlock,
{
if (this->isCaseSensitive_)
{
regex_.setPatternOptions(
this->regex_.setPatternOptions(
QRegularExpression::UseUnicodePropertiesOption);
}
else
{
regex_.setPatternOptions(
this->regex_.setPatternOptions(
QRegularExpression::CaseInsensitiveOption |
QRegularExpression::UseUnicodePropertiesOption);
}
@@ -64,7 +64,7 @@ void NotificationController::updateChannelNotification(
bool NotificationController::isChannelNotified(const QString &channelName,
Platform p) const
{
return ranges::any_of(channelMap.at(p).raw(), [&](const auto &name) {
return ranges::any_of(this->channelMap.at(p).raw(), [&](const auto &name) {
return name.compare(channelName, Qt::CaseInsensitive) == 0;
});
}
@@ -72,19 +72,19 @@ bool NotificationController::isChannelNotified(const QString &channelName,
void NotificationController::addChannelNotification(const QString &channelName,
Platform p)
{
channelMap[p].append(channelName);
this->channelMap[p].append(channelName);
}
void NotificationController::removeChannelNotification(
const QString &channelName, Platform p)
{
for (std::vector<int>::size_type i = 0; i != channelMap[p].raw().size();
i++)
for (std::vector<int>::size_type i = 0;
i != this->channelMap[p].raw().size(); i++)
{
if (channelMap[p].raw()[i].compare(channelName, Qt::CaseInsensitive) ==
0)
if (this->channelMap[p].raw()[i].compare(channelName,
Qt::CaseInsensitive) == 0)
{
channelMap[p].removeAt(static_cast<int>(i));
this->channelMap[p].removeAt(static_cast<int>(i));
i--;
}
}
@@ -173,9 +173,9 @@ void NotificationController::fetchFakeChannels()
qCDebug(chatterinoNotification) << "fetching fake channels";
QStringList channels;
for (size_t i = 0; i < channelMap[Platform::Twitch].raw().size(); i++)
for (size_t i = 0; i < this->channelMap[Platform::Twitch].raw().size(); i++)
{
const auto &name = channelMap[Platform::Twitch].raw()[i];
const auto &name = this->channelMap[Platform::Twitch].raw()[i];
auto chan = getApp()->getTwitch()->getChannelOrEmpty(name);
if (chan->isEmpty())
{
+1 -1
View File
@@ -76,7 +76,7 @@ public:
~StackGuard()
{
if (expected < 0)
if (this->expected < 0)
{
return;
}
+1 -1
View File
@@ -442,7 +442,7 @@ private:
}
else
{
return visitOne<TReturn, Rest...>(
return this->visitOne<TReturn, Rest...>(
std::forward<decltype(rest)>(rest)...);
}
}
+1 -1
View File
@@ -118,7 +118,7 @@ void TwitchLiveController::request(std::optional<QStringList> optChannelIDs)
for (const auto &result : results)
{
auto it = this->channels.find(result.first);
if (it != channels.end())
if (it != this->channels.end())
{
if (auto channel = it->second.ptr.lock(); channel)
{
+1 -1
View File
@@ -21,7 +21,7 @@ struct UserData {
bool isEmpty() const
{
return !color.has_value() && notes.isEmpty();
return !this->color.has_value() && this->notes.isEmpty();
}
};
+4 -3
View File
@@ -7,18 +7,19 @@ namespace chatterino {
BenchmarkGuard::BenchmarkGuard(const QString &_name)
: name_(_name)
{
timer_.start();
this->timer_.start();
}
BenchmarkGuard::~BenchmarkGuard()
{
qCDebug(chatterinoBenchmark)
<< this->name_ << float(timer_.nsecsElapsed()) / 1000000.0f << "ms";
<< this->name_ << float(this->timer_.nsecsElapsed()) / 1000000.0f
<< "ms";
}
qreal BenchmarkGuard::getElapsedMs()
{
return qreal(timer_.nsecsElapsed()) / 1000000.0;
return qreal(this->timer_.nsecsElapsed()) / 1000000.0;
}
} // namespace chatterino
+1 -1
View File
@@ -30,7 +30,7 @@ struct Emote {
// FOURTF: no solution yet, to be refactored later
const QString &getCopyString() const
{
return name.string;
return this->name.string;
}
QJsonObject toJson() const;
+1 -1
View File
@@ -428,7 +428,7 @@ std::vector<LayeredEmoteElement::Emote> LayeredEmoteElement::getUniqueEmotes()
struct NotDuplicate {
bool operator()(const Emote &element)
{
return seen.insert(element.ptr).second;
return this->seen.insert(element.ptr).second;
}
private:
+3 -3
View File
@@ -51,17 +51,17 @@ public:
const QString &rootId() const
{
return rootMessageId_;
return this->rootMessageId_;
}
const std::shared_ptr<const Message> &root() const
{
return rootMessage_;
return this->rootMessage_;
}
const std::vector<std::weak_ptr<const Message>> &replies() const
{
return replies_;
return this->replies_;
}
QJsonObject toJson() const;
+1 -1
View File
@@ -57,7 +57,7 @@ struct Selection {
, selectionMin(start)
, selectionMax(end)
{
if (selectionMin > selectionMax)
if (this->selectionMin > this->selectionMax)
{
std::swap(this->selectionMin, this->selectionMax);
}
@@ -165,14 +165,14 @@ void MessageLayoutContainer::breakLine()
{
const int marginOffset = int(MARGIN.left() * this->scale_) +
int(MARGIN.right() * this->scale_);
xOffset = (width_ - marginOffset -
xOffset = (this->width_ - marginOffset -
this->elements_.at(this->elements_.size() - 1)
->getRect()
.right()) /
2;
}
for (size_t i = lineStart_; i < this->elements_.size(); i++)
for (size_t i = this->lineStart_; i < this->elements_.size(); i++)
{
MessageLayoutElement *element = this->elements_.at(i).get();
@@ -199,11 +199,11 @@ void MessageLayoutContainer::breakLine()
this->lines_.back().endCharIndex = this->charIndex_;
}
this->lines_.push_back({
.startIndex = lineStart_,
.startIndex = this->lineStart_,
.endIndex = 0,
.startCharIndex = this->charIndex_,
.endCharIndex = 0,
.rect = QRectF(-100000, this->currentY_, 200000, lineHeight_),
.rect = QRectF(-100000, this->currentY_, 200000, this->lineHeight_),
});
for (auto i = this->lineStart_; i < this->elements_.size(); i++)
+2 -2
View File
@@ -17,8 +17,8 @@ AuthorPredicate::AuthorPredicate(const QString &authors, bool negate)
bool AuthorPredicate::appliesToImpl(const Message &message)
{
return authors_.contains(message.displayName, Qt::CaseInsensitive) ||
authors_.contains(message.loginName, Qt::CaseInsensitive);
return this->authors_.contains(message.displayName, Qt::CaseInsensitive) ||
this->authors_.contains(message.loginName, Qt::CaseInsensitive);
}
} // namespace chatterino
+1 -1
View File
@@ -35,7 +35,7 @@ bool BadgePredicate::appliesToImpl(const Message &message)
{
for (const Badge &badge : message.badges)
{
if (badges_.contains(badge.key_, Qt::CaseInsensitive))
if (this->badges_.contains(badge.key_, Qt::CaseInsensitive))
{
return true;
}
+1 -1
View File
@@ -17,7 +17,7 @@ ChannelPredicate::ChannelPredicate(const QString &channels, bool negate)
bool ChannelPredicate::appliesToImpl(const Message &message)
{
return channels_.contains(message.channelName, Qt::CaseInsensitive);
return this->channels_.contains(message.channelName, Qt::CaseInsensitive);
}
} // namespace chatterino
@@ -71,10 +71,10 @@ bool MessageFlagsPredicate::appliesToImpl(const Message &message)
if (this->flags_.has(MessageFlag::System) &&
!this->flags_.has(MessageFlag::Timeout))
{
return message.flags.hasAny(flags_) &&
return message.flags.hasAny(this->flags_) &&
!message.flags.has(MessageFlag::Timeout);
}
return message.flags.hasAny(flags_);
return message.flags.hasAny(this->flags_);
}
} // namespace chatterino
+2 -2
View File
@@ -12,12 +12,12 @@ RegexPredicate::RegexPredicate(const QString &regex, bool negate)
bool RegexPredicate::appliesToImpl(const Message &message)
{
if (!regex_.isValid())
if (!this->regex_.isValid())
{
return false;
}
QRegularExpressionMatch match = regex_.match(message.messageText);
QRegularExpressionMatch match = this->regex_.match(message.messageText);
return match.hasMatch();
}
+1 -1
View File
@@ -24,7 +24,7 @@ bool SubtierPredicate::appliesToImpl(const Message &message)
const auto &subTier =
badge.value_.length() > 3 ? badge.value_.at(0) : '1';
return subtiers_.contains(subTier);
return this->subtiers_.contains(subTier);
}
}
@@ -21,10 +21,10 @@ std::optional<EmotePtr> ChatterinoBadges::getBadge(const UserId &id)
{
std::shared_lock lock(this->mutex_);
auto it = badgeMap.find(id.string);
if (it != badgeMap.end())
auto it = this->badgeMap.find(id.string);
if (it != this->badgeMap.end())
{
return emotes[it->second];
return this->emotes[it->second];
}
return std::nullopt;
}
@@ -66,12 +66,12 @@ void ChatterinoBadges::loadChatterinoBadges()
.homePage = Url{},
};
emotes.push_back(
this->emotes.push_back(
std::make_shared<const Emote>(std::move(emote)));
for (const auto &user : jsonBadge.value("users").toArray())
{
badgeMap[user.toString()] = index;
this->badgeMap[user.toString()] = index;
}
++index;
}
@@ -143,7 +143,7 @@ private:
this->connectBackoff_.reset();
auto *client = resolve(id);
auto *client = this->resolve(id);
client->onOpen();
auto pendingSubsToTake = std::min(this->pendingSubscriptions_.size(),
client->maxSubscriptions);
+1 -1
View File
@@ -18,7 +18,7 @@ bool UserPronouns::isUnspecified() const
UserPronouns::operator bool() const
{
return !isUnspecified();
return !this->isUnspecified();
}
} // namespace chatterino::pronouns
+1 -1
View File
@@ -12,7 +12,7 @@ public:
QString format() const
{
if (isUnspecified())
if (this->isUnspecified())
{
return "unspecified";
}
+2 -2
View File
@@ -58,13 +58,13 @@ ChannelPointReward::ChannelPointReward(const QJsonObject &redemption)
}
// use bits cost when channel points were not used
if (cost == 0)
if (this->cost == 0)
{
this->cost = reward.value("bits_cost").toInt();
}
// workaround twitch bug where bits_cost is always 0 in practice
if (cost == 0)
if (this->cost == 0)
{
this->cost = reward.value("default_bits_cost").toInt();
}
+3 -3
View File
@@ -8,17 +8,17 @@ struct EmoteValue {
public:
int getSet()
{
return set_;
return this->set_;
}
int getId()
{
return id_;
return this->id_;
}
const QString &getChannelName()
{
return channelName_;
return this->channelName_;
}
private:
+1 -1
View File
@@ -1196,7 +1196,7 @@ void TwitchChannel::updateSeventvUser(
return;
}
updateSeventvData(this->seventvUserID_, dispatch.emoteSetID);
this->updateSeventvData(this->seventvUserID_, dispatch.emoteSetID);
SeventvEmotes::getEmoteSet(
dispatch.emoteSetID,
[this, weak = weakOf<Channel>(this), dispatch](auto &&emotes,
+1 -1
View File
@@ -393,7 +393,7 @@ struct HelixBadgeSet {
const auto jsonVersions = json.value("versions").toArray();
for (const auto &version : jsonVersions)
{
versions.emplace_back(version.toObject());
this->versions.emplace_back(version.toObject());
}
}
};
@@ -161,9 +161,9 @@ void EventSubMessageBuilder::appendUser(const lib::String &userName,
QString &text, bool trailingSpace)
{
auto login = userLogin.qt();
auto *el = this->emplace<MentionElement>(userName.qt(), login,
MessageColor::System,
channel->getUserColor(login));
auto *el = this->emplace<MentionElement>(
userName.qt(), login, MessageColor::System,
this->channel->getUserColor(login));
text.append(login);
if (trailingSpace)
@@ -19,7 +19,7 @@ RawSubscriptionHandle::~RawSubscriptionHandle()
// We're shutting down, assume the unsubscription has been taken care of
return;
}
app->getEventSub()->removeRef(request);
app->getEventSub()->removeRef(this->request);
}
} // namespace chatterino::eventsub
+1 -1
View File
@@ -132,7 +132,7 @@ using namespace std::string_literals;
CrashHandler::CrashHandler(const Paths &paths_)
: paths(paths_)
{
auto optSettings = readRecoverySettings(paths);
auto optSettings = readRecoverySettings(this->paths);
if (optSettings)
{
this->shouldRecover_ = *optSettings;
+5 -5
View File
@@ -117,12 +117,12 @@ void Settings::mute(const QString &channelName)
void Settings::unmute(const QString &channelName)
{
for (std::vector<int>::size_type i = 0; i != mutedChannels.raw().size();
i++)
for (std::vector<int>::size_type i = 0;
i != this->mutedChannels.raw().size(); i++)
{
if (mutedChannels.raw()[i].toLower() == channelName.toLower())
if (this->mutedChannels.raw()[i].toLower() == channelName.toLower())
{
mutedChannels.removeAt(i);
this->mutedChannels.removeAt(i);
i--;
}
}
@@ -132,7 +132,7 @@ bool Settings::toggleMutedChannel(const QString &channelName)
{
if (this->isMutedChannel(channelName))
{
unmute(channelName);
this->unmute(channelName);
return false;
}
else
+1 -1
View File
@@ -462,7 +462,7 @@ AvatarDownloader::AvatarDownloader(const QString &avatarURL,
{
this->file_.close();
}
downloadComplete();
this->downloadComplete();
this->deleteLater();
});
}
+2 -2
View File
@@ -104,12 +104,12 @@ void Updates::deleteOldFiles()
const QString &Updates::getCurrentVersion() const
{
return currentVersion_;
return this->currentVersion_;
}
const QString &Updates::getOnlineVersion() const
{
return onlineVersion_;
return this->onlineVersion_;
}
void Updates::installUpdates()
+1 -1
View File
@@ -806,7 +806,7 @@ void WindowManager::closeAll()
qCDebug(chatterinoWindowmanager) << "Shutting down (closing windows)";
this->shuttingDown_ = true;
for (Window *window : windows_)
for (Window *window : this->windows_)
{
closeWindowsRecursive(window);
}
+9 -8
View File
@@ -64,27 +64,28 @@ LoggingChannel::LoggingChannel(QString _channelName, QString _platform)
{
this->subDirectory = "Whispers";
}
else if (channelName.startsWith("/mentions"))
else if (this->channelName.startsWith("/mentions"))
{
this->subDirectory = "Mentions";
}
else if (channelName.startsWith("/live"))
else if (this->channelName.startsWith("/live"))
{
this->subDirectory = "Live";
}
else if (channelName.startsWith("/automod"))
else if (this->channelName.startsWith("/automod"))
{
this->subDirectory = "AutoMod";
}
else
{
this->subDirectory =
QStringLiteral("Channels") + QDir::separator() + channelName;
QStringLiteral("Channels") + QDir::separator() + this->channelName;
}
// enforce capitalized platform names
this->subDirectory = platform[0].toUpper() + platform.mid(1).toLower() +
QDir::separator() + this->subDirectory;
this->subDirectory = this->platform[0].toUpper() +
this->platform.mid(1).toLower() + QDir::separator() +
this->subDirectory;
getSettings()->logPath.connect([this](const QString &logPath, auto) {
this->baseDirectory = logPath.isEmpty()
@@ -196,8 +197,8 @@ void LoggingChannel::addMessage(const MessagePtr &message,
}
QString str;
if (channelName.startsWith("/mentions") ||
channelName.startsWith("/automod"))
if (this->channelName.startsWith("/mentions") ||
this->channelName.startsWith("/automod"))
{
str.append("#" + message->channelName + " ");
}
+6 -6
View File
@@ -36,37 +36,37 @@ struct QByteArrayBuffer {
[[nodiscard]] constexpr reference operator*() const noexcept
{
return *ptr;
return *this->ptr;
}
[[nodiscard]] constexpr pointer operator->() const noexcept
{
return ptr;
return this->ptr;
}
constexpr ConstIterator &operator++() noexcept
{
++ptr;
++this->ptr;
return *this;
}
constexpr ConstIterator operator++(int) noexcept
{
ConstIterator tmp = *this;
++ptr;
++this->ptr;
return tmp;
}
constexpr ConstIterator &operator--() noexcept
{
--ptr;
--this->ptr;
return *this;
}
constexpr ConstIterator operator--(int) noexcept
{
ConstIterator tmp = *this;
--ptr;
--this->ptr;
return tmp;
}
+4 -4
View File
@@ -26,17 +26,17 @@ void RatelimitBucket::send(QString channel)
void RatelimitBucket::handleOne()
{
if (queue_.isEmpty())
if (this->queue_.isEmpty())
{
return;
}
auto item = queue_.takeFirst();
auto item = this->queue_.takeFirst();
this->budget_--;
callback_(item);
this->callback_(item);
QTimer::singleShot(cooldown_, this, [this] {
QTimer::singleShot(this->cooldown_, this, [this] {
this->budget_++;
this->handleOne();
});
+1 -1
View File
@@ -26,7 +26,7 @@ public:
/// isValid returns true if the file exists and is readable
bool isValid() const
{
return valid;
return this->valid;
}
/// Find the first desktop file based on the given desktop file ID
+2 -2
View File
@@ -751,7 +751,7 @@ bool BaseWindow::applyLastBoundsCheck()
void BaseWindow::resizeEvent(QResizeEvent *)
{
// Queue up save because: Window resized
if (!flags_.has(DisableLayoutSave))
if (!this->flags_.has(DisableLayoutSave))
{
getApp()->getWindows()->queueSave();
}
@@ -766,7 +766,7 @@ void BaseWindow::moveEvent(QMoveEvent *event)
{
// Queue up save because: Window position changed
#ifdef CHATTERINO
if (!flags_.has(DisableLayoutSave))
if (!this->flags_.has(DisableLayoutSave))
{
getApp()->getWindows()->queueSave();
}
+3 -3
View File
@@ -97,8 +97,8 @@ void DraggablePopup::mouseMoveEvent(QMouseEvent *event)
void DraggablePopup::togglePinned()
{
this->isPinned_ = !isPinned_;
if (isPinned_)
this->isPinned_ = !this->isPinned_;
if (this->isPinned_)
{
this->windowDeactivateAction = WindowDeactivateAction::Nothing;
this->pinButton_->setSource(this->pinEnabledSource_);
@@ -111,7 +111,7 @@ void DraggablePopup::togglePinned()
}
Button *DraggablePopup::createPinButton()
{
this->pinButton_ = new SvgButton(pinDisabledSource_, this, {3, 3});
this->pinButton_ = new SvgButton(this->pinDisabledSource_, this, {3, 3});
this->pinButton_->setScaleIndependentSize(18, 18);
this->pinButton_->setToolTip("Pin Window");
+9 -9
View File
@@ -356,7 +356,7 @@ void Notebook::select(QWidget *page, bool focusPage)
// Hide the previously selected page
this->selectedPage_->hide();
auto *item = this->findItem(selectedPage_);
auto *item = this->findItem(this->selectedPage_);
if (!item)
{
return;
@@ -830,7 +830,7 @@ void Notebook::performHorizontalLayout(const LayoutContext &ctx, bool animated)
auto isLast = &item == &ctx.items.back();
auto fitsInLine = ((isLast ? ctx.addButtonWidth : 0) + x +
item.tab->width()) <= width();
item.tab->width()) <= this->width();
if (!isFirst && !fitsInLine)
{
@@ -884,7 +884,7 @@ void Notebook::performHorizontalLayout(const LayoutContext &ctx, bool animated)
if (this->selectedPage_ != nullptr)
{
this->selectedPage_->move(0, 0);
this->selectedPage_->resize(width(), tabsStart);
this->selectedPage_->resize(this->width(), tabsStart);
this->selectedPage_->raise();
}
}
@@ -905,7 +905,7 @@ void Notebook::performHorizontalLayout(const LayoutContext &ctx, bool animated)
if (this->selectedPage_ != nullptr)
{
this->selectedPage_->move(0, y);
this->selectedPage_->resize(width(), height() - y);
this->selectedPage_->resize(this->width(), this->height() - y);
this->selectedPage_->raise();
}
}
@@ -1010,7 +1010,7 @@ void Notebook::performVerticalLayout(const LayoutContext &ctx, bool animated)
{
if (isRight)
{
int distanceFromRight = width() - x;
int distanceFromRight = this->width() - x;
largestWidth = std::max(
largestWidth, consumedButtonWidths - distanceFromRight);
}
@@ -1069,7 +1069,7 @@ void Notebook::performVerticalLayout(const LayoutContext &ctx, bool animated)
if (this->selectedPage_ != nullptr)
{
this->selectedPage_->move(0, 0);
this->selectedPage_->resize(tabsStart, height());
this->selectedPage_->resize(tabsStart, this->height());
this->selectedPage_->raise();
}
}
@@ -1087,7 +1087,7 @@ void Notebook::performVerticalLayout(const LayoutContext &ctx, bool animated)
if (this->selectedPage_ != nullptr)
{
this->selectedPage_->move(x, 0);
this->selectedPage_->resize(width() - x, height());
this->selectedPage_->resize(this->width() - x, this->height());
this->selectedPage_->raise();
}
}
@@ -1158,8 +1158,8 @@ void Notebook::paintEvent(QPaintEvent *event)
{
painter.fillRect(this->lineOffset_,
int(NOTEBOOK_TAB_HEIGHT * scale),
width() - this->lineOffset_, int(2 * scale),
this->theme->tabs.dividerLine);
this->width() - this->lineOffset_,
int(2 * scale), this->theme->tabs.dividerLine);
}
}
+1 -1
View File
@@ -152,7 +152,7 @@ protected:
const QList<Item> items()
{
return items_;
return this->items_;
}
/**
+1 -1
View File
@@ -229,7 +229,7 @@ void Window::addCustomTitlebarButtons()
this->userLabel_->mapToGlobal(
this->userLabel_->rect().bottomLeft()));
});
this->userLabel_->setMinimumWidth(20 * scale());
this->userLabel_->setMinimumWidth(20 * this->scale());
// streamer mode
this->streamerModeTitlebarIcon_ =
+8 -8
View File
@@ -14,7 +14,7 @@ namespace chatterino {
Button::Button(BaseWidget *parent)
: BaseWidget(parent)
{
connect(&effectTimer_, &QTimer::timeout, this,
connect(&this->effectTimer_, &QTimer::timeout, this,
&Button::onMouseEffectTimeout);
this->effectTimer_.setInterval(20);
@@ -269,10 +269,10 @@ void Button::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
{
leftClicked();
this->leftClicked();
}
clicked(event->button());
this->clicked(event->button());
}
}
@@ -295,7 +295,7 @@ void Button::onMouseEffectTimeout()
{
bool performUpdate = false;
if (mouseOver_)
if (this->mouseOver_)
{
if (this->hoverMultiplier_ != 1)
{
@@ -336,7 +336,7 @@ void Button::onMouseEffectTimeout()
if (performUpdate)
{
update();
this->update();
}
}
@@ -437,7 +437,7 @@ void Button::fancyPaint(QPainter &painter)
if (this->hoverMultiplier_ > 0)
{
QRadialGradient gradient(QPointF(mousePos_),
QRadialGradient gradient(QPointF(this->mousePos_),
static_cast<qreal>(this->width()) / 2.0);
gradient.setColorAt(0, QColor(c.red(), c.green(), c.blue(),
@@ -454,8 +454,8 @@ void Button::fancyPaint(QPainter &painter)
painter.setBrush(QColor(c.red(), c.green(), c.blue(),
int((1 - effect.progress) * 95)));
painter.drawEllipse(QPointF(effect.position),
effect.progress * qreal(width()) * 2,
effect.progress * qreal(width()) * 2);
effect.progress * qreal(this->width()) * 2,
effect.progress * qreal(this->width()) * 2);
}
}
+1 -1
View File
@@ -144,7 +144,7 @@ void DrawnButton::paintContent(QPainter &painter)
QRect centerBox;
centerBox.setSize({thickness, thickness});
centerBox.moveCenter(rect().center());
centerBox.moveCenter(this->rect().center());
painter.fillRect(centerBox, fg);
+2 -2
View File
@@ -16,7 +16,7 @@ void SignalLabel::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
{
leftMouseDown();
this->leftMouseDown();
}
event->ignore();
@@ -26,7 +26,7 @@ void SignalLabel::mouseReleaseEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
{
leftMouseUp();
this->leftMouseUp();
}
event->ignore();
+2 -2
View File
@@ -626,7 +626,7 @@ void UserInfoPopup::themeChangedEvent()
void UserInfoPopup::scaleChangedEvent(float /*scale*/)
{
themeChangedEvent();
this->themeChangedEvent();
QTimer::singleShot(20, this, [this] {
auto geo = this->geometry();
@@ -815,7 +815,7 @@ void UserInfoPopup::setData(const QString &name,
if (isId)
{
this->userId_ = name.mid(idPrefix.size());
updateNotes();
this->updateNotes();
this->userName_ = "";
}
else
+8 -8
View File
@@ -461,7 +461,7 @@ Scrollbar *ChannelView::scrollbar()
bool ChannelView::pausable() const
{
return pausable_;
return this->pausable_;
}
void ChannelView::setPausable(bool value)
@@ -867,7 +867,7 @@ bool ChannelView::hasSelection()
void ChannelView::clearSelection()
{
this->selection_ = Selection();
queueLayout();
this->queueLayout();
}
void ChannelView::copySelectedText()
@@ -1543,7 +1543,7 @@ void ChannelView::paintEvent(QPaintEvent *event)
QPainter painter(this);
painter.fillRect(rect(), this->messageColors_.channelBackground);
painter.fillRect(this->rect(), this->messageColors_.channelBackground);
// draw messages
this->drawMessages(painter, event->rect());
@@ -1961,7 +1961,7 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
int messageIndex;
// no message under cursor
if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
if (!this->tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
{
this->setCursor(Qt::ArrowCursor);
this->tooltipWidget_->hide();
@@ -2164,9 +2164,9 @@ void ChannelView::mousePressEvent(QMouseEvent *event)
QPointF relativePos;
int messageIndex;
if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
if (!this->tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
{
setCursor(Qt::ArrowCursor);
this->setCursor(Qt::ArrowCursor);
auto &messagesSnapshot = this->getMessagesSnapshot();
if (messagesSnapshot.size() == 0)
{
@@ -2271,7 +2271,7 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
int messageIndex;
bool foundElement =
tryGetMessageAt(event->pos(), layout, relativePos, messageIndex);
this->tryGetMessageAt(event->pos(), layout, relativePos, messageIndex);
// check if mouse was pressed
if (event->button() == Qt::LeftButton)
@@ -2915,7 +2915,7 @@ void ChannelView::mouseDoubleClickEvent(QMouseEvent *event)
QPointF relativePos;
int messageIndex;
if (!tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
if (!this->tryGetMessageAt(event->pos(), layout, relativePos, messageIndex))
{
return;
}
+11 -11
View File
@@ -20,7 +20,7 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
, model_(model)
{
this->model_->setParent(this);
this->tableView_->setModel(model_);
this->tableView_->setModel(this->model_);
// disabling word-wrap somehow prevent '/'-prefixed commands from being elided
this->tableView_->setWordWrap(false);
this->tableView_->setSelectionMode(QAbstractItemView::SingleSelection);
@@ -66,7 +66,7 @@ EditableModelView::EditableModelView(QAbstractTableModel *model, bool movable)
for (auto &&row : rows)
{
model_->removeRow(row);
this->model_->removeRow(row);
}
});
@@ -171,8 +171,8 @@ bool EditableModelView::filterSearchResults(const QString &query,
for (int j : columnSelect)
{
QModelIndex idx = model_->index(i, j);
QVariant a = model_->data(idx);
QModelIndex idx = this->model_->index(i, j);
QVariant a = this->model_->data(idx);
if (a.toString().contains(query, Qt::CaseInsensitive))
{
foundMatch = true;
@@ -181,7 +181,7 @@ bool EditableModelView::filterSearchResults(const QString &query,
}
}
tableView_->setRowHidden(i, !foundMatch);
this->tableView_->setRowHidden(i, !foundMatch);
}
return searchFoundSomething;
@@ -194,19 +194,19 @@ void EditableModelView::filterSearchResultsHotkey(
for (int i = 0; i < rowAmount; i++)
{
QModelIndex idx = model_->index(i, 1);
QVariant a = model_->data(idx);
QModelIndex idx = this->model_->index(i, 1);
QVariant a = this->model_->data(idx);
auto seq = qvariant_cast<QKeySequence>(a);
// todo: Make this fuzzy match, right now only exact matches happen
// so ctrl+f won't match ctrl+shift+f shortcuts
if (keySequenceQuery.matches(seq) != QKeySequence::NoMatch)
{
tableView_->showRow(i);
this->tableView_->showRow(i);
}
else
{
tableView_->hideRow(i);
this->tableView_->hideRow(i);
}
}
}
@@ -224,8 +224,8 @@ void EditableModelView::moveRow(int dir)
return;
}
model_->moveRows(model_->index(row, 0), row, selected.size(),
model_->index(row + dir, 0), row + dir);
this->model_->moveRows(this->model_->index(row, 0), row, selected.size(),
this->model_->index(row + dir, 0), row + dir);
this->tableView_->selectRow(row + dir);
}
+8 -8
View File
@@ -127,7 +127,7 @@ NotebookTab::NotebookTab(Notebook *notebook)
this->closeMultipleTabsMenu_ = new QMenu("Close Multiple Tabs", this);
const auto tabDirection = getSettings()->tabDirection.getEnum();
this->menu_.addMenu(closeMultipleTabsMenu_);
this->menu_.addMenu(this->closeMultipleTabsMenu_);
getSettings()->tabDirection.connect(
[this](int val) {
this->recreateCloseMultipleTabsMenu(
@@ -150,15 +150,15 @@ NotebookTab::NotebookTab(Notebook *notebook)
this->notebook_->duplicatePage(this->page);
});
highlightNewMessagesAction_ =
this->highlightNewMessagesAction_ =
new QAction("Mark Tab as Unread on New Messages", &this->menu_);
highlightNewMessagesAction_->setCheckable(true);
highlightNewMessagesAction_->setChecked(highlightEnabled_);
QObject::connect(highlightNewMessagesAction_, &QAction::triggered,
this->highlightNewMessagesAction_->setCheckable(true);
this->highlightNewMessagesAction_->setChecked(this->highlightEnabled_);
QObject::connect(this->highlightNewMessagesAction_, &QAction::triggered,
[this](bool checked) {
this->highlightEnabled_ = checked;
});
this->menu_.addAction(highlightNewMessagesAction_);
this->menu_.addAction(this->highlightNewMessagesAction_);
this->menu_.addSeparator();
@@ -824,7 +824,7 @@ bool NotebookTab::hasHighlightsEnabled() const
QRect NotebookTab::getDesiredRect() const
{
return QRect(this->positionAnimationDesiredPoint_, size());
return QRect(this->positionAnimationDesiredPoint_, this->size());
}
void NotebookTab::tabSizeChanged()
@@ -1081,7 +1081,7 @@ void NotebookTab::mousePressEvent(QMouseEvent *event)
this->mouseDown_ = true;
this->mouseDownX_ = this->getXRect().contains(event->pos());
this->notebook_->select(page);
this->notebook_->select(this->page);
}
this->update();
+3 -2
View File
@@ -66,7 +66,8 @@ int ResizingTextEdit::heightForWidth(int) const
{
auto margins = this->contentsMargins();
return margins.top() + document()->size().height() + margins.bottom() + 5;
return margins.top() + this->document()->size().height() +
margins.bottom() + 5;
}
QString ResizingTextEdit::textUnderCursor(bool *hadSpace) const
@@ -256,7 +257,7 @@ void ResizingTextEdit::setCompleter(QCompleter *c)
this->completer_->setCompletionMode(QCompleter::InlineCompletion);
this->completer_->setCaseSensitivity(Qt::CaseInsensitive);
QObject::connect(completer_,
QObject::connect(this->completer_,
static_cast<void (QCompleter::*)(const QString &)>(
&QCompleter::highlighted),
this, &ResizingTextEdit::insertCompletion);
+7 -7
View File
@@ -36,7 +36,7 @@ void SettingsDialogTab::setSelected(bool _selected)
// height: <checkbox-size>px;
this->selected_ = _selected;
selectedChanged(selected_);
this->selectedChanged(this->selected_);
}
SettingsPage *SettingsDialogTab::page()
@@ -69,10 +69,10 @@ void SettingsDialogTab::paintEvent(QPaintEvent *)
pad = (3 * pad) + iconSize;
this->style()->drawItemText(&painter,
QRect(pad, 0, width() - pad, height()),
Qt::AlignLeft | Qt::AlignVCenter,
this->palette(), false, this->ui_.labelText);
this->style()->drawItemText(
&painter, QRect(pad, 0, this->width() - pad, this->height()),
Qt::AlignLeft | Qt::AlignVCenter, this->palette(), false,
this->ui_.labelText);
}
void SettingsDialogTab::mousePressEvent(QMouseEvent *event)
@@ -89,12 +89,12 @@ void SettingsDialogTab::mousePressEvent(QMouseEvent *event)
const QString &SettingsDialogTab::name() const
{
return name_;
return this->name_;
}
SettingsTabId SettingsDialogTab::id() const
{
return id_;
return this->id_;
}
} // namespace chatterino
+1 -1
View File
@@ -155,7 +155,7 @@ QSize FlowLayout::minimumSize() const
size = size.expandedTo(item->minimumSize());
}
const QMargins margins = contentsMargins();
const QMargins margins = this->contentsMargins();
size += QSize(margins.left() + margins.right(),
margins.top() + margins.bottom());
return size;
@@ -90,7 +90,7 @@ ExternalToolsPage::ExternalToolsPage()
y->addWidget(z);
this->setLayout(y);
this->initLayout(*view);
this->initLayout(*this->view);
}
bool ExternalToolsPage::filterElements(const QString &query)
@@ -77,7 +77,7 @@ KeyboardSettingsPage::KeyboardSettingsPage()
}
});
QObject::connect(view_->getTableView(), &QTableView::doubleClicked,
QObject::connect(this->view_->getTableView(), &QTableView::doubleClicked,
[view, model](const QModelIndex &clicked) {
tableCellClicked(clicked, view, model);
});
+1 -1
View File
@@ -35,7 +35,7 @@ SettingWidget::SettingWidget(const QString &mainKeyword)
this->vLayout->setContentsMargins(0, 0, 0, 0);
this->hLayout->setContentsMargins(0, 0, 0, 0);
this->vLayout->addLayout(hLayout);
this->vLayout->addLayout(this->hLayout);
this->keywords.append(mainKeyword);
}
+1 -1
View File
@@ -109,7 +109,7 @@ Split::Split(QWidget *parent)
getApp()->getAccounts()->twitch.currentUserChanged.connect([this] {
this->updateInputPlaceholder();
}));
this->signalHolder_.managedConnect(channelChanged, [this] {
this->signalHolder_.managedConnect(this->channelChanged, [this] {
this->updateInputPlaceholder();
});
this->updateInputPlaceholder();
+11 -11
View File
@@ -340,7 +340,7 @@ SplitContainer::Position SplitContainer::releaseSplit(Split *split)
split->setParent(nullptr);
Position position = node->releaseSplit();
this->layout();
if (splits_.empty())
if (this->splits_.empty())
{
this->setSelected(nullptr);
this->setCursor(Qt::PointingHandCursor);
@@ -366,7 +366,7 @@ SplitContainer::Position SplitContainer::deleteSplit(Split *split)
assert(split != nullptr);
split->deleteLater();
return releaseSplit(split);
return this->releaseSplit(split);
}
void SplitContainer::selectNextSplit(SplitDirection direction)
@@ -468,13 +468,13 @@ Split *SplitContainer::getTopRightSplit(Node &node)
case Node::Type::VerticalContainer:
if (!node.getChildren().empty())
{
return getTopRightSplit(*node.getChildren().front());
return this->getTopRightSplit(*node.getChildren().front());
}
break;
case Node::Type::HorizontalContainer:
if (!node.getChildren().empty())
{
return getTopRightSplit(*node.getChildren().back());
return this->getTopRightSplit(*node.getChildren().back());
}
break;
default:;
@@ -635,7 +635,7 @@ void SplitContainer::paintSplitBorder(Node *node, QPainter *painter)
case Node::Type::HorizontalContainer: {
for (const auto &child : node->children_)
{
paintSplitBorder(child.get(), painter);
this->paintSplitBorder(child.get(), painter);
}
}
break;
@@ -650,7 +650,7 @@ void SplitContainer::paintEvent(QPaintEvent * /*event*/)
if (this->splits_.empty())
{
painter.fillRect(rect(), this->theme->splits.background);
painter.fillRect(this->rect(), this->theme->splits.background);
painter.setPen(this->theme->splits.header.text);
@@ -670,7 +670,7 @@ void SplitContainer::paintEvent(QPaintEvent * /*event*/)
}
}
painter.drawText(rect(), text, QTextOption(Qt::AlignCenter));
painter.drawText(this->rect(), text, QTextOption(Qt::AlignCenter));
}
else
{
@@ -725,7 +725,7 @@ void SplitContainer::paintEvent(QPaintEvent * /*event*/)
? this->theme->tabs.selected.backgrounds.regular
: this->theme->tabs.selected.backgrounds.unfocused);
painter.fillRect(0, 0, width(), 1, accentColor);
painter.fillRect(0, 0, this->width(), 1, accentColor);
}
void SplitContainer::dragEnterEvent(QDragEnterEvent *event)
@@ -1152,7 +1152,7 @@ void SplitContainer::Node::insertSplitRelative(Split *_split,
}
// parent != nullptr
if (parent_->type_ == toContainerType(_direction))
if (this->parent_->type_ == toContainerType(_direction))
{
// hell yeah we'll just insert it next to outselves
this->insertNextToThis(_split, _direction);
@@ -1238,7 +1238,7 @@ SplitContainer::Position SplitContainer::Node::releaseSplit()
{
assert(this->type_ == Type::Split);
if (parent_ == nullptr)
if (this->parent_ == nullptr)
{
this->type_ = Type::EmptyRoot;
this->split_ = nullptr;
@@ -1667,7 +1667,7 @@ void SplitContainer::ResizeHandle::mouseMoveEvent(QMouseEvent *event)
assert(node != nullptr);
assert(node->parent_ != nullptr);
const auto &siblings = node->parent_->getChildren();
const auto &siblings = this->node->parent_->getChildren();
auto it = std::ranges::find_if(siblings, [this](const auto &n) {
return n.get() == this->node;
});
+3 -3
View File
@@ -979,10 +979,10 @@ void SplitHeader::paintEvent(QPaintEvent * /*event*/)
border = this->theme->splits.header.focusedBorder;
}
painter.fillRect(rect(), background);
painter.fillRect(this->rect(), background);
painter.setPen(border);
painter.drawRect(0, 0, width() - 1, height() - 2);
painter.fillRect(0, height() - 1, width(), 1, background);
painter.drawRect(0, 0, this->width() - 1, this->height() - 2);
painter.fillRect(0, this->height() - 1, this->width(), 1, background);
}
void SplitHeader::mousePressEvent(QMouseEvent *event)
+3 -3
View File
@@ -374,7 +374,7 @@ QString SplitInput::handleSendMessage(const std::vector<QString> &arguments)
if (!c->isTwitchChannel() || this->replyTarget_ == nullptr)
{
// standard message send behavior
QString message = ui_.textEdit->toPlainText();
QString message = this->ui_.textEdit->toPlainText();
message = message.replace('\n', ' ');
QString sendMessage =
@@ -544,7 +544,7 @@ void SplitInput::addShortcuts()
if (this->prevIndex_ == (this->prevMsg_.size()))
{
this->currMsg_ = ui_.textEdit->toPlainText();
this->currMsg_ = this->ui_.textEdit->toPlainText();
}
this->prevIndex_--;
@@ -568,7 +568,7 @@ void SplitInput::addShortcuts()
return "";
}
bool cursorToEnd = true;
QString message = ui_.textEdit->toPlainText();
QString message = this->ui_.textEdit->toPlainText();
if (this->prevIndex_ != (this->prevMsg_.size() - 1) &&
this->prevIndex_ != this->prevMsg_.size())