blob: f7b2a5947089cb47b60715f637985c3879b39a18 [file] [log] [blame]
Yingdi Yu24ca96f2013-10-22 23:42:16 -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
12#include "invitationdialog.h"
13#include "ui_invitationdialog.h"
14
15using namespace std;
Yingdi Yu978b3ae2013-10-23 11:50:51 -070016using namespace ndn;
Yingdi Yu24ca96f2013-10-22 23:42:16 -070017
18InvitationDialog::InvitationDialog(QWidget *parent) :
19 QDialog(parent),
20 ui(new Ui::InvitationDialog)
21{
22 ui->setupUi(this);
23}
24
25InvitationDialog::~InvitationDialog()
26{
27 delete ui;
28}
29
30void
31InvitationDialog::setMsg(const string& inviter, const string& chatroom)
32{
Yingdi Yu978b3ae2013-10-23 11:50:51 -070033 m_inviter = inviter;
34 m_chatroom = chatroom;
Yingdi Yu24ca96f2013-10-22 23:42:16 -070035 string msg = inviter;
36 msg.append(" invites you to join the chat room: ");
37
38 ui->msgLabel->setText(QString::fromUtf8(msg.c_str()));
39 ui->chatroomLine->setText(QString::fromUtf8(msg.c_str()));
40}
41
42void
43InvitationDialog::onOkClicked()
Yingdi Yu978b3ae2013-10-23 11:50:51 -070044{
45 QString inviter = QString::fromUtf8(m_inviter.c_str());
46 QString chatroom = QString::fromUtf8(m_chatroom.c_str());
47 emit invitationAccepted(m_interestName, *m_identityCertificate, inviter, chatroom);
48}
Yingdi Yu24ca96f2013-10-22 23:42:16 -070049
50void
51InvitationDialog::onCancelClicked()
52{
53 ui->msgLabel->clear();
54 ui->chatroomLine->clear();
55 m_interestName = Name();
Yingdi Yu978b3ae2013-10-23 11:50:51 -070056 m_inviter.clear();
57 m_chatroom.clear();
Yingdi Yu24ca96f2013-10-22 23:42:16 -070058 emit invitationRejected(m_interestName);
59}
60
61#if WAF
62#include "invitationdialog.moc"
63#include "invitationdialog.cpp.moc"
64#endif