Qiuhan Ding | ba3e57a | 2015-01-08 19:07:39 -0800 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| 2 | /* |
Varun Patil | a24bd3e | 2020-11-24 10:08:33 +0530 | [diff] [blame^] | 3 | * Copyright (c) 2020, Regents of the University of California |
Qiuhan Ding | ba3e57a | 2015-01-08 19:07:39 -0800 | [diff] [blame] | 4 | * |
| 5 | * BSD license, See the LICENSE file for more information |
| 6 | * |
| 7 | * Author: Qiuhan Ding <qiuhanding@cs.ucla.edu> |
| 8 | * Yingdi Yu <yingdi@cs.ucla.edu> |
| 9 | */ |
| 10 | |
| 11 | #include "invitation-request-dialog.hpp" |
| 12 | #include "ui_invitation-request-dialog.h" |
| 13 | |
| 14 | namespace chronochat { |
| 15 | |
| 16 | InvitationRequestDialog::InvitationRequestDialog(QWidget* parent) |
| 17 | : QDialog(parent) |
| 18 | , ui(new Ui::InvitationRequestDialog) |
| 19 | { |
| 20 | ui->setupUi(this); |
| 21 | |
| 22 | connect(ui->okButton, SIGNAL(clicked()), |
| 23 | this, SLOT(onOkClicked())); |
| 24 | connect(ui->cancelButton, SIGNAL(clicked()), |
| 25 | this, SLOT(onCancelClicked())); |
| 26 | } |
| 27 | |
| 28 | InvitationRequestDialog::~InvitationRequestDialog() |
| 29 | { |
| 30 | delete ui; |
| 31 | } |
| 32 | |
| 33 | void |
| 34 | InvitationRequestDialog::onInvitationRequestReceived(QString alias, QString chatroom, |
| 35 | Name interestName) |
| 36 | { |
| 37 | m_invitationInterest = interestName; |
| 38 | |
| 39 | QString msg = QString("%1\n request your invitation to chatroom\n %2 ").arg(alias).arg(chatroom); |
| 40 | ui->msgLabel->setText(msg); |
| 41 | |
| 42 | show(); |
| 43 | raise(); |
| 44 | } |
| 45 | |
| 46 | void |
| 47 | InvitationRequestDialog::onOkClicked() |
| 48 | { |
| 49 | emit invitationRequestResponded(m_invitationInterest, true); |
| 50 | this->close(); |
| 51 | |
| 52 | ui->msgLabel->clear(); |
| 53 | m_invitationInterest.clear(); |
| 54 | } |
| 55 | |
| 56 | void |
| 57 | InvitationRequestDialog::onCancelClicked() |
| 58 | { |
| 59 | emit invitationRequestResponded(m_invitationInterest, false); |
| 60 | this->close(); |
| 61 | |
| 62 | ui->msgLabel->clear(); |
| 63 | m_invitationInterest.clear(); |
| 64 | } |
| 65 | |
| 66 | } // namespace chronochat |
| 67 | |
| 68 | #if WAF |
| 69 | #include "invitation-request-dialog.moc" |
Qiuhan Ding | ba3e57a | 2015-01-08 19:07:39 -0800 | [diff] [blame] | 70 | #endif |