refactor: Use override instead of virtual where possible (#4917)

This commit is contained in:
pajlada
2023-10-25 18:13:48 +02:00
committed by GitHub
parent da31e47f9a
commit 5c0219c245
54 changed files with 193 additions and 203 deletions
@@ -18,7 +18,7 @@ using EmotePtr = std::shared_ptr<const Emote>;
class ChatterinoBadges : public Singleton
{
public:
virtual void initialize(Settings &settings, Paths &paths) override;
void initialize(Settings &settings, Paths &paths) override;
ChatterinoBadges();
std::optional<EmotePtr> getBadge(const UserId &id);
+1 -1
View File
@@ -21,7 +21,7 @@ using EmotePtr = std::shared_ptr<const Emote>;
class FfzBadges : public Singleton
{
public:
virtual void initialize(Settings &settings, Paths &paths) override;
void initialize(Settings &settings, Paths &paths) override;
FfzBadges() = default;
struct Badge {
+1 -1
View File
@@ -22,7 +22,7 @@ class AbstractIrcServer : public QObject
public:
enum ConnectionType { Read = 1, Write = 2, Both = 3 };
virtual ~AbstractIrcServer() = default;
~AbstractIrcServer() override = default;
// initializeIrc must be called from the derived class
// this allows us to initialize the abstract IRC server based on the derived class's parameters
+4 -2
View File
@@ -18,6 +18,7 @@
namespace chatterino {
namespace {
QString configPath()
{
return combinePath(getPaths()->settingsDirectory, "irc.json");
@@ -33,7 +34,7 @@ namespace {
// turn a vector item into a model row
IrcServerData getItemFromRow(std::vector<QStandardItem *> &row,
const IrcServerData &original)
const IrcServerData &original) override
{
return IrcServerData{
row[0]->data(Qt::EditRole).toString(), // host
@@ -50,7 +51,7 @@ namespace {
// turns a row in the model into a vector item
void getRowFromItem(const IrcServerData &item,
std::vector<QStandardItem *> &row)
std::vector<QStandardItem *> &row) override
{
setStringItem(row[0], item.host, false);
setStringItem(row[1], QString::number(item.port));
@@ -60,6 +61,7 @@ namespace {
setStringItem(row[5], item.real);
}
};
} // namespace
inline QString escape(QString str)
+3 -3
View File
@@ -8,7 +8,7 @@ namespace chatterino {
class Irc;
class IrcServer;
class IrcChannel : public Channel, public ChannelChatters
class IrcChannel final : public Channel, public ChannelChatters
{
public:
explicit IrcChannel(const QString &name, IrcServer *server);
@@ -19,8 +19,8 @@ public:
IrcServer *server();
// Channel methods
virtual bool canReconnect() const override;
virtual void reconnect() override;
bool canReconnect() const override;
void reconnect() override;
private:
void setServer(IrcServer *server);
+1 -1
View File
@@ -52,7 +52,7 @@ public:
TwitchAccount(const QString &username, const QString &oauthToken_,
const QString &oauthClient_, const QString &_userID);
virtual QString toString() const override;
QString toString() const override;
const QString &getUserName() const;
const QString &getOAuthToken() const;
+14 -14
View File
@@ -67,7 +67,7 @@ struct HelixStream;
class TwitchIrcServer;
class TwitchChannel : public Channel, public ChannelChatters
class TwitchChannel final : public Channel, public ChannelChatters
{
public:
struct StreamStatus {
@@ -109,17 +109,17 @@ public:
void initialize();
// Channel methods
virtual bool isEmpty() const override;
virtual bool canSendMessage() const override;
virtual void sendMessage(const QString &message) override;
virtual void sendReply(const QString &message, const QString &replyId);
virtual bool isMod() const override;
bool isEmpty() const override;
bool canSendMessage() const override;
void sendMessage(const QString &message) override;
void sendReply(const QString &message, const QString &replyId);
bool isMod() const override;
bool isVip() const;
bool isStaff() const;
virtual bool isBroadcaster() const override;
virtual bool hasHighRateLimit() const override;
virtual bool canReconnect() const override;
virtual void reconnect() override;
bool isBroadcaster() const override;
bool hasHighRateLimit() const override;
bool canReconnect() const override;
void reconnect() override;
void createClip();
// Data
@@ -127,7 +127,7 @@ public:
const QString &channelUrl();
const QString &popoutPlayerUrl();
int chatterCount();
virtual bool isLive() const override;
bool isLive() const override;
QString roomId() const;
SharedAccessGuard<const RoomModes> accessRoomModes() const;
SharedAccessGuard<const StreamStatus> accessStreamStatus() const;
@@ -140,9 +140,9 @@ public:
std::shared_ptr<const EmoteMap> ffzEmotes() const;
std::shared_ptr<const EmoteMap> seventvEmotes() const;
virtual void refreshBTTVChannelEmotes(bool manualRefresh);
virtual void refreshFFZChannelEmotes(bool manualRefresh);
virtual void refreshSevenTVChannelEmotes(bool manualRefresh);
void refreshBTTVChannelEmotes(bool manualRefresh);
void refreshFFZChannelEmotes(bool manualRefresh);
void refreshSevenTVChannelEmotes(bool manualRefresh);
const QString &seventvUserID() const;
const QString &seventvEmoteSetID() const;
+11 -15
View File
@@ -42,9 +42,9 @@ class TwitchIrcServer final : public AbstractIrcServer,
{
public:
TwitchIrcServer();
virtual ~TwitchIrcServer() override = default;
~TwitchIrcServer() override = default;
virtual void initialize(Settings &settings, Paths &paths) override;
void initialize(Settings &settings, Paths &paths) override;
void forEachChannelAndSpecialChannels(std::function<void(ChannelPtr)> func);
@@ -89,23 +89,19 @@ public:
const IndirectChannel &getWatchingChannel() const override;
protected:
virtual void initializeConnection(IrcConnection *connection,
ConnectionType type) override;
virtual std::shared_ptr<Channel> createChannel(
const QString &channelName) override;
void initializeConnection(IrcConnection *connection,
ConnectionType type) override;
std::shared_ptr<Channel> createChannel(const QString &channelName) override;
virtual void privateMessageReceived(
Communi::IrcPrivateMessage *message) override;
virtual void readConnectionMessageReceived(
Communi::IrcMessage *message) override;
virtual void writeConnectionMessageReceived(
Communi::IrcMessage *message) override;
void privateMessageReceived(Communi::IrcPrivateMessage *message) override;
void readConnectionMessageReceived(Communi::IrcMessage *message) override;
void writeConnectionMessageReceived(Communi::IrcMessage *message) override;
virtual std::shared_ptr<Channel> getCustomChannel(
std::shared_ptr<Channel> getCustomChannel(
const QString &channelname) override;
virtual QString cleanChannelName(const QString &dirtyChannelName) override;
virtual bool hasSeparateWriteConnection() const override;
QString cleanChannelName(const QString &dirtyChannelName) override;
bool hasSeparateWriteConnection() const override;
private:
void onMessageSendRequested(TwitchChannel *channel, const QString &message,