blob: 15a6726f168bcf25280ad0d2af490bc538457d9a [file] [log] [blame]
Qiuhan Dingba3e57a2015-01-08 19:07:39 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
Varun Patila24bd3e2020-11-24 10:08:33 +05303 * Copyright (c) 2020, Regents of the University of California
Qiuhan Dingba3e57a2015-01-08 19:07:39 -08004 *
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
14namespace chronochat {
15
16InvitationRequestDialog::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
28InvitationRequestDialog::~InvitationRequestDialog()
29{
30 delete ui;
31}
32
33void
34InvitationRequestDialog::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
46void
47InvitationRequestDialog::onOkClicked()
48{
49 emit invitationRequestResponded(m_invitationInterest, true);
50 this->close();
51
52 ui->msgLabel->clear();
53 m_invitationInterest.clear();
54}
55
56void
57InvitationRequestDialog::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 Dingba3e57a2015-01-08 19:07:39 -080070#endif