#ifndef _DOODLE_MANAGER_H__ #define _DOODLE_MANAGER_H__ #include #include "../mainapp.h" namespace JusDoodle { typedef int SESSID; class DoodleSession; class DoodleManager : public QObject { Q_OBJECT private Q_SLOTS: void onServiceEvent(const QString &name, size_t cookie, const Notification &info); public: DoodleManager(QObject *parent = 0); virtual ~DoodleManager(); // singleton static DoodleManager *Instance(); // Initialization // Session create when MtcCallConnectingNotification received, // and delete when MtcCallTermedNotification or MtcCallDidTermNotification. // // All sessions will be deleted when MtcCliServerLogoutedNotification // or MtcCliServerDidLogoutNotification. // // Session has the same id of corresponding call. bool init(); // Start doodle session. // Show doodle window. When start for the first time, // MTC_DOODLE_ACTION_START action will be sent as well. bool startSess(SESSID sessId, int pageCount); // Stop doodle session, hide the doodle window. // Received data will be saved in session. void stopSess(SESSID sessId); // Set background images. void setBackgroundImages(SESSID sessId, const QStringList &imagePaths); // Interface when data received. Useless right now. void onRecvData(SESSID sessId, const char *name, const char *data); DoodleSession *findSess(SESSID sessId); Q_SIGNALS: // Emit after a session is created void sessCreated(int sessId); private: // Get session from ID. // Process call notification. bool onCallEvent(const QString &name, size_t cookie, const Notification &info); // Process client notification. bool onClientEvent(const QString &name, size_t cookie, const Notification &info); private: static DoodleManager *_pDoodleManager; std::map _SessMap; }; } // namespace JusDoodle #endif /* _DOODLE_MANAGER_H__ */