summaryrefslogtreecommitdiffstats
path: root/src/server/serverapp/serverapp.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/serverapp/serverapp.h')
-rw-r--r--src/server/serverapp/serverapp.h32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/server/serverapp/serverapp.h b/src/server/serverapp/serverapp.h
index e0a1351..3cb40b5 100644
--- a/src/server/serverapp/serverapp.h
+++ b/src/server/serverapp/serverapp.h
@@ -5,10 +5,10 @@
#include <QStringList>
#include <QMap>
-#include "../mainwindow/mainwindow.h"
+class QSettings;
struct Room {
- Room(QMap<QString, QPoint> cPos, QSize grid, QSize client, QString image, QString tutor) :
+ Room(const QMap<QString, QPoint> &cPos, const QSize &grid, const QSize &client, const QString &image, const QString &tutor) :
clientPositions(cPos),
gridSize(grid),
clientSize(client),
@@ -23,12 +23,12 @@ struct Room {
/* define a macro `serverApp` that can be used anywhere in the program and
- * returns a reference to the current ClientApp instance */
+ * returns a reference to the current ServerApp instance */
#if defined(serverApp)
#undef serverApp
#endif
-#define serverApp (static_cast<ServerApp*>(QCoreApplication::instance()))
+#define serverApp (static_cast<ServerApp*>(QCoreApplication::instance())) // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
/* this class is supposed to (after complete refactoring) to encapsulate all
* state of the application. At the moment, the state is distributed within
@@ -42,15 +42,15 @@ class ServerApp : public QApplication
private:
QStringList _arguments;
- MainWindow* _mainWindow;
QString _sessionName;
QByteArray _sessionNameArray;
QMap<QString, Room*> _rooms;
QString _currentRoom;
+ bool _doExit{};
- bool _managerOnly;
- bool _isExam;
+ bool _managerOnly{};
+ bool _isExam{};
QString _iniPath;
QStringList parseParameters();
@@ -64,23 +64,21 @@ public:
/* getters */
- const QString& sessionName() { return _sessionName; }
- const QByteArray& sessionNameArray() { return _sessionNameArray; }
- const QMap<QString, Room*> & rooms() { return _rooms; }
- const QString& getCurrentRoomName() { return _currentRoom; }
- const QMap<QString, Room*>& getRooms() { return _rooms; }
- bool isExam() { return _isExam; }
- bool isManagerOnly() { return _managerOnly; }
- const Room* getCurrentRoom();
- QSharedPointer<QSettings> getSettings();
+ const QString &sessionName() const { return _sessionName; }
+ const QByteArray &sessionNameArray() const { return _sessionNameArray; }
+ const QMap<QString, Room *> &getRooms() const { return _rooms; }
+ bool isExam() const { return _isExam; }
+ const Room* getCurrentRoom() const;
+ QSettings * getSettings();
/* setters */
void setSessionName(const QString& name);
void setSessionName();
- void setIniPath(QString s) { _iniPath = s; };
void setCurrentRoom(const QString& room) { _currentRoom = room; }
void setExam(bool exam) { _isExam = exam; }
+ bool shouldExit() const { return _doExit; }
+
};
#endif