From 3d82bfc698165bb20f3c38d42f2b77ab855c1edf Mon Sep 17 00:00:00 2001 From: Christian Klinger Date: Thu, 29 Sep 2016 15:40:18 +0200 Subject: astyle. --- src/server/util/global.cpp | 46 ++++++++++++++++++++------------------- src/server/util/global.h | 54 ++++++++++++++++++++++++---------------------- 2 files changed, 52 insertions(+), 48 deletions(-) (limited to 'src/server/util') 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(), 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(), 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 Global::getSettings() { - QSharedPointer set; - if (_iniPath == "") { - /* default location (system scope) */ - set = QSharedPointer(new QSettings(QSettings::IniFormat, QSettings::SystemScope, "openslx/pvs2", "pvs2")); - } else { - /* use _iniPath to find ini file */ - set = QSharedPointer(new QSettings(Global::_iniPath, QSettings::IniFormat)); - } - set->setIniCodec("UTF-8"); - return set; +QSharedPointer Global::getSettings() +{ + QSharedPointer set; + if (_iniPath == "") { + /* default location (system scope) */ + set = QSharedPointer(new QSettings(QSettings::IniFormat, QSettings::SystemScope, "openslx/pvs2", "pvs2")); + } else { + /* use _iniPath to find ini file */ + set = QSharedPointer(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 struct Room { - Room(QMap cPos, QSize grid, QSize client, QString image, QString tutor) : - clientPositions(cPos), - gridSize(grid), - clientSize(client), - imagePath(image), - tutorIP(tutor){}; - QMap clientPositions; - QSize gridSize; - QSize clientSize; - QString imagePath; - QString tutorIP; + Room(QMap cPos, QSize grid, QSize client, QString image, QString tutor) : + clientPositions(cPos), + gridSize(grid), + clientSize(client), + imagePath(image), + tutorIP(tutor) {}; + QMap 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 _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 & roomList); - static const QMap & getRooms() { + static const QMap & getRooms() + { return _rooms; } - static void setIniPath(QString s) {_iniPath = s;}; - static QString getIniPath() { return _iniPath; }; - static QSharedPointer getSettings(); + static void setIniPath(QString s) {_iniPath = s;}; + static QString getIniPath() { return _iniPath; }; + static QSharedPointer 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(); }; -- cgit v1.2.3-55-g7522