blob: b7a47257945f99b94ccfa2d0f64162f9ab6bab6a [file] [log] [blame]
Yingdi Yu348f5ea2014-03-01 14:47:25 -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
Yingdi Yu348f5ea2014-03-01 14:47:25 -08004 * Yingdi Yu
5 *
6 * BSD license, See the LICENSE file for more information
7 *
8 * Author: Yingdi Yu <yingdi@cs.ucla.edu>
9 */
10
Yingdi Yu0b0a7362014-08-05 16:31:30 -070011#include "invitation-dialog.hpp"
Yingdi Yu348f5ea2014-03-01 14:47:25 -080012#include "ui_invitation-dialog.h"
13
Yingdi Yueb692ac2015-02-10 18:46:18 -080014namespace chronochat {
Yingdi Yu348f5ea2014-03-01 14:47:25 -080015
Yingdi Yu0b0a7362014-08-05 16:31:30 -070016InvitationDialog::InvitationDialog(QWidget* parent)
Yingdi Yu348f5ea2014-03-01 14:47:25 -080017 : QDialog(parent)
18 , ui(new Ui::InvitationDialog)
19{
20 ui->setupUi(this);
Yingdi Yufa0b6a02014-04-30 14:26:42 -070021
Yingdi Yu348f5ea2014-03-01 14:47:25 -080022 connect(ui->okButton, SIGNAL(clicked()),
23 this, SLOT(onOkClicked()));
24 connect(ui->cancelButton, SIGNAL(clicked()),
25 this, SLOT(onCancelClicked()));
26}
27
28InvitationDialog::~InvitationDialog()
29{
30 delete ui;
31}
32
33void
Yingdi Yu2c9e7712014-10-20 11:55:05 -070034InvitationDialog::onInvitationReceived(QString alias, QString chatroom, Name interestName)
Yingdi Yu348f5ea2014-03-01 14:47:25 -080035{
Yingdi Yu233a9722014-03-07 15:47:09 -080036 m_invitationInterest = interestName;
Yingdi Yu2c9e7712014-10-20 11:55:05 -070037
38 QString msg = QString("%1 invites you to chatroom\n %2 ").arg(alias).arg(chatroom);
39 ui->msgLabel->setText(msg);
40
41 show();
Yingdi Yu348f5ea2014-03-01 14:47:25 -080042}
43
44void
45InvitationDialog::onOkClicked()
Yingdi Yufa0b6a02014-04-30 14:26:42 -070046{
47 emit invitationResponded(m_invitationInterest, true);
Yingdi Yu348f5ea2014-03-01 14:47:25 -080048 this->close();
49
50 ui->msgLabel->clear();
51 m_invitationInterest.clear();
52}
Yingdi Yufa0b6a02014-04-30 14:26:42 -070053
Yingdi Yu348f5ea2014-03-01 14:47:25 -080054void
55InvitationDialog::onCancelClicked()
Yingdi Yufa0b6a02014-04-30 14:26:42 -070056{
Yingdi Yu348f5ea2014-03-01 14:47:25 -080057 emit invitationResponded(m_invitationInterest, false);
58 this->close();
59
60 ui->msgLabel->clear();
61 m_invitationInterest.clear();
62}
63
Yingdi Yueb692ac2015-02-10 18:46:18 -080064} // namespace chronochat
Yingdi Yu0b0a7362014-08-05 16:31:30 -070065
Yingdi Yu348f5ea2014-03-01 14:47:25 -080066#if WAF
67#include "invitation-dialog.moc"
Yingdi Yu348f5ea2014-03-01 14:47:25 -080068#endif