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 | |
| 11 | #ifndef BROWSE_CONTACT_DIALOG_H |
| 12 | #define BROWSE_CONTACT_DIALOG_H |
| 13 | |
| 14 | #include <QDialog> |
| 15 | #include <QStringListModel> |
| 16 | #include <QCloseEvent> |
| 17 | #include <QTableWidgetItem> |
| 18 | |
| 19 | #ifndef Q_MOC_RUN |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame^] | 20 | #include <ndn-cxx/security/identity-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 | |
| 29 | class BrowseContactDialog : public QDialog |
| 30 | { |
| 31 | Q_OBJECT |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame^] | 32 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 33 | public: |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame^] | 34 | explicit |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 35 | BrowseContactDialog(QWidget *parent = 0); |
| 36 | |
| 37 | ~BrowseContactDialog(); |
| 38 | |
| 39 | protected: |
| 40 | void |
| 41 | closeEvent(QCloseEvent *e); |
| 42 | |
| 43 | private slots: |
| 44 | void |
| 45 | onSelectionChanged(const QItemSelection &selected, |
| 46 | const QItemSelection &deselected); |
| 47 | |
| 48 | void |
| 49 | onAddClicked(); |
| 50 | |
| 51 | void |
| 52 | onDirectAddClicked(); |
| 53 | |
| 54 | public slots: |
| 55 | void |
| 56 | onIdCertNameListReady(const QStringList& certNameList); |
| 57 | |
| 58 | void |
| 59 | onNameListReady(const QStringList& nameList); |
| 60 | |
| 61 | void |
| 62 | onIdCertReady(const ndn::IdentityCertificate& idCert); |
| 63 | |
| 64 | signals: |
| 65 | void |
| 66 | directAddClicked(); |
Yingdi Yu | fa0b6a0 | 2014-04-30 14:26:42 -0700 | [diff] [blame^] | 67 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 68 | void |
| 69 | fetchIdCert(const QString& certName); |
| 70 | |
| 71 | void |
| 72 | addContact(const QString& qCertName); |
| 73 | |
| 74 | private: |
| 75 | |
| 76 | typedef boost::recursive_mutex RecLock; |
| 77 | typedef boost::unique_lock<RecLock> UniqueRecLock; |
| 78 | |
| 79 | Ui::BrowseContactDialog *ui; |
| 80 | |
| 81 | QTableWidgetItem* m_typeHeader; |
| 82 | QTableWidgetItem* m_valueHeader; |
| 83 | |
| 84 | QStringListModel* m_contactListModel; |
| 85 | |
| 86 | QStringList m_contactNameList; |
| 87 | QStringList m_contactCertNameList; |
| 88 | }; |
| 89 | |
| 90 | #endif // BROWSE_CONTACT_DIALOG_H |