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
+1 -1
View File
@@ -101,7 +101,7 @@ public:
return this; return this;
} }
virtual ~SignalVectorModel() ~SignalVectorModel() override
{ {
for (Row &row : this->rows_) for (Row &row : this->rows_)
{ {
@@ -21,7 +21,7 @@ public:
AccountModel *createModel(QObject *parent); AccountModel *createModel(QObject *parent);
virtual void initialize(Settings &settings, Paths &paths) override; void initialize(Settings &settings, Paths &paths) override;
TwitchAccountManager twitch; TwitchAccountManager twitch;
+8 -9
View File
@@ -17,21 +17,20 @@ public:
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual std::shared_ptr<Account> getItemFromRow( std::shared_ptr<Account> getItemFromRow(
std::vector<QStandardItem *> &row, std::vector<QStandardItem *> &row,
const std::shared_ptr<Account> &original) override; const std::shared_ptr<Account> &original) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const std::shared_ptr<Account> &item, void getRowFromItem(const std::shared_ptr<Account> &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
virtual int beforeInsert(const std::shared_ptr<Account> &item, int beforeInsert(const std::shared_ptr<Account> &item,
std::vector<QStandardItem *> &row, std::vector<QStandardItem *> &row,
int proposedIndex) override; int proposedIndex) override;
virtual void afterRemoved(const std::shared_ptr<Account> &item, void afterRemoved(const std::shared_ptr<Account> &item,
std::vector<QStandardItem *> &row, std::vector<QStandardItem *> &row, int index) override;
int index) override;
friend class AccountController; friend class AccountController;
@@ -33,8 +33,8 @@ public:
bool dryRun); bool dryRun);
QStringList getDefaultChatterinoCommandList(); QStringList getDefaultChatterinoCommandList();
virtual void initialize(Settings &, Paths &paths) override; void initialize(Settings &, Paths &paths) override;
virtual void save() override; void save() override;
CommandModel *createModel(QObject *parent); CommandModel *createModel(QObject *parent);
+4 -4
View File
@@ -22,12 +22,12 @@ class CommandModel : public SignalVectorModel<Command>
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual Command getItemFromRow(std::vector<QStandardItem *> &row, Command getItemFromRow(std::vector<QStandardItem *> &row,
const Command &command) override; const Command &command) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const Command &item, void getRowFromItem(const Command &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
friend class CommandController; friend class CommandController;
}; };
+4 -5
View File
@@ -16,13 +16,12 @@ public:
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual FilterRecordPtr getItemFromRow( FilterRecordPtr getItemFromRow(std::vector<QStandardItem *> &row,
std::vector<QStandardItem *> &row, const FilterRecordPtr &original) override;
const FilterRecordPtr &original) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const FilterRecordPtr &item, void getRowFromItem(const FilterRecordPtr &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
}; };
} // namespace chatterino } // namespace chatterino
@@ -25,12 +25,11 @@ public:
protected: protected:
// vector into model row // vector into model row
virtual HighlightBadge getItemFromRow( HighlightBadge getItemFromRow(std::vector<QStandardItem *> &row,
std::vector<QStandardItem *> &row, const HighlightBadge &original) override;
const HighlightBadge &original) override;
virtual void getRowFromItem(const HighlightBadge &item, void getRowFromItem(const HighlightBadge &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
}; };
} // namespace chatterino } // namespace chatterino
@@ -21,13 +21,13 @@ public:
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual HighlightBlacklistUser getItemFromRow( HighlightBlacklistUser getItemFromRow(
std::vector<QStandardItem *> &row, std::vector<QStandardItem *> &row,
const HighlightBlacklistUser &original) override; const HighlightBlacklistUser &original) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const HighlightBlacklistUser &item, void getRowFromItem(const HighlightBlacklistUser &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
}; };
} // namespace chatterino } // namespace chatterino
@@ -42,19 +42,18 @@ public:
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual HighlightPhrase getItemFromRow( HighlightPhrase getItemFromRow(std::vector<QStandardItem *> &row,
std::vector<QStandardItem *> &row, const HighlightPhrase &original) override;
const HighlightPhrase &original) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const HighlightPhrase &item, void getRowFromItem(const HighlightPhrase &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
virtual void afterInit() override; void afterInit() override;
virtual void customRowSetData(const std::vector<QStandardItem *> &row, void customRowSetData(const std::vector<QStandardItem *> &row, int column,
int column, const QVariant &value, int role, const QVariant &value, int role,
int rowIndex) override; int rowIndex) override;
}; };
} // namespace chatterino } // namespace chatterino
@@ -16,18 +16,17 @@ public:
protected: protected:
// vector into model row // vector into model row
virtual HighlightPhrase getItemFromRow( HighlightPhrase getItemFromRow(std::vector<QStandardItem *> &row,
std::vector<QStandardItem *> &row, const HighlightPhrase &original) override;
const HighlightPhrase &original) override;
virtual void getRowFromItem(const HighlightPhrase &item, void getRowFromItem(const HighlightPhrase &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
virtual void afterInit() override; void afterInit() override;
virtual void customRowSetData(const std::vector<QStandardItem *> &row, void customRowSetData(const std::vector<QStandardItem *> &row, int column,
int column, const QVariant &value, int role, const QVariant &value, int role,
int rowIndex) override; int rowIndex) override;
}; };
} // namespace chatterino } // namespace chatterino
+8 -9
View File
@@ -17,21 +17,20 @@ public:
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual std::shared_ptr<Hotkey> getItemFromRow( std::shared_ptr<Hotkey> getItemFromRow(
std::vector<QStandardItem *> &row, std::vector<QStandardItem *> &row,
const std::shared_ptr<Hotkey> &original) override; const std::shared_ptr<Hotkey> &original) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const std::shared_ptr<Hotkey> &item, void getRowFromItem(const std::shared_ptr<Hotkey> &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
virtual int beforeInsert(const std::shared_ptr<Hotkey> &item, int beforeInsert(const std::shared_ptr<Hotkey> &item,
std::vector<QStandardItem *> &row, std::vector<QStandardItem *> &row,
int proposedIndex) override; int proposedIndex) override;
virtual void afterRemoved(const std::shared_ptr<Hotkey> &item, void afterRemoved(const std::shared_ptr<Hotkey> &item,
std::vector<QStandardItem *> &row, std::vector<QStandardItem *> &row, int index) override;
int index) override;
friend class HotkeyController; friend class HotkeyController;
+4 -4
View File
@@ -15,12 +15,12 @@ public:
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual IgnorePhrase getItemFromRow(std::vector<QStandardItem *> &row, IgnorePhrase getItemFromRow(std::vector<QStandardItem *> &row,
const IgnorePhrase &original) override; const IgnorePhrase &original) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const IgnorePhrase &item, void getRowFromItem(const IgnorePhrase &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
}; };
} // namespace chatterino } // namespace chatterino
@@ -15,13 +15,12 @@ public:
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual ModerationAction getItemFromRow( ModerationAction getItemFromRow(std::vector<QStandardItem *> &row,
std::vector<QStandardItem *> &row, const ModerationAction &original) override;
const ModerationAction &original) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const ModerationAction &item, void getRowFromItem(const ModerationAction &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
friend class HighlightController; friend class HighlightController;
}; };
@@ -20,7 +20,7 @@ enum class Platform : uint8_t {
class NotificationController final : public Singleton, private QObject class NotificationController final : public Singleton, private QObject
{ {
public: public:
virtual void initialize(Settings &settings, Paths &paths) override; void initialize(Settings &settings, Paths &paths) override;
bool isChannelNotified(const QString &channelName, Platform p); bool isChannelNotified(const QString &channelName, Platform p);
void updateChannelNotification(const QString &channelName, Platform p); void updateChannelNotification(const QString &channelName, Platform p);
@@ -14,12 +14,12 @@ class NotificationModel : public SignalVectorModel<QString>
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual QString getItemFromRow(std::vector<QStandardItem *> &row, QString getItemFromRow(std::vector<QStandardItem *> &row,
const QString &original) override; const QString &original) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const QString &item, void getRowFromItem(const QString &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
friend class NotificationController; friend class NotificationController;
}; };
+4 -4
View File
@@ -12,12 +12,12 @@ class MutedChannelModel : public SignalVectorModel<QString>
protected: protected:
// turn a vector item into a model row // turn a vector item into a model row
virtual QString getItemFromRow(std::vector<QStandardItem *> &row, QString getItemFromRow(std::vector<QStandardItem *> &row,
const QString &original) override; const QString &original) override;
// turns a row in the model into a vector item // turns a row in the model into a vector item
virtual void getRowFromItem(const QString &item, void getRowFromItem(const QString &item,
std::vector<QStandardItem *> &row) override; std::vector<QStandardItem *> &row) override;
}; };
} // namespace chatterino } // namespace chatterino
@@ -18,7 +18,7 @@ using EmotePtr = std::shared_ptr<const Emote>;
class ChatterinoBadges : public Singleton class ChatterinoBadges : public Singleton
{ {
public: public:
virtual void initialize(Settings &settings, Paths &paths) override; void initialize(Settings &settings, Paths &paths) override;
ChatterinoBadges(); ChatterinoBadges();
std::optional<EmotePtr> getBadge(const UserId &id); 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 class FfzBadges : public Singleton
{ {
public: public:
virtual void initialize(Settings &settings, Paths &paths) override; void initialize(Settings &settings, Paths &paths) override;
FfzBadges() = default; FfzBadges() = default;
struct Badge { struct Badge {
+1 -1
View File
@@ -22,7 +22,7 @@ class AbstractIrcServer : public QObject
public: public:
enum ConnectionType { Read = 1, Write = 2, Both = 3 }; enum ConnectionType { Read = 1, Write = 2, Both = 3 };
virtual ~AbstractIrcServer() = default; ~AbstractIrcServer() override = default;
// initializeIrc must be called from the derived class // initializeIrc must be called from the derived class
// this allows us to initialize the abstract IRC server based on the derived class's parameters // 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 chatterino {
namespace { namespace {
QString configPath() QString configPath()
{ {
return combinePath(getPaths()->settingsDirectory, "irc.json"); return combinePath(getPaths()->settingsDirectory, "irc.json");
@@ -33,7 +34,7 @@ namespace {
// turn a vector item into a model row // turn a vector item into a model row
IrcServerData getItemFromRow(std::vector<QStandardItem *> &row, IrcServerData getItemFromRow(std::vector<QStandardItem *> &row,
const IrcServerData &original) const IrcServerData &original) override
{ {
return IrcServerData{ return IrcServerData{
row[0]->data(Qt::EditRole).toString(), // host row[0]->data(Qt::EditRole).toString(), // host
@@ -50,7 +51,7 @@ namespace {
// turns a row in the model into a vector item // turns a row in the model into a vector item
void getRowFromItem(const IrcServerData &item, void getRowFromItem(const IrcServerData &item,
std::vector<QStandardItem *> &row) std::vector<QStandardItem *> &row) override
{ {
setStringItem(row[0], item.host, false); setStringItem(row[0], item.host, false);
setStringItem(row[1], QString::number(item.port)); setStringItem(row[1], QString::number(item.port));
@@ -60,6 +61,7 @@ namespace {
setStringItem(row[5], item.real); setStringItem(row[5], item.real);
} }
}; };
} // namespace } // namespace
inline QString escape(QString str) inline QString escape(QString str)
+3 -3
View File
@@ -8,7 +8,7 @@ namespace chatterino {
class Irc; class Irc;
class IrcServer; class IrcServer;
class IrcChannel : public Channel, public ChannelChatters class IrcChannel final : public Channel, public ChannelChatters
{ {
public: public:
explicit IrcChannel(const QString &name, IrcServer *server); explicit IrcChannel(const QString &name, IrcServer *server);
@@ -19,8 +19,8 @@ public:
IrcServer *server(); IrcServer *server();
// Channel methods // Channel methods
virtual bool canReconnect() const override; bool canReconnect() const override;
virtual void reconnect() override; void reconnect() override;
private: private:
void setServer(IrcServer *server); void setServer(IrcServer *server);
+1 -1
View File
@@ -52,7 +52,7 @@ public:
TwitchAccount(const QString &username, const QString &oauthToken_, TwitchAccount(const QString &username, const QString &oauthToken_,
const QString &oauthClient_, const QString &_userID); const QString &oauthClient_, const QString &_userID);
virtual QString toString() const override; QString toString() const override;
const QString &getUserName() const; const QString &getUserName() const;
const QString &getOAuthToken() const; const QString &getOAuthToken() const;
+14 -14
View File
@@ -67,7 +67,7 @@ struct HelixStream;
class TwitchIrcServer; class TwitchIrcServer;
class TwitchChannel : public Channel, public ChannelChatters class TwitchChannel final : public Channel, public ChannelChatters
{ {
public: public:
struct StreamStatus { struct StreamStatus {
@@ -109,17 +109,17 @@ public:
void initialize(); void initialize();
// Channel methods // Channel methods
virtual bool isEmpty() const override; bool isEmpty() const override;
virtual bool canSendMessage() const override; bool canSendMessage() const override;
virtual void sendMessage(const QString &message) override; void sendMessage(const QString &message) override;
virtual void sendReply(const QString &message, const QString &replyId); void sendReply(const QString &message, const QString &replyId);
virtual bool isMod() const override; bool isMod() const override;
bool isVip() const; bool isVip() const;
bool isStaff() const; bool isStaff() const;
virtual bool isBroadcaster() const override; bool isBroadcaster() const override;
virtual bool hasHighRateLimit() const override; bool hasHighRateLimit() const override;
virtual bool canReconnect() const override; bool canReconnect() const override;
virtual void reconnect() override; void reconnect() override;
void createClip(); void createClip();
// Data // Data
@@ -127,7 +127,7 @@ public:
const QString &channelUrl(); const QString &channelUrl();
const QString &popoutPlayerUrl(); const QString &popoutPlayerUrl();
int chatterCount(); int chatterCount();
virtual bool isLive() const override; bool isLive() const override;
QString roomId() const; QString roomId() const;
SharedAccessGuard<const RoomModes> accessRoomModes() const; SharedAccessGuard<const RoomModes> accessRoomModes() const;
SharedAccessGuard<const StreamStatus> accessStreamStatus() const; SharedAccessGuard<const StreamStatus> accessStreamStatus() const;
@@ -140,9 +140,9 @@ public:
std::shared_ptr<const EmoteMap> ffzEmotes() const; std::shared_ptr<const EmoteMap> ffzEmotes() const;
std::shared_ptr<const EmoteMap> seventvEmotes() const; std::shared_ptr<const EmoteMap> seventvEmotes() const;
virtual void refreshBTTVChannelEmotes(bool manualRefresh); void refreshBTTVChannelEmotes(bool manualRefresh);
virtual void refreshFFZChannelEmotes(bool manualRefresh); void refreshFFZChannelEmotes(bool manualRefresh);
virtual void refreshSevenTVChannelEmotes(bool manualRefresh); void refreshSevenTVChannelEmotes(bool manualRefresh);
const QString &seventvUserID() const; const QString &seventvUserID() const;
const QString &seventvEmoteSetID() const; const QString &seventvEmoteSetID() const;
+11 -15
View File
@@ -42,9 +42,9 @@ class TwitchIrcServer final : public AbstractIrcServer,
{ {
public: public:
TwitchIrcServer(); 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); void forEachChannelAndSpecialChannels(std::function<void(ChannelPtr)> func);
@@ -89,23 +89,19 @@ public:
const IndirectChannel &getWatchingChannel() const override; const IndirectChannel &getWatchingChannel() const override;
protected: protected:
virtual void initializeConnection(IrcConnection *connection, void initializeConnection(IrcConnection *connection,
ConnectionType type) override; ConnectionType type) override;
virtual std::shared_ptr<Channel> createChannel( std::shared_ptr<Channel> createChannel(const QString &channelName) override;
const QString &channelName) override;
virtual void privateMessageReceived( void privateMessageReceived(Communi::IrcPrivateMessage *message) override;
Communi::IrcPrivateMessage *message) override; void readConnectionMessageReceived(Communi::IrcMessage *message) override;
virtual void readConnectionMessageReceived( void writeConnectionMessageReceived(Communi::IrcMessage *message) override;
Communi::IrcMessage *message) override;
virtual void writeConnectionMessageReceived(
Communi::IrcMessage *message) override;
virtual std::shared_ptr<Channel> getCustomChannel( std::shared_ptr<Channel> getCustomChannel(
const QString &channelname) override; const QString &channelname) override;
virtual QString cleanChannelName(const QString &dirtyChannelName) override; QString cleanChannelName(const QString &dirtyChannelName) override;
virtual bool hasSeparateWriteConnection() const override; bool hasSeparateWriteConnection() const override;
private: private:
void onMessageSendRequested(TwitchChannel *channel, const QString &message, void onMessageSendRequested(TwitchChannel *channel, const QString &message,
+1 -1
View File
@@ -25,7 +25,7 @@ class Emotes final : public IEmotes, public Singleton
public: public:
Emotes(); Emotes();
virtual void initialize(Settings &settings, Paths &paths) override; void initialize(Settings &settings, Paths &paths) override;
bool isIgnoredEmote(const QString &emote); bool isIgnoredEmote(const QString &emote);
+1 -1
View File
@@ -43,7 +43,7 @@ class Fonts final : public Singleton
public: public:
Fonts(); Fonts();
virtual void initialize(Settings &settings, Paths &paths) override; void initialize(Settings &settings, Paths &paths) override;
// font data gets set in createFontData(...) // font data gets set in createFontData(...)
+1 -1
View File
@@ -24,7 +24,7 @@ class Logging : public Singleton
public: public:
Logging() = default; Logging() = default;
virtual void initialize(Settings &settings, Paths &paths) override; void initialize(Settings &settings, Paths &paths) override;
void addMessage(const QString &channelName, MessagePtr message, void addMessage(const QString &channelName, MessagePtr message,
const QString &platformName); const QString &platformName);
+2 -2
View File
@@ -93,8 +93,8 @@ public:
QPoint emotePopupPos(); QPoint emotePopupPos();
void setEmotePopupPos(QPoint pos); void setEmotePopupPos(QPoint pos);
virtual void initialize(Settings &settings, Paths &paths) override; void initialize(Settings &settings, Paths &paths) override;
virtual void save() override; void save() override;
void closeAll(); void closeAll();
int getGeneration() const; int getGeneration() const;
+2 -2
View File
@@ -17,11 +17,11 @@ class LambdaRunnable : public QRunnable
{ {
public: public:
LambdaRunnable(std::function<void()> action) LambdaRunnable(std::function<void()> action)
: action_(std::move(action))
{ {
this->action_ = std::move(action);
} }
void run() void run() override
{ {
this->action_(); this->action_();
} }
+2 -2
View File
@@ -28,7 +28,7 @@ public:
bool fullscreen = false; bool fullscreen = false;
}; };
virtual ~AttachedWindow() override; ~AttachedWindow() override;
static AttachedWindow *get(void *target_, const GetArgs &args); static AttachedWindow *get(void *target_, const GetArgs &args);
#ifdef USEWINSDK #ifdef USEWINSDK
@@ -39,7 +39,7 @@ public:
void setChannel(ChannelPtr channel); void setChannel(ChannelPtr channel);
protected: protected:
virtual void showEvent(QShowEvent *) override; void showEvent(QShowEvent *) override;
// virtual void nativeEvent(const QByteArray &eventType, void *message, // virtual void nativeEvent(const QByteArray &eventType, void *message,
// long *result) override; // long *result) override;
+2 -2
View File
@@ -37,8 +37,8 @@ public:
float qtFontScale() const; float qtFontScale() const;
protected: protected:
virtual void childEvent(QChildEvent *) override; void childEvent(QChildEvent *) override;
virtual void showEvent(QShowEvent *) override; void showEvent(QShowEvent *) override;
virtual void scaleChangedEvent(float newScale); virtual void scaleChangedEvent(float newScale);
virtual void themeChangedEvent(); virtual void themeChangedEvent();
+11 -11
View File
@@ -72,20 +72,20 @@ protected:
bool nativeEvent(const QByteArray &eventType, void *message, bool nativeEvent(const QByteArray &eventType, void *message,
long *result) override; long *result) override;
#endif #endif
virtual void scaleChangedEvent(float) override; void scaleChangedEvent(float) override;
virtual void paintEvent(QPaintEvent *) override; void paintEvent(QPaintEvent *) override;
virtual void changeEvent(QEvent *) override; void changeEvent(QEvent *) override;
virtual void leaveEvent(QEvent *) override; void leaveEvent(QEvent *) override;
virtual void resizeEvent(QResizeEvent *) override; void resizeEvent(QResizeEvent *) override;
virtual void moveEvent(QMoveEvent *) override; void moveEvent(QMoveEvent *) override;
virtual void closeEvent(QCloseEvent *) override; void closeEvent(QCloseEvent *) override;
virtual void showEvent(QShowEvent *) override; void showEvent(QShowEvent *) override;
virtual void themeChangedEvent() override; void themeChangedEvent() override;
virtual bool event(QEvent *event) override; bool event(QEvent *event) override;
virtual void wheelEvent(QWheelEvent *event) override; void wheelEvent(QWheelEvent *event) override;
void mousePressEvent(QMouseEvent *event) override; void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override;
+4 -4
View File
@@ -28,11 +28,11 @@ public:
void setHasOffset(bool hasOffset); void setHasOffset(bool hasOffset);
protected: protected:
virtual void scaleChangedEvent(float scale_) override; void scaleChangedEvent(float scale_) override;
virtual void paintEvent(QPaintEvent *) override; void paintEvent(QPaintEvent *) override;
virtual QSize sizeHint() const override; QSize sizeHint() const override;
virtual QSize minimumSizeHint() const override; QSize minimumSizeHint() const override;
private: private:
void updateSize(); void updateSize();
+4 -4
View File
@@ -124,10 +124,10 @@ public:
void refresh(); void refresh();
protected: protected:
virtual void scaleChangedEvent(float scale_) override; void scaleChangedEvent(float scale_) override;
virtual void resizeEvent(QResizeEvent *) override; void resizeEvent(QResizeEvent *) override;
virtual void mousePressEvent(QMouseEvent *event) override; void mousePressEvent(QMouseEvent *event) override;
virtual void paintEvent(QPaintEvent *) override; void paintEvent(QPaintEvent *) override;
NotebookButton *getAddButton(); NotebookButton *getAddButton();
NotebookButton *addCustomButton(); NotebookButton *addCustomButton();
+1 -1
View File
@@ -37,7 +37,7 @@ public:
*/ */
ColorPickerDialog(const QColor &initial, QWidget *parent); ColorPickerDialog(const QColor &initial, QWidget *parent);
~ColorPickerDialog(); ~ColorPickerDialog() override;
/** /**
* @brief Return the final color selected by the user. * @brief Return the final color selected by the user.
+1 -1
View File
@@ -22,7 +22,7 @@ class IrcConnectionEditor : public QDialog
public: public:
explicit IrcConnectionEditor(const IrcServerData &data, bool isAdd = false, explicit IrcConnectionEditor(const IrcServerData &data, bool isAdd = false,
QWidget *parent = nullptr); QWidget *parent = nullptr);
~IrcConnectionEditor(); ~IrcConnectionEditor() override;
IrcServerData data(); IrcServerData data();
+3 -3
View File
@@ -27,8 +27,8 @@ public:
pajlada::Signals::NoArgSignal closed; pajlada::Signals::NoArgSignal closed;
protected: protected:
virtual void closeEvent(QCloseEvent *) override; void closeEvent(QCloseEvent *) override;
virtual void themeChangedEvent() override; void themeChangedEvent() override;
private: private:
class EventFilter : public QObject class EventFilter : public QObject
@@ -37,7 +37,7 @@ private:
SelectChannelDialog *dialog; SelectChannelDialog *dialog;
protected: protected:
virtual bool eventFilter(QObject *watched, QEvent *event) override; bool eventFilter(QObject *watched, QEvent *event) override;
}; };
struct { struct {
+3 -3
View File
@@ -42,9 +42,9 @@ public:
SettingsDialogPreference::NoPreference); SettingsDialogPreference::NoPreference);
protected: protected:
virtual void scaleChangedEvent(float newDpi) override; void scaleChangedEvent(float newDpi) override;
virtual void themeChangedEvent() override; void themeChangedEvent() override;
virtual void showEvent(QShowEvent *) override; void showEvent(QShowEvent *) override;
private: private:
void refresh(); void refresh();
+2 -2
View File
@@ -30,8 +30,8 @@ public:
const ChannelPtr &openingChannel); const ChannelPtr &openingChannel);
protected: protected:
virtual void themeChangedEvent() override; void themeChangedEvent() override;
virtual void scaleChangedEvent(float scale) override; void scaleChangedEvent(float scale) override;
private: private:
void installEvents(); void installEvents();
@@ -18,10 +18,10 @@ public:
/** /**
* @brief Open the channel passed in the constructor in a new popup. * @brief Open the channel passed in the constructor in a new popup.
*/ */
virtual void action() override; void action() override;
virtual void paint(QPainter *painter, const QRect &rect) const override; void paint(QPainter *painter, const QRect &rect) const override;
virtual QSize sizeHint(const QRect &rect) const override; QSize sizeHint(const QRect &rect) const override;
private: private:
static constexpr const char *TEXT_FORMAT = static constexpr const char *TEXT_FORMAT =
+3 -3
View File
@@ -20,10 +20,10 @@ public:
/** /**
* @brief Open the channel passed in the constructor in a new tab. * @brief Open the channel passed in the constructor in a new tab.
*/ */
virtual void action() override; void action() override;
virtual void paint(QPainter *painter, const QRect &rect) const override; void paint(QPainter *painter, const QRect &rect) const override;
virtual QSize sizeHint(const QRect &rect) const override; QSize sizeHint(const QRect &rect) const override;
private: private:
static constexpr const char *TEXT_FORMAT = "Open channel \"%1\" in new tab"; static constexpr const char *TEXT_FORMAT = "Open channel \"%1\" in new tab";
@@ -16,10 +16,10 @@ class SwitchSplitItem : public AbstractSwitcherItem
public: public:
SwitchSplitItem(SplitContainer *container, Split *split = nullptr); SwitchSplitItem(SplitContainer *container, Split *split = nullptr);
virtual void action() override; void action() override;
virtual void paint(QPainter *painter, const QRect &rect) const override; void paint(QPainter *painter, const QRect &rect) const override;
virtual QSize sizeHint(const QRect &rect) const override; QSize sizeHint(const QRect &rect) const override;
private: private:
SplitContainer *container_{}; SplitContainer *container_{};
+4 -4
View File
@@ -69,10 +69,10 @@ protected:
#else #else
void enterEvent(QEvent * /*event*/) override; void enterEvent(QEvent * /*event*/) override;
#endif #endif
virtual void leaveEvent(QEvent *) override; void leaveEvent(QEvent *) override;
virtual void mousePressEvent(QMouseEvent *event) override; void mousePressEvent(QMouseEvent *event) override;
virtual void mouseReleaseEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override;
void fancyPaint(QPainter &painter); void fancyPaint(QPainter &painter);
+7 -7
View File
@@ -12,14 +12,14 @@ class ComboBoxItemDelegate : public QStyledItemDelegate
public: public:
ComboBoxItemDelegate(QObject *parent = nullptr); ComboBoxItemDelegate(QObject *parent = nullptr);
~ComboBoxItemDelegate(); ~ComboBoxItemDelegate() override;
virtual QWidget *createEditor(QWidget *parent, QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QStyleOptionViewItem &option, const QModelIndex &index) const override;
const QModelIndex &index) const; void setEditorData(QWidget *editor,
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const; const QModelIndex &index) const override;
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const; const QModelIndex &index) const override;
}; };
} // namespace chatterino } // namespace chatterino
+1 -1
View File
@@ -23,7 +23,7 @@ public:
} }
} }
virtual void paintEvent(QPaintEvent *) void paintEvent(QPaintEvent *) override
{ {
QPainter painter(this); QPainter painter(this);
+8 -8
View File
@@ -21,15 +21,15 @@ public:
Icon getIcon() const; Icon getIcon() const;
protected: protected:
virtual void themeChangedEvent() override; void themeChangedEvent() override;
virtual void paintEvent(QPaintEvent *) override; void paintEvent(QPaintEvent *) override;
virtual void mouseReleaseEvent(QMouseEvent *) override; void mouseReleaseEvent(QMouseEvent *) override;
virtual void dragEnterEvent(QDragEnterEvent *) override; void dragEnterEvent(QDragEnterEvent *) override;
virtual void dragLeaveEvent(QDragLeaveEvent *) override; void dragLeaveEvent(QDragLeaveEvent *) override;
virtual void dropEvent(QDropEvent *) override; void dropEvent(QDropEvent *) override;
virtual void hideEvent(QHideEvent *) override; void hideEvent(QHideEvent *) override;
virtual void showEvent(QShowEvent *) override; void showEvent(QShowEvent *) override;
signals: signals:
void leftClicked(); void leftClicked();
+9 -9
View File
@@ -65,24 +65,24 @@ public:
int normalTabWidth(); int normalTabWidth();
protected: protected:
virtual void themeChangedEvent() override; void themeChangedEvent() override;
virtual void paintEvent(QPaintEvent *) override; void paintEvent(QPaintEvent *) override;
virtual void mousePressEvent(QMouseEvent *event) override; void mousePressEvent(QMouseEvent *event) override;
virtual void mouseReleaseEvent(QMouseEvent *event) override; void mouseReleaseEvent(QMouseEvent *event) override;
virtual void mouseDoubleClickEvent(QMouseEvent *event) override; void mouseDoubleClickEvent(QMouseEvent *event) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void enterEvent(QEnterEvent *event) override; void enterEvent(QEnterEvent *event) override;
#else #else
void enterEvent(QEvent *event) override; void enterEvent(QEvent *event) override;
#endif #endif
virtual void leaveEvent(QEvent *) override; void leaveEvent(QEvent *) override;
virtual void dragEnterEvent(QDragEnterEvent *event) override; void dragEnterEvent(QDragEnterEvent *event) override;
virtual void mouseMoveEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override;
virtual void wheelEvent(QWheelEvent *event) override; void wheelEvent(QWheelEvent *event) override;
private: private:
void showRenameDialog(); void showRenameDialog();
+2 -2
View File
@@ -56,7 +56,7 @@ class QColorPicker : public QFrame
Q_OBJECT Q_OBJECT
public: public:
QColorPicker(QWidget *parent); QColorPicker(QWidget *parent);
~QColorPicker(); ~QColorPicker() override;
void setCrossVisible(bool visible); void setCrossVisible(bool visible);
public slots: public slots:
@@ -91,7 +91,7 @@ class QColorLuminancePicker : public QWidget
Q_OBJECT Q_OBJECT
public: public:
QColorLuminancePicker(QWidget *parent = 0); QColorLuminancePicker(QWidget *parent = 0);
~QColorLuminancePicker(); ~QColorLuminancePicker() override;
public slots: public slots:
void setCol(int h, int s, int v); void setCol(int h, int s, int v);
+2 -2
View File
@@ -40,8 +40,8 @@ signals:
void selectedChanged(bool); void selectedChanged(bool);
private: private:
void paintEvent(QPaintEvent *); void paintEvent(QPaintEvent *) override;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) override;
struct { struct {
QString labelText; QString labelText;
+1 -1
View File
@@ -13,7 +13,7 @@ class SignalLabel : public QLabel
public: public:
explicit SignalLabel(QWidget *parent = nullptr, Qt::WindowFlags f = {}); explicit SignalLabel(QWidget *parent = nullptr, Qt::WindowFlags f = {});
virtual ~SignalLabel() override = default; ~SignalLabel() override = default;
signals: signals:
void mouseDoubleClick(QMouseEvent *ev); void mouseDoubleClick(QMouseEvent *ev);
+1 -1
View File
@@ -10,7 +10,7 @@ class SwitcherItemDelegate : public QStyledItemDelegate
public: public:
SwitcherItemDelegate(QObject *parent = nullptr); SwitcherItemDelegate(QObject *parent = nullptr);
~SwitcherItemDelegate(); ~SwitcherItemDelegate() override;
void paint(QPainter *painter, const QStyleOptionViewItem &option, void paint(QPainter *painter, const QStyleOptionViewItem &option,
const QModelIndex &index) const override; const QModelIndex &index) const override;
+1 -1
View File
@@ -16,7 +16,7 @@ class GenericListView : public QListView
public: public:
GenericListView(); GenericListView();
virtual void setModel(QAbstractItemModel *model) override; void setModel(QAbstractItemModel *model) override;
void setModel(GenericListModel *); void setModel(GenericListModel *);
void setInvokeActionOnTab(bool); void setInvokeActionOnTab(bool);
bool eventFilter(QObject *watched, QEvent *event) override; bool eventFilter(QObject *watched, QEvent *event) override;
+1 -1
View File
@@ -19,7 +19,7 @@ class GeneralPage : public SettingsPage
public: public:
GeneralPage(); GeneralPage();
bool filterElements(const QString &query); bool filterElements(const QString &query) override;
private: private:
void initLayout(GeneralPageView &layout); void initLayout(GeneralPageView &layout);
+3 -4
View File
@@ -19,10 +19,9 @@ public:
ActionCallback action); ActionCallback action);
// GenericListItem interface // GenericListItem interface
public: void action() override;
virtual void action() override; void paint(QPainter *painter, const QRect &rect) const override;
virtual void paint(QPainter *painter, const QRect &rect) const override; QSize sizeHint(const QRect &rect) const override;
virtual QSize sizeHint(const QRect &rect) const override;
private: private:
EmotePtr emote_; EmotePtr emote_;