Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 1 | #ifndef CHATDIALOG_H |
| 2 | #define CHATDIALOG_H |
Zhenkai Zhu | b45e38a | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 3 | #include <boost/function.hpp> |
| 4 | #include <vector> |
| 5 | #include "digesttreescene.h" |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 6 | #include "ui_chatdialog.h" |
Zhenkai Zhu | 5a8d5aa | 2012-05-30 21:25:23 -0700 | [diff] [blame] | 7 | #include "chatbuf.pb.h" |
Zhenkai Zhu | 90ee76c | 2012-06-01 16:00:25 -0700 | [diff] [blame] | 8 | #include <sync-app-socket.h> |
Zhenkai Zhu | 85845d2 | 2012-06-01 23:10:43 -0700 | [diff] [blame] | 9 | #include <sync-logic.h> |
| 10 | #include <sync-seq-no.h> |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 11 | |
Zhenkai Zhu | 7e9b06d | 2012-06-02 00:44:42 -0700 | [diff] [blame^] | 12 | #define ORGANIZATION "IRL@UCLA" |
| 13 | #define APPLICATION "SYNC-DEMO" |
| 14 | |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 15 | class ChatDialog : public QDialog, private Ui::ChatDialog |
| 16 | { |
| 17 | Q_OBJECT |
| 18 | |
| 19 | public: |
| 20 | ChatDialog(QWidget *parent = 0); |
Zhenkai Zhu | b633882 | 2012-05-31 13:27:24 -0700 | [diff] [blame] | 21 | void appendMessage(const SyncDemo::ChatMessage &msg); |
Zhenkai Zhu | 85845d2 | 2012-06-01 23:10:43 -0700 | [diff] [blame] | 22 | void processData(const std::vector<Sync::MissingDataInfo> &, Sync::SyncAppSocket *); |
Zhenkai Zhu | b45e38a | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 23 | |
| 24 | private: |
| 25 | void formChatMessage(const QString &text, SyncDemo::ChatMessage &msg); |
Zhenkai Zhu | 7e9b06d | 2012-06-02 00:44:42 -0700 | [diff] [blame^] | 26 | void readSettings(); |
| 27 | void writeSettings(); |
| 28 | void updateLabels(); |
Zhenkai Zhu | 5a8d5aa | 2012-05-30 21:25:23 -0700 | [diff] [blame] | 29 | |
| 30 | private slots: |
| 31 | void returnPressed(); |
Zhenkai Zhu | 85845d2 | 2012-06-01 23:10:43 -0700 | [diff] [blame] | 32 | void buttonPressed(); |
Zhenkai Zhu | 7e9b06d | 2012-06-02 00:44:42 -0700 | [diff] [blame^] | 33 | void settingUpdated(QString, QString, QString); |
Zhenkai Zhu | 5a8d5aa | 2012-05-30 21:25:23 -0700 | [diff] [blame] | 34 | |
| 35 | private: |
| 36 | QString m_nick; |
| 37 | QString m_chatroom; |
Zhenkai Zhu | b45e38a | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 38 | QString m_prefix; |
| 39 | Sync::SyncAppSocket *m_sock; |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 40 | }; |
| 41 | #endif |