Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame^] | 1 | /* -*- 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 | |
| 15 | using namespace std; |
| 16 | using namespace ndn; |
| 17 | |
| 18 | InvitationDialog::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 | |
| 30 | InvitationDialog::~InvitationDialog() |
| 31 | { |
| 32 | delete ui; |
| 33 | } |
| 34 | |
| 35 | void |
| 36 | InvitationDialog::setInvitation(const string& alias, |
| 37 | const string& chatroom, |
| 38 | const Name& interestName) |
| 39 | { |
| 40 | string msg = alias; |
| 41 | msg.append(" invites you to: ").append(chatroom); |
| 42 | ui->msgLabel->setText(QString::fromStdString(msg)); |
| 43 | } |
| 44 | |
| 45 | void |
| 46 | InvitationDialog::onOkClicked() |
| 47 | { |
| 48 | emit invitationResponded(m_invitationInterest, true); |
| 49 | this->close(); |
| 50 | |
| 51 | ui->msgLabel->clear(); |
| 52 | m_invitationInterest.clear(); |
| 53 | } |
| 54 | |
| 55 | void |
| 56 | InvitationDialog::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 |