| /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| /* |
| * Copyright (c) 2013, Regents of the University of California |
| * Yingdi Yu |
| * |
| * BSD license, See the LICENSE file for more information |
| * |
| * Author: Yingdi Yu <yingdi@cs.ucla.edu> |
| */ |
| |
| #ifndef CONTACTPANEL_H |
| #define CONTACTPANEL_H |
| |
| #include <QDialog> |
| #include <QStringListModel> |
| #include <QtSql/QSqlDatabase> |
| #include <QMenu> |
| #include <QMessageBox> |
| |
| #include "profileeditor.h" |
| #include "addcontactpanel.h" |
| #include "setaliasdialog.h" |
| #include "startchatdialog.h" |
| #include "invitationdialog.h" |
| #include "settingdialog.h" |
| #include "chatdialog.h" |
| #include "endorse-combobox-delegate.h" |
| #include "browsecontactdialog.h" |
| #include "warningDialog.h" |
| |
| #ifndef Q_MOC_RUN |
| #include "contact-manager.h" |
| #include "chronos-invitation.h" |
| #include "panel-policy-manager.h" |
| #endif |
| |
| |
| namespace Ui { |
| class ContactPanel; |
| } |
| |
| class ContactPanel : public QDialog |
| { |
| Q_OBJECT |
| |
| public: |
| explicit ContactPanel(QWidget *parent = 0); |
| |
| ~ContactPanel(); |
| |
| private: |
| void |
| createAction(); |
| |
| void |
| openDB(); |
| |
| void |
| setKeychain(); |
| |
| void |
| setLocalPrefix(); |
| |
| void |
| onLocalPrefixVerified(ndn::Ptr<ndn::Data> data); |
| |
| void |
| onLocalPrefixTimeout(ndn::Ptr<ndn::Closure> closure, |
| ndn::Ptr<ndn::Interest> interest); |
| |
| void |
| setInvitationListener(); |
| |
| void |
| onInvitation(ndn::Ptr<ndn::Interest> interest); |
| |
| void |
| onUnverified(ndn::Ptr<ndn::Data> data); |
| |
| void |
| onTimeout(ndn::Ptr<ndn::Closure> closure, |
| ndn::Ptr<ndn::Interest> interest); |
| |
| void |
| onInvitationCertVerified(ndn::Ptr<ndn::Data> data, |
| ndn::Ptr<ChronosInvitation> invitation); |
| |
| void |
| popChatInvitation(ndn::Ptr<ChronosInvitation> invitation, |
| const ndn::Name& inviterNameSpace, |
| ndn::Ptr<ndn::security::IdentityCertificate> certificate); |
| |
| void |
| collectEndorsement(); |
| |
| void |
| onDnsEndorseeVerified(ndn::Ptr<ndn::Data> data, int count); |
| |
| void |
| onDnsEndorseeTimeout(ndn::Ptr<ndn::Closure> closure, |
| ndn::Ptr<ndn::Interest> interest, |
| int count); |
| |
| void |
| onDnsEndorseeUnverified(ndn::Ptr<ndn::Data> data, int count); |
| |
| void |
| updateCollectStatus(int count); |
| |
| std::string |
| getRandomString(); |
| |
| signals: |
| void |
| newInvitationReady(); |
| |
| void |
| refreshCertDirectory(); |
| |
| private slots: |
| void |
| showError(const QString& msg); |
| |
| void |
| showWarning(const QString& msg); |
| |
| void |
| updateSelection(const QItemSelection &selected, |
| const QItemSelection &deselected); |
| |
| void |
| updateDefaultIdentity(const QString& identity, |
| const QString& nickName); |
| |
| void |
| openProfileEditor(); |
| |
| void |
| openAddContactPanel(); |
| |
| void |
| openBrowseContactDialog(); |
| |
| void |
| openSetAliasDialog(); |
| |
| void |
| removeContactButton(); |
| |
| void |
| openStartChatDialog(); |
| |
| void |
| openSettingDialog(); |
| |
| void |
| openInvitationDialog(); |
| |
| void |
| refreshContactList(); |
| |
| void |
| showContextMenu(const QPoint& pos); |
| |
| void |
| startChatroom(const QString& chatroom, |
| const QString& invitee, |
| bool isIntroducer); |
| |
| void |
| startChatroom2(const ChronosInvitation& invitation, |
| const ndn::security::IdentityCertificate& identityCertificate); |
| |
| void |
| acceptInvitation(const ChronosInvitation& invitation, |
| const ndn::security::IdentityCertificate& identityCertificate); |
| |
| void |
| rejectInvitation(const ChronosInvitation& invitation); |
| |
| void |
| isIntroducerChanged(int state); |
| |
| void |
| addScopeClicked(); |
| |
| void |
| deleteScopeClicked(); |
| |
| void |
| saveScopeClicked(); |
| |
| void |
| endorseButtonClicked(); |
| |
| void |
| removeChatDialog(const ndn::Name& chatroomName); |
| |
| |
| |
| private: |
| Ui::ContactPanel *ui; |
| WarningDialog* m_warningDialog; |
| ndn::Ptr<ContactManager> m_contactManager; |
| QStringListModel* m_contactListModel; |
| ProfileEditor* m_profileEditor; |
| AddContactPanel* m_addContactPanel; |
| BrowseContactDialog* m_browseContactDialog; |
| SetAliasDialog* m_setAliasDialog; |
| StartChatDialog* m_startChatDialog; |
| InvitationDialog* m_invitationDialog; |
| SettingDialog* m_settingDialog; |
| std::map<ndn::Name, ChatDialog*> m_chatDialogs; |
| QAction* m_menuInvite; |
| QAction* m_menuAlias; |
| std::vector<ndn::Ptr<ContactItem> > m_contactList; |
| ndn::Ptr<std::vector<bool> > m_collectStatus; |
| |
| ndn::Ptr<PanelPolicyManager> m_panelPolicyManager; |
| ndn::Ptr<ndn::security::Keychain> m_keychain; |
| ndn::Ptr<ndn::Wrapper> m_handler; |
| |
| ndn::Name m_defaultIdentity; |
| std::string m_nickName; |
| ndn::Name m_localPrefix; |
| ndn::Name m_inviteListenPrefix; |
| |
| ndn::Ptr<ContactItem> m_currentSelectedContact; |
| QSqlTableModel* m_trustScopeModel; |
| QSqlTableModel* m_endorseDataModel; |
| EndorseComboBoxDelegate* m_endorseComboBoxDelegate; |
| }; |
| |
| #endif // CONTACTPANEL_H |