blob: f80f68431d112621b25898c45547812e9c79b5c3 [file] [log] [blame]
Yingdi Yu348f5ea2014-03-01 14:47:25 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
Varun Patila24bd3e2020-11-24 10:08:33 +05303 * Copyright (c) 2020, Regents of the University of California
Yingdi Yu348f5ea2014-03-01 14:47:25 -08004 * 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 Yueb692ac2015-02-10 18:46:18 -080011#ifndef CHRONOCHAT_BROWSE_CONTACT_DIALOG_HPP
12#define CHRONOCHAT_BROWSE_CONTACT_DIALOG_HPP
Yingdi Yu348f5ea2014-03-01 14:47:25 -080013
14#include <QDialog>
15#include <QStringListModel>
16#include <QCloseEvent>
17#include <QTableWidgetItem>
18
19#ifndef Q_MOC_RUN
Varun Patil3d850902020-11-23 12:19:14 +053020#include <ndn-cxx/security/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;
Varun Patila24bd3e2020-11-24 10:08:33 +053027} // namespace Ui
Yingdi Yu348f5ea2014-03-01 14:47:25 -080028
Yingdi Yueb692ac2015-02-10 18:46:18 -080029namespace chronochat {
Yingdi Yu0b0a7362014-08-05 16:31:30 -070030
Yingdi Yu348f5ea2014-03-01 14:47:25 -080031class BrowseContactDialog : public QDialog
32{
33 Q_OBJECT
Yingdi Yufa0b6a02014-04-30 14:26:42 -070034
Yingdi Yu348f5ea2014-03-01 14:47:25 -080035public:
Yingdi Yufa0b6a02014-04-30 14:26:42 -070036 explicit
Yingdi Yu348f5ea2014-03-01 14:47:25 -080037 BrowseContactDialog(QWidget *parent = 0);
38
39 ~BrowseContactDialog();
40
41protected:
42 void
Yingdi Yu0b0a7362014-08-05 16:31:30 -070043 closeEvent(QCloseEvent* e);
Yingdi Yu348f5ea2014-03-01 14:47:25 -080044
45private slots:
46 void
Yingdi Yu0b0a7362014-08-05 16:31:30 -070047 onSelectionChanged(const QItemSelection& selected,
48 const QItemSelection& deselected);
Yingdi Yu348f5ea2014-03-01 14:47:25 -080049
50 void
51 onAddClicked();
52
53 void
54 onDirectAddClicked();
55
56public slots:
57 void
58 onIdCertNameListReady(const QStringList& certNameList);
59
60 void
61 onNameListReady(const QStringList& nameList);
62
63 void
Varun Patila24bd3e2020-11-24 10:08:33 +053064 onIdCertReady(const ndn::security::Certificate& idCert);
Yingdi Yu348f5ea2014-03-01 14:47:25 -080065
66signals:
67 void
68 directAddClicked();
Yingdi Yufa0b6a02014-04-30 14:26:42 -070069
Yingdi Yu348f5ea2014-03-01 14:47:25 -080070 void
71 fetchIdCert(const QString& certName);
72
73 void
74 addContact(const QString& qCertName);
75
76private:
77
78 typedef boost::recursive_mutex RecLock;
79 typedef boost::unique_lock<RecLock> UniqueRecLock;
80
Yingdi Yu0b0a7362014-08-05 16:31:30 -070081 Ui::BrowseContactDialog* ui;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080082
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 Yueb692ac2015-02-10 18:46:18 -080092} // namespace chronochat
Yingdi Yu0b0a7362014-08-05 16:31:30 -070093
Yingdi Yueb692ac2015-02-10 18:46:18 -080094#endif // CHRONOCHAT_BROWSE_CONTACT_DIALOG_HPP