diff options
-rw-r--r-- | src/server/mainwindow/mainwindow.cpp | 14 | ||||
-rw-r--r-- | src/server/util/util.h | 9 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/server/mainwindow/mainwindow.cpp b/src/server/mainwindow/mainwindow.cpp index 9a3bd76..8fbba96 100644 --- a/src/server/mainwindow/mainwindow.cpp +++ b/src/server/mainwindow/mainwindow.cpp @@ -416,17 +416,23 @@ void MainWindow::tryToUseRoomTemplate() QMap<QString, Room* > roomsList; SYSTEM_SETTINGS(conf); - if (!conf.contains("rooms")) { qDebug() << "Invalid config file!"; return; } + if (!conf.contains("rooms")) { qDebug() << "Invalid config file (no rooms are set)!"; return; } QStringList rooms = conf.value("rooms").toStringList(); qDebug() << rooms; QString myRoom = ""; - for (QString roomName : rooms) + for (QString roomId : rooms) { - conf.beginGroup(roomName); + conf.beginGroup(roomId); + QString roomName = conf.value("name").toString(); + + /* fallback to the old format where the room id was actually just the name */ + if (roomName == "") { + roomName = roomId; + } if (!conf.contains("mgrIP")) { - qDebug() << "Invalid config file!"; + qDebug() << "Invalid config file (room " << roomName << " needs a mgrIP)!"; return; } QMap<QString, QPoint> clientPositions; diff --git a/src/server/util/util.h b/src/server/util/util.h index 144e692..98a56b6 100644 --- a/src/server/util/util.h +++ b/src/server/util/util.h @@ -6,8 +6,13 @@ // Use like this: // USER_SETTINGS(settings) // settings.value("somekey") -#define USER_SETTINGS(name) QSettings name (QSettings::IniFormat, QSettings::UserScope, "openslx/pvs2", "pvs2") -#define SYSTEM_SETTINGS(name) QSettings name (QSettings::IniFormat, QSettings::SystemScope, "openslx/pvs2", "pvs2") +#define USER_SETTINGS(name) \ + QSettings name (QSettings::IniFormat, QSettings::UserScope, "openslx/pvs2", "pvs2"); \ + name.setIniCodec("UTF-8"); + +#define SYSTEM_SETTINGS(name) \ + QSettings name (QSettings::IniFormat, QSettings::SystemScope, "openslx/pvs2", "pvs2"); \ + name.setIniCodec("UTF-8"); namespace Util { |