get UserListProxy from TabSupervisor instead of passing it in the constructor (#5490)

This commit is contained in:
RickyRister 2025-01-17 07:27:52 -08:00 committed by GitHub
parent 92a903b035
commit 2bc71095dd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 32 additions and 52 deletions

View file

@ -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_manager.h"
#include "../user/user_list_proxy.h"
#include "user_level.h"
@ -22,13 +23,10 @@ UserMessagePosition::UserMessagePosition(QTextCursor &cursor)
relativePosition = cursor.position() - block.position();
}
ChatView::ChatView(TabSupervisor *_tabSupervisor,
const UserListProxy *_userListProxy,
TabGame *_game,
bool _showTimestamps,
QWidget *parent)
: QTextBrowser(parent), tabSupervisor(_tabSupervisor), game(_game), userListProxy(_userListProxy), evenNumber(true),
showTimestamps(_showTimestamps), hoveredItemType(HoveredNothing)
ChatView::ChatView(TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent)
: QTextBrowser(parent), tabSupervisor(_tabSupervisor), game(_game),
userListProxy(_tabSupervisor->getUserListManager()), evenNumber(true), showTimestamps(_showTimestamps),
hoveredItemType(HoveredNothing)
{
if (palette().windowText().color().lightness() > 200) {
document()->setDefaultStyleSheet(R"(
@ -46,7 +44,7 @@ ChatView::ChatView(TabSupervisor *_tabSupervisor,
linkColor = palette().link().color();
}
userContextMenu = new UserContextMenu(tabSupervisor, userListProxy, this, game);
userContextMenu = new UserContextMenu(tabSupervisor, this, game);
connect(userContextMenu, SIGNAL(openMessageDialog(QString, bool)), this, SIGNAL(openMessageDialog(QString, bool)));
ownUserName = userListProxy->getOwnUsername();