Move UserlistProxy to src/server/user and fix capitalization (#5475)

* move file

* fix capitalization
This commit is contained in:
RickyRister 2025-01-15 05:14:16 -08:00 committed by GitHub
parent 2def02e140
commit 455d68f9ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 34 additions and 33 deletions

View file

@ -123,7 +123,7 @@ TabGame::TabGame(TabSupervisor *_tabSupervisor, GameReplay *_replay)
} }
TabGame::TabGame(TabSupervisor *_tabSupervisor, TabGame::TabGame(TabSupervisor *_tabSupervisor,
UserlistProxy *_userListProxy, UserListProxy *_userListProxy,
QList<AbstractClient *> &_clients, QList<AbstractClient *> &_clients,
const Event_GameJoined &event, const Event_GameJoined &event,
const QMap<int, QString> &_roomGameTypes) const QMap<int, QString> &_roomGameTypes)

View file

@ -11,7 +11,7 @@
#include <QCompleter> #include <QCompleter>
#include <QMap> #include <QMap>
class UserlistProxy; class UserListProxy;
class DeckViewContainer; class DeckViewContainer;
class AbstractClient; class AbstractClient;
class CardDatabase; class CardDatabase;
@ -67,7 +67,7 @@ class TabGame : public Tab
private: private:
QTimer *gameTimer; QTimer *gameTimer;
int secondsElapsed; int secondsElapsed;
UserlistProxy *userListProxy; UserListProxy *userListProxy;
QList<AbstractClient *> clients; QList<AbstractClient *> clients;
ServerInfo_Game gameInfo; ServerInfo_Game gameInfo;
QMap<int, QString> roomGameTypes; QMap<int, QString> roomGameTypes;
@ -212,7 +212,7 @@ private slots:
public: public:
TabGame(TabSupervisor *_tabSupervisor, TabGame(TabSupervisor *_tabSupervisor,
UserlistProxy *_userListProxy, UserListProxy *_userListProxy,
QList<AbstractClient *> &_clients, QList<AbstractClient *> &_clients,
const Event_GameJoined &event, const Event_GameJoined &event,
const QMap<int, QString> &_roomGameTypes); const QMap<int, QString> &_roomGameTypes);

View file

@ -36,7 +36,7 @@
TabRoom::TabRoom(TabSupervisor *_tabSupervisor, TabRoom::TabRoom(TabSupervisor *_tabSupervisor,
AbstractClient *_client, AbstractClient *_client,
ServerInfo_User *_ownUser, ServerInfo_User *_ownUser,
const UserlistProxy *_userListProxy, const UserListProxy *_userListProxy,
const ServerInfo_Room &info) const ServerInfo_Room &info)
: Tab(_tabSupervisor), client(_client), roomId(info.room_id()), roomName(QString::fromStdString(info.name())), : Tab(_tabSupervisor), client(_client), roomId(info.room_id()), roomName(QString::fromStdString(info.name())),
ownUser(_ownUser), userListProxy(_userListProxy) ownUser(_ownUser), userListProxy(_userListProxy)

View file

@ -9,7 +9,7 @@
#include <QKeyEvent> #include <QKeyEvent>
#include <QMap> #include <QMap>
class UserlistProxy; class UserListProxy;
class UserListManager; class UserListManager;
namespace google namespace google
{ {
@ -51,7 +51,7 @@ private:
GameSelector *gameSelector; GameSelector *gameSelector;
UserListWidget *userList; UserListWidget *userList;
const UserlistProxy *userListProxy; const UserListProxy *userListProxy;
ChatView *chatView; ChatView *chatView;
QLabel *sayLabel; QLabel *sayLabel;
LineEditCompleter *sayEdit; LineEditCompleter *sayEdit;
@ -92,7 +92,7 @@ public:
TabRoom(TabSupervisor *_tabSupervisor, TabRoom(TabSupervisor *_tabSupervisor,
AbstractClient *_client, AbstractClient *_client,
ServerInfo_User *_ownUser, ServerInfo_User *_ownUser,
const UserlistProxy *_userListProxy, const UserListProxy *_userListProxy,
const ServerInfo_Room &info); const ServerInfo_Room &info);
void retranslateUi() override; void retranslateUi() override;
void closeRequest(bool forced = false) override; void closeRequest(bool forced = false) override;

View file

@ -2,7 +2,7 @@
#define TAB_SUPERVISOR_H #define TAB_SUPERVISOR_H
#include "../../deck/deck_loader.h" #include "../../deck/deck_loader.h"
#include "../../server/chat_view/user_list_proxy.h" #include "../../server/user/user_list_proxy.h"
#include "visual_deck_storage/tab_deck_storage_visual.h" #include "visual_deck_storage/tab_deck_storage_visual.h"
#include <QAbstractButton> #include <QAbstractButton>

View file

@ -285,7 +285,7 @@ void GamesModel::updateGameList(const ServerInfo_Game &game)
endInsertRows(); endInsertRows();
} }
GamesProxyModel::GamesProxyModel(QObject *parent, const UserlistProxy *_userListProxy) GamesProxyModel::GamesProxyModel(QObject *parent, const UserListProxy *_userListProxy)
: QSortFilterProxyModel(parent), userListProxy(_userListProxy) : QSortFilterProxyModel(parent), userListProxy(_userListProxy)
{ {
resetFilterParameters(); resetFilterParameters();

View file

@ -11,7 +11,7 @@
#include <QStringList> #include <QStringList>
#include <QTime> #include <QTime>
class UserlistProxy; class UserListProxy;
class GamesModel : public QAbstractTableModel class GamesModel : public QAbstractTableModel
{ {
@ -66,7 +66,7 @@ class GamesProxyModel : public QSortFilterProxyModel
{ {
Q_OBJECT Q_OBJECT
private: private:
const UserlistProxy *userListProxy; const UserListProxy *userListProxy;
// If adding any additional filters, make sure to update: // If adding any additional filters, make sure to update:
// - GamesProxyModel() // - GamesProxyModel()
@ -88,7 +88,7 @@ private:
showOnlyIfSpectatorsCanSeeHands; showOnlyIfSpectatorsCanSeeHands;
public: public:
GamesProxyModel(QObject *parent = nullptr, const UserlistProxy *_userListProxy = nullptr); GamesProxyModel(QObject *parent = nullptr, const UserListProxy *_userListProxy = nullptr);
bool getShowBuddiesOnlyGames() const bool getShowBuddiesOnlyGames() const
{ {

View file

@ -5,6 +5,7 @@
#include "../../client/ui/pixel_map_generator.h" #include "../../client/ui/pixel_map_generator.h"
#include "../../settings/cache_settings.h" #include "../../settings/cache_settings.h"
#include "../user/user_context_menu.h" #include "../user/user_context_menu.h"
#include "../user/user_list_proxy.h"
#include "user_level.h" #include "user_level.h"
#include <QApplication> #include <QApplication>
@ -22,11 +23,11 @@ UserMessagePosition::UserMessagePosition(QTextCursor &cursor)
} }
ChatView::ChatView(TabSupervisor *_tabSupervisor, ChatView::ChatView(TabSupervisor *_tabSupervisor,
const UserlistProxy *_userlistProxy, const UserListProxy *_userListProxy,
TabGame *_game, TabGame *_game,
bool _showTimestamps, bool _showTimestamps,
QWidget *parent) QWidget *parent)
: QTextBrowser(parent), tabSupervisor(_tabSupervisor), game(_game), userlistProxy(_userlistProxy), evenNumber(true), : QTextBrowser(parent), tabSupervisor(_tabSupervisor), game(_game), userListProxy(_userListProxy), evenNumber(true),
showTimestamps(_showTimestamps), hoveredItemType(HoveredNothing) showTimestamps(_showTimestamps), hoveredItemType(HoveredNothing)
{ {
if (palette().windowText().color().lightness() > 200) { if (palette().windowText().color().lightness() > 200) {
@ -45,10 +46,10 @@ ChatView::ChatView(TabSupervisor *_tabSupervisor,
linkColor = palette().link().color(); linkColor = palette().link().color();
} }
userContextMenu = new UserContextMenu(tabSupervisor, userlistProxy, this, game); userContextMenu = new UserContextMenu(tabSupervisor, userListProxy, this, game);
connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool))); connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
ownUserName = userlistProxy->getOwnUsername(); ownUserName = userListProxy->getOwnUsername();
mention = "@" + ownUserName; mention = "@" + ownUserName;
mentionFormat.setFontWeight(QFont::Bold); mentionFormat.setFontWeight(QFont::Bold);
@ -189,7 +190,7 @@ void ChatView::appendMessage(QString message,
cursor.insertText(" "); cursor.insertText(" ");
} else { } else {
const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize(); const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize();
bool isBuddy = userlistProxy->isUserBuddy(userName); bool isBuddy = userListProxy->isUserBuddy(userName);
cursor.insertImage( cursor.insertImage(
UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel, isBuddy, UserPrivLevel).toImage()); UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel, isBuddy, UserPrivLevel).toImage());
cursor.insertText(" "); cursor.insertText(" ");
@ -328,7 +329,7 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, const QString
QString mentionIntact = fullMentionUpToSpaceOrEnd; QString mentionIntact = fullMentionUpToSpaceOrEnd;
while (fullMentionUpToSpaceOrEnd.size()) { while (fullMentionUpToSpaceOrEnd.size()) {
const ServerInfo_User *onlineUser = userlistProxy->getOnlineUser(fullMentionUpToSpaceOrEnd); const ServerInfo_User *onlineUser = userListProxy->getOnlineUser(fullMentionUpToSpaceOrEnd);
if (onlineUser) // Is there a user online named this? if (onlineUser) // Is there a user online named this?
{ {
if (ownUserName.toLower() == fullMentionUpToSpaceOrEnd.toLower()) // Is this user you? if (ownUserName.toLower() == fullMentionUpToSpaceOrEnd.toLower()) // Is this user you?

View file

@ -5,7 +5,6 @@
#include "../user/user_list_widget.h" #include "../user/user_list_widget.h"
#include "room_message_type.h" #include "room_message_type.h"
#include "user_level.h" #include "user_level.h"
#include "user_list_proxy.h"
#include <QAction> #include <QAction>
#include <QColor> #include <QColor>
@ -16,6 +15,7 @@
class QTextTable; class QTextTable;
class QMouseEvent; class QMouseEvent;
class UserContextMenu; class UserContextMenu;
class UserListProxy;
class TabGame; class TabGame;
class UserMessagePosition class UserMessagePosition
@ -44,7 +44,7 @@ private:
HoveredCard, HoveredCard,
HoveredUser HoveredUser
}; };
const UserlistProxy *const userlistProxy; const UserListProxy *const userListProxy;
UserContextMenu *userContextMenu; UserContextMenu *userContextMenu;
QString lastSender; QString lastSender;
QString ownUserName; QString ownUserName;
@ -84,7 +84,7 @@ private slots:
public: public:
ChatView(TabSupervisor *_tabSupervisor, ChatView(TabSupervisor *_tabSupervisor,
const UserlistProxy *_userlistProxy, const UserListProxy *_userListProxy,
TabGame *_game, TabGame *_game,
bool _showTimestamps, bool _showTimestamps,
QWidget *parent = nullptr); QWidget *parent = nullptr);

View file

@ -863,10 +863,10 @@ void MessageLogWidget::connectToPlayer(Player *player)
} }
MessageLogWidget::MessageLogWidget(TabSupervisor *_tabSupervisor, MessageLogWidget::MessageLogWidget(TabSupervisor *_tabSupervisor,
const UserlistProxy *_userlistProxy, const UserListProxy *_userListProxy,
TabGame *_game, TabGame *_game,
QWidget *parent) QWidget *parent)
: ChatView(_tabSupervisor, _userlistProxy, _game, true, parent), mulliganNumber(0), : ChatView(_tabSupervisor, _userListProxy, _game, true, parent), mulliganNumber(0),
currentContext(MessageContext_None) currentContext(MessageContext_None)
{ {
} }

View file

@ -104,7 +104,7 @@ public slots:
public: public:
void connectToPlayer(Player *player); void connectToPlayer(Player *player);
MessageLogWidget(TabSupervisor *_tabSupervisor, MessageLogWidget(TabSupervisor *_tabSupervisor,
const UserlistProxy *_userlistProxy, const UserListProxy *_userListProxy,
TabGame *_game, TabGame *_game,
QWidget *parent = nullptr); QWidget *parent = nullptr);
}; };

View file

@ -5,7 +5,6 @@
#include "../../client/tabs/tab_game.h" #include "../../client/tabs/tab_game.h"
#include "../../client/tabs/tab_supervisor.h" #include "../../client/tabs/tab_supervisor.h"
#include "../../game/game_selector.h" #include "../../game/game_selector.h"
#include "../../server/chat_view/user_list_proxy.h"
#include "../chat_view/chat_view.h" #include "../chat_view/chat_view.h"
#include "../pending_command.h" #include "../pending_command.h"
#include "pb/command_kick_from_game.pb.h" #include "pb/command_kick_from_game.pb.h"
@ -19,6 +18,7 @@
#include "pb/response_warn_list.pb.h" #include "pb/response_warn_list.pb.h"
#include "pb/session_commands.pb.h" #include "pb/session_commands.pb.h"
#include "user_info_box.h" #include "user_info_box.h"
#include "user_list_proxy.h"
#include "user_list_widget.h" #include "user_list_widget.h"
#include <QAction> #include <QAction>
@ -29,7 +29,7 @@
#include <QtWidgets> #include <QtWidgets>
UserContextMenu::UserContextMenu(TabSupervisor *_tabSupervisor, UserContextMenu::UserContextMenu(TabSupervisor *_tabSupervisor,
const UserlistProxy *_userListProxy, const UserListProxy *_userListProxy,
QWidget *parent, QWidget *parent,
TabGame *_game) TabGame *_game)
: QObject(parent), client(_tabSupervisor->getClient()), tabSupervisor(_tabSupervisor), : QObject(parent), client(_tabSupervisor->getClient()), tabSupervisor(_tabSupervisor),

View file

@ -5,7 +5,7 @@
#include <QObject> #include <QObject>
class UserlistProxy; class UserListProxy;
class AbstractClient; class AbstractClient;
class ChatView; class ChatView;
class CommandContainer; class CommandContainer;
@ -23,7 +23,7 @@ class UserContextMenu : public QObject
private: private:
AbstractClient *client; AbstractClient *client;
TabSupervisor *tabSupervisor; TabSupervisor *tabSupervisor;
const UserlistProxy *userListProxy; const UserListProxy *userListProxy;
TabGame *game; TabGame *game;
QAction *aUserName; QAction *aUserName;
@ -55,7 +55,7 @@ private slots:
public: public:
UserContextMenu(TabSupervisor *_tabSupervisor, UserContextMenu(TabSupervisor *_tabSupervisor,
const UserlistProxy *_userListProxy, const UserListProxy *_userListProxy,
QWidget *_parent, QWidget *_parent,
TabGame *_game = 0); TabGame *_game = 0);
void retranslateUi(); void retranslateUi();

View file

@ -1,8 +1,8 @@
#ifndef COCKATRICE_USER_LIST_MANAGER_H #ifndef COCKATRICE_USER_LIST_MANAGER_H
#define COCKATRICE_USER_LIST_MANAGER_H #define COCKATRICE_USER_LIST_MANAGER_H
#include "../chat_view/user_list_proxy.h"
#include "pb/serverinfo_user.pb.h" #include "pb/serverinfo_user.pb.h"
#include "user_list_proxy.h"
#include <QMap> #include <QMap>
#include <QWidget> #include <QWidget>
@ -17,7 +17,7 @@ class Response;
class ServerInfo_User; class ServerInfo_User;
class TabSupervisor; class TabSupervisor;
class UserListManager : public QWidget, public UserlistProxy class UserListManager : public QWidget, public UserListProxy
{ {
Q_OBJECT Q_OBJECT

View file

@ -8,7 +8,7 @@ class ServerInfo_User;
* Responsible for providing a bare-bones minimal interface into userlist information, * Responsible for providing a bare-bones minimal interface into userlist information,
* including your current connection to the server as well as buddy/ignore/alluser lists. * including your current connection to the server as well as buddy/ignore/alluser lists.
*/ */
class UserlistProxy class UserListProxy
{ {
public: public:
virtual bool isOwnUserRegistered() const = 0; virtual bool isOwnUserRegistered() const = 0;