Yingdi Yu | 24ca96f | 2013-10-22 23:42:16 -0700 | [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 "invitationdialog.h" |
| 13 | #include "ui_invitationdialog.h" |
| 14 | |
| 15 | using namespace std; |
Yingdi Yu | 978b3ae | 2013-10-23 11:50:51 -0700 | [diff] [blame] | 16 | using namespace ndn; |
Yingdi Yu | 24ca96f | 2013-10-22 23:42:16 -0700 | [diff] [blame] | 17 | |
| 18 | InvitationDialog::InvitationDialog(QWidget *parent) : |
| 19 | QDialog(parent), |
| 20 | ui(new Ui::InvitationDialog) |
| 21 | { |
| 22 | ui->setupUi(this); |
| 23 | } |
| 24 | |
| 25 | InvitationDialog::~InvitationDialog() |
| 26 | { |
| 27 | delete ui; |
| 28 | } |
| 29 | |
| 30 | void |
| 31 | InvitationDialog::setMsg(const string& inviter, const string& chatroom) |
| 32 | { |
Yingdi Yu | 978b3ae | 2013-10-23 11:50:51 -0700 | [diff] [blame] | 33 | m_inviter = inviter; |
| 34 | m_chatroom = chatroom; |
Yingdi Yu | 24ca96f | 2013-10-22 23:42:16 -0700 | [diff] [blame] | 35 | string msg = inviter; |
| 36 | msg.append(" invites you to join the chat room: "); |
| 37 | |
| 38 | ui->msgLabel->setText(QString::fromUtf8(msg.c_str())); |
| 39 | ui->chatroomLine->setText(QString::fromUtf8(msg.c_str())); |
| 40 | } |
| 41 | |
| 42 | void |
| 43 | InvitationDialog::onOkClicked() |
Yingdi Yu | 978b3ae | 2013-10-23 11:50:51 -0700 | [diff] [blame] | 44 | { |
| 45 | QString inviter = QString::fromUtf8(m_inviter.c_str()); |
| 46 | QString chatroom = QString::fromUtf8(m_chatroom.c_str()); |
| 47 | emit invitationAccepted(m_interestName, *m_identityCertificate, inviter, chatroom); |
| 48 | } |
Yingdi Yu | 24ca96f | 2013-10-22 23:42:16 -0700 | [diff] [blame] | 49 | |
| 50 | void |
| 51 | InvitationDialog::onCancelClicked() |
| 52 | { |
| 53 | ui->msgLabel->clear(); |
| 54 | ui->chatroomLine->clear(); |
| 55 | m_interestName = Name(); |
Yingdi Yu | 978b3ae | 2013-10-23 11:50:51 -0700 | [diff] [blame] | 56 | m_inviter.clear(); |
| 57 | m_chatroom.clear(); |
Yingdi Yu | 24ca96f | 2013-10-22 23:42:16 -0700 | [diff] [blame] | 58 | emit invitationRejected(m_interestName); |
| 59 | } |
| 60 | |
| 61 | #if WAF |
| 62 | #include "invitationdialog.moc" |
| 63 | #include "invitationdialog.cpp.moc" |
| 64 | #endif |