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 | #ifndef CHRONOCHAT_CHATROOM_DISCOVERY_DIALOG_HPP |
| 12 | #define CHRONOCHAT_CHATROOM_DISCOVERY_DIALOG_HPP |
| 13 | |
| 14 | #include <QDialog> |
| 15 | #include <QModelIndex> |
| 16 | #include <QStandardItem> |
| 17 | #include <QHeaderView> |
| 18 | #include <QMessageBox> |
| 19 | #include <QDebug> |
| 20 | #include "chatroom-discovery-view-dialog.hpp" |
| 21 | |
| 22 | #ifndef Q_MOC_RUN |
| 23 | #include "chatroom-info.hpp" |
| 24 | #endif |
| 25 | |
| 26 | namespace Ui { |
| 27 | class ChatroomDiscoveryDialog; |
| 28 | } |
| 29 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 30 | namespace chronochat { |
Mengjin Yan | 391d724 | 2014-08-28 20:51:55 -0700 | [diff] [blame] | 31 | |
| 32 | class ChatroomDiscoveryDialog : public QDialog |
| 33 | { |
| 34 | Q_OBJECT |
| 35 | |
| 36 | public: |
| 37 | explicit |
| 38 | ChatroomDiscoveryDialog(QWidget* parent = 0); |
| 39 | |
| 40 | ~ChatroomDiscoveryDialog(); |
| 41 | |
| 42 | void |
| 43 | updateChatroomList(); |
| 44 | |
| 45 | signals: |
| 46 | void |
| 47 | startChatroom(const QString& chatroomName, bool secured); |
| 48 | |
| 49 | public slots: |
| 50 | void |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 51 | onDiscoverChatroomChanged(const chronochat::ChatroomInfo& chatroom, bool isAdd); |
Mengjin Yan | 391d724 | 2014-08-28 20:51:55 -0700 | [diff] [blame] | 52 | |
| 53 | private slots: |
| 54 | void |
| 55 | onCancelButtonClicked(); |
| 56 | |
| 57 | void |
| 58 | onJoinButtonClicked(); |
| 59 | |
| 60 | void |
| 61 | onViewButtonClicked(); |
| 62 | |
| 63 | void |
| 64 | onChatroomListViewDoubleClicked(const QModelIndex& index); |
| 65 | |
| 66 | void |
| 67 | onChatroomListViewClicked(const QModelIndex& index); |
| 68 | |
| 69 | private: |
| 70 | |
| 71 | typedef std::map<Name::Component, ChatroomInfo> Chatrooms; |
| 72 | |
| 73 | Ui::ChatroomDiscoveryDialog *ui; |
| 74 | QStandardItemModel* m_standardItemModel; |
| 75 | |
| 76 | int m_selectedRow; |
| 77 | |
| 78 | Chatrooms m_chatrooms; |
| 79 | |
| 80 | |
| 81 | |
| 82 | ChatroomDiscoveryViewDialog* m_chatroomDiscoveryViewDialog; |
| 83 | }; |
| 84 | |
Yingdi Yu | eb692ac | 2015-02-10 18:46:18 -0800 | [diff] [blame] | 85 | } //namespace chronochat |
Mengjin Yan | 391d724 | 2014-08-28 20:51:55 -0700 | [diff] [blame] | 86 | |
| 87 | #endif // CHRONOCHAT_CHATROOM_DISCOVERY_DIALOG_HPP |