Pool Video Switch v2
Software video switch for distributed remote display in a lecture environment
clientapp.h
Go to the documentation of this file.
1 #include "../util/util.h"
2 #include "../net/serverconnection.h"
3 
4 #include <QApplication>
5 #include <QSharedPointer>
6 #include <QSettings>
7 
8 /* define a macro `clientApp` that can be used anywhere in the program and returns a reference to the current ClientApp instance */
9 #if defined(clientApp)
10 #undef clientApp
11 #endif
12 #define clientApp (static_cast<ClientApp*>(QCoreApplication::instance())) // NOLINT(cppcoreguidelines-pro-type-static-cast-downcast)
13 
14 class Toolbar;
15 class ConnectWindow;
16 
17 /* this class is supposed to (after complete refactoring) to encapsulate all
18  * state of the application. At the moment, the state is distributed within
19  * several widgets. With this class information access will also be easier as
20  * it is possible to access the current ClientApp instance from anywhere with
21  * the clientApp macro (like qApp) macro */
22 class ClientApp : public QApplication
23 {
24 
25  Q_OBJECT
26 
27 public:
29 
30 private:
31  ConnectionMode _connectionMode; /* way of automatically connection to a session on startup*/
32  bool _examMode;
33  QString _sessionName; /* only set when _connectionMode == Session */
37  QStringList _arguments;
38  QString _iniPath;
39 
40  QStringList parseParameters();
41 
42 public:
43 
44  ClientApp(int& argc, char** argv);
45 
46  bool isExamMode() const { return _examMode; };
47 
48  virtual QStringList arguments();
49 
50  QSharedPointer<QSettings> getSettings();
51 
53 
55 
56  bool isConnectedToLocalManager() const { return _connection != nullptr && _connection->isLocalConnection(); }
57 
58 private slots:
59 
62 
63 };
Class for handling the client connection.
Definition: connectwindow.h:41
ConnectionMode
Definition: clientapp.h:28
QStringList _arguments
Definition: clientapp.h:37
bool isConnectedToLocalManager() const
Definition: clientapp.h:56
QStringList parseParameters()
Definition: clientapp.cpp:59
ConnectWindow * connectWindow() const
Definition: clientapp.h:54
ConnectionMode _connectionMode
Definition: clientapp.h:31
virtual QStringList arguments()
Definition: clientapp.cpp:79
ServerConnection * connection() const
Definition: clientapp.h:52
bool isExamMode() const
Definition: clientapp.h:46
bool _examMode
Definition: clientapp.h:32
ServerConnection * _connection
Definition: clientapp.h:36
ClientApp(int &argc, char **argv)
Definition: clientapp.cpp:11
QSharedPointer< QSettings > getSettings()
Definition: clientapp.cpp:84
QString _sessionName
Definition: clientapp.h:33
Toolbar * _toolbar
Definition: clientapp.h:34
void disconnected(ServerConnection *connection)
Definition: clientapp.cpp:104
ConnectWindow * _connectWindow
Definition: clientapp.h:35
void connected(ServerConnection *connection)
Definition: clientapp.cpp:98
QString _iniPath
Definition: clientapp.h:38