| #ifndef CHATDIALOG_H |
| #define CHATDIALOG_H |
| #include <boost/function.hpp> |
| #include <boost/thread/mutex.hpp> |
| #include <vector> |
| #include "digesttreescene.h" |
| #include "ui_chatdialog.h" |
| #include "chatbuf.pb.h" |
| #include <sync-app-socket.h> |
| #include <sync-logic.h> |
| #include <sync-seq-no.h> |
| |
| #define ORGANIZATION "IRL@UCLA" |
| #define APPLICATION "SYNC-DEMO" |
| |
| class ChatDialog : public QDialog, private Ui::ChatDialog |
| { |
| Q_OBJECT |
| |
| public: |
| ChatDialog(QWidget *parent = 0); |
| ~ChatDialog(); |
| void processRemove(const std::string); |
| void appendMessage(const SyncDemo::ChatMessage msg); |
| void processTreeUpdateWrapper(const std::vector<Sync::MissingDataInfo>, Sync::SyncAppSocket *); |
| void processDataWrapper(std::string, const char *buf, size_t len); |
| |
| public slots: |
| void processTreeUpdate(const std::vector<Sync::MissingDataInfo>); |
| void processData(QString name, const char *buf, size_t len); |
| |
| private: |
| void formChatMessage(const QString &text, SyncDemo::ChatMessage &msg); |
| bool readSettings(); |
| void writeSettings(); |
| void updateLabels(); |
| void resizeEvent(QResizeEvent *); |
| void showEvent(QShowEvent *); |
| void fitView(); |
| void testDraw(); |
| |
| private slots: |
| void returnPressed(); |
| void buttonPressed(); |
| void checkSetting(); |
| void settingUpdated(QString, QString, QString); |
| |
| signals: |
| void dataReceived(QString name, const char *buf, size_t len); |
| void treeUpdated(const std::vector<Sync::MissingDataInfo>); |
| |
| private: |
| User m_user; |
| Sync::SyncAppSocket *m_sock; |
| uint32_t m_session; |
| DigestTreeScene *m_scene; |
| boost::mutex m_msgMutex; |
| boost::mutex m_sceneMutex; |
| }; |
| #endif |