Blame view

LiveChat/FeiTalk/JusDoodle/DoodleSession.h 1.89 KB
9f17d59e   陈明泉   no message
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
  #ifndef _DOODLE_SESSION_H__
  #define _DOODLE_SESSION_H__
  
  #include <QtCore>
  #include "../mainapp.h"
  #include "avatar/zos/zos_type.h"
  #include "lemon/service/rcs/mtc_doodle.h"
  #include "DoodlePage.h"
  
  namespace JusDoodle {
  class DoodleWindow;
  
  class DoodleSession : public QObject
  {
      Q_OBJECT
  
  public:
      DoodleSession(int sessId, QObject *parent = 0);
      virtual ~DoodleSession();
  
      // Initialization
      // The session can process data received.
      bool init();
  
      // Start doodle, show doodle window.
      // When start for the first time, 
      // EN_MTC_DOODLE_ACTION_START action will be sent as well.
      bool start(int pageCount);
  
      // Stop doodle, hide doodle window.
      void stop();
  
      // Set background images.
      void setBackgroundImages(const QStringList &imagePaths);
  
      // Process data received.
      void recvData(const QString &name, const QString &data);
  
      // Process file received.
      void recvFile(const QString &name, const QString &path, int pageId);
  
      // Initialize doodle window
      void initWindow(int pageCount);
  
  public Q_SLOTS:
      // Format EN_MTC_DOODLE_ACTION_SELECT_PAGE action and send to peer.
      void onNotifyPageChanged(int pageId);
  
      // Format EN_MTC_DOODLE_ACTION_CLEAN action and send to peer.
      void onNotifyClean(int pageId);
  
      // Format EN_MTC_DOODLE_ACTION_DRAW action and send to peer.
      void onNotifyDrawPath(int pageId, const Path &path,
          const QColor &color, double width);
  
      // Format EN_MTC_DOODLE_ACTION_ERASE action and send to peer.
      void onNotifyErasePath(int pageId, const Path &path,
          double width);
  
  private:
      // Read path information from action.
      void readPath(MTC_ACT action, Path &path);
  
      // Do action.
      void procAction(MTC_ACT action);
  
  public:
      DoodleWindow *_doodleWindow;
  private:
      MTC_SESS _doodleSess;
      int _sessId;
      bool _isCall;
  };
  
  } // namespace JusDoodle
  
  #endif /* _DOODLE_SESSION_H__ */