diff options
Diffstat (limited to 'src/client/clientapp/clientapp.h')
-rw-r--r-- | src/client/clientapp/clientapp.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/client/clientapp/clientapp.h b/src/client/clientapp/clientapp.h new file mode 100644 index 0000000..5571cb0 --- /dev/null +++ b/src/client/clientapp/clientapp.h @@ -0,0 +1,38 @@ +#include<QApplication> +#include "../toolbar/toolbar.h" +#include "../util/util.h" + + +/* define a macro `clientApp` that can be used anywhere in the program and returns a reference to the current ClientApp instance */ +#if defined(clientApp) +#undef clientApp +#endif +#define clientApp (static_cast<ClientApp*>(QCoreApplication::instance())) + +/* this class is supposed to (after complete refactoring) to encapsulate all + * state of the application. At the moment, the state is distributed within + * several widgets. With this class information access will also be easier as + * it is possible to access the current ClientApp instance from anywhere with + * the clientApp macro (like qApp) macro */ +class ClientApp : public QApplication { + + Q_OBJECT + + public: + enum ConnectionMode { None, Auto, Session }; + + private: + bool _examMode; + ConnectionMode _connectionMode; /* way of automatically connection to a session on startup*/ + QString _sessionName; /* only set when _connectionMode == Session */ + Toolbar* _toolbar; + + void initConfiguration(); + void parseParameters(); + + public: + + ClientApp(int& argc, char** argv); + + bool isExamMode() const { return _examMode; }; +}; |