| /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */ |
| /* |
| * Copyright (c) 2020, Regents of the University of California |
| * Yingdi Yu |
| * |
| * BSD license, See the LICENSE file for more information |
| * |
| * Author: Yingdi Yu <yingdi@cs.ucla.edu> |
| */ |
| |
| #include "invitation-dialog.hpp" |
| #include "ui_invitation-dialog.h" |
| |
| namespace chronochat { |
| |
| InvitationDialog::InvitationDialog(QWidget* parent) |
| : QDialog(parent) |
| , ui(new Ui::InvitationDialog) |
| { |
| ui->setupUi(this); |
| |
| connect(ui->okButton, SIGNAL(clicked()), |
| this, SLOT(onOkClicked())); |
| connect(ui->cancelButton, SIGNAL(clicked()), |
| this, SLOT(onCancelClicked())); |
| } |
| |
| InvitationDialog::~InvitationDialog() |
| { |
| delete ui; |
| } |
| |
| void |
| InvitationDialog::onInvitationReceived(QString alias, QString chatroom, Name interestName) |
| { |
| m_invitationInterest = interestName; |
| |
| QString msg = QString("%1 invites you to chatroom\n %2 ").arg(alias).arg(chatroom); |
| ui->msgLabel->setText(msg); |
| |
| show(); |
| } |
| |
| void |
| InvitationDialog::onOkClicked() |
| { |
| emit invitationResponded(m_invitationInterest, true); |
| this->close(); |
| |
| ui->msgLabel->clear(); |
| m_invitationInterest.clear(); |
| } |
| |
| void |
| InvitationDialog::onCancelClicked() |
| { |
| emit invitationResponded(m_invitationInterest, false); |
| this->close(); |
| |
| ui->msgLabel->clear(); |
| m_invitationInterest.clear(); |
| } |
| |
| } // namespace chronochat |
| |
| #if WAF |
| #include "invitation-dialog.moc" |
| #endif |