blob: 8aa79653be7666e63d57c677404fe999353afdc8 [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 Yu0b0a7362014-08-05 16:31:30 -070011#include "start-chat-dialog.hpp"
Yingdi Yu348f5ea2014-03-01 14:47:25 -080012#include "ui_start-chat-dialog.h"
Yingdi Yu595aadc2013-10-21 15:01:40 -070013
Yingdi Yu0b0a7362014-08-05 16:31:30 -070014namespace chronos {
15
Yingdi Yufa0b6a02014-04-30 14:26:42 -070016StartChatDialog::StartChatDialog(QWidget *parent)
Yingdi Yu348f5ea2014-03-01 14:47:25 -080017 : 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()),
Yingdi Yufa0b6a02014-04-30 14:26:42 -070023 this, SLOT(onOkClicked()));
Yingdi Yu595aadc2013-10-21 15:01:40 -070024 connect(ui->cancelButton, SIGNAL(clicked()),
Yingdi Yufa0b6a02014-04-30 14:26:42 -070025 this, SLOT(onCancelClicked()));
Yingdi Yu595aadc2013-10-21 15:01:40 -070026}
27
28StartChatDialog::~StartChatDialog()
Yingdi Yufa0b6a02014-04-30 14:26:42 -070029{
30 delete ui;
Yingdi Yu348f5ea2014-03-01 14:47:25 -080031}
Yingdi Yu595aadc2013-10-21 15:01:40 -070032
33void
Yingdi Yu17032f82014-03-25 15:48:23 -070034StartChatDialog::setChatroom(const std::string& chatroom)
Yingdi Yufa0b6a02014-04-30 14:26:42 -070035{
36 ui->chatroomInput->setText(QString::fromStdString(chatroom));
Yingdi Yu348f5ea2014-03-01 14:47:25 -080037}
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 Yufa0b6a02014-04-30 14:26:42 -070050{
51 this->close();
Yingdi Yu348f5ea2014-03-01 14:47:25 -080052}
Yingdi Yu595aadc2013-10-21 15:01:40 -070053
Yingdi Yu0b0a7362014-08-05 16:31:30 -070054} // namespace chronos
55
Yingdi Yu595aadc2013-10-21 15:01:40 -070056#if WAF
Yingdi Yu348f5ea2014-03-01 14:47:25 -080057#include "start-chat-dialog.moc"
58#include "start-chat-dialog.cpp.moc"
Yingdi Yu595aadc2013-10-21 15:01:40 -070059#endif