qthighway/examples/serviceapp/src/serviceapp.h
changeset 4 90517678cc4f
parent 1 2b40d63a9c3d
child 19 46686fb6258c
equal deleted inserted replaced
1:2b40d63a9c3d 4:90517678cc4f
    26 #include <QModelIndex>
    26 #include <QModelIndex>
    27 #include <QMap>
    27 #include <QMap>
    28 #include <QStringList>
    28 #include <QStringList>
    29 #include <xqserviceprovider.h>
    29 #include <xqserviceprovider.h>
    30 #include <xqsharablefile.h>
    30 #include <xqsharablefile.h>
       
    31 #include <cntservicescontact.h>
    31 
    32 
    32 class QLineEdit;
    33 class QLineEdit;
    33 class QPushButton;
    34 class QPushButton;
    34 class DialerService;
    35 class DialerService;
    35 class UriService;
    36 class UriService;
    36 class QLabel;
    37 class QLabel;
    37 class FileService;
    38 class FileService;
    38 class XQSharableFile;
    39 class XQSharableFile;
       
    40 class NewDialerService;
       
    41 class NewUriService;
       
    42 class NewFileService;
    39 
    43 
    40 class ServiceApp : public QWidget
    44 class ServiceApp : public QWidget
    41 {
    45 {
    42     Q_OBJECT
    46     Q_OBJECT
    43 public:
    47 public:
    49 public slots:    
    53 public slots:    
    50     void endCall();
    54     void endCall();
    51     
    55     
    52 public slots:
    56 public slots:
    53     void quit();
    57     void quit();
    54     void answer();
    58     void answerDial();
    55     void handleAnswerDelivered();
    59     void answerUri();
       
    60     void answerFile();
    56     
    61     
    57 private:
    62 private:
    58     QLabel *mLabel;
    63     QLabel *mLabel;
    59     QLineEdit *mNumber;
    64     QLineEdit *mNumber;
    60     //QPushButton *mEndCallButton;
    65     //QPushButton *mEndCallButton;
    61     DialerService* mService;
    66     DialerService* mDialService;
    62     UriService* mUriService;
    67     UriService* mUriService;
    63     FileService* mFileService;
    68     FileService* mFileService;
       
    69     NewDialerService* mNewDialService;
       
    70     NewUriService* mNewUriService;
       
    71     NewFileService* mNewFileService;
    64 };
    72 };
    65 
    73 
    66 class DialerService : public XQServiceProvider
    74 class DialerService : public XQServiceProvider
    67 {
    75 {
    68     Q_OBJECT
    76     Q_OBJECT
    69 public:
    77 public:
    70     DialerService( ServiceApp *parent = 0 );
    78     DialerService( ServiceApp *parent = 0 );
    71     ~DialerService();
    79     ~DialerService();
    72     
    80     
    73     void complete(QString number);
    81     void complete(QString number);
    74     bool asyncAnswer() {return mAsyncAnswer;}
    82     bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
       
    83     
    75 public slots:
    84 public slots:
    76     int dial(const QString& number, bool asyncAnswer);
    85     int dial(const QString& number, bool asyncAnswer);
    77 
    86     QVariant testVariant(QVariant variant);
    78 private slots:
    87     CntServicesContactList testContactList(CntServicesContactList list);
       
    88 
       
    89 protected slots:
    79    void handleClientDisconnect();
    90    void handleClientDisconnect();
    80 
    91    void handleAnswerDelivered();
    81 private:
    92 
       
    93 protected:
       
    94     void showRecipients(QVariant &value);
       
    95     void showRecipients(CntServicesContactList &value);
       
    96 
       
    97 protected:
    82     ServiceApp* mServiceApp;
    98     ServiceApp* mServiceApp;
    83     QString mNumber;
    99     QString mNumber;
    84     bool mAsyncAnswer;
   100     QMap<quint32,int> mAsyncReqIds;
    85     int mAsyncReqId;
   101 };
    86 };
   102 
       
   103 
       
   104 class NewDialerService : public XQServiceProvider
       
   105 {
       
   106     Q_OBJECT
       
   107     public:
       
   108         NewDialerService( ServiceApp *parent = 0 );
       
   109         ~NewDialerService();
       
   110 
       
   111         void complete(QString number);
       
   112         bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
       
   113 
       
   114     public slots:
       
   115             int dial(const QString& number, bool asyncAnswer);
       
   116     QVariant testVariant(QVariant variant);
       
   117     CntServicesContactList testContactList(CntServicesContactList list);
       
   118 
       
   119     protected slots:
       
   120             void handleClientDisconnect();
       
   121     void handleAnswerDelivered();
       
   122 
       
   123     protected:
       
   124         void showRecipients(QVariant &value);
       
   125         void showRecipients(CntServicesContactList &value);
       
   126 
       
   127     protected:
       
   128         ServiceApp* mServiceApp;
       
   129         QString mNumber;
       
   130         QMap<quint32,int> mAsyncReqIds;
       
   131 };
       
   132 
       
   133 
    87 
   134 
    88 class UriService : public XQServiceProvider
   135 class UriService : public XQServiceProvider
    89 {
   136 {
    90     Q_OBJECT
   137     Q_OBJECT
    91     public:
   138     public:
    92         UriService( ServiceApp *parent = 0 );
   139         UriService( ServiceApp *parent = 0 );
    93         ~UriService();
   140         ~UriService();
    94         bool asyncAnswer() {return mAsyncAnswer;}
   141         bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
    95         void complete(bool ok);
   142         void complete(bool ok);
    96         
   143         
    97     public slots:
   144     public slots:
    98         bool view(const QString& uri);
   145         bool view(const QString& uri);
    99         bool view(const QString& uri, bool returnValue);
   146         bool view(const QString& uri, bool returnValue);
   100         
   147         
   101     private slots:
   148     private slots:
   102         void handleClientDisconnect();
   149         void handleClientDisconnect();
   103 
   150         void handleAnswerDelivered();
   104     private:
   151 
   105         ServiceApp* mServiceApp;
   152     private:
   106         bool mAsyncAnswer;
   153         ServiceApp* mServiceApp;
   107         int mAsyncReqId;
   154         QMap<quint32,int> mAsyncReqIds;
   108         bool mRetValue;
   155         bool mRetValue;
   109 };
   156 };
       
   157 
       
   158 
       
   159 class NewUriService : public XQServiceProvider
       
   160 {
       
   161     Q_OBJECT
       
   162     public:
       
   163         NewUriService( ServiceApp *parent = 0 );
       
   164         ~NewUriService();
       
   165         bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
       
   166         void complete(bool ok);
       
   167 
       
   168     public slots:
       
   169             bool view(const QString& uri);
       
   170     bool view(const QString& uri, bool returnValue);
       
   171 
       
   172     private slots:
       
   173             void handleClientDisconnect();
       
   174     void handleAnswerDelivered();
       
   175 
       
   176     private:
       
   177         ServiceApp* mServiceApp;
       
   178         QMap<quint32,int> mAsyncReqIds;
       
   179         bool mRetValue;
       
   180 };
       
   181 
   110 
   182 
   111 class FileService : public XQServiceProvider
   183 class FileService : public XQServiceProvider
   112 {
   184 {
   113     Q_OBJECT
   185     Q_OBJECT
   114     public:
   186     public:
   115         FileService( ServiceApp *parent = 0 );
   187         FileService( ServiceApp *parent = 0 );
   116         ~FileService();
   188         ~FileService();
   117         bool asyncAnswer() {return mAsyncAnswer;}
   189         bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
       
   190         void complete(bool ok);
       
   191 
       
   192     public slots:
       
   193             bool view(QString file);
       
   194     bool view(XQSharableFile file);
       
   195 
       
   196     private slots:
       
   197             void handleClientDisconnect();
       
   198     void handleAnswerDelivered();
       
   199 
       
   200     private:
       
   201         ServiceApp* mServiceApp;
       
   202         QMap<quint32,int> mAsyncReqIds;
       
   203         bool mRetValue;
       
   204 };
       
   205 
       
   206 
       
   207 class NewFileService : public XQServiceProvider
       
   208 {
       
   209     Q_OBJECT
       
   210     public:
       
   211         NewFileService( ServiceApp *parent = 0 );
       
   212         ~NewFileService();
       
   213         bool asyncAnswer() {return mAsyncReqIds.count() > 0;}
   118         void complete(bool ok);
   214         void complete(bool ok);
   119 
   215 
   120     public slots:
   216     public slots:
   121         bool view(QString file);
   217         bool view(QString file);
   122         bool view(XQSharableFile file);
   218         bool view(XQSharableFile file);
   123         
   219         
   124     private slots:
   220     private slots:
   125         void handleClientDisconnect();
   221         void handleClientDisconnect();
   126 
   222         void handleAnswerDelivered();
   127     private:
   223 
   128         ServiceApp* mServiceApp;
   224     private:
   129         bool mAsyncAnswer;
   225         ServiceApp* mServiceApp;
   130         int mAsyncReqId;
   226         QMap<quint32,int> mAsyncReqIds;
   131         bool mRetValue;
   227         bool mRetValue;
   132 };
   228 };
       
   229 
       
   230 
   133 
   231 
   134 
   232 
   135 #endif
   233 #endif