Cockatrice 2025-11-30-Development-2.11.0-beta.38
A cross-platform virtual tabletop for multiplayer card games
Loading...
Searching...
No Matches
user_info_box.h
Go to the documentation of this file.
1
6
7#ifndef USERINFOBOX_H
8#define USERINFOBOX_H
9
10#include <QDateTime>
11#include <QLabel>
12#include <QPushButton>
13#include <QWidget>
14
15class ServerInfo_User;
16class AbstractClient;
17class Response;
18
19class UserInfoBox : public QWidget
20{
21 Q_OBJECT
22private:
28 QPixmap avatarPixmap;
30 const ServerInfo_User *currentUserInfo;
31
32 static QString getAgeString(int ageSeconds);
33
34public:
35 UserInfoBox(AbstractClient *_client, bool editable, QWidget *parent = nullptr, Qt::WindowFlags flags = {});
36 void retranslateUi();
37
38 inline static QPair<int, int> getDaysAndYearsBetween(const QDate &then, const QDate &now)
39 {
40 int years = now.addDays(1 - then.dayOfYear()).year() - then.year(); // there is no yearsTo
41 int days = then.addYears(years).daysTo(now);
42 return {days, years};
43 }
44private slots:
45 void processResponse(const Response &r);
46 void processEditResponse(const Response &r);
47 void processPasswordResponse(const Response &r);
48 void processAvatarResponse(const Response &r);
49
50 void actEdit();
51 void actEditInternal(const Response &r);
52 void actPassword();
53 void actAvatar();
54public slots:
55 void updateInfo(const ServerInfo_User &user);
56 void updateInfo(const QString &userName);
57
58private:
59 void resizeEvent(QResizeEvent *event) override;
60 void changePassword(const QString &oldPassword, const QString &newPassword);
61};
62
63#endif
Definition abstract_client.h:51
void processEditResponse(const Response &r)
Definition user_info_box.cpp:311
void actAvatar()
Definition user_info_box.cpp:296
const ServerInfo_User * currentUserInfo
Definition user_info_box.h:30
QLabel countryLabel3
Definition user_info_box.h:26
QLabel userLevelIcon
Definition user_info_box.h:25
UserInfoBox(AbstractClient *_client, bool editable, QWidget *parent=nullptr, Qt::WindowFlags flags={})
Definition user_info_box.cpp:22
void processAvatarResponse(const Response &r)
Definition user_info_box.cpp:356
QLabel avatarPic
Definition user_info_box.h:25
AbstractClient * client
Definition user_info_box.h:23
QLabel countryLabel2
Definition user_info_box.h:25
QLabel nameLabel
Definition user_info_box.h:25
QPixmap avatarPixmap
Definition user_info_box.h:28
void retranslateUi()
Definition user_info_box.cpp:76
QLabel userLevelLabel2
Definition user_info_box.h:26
void changePassword(const QString &oldPassword, const QString &newPassword)
Definition user_info_box.cpp:278
void updateInfo(const ServerInfo_User &user)
Definition user_info_box.cpp:97
void actPassword()
Definition user_info_box.cpp:250
static QPair< int, int > getDaysAndYearsBetween(const QDate &then, const QDate &now)
Definition user_info_box.h:38
QLabel realNameLabel1
Definition user_info_box.h:25
static QString getAgeString(int ageSeconds)
Definition user_info_box.cpp:152
void processResponse(const Response &r)
Definition user_info_box.cpp:193
void actEditInternal(const Response &r)
Definition user_info_box.cpp:211
QLabel accountAgeLabel2
Definition user_info_box.h:26
QLabel accountAgeLabel1
Definition user_info_box.h:26
QLabel countryLabel1
Definition user_info_box.h:25
QLabel realNameLabel2
Definition user_info_box.h:25
QLabel userLevelLabel1
Definition user_info_box.h:26
bool editable
Definition user_info_box.h:24
bool hasAvatar
Definition user_info_box.h:29
QPushButton avatarButton
Definition user_info_box.h:27
QPushButton editButton
Definition user_info_box.h:27
void actEdit()
Definition user_info_box.cpp:201
QPushButton passwordButton
Definition user_info_box.h:27
void processPasswordResponse(const Response &r)
Definition user_info_box.cpp:333
void resizeEvent(QResizeEvent *event) override
Definition user_info_box.cpp:373