From 57d6583a2bb1da60322044ba4a0c01b0e7f0a158 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Tue, 30 Dec 2025 13:30:57 +0100 Subject: [PATCH] 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. --- src/common/Channel.cpp | 2 +- src/common/SignalVectorModel.hpp | 2 +- src/common/WindowDescriptors.cpp | 2 +- .../completion/strategies/CommandStrategy.cpp | 2 +- src/controllers/hotkeys/ActionNames.hpp | 2 +- src/controllers/ignores/IgnorePhrase.cpp | 4 ++-- .../notifications/NotificationController.cpp | 18 +++++++-------- src/controllers/plugins/LuaUtilities.hpp | 2 +- src/controllers/plugins/api/Message.cpp | 2 +- src/controllers/twitch/LiveController.cpp | 2 +- src/controllers/userdata/UserData.hpp | 2 +- src/debug/Benchmark.cpp | 7 +++--- src/messages/Emote.hpp | 2 +- src/messages/MessageElement.cpp | 2 +- src/messages/MessageThread.hpp | 6 ++--- src/messages/Selection.hpp | 2 +- .../layouts/MessageLayoutContainer.cpp | 8 +++---- src/messages/search/AuthorPredicate.cpp | 4 ++-- src/messages/search/BadgePredicate.cpp | 2 +- src/messages/search/ChannelPredicate.cpp | 2 +- src/messages/search/MessageFlagsPredicate.cpp | 4 ++-- src/messages/search/RegexPredicate.cpp | 4 ++-- src/messages/search/SubtierPredicate.cpp | 2 +- src/providers/chatterino/ChatterinoBadges.cpp | 10 ++++----- .../liveupdates/BasicPubSubManager.hpp | 2 +- src/providers/pronouns/UserPronouns.cpp | 2 +- src/providers/pronouns/UserPronouns.hpp | 2 +- src/providers/twitch/ChannelPointReward.cpp | 4 ++-- src/providers/twitch/EmoteValue.hpp | 6 ++--- src/providers/twitch/TwitchChannel.cpp | 2 +- src/providers/twitch/api/Helix.hpp | 2 +- .../twitch/eventsub/MessageBuilder.cpp | 6 ++--- .../twitch/eventsub/SubscriptionHandle.cpp | 2 +- src/singletons/CrashHandler.cpp | 2 +- src/singletons/Settings.cpp | 10 ++++----- src/singletons/Toasts.cpp | 2 +- src/singletons/Updates.cpp | 4 ++-- src/singletons/WindowManager.cpp | 2 +- src/singletons/helper/LoggingChannel.cpp | 17 +++++++------- src/util/QByteArrayBuffer.hpp | 12 +++++----- src/util/RatelimitBucket.cpp | 8 +++---- src/util/XDGDesktopFile.hpp | 2 +- src/widgets/BaseWindow.cpp | 4 ++-- src/widgets/DraggablePopup.cpp | 6 ++--- src/widgets/Notebook.cpp | 18 +++++++-------- src/widgets/Notebook.hpp | 2 +- src/widgets/Window.cpp | 2 +- src/widgets/buttons/Button.cpp | 16 +++++++------- src/widgets/buttons/DrawnButton.cpp | 2 +- src/widgets/buttons/SignalLabel.cpp | 4 ++-- src/widgets/dialogs/UserInfoPopup.cpp | 4 ++-- src/widgets/helper/ChannelView.cpp | 16 +++++++------- src/widgets/helper/EditableModelView.cpp | 22 +++++++++---------- src/widgets/helper/NotebookTab.cpp | 16 +++++++------- src/widgets/helper/ResizingTextEdit.cpp | 5 +++-- src/widgets/helper/SettingsDialogTab.cpp | 14 ++++++------ src/widgets/layout/FlowLayout.cpp | 2 +- .../settingspages/ExternalToolsPage.cpp | 2 +- .../settingspages/KeyboardSettingsPage.cpp | 2 +- src/widgets/settingspages/SettingWidget.cpp | 2 +- src/widgets/splits/Split.cpp | 2 +- src/widgets/splits/SplitContainer.cpp | 22 +++++++++---------- src/widgets/splits/SplitHeader.cpp | 6 ++--- src/widgets/splits/SplitInput.cpp | 6 ++--- 64 files changed, 180 insertions(+), 177 deletions(-) diff --git a/src/common/Channel.cpp b/src/common/Channel.cpp index d9cbc3ca..18788d2c 100644 --- a/src/common/Channel.cpp +++ b/src/common/Channel.cpp @@ -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) diff --git a/src/common/SignalVectorModel.hpp b/src/common/SignalVectorModel.hpp index 402cdc18..65723c1d 100644 --- a/src/common/SignalVectorModel.hpp +++ b/src/common/SignalVectorModel.hpp @@ -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, diff --git a/src/common/WindowDescriptors.cpp b/src/common/WindowDescriptors.cpp index ed08f0cd..3f68e447 100644 --- a/src/common/WindowDescriptors.cpp +++ b/src/common/WindowDescriptors.cpp @@ -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; diff --git a/src/controllers/completion/strategies/CommandStrategy.cpp b/src/controllers/completion/strategies/CommandStrategy.cpp index 9edf4e40..02d5eb66 100644 --- a/src/controllers/completion/strategies/CommandStrategy.cpp +++ b/src/controllers/completion/strategies/CommandStrategy.cpp @@ -23,7 +23,7 @@ void CommandStrategy::apply(const std::vector &items, { QString normalizedQuery = normalizeQuery(query); - if (startsWithOnly_) + if (this->startsWithOnly_) { std::copy_if(items.begin(), items.end(), std::back_insert_iterator(output), diff --git a/src/controllers/hotkeys/ActionNames.hpp b/src/controllers/hotkeys/ActionNames.hpp index f2fbbd79..470fad64 100644 --- a/src/controllers/hotkeys/ActionNames.hpp +++ b/src/controllers/hotkeys/ActionNames.hpp @@ -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 diff --git a/src/controllers/ignores/IgnorePhrase.cpp b/src/controllers/ignores/IgnorePhrase.cpp index 17dc84bf..9c9a993a 100644 --- a/src/controllers/ignores/IgnorePhrase.cpp +++ b/src/controllers/ignores/IgnorePhrase.cpp @@ -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); } diff --git a/src/controllers/notifications/NotificationController.cpp b/src/controllers/notifications/NotificationController.cpp index 497b9161..b7f0ad9a 100644 --- a/src/controllers/notifications/NotificationController.cpp +++ b/src/controllers/notifications/NotificationController.cpp @@ -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::size_type i = 0; i != channelMap[p].raw().size(); - i++) + for (std::vector::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(i)); + this->channelMap[p].removeAt(static_cast(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()) { diff --git a/src/controllers/plugins/LuaUtilities.hpp b/src/controllers/plugins/LuaUtilities.hpp index 6c417977..7167e977 100644 --- a/src/controllers/plugins/LuaUtilities.hpp +++ b/src/controllers/plugins/LuaUtilities.hpp @@ -76,7 +76,7 @@ public: ~StackGuard() { - if (expected < 0) + if (this->expected < 0) { return; } diff --git a/src/controllers/plugins/api/Message.cpp b/src/controllers/plugins/api/Message.cpp index e7200314..1d791d0d 100644 --- a/src/controllers/plugins/api/Message.cpp +++ b/src/controllers/plugins/api/Message.cpp @@ -442,7 +442,7 @@ private: } else { - return visitOne( + return this->visitOne( std::forward(rest)...); } } diff --git a/src/controllers/twitch/LiveController.cpp b/src/controllers/twitch/LiveController.cpp index d574bf86..241315db 100644 --- a/src/controllers/twitch/LiveController.cpp +++ b/src/controllers/twitch/LiveController.cpp @@ -118,7 +118,7 @@ void TwitchLiveController::request(std::optional 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) { diff --git a/src/controllers/userdata/UserData.hpp b/src/controllers/userdata/UserData.hpp index b26ac181..8fd0b306 100644 --- a/src/controllers/userdata/UserData.hpp +++ b/src/controllers/userdata/UserData.hpp @@ -21,7 +21,7 @@ struct UserData { bool isEmpty() const { - return !color.has_value() && notes.isEmpty(); + return !this->color.has_value() && this->notes.isEmpty(); } }; diff --git a/src/debug/Benchmark.cpp b/src/debug/Benchmark.cpp index 0aca0a61..61787748 100644 --- a/src/debug/Benchmark.cpp +++ b/src/debug/Benchmark.cpp @@ -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 diff --git a/src/messages/Emote.hpp b/src/messages/Emote.hpp index c2fd3885..960d4e25 100644 --- a/src/messages/Emote.hpp +++ b/src/messages/Emote.hpp @@ -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; diff --git a/src/messages/MessageElement.cpp b/src/messages/MessageElement.cpp index b02352be..c5084df9 100644 --- a/src/messages/MessageElement.cpp +++ b/src/messages/MessageElement.cpp @@ -428,7 +428,7 @@ std::vector LayeredEmoteElement::getUniqueEmotes() struct NotDuplicate { bool operator()(const Emote &element) { - return seen.insert(element.ptr).second; + return this->seen.insert(element.ptr).second; } private: diff --git a/src/messages/MessageThread.hpp b/src/messages/MessageThread.hpp index 56b088c0..3192bbd7 100644 --- a/src/messages/MessageThread.hpp +++ b/src/messages/MessageThread.hpp @@ -51,17 +51,17 @@ public: const QString &rootId() const { - return rootMessageId_; + return this->rootMessageId_; } const std::shared_ptr &root() const { - return rootMessage_; + return this->rootMessage_; } const std::vector> &replies() const { - return replies_; + return this->replies_; } QJsonObject toJson() const; diff --git a/src/messages/Selection.hpp b/src/messages/Selection.hpp index b04ad167..952a717a 100644 --- a/src/messages/Selection.hpp +++ b/src/messages/Selection.hpp @@ -57,7 +57,7 @@ struct Selection { , selectionMin(start) , selectionMax(end) { - if (selectionMin > selectionMax) + if (this->selectionMin > this->selectionMax) { std::swap(this->selectionMin, this->selectionMax); } diff --git a/src/messages/layouts/MessageLayoutContainer.cpp b/src/messages/layouts/MessageLayoutContainer.cpp index f8afbe5e..64709111 100644 --- a/src/messages/layouts/MessageLayoutContainer.cpp +++ b/src/messages/layouts/MessageLayoutContainer.cpp @@ -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++) diff --git a/src/messages/search/AuthorPredicate.cpp b/src/messages/search/AuthorPredicate.cpp index ae951b8c..4c7148bc 100644 --- a/src/messages/search/AuthorPredicate.cpp +++ b/src/messages/search/AuthorPredicate.cpp @@ -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 diff --git a/src/messages/search/BadgePredicate.cpp b/src/messages/search/BadgePredicate.cpp index 218ede8e..fb5705fb 100644 --- a/src/messages/search/BadgePredicate.cpp +++ b/src/messages/search/BadgePredicate.cpp @@ -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; } diff --git a/src/messages/search/ChannelPredicate.cpp b/src/messages/search/ChannelPredicate.cpp index 47df247f..41a3fa9b 100644 --- a/src/messages/search/ChannelPredicate.cpp +++ b/src/messages/search/ChannelPredicate.cpp @@ -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 diff --git a/src/messages/search/MessageFlagsPredicate.cpp b/src/messages/search/MessageFlagsPredicate.cpp index 82a7748a..aab2e148 100644 --- a/src/messages/search/MessageFlagsPredicate.cpp +++ b/src/messages/search/MessageFlagsPredicate.cpp @@ -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 diff --git a/src/messages/search/RegexPredicate.cpp b/src/messages/search/RegexPredicate.cpp index 733949af..2089efe7 100644 --- a/src/messages/search/RegexPredicate.cpp +++ b/src/messages/search/RegexPredicate.cpp @@ -12,12 +12,12 @@ RegexPredicate::RegexPredicate(const QString ®ex, 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(); } diff --git a/src/messages/search/SubtierPredicate.cpp b/src/messages/search/SubtierPredicate.cpp index 70d5b714..b6306e86 100644 --- a/src/messages/search/SubtierPredicate.cpp +++ b/src/messages/search/SubtierPredicate.cpp @@ -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); } } diff --git a/src/providers/chatterino/ChatterinoBadges.cpp b/src/providers/chatterino/ChatterinoBadges.cpp index a22d5b99..55fec5cd 100644 --- a/src/providers/chatterino/ChatterinoBadges.cpp +++ b/src/providers/chatterino/ChatterinoBadges.cpp @@ -21,10 +21,10 @@ std::optional 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(std::move(emote))); for (const auto &user : jsonBadge.value("users").toArray()) { - badgeMap[user.toString()] = index; + this->badgeMap[user.toString()] = index; } ++index; } diff --git a/src/providers/liveupdates/BasicPubSubManager.hpp b/src/providers/liveupdates/BasicPubSubManager.hpp index 66c922da..0ae0536a 100644 --- a/src/providers/liveupdates/BasicPubSubManager.hpp +++ b/src/providers/liveupdates/BasicPubSubManager.hpp @@ -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); diff --git a/src/providers/pronouns/UserPronouns.cpp b/src/providers/pronouns/UserPronouns.cpp index 6c093a72..f99194d8 100644 --- a/src/providers/pronouns/UserPronouns.cpp +++ b/src/providers/pronouns/UserPronouns.cpp @@ -18,7 +18,7 @@ bool UserPronouns::isUnspecified() const UserPronouns::operator bool() const { - return !isUnspecified(); + return !this->isUnspecified(); } } // namespace chatterino::pronouns diff --git a/src/providers/pronouns/UserPronouns.hpp b/src/providers/pronouns/UserPronouns.hpp index 5ce5b9c8..20073af0 100644 --- a/src/providers/pronouns/UserPronouns.hpp +++ b/src/providers/pronouns/UserPronouns.hpp @@ -12,7 +12,7 @@ public: QString format() const { - if (isUnspecified()) + if (this->isUnspecified()) { return "unspecified"; } diff --git a/src/providers/twitch/ChannelPointReward.cpp b/src/providers/twitch/ChannelPointReward.cpp index fff96de4..7f959013 100644 --- a/src/providers/twitch/ChannelPointReward.cpp +++ b/src/providers/twitch/ChannelPointReward.cpp @@ -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(); } diff --git a/src/providers/twitch/EmoteValue.hpp b/src/providers/twitch/EmoteValue.hpp index bf64445f..c5e91435 100644 --- a/src/providers/twitch/EmoteValue.hpp +++ b/src/providers/twitch/EmoteValue.hpp @@ -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: diff --git a/src/providers/twitch/TwitchChannel.cpp b/src/providers/twitch/TwitchChannel.cpp index bbcd669a..4c84b107 100644 --- a/src/providers/twitch/TwitchChannel.cpp +++ b/src/providers/twitch/TwitchChannel.cpp @@ -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(this), dispatch](auto &&emotes, diff --git a/src/providers/twitch/api/Helix.hpp b/src/providers/twitch/api/Helix.hpp index e8f82337..57143063 100644 --- a/src/providers/twitch/api/Helix.hpp +++ b/src/providers/twitch/api/Helix.hpp @@ -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()); } } }; diff --git a/src/providers/twitch/eventsub/MessageBuilder.cpp b/src/providers/twitch/eventsub/MessageBuilder.cpp index 3a692cf7..d2c7b0cf 100644 --- a/src/providers/twitch/eventsub/MessageBuilder.cpp +++ b/src/providers/twitch/eventsub/MessageBuilder.cpp @@ -161,9 +161,9 @@ void EventSubMessageBuilder::appendUser(const lib::String &userName, QString &text, bool trailingSpace) { auto login = userLogin.qt(); - auto *el = this->emplace(userName.qt(), login, - MessageColor::System, - channel->getUserColor(login)); + auto *el = this->emplace( + userName.qt(), login, MessageColor::System, + this->channel->getUserColor(login)); text.append(login); if (trailingSpace) diff --git a/src/providers/twitch/eventsub/SubscriptionHandle.cpp b/src/providers/twitch/eventsub/SubscriptionHandle.cpp index 175743fc..fc560c5a 100644 --- a/src/providers/twitch/eventsub/SubscriptionHandle.cpp +++ b/src/providers/twitch/eventsub/SubscriptionHandle.cpp @@ -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 diff --git a/src/singletons/CrashHandler.cpp b/src/singletons/CrashHandler.cpp index 02592743..7f03e23b 100644 --- a/src/singletons/CrashHandler.cpp +++ b/src/singletons/CrashHandler.cpp @@ -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; diff --git a/src/singletons/Settings.cpp b/src/singletons/Settings.cpp index f68e6e39..3216217e 100644 --- a/src/singletons/Settings.cpp +++ b/src/singletons/Settings.cpp @@ -117,12 +117,12 @@ void Settings::mute(const QString &channelName) void Settings::unmute(const QString &channelName) { - for (std::vector::size_type i = 0; i != mutedChannels.raw().size(); - i++) + for (std::vector::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 diff --git a/src/singletons/Toasts.cpp b/src/singletons/Toasts.cpp index f30d1461..df8463be 100644 --- a/src/singletons/Toasts.cpp +++ b/src/singletons/Toasts.cpp @@ -462,7 +462,7 @@ AvatarDownloader::AvatarDownloader(const QString &avatarURL, { this->file_.close(); } - downloadComplete(); + this->downloadComplete(); this->deleteLater(); }); } diff --git a/src/singletons/Updates.cpp b/src/singletons/Updates.cpp index b2e4429b..541ee309 100644 --- a/src/singletons/Updates.cpp +++ b/src/singletons/Updates.cpp @@ -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() diff --git a/src/singletons/WindowManager.cpp b/src/singletons/WindowManager.cpp index a550f288..6c9fc25e 100644 --- a/src/singletons/WindowManager.cpp +++ b/src/singletons/WindowManager.cpp @@ -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); } diff --git a/src/singletons/helper/LoggingChannel.cpp b/src/singletons/helper/LoggingChannel.cpp index d2e26b83..3bda2147 100644 --- a/src/singletons/helper/LoggingChannel.cpp +++ b/src/singletons/helper/LoggingChannel.cpp @@ -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 + " "); } diff --git a/src/util/QByteArrayBuffer.hpp b/src/util/QByteArrayBuffer.hpp index b16ca1ef..4901618e 100644 --- a/src/util/QByteArrayBuffer.hpp +++ b/src/util/QByteArrayBuffer.hpp @@ -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; } diff --git a/src/util/RatelimitBucket.cpp b/src/util/RatelimitBucket.cpp index 75bf8e34..1d59f6c8 100644 --- a/src/util/RatelimitBucket.cpp +++ b/src/util/RatelimitBucket.cpp @@ -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(); }); diff --git a/src/util/XDGDesktopFile.hpp b/src/util/XDGDesktopFile.hpp index d61705c8..8d6a1731 100644 --- a/src/util/XDGDesktopFile.hpp +++ b/src/util/XDGDesktopFile.hpp @@ -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 diff --git a/src/widgets/BaseWindow.cpp b/src/widgets/BaseWindow.cpp index 70592712..98077a0a 100644 --- a/src/widgets/BaseWindow.cpp +++ b/src/widgets/BaseWindow.cpp @@ -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(); } diff --git a/src/widgets/DraggablePopup.cpp b/src/widgets/DraggablePopup.cpp index 1dc649aa..5220a654 100644 --- a/src/widgets/DraggablePopup.cpp +++ b/src/widgets/DraggablePopup.cpp @@ -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"); diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index 66a065ef..0edcf6d9 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -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); } } diff --git a/src/widgets/Notebook.hpp b/src/widgets/Notebook.hpp index c4dd96e3..01e158ba 100644 --- a/src/widgets/Notebook.hpp +++ b/src/widgets/Notebook.hpp @@ -152,7 +152,7 @@ protected: const QList items() { - return items_; + return this->items_; } /** diff --git a/src/widgets/Window.cpp b/src/widgets/Window.cpp index 82c31b3c..f10e4fad 100644 --- a/src/widgets/Window.cpp +++ b/src/widgets/Window.cpp @@ -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_ = diff --git a/src/widgets/buttons/Button.cpp b/src/widgets/buttons/Button.cpp index 83ce2177..09778545 100644 --- a/src/widgets/buttons/Button.cpp +++ b/src/widgets/buttons/Button.cpp @@ -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(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); } } diff --git a/src/widgets/buttons/DrawnButton.cpp b/src/widgets/buttons/DrawnButton.cpp index afa2da5e..e7bbbad7 100644 --- a/src/widgets/buttons/DrawnButton.cpp +++ b/src/widgets/buttons/DrawnButton.cpp @@ -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); diff --git a/src/widgets/buttons/SignalLabel.cpp b/src/widgets/buttons/SignalLabel.cpp index 9b69daa6..6ff9c107 100644 --- a/src/widgets/buttons/SignalLabel.cpp +++ b/src/widgets/buttons/SignalLabel.cpp @@ -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(); diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index 54c8ff66..43231d38 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -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 diff --git a/src/widgets/helper/ChannelView.cpp b/src/widgets/helper/ChannelView.cpp index 4e4879d1..5bfee826 100644 --- a/src/widgets/helper/ChannelView.cpp +++ b/src/widgets/helper/ChannelView.cpp @@ -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; } diff --git a/src/widgets/helper/EditableModelView.cpp b/src/widgets/helper/EditableModelView.cpp index e40a7d2d..2acb0d9f 100644 --- a/src/widgets/helper/EditableModelView.cpp +++ b/src/widgets/helper/EditableModelView.cpp @@ -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(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); } diff --git a/src/widgets/helper/NotebookTab.cpp b/src/widgets/helper/NotebookTab.cpp index 314d179f..c1b092ad 100644 --- a/src/widgets/helper/NotebookTab.cpp +++ b/src/widgets/helper/NotebookTab.cpp @@ -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(); diff --git a/src/widgets/helper/ResizingTextEdit.cpp b/src/widgets/helper/ResizingTextEdit.cpp index b9148217..0e69b943 100644 --- a/src/widgets/helper/ResizingTextEdit.cpp +++ b/src/widgets/helper/ResizingTextEdit.cpp @@ -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( &QCompleter::highlighted), this, &ResizingTextEdit::insertCompletion); diff --git a/src/widgets/helper/SettingsDialogTab.cpp b/src/widgets/helper/SettingsDialogTab.cpp index de962cec..975a4db4 100644 --- a/src/widgets/helper/SettingsDialogTab.cpp +++ b/src/widgets/helper/SettingsDialogTab.cpp @@ -36,7 +36,7 @@ void SettingsDialogTab::setSelected(bool _selected) // height: 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 diff --git a/src/widgets/layout/FlowLayout.cpp b/src/widgets/layout/FlowLayout.cpp index d815f623..12a2bad2 100644 --- a/src/widgets/layout/FlowLayout.cpp +++ b/src/widgets/layout/FlowLayout.cpp @@ -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; diff --git a/src/widgets/settingspages/ExternalToolsPage.cpp b/src/widgets/settingspages/ExternalToolsPage.cpp index 62b66096..1cb9ff83 100644 --- a/src/widgets/settingspages/ExternalToolsPage.cpp +++ b/src/widgets/settingspages/ExternalToolsPage.cpp @@ -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) diff --git a/src/widgets/settingspages/KeyboardSettingsPage.cpp b/src/widgets/settingspages/KeyboardSettingsPage.cpp index c6981ec0..9d0749f9 100644 --- a/src/widgets/settingspages/KeyboardSettingsPage.cpp +++ b/src/widgets/settingspages/KeyboardSettingsPage.cpp @@ -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); }); diff --git a/src/widgets/settingspages/SettingWidget.cpp b/src/widgets/settingspages/SettingWidget.cpp index 1c9c04f8..6e2385e7 100644 --- a/src/widgets/settingspages/SettingWidget.cpp +++ b/src/widgets/settingspages/SettingWidget.cpp @@ -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); } diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index 8aebd9bc..ca45759e 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -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(); diff --git a/src/widgets/splits/SplitContainer.cpp b/src/widgets/splits/SplitContainer.cpp index aa218296..ae900b86 100644 --- a/src/widgets/splits/SplitContainer.cpp +++ b/src/widgets/splits/SplitContainer.cpp @@ -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; }); diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index a9e16c74..9e7310a6 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -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) diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index 5de2b47a..d4d05f8b 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -374,7 +374,7 @@ QString SplitInput::handleSendMessage(const std::vector &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())