Add InvitationDialog
diff --git a/src/invitationdialog.cpp b/src/invitationdialog.cpp
new file mode 100644
index 0000000..bea2693
--- /dev/null
+++ b/src/invitationdialog.cpp
@@ -0,0 +1,55 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+
+#include "invitationdialog.h"
+#include "ui_invitationdialog.h"
+
+using namespace std;
+
+InvitationDialog::InvitationDialog(QWidget *parent) :
+ QDialog(parent),
+ ui(new Ui::InvitationDialog)
+{
+ ui->setupUi(this);
+}
+
+InvitationDialog::~InvitationDialog()
+{
+ delete ui;
+}
+
+void
+InvitationDialog::setMsg(const string& inviter, const string& chatroom)
+{
+ string msg = inviter;
+ msg.append(" invites you to join the chat room: ");
+
+ ui->msgLabel->setText(QString::fromUtf8(msg.c_str()));
+ ui->chatroomLine->setText(QString::fromUtf8(msg.c_str()));
+}
+
+void
+InvitationDialog::onOkClicked()
+{ emit invitationAccepted(m_interestName); }
+
+void
+InvitationDialog::onCancelClicked()
+{
+ ui->msgLabel->clear();
+ ui->chatroomLine->clear();
+ m_interestName = Name();
+ emit invitationRejected(m_interestName);
+}
+
+#if WAF
+#include "invitationdialog.moc"
+#include "invitationdialog.cpp.moc"
+#endif
diff --git a/src/invitationdialog.h b/src/invitationdialog.h
new file mode 100644
index 0000000..bcfeaa6
--- /dev/null
+++ b/src/invitationdialog.h
@@ -0,0 +1,55 @@
+/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
+/*
+ * Copyright (c) 2013, Regents of the University of California
+ * Yingdi Yu
+ *
+ * BSD license, See the LICENSE file for more information
+ *
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+
+#ifndef INVITATIONDIALOG_H
+#define INVITATIONDIALOG_H
+
+#include <QDialog>
+
+namespace Ui {
+class InvitationDialog;
+}
+
+class InvitationDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit InvitationDialog(QWidget *parent = 0);
+ ~InvitationDialog();
+
+ void
+ setMsg(const std::string& inviter, const std::string& chatroom);
+
+ inline void
+ setInterestName(const ndn::Name& interestName)
+ { m_interestName = interestName; }
+
+signals:
+ void
+ invitationAccepted(const ndn::Name& interestName);
+
+ void
+ invitationRejected(const ndn::Name& interestName);
+
+private slots:
+ void
+ onOkClicked();
+
+ void
+ onCancelClicked();
+
+
+private:
+ Ui::InvitationDialog *ui;
+ ndn::Name m_interestName;
+};
+
+#endif // INVITATIONDIALOG_H
diff --git a/src/invitationdialog.ui b/src/invitationdialog.ui
new file mode 100644
index 0000000..b7d9367
--- /dev/null
+++ b/src/invitationdialog.ui
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>InvitationDialog</class>
+ <widget class="QDialog" name="InvitationDialog">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>300</width>
+ <height>200</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Dialog</string>
+ </property>
+ <widget class="QLabel" name="msgLabel">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>30</y>
+ <width>240</width>
+ <height>50</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ <widget class="QLineEdit" name="chatroomLine">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>100</y>
+ <width>241</width>
+ <height>21</height>
+ </rect>
+ </property>
+ <property name="readOnly">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="cancelButton">
+ <property name="geometry">
+ <rect>
+ <x>30</x>
+ <y>150</y>
+ <width>100</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>Cancel</string>
+ </property>
+ </widget>
+ <widget class="QPushButton" name="okButton">
+ <property name="geometry">
+ <rect>
+ <x>170</x>
+ <y>150</y>
+ <width>100</width>
+ <height>32</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>OK</string>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>