Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 4 | * Yingdi Yu |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 5 | * |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 6 | * BSD license, See the LICENSE file for more information |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 7 | * |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 8 | * Author: Zhenkai Zhu <zhenkai@cs.ucla.edu> |
| 9 | * Alexander Afanasyev <alexander.afanasyev@ucla.edu> |
| 10 | * Yingdi Yu <yingdi@cs.ucla.edu> |
Alexander Afanasyev | b4b9229 | 2013-07-09 13:54:59 -0700 | [diff] [blame] | 11 | */ |
| 12 | |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 13 | #ifndef CHATDIALOG_H |
| 14 | #define CHATDIALOG_H |
Alexander Afanasyev | f829f4d | 2013-05-07 15:59:36 -0700 | [diff] [blame] | 15 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 16 | #include <QDialog> |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 17 | #include <QTextTable> |
| 18 | #include <QStringListModel> |
| 19 | #include <QTimer> |
Yingdi Yu | 83eae84 | 2013-11-06 22:07:38 -0800 | [diff] [blame] | 20 | #include <QSystemTrayIcon> |
Yingdi Yu | 702d6f1 | 2013-11-07 17:00:54 -0800 | [diff] [blame] | 21 | #include <QMenu> |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 22 | |
| 23 | #include "invitelistdialog.h" |
Alexander Afanasyev | f829f4d | 2013-05-07 15:59:36 -0700 | [diff] [blame] | 24 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 25 | #ifndef Q_MOC_RUN |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 26 | #include <ndn-cpp/data.hpp> |
| 27 | #include <ndn-cpp/face.hpp> |
Yingdi Yu | f8f572d | 2014-01-13 11:19:47 -0800 | [diff] [blame^] | 28 | #include <ndn-cpp/security/key-chain.hpp> |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 29 | #include "invitation-policy-manager.h" |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame] | 30 | #include "contact-item.h" |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 31 | |
Alexander Afanasyev | 4a97931 | 2013-11-07 15:30:05 -0800 | [diff] [blame] | 32 | #include <sync-socket.h> |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 33 | #include <sync-seq-no.h> |
| 34 | #include "chatbuf.pb.h" |
| 35 | #include "digesttreescene.h" |
Yingdi Yu | 6eabbd7 | 2013-12-27 08:44:12 +0800 | [diff] [blame] | 36 | |
| 37 | #include <boost/thread/locks.hpp> |
| 38 | #include <boost/thread/recursive_mutex.hpp> |
| 39 | #include <boost/thread/thread.hpp> |
Alexander Afanasyev | f829f4d | 2013-05-07 15:59:36 -0700 | [diff] [blame] | 40 | #endif |
| 41 | |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 42 | typedef ndn::func_lib::function<void()> OnEventualTimeout; |
| 43 | |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 44 | #define MAX_HISTORY_ENTRY 20 |
| 45 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 46 | namespace Ui { |
| 47 | class ChatDialog; |
| 48 | } |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 49 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 50 | class ChatDialog : public QDialog |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 51 | { |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 52 | Q_OBJECT |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 53 | |
| 54 | public: |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 55 | explicit ChatDialog(ndn::ptr_lib::shared_ptr<ContactManager> contactManager, |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 56 | const ndn::Name& chatroomPrefix, |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 57 | const ndn::Name& localPrefix, |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame] | 58 | const ndn::Name& defaultIdentity, |
Yingdi Yu | 4694828 | 2013-11-06 18:43:31 -0800 | [diff] [blame] | 59 | const std::string& nick, |
| 60 | bool trial = false, |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 61 | QWidget *parent = 0); |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 62 | |
| 63 | // explicit ChatDialog(const ndn::Name& chatroomPrefix, |
| 64 | // const ndn::Name& localPrefix, |
| 65 | // const ndn::Name& defaultIdentity, |
| 66 | // const ndn::security::IdentityCertificate& identityCertificate, |
| 67 | // QWidget *parent = 0); |
| 68 | |
Zhenkai Zhu | 82a6275 | 2012-06-04 17:11:04 -0700 | [diff] [blame] | 69 | ~ChatDialog(); |
Zhenkai Zhu | b45e38a | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 70 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 71 | const ndn::Name& |
| 72 | getChatroomPrefix() const |
| 73 | { return m_chatroomPrefix; } |
Zhenkai Zhu | 3a008fc | 2012-06-08 17:36:39 -0700 | [diff] [blame] | 74 | |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 75 | const ndn::Name& |
| 76 | getLocalPrefix() const |
| 77 | { return m_localPrefix; } |
| 78 | |
| 79 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 80 | sendInvitation(ndn::ptr_lib::shared_ptr<ContactItem> contact, bool isIntroducer); |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 81 | |
| 82 | void |
| 83 | addTrustAnchor(const EndorseCertificate& selfEndorseCertificate); |
| 84 | |
| 85 | void |
| 86 | addChatDataRule(const ndn::Name& prefix, |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 87 | const ndn::IdentityCertificate& identityCertificate, |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 88 | bool isIntroducer); |
| 89 | |
| 90 | void |
| 91 | appendMessage(const SyncDemo::ChatMessage msg, bool isHistory = false); |
| 92 | |
| 93 | void |
| 94 | processTreeUpdateWrapper(const std::vector<Sync::MissingDataInfo>, Sync::SyncSocket *); |
| 95 | |
| 96 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 97 | processDataWrapper(const ndn::ptr_lib::shared_ptr<ndn::Data>& data); |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 98 | |
| 99 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 100 | processDataNoShowWrapper(const ndn::ptr_lib::shared_ptr<ndn::Data>& data); |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 101 | |
| 102 | void |
| 103 | processRemoveWrapper(std::string); |
Zhenkai Zhu | 10ccb5a | 2012-06-04 21:55:14 -0700 | [diff] [blame] | 104 | |
Yingdi Yu | 83eae84 | 2013-11-06 22:07:38 -0800 | [diff] [blame] | 105 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 106 | publishIntroCert(const ndn::IdentityCertificate& dskCertificate, bool isIntroducer); |
Yingdi Yu | 83eae84 | 2013-11-06 22:07:38 -0800 | [diff] [blame] | 107 | |
Yingdi Yu | 4694828 | 2013-11-06 18:43:31 -0800 | [diff] [blame] | 108 | protected: |
Yingdi Yu | 83eae84 | 2013-11-06 22:07:38 -0800 | [diff] [blame] | 109 | void |
| 110 | closeEvent(QCloseEvent *e); |
| 111 | |
| 112 | void |
| 113 | changeEvent(QEvent *e); |
Yingdi Yu | 4694828 | 2013-11-06 18:43:31 -0800 | [diff] [blame] | 114 | |
Zhenkai Zhu | b45e38a | 2012-06-01 15:44:36 -0700 | [diff] [blame] | 115 | private: |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 116 | |
Yingdi Yu | 6eabbd7 | 2013-12-27 08:44:12 +0800 | [diff] [blame] | 117 | void |
| 118 | startFace(); |
| 119 | |
| 120 | void |
| 121 | shutdownFace(); |
| 122 | |
| 123 | void |
| 124 | eventLoop(); |
| 125 | |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 126 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 127 | connectToDaemon(); |
| 128 | |
| 129 | void |
| 130 | onConnectionData(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 131 | const ndn::ptr_lib::shared_ptr<ndn::Data>& data); |
| 132 | |
| 133 | void |
| 134 | onConnectionDataTimeout(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest); |
| 135 | |
| 136 | void |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 137 | initializeSetting(); |
| 138 | |
Yingdi Yu | fdb8ab8 | 2013-11-10 01:38:21 -0800 | [diff] [blame] | 139 | QString |
| 140 | getRandomString(); |
| 141 | |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 142 | void |
| 143 | updateLabels(); |
| 144 | |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame] | 145 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 146 | initializeSync(); |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 147 | |
| 148 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 149 | onTargetData(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 150 | const ndn::ptr_lib::shared_ptr<ndn::Data>& data, |
| 151 | int stepCount, |
| 152 | const ndn::OnVerified& onVerified, |
| 153 | const ndn::OnVerifyFailed& onVerifyFailed, |
| 154 | const OnEventualTimeout& timeoutNotify, |
| 155 | const ndn::ptr_lib::shared_ptr<ndn::PolicyManager>& policyManager); |
| 156 | |
| 157 | void |
| 158 | onTargetTimeout(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 159 | int retry, |
| 160 | int stepCount, |
| 161 | const ndn::OnVerified& onVerified, |
| 162 | const ndn::OnVerifyFailed& onVerifyFailed, |
| 163 | const OnEventualTimeout& timeoutNotify, |
| 164 | const ndn::ptr_lib::shared_ptr<ndn::PolicyManager>& policyManager); |
| 165 | |
| 166 | void |
| 167 | onCertData(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 168 | const ndn::ptr_lib::shared_ptr<ndn::Data>& cert, |
| 169 | ndn::ptr_lib::shared_ptr<ndn::ValidationRequest> previousStep, |
| 170 | const ndn::ptr_lib::shared_ptr<ndn::PolicyManager>& policyManager); |
| 171 | |
| 172 | void |
| 173 | onCertTimeout(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 174 | const ndn::OnVerifyFailed& onVerifyFailed, |
| 175 | const ndn::ptr_lib::shared_ptr<ndn::Data>& data, |
| 176 | ndn::ptr_lib::shared_ptr<ndn::ValidationRequest> nextStep, |
| 177 | const ndn::ptr_lib::shared_ptr<ndn::PolicyManager>& policyManager); |
| 178 | |
| 179 | void |
| 180 | sendInterest(const ndn::Interest& interest, |
| 181 | const ndn::OnVerified& onVerified, |
| 182 | const ndn::OnVerifyFailed& onVerifyFailed, |
| 183 | const OnEventualTimeout& timeoutNotify, |
| 184 | const ndn::ptr_lib::shared_ptr<ndn::PolicyManager>& policyManager, |
| 185 | int retry = 1, |
| 186 | int stepCount = 0); |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame] | 187 | |
| 188 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 189 | onInviteReplyVerified(const ndn::ptr_lib::shared_ptr<ndn::Data>& data, |
| 190 | const ndn::Name& identity, |
| 191 | bool isIntroduce); |
| 192 | |
| 193 | void |
| 194 | onInviteReplyVerifyFailed(const ndn::ptr_lib::shared_ptr<ndn::Data>& data, |
| 195 | const ndn::Name& identity); |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame] | 196 | |
| 197 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 198 | onInviteReplyTimeout(const ndn::Name& identity); |
| 199 | |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame] | 200 | |
| 201 | void |
| 202 | invitationRejected(const ndn::Name& identity); |
| 203 | |
| 204 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 205 | invitationAccepted(const ndn::Name& identity, |
| 206 | ndn::ptr_lib::shared_ptr<ndn::Data> data, |
| 207 | const std::string& inviteePrefix, |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 208 | bool isIntroducer); |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame] | 209 | |
| 210 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 211 | onLocalPrefix(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest, |
| 212 | const ndn::ptr_lib::shared_ptr<ndn::Data>& data); |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 213 | |
Yingdi Yu | 4694828 | 2013-11-06 18:43:31 -0800 | [diff] [blame] | 214 | void |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 215 | onLocalPrefixTimeout(const ndn::ptr_lib::shared_ptr<const ndn::Interest>& interest); |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 216 | |
| 217 | // void |
| 218 | // fetchHistory(std::string name); |
| 219 | |
| 220 | void |
| 221 | formChatMessage(const QString &text, SyncDemo::ChatMessage &msg); |
| 222 | |
| 223 | void |
| 224 | formControlMessage(SyncDemo::ChatMessage &msg, SyncDemo::ChatMessage::ChatMessageType type); |
| 225 | |
| 226 | void |
| 227 | sendMsg(SyncDemo::ChatMessage &msg); |
| 228 | |
| 229 | void |
| 230 | resizeEvent(QResizeEvent *); |
| 231 | |
| 232 | void |
| 233 | showEvent(QShowEvent *); |
| 234 | |
| 235 | void |
| 236 | fitView(); |
| 237 | |
Yingdi Yu | 83eae84 | 2013-11-06 22:07:38 -0800 | [diff] [blame] | 238 | void |
| 239 | createActions(); |
| 240 | |
| 241 | void |
| 242 | createTrayIcon(); |
| 243 | |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 244 | QString |
| 245 | formatTime(time_t); |
| 246 | |
| 247 | void |
| 248 | printTimeInCell(QTextTable *, time_t); |
| 249 | |
| 250 | void |
| 251 | disableTreeDisplay(); |
| 252 | |
| 253 | signals: |
| 254 | void |
| 255 | dataReceived(QString name, const char *buf, size_t len, bool show, bool isHistory); |
| 256 | |
| 257 | void |
| 258 | treeUpdated(const std::vector<Sync::MissingDataInfo>); |
| 259 | |
| 260 | void |
| 261 | removeReceived(QString prefix); |
| 262 | |
Yingdi Yu | 4694828 | 2013-11-06 18:43:31 -0800 | [diff] [blame] | 263 | void |
| 264 | closeChatDialog(const ndn::Name& chatroomPrefix); |
| 265 | |
Yingdi Yu | 8e13583 | 2013-11-09 20:12:31 -0800 | [diff] [blame] | 266 | void |
| 267 | noNdnConnection(const QString& msg); |
Yingdi Yu | 0aca265 | 2013-11-10 10:47:44 -0800 | [diff] [blame] | 268 | |
| 269 | void |
| 270 | inivationRejection(const QString& msg); |
Yingdi Yu | 8e13583 | 2013-11-09 20:12:31 -0800 | [diff] [blame] | 271 | |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 272 | public slots: |
| 273 | void |
| 274 | processTreeUpdate(const std::vector<Sync::MissingDataInfo>); |
| 275 | |
| 276 | void |
| 277 | processData(QString name, const char *buf, size_t len, bool show, bool isHistory); |
| 278 | |
| 279 | void |
| 280 | processRemove(QString prefix); |
| 281 | |
| 282 | private slots: |
| 283 | void |
| 284 | returnPressed(); |
| 285 | |
| 286 | void |
| 287 | treeButtonPressed(); |
| 288 | |
Yingdi Yu | fdb8ab8 | 2013-11-10 01:38:21 -0800 | [diff] [blame] | 289 | void |
| 290 | settingUpdated(QString, QString, QString); |
| 291 | |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 292 | void |
| 293 | sendJoin(); |
| 294 | |
| 295 | void |
| 296 | sendHello(); |
| 297 | |
| 298 | void |
| 299 | sendLeave(); |
| 300 | |
| 301 | void |
| 302 | replot(); |
| 303 | |
| 304 | void |
| 305 | updateRosterList(QStringList); |
| 306 | |
| 307 | void |
| 308 | enableTreeDisplay(); |
| 309 | |
Yingdi Yu | fdb8ab8 | 2013-11-10 01:38:21 -0800 | [diff] [blame] | 310 | void |
| 311 | updateLocalPrefix(); |
| 312 | |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 313 | void |
| 314 | summonReaper(); |
| 315 | |
| 316 | void |
| 317 | reap(); |
| 318 | |
| 319 | void |
Yingdi Yu | 83eae84 | 2013-11-06 22:07:38 -0800 | [diff] [blame] | 320 | iconActivated(QSystemTrayIcon::ActivationReason reason); |
| 321 | |
| 322 | void |
| 323 | messageClicked(); |
| 324 | |
| 325 | void |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 326 | showMessage(QString, QString); |
| 327 | |
| 328 | void |
| 329 | openInviteListDialog(); |
| 330 | |
| 331 | void |
| 332 | sendInvitationWrapper(QString, bool); |
Yingdi Yu | 702d6f1 | 2013-11-07 17:00:54 -0800 | [diff] [blame] | 333 | |
| 334 | void |
| 335 | quit(); |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame] | 336 | |
| 337 | private: |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 338 | Ui::ChatDialog *ui; |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 339 | ndn::ptr_lib::shared_ptr<ContactManager> m_contactManager; |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 340 | ndn::Name m_chatroomPrefix; |
| 341 | ndn::Name m_localPrefix; |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 342 | ndn::Name m_localChatPrefix; |
Yingdi Yu | eda39aa | 2013-10-23 23:07:29 -0700 | [diff] [blame] | 343 | ndn::Name m_defaultIdentity; |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 344 | ndn::ptr_lib::shared_ptr<InvitationPolicyManager> m_invitationPolicyManager; |
| 345 | ndn::ptr_lib::shared_ptr<SyncPolicyManager> m_syncPolicyManager; |
Yingdi Yu | f8f572d | 2014-01-13 11:19:47 -0800 | [diff] [blame^] | 346 | ndn::ptr_lib::shared_ptr<ndn::KeyChain> m_keyChain; |
Yingdi Yu | 76dd800 | 2013-12-24 11:16:32 +0800 | [diff] [blame] | 347 | ndn::ptr_lib::shared_ptr<ndn::Face> m_face; |
Yingdi Yu | a66183f | 2013-11-10 10:32:18 -0800 | [diff] [blame] | 348 | |
Yingdi Yu | 6eabbd7 | 2013-12-27 08:44:12 +0800 | [diff] [blame] | 349 | boost::recursive_mutex m_mutex; |
| 350 | boost::thread m_thread; |
| 351 | bool m_running; |
| 352 | |
Yingdi Yu | a66183f | 2013-11-10 10:32:18 -0800 | [diff] [blame] | 353 | ndn::Name m_newLocalPrefix; |
| 354 | bool m_newLocalPrefixReady; |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 355 | |
| 356 | User m_user; |
Yingdi Yu | 4694828 | 2013-11-06 18:43:31 -0800 | [diff] [blame] | 357 | std::string m_nick; |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 358 | Sync::SyncSocket *m_sock; |
| 359 | uint32_t m_session; |
| 360 | DigestTreeScene *m_scene; |
| 361 | boost::recursive_mutex m_msgMutex; |
| 362 | boost::recursive_mutex m_sceneMutex; |
| 363 | time_t m_lastMsgTime; |
| 364 | int m_randomizedInterval; |
| 365 | QTimer *m_timer; |
| 366 | QStringListModel *m_rosterModel; |
Yingdi Yu | 83eae84 | 2013-11-06 22:07:38 -0800 | [diff] [blame] | 367 | QSystemTrayIcon *trayIcon; |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 368 | |
Yingdi Yu | 702d6f1 | 2013-11-07 17:00:54 -0800 | [diff] [blame] | 369 | QAction *minimizeAction; |
| 370 | QAction *maximizeAction; |
| 371 | QAction *restoreAction; |
Yingdi Yu | fdb8ab8 | 2013-11-10 01:38:21 -0800 | [diff] [blame] | 372 | QAction *updateLocalPrefixAction; |
Yingdi Yu | 702d6f1 | 2013-11-07 17:00:54 -0800 | [diff] [blame] | 373 | QAction *quitAction; |
| 374 | QMenu *trayIconMenu; |
| 375 | |
Yingdi Yu | 7989eb2 | 2013-10-31 17:38:22 -0700 | [diff] [blame] | 376 | // QQueue<SyncDemo::ChatMessage> m_history; |
| 377 | // bool m_historyInitialized; |
| 378 | bool m_joined; |
| 379 | |
| 380 | QList<QString> m_zombieList; |
| 381 | int m_zombieIndex; |
| 382 | |
| 383 | InviteListDialog* m_inviteListDialog; |
Zhenkai Zhu | 6d589aa | 2012-05-29 17:34:35 -0700 | [diff] [blame] | 384 | }; |
Yingdi Yu | 5b98913 | 2013-10-23 14:03:09 -0700 | [diff] [blame] | 385 | |
| 386 | #endif // ChatDIALOG_H |