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