[Browser] Cast QStrings to UTF-8 instead Latin1

pull/368/head
Koncord 7 years ago
parent 35b771b19e
commit 043eb224e2

@ -131,7 +131,7 @@ bool ServerModel::setData(const QModelIndex &index, const QVariant &value, int r
sd.SetPassword(value.toBool()); sd.SetPassword(value.toBool());
break; break;
case ServerData::VERSION: case ServerData::VERSION:
sd.SetVersion(value.toString().toLatin1()); sd.SetVersion(value.toString().toUtf8());
ok = !sd.addr.isEmpty(); ok = !sd.addr.isEmpty();
break; break;
case ServerData::PLAYERS: case ServerData::PLAYERS:
@ -141,14 +141,14 @@ bool ServerModel::setData(const QModelIndex &index, const QVariant &value, int r
sd.SetMaxPlayers(value.toInt(&ok)); sd.SetMaxPlayers(value.toInt(&ok));
break; break;
case ServerData::HOSTNAME: case ServerData::HOSTNAME:
sd.SetName(value.toString().toLatin1()); sd.SetName(value.toString().toUtf8());
ok = !sd.addr.isEmpty(); ok = !sd.addr.isEmpty();
break; break;
case ServerData::PING: case ServerData::PING:
sd.ping = value.toInt(&ok); sd.ping = value.toInt(&ok);
break; break;
case ServerData::MODNAME: case ServerData::MODNAME:
sd.SetGameMode(value.toString().toLatin1()); sd.SetGameMode(value.toString().toUtf8());
break; break;
default: default:
return false; return false;
@ -165,9 +165,7 @@ bool ServerModel::insertRows(int position, int count, const QModelIndex &index)
Q_UNUSED(index); Q_UNUSED(index);
beginInsertRows(QModelIndex(), position, position + count - 1); beginInsertRows(QModelIndex(), position, position + count - 1);
for (int row = 0; row < count; ++row) { myData.insert(position, count, {});
myData.insert(position, {});
}
endInsertRows(); endInsertRows();
return true; return true;

Loading…
Cancel
Save