blob: e9ac1f833c0e08e58280c03a8b029fae2809f40e [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
14using namespace std;
15
Yingdi Yu348f5ea2014-03-01 14:47:25 -080016StartChatDialog::StartChatDialog(QWidget *parent)
17 : QDialog(parent)
18 , ui(new Ui::StartChatDialog)
Yingdi Yu595aadc2013-10-21 15:01:40 -070019{
20 ui->setupUi(this);
Yingdi Yu348f5ea2014-03-01 14:47:25 -080021
Yingdi Yu595aadc2013-10-21 15:01:40 -070022 connect(ui->okButton, SIGNAL(clicked()),
23 this, SLOT(onOkClicked()));
24 connect(ui->cancelButton, SIGNAL(clicked()),
25 this, SLOT(onCancelClicked()));
26}
27
28StartChatDialog::~StartChatDialog()
Yingdi Yu348f5ea2014-03-01 14:47:25 -080029{
30 delete ui;
31}
Yingdi Yu595aadc2013-10-21 15:01:40 -070032
33void
Yingdi Yufa4ce792014-02-06 18:09:22 -080034StartChatDialog::setChatroom(const string& chatroom)
Yingdi Yu348f5ea2014-03-01 14:47:25 -080035{
36 ui->chatroomInput->setText(QString::fromStdString(chatroom));
37}
Yingdi Yu595aadc2013-10-21 15:01:40 -070038
Yingdi Yufa4ce792014-02-06 18:09:22 -080039void
Yingdi Yu595aadc2013-10-21 15:01:40 -070040StartChatDialog::onOkClicked()
41{
42 QString chatroom = ui->chatroomInput->text();
Yingdi Yu348f5ea2014-03-01 14:47:25 -080043 bool secured = ui->withSecurity->isChecked();
44 emit startChatroom(chatroom, secured);
Yingdi Yu595aadc2013-10-21 15:01:40 -070045 this->close();
46}
47
48void
49StartChatDialog::onCancelClicked()
Yingdi Yu348f5ea2014-03-01 14:47:25 -080050{
51 this->close();
52}
Yingdi Yu595aadc2013-10-21 15:01:40 -070053
Yingdi Yu595aadc2013-10-21 15:01:40 -070054#if WAF
Yingdi Yu348f5ea2014-03-01 14:47:25 -080055#include "start-chat-dialog.moc"
56#include "start-chat-dialog.cpp.moc"
Yingdi Yu595aadc2013-10-21 15:01:40 -070057#endif