blob: 54c586bba29520f0dcfa52152f5b8e7f6cf680a7 [file] [log] [blame]
Yingdi Yu847aa862013-10-09 16:35:53 -07001/* -*- 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 CONTACTPANEL_H
12#define CONTACTPANEL_H
13
14#include <QDialog>
Yingdi Yu40eca752013-10-10 15:00:58 -070015#include <QStringListModel>
Yingdi Yu3b318c12013-10-15 17:54:00 -070016#include <QtSql/QSqlDatabase>
Yingdi Yu2ac40fb2013-10-21 13:38:38 -070017#include <QMenu>
Yingdi Yu3b318c12013-10-15 17:54:00 -070018
19#include "profileeditor.h"
Yingdi Yu0269c872013-10-16 13:16:49 -070020#include "addcontactpanel.h"
Yingdi Yu2ac40fb2013-10-21 13:38:38 -070021#include "setaliasdialog.h"
Yingdi Yu3b318c12013-10-15 17:54:00 -070022
23#ifndef Q_MOC_RUN
Yingdi Yu9236c432013-10-18 11:29:25 -070024#include "contact-manager.h"
Yingdi Yu3b318c12013-10-15 17:54:00 -070025#endif
Yingdi Yu847aa862013-10-09 16:35:53 -070026
27namespace Ui {
28class ContactPanel;
29}
30
31class ContactPanel : public QDialog
32{
33 Q_OBJECT
34
35public:
Yingdi Yu9236c432013-10-18 11:29:25 -070036 explicit ContactPanel(ndn::Ptr<ContactManager> contactManager, QWidget *parent = 0);
Yingdi Yu3b318c12013-10-15 17:54:00 -070037 ~ContactPanel();
Yingdi Yu847aa862013-10-09 16:35:53 -070038
Yingdi Yu40eca752013-10-10 15:00:58 -070039private slots:
40 void
41 updateSelection(const QItemSelection &selected,
42 const QItemSelection &deselected);
43
Yingdi Yu3b318c12013-10-15 17:54:00 -070044 void
45 openProfileEditor();
46
Yingdi Yu0269c872013-10-16 13:16:49 -070047 void
48 openAddContactPanel();
49
Yingdi Yu2ac40fb2013-10-21 13:38:38 -070050 void
51 openSetAliasDialog();
52
53 void
54 refreshContactList();
55
56 void
57 showContextMenu(const QPoint& pos);
58
Yingdi Yu847aa862013-10-09 16:35:53 -070059private:
Yingdi Yu3b318c12013-10-15 17:54:00 -070060 Ui::ContactPanel *ui;
Yingdi Yu9236c432013-10-18 11:29:25 -070061 ndn::Ptr<ContactManager> m_contactManager;
Yingdi Yu3b318c12013-10-15 17:54:00 -070062 QStringListModel* m_contactListModel;
63 ProfileEditor* m_profileEditor;
Yingdi Yu0269c872013-10-16 13:16:49 -070064 AddContactPanel* m_addContactPanel;
Yingdi Yu2ac40fb2013-10-21 13:38:38 -070065 SetAliasDialog* m_setAliasDialog;
66 QAction* m_menuInvite;
67 QAction* m_menuAlias;
68
69
70 std::vector<ndn::Ptr<ContactItem> > m_contactList;
71
72 std::string m_currentSelectedContact;
Yingdi Yu847aa862013-10-09 16:35:53 -070073};
74
75#endif // CONTACTPANEL_H