summaryrefslogtreecommitdiffstats
path: root/src/server/util
diff options
context:
space:
mode:
authorChristian Klinger2016-09-29 15:40:18 +0200
committerChristian Klinger2016-09-29 15:40:18 +0200
commit3d82bfc698165bb20f3c38d42f2b77ab855c1edf (patch)
tree2c170bcdd5c89259bb0b530fa11fdfe701c99850 /src/server/util
parentadded an information dialog that displays ip and hostname. (diff)
downloadpvs2-3d82bfc698165bb20f3c38d42f2b77ab855c1edf.tar.gz
pvs2-3d82bfc698165bb20f3c38d42f2b77ab855c1edf.tar.xz
pvs2-3d82bfc698165bb20f3c38d42f2b77ab855c1edf.zip
astyle.
Diffstat (limited to 'src/server/util')
-rw-r--r--src/server/util/global.cpp46
-rw-r--r--src/server/util/global.h54
2 files changed, 52 insertions, 48 deletions
diff --git a/src/server/util/global.cpp b/src/server/util/global.cpp
index 990eee1..97c0355 100644
--- a/src/server/util/global.cpp
+++ b/src/server/util/global.cpp
@@ -36,31 +36,33 @@ void Global::setCurrentRoom(QString room)
Global::_currentRoom = room;
}
-const Room* Global::getCurrentRoom() {
- if (_rooms.contains(_currentRoom)) {
- return _rooms[_currentRoom];
- } else {
- static Room* defaultRoom = NULL;
- if (defaultRoom == NULL) {
- defaultRoom = new Room(QMap<QString, QPoint>(), QSize(8, 6), QSize(1,1), "", "");
- }
- return defaultRoom;
- }
+const Room* Global::getCurrentRoom()
+{
+ if (_rooms.contains(_currentRoom)) {
+ return _rooms[_currentRoom];
+ } else {
+ static Room* defaultRoom = NULL;
+ if (defaultRoom == NULL) {
+ defaultRoom = new Room(QMap<QString, QPoint>(), QSize(8, 6), QSize(1, 1), "", "");
+ }
+ return defaultRoom;
+ }
}
-bool Global::manager_only = false;
+bool Global::manager_only = false;
bool Global::_isExam = false;
QString Global::_iniPath = "";
-QSharedPointer<QSettings> Global::getSettings() {
- QSharedPointer<QSettings> set;
- if (_iniPath == "") {
- /* default location (system scope) */
- set = QSharedPointer<QSettings>(new QSettings(QSettings::IniFormat, QSettings::SystemScope, "openslx/pvs2", "pvs2"));
- } else {
- /* use _iniPath to find ini file */
- set = QSharedPointer<QSettings>(new QSettings(Global::_iniPath, QSettings::IniFormat));
- }
- set->setIniCodec("UTF-8");
- return set;
+QSharedPointer<QSettings> Global::getSettings()
+{
+ QSharedPointer<QSettings> set;
+ if (_iniPath == "") {
+ /* default location (system scope) */
+ set = QSharedPointer<QSettings>(new QSettings(QSettings::IniFormat, QSettings::SystemScope, "openslx/pvs2", "pvs2"));
+ } else {
+ /* use _iniPath to find ini file */
+ set = QSharedPointer<QSettings>(new QSettings(Global::_iniPath, QSettings::IniFormat));
+ }
+ set->setIniCodec("UTF-8");
+ return set;
}
diff --git a/src/server/util/global.h b/src/server/util/global.h
index 6ab1c42..ce1c2ab 100644
--- a/src/server/util/global.h
+++ b/src/server/util/global.h
@@ -19,31 +19,32 @@
#include <QSharedPointer>
struct Room {
- Room(QMap<QString, QPoint> cPos, QSize grid, QSize client, QString image, QString tutor) :
- clientPositions(cPos),
- gridSize(grid),
- clientSize(client),
- imagePath(image),
- tutorIP(tutor){};
- QMap<QString, QPoint> clientPositions;
- QSize gridSize;
- QSize clientSize;
- QString imagePath;
- QString tutorIP;
+ Room(QMap<QString, QPoint> cPos, QSize grid, QSize client, QString image, QString tutor) :
+ clientPositions(cPos),
+ gridSize(grid),
+ clientSize(client),
+ imagePath(image),
+ tutorIP(tutor) {};
+ QMap<QString, QPoint> clientPositions;
+ QSize gridSize;
+ QSize clientSize;
+ QString imagePath;
+ QString tutorIP;
};
-class Global {
+class Global
+{
private:
- Global(){}
- ~Global(){}
+ Global() {}
+ ~Global() {}
static QString _sessionName;
static QByteArray _sessionNameArray;
static QMap<QString, Room*> _rooms;
static QString _currentRoom;
- static bool _isExam;
- static QString _iniPath;
+ static bool _isExam;
+ static QString _iniPath;
public:
static const QString& sessionName() { return Global::_sessionName; }
@@ -51,26 +52,27 @@ public:
static void setSessionName(const QString& name);
static void setSessionName();
- static bool manager_only;
+ static bool manager_only;
static void setRooms(const QMap<QString, Room*> & roomList);
- static const QMap<QString, Room*> & getRooms() {
+ static const QMap<QString, Room*> & getRooms()
+ {
return _rooms;
}
- static void setIniPath(QString s) {_iniPath = s;};
- static QString getIniPath() { return _iniPath; };
- static QSharedPointer<QSettings> getSettings();
+ static void setIniPath(QString s) {_iniPath = s;};
+ static QString getIniPath() { return _iniPath; };
+ static QSharedPointer<QSettings> getSettings();
- static bool isExam() { return _isExam; }
- static void setExam(bool b) { _isExam = b; }
+ static bool isExam() { return _isExam; }
+ static void setExam(bool b) { _isExam = b; }
static void setCurrentRoom(QString room);
static const QString& getCurrentRoomName() { return _currentRoom; }
- /* returns a pointer to the current room or a pointer to the constant "defaultRoom".
- * (NEVER returns NULL or undefined) */
- static const Room* getCurrentRoom();
+ /* returns a pointer to the current room or a pointer to the constant "defaultRoom".
+ * (NEVER returns NULL or undefined) */
+ static const Room* getCurrentRoom();
};