Alexandre Lision | 8af73cb | 2013-12-10 14:11:20 -0500 | [diff] [blame] | 1 | // Default empty project template |
| 2 | #ifndef ApplicationUI_HPP_ |
| 3 | #define ApplicationUI_HPP_ |
| 4 | |
| 5 | #include <QObject> |
| 6 | |
| 7 | #include "../../pjsua_app.h" |
| 8 | |
| 9 | namespace bb { namespace cascades { class Application; }} |
| 10 | |
| 11 | /*! |
| 12 | * @brief Application pane object |
| 13 | * |
| 14 | *Use this object to create and init app UI, to create context objects, to register the new meta types etc. |
| 15 | */ |
| 16 | class ApplicationUI : public QObject |
| 17 | { |
| 18 | Q_OBJECT |
| 19 | public: |
| 20 | ApplicationUI(bb::cascades::Application *app); |
| 21 | virtual ~ApplicationUI(); |
| 22 | |
| 23 | bool isShuttingDown; |
| 24 | static ApplicationUI *instance(); |
| 25 | |
| 26 | /* Write msg to label (from different thread) */ |
| 27 | static void extDisplayMsg(const char *msg); |
| 28 | |
| 29 | /* Restart request (from different thread) */ |
| 30 | void extRestartRequest(int argc, char **argv); |
| 31 | |
| 32 | public slots: |
| 33 | void aboutToQuit(); |
| 34 | |
| 35 | Q_INVOKABLE void restartPjsua(); |
| 36 | Q_INVOKABLE void displayMsg(const QString &msg); |
| 37 | |
| 38 | private: |
| 39 | static ApplicationUI *instance_; |
| 40 | char **restartArgv; |
| 41 | int restartArgc; |
| 42 | |
| 43 | /* pjsua main operations */ |
| 44 | void pjsuaStart(); |
| 45 | void pjsuaDestroy(); |
| 46 | |
| 47 | /* pjsua app callbacks */ |
| 48 | static void pjsuaOnStartedCb(pj_status_t status, const char* msg); |
| 49 | static void pjsuaOnStoppedCb(pj_bool_t restart, int argc, char** argv); |
| 50 | static void pjsuaOnAppConfigCb(pjsua_app_config *cfg); |
| 51 | }; |
| 52 | |
| 53 | |
| 54 | #endif /* ApplicationUI_HPP_ */ |