blob: dff0e56eb552c9854af5e8a036c2b4300d0c691c [file] [log] [blame]
Yingdi Yu9e0dc292013-10-10 11:39:45 -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
Yingdi Yudef90612013-10-09 22:34:42 -070011#ifndef CONTACTPANEL_H
12#define CONTACTPANEL_H
13
14#include <QDialog>
Yingdi Yu01a942b2013-10-10 15:00:58 -070015#include <QStringListModel>
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070016#include <QtSql/QSqlDatabase>
Yingdi Yu79c25a22013-10-21 13:38:38 -070017#include <QMenu>
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070018
19#include "profileeditor.h"
Yingdi Yud59b5932013-10-16 13:16:49 -070020#include "addcontactpanel.h"
Yingdi Yu79c25a22013-10-21 13:38:38 -070021#include "setaliasdialog.h"
Yingdi Yu100267f2013-10-21 15:01:40 -070022#include "startchatdialog.h"
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070023
24#ifndef Q_MOC_RUN
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070025#include "contact-manager.h"
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070026#endif
Yingdi Yudef90612013-10-09 22:34:42 -070027
28namespace Ui {
29class ContactPanel;
30}
31
32class ContactPanel : public QDialog
33{
34 Q_OBJECT
35
36public:
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070037 explicit ContactPanel(ndn::Ptr<ContactManager> contactManager, QWidget *parent = 0);
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070038 ~ContactPanel();
Yingdi Yudef90612013-10-09 22:34:42 -070039
Yingdi Yu01a942b2013-10-10 15:00:58 -070040private slots:
41 void
42 updateSelection(const QItemSelection &selected,
43 const QItemSelection &deselected);
44
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070045 void
46 openProfileEditor();
47
Yingdi Yud59b5932013-10-16 13:16:49 -070048 void
49 openAddContactPanel();
50
Yingdi Yu79c25a22013-10-21 13:38:38 -070051 void
52 openSetAliasDialog();
Yingdi Yu100267f2013-10-21 15:01:40 -070053
54 void
55 openStartChatDialog();
Yingdi Yu79c25a22013-10-21 13:38:38 -070056
57 void
58 refreshContactList();
59
60 void
61 showContextMenu(const QPoint& pos);
62
Yingdi Yu100267f2013-10-21 15:01:40 -070063 void
64 startChatroom(const QString& chatroom, const QString& invitee, bool isIntroducer);
65
Yingdi Yudef90612013-10-09 22:34:42 -070066private:
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070067 Ui::ContactPanel *ui;
Yingdi Yu0b82a4e2013-10-18 11:29:25 -070068 ndn::Ptr<ContactManager> m_contactManager;
Yingdi Yu0a6b6c52013-10-15 17:54:00 -070069 QStringListModel* m_contactListModel;
70 ProfileEditor* m_profileEditor;
Yingdi Yud59b5932013-10-16 13:16:49 -070071 AddContactPanel* m_addContactPanel;
Yingdi Yu79c25a22013-10-21 13:38:38 -070072 SetAliasDialog* m_setAliasDialog;
Yingdi Yu100267f2013-10-21 15:01:40 -070073 StartChatDialog* m_startChatDialog;
Yingdi Yu79c25a22013-10-21 13:38:38 -070074 QAction* m_menuInvite;
75 QAction* m_menuAlias;
76
77
78 std::vector<ndn::Ptr<ContactItem> > m_contactList;
79
Yingdi Yu100267f2013-10-21 15:01:40 -070080 std::string m_currentSelectedContactAlias;
81 std::string m_currentSelectedContactNamespace;
Yingdi Yudef90612013-10-09 22:34:42 -070082};
83
84#endif // CONTACTPANEL_H