deprecate the gender property from the protocol entirely (#4496)

* deprecate the gender property from the protocol entirely

* use obsolete instead of deprecated

* add the database migration

* update internal database version as well
This commit is contained in:
ebbit1q 2021-12-14 07:51:57 +01:00 committed by GitHub
parent 86881bbbc3
commit 07e6aadbbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 25 additions and 170 deletions

View file

@ -88,7 +88,6 @@ protected slots:
protected:
QMap<int, PendingCommand *> pendingCommands;
QString userName, password, email, country, realName, token;
int gender;
void setStatus(ClientStatus _status);
int getNewCmdId()
{

View file

@ -21,10 +21,6 @@ public:
{
return emailEdit->text();
}
int getGender() const
{
return -1;
} // This will return GenderUnknown for protocol purposes.
QString getCountry() const
{
return countryEdit->currentIndex() == 0 ? "" : countryEdit->currentText();

View file

@ -34,10 +34,6 @@ public:
{
return emailEdit->text();
}
int getGender() const
{
return -1;
} // This will return GenderUnknown for the protocol.
QString getCountry() const
{
return countryEdit->currentIndex() == 0 ? "" : countryEdit->currentText();

View file

@ -78,25 +78,6 @@ QPixmap PingPixmapGenerator::generatePixmap(int size, int value, int max)
QMap<int, QPixmap> PingPixmapGenerator::pmCache;
QPixmap GenderPixmapGenerator::generatePixmap(int height)
{
ServerInfo_User::Gender gender = ServerInfo_User::GenderUnknown;
int key = gender * 100000 + height;
if (pmCache.contains(key))
return pmCache.value(key);
QString genderStr;
genderStr = "unknown";
QPixmap pixmap =
QPixmap("theme:genders/" + genderStr).scaled(height, height, Qt::KeepAspectRatio, Qt::SmoothTransformation);
pmCache.insert(key, pixmap);
return pixmap;
}
QMap<int, QPixmap> GenderPixmapGenerator::pmCache;
QPixmap CountryPixmapGenerator::generatePixmap(int height, const QString &countryCode)
{
if (countryCode.size() != 2)

View file

@ -45,19 +45,6 @@ public:
}
};
class GenderPixmapGenerator
{
private:
static QMap<int, QPixmap> pmCache;
public:
static QPixmap generatePixmap(int height);
static void clear()
{
pmCache.clear();
}
};
class CountryPixmapGenerator
{
private:

View file

@ -152,7 +152,6 @@ void RemoteClient::processServerIdentificationEvent(const Event_ServerIdentifica
cmdRegister.set_user_name(userName.toStdString());
cmdRegister.set_password(password.toStdString());
cmdRegister.set_email(email.toStdString());
cmdRegister.set_gender((ServerInfo_User_Gender)gender);
cmdRegister.set_country(country.toStdString());
cmdRegister.set_real_name(realName.toStdString());
cmdRegister.set_clientid(getSrvClientID(lastHostname).toStdString());
@ -449,7 +448,6 @@ void RemoteClient::doRegisterToServer(const QString &hostname,
const QString &_userName,
const QString &_password,
const QString &_email,
const int _gender,
const QString &_country,
const QString &_realname)
{
@ -458,7 +456,6 @@ void RemoteClient::doRegisterToServer(const QString &hostname,
userName = _userName;
password = _password;
email = _email;
gender = _gender;
country = _country;
realName = _realname;
lastHostname = hostname;
@ -539,11 +536,10 @@ void RemoteClient::registerToServer(const QString &hostname,
const QString &_userName,
const QString &_password,
const QString &_email,
const int _gender,
const QString &_country,
const QString &_realname)
{
emit sigRegisterToServer(hostname, port, _userName, _password, _email, _gender, _country, _realname);
emit sigRegisterToServer(hostname, port, _userName, _password, _email, _country, _realname);
}
void RemoteClient::activateToServer(const QString &_token)

View file

@ -27,7 +27,6 @@ signals:
const QString &_userName,
const QString &_password,
const QString &_email,
int _gender,
const QString &_country,
const QString &_realname);
void sigActivateToServer(const QString &_token);
@ -67,7 +66,6 @@ private slots:
const QString &_userName,
const QString &_password,
const QString &_email,
int _gender,
const QString &_country,
const QString &_realname);
void doRequestPasswordSalt();
@ -130,7 +128,6 @@ public:
const QString &_userName,
const QString &_password,
const QString &_email,
int _gender,
const QString &_country,
const QString &_realname);
void activateToServer(const QString &_token);

View file

@ -200,7 +200,6 @@ void UserInfoBox::actEditInternal(const Response &r)
Command_AccountEdit cmd;
cmd.set_real_name(dlg.getRealName().toStdString());
cmd.set_email(dlg.getEmail().toStdString());
cmd.set_gender((ServerInfo_User_Gender)dlg.getGender());
cmd.set_country(dlg.getCountry().toStdString());
PendingCommand *pend = client->prepareSessionCommand(cmd);

View file

@ -201,8 +201,7 @@ void MainWindow::actRegister()
DlgRegister dlg(this);
if (dlg.exec()) {
client->registerToServer(dlg.getHost(), static_cast<unsigned int>(dlg.getPort()), dlg.getPlayerName(),
dlg.getPassword(), dlg.getEmail(), dlg.getGender(), dlg.getCountry(),
dlg.getRealName());
dlg.getPassword(), dlg.getEmail(), dlg.getCountry(), dlg.getRealName());
}
}