🐛 Replaced '\n' with Qt::endl and fixed duplicate highscore entry

main
Isabell Pflug 1 year ago
parent 38d801c604
commit f1dd878ac8

@ -172,13 +172,15 @@ void MainWindow::processHighscore() {
QTextStream hs(&highscoreCSV); QTextStream hs(&highscoreCSV);
for (auto key = highscore.keyValueBegin(); key != highscore.keyValueEnd(); key++){ for (auto key = highscore.keyValueBegin(); key != highscore.keyValueEnd(); key++){
hs << key->first.first << ";" << key->first.second.toString(Qt::DateFormat::ISODate) << ";" << key->second << "\n"; hs << key->first.first << ";" << key->first.second.toString(Qt::DateFormat::ISODate) << ";" << key->second << Qt::endl;
} }
highscoreCSV.close(); highscoreCSV.close();
usleep(500); // paranoia
} }
void MainWindow::readHighscore() { void MainWindow::readHighscore() {
highscore.clear();
QDir appdata = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation)); QDir appdata = QDir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
QFile highscoreCSV = QFile(appdata.filePath(csv_name)); QFile highscoreCSV = QFile(appdata.filePath(csv_name));
if (!appdata.exists()) { if (!appdata.exists()) {

Loading…
Cancel
Save