add missing override and explicit specifiers in src/server (#5526)

This commit is contained in:
RickyRister 2025-01-25 06:05:25 -08:00 committed by GitHub
parent a41e7c75c1
commit b911ea6e28
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 58 additions and 56 deletions

View file

@ -100,14 +100,14 @@ public:
protected: protected:
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)) #if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
void enterEvent(QEnterEvent *event); void enterEvent(QEnterEvent *event) override;
#else #else
void enterEvent(QEvent *event); void enterEvent(QEvent *event) override;
#endif #endif
void leaveEvent(QEvent *event); void leaveEvent(QEvent *event) override;
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event) override;
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event) override;
signals: signals:
void openMessageDialog(const QString &userName, bool focus); void openMessageDialog(const QString &userName, bool focus);
void cardNameHovered(QString cardName); void cardNameHovered(QString cardName);

View file

@ -16,9 +16,9 @@ public:
const QString &_playerName, const QString &_playerName,
const QString &_clientId, const QString &_clientId,
QObject *parent = nullptr); QObject *parent = nullptr);
~LocalClient(); ~LocalClient() override;
void sendCommandContainer(const CommandContainer &cont); void sendCommandContainer(const CommandContainer &cont) override;
private slots: private slots:
void itemFromServer(const ServerMessage &item); void itemFromServer(const ServerMessage &item);
}; };

View file

@ -10,8 +10,8 @@ class LocalServer : public Server
{ {
Q_OBJECT Q_OBJECT
public: public:
LocalServer(QObject *parent = nullptr); explicit LocalServer(QObject *parent = nullptr);
~LocalServer(); ~LocalServer() override;
LocalServerInterface *newConnection(); LocalServerInterface *newConnection();
}; };
@ -23,27 +23,27 @@ private:
LocalServer *localServer; LocalServer *localServer;
protected: protected:
ServerInfo_User getUserData(const QString &name, bool withId = false); ServerInfo_User getUserData(const QString &name, bool withId = false) override;
public: public:
LocalServer_DatabaseInterface(LocalServer *_localServer); explicit LocalServer_DatabaseInterface(LocalServer *_localServer);
~LocalServer_DatabaseInterface() = default; ~LocalServer_DatabaseInterface() override = default;
AuthenticationResult checkUserPassword(Server_ProtocolHandler *handler, AuthenticationResult checkUserPassword(Server_ProtocolHandler *handler,
const QString &user, const QString &user,
const QString &password, const QString &password,
const QString &clientId, const QString &clientId,
QString &reasonStr, QString &reasonStr,
int &secondsLeft, int &secondsLeft,
bool passwordNeedsHash); bool passwordNeedsHash) override;
int getNextGameId() int getNextGameId() override
{ {
return localServer->getNextLocalGameId(); return localServer->getNextLocalGameId();
} }
int getNextReplayId() int getNextReplayId() override
{ {
return -1; return -1;
} }
int getActiveUserCount(QString /* connectionType */) int getActiveUserCount(QString /* connectionType */) override
{ {
return 0; return 0;
} }

View file

@ -10,17 +10,17 @@ class LocalServerInterface : public Server_ProtocolHandler
Q_OBJECT Q_OBJECT
public: public:
LocalServerInterface(LocalServer *_server, Server_DatabaseInterface *_databaseInterface); LocalServerInterface(LocalServer *_server, Server_DatabaseInterface *_databaseInterface);
~LocalServerInterface(); ~LocalServerInterface() override;
QString getAddress() const QString getAddress() const override
{ {
return QString(); return QString();
} }
QString getConnectionType() const QString getConnectionType() const override
{ {
return "local"; return "local";
}; };
void transmitProtocolItem(const ServerMessage &item); void transmitProtocolItem(const ServerMessage &item) override;
signals: signals:
void itemToClient(const ServerMessage &item); void itemToClient(const ServerMessage &item);
public slots: public slots:

View file

@ -18,7 +18,7 @@ private:
int ticks; int ticks;
public: public:
PendingCommand(const CommandContainer &_commandContainer, QVariant _extraData = QVariant()); explicit PendingCommand(const CommandContainer &_commandContainer, QVariant _extraData = QVariant());
CommandContainer &getCommandContainer(); CommandContainer &getCommandContainer();
void setExtraData(const QVariant &_extraData); void setExtraData(const QVariant &_extraData);
QVariant getExtraData() const; QVariant getExtraData() const;

View file

@ -23,10 +23,10 @@ public:
QString name; QString name;
public: public:
Node(const QString &_name, DirectoryNode *_parent = nullptr) : parent(_parent), name(_name) explicit Node(const QString &_name, DirectoryNode *_parent = nullptr) : parent(_parent), name(_name)
{ {
} }
virtual ~Node(){}; virtual ~Node() = default;
DirectoryNode *getParent() const DirectoryNode *getParent() const
{ {
return parent; return parent;
@ -39,8 +39,8 @@ public:
class DirectoryNode : public Node, public QList<Node *> class DirectoryNode : public Node, public QList<Node *>
{ {
public: public:
DirectoryNode(const QString &_name = QString(), DirectoryNode *_parent = nullptr); explicit DirectoryNode(const QString &_name = QString(), DirectoryNode *_parent = nullptr);
~DirectoryNode(); ~DirectoryNode() override;
void clearTree(); void clearTree();
QString getPath() const; QString getPath() const;
DirectoryNode *getNodeByPath(QStringList path); DirectoryNode *getNodeByPath(QStringList path);
@ -87,15 +87,15 @@ private slots:
void deckListFinished(const Response &r); void deckListFinished(const Response &r);
public: public:
RemoteDeckList_TreeModel(AbstractClient *_client, QObject *parent = nullptr); explicit RemoteDeckList_TreeModel(AbstractClient *_client, QObject *parent = nullptr);
~RemoteDeckList_TreeModel(); ~RemoteDeckList_TreeModel() override;
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const; int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &index) const; QModelIndex parent(const QModelIndex &index) const override;
Qt::ItemFlags flags(const QModelIndex &index) const; Qt::ItemFlags flags(const QModelIndex &index) const override;
DirectoryNode *getRoot() const DirectoryNode *getRoot() const
{ {
@ -116,7 +116,7 @@ private:
QSortFilterProxyModel *proxyModel; QSortFilterProxyModel *proxyModel;
public: public:
RemoteDeckList_TreeWidget(AbstractClient *_client, QWidget *parent = nullptr); explicit RemoteDeckList_TreeWidget(AbstractClient *_client, QWidget *parent = nullptr);
RemoteDeckList_TreeModel::Node *getNode(const QModelIndex &ind) const; RemoteDeckList_TreeModel::Node *getNode(const QModelIndex &ind) const;
RemoteDeckList_TreeModel::Node *getCurrentItem() const; RemoteDeckList_TreeModel::Node *getCurrentItem() const;
QList<RemoteDeckList_TreeModel::Node *> getCurrentSelection() const; QList<RemoteDeckList_TreeModel::Node *> getCurrentSelection() const;

View file

@ -24,10 +24,10 @@ private:
QString name; QString name;
public: public:
Node(const QString &_name) : name(_name) explicit Node(const QString &_name) : name(_name)
{ {
} }
virtual ~Node(){}; virtual ~Node() = default;
QString getName() const QString getName() const
{ {
return name; return name;
@ -39,8 +39,8 @@ private:
ServerInfo_ReplayMatch matchInfo; ServerInfo_ReplayMatch matchInfo;
public: public:
MatchNode(const ServerInfo_ReplayMatch &_matchInfo); explicit MatchNode(const ServerInfo_ReplayMatch &_matchInfo);
~MatchNode(); ~MatchNode() override;
void clearTree(); void clearTree();
const ServerInfo_ReplayMatch &getMatchInfo() const ServerInfo_ReplayMatch &getMatchInfo()
{ {
@ -82,18 +82,18 @@ private slots:
void replayListFinished(const Response &r); void replayListFinished(const Response &r);
public: public:
RemoteReplayList_TreeModel(AbstractClient *_client, QObject *parent = nullptr); explicit RemoteReplayList_TreeModel(AbstractClient *_client, QObject *parent = nullptr);
~RemoteReplayList_TreeModel(); ~RemoteReplayList_TreeModel() override;
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const override;
int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const int columnCount(const QModelIndex & /*parent*/ = QModelIndex()) const override
{ {
return numberOfColumns; return numberOfColumns;
} }
QVariant data(const QModelIndex &index, int role) const; QVariant data(const QModelIndex &index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex &index) const; QModelIndex parent(const QModelIndex &index) const override;
Qt::ItemFlags flags(const QModelIndex &index) const; Qt::ItemFlags flags(const QModelIndex &index) const override;
void clearTree(); void clearTree();
void refreshTree(); void refreshTree();
ServerInfo_Replay const *getReplay(const QModelIndex &index) const; ServerInfo_Replay const *getReplay(const QModelIndex &index) const;
@ -111,7 +111,7 @@ private:
QSortFilterProxyModel *proxyModel; QSortFilterProxyModel *proxyModel;
public: public:
RemoteReplayList_TreeWidget(AbstractClient *_client, QWidget *parent = nullptr); explicit RemoteReplayList_TreeWidget(AbstractClient *_client, QWidget *parent = nullptr);
ServerInfo_Replay const *getReplay(const QModelIndex &ind) const; ServerInfo_Replay const *getReplay(const QModelIndex &ind) const;
ServerInfo_ReplayMatch const *getReplayMatch(const QModelIndex &ind) const; ServerInfo_ReplayMatch const *getReplayMatch(const QModelIndex &ind) const;
QList<ServerInfo_Replay const *> getSelectedReplays() const; QList<ServerInfo_Replay const *> getSelectedReplays() const;

View file

@ -39,7 +39,7 @@ private slots:
void enableTemporaryEdits(bool enabled); void enableTemporaryEdits(bool enabled);
public: public:
BanDialog(const ServerInfo_User &info, QWidget *parent = nullptr); explicit BanDialog(const ServerInfo_User &info, QWidget *parent = nullptr);
QString getBanName() const; QString getBanName() const;
QString getBanIP() const; QString getBanIP() const;
QString getBanId() const; QString getBanId() const;
@ -90,9 +90,11 @@ public:
class UserListItemDelegate : public QStyledItemDelegate class UserListItemDelegate : public QStyledItemDelegate
{ {
public: public:
UserListItemDelegate(QObject *const parent); explicit UserListItemDelegate(QObject *const parent);
bool bool editorEvent(QEvent *event,
editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index); QAbstractItemModel *model,
const QStyleOptionViewItem &option,
const QModelIndex &index) override;
}; };
class UserListTWI : public QTreeWidgetItem class UserListTWI : public QTreeWidgetItem
@ -101,14 +103,14 @@ private:
ServerInfo_User userInfo; ServerInfo_User userInfo;
public: public:
UserListTWI(const ServerInfo_User &_userInfo); explicit UserListTWI(const ServerInfo_User &_userInfo);
const ServerInfo_User &getUserInfo() const const ServerInfo_User &getUserInfo() const
{ {
return userInfo; return userInfo;
} }
void setUserInfo(const ServerInfo_User &_userInfo); void setUserInfo(const ServerInfo_User &_userInfo);
void setOnline(bool online); void setOnline(bool online);
bool operator<(const QTreeWidgetItem &other) const; bool operator<(const QTreeWidgetItem &other) const override;
}; };
class UserListWidget : public QGroupBox class UserListWidget : public QGroupBox