blob: d3949e523ffae951adcda6a9bd51aea0f5c0fdf2 [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 Yueb692ac2015-02-10 18:46:18 -080014namespace chronochat {
Yingdi Yu0b0a7362014-08-05 16:31:30 -070015
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 Yud85e29f2014-09-09 17:20:04 -070043 bool secured = false;
44 // bool secured = ui->withSecurity->isChecked();
Yingdi Yu348f5ea2014-03-01 14:47:25 -080045 emit startChatroom(chatroom, secured);
Yingdi Yu595aadc2013-10-21 15:01:40 -070046 this->close();
47}
48
49void
50StartChatDialog::onCancelClicked()
Yingdi Yufa0b6a02014-04-30 14:26:42 -070051{
52 this->close();
Yingdi Yu348f5ea2014-03-01 14:47:25 -080053}
Yingdi Yu595aadc2013-10-21 15:01:40 -070054
Yingdi Yueb692ac2015-02-10 18:46:18 -080055} // namespace chronochat
Yingdi Yu0b0a7362014-08-05 16:31:30 -070056
Yingdi Yu595aadc2013-10-21 15:01:40 -070057#if WAF
Yingdi Yu348f5ea2014-03-01 14:47:25 -080058#include "start-chat-dialog.moc"
Yingdi Yu42125862014-08-07 17:04:28 -070059// #include "start-chat-dialog.cpp.moc"
Yingdi Yu595aadc2013-10-21 15:01:40 -070060#endif