Qt: fix user manager localusername and add textvalue to the inputdialog

This commit is contained in:
Megamouse 2018-07-27 00:12:00 +02:00
parent f84883223b
commit e29ea61f7c
2 changed files with 11 additions and 3 deletions

View file

@ -12,12 +12,18 @@ UserAccount::UserAccount(const std::string& user_id)
fs::file file;
if (file.open(m_user_dir + "localusername", fs::read))
{
file.read(m_username, 16*sizeof(char)); // max of 16 chars on real PS3
m_username = file.to_string();
file.close();
if (m_username.length() > 16) // max of 16 chars on real PS3
{
m_username = m_username.substr(0, 16);
LOG_WARNING(GENERAL, "UserAccount: localusername of userId=%s was too long, cropped to: %s", m_user_id, m_username);
}
}
else
{
LOG_WARNING(GENERAL, "UserAccount: localusername file read error (userId=%s, userDir=%s).", m_user_id, m_user_dir);
LOG_ERROR(GENERAL, "UserAccount: localusername file read error (userId=%s, userDir=%s).", m_user_id, m_user_dir);
}
}