blob: 1da8f00aa0d9b0ba042d75ccf7fd373e0df65a4e [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
12#include "invitation-dialog.h"
13#include "ui_invitation-dialog.h"
14
Yingdi Yu348f5ea2014-03-01 14:47:25 -080015using namespace ndn;
16
17InvitationDialog::InvitationDialog(QWidget *parent)
18 : QDialog(parent)
19 , ui(new Ui::InvitationDialog)
20{
21 ui->setupUi(this);
22
23 connect(ui->okButton, SIGNAL(clicked()),
24 this, SLOT(onOkClicked()));
25 connect(ui->cancelButton, SIGNAL(clicked()),
26 this, SLOT(onCancelClicked()));
27}
28
29InvitationDialog::~InvitationDialog()
30{
31 delete ui;
32}
33
34void
Yingdi Yu17032f82014-03-25 15:48:23 -070035InvitationDialog::setInvitation(const std::string& alias,
36 const std::string& chatroom,
Yingdi Yu348f5ea2014-03-01 14:47:25 -080037 const Name& interestName)
38{
Yingdi Yu17032f82014-03-25 15:48:23 -070039 std::string msg = alias;
Yingdi Yu233a9722014-03-07 15:47:09 -080040 m_invitationInterest = interestName;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080041 msg.append(" invites you to: ").append(chatroom);
42 ui->msgLabel->setText(QString::fromStdString(msg));
43}
44
45void
46InvitationDialog::onOkClicked()
47{
48 emit invitationResponded(m_invitationInterest, true);
49 this->close();
50
51 ui->msgLabel->clear();
52 m_invitationInterest.clear();
53}
54
55void
56InvitationDialog::onCancelClicked()
57{
58 emit invitationResponded(m_invitationInterest, false);
59 this->close();
60
61 ui->msgLabel->clear();
62 m_invitationInterest.clear();
63}
64
65#if WAF
66#include "invitation-dialog.moc"
67#include "invitation-dialog.cpp.moc"
68#endif