Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/channellist/channellistview.h
Show All 15 Lines | 1 | /* | |||
---|---|---|---|---|---|
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef CHANNELLISTVIEW_H | 21 | #ifndef CHANNELLISTVIEW_H | ||
22 | #define CHANNELLISTVIEW_H | 22 | #define CHANNELLISTVIEW_H | ||
23 | 23 | | |||
24 | #include <QListView> | 24 | #include <QTreeView> | ||
25 | 25 | | |||
26 | #include "libruqolawidgets_private_export.h" | 26 | #include "libruqolawidgets_private_export.h" | ||
27 | 27 | | |||
28 | class RoomFilterProxyModel; | 28 | class AccountsChannelsModel; | ||
29 | class RocketChatAccount; | ||||
29 | 30 | | |||
30 | class LIBRUQOLAWIDGETS_TESTS_EXPORT ChannelListView : public QListView | 31 | class LIBRUQOLAWIDGETS_TESTS_EXPORT ChannelListView : public QTreeView | ||
31 | { | 32 | { | ||
32 | Q_OBJECT | 33 | Q_OBJECT | ||
33 | public: | 34 | public: | ||
34 | explicit ChannelListView(QWidget *parent = nullptr); | 35 | explicit ChannelListView(QWidget *parent = nullptr); | ||
35 | ~ChannelListView() override; | 36 | ~ChannelListView() override; | ||
36 | 37 | | |||
37 | RoomFilterProxyModel *model() const; | 38 | void setModel(QAbstractItemModel *) override; | ||
38 | void setModel(QAbstractItemModel *model) override; | 39 | void model() const = delete; | ||
39 | 40 | | |||
40 | void selectChannelRequested(const QString &channelId); | 41 | void activateChannel(const QModelIndex &index); | ||
42 | void activateChannelById(const QString &channelId); | ||||
43 | Q_REQUIRED_RESULT bool activateChannelByRoomName(const QString &selectedRoomName); | ||||
41 | 44 | | |||
42 | Q_REQUIRED_RESULT bool selectChannelByRoomNameRequested(const QString &selectedRoomName); | 45 | void moveSelectionDown(); | ||
46 | void moveSelectionUp(); | ||||
43 | 47 | | |||
44 | void channelSelected(const QModelIndex &index); | 48 | void setFilterString(const QString &filter); | ||
45 | 49 | | |||
46 | Q_SIGNALS: | 50 | Q_SIGNALS: | ||
47 | void roomSelected(const QString &roomId, const QString &roomType); | 51 | void channelActivated(const QString &acct, const QString &roomId, const QString &roomType); | ||
48 | 52 | | |||
49 | protected: | 53 | protected: | ||
50 | void contextMenuEvent(QContextMenuEvent *event) override; | 54 | void contextMenuEvent(QContextMenuEvent *event) override; | ||
51 | 55 | | |||
52 | private: | 56 | private: | ||
57 | AccountsChannelsModel *rooms() const; | ||||
58 | | ||||
53 | void slotClicked(const QModelIndex &index); | 59 | void slotClicked(const QModelIndex &index); | ||
54 | void slotHideChannel(const QModelIndex &index, const QString &roomType); | 60 | void slotHideChannel(const QModelIndex &index, const QString &roomType); | ||
55 | void slotLeaveChannel(const QModelIndex &index, const QString &roomType); | 61 | void slotLeaveChannel(const QModelIndex &index, const QString &roomType); | ||
56 | void slotChangeFavorite(const QModelIndex &index, bool isFavorite); | 62 | void slotChangeFavorite(const QModelIndex &index, bool isFavorite); | ||
63 | | ||||
64 | // TODO: Move this state out of this widget | ||||
65 | QString mCurrentChannelId; | ||||
57 | }; | 66 | }; | ||
58 | 67 | | |||
59 | #endif // CHANNELLISTVIEW_H | 68 | #endif // CHANNELLISTVIEW_H |