blob: f79e4a25d6ed31f97f8f585badcc3b16bf655ee1 [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 Yufa0b6a02014-04-30 14:26:42 -070014StartChatDialog::StartChatDialog(QWidget *parent)
Yingdi Yu348f5ea2014-03-01 14:47:25 -080015 : 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()),
Yingdi Yufa0b6a02014-04-30 14:26:42 -070021 this, SLOT(onOkClicked()));
Yingdi Yu595aadc2013-10-21 15:01:40 -070022 connect(ui->cancelButton, SIGNAL(clicked()),
Yingdi Yufa0b6a02014-04-30 14:26:42 -070023 this, SLOT(onCancelClicked()));
Yingdi Yu595aadc2013-10-21 15:01:40 -070024}
25
26StartChatDialog::~StartChatDialog()
Yingdi Yufa0b6a02014-04-30 14:26:42 -070027{
28 delete ui;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080029}
Yingdi Yu595aadc2013-10-21 15:01:40 -070030
31void
Yingdi Yu17032f82014-03-25 15:48:23 -070032StartChatDialog::setChatroom(const std::string& chatroom)
Yingdi Yufa0b6a02014-04-30 14:26:42 -070033{
34 ui->chatroomInput->setText(QString::fromStdString(chatroom));
Yingdi Yu348f5ea2014-03-01 14:47:25 -080035}
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 Yufa0b6a02014-04-30 14:26:42 -070048{
49 this->close();
Yingdi Yu348f5ea2014-03-01 14:47:25 -080050}
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