blob: c508c1ecd29a261887fe3c65474efe2e06a2f312 [file] [log] [blame]
Yingdi Yu595aadc2013-10-21 15:01:40 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2/*
3 * Copyright (c) 2013, Regents of the University of California
4 * 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 Yu348f5ea2014-03-01 14:47:25 -080011#include "start-chat-dialog.h"
12#include "ui_start-chat-dialog.h"
Yingdi Yu595aadc2013-10-21 15:01:40 -070013
Yingdi Yu348f5ea2014-03-01 14:47:25 -080014StartChatDialog::StartChatDialog(QWidget *parent)
15 : QDialog(parent)
16 , ui(new Ui::StartChatDialog)
Yingdi Yu595aadc2013-10-21 15:01:40 -070017{
18 ui->setupUi(this);
Yingdi Yu348f5ea2014-03-01 14:47:25 -080019
Yingdi Yu595aadc2013-10-21 15:01:40 -070020 connect(ui->okButton, SIGNAL(clicked()),
21 this, SLOT(onOkClicked()));
22 connect(ui->cancelButton, SIGNAL(clicked()),
23 this, SLOT(onCancelClicked()));
24}
25
26StartChatDialog::~StartChatDialog()
Yingdi Yu348f5ea2014-03-01 14:47:25 -080027{
28 delete ui;
29}
Yingdi Yu595aadc2013-10-21 15:01:40 -070030
31void
Yingdi Yu17032f82014-03-25 15:48:23 -070032StartChatDialog::setChatroom(const std::string& chatroom)
Yingdi Yu348f5ea2014-03-01 14:47:25 -080033{
34 ui->chatroomInput->setText(QString::fromStdString(chatroom));
35}
Yingdi Yu595aadc2013-10-21 15:01:40 -070036
Yingdi Yufa4ce792014-02-06 18:09:22 -080037void
Yingdi Yu595aadc2013-10-21 15:01:40 -070038StartChatDialog::onOkClicked()
39{
40 QString chatroom = ui->chatroomInput->text();
Yingdi Yu348f5ea2014-03-01 14:47:25 -080041 bool secured = ui->withSecurity->isChecked();
42 emit startChatroom(chatroom, secured);
Yingdi Yu595aadc2013-10-21 15:01:40 -070043 this->close();
44}
45
46void
47StartChatDialog::onCancelClicked()
Yingdi Yu348f5ea2014-03-01 14:47:25 -080048{
49 this->close();
50}
Yingdi Yu595aadc2013-10-21 15:01:40 -070051
Yingdi Yu595aadc2013-10-21 15:01:40 -070052#if WAF
Yingdi Yu348f5ea2014-03-01 14:47:25 -080053#include "start-chat-dialog.moc"
54#include "start-chat-dialog.cpp.moc"
Yingdi Yu595aadc2013-10-21 15:01:40 -070055#endif