Zhenkai Zhu | fd52ab7 | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 1 | #ifndef CHATDIALOG_H |
| 2 | #define CHATDIALOG_H |
Zhenkai Zhu | 9ec8f41 | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 3 | #include <boost/function.hpp> |
| 4 | #include <vector> |
| 5 | #include "digesttreescene.h" |
Zhenkai Zhu | fd52ab7 | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 6 | #include "ui_chatdialog.h" |
Zhenkai Zhu | c71da77 | 2012-05-30 21:25:23 -0700 | [diff] [blame] | 7 | #include "chatbuf.pb.h" |
Zhenkai Zhu | ea02698 | 2012-06-01 16:00:25 -0700 | [diff] [blame] | 8 | #include <sync-app-socket.h> |
Zhenkai Zhu | 275ba3a | 2012-06-01 23:10:43 -0700 | [diff] [blame] | 9 | #include <sync-logic.h> |
| 10 | #include <sync-seq-no.h> |
Zhenkai Zhu | fd52ab7 | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 11 | |
Zhenkai Zhu | 3472e3f | 2012-06-02 00:44:42 -0700 | [diff] [blame] | 12 | #define ORGANIZATION "IRL@UCLA" |
| 13 | #define APPLICATION "SYNC-DEMO" |
| 14 | |
Zhenkai Zhu | fd52ab7 | 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 | 36c6b78 | 2012-06-04 17:11:04 -0700 | [diff] [blame] | 21 | ~ChatDialog(); |
Zhenkai Zhu | 2c55b38 | 2012-05-31 13:27:24 -0700 | [diff] [blame] | 22 | void appendMessage(const SyncDemo::ChatMessage &msg); |
Zhenkai Zhu | 36c6b78 | 2012-06-04 17:11:04 -0700 | [diff] [blame] | 23 | void processTreeUpdate(const std::vector<Sync::MissingDataInfo> &, Sync::SyncAppSocket *); |
| 24 | void processData(std::string, const char *buf, size_t len); |
| 25 | void processRemove(const std::string); |
Zhenkai Zhu | 9ec8f41 | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 26 | |
| 27 | private: |
| 28 | void formChatMessage(const QString &text, SyncDemo::ChatMessage &msg); |
Zhenkai Zhu | 36c6b78 | 2012-06-04 17:11:04 -0700 | [diff] [blame] | 29 | bool readSettings(); |
Zhenkai Zhu | 3472e3f | 2012-06-02 00:44:42 -0700 | [diff] [blame] | 30 | void writeSettings(); |
| 31 | void updateLabels(); |
Zhenkai Zhu | e566093 | 2012-06-04 15:25:20 -0700 | [diff] [blame] | 32 | void resizeEvent(QResizeEvent *); |
| 33 | void showEvent(QShowEvent *); |
| 34 | void fitView(); |
Zhenkai Zhu | 88380c1 | 2012-06-04 21:23:34 -0700 | [diff] [blame^] | 35 | void testDraw(); |
Zhenkai Zhu | c71da77 | 2012-05-30 21:25:23 -0700 | [diff] [blame] | 36 | |
| 37 | private slots: |
| 38 | void returnPressed(); |
Zhenkai Zhu | 275ba3a | 2012-06-01 23:10:43 -0700 | [diff] [blame] | 39 | void buttonPressed(); |
Zhenkai Zhu | 3472e3f | 2012-06-02 00:44:42 -0700 | [diff] [blame] | 40 | void settingUpdated(QString, QString, QString); |
Zhenkai Zhu | c71da77 | 2012-05-30 21:25:23 -0700 | [diff] [blame] | 41 | |
| 42 | private: |
Zhenkai Zhu | 56a8859 | 2012-06-04 09:42:53 -0700 | [diff] [blame] | 43 | User m_user; |
Zhenkai Zhu | 9ec8f41 | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 44 | Sync::SyncAppSocket *m_sock; |
Zhenkai Zhu | 36c6b78 | 2012-06-04 17:11:04 -0700 | [diff] [blame] | 45 | uint32_t m_session; |
| 46 | DigestTreeScene *m_scene; |
Zhenkai Zhu | fd52ab7 | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 47 | }; |
| 48 | #endif |