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