summaryrefslogtreecommitdiff
path: root/pjsip-apps/src/pjsua/bb10/src/applicationui.h
blob: 8dbb17c21bf75f85fccc1e7f01cd6f12c2532c28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Default empty project template
#ifndef ApplicationUI_HPP_
#define ApplicationUI_HPP_

#include <QObject>

#include "../../pjsua_app.h"

namespace bb { namespace cascades { class Application; }}

/*!
 * @brief Application pane object
 *
 *Use this object to create and init app UI, to create context objects, to register the new meta types etc.
 */
class ApplicationUI : public QObject
{
    Q_OBJECT
public:
    ApplicationUI(bb::cascades::Application *app);
    virtual ~ApplicationUI();

    bool isShuttingDown;
    static ApplicationUI *instance();

    /* Write msg to label (from different thread) */
    static void extDisplayMsg(const char *msg);

    /* Restart request (from different thread) */
    void extRestartRequest(int argc, char **argv);

public slots:
    void aboutToQuit();

    Q_INVOKABLE void restartPjsua();
    Q_INVOKABLE void displayMsg(const QString &msg);

private:
    static ApplicationUI *instance_;
    char **restartArgv;
    int restartArgc;

    /* pjsua main operations */
    void pjsuaStart();
    void pjsuaDestroy();

    /* pjsua app callbacks */
    static void 	pjsuaOnStartedCb(pj_status_t status, const char* msg);
    static pj_bool_t 	pjsuaOnStoppedCb(pj_bool_t restart, int argc, char** argv);
    static void 	pjsuaOnAppConfigCb(pjsua_app_config *cfg);
};


#endif /* ApplicationUI_HPP_ */