blob: 9ca77c09d933aa4f5d913036a6a64ac9aaab5a0c [file] [log] [blame]
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -07001#ifndef CHATDIALOG_H
2#define CHATDIALOG_H
Zhenkai Zhub45e38a2012-06-01 15:44:36 -07003#include <boost/function.hpp>
4#include <vector>
5#include "digesttreescene.h"
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -07006#include "ui_chatdialog.h"
Zhenkai Zhu5a8d5aa2012-05-30 21:25:23 -07007#include "chatbuf.pb.h"
Zhenkai Zhu90ee76c2012-06-01 16:00:25 -07008#include <sync-app-socket.h>
Zhenkai Zhu85845d22012-06-01 23:10:43 -07009#include <sync-logic.h>
10#include <sync-seq-no.h>
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070011
Zhenkai Zhu7e9b06d2012-06-02 00:44:42 -070012#define ORGANIZATION "IRL@UCLA"
13#define APPLICATION "SYNC-DEMO"
14
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070015class ChatDialog : public QDialog, private Ui::ChatDialog
16{
17 Q_OBJECT
18
19public:
20 ChatDialog(QWidget *parent = 0);
Zhenkai Zhub6338822012-05-31 13:27:24 -070021 void appendMessage(const SyncDemo::ChatMessage &msg);
Zhenkai Zhu85845d22012-06-01 23:10:43 -070022 void processData(const std::vector<Sync::MissingDataInfo> &, Sync::SyncAppSocket *);
Zhenkai Zhub45e38a2012-06-01 15:44:36 -070023
24private:
25 void formChatMessage(const QString &text, SyncDemo::ChatMessage &msg);
Zhenkai Zhu7e9b06d2012-06-02 00:44:42 -070026 void readSettings();
27 void writeSettings();
28 void updateLabels();
Zhenkai Zhud13acd02012-06-04 15:25:20 -070029 void resizeEvent(QResizeEvent *);
30 void showEvent(QShowEvent *);
31 void fitView();
Zhenkai Zhu5a8d5aa2012-05-30 21:25:23 -070032
33private slots:
34 void returnPressed();
Zhenkai Zhu85845d22012-06-01 23:10:43 -070035 void buttonPressed();
Zhenkai Zhu7e9b06d2012-06-02 00:44:42 -070036 void settingUpdated(QString, QString, QString);
Zhenkai Zhu5a8d5aa2012-05-30 21:25:23 -070037
38private:
Zhenkai Zhu71b42cb2012-06-04 09:42:53 -070039 User m_user;
Zhenkai Zhub45e38a2012-06-01 15:44:36 -070040 Sync::SyncAppSocket *m_sock;
Zhenkai Zhu6d589aa2012-05-29 17:34:35 -070041};
42#endif