Add chatroom discovery UI
Change-Id: I94ee73ce9b4bcc63e7ecbdbf2f4844b6b57615a3
diff --git a/src/chatroom-discovery-dialog.hpp b/src/chatroom-discovery-dialog.hpp
new file mode 100644
index 0000000..0193cbd
--- /dev/null
+++ b/src/chatroom-discovery-dialog.hpp
@@ -0,0 +1,87 @@
+/* -*- 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: Mengjin Yan <jane.yan0129@gmail.com>
+ * Author: Yingdi Yu <yingdi@cs.ucla.edu>
+ */
+#ifndef CHRONOCHAT_CHATROOM_DISCOVERY_DIALOG_HPP
+#define CHRONOCHAT_CHATROOM_DISCOVERY_DIALOG_HPP
+
+#include <QDialog>
+#include <QModelIndex>
+#include <QStandardItem>
+#include <QHeaderView>
+#include <QMessageBox>
+#include <QDebug>
+#include "chatroom-discovery-view-dialog.hpp"
+
+#ifndef Q_MOC_RUN
+#include "chatroom-info.hpp"
+#endif
+
+namespace Ui {
+class ChatroomDiscoveryDialog;
+}
+
+namespace chronos {
+
+class ChatroomDiscoveryDialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ explicit
+ ChatroomDiscoveryDialog(QWidget* parent = 0);
+
+ ~ChatroomDiscoveryDialog();
+
+ void
+ updateChatroomList();
+
+signals:
+ void
+ startChatroom(const QString& chatroomName, bool secured);
+
+public slots:
+ void
+ onDiscoverChatroomChanged(const chronos::ChatroomInfo& chatroom, bool isAdd);
+
+private slots:
+ void
+ onCancelButtonClicked();
+
+ void
+ onJoinButtonClicked();
+
+ void
+ onViewButtonClicked();
+
+ void
+ onChatroomListViewDoubleClicked(const QModelIndex& index);
+
+ void
+ onChatroomListViewClicked(const QModelIndex& index);
+
+private:
+
+ typedef std::map<Name::Component, ChatroomInfo> Chatrooms;
+
+ Ui::ChatroomDiscoveryDialog *ui;
+ QStandardItemModel* m_standardItemModel;
+
+ int m_selectedRow;
+
+ Chatrooms m_chatrooms;
+
+
+
+ ChatroomDiscoveryViewDialog* m_chatroomDiscoveryViewDialog;
+};
+
+} //namespace chronos
+
+#endif // CHRONOCHAT_CHATROOM_DISCOVERY_DIALOG_HPP