Mengjin Yan | 391d724 | 2014-08-28 20:51:55 -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: Mengjin Yan <jane.yan0129@gmail.com> |
| 9 | * Author: Yingdi Yu <yingdi@cs.ucla.edu> |
| 10 | */ |
| 11 | #include "chatroom-discovery-view-dialog.hpp" |
| 12 | #include "ui_chatroom-discovery-view-dialog.h" |
| 13 | |
| 14 | namespace chronos { |
| 15 | |
| 16 | using std::vector; |
| 17 | using ndn::Name; |
| 18 | |
| 19 | ChatroomDiscoveryViewDialog::ChatroomDiscoveryViewDialog(QWidget* parent) |
| 20 | : QDialog(parent) |
| 21 | , ui(new Ui::ChatroomDiscoveryViewDialog) |
| 22 | { |
| 23 | ui->setupUi(this); |
| 24 | |
| 25 | ui->participantsBrowser->setReadOnly(true); |
| 26 | |
| 27 | connect(ui->closeButton, SIGNAL(clicked()), |
| 28 | this, SLOT(onCloseButtonClicked())); |
| 29 | } |
| 30 | |
| 31 | ChatroomDiscoveryViewDialog::~ChatroomDiscoveryViewDialog() |
| 32 | { |
| 33 | delete ui; |
| 34 | } |
| 35 | |
| 36 | void |
| 37 | ChatroomDiscoveryViewDialog::onCloseButtonClicked() |
| 38 | { |
| 39 | this->close(); |
| 40 | } |
| 41 | |
| 42 | void |
| 43 | ChatroomDiscoveryViewDialog::setChatroomName(QString chatroomName) |
| 44 | { |
| 45 | ui->chatroomNameLabel->setText("Chatroom Name: "+chatroomName); |
| 46 | } |
| 47 | |
| 48 | void |
| 49 | ChatroomDiscoveryViewDialog::setChatroomTrustModel(QString chatroomTrustModel) |
| 50 | { |
| 51 | ui->chatroomTrustModelLabel->setText("Chatroom Trust Model: "+chatroomTrustModel); |
| 52 | } |
| 53 | |
| 54 | void |
| 55 | ChatroomDiscoveryViewDialog::setChatroomParticipants(const vector<Name>& participants) |
| 56 | { |
| 57 | QString content; |
| 58 | for (vector<Name>::const_iterator it = participants.begin(); |
| 59 | it != participants.end(); it++) { |
| 60 | content.append(QString::fromStdString(it->toUri())).append("\n"); |
| 61 | } |
| 62 | |
| 63 | ui->participantsBrowser->setPlainText(content); |
| 64 | } |
| 65 | |
| 66 | } // namespace chronos |
| 67 | |
| 68 | #if WAF |
| 69 | #include "chatroom-discovery-view-dialog.moc" |
| 70 | #endif |