blob: 916a6d22612d4c019df1d3f60d90dce810ffc40f [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#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
26namespace Ui {
27class ChatroomDiscoveryDialog;
28}
29
Yingdi Yueb692ac2015-02-10 18:46:18 -080030namespace chronochat {
Mengjin Yan391d7242014-08-28 20:51:55 -070031
32class ChatroomDiscoveryDialog : public QDialog
33{
34 Q_OBJECT
35
36public:
37 explicit
38 ChatroomDiscoveryDialog(QWidget* parent = 0);
39
40 ~ChatroomDiscoveryDialog();
41
42 void
43 updateChatroomList();
44
45signals:
46 void
47 startChatroom(const QString& chatroomName, bool secured);
48
49public slots:
50 void
Yingdi Yueb692ac2015-02-10 18:46:18 -080051 onDiscoverChatroomChanged(const chronochat::ChatroomInfo& chatroom, bool isAdd);
Mengjin Yan391d7242014-08-28 20:51:55 -070052
53private 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
69private:
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 Yueb692ac2015-02-10 18:46:18 -080085} //namespace chronochat
Mengjin Yan391d7242014-08-28 20:51:55 -070086
87#endif // CHRONOCHAT_CHATROOM_DISCOVERY_DIALOG_HPP