mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-15 03:28:49 -07:00
Move UserlistProxy to src/server/user and fix capitalization (#5475)
* move file * fix capitalization
This commit is contained in:
parent
2def02e140
commit
455d68f9ea
15 changed files with 34 additions and 33 deletions
|
|
@ -5,6 +5,7 @@
|
|||
#include "../../client/ui/pixel_map_generator.h"
|
||||
#include "../../settings/cache_settings.h"
|
||||
#include "../user/user_context_menu.h"
|
||||
#include "../user/user_list_proxy.h"
|
||||
#include "user_level.h"
|
||||
|
||||
#include <QApplication>
|
||||
|
|
@ -22,11 +23,11 @@ UserMessagePosition::UserMessagePosition(QTextCursor &cursor)
|
|||
}
|
||||
|
||||
ChatView::ChatView(TabSupervisor *_tabSupervisor,
|
||||
const UserlistProxy *_userlistProxy,
|
||||
const UserListProxy *_userListProxy,
|
||||
TabGame *_game,
|
||||
bool _showTimestamps,
|
||||
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)
|
||||
{
|
||||
if (palette().windowText().color().lightness() > 200) {
|
||||
|
|
@ -45,10 +46,10 @@ ChatView::ChatView(TabSupervisor *_tabSupervisor,
|
|||
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)));
|
||||
|
||||
ownUserName = userlistProxy->getOwnUsername();
|
||||
ownUserName = userListProxy->getOwnUsername();
|
||||
mention = "@" + ownUserName;
|
||||
|
||||
mentionFormat.setFontWeight(QFont::Bold);
|
||||
|
|
@ -189,7 +190,7 @@ void ChatView::appendMessage(QString message,
|
|||
cursor.insertText(" ");
|
||||
} else {
|
||||
const int pixelSize = QFontInfo(cursor.charFormat().font()).pixelSize();
|
||||
bool isBuddy = userlistProxy->isUserBuddy(userName);
|
||||
bool isBuddy = userListProxy->isUserBuddy(userName);
|
||||
cursor.insertImage(
|
||||
UserLevelPixmapGenerator::generatePixmap(pixelSize, userLevel, isBuddy, UserPrivLevel).toImage());
|
||||
cursor.insertText(" ");
|
||||
|
|
@ -328,7 +329,7 @@ void ChatView::checkMention(QTextCursor &cursor, QString &message, const QString
|
|||
QString mentionIntact = fullMentionUpToSpaceOrEnd;
|
||||
|
||||
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 (ownUserName.toLower() == fullMentionUpToSpaceOrEnd.toLower()) // Is this user you?
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include "../user/user_list_widget.h"
|
||||
#include "room_message_type.h"
|
||||
#include "user_level.h"
|
||||
#include "user_list_proxy.h"
|
||||
|
||||
#include <QAction>
|
||||
#include <QColor>
|
||||
|
|
@ -16,6 +15,7 @@
|
|||
class QTextTable;
|
||||
class QMouseEvent;
|
||||
class UserContextMenu;
|
||||
class UserListProxy;
|
||||
class TabGame;
|
||||
|
||||
class UserMessagePosition
|
||||
|
|
@ -44,7 +44,7 @@ private:
|
|||
HoveredCard,
|
||||
HoveredUser
|
||||
};
|
||||
const UserlistProxy *const userlistProxy;
|
||||
const UserListProxy *const userListProxy;
|
||||
UserContextMenu *userContextMenu;
|
||||
QString lastSender;
|
||||
QString ownUserName;
|
||||
|
|
@ -84,7 +84,7 @@ private slots:
|
|||
|
||||
public:
|
||||
ChatView(TabSupervisor *_tabSupervisor,
|
||||
const UserlistProxy *_userlistProxy,
|
||||
const UserListProxy *_userListProxy,
|
||||
TabGame *_game,
|
||||
bool _showTimestamps,
|
||||
QWidget *parent = nullptr);
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
#ifndef COCKATRICE_USERLISTPROXY_H
|
||||
#define COCKATRICE_USERLISTPROXY_H
|
||||
|
||||
class QString;
|
||||
class ServerInfo_User;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
class UserlistProxy
|
||||
{
|
||||
public:
|
||||
virtual bool isOwnUserRegistered() const = 0;
|
||||
virtual QString getOwnUsername() const = 0;
|
||||
virtual bool isUserBuddy(const QString &userName) const = 0;
|
||||
virtual bool isUserIgnored(const QString &userName) const = 0;
|
||||
virtual const ServerInfo_User *getOnlineUser(const QString &userName) const = 0; // Can return nullptr
|
||||
};
|
||||
|
||||
#endif // COCKATRICE_USERLISTPROXY_H
|
||||
Loading…
Add table
Add a link
Reference in a new issue