blob: 7eff07ba9e037ffd87c37dda368b232b67b4d77c [file] [log] [blame]
Mengjin Yan391d7242014-08-28 20:51:55 -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: 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
14namespace chronos {
15
16using std::vector;
17using ndn::Name;
18
19ChatroomDiscoveryViewDialog::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
31ChatroomDiscoveryViewDialog::~ChatroomDiscoveryViewDialog()
32{
33 delete ui;
34}
35
36void
37ChatroomDiscoveryViewDialog::onCloseButtonClicked()
38{
39 this->close();
40}
41
42void
43ChatroomDiscoveryViewDialog::setChatroomName(QString chatroomName)
44{
45 ui->chatroomNameLabel->setText("Chatroom Name: "+chatroomName);
46}
47
48void
49ChatroomDiscoveryViewDialog::setChatroomTrustModel(QString chatroomTrustModel)
50{
51 ui->chatroomTrustModelLabel->setText("Chatroom Trust Model: "+chatroomTrustModel);
52}
53
54void
55ChatroomDiscoveryViewDialog::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