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 | |
| 11 | #include "startchatdialog.h" |
| 12 | #include "ui_startchatdialog.h" |
| 13 | |
| 14 | using namespace std; |
| 15 | |
| 16 | StartChatDialog::StartChatDialog(QWidget *parent) : |
| 17 | QDialog(parent), |
| 18 | ui(new Ui::StartChatDialog) |
| 19 | { |
| 20 | ui->setupUi(this); |
| 21 | connect(ui->okButton, SIGNAL(clicked()), |
| 22 | this, SLOT(onOkClicked())); |
| 23 | connect(ui->cancelButton, SIGNAL(clicked()), |
| 24 | this, SLOT(onCancelClicked())); |
| 25 | } |
| 26 | |
| 27 | StartChatDialog::~StartChatDialog() |
| 28 | { |
| 29 | delete ui; |
| 30 | } |
| 31 | |
| 32 | void |
| 33 | StartChatDialog::setInvitee(const string& invitee, const string& chatroom) |
| 34 | { |
| 35 | m_invitee = invitee; |
| 36 | ui->chatroomInput->setText(QString::fromUtf8(chatroom.c_str())); |
| 37 | } |
| 38 | |
| 39 | void |
| 40 | StartChatDialog::onOkClicked() |
| 41 | { |
| 42 | QString chatroom = ui->chatroomInput->text(); |
| 43 | QString invitee = QString::fromUtf8(m_invitee.c_str()); |
| 44 | bool isIntroducer = ui->introCheckBox->isChecked(); |
| 45 | emit chatroomConfirmed(chatroom, invitee, isIntroducer); |
| 46 | this->close(); |
| 47 | } |
| 48 | |
| 49 | void |
| 50 | StartChatDialog::onCancelClicked() |
| 51 | { this->close(); } |
| 52 | |
| 53 | |
| 54 | #if WAF |
| 55 | #include "startchatdialog.moc" |
| 56 | #include "startchatdialog.cpp.moc" |
| 57 | #endif |