blob: 47b63f138c41a2c5b406ca301693993992433806 [file] [log] [blame]
Qiuhan Dingba3e57a2015-01-08 19:07:39 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
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
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"
70// #include "invitation-request-dialog.cpp.moc"
71#endif