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 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 15 | using namespace ndn; |
| 16 | |
| 17 | InvitationDialog::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 | |
| 29 | InvitationDialog::~InvitationDialog() |
| 30 | { |
| 31 | delete ui; |
| 32 | } |
| 33 | |
| 34 | void |
Yingdi Yu | 17032f8 | 2014-03-25 15:48:23 -0700 | [diff] [blame] | 35 | InvitationDialog::setInvitation(const std::string& alias, |
| 36 | const std::string& chatroom, |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 37 | const Name& interestName) |
| 38 | { |
Yingdi Yu | 17032f8 | 2014-03-25 15:48:23 -0700 | [diff] [blame] | 39 | std::string msg = alias; |
Yingdi Yu | 233a972 | 2014-03-07 15:47:09 -0800 | [diff] [blame] | 40 | m_invitationInterest = interestName; |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 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 |