mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
Fix user card games for offline users and stale requests (#7738)
This commit is contained in:
parent
7768416091
commit
94f7de42f2
8 changed files with 550 additions and 76 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef COCKATRICE_USER_INFO_POPUP_H
|
||||
#define COCKATRICE_USER_INFO_POPUP_H
|
||||
|
||||
#include "user_games_model.h"
|
||||
#include "user_list_painter.h"
|
||||
|
||||
#include <QColor>
|
||||
|
|
@ -21,15 +22,13 @@ class QPushButton;
|
|||
class TabSupervisor;
|
||||
class QListView;
|
||||
class QPoint;
|
||||
class QStandardItemModel;
|
||||
class Response;
|
||||
template <class Key, class T> class QMap;
|
||||
|
||||
// ── Roles ─────────────────────────────────────────────────────────────────────
|
||||
|
||||
namespace PopupRoles
|
||||
{
|
||||
constexpr int GameData = Qt::UserRole + 10;
|
||||
constexpr int GameData = UserGamesModel::GameRole;
|
||||
}
|
||||
|
||||
// Popup theme
|
||||
|
|
@ -143,6 +142,7 @@ public:
|
|||
void
|
||||
showForUser(const QString &userName, const ServerInfo_User &userInfo, bool online, bool isBuddy, bool isIgnored);
|
||||
void fetchGames();
|
||||
void setOnline(bool online);
|
||||
|
||||
[[nodiscard]] QString getCurrentUser() const
|
||||
{
|
||||
|
|
@ -199,7 +199,7 @@ protected:
|
|||
|
||||
private slots:
|
||||
void refreshGames();
|
||||
void onGamesReceived(const Response &r, const QString &forUser);
|
||||
void updateGamesDisplay();
|
||||
void onGamesContextMenu(const QPoint &pos);
|
||||
|
||||
private:
|
||||
|
|
@ -218,6 +218,8 @@ private:
|
|||
QString currentUser;
|
||||
ServerInfo_User currentUserInfo;
|
||||
bool currentOnline = false;
|
||||
bool currentBuddy = false;
|
||||
bool currentIgnored = false;
|
||||
std::function<bool(const QString &userName)> gameInviteAvailable;
|
||||
|
||||
UserInfoHeaderWidget *header;
|
||||
|
|
@ -225,7 +227,7 @@ private:
|
|||
QLabel *gamesLabel;
|
||||
QFrame *separator;
|
||||
QListView *gamesView;
|
||||
QStandardItemModel *gamesModel;
|
||||
UserGamesModel *gamesModel;
|
||||
QLabel *gamesStatus;
|
||||
QPushButton *closeBtn;
|
||||
QPushButton *refreshBtn;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue