mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-02 11:33:55 -07:00
Address macOS issue where right-clicking a username in the main chat (#4523)
* Address macOS issue where right-clicking a username in the main chat (or game chat) areas would pop up a seemingly empty user profile. This is because the resize event is overridden and doesn't actually attempt to resize based on the size hint of the dialog. Now that we're explicit with the call, this resize should be forced and have comparable results to popping up user profile from the user list. * use datetime for calculating account age (#4526) * use datetime for calculating account age make translating easier by using tr multiples automatically account for leap days Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
parent
baaf22d0c4
commit
d61c604bf4
4 changed files with 89 additions and 30 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef USERINFOBOX_H
|
||||
#define USERINFOBOX_H
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
|
|
@ -20,9 +21,18 @@ private:
|
|||
QPushButton editButton, passwordButton, avatarButton;
|
||||
QPixmap avatarPixmap;
|
||||
|
||||
static QString getAgeString(int ageSeconds);
|
||||
|
||||
public:
|
||||
UserInfoBox(AbstractClient *_client, bool editable, QWidget *parent = nullptr, Qt::WindowFlags flags = {});
|
||||
void retranslateUi();
|
||||
|
||||
inline static QPair<int, int> getDaysAndYearsBetween(const QDate &then, const QDate &now)
|
||||
{
|
||||
int years = now.addDays(1 - then.dayOfYear()).year() - then.year(); // there is no yearsTo
|
||||
int days = then.addYears(years).daysTo(now);
|
||||
return {days, years};
|
||||
}
|
||||
private slots:
|
||||
void processResponse(const Response &r);
|
||||
void processEditResponse(const Response &r);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue