blob: 54cdcb2932a9d625bc3b4860df2fe217ae7d9a7b [file] [log] [blame]
Yingdi Yu348f5ea2014-03-01 14:47:25 -08001/* -*- 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 Yufa0b6a02014-04-30 14:26:42 -070020#include <ndn-cxx/security/identity-certificate.hpp>
Yingdi Yu348f5ea2014-03-01 14:47:25 -080021#include <boost/thread/locks.hpp>
22#include <boost/thread/recursive_mutex.hpp>
23#endif
24
25namespace Ui {
26class BrowseContactDialog;
27}
28
29class BrowseContactDialog : public QDialog
30{
31 Q_OBJECT
Yingdi Yufa0b6a02014-04-30 14:26:42 -070032
Yingdi Yu348f5ea2014-03-01 14:47:25 -080033public:
Yingdi Yufa0b6a02014-04-30 14:26:42 -070034 explicit
Yingdi Yu348f5ea2014-03-01 14:47:25 -080035 BrowseContactDialog(QWidget *parent = 0);
36
37 ~BrowseContactDialog();
38
39protected:
40 void
41 closeEvent(QCloseEvent *e);
42
43private slots:
44 void
45 onSelectionChanged(const QItemSelection &selected,
46 const QItemSelection &deselected);
47
48 void
49 onAddClicked();
50
51 void
52 onDirectAddClicked();
53
54public 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
64signals:
65 void
66 directAddClicked();
Yingdi Yufa0b6a02014-04-30 14:26:42 -070067
Yingdi Yu348f5ea2014-03-01 14:47:25 -080068 void
69 fetchIdCert(const QString& certName);
70
71 void
72 addContact(const QString& qCertName);
73
74private:
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