blob: 95fd5d2365e9c438e67adbd9f3ab9a90db0532be (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
/*
* Copyright (c) 2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#pragma once
#include <set>
#include <QSortFilterProxyModel>
#include <QString>
#include <QWidget>
#include <Swiften/JID/JID.h>
class QListView;
namespace Swift {
class ChattablesModel;
class QtClickableLabel;
class QtExpandedListView;
class BundleFilter : public QSortFilterProxyModel {
Q_OBJECT
public:
enum class Filter {Unread, People, Rooms, Online};
BundleFilter(QObject* parent);
void addFilter(Filter);
bool hasFilter(Filter);
void removeFilter(Filter);
protected:
bool filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const;
private:
std::set<Filter> filters_;
};
class QtChatOverviewBundle : public QWidget {
Q_OBJECT
public:
QtChatOverviewBundle(ChattablesModel*, QString name, bool hideWhenEmpty, QWidget* parent);
~QtChatOverviewBundle() override;
signals:
void clicked(JID jid);
private slots:
void handleFilterClicked();
void handleItemClicked(const QModelIndex&);
private:
void updateVisibility();
private:
ChattablesModel* rootModel_;
QtExpandedListView* listView_;
BundleFilter* proxyModel_;
bool hideWhenEmpty_;
QtClickableLabel* filterLabel_ = nullptr;
};
}
|