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