![]() |
Cockatrice 2026-10-19-Development-3.1.2-beta.2
A virtual tabletop for multiplayer card games
|
#include <user_list_widget.h>
Public Types | |
| enum | UserListType { AllUsersList , RoomList , BuddyList , IgnoreList } |
| enum class | Section { Buddy , Online , Ignore } |
Signals | |
| void | openMessageDialog (const QString &userName, bool focus) |
| void | addBuddy (const QString &userName) |
| void | removeBuddy (const QString &userName) |
| void | addIgnore (const QString &userName) |
| void | removeIgnore (const QString &userName) |
| void | sectionExpanded (Section section, bool expanded) |
| void | userActivated (const QString &userName) |
| void | currentUserChanged (const QString &userName) |
| void | userListChanged () |
Public Member Functions | |
| UserListWidget (TabSupervisor *_tabSupervisor, AbstractClient *_client, UserListType _type, QWidget *parent=nullptr, bool hasUserInfoPopup=true) | |
| ~UserListWidget () override | |
| void | bind (UserListManager *mgr) |
| void | applyDisplayMode () |
| void | beginBulkLoad () |
| void | endBulkLoad () |
| bool | eventFilter (QObject *obj, QEvent *event) override |
| void | retranslateUi () |
| void | rebuild () |
| void | processUserInfo (const ServerInfo_User &user, bool online) |
| bool | deleteUser (const QString &userName) |
| void | setUserOnline (const QString &userName, bool online) |
| void | setFilterText (const QString &text) |
| void | setShowTitle (bool showTitle) |
| void | setSectioned (const QList< Section > &ids) |
| void | setSectionExpanded (Section section, bool expanded) |
| void | setUserFilter (std::function< bool(const QString &userName, bool online)> filter) |
| int | visibleUserRowCount () const |
| bool | getHasUserInfoPopup () const |
| const QList< Section > & | getSectionIds () const |
| const QMap< QString, UserListTWI * > & | getUsers () const |
| void | showContextMenu (const QPoint &pos, const QModelIndex &index) |
| void | sortItems () |
| void | setGameInviteLinkProvider (std::function< QList< GameInviteOption >()> provider) |
Protected Member Functions | |
| void | hideEvent (QHideEvent *e) override |
| void | showEvent (QShowEvent *e) override |
Private Slots | |
| void | userClicked (QTreeWidgetItem *item, int column) |
| void | refreshVisibleUserHeader (const QString &name) |
Private Member Functions | |
| void | showPopupForUser (UserListTWI *item) |
| void | hidePopup (bool immediate=false) |
| void | positionPopup (UserListTWI *item) |
| void | connectPopupSignals () |
| bool | isPressInsideListUi (const QWidget *widget) const |
| void | clearSelectionAndClosePopup () |
| bool | isItemNearViewport (const UserListTWI *item) const |
| void | requestVisibleItemResources () |
| void | createSectionItems () |
| QTreeWidgetItem * | createSectionItem (Section section) |
| QString | sectionTitle (Section section) const |
| void | updateSectionDivider (Section section) |
| void | handleSectionExpansion (QTreeWidgetItem *item, bool expanded) |
| void | setExpandedProgrammatically (QTreeWidgetItem *item, bool expanded) |
| void | handleOnlineChange (const ServerInfo_User &user) |
| void | handleOnlineChangeLeft (const QString &userName) |
| void | handleListAdd (Section section, const ServerInfo_User &user) |
| void | handleListRemove (Section section, const QString &userName) |
| UserListTWI * | ensureSectionMembership (Section section, const ServerInfo_User &user, bool online) |
| bool | dropSectionMembership (Section section, const QString &userName) |
| void | finishSectionedMutation () |
| void | updateCardArtParams (const ServerInfo_User &user, const QString &userName) |
| void | processUserInfo (Section section, const ServerInfo_User &user, bool online) |
| void | updateCount () |
| void | applyFilter () |
| void | refreshPopupButtons (const QString &userName) |
Private Attributes | |
| UserListManager * | manager = nullptr |
| UserAvatarProvider * | avatarProvider = nullptr |
| UserCardArtProvider * | cardArtProvider = nullptr |
| QMap< QString, CardArtParams > | cardArtParamsMap |
| UserInfoPopup * | userInfoPopup = nullptr |
| QTimer * | showPopupTimer = nullptr |
| QTimer * | hidePopupTimer = nullptr |
| QString | hoveredUser |
| bool | popupPinned = false |
| bool | bulkLoading = false |
| bool | hasUserInfoPopup = true |
| std::function< bool(const QString &userName, bool online)> | userFilter |
| bool | sectioned = false |
| QList< Section > | sectionIds |
| QMap< Section, QTreeWidgetItem * > | sectionItems |
| QMap< Section, QMap< QString, UserListTWI * > > | sectionUsers |
| QSet< Section > | expandedSections |
| QMap< QString, UserListTWI * > | users |
| TabSupervisor * | tabSupervisor |
| AbstractClient * | client |
| UserListType | type |
| QTreeWidget * | userTree = nullptr |
| UserListItemDelegate * | itemDelegate |
| UserContextMenu * | userContextMenu |
| int | onlineCount |
| QString | titleStr |
| QString | filterText |
| bool | showTitle = true |
|
strong |
| UserListWidget::UserListWidget | ( | TabSupervisor * | _tabSupervisor, |
| AbstractClient * | _client, | ||
| UserListType | _type, | ||
| QWidget * | parent = nullptr, | ||
| bool | hasUserInfoPopup = true ) |
|
override |
|
signal |
|
signal |
| void UserListWidget::applyDisplayMode | ( | ) |
|
private |
| void UserListWidget::beginBulkLoad | ( | ) |
| void UserListWidget::bind | ( | UserListManager * | mgr | ) |
|
private |
|
private |
|
private |
|
private |
|
signal |
Dialog mode: the current row changed; empty string means no user row.
| bool UserListWidget::deleteUser | ( | const QString & | userName | ) |
|
private |
Removes and deletes the row for userName in section.
| void UserListWidget::endBulkLoad | ( | ) |
|
private |
Creates or updates the row for user in section.
|
override |
|
private |
Sorts, refilters and repaints after a sectioned mode mutation.
|
inlinenodiscard |
|
inlinenodiscard |
|
private |
|
private |
|
private |
|
private |
|
private |
|
overrideprotected |
|
private |
|
private |
|
private |
True when widget is the tree, the popup or an open menu.
|
signal |
|
private |
| void UserListWidget::processUserInfo | ( | const ServerInfo_User & | user, |
| bool | online ) |
|
private |
| void UserListWidget::rebuild | ( | ) |
|
private |
|
privateslot |
|
signal |
|
signal |
|
private |
| void UserListWidget::retranslateUi | ( | ) |
|
signal |
|
nodiscardprivate |
|
private |
| void UserListWidget::setFilterText | ( | const QString & | text | ) |
| void UserListWidget::setGameInviteLinkProvider | ( | std::function< QList< GameInviteOption >()> | provider | ) |
| void UserListWidget::setSectionExpanded | ( | Section | section, |
| bool | expanded ) |
| void UserListWidget::setShowTitle | ( | bool | showTitle | ) |
|
inline |
Dialog mode: rows that fail the predicate are never shown.
| void UserListWidget::setUserOnline | ( | const QString & | userName, |
| bool | online ) |
| void UserListWidget::showContextMenu | ( | const QPoint & | pos, |
| const QModelIndex & | index ) |
|
overrideprotected |
|
private |
Popup functions are anchored on the row, not the user name. In sectioned mode a user can own several rows (online + buddy), and the popup must follow the hovered/selected row rather than a lookup by name.
| void UserListWidget::sortItems | ( | ) |
|
private |
|
private |
|
private |
|
signal |
Dialog mode: the user activated (Enter/double-click) the given row.
|
privateslot |
|
signal |
The set of visible rows changed (filter, search or a live mutation).
|
nodiscard |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |