blob: f13770e5e243bac0b3753ba8b47817b10d8d1bf1 [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
20#include <ndn-cpp-dev/security/identity-certificate.hpp>
21#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
32
33public:
34 explicit
35 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();
67
68 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