Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
| 3 | * Copyright (c) 2013, Regents of the University of California |
| 4 | * Yingdi Yu |
| 5 | * |
| 6 | * BSD license, See the LICENSE file for more information |
| 7 | * |
| 8 | * Author: Yingdi Yu <yingdi@cs.ucla.edu> |
| 9 | */ |
| 10 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 11 | #ifndef CHRONOCHAT_BROWSE_CONTACT_DIALOG_HPP |
| 12 | #define CHRONOCHAT_BROWSE_CONTACT_DIALOG_HPP |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 13 | |
| 14 | #include <QDialog> |
| 15 | #include <QStringListModel> |
| 16 | #include <QCloseEvent> |
| 17 | #include <QTableWidgetItem> |
| 18 | |
| 19 | #ifndef Q_MOC_RUN |
Varun Patil | 3d85090 | 2020-11-23 12:19:14 +0530 | [diff] [blame^] | 20 | #include <ndn-cxx/security/certificate.hpp> |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 21 | #include <boost/thread/locks.hpp> |
| 22 | #include <boost/thread/recursive_mutex.hpp> |
| 23 | #endif |
| 24 | |
| 25 | namespace Ui { |
| 26 | class BrowseContactDialog; |
| 27 | } |
| 28 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 29 | namespace chronochat { |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 30 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 31 | class BrowseContactDialog : public QDialog |
| 32 | { |
| 33 | Q_OBJECT |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 34 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 35 | public: |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 36 | explicit |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 37 | BrowseContactDialog(QWidget *parent = 0); |
| 38 | |
| 39 | ~BrowseContactDialog(); |
| 40 | |
| 41 | protected: |
| 42 | void |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 43 | closeEvent(QCloseEvent* e); |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 44 | |
| 45 | private slots: |
| 46 | void |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 47 | onSelectionChanged(const QItemSelection& selected, |
| 48 | const QItemSelection& deselected); |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 49 | |
| 50 | void |
| 51 | onAddClicked(); |
| 52 | |
| 53 | void |
| 54 | onDirectAddClicked(); |
| 55 | |
| 56 | public slots: |
| 57 | void |
| 58 | onIdCertNameListReady(const QStringList& certNameList); |
| 59 | |
| 60 | void |
| 61 | onNameListReady(const QStringList& nameList); |
| 62 | |
| 63 | void |
Varun Patil | 3d85090 | 2020-11-23 12:19:14 +0530 | [diff] [blame^] | 64 | onIdCertReady(const ndn::security::Certificate & idCert); |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 65 | |
| 66 | signals: |
| 67 | void |
| 68 | directAddClicked(); |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame] | 69 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 70 | void |
| 71 | fetchIdCert(const QString& certName); |
| 72 | |
| 73 | void |
| 74 | addContact(const QString& qCertName); |
| 75 | |
| 76 | private: |
| 77 | |
| 78 | typedef boost::recursive_mutex RecLock; |
| 79 | typedef boost::unique_lock<RecLock> UniqueRecLock; |
| 80 | |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 81 | Ui::BrowseContactDialog* ui; |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 82 | |
| 83 | QTableWidgetItem* m_typeHeader; |
| 84 | QTableWidgetItem* m_valueHeader; |
| 85 | |
| 86 | QStringListModel* m_contactListModel; |
| 87 | |
| 88 | QStringList m_contactNameList; |
| 89 | QStringList m_contactCertNameList; |
| 90 | }; |
| 91 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 92 | } // namespace chronochat |
Yingdi Yu | 0b0a736 | 2014-08-05 16:31:30 -0700 | [diff] [blame] | 93 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 94 | #endif // CHRONOCHAT_BROWSE_CONTACT_DIALOG_HPP |