summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Klinger2016-09-12 12:00:46 +0200
committerChristian Klinger2016-09-12 12:01:04 +0200
commit2f981e1ca6ad4b63bd3ba3da54997a0e40b352ca (patch)
treeab0bf89f16b5d556a55a6b2f38f9cced7de07f63
parentfix problem with ghost click. (diff)
downloadpvs2-2f981e1ca6ad4b63bd3ba3da54997a0e40b352ca.tar.gz
pvs2-2f981e1ca6ad4b63bd3ba3da54997a0e40b352ca.tar.xz
pvs2-2f981e1ca6ad4b63bd3ba3da54997a0e40b352ca.zip
Added support for a label field inside each room section + UTF8
-rw-r--r--src/server/mainwindow/mainwindow.cpp14
-rw-r--r--src/server/util/util.h9
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
{