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