Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 1 | /* -*- 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 Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 11 | #include "start-chat-dialog.h" |
| 12 | #include "ui_start-chat-dialog.h" |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 13 | |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 14 | StartChatDialog::StartChatDialog(QWidget *parent) |
| 15 | : QDialog(parent) |
| 16 | , ui(new Ui::StartChatDialog) |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 17 | { |
| 18 | ui->setupUi(this); |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 19 | |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 20 | connect(ui->okButton, SIGNAL(clicked()), |
| 21 | this, SLOT(onOkClicked())); |
| 22 | connect(ui->cancelButton, SIGNAL(clicked()), |
| 23 | this, SLOT(onCancelClicked())); |
| 24 | } |
| 25 | |
| 26 | StartChatDialog::~StartChatDialog() |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 27 | { |
| 28 | delete ui; |
| 29 | } |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 30 | |
| 31 | void |
Yingdi Yu | 17032f8 | 2014-03-25 15:48:23 -0700 | [diff] [blame^] | 32 | StartChatDialog::setChatroom(const std::string& chatroom) |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 33 | { |
| 34 | ui->chatroomInput->setText(QString::fromStdString(chatroom)); |
| 35 | } |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 36 | |
Yingdi Yu | fa4ce79 | 2014-02-06 18:09:22 -0800 | [diff] [blame] | 37 | void |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 38 | StartChatDialog::onOkClicked() |
| 39 | { |
| 40 | QString chatroom = ui->chatroomInput->text(); |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 41 | bool secured = ui->withSecurity->isChecked(); |
| 42 | emit startChatroom(chatroom, secured); |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 43 | this->close(); |
| 44 | } |
| 45 | |
| 46 | void |
| 47 | StartChatDialog::onCancelClicked() |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 48 | { |
| 49 | this->close(); |
| 50 | } |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 51 | |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 52 | #if WAF |
Yingdi Yu | 348f5ea | 2014-03-01 14:47:25 -0800 | [diff] [blame] | 53 | #include "start-chat-dialog.moc" |
| 54 | #include "start-chat-dialog.cpp.moc" |
Yingdi Yu | 595aadc | 2013-10-21 15:01:40 -0700 | [diff] [blame] | 55 | #endif |