UI: Improve alignment in user info (#4524)

* fix alignment

* tweaking

* lint

* limit flag to one column

* lint

* cleanup

* Update userinfobox.cpp

* re-add manual window resizing

* Update cockatrice/src/userinfobox.cpp

Co-authored-by: ebbit1q <ebbit1q@gmail.com>
This commit is contained in:
tooomm 2022-01-16 22:49:41 +01:00 committed by GitHub
parent 368ff1793f
commit baaf22d0c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -43,7 +43,7 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *paren
mainLayout->addWidget(&realNameLabel1, 2, 0, 1, 1);
mainLayout->addWidget(&realNameLabel2, 2, 1, 1, 2);
mainLayout->addWidget(&countryLabel1, 4, 0, 1, 1);
mainLayout->addWidget(&countryLabel2, 4, 1, 1, 2);
mainLayout->addWidget(&countryLabel2, 4, 1, 1, 1, Qt::AlignCenter);
mainLayout->addWidget(&countryLabel3, 4, 2, 1, 1);
mainLayout->addWidget(&userLevelLabel1, 5, 0, 1, 1);
mainLayout->addWidget(&userLevelLabel2, 5, 1, 1, 1);
@ -64,16 +64,16 @@ UserInfoBox::UserInfoBox(AbstractClient *_client, bool _editable, QWidget *paren
connect(&avatarButton, SIGNAL(clicked()), this, SLOT(actAvatar()));
}
setWindowTitle(tr("User information"));
setWindowTitle(tr("User Information"));
setLayout(mainLayout);
retranslateUi();
}
void UserInfoBox::retranslateUi()
{
realNameLabel1.setText(tr("Real name:"));
realNameLabel1.setText(tr("Real Name:"));
countryLabel1.setText(tr("Location:"));
userLevelLabel1.setText(tr("User level:"));
userLevelLabel1.setText(tr("User Level:"));
accountAgeLabel1.setText(tr("Account Age:"));
editButton.setText(tr("Edit"));
@ -98,7 +98,7 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user)
if (country.length() != 0) {
countryLabel2.setPixmap(CountryPixmapGenerator::generatePixmap(15, country));
countryLabel3.setText(QString("(%1)").arg(country.toUpper()));
countryLabel3.setText(QString("%1").arg(country.toUpper()));
} else {
countryLabel2.setText("");
countryLabel3.setText("");
@ -106,6 +106,7 @@ void UserInfoBox::updateInfo(const ServerInfo_User &user)
userLevelLabel2.setPixmap(
UserLevelPixmapGenerator::generatePixmap(15, userLevel, false, QString::fromStdString(user.privlevel())));
userLevelLabel2.setAlignment(Qt::AlignCenter);
QString userLevelText;
if (userLevel.testFlag(ServerInfo_User::IsAdmin))
userLevelText = tr("Administrator");