on xenial help sign in
Removed commented code.
1099b0bPawel Stolowski
plugins/Unity/categories.cpp−57
@@ -20,12 +20,10 @@
20// self
20// self
21#include "categories.h"
21#include "categories.h"
22#include "categoryfilter.h"
22#include "categoryfilter.h"
23−#include <QDebug>
24
23
25Categories::Categories(QObject* parent)
24Categories::Categories(QObject* parent)
26 : DeeListModel(parent)
25 : DeeListModel(parent)
27 , m_resultModel(0)
26 , m_resultModel(0)
28−// , m_globalResultModel(0)
29{
27{
30 // FIXME: need to clean up unused filters on countChanged
28 // FIXME: need to clean up unused filters on countChanged
31 m_roles[Categories::RoleId] = "id";
29 m_roles[Categories::RoleId] = "id";
@@ -34,9 +32,7 @@ Categories::Categories(QObject* parent)
34 m_roles[Categories::RoleRenderer] = "renderer";
32 m_roles[Categories::RoleRenderer] = "renderer";
35 m_roles[Categories::RoleHints] = "hints";
33 m_roles[Categories::RoleHints] = "hints";
36 m_roles[Categories::RoleResults] = "results";
34 m_roles[Categories::RoleResults] = "results";
37− m_roles[Categories::RoleGlobalResults] = "globalResults";
38 m_roles[Categories::RoleCount] = "count";
35 m_roles[Categories::RoleCount] = "count";
39− m_roles[Categories::RoleGlobalCount] = "globalCount";
40
36
41 // TODO This should not be needed but accumulatting the count changes
37 // TODO This should not be needed but accumulatting the count changes
42 // makes the visualization more stable and also makes crashes on fast
38 // makes the visualization more stable and also makes crashes on fast
@@ -49,7 +45,6 @@ Categories::Categories(QObject* parent)
49Categories::~Categories()
45Categories::~Categories()
50{
46{
51 qDeleteAll(m_filters);
47 qDeleteAll(m_filters);
52−// qDeleteAll(m_globalFilters);
53}
48}
54
49
55CategoryFilter*
50CategoryFilter*
@@ -67,21 +62,6 @@ Categories::getFilter(int index) const
67 return m_filters[index];
62 return m_filters[index];
68}
63}
69
64
70−/*CategoryFilter*
71−Categories::getGlobalFilter(int index) const
72−{
73− if (!m_globalFilters.contains(index)) {
74− CategoryFilter* filter = new CategoryFilter();
75− connect(filter, SIGNAL(countChanged()), this, SLOT(onGlobalCountChanged()));
76− filter->setModel(m_globalResultModel);
77− filter->setIndex(index);
78−
79− m_globalFilters.insert(index, filter);
80− }
81−
82− return m_globalFilters[index];
83− }*/
84−
85void
65void
86Categories::setResultModel(DeeListModel* model)
66Categories::setResultModel(DeeListModel* model)
87{
67{
@@ -96,21 +76,6 @@ Categories::setResultModel(DeeListModel* model)
96 }
76 }
97}
77}
98
78
99−/*
100−void
101−Categories::setGlobalResultModel(DeeListModel* model)
102−{
103− if (model != m_globalResultModel) {
104− m_globalResultModel = model;
105−
106− Q_FOREACH(CategoryFilter* filter, m_globalFilters) {
107− filter->setModel(m_globalResultModel);
108− }
109−
110− Q_EMIT globalResultModelChanged(m_globalResultModel);
111− }
112− }*/
113−
114void
79void
115Categories::onCountChanged()
80Categories::onCountChanged()
116{
81{
@@ -133,19 +98,6 @@ Categories::onEmitCountChanged()
133 m_timerFilters.clear();
98 m_timerFilters.clear();
134}
99}
135
100
136−/*
137−void
138−Categories::onGlobalCountChanged()
139−{
140− CategoryFilter* filter = qobject_cast<CategoryFilter*>(sender());
141− if (filter) {
142− QModelIndex changedIndex = index(filter->index());
143− QVector<int> roles;
144− roles.append(Categories::RoleGlobalCount);
145− Q_EMIT dataChanged(changedIndex, changedIndex, roles);
146− }
147− }*/
148−
149QHash<int, QByteArray>
101QHash<int, QByteArray>
150Categories::roleNames() const
102Categories::roleNames() const
151{
103{
@@ -171,18 +123,9 @@ Categories::data(const QModelIndex& index, int role) const
171 return QVariant::fromValue(DeeListModel::data(index, 4)); //HINTS
123 return QVariant::fromValue(DeeListModel::data(index, 4)); //HINTS
172 } else if (role == RoleResults) {
124 } else if (role == RoleResults) {
173 return QVariant::fromValue(getFilter(index.row()));
125 return QVariant::fromValue(getFilter(index.row()));
174− } else if (role == RoleGlobalResults) {
175− qWarning() << "GLOBAL RESULTS???";
176−// return QVariant::fromValue(getGlobalFilter(index.row()));
177− return QVariant();
178 } else if (role == RoleCount) {
126 } else if (role == RoleCount) {
179 CategoryFilter* filter = getFilter(index.row());
127 CategoryFilter* filter = getFilter(index.row());
180 return QVariant::fromValue(filter->rowCount());
128 return QVariant::fromValue(filter->rowCount());
181− } else if (role == RoleGlobalCount) {
182− qWarning() << "GLOBAL COUNT???";
183−// QSortFilterProxyModel* filter = getGlobalFilter(index.row());
184− // return QVariant::fromValue(filter->rowCount());
185− return QVariant();
186 } else {
129 } else {
187 return QVariant();
130 return QVariant();
188 }
131 }
plugins/Unity/categories.h+1−11
@@ -36,7 +36,6 @@ class Categories : public DeeListModel
36 Q_ENUMS(Roles)
36 Q_ENUMS(Roles)
37
37
38 Q_PROPERTY(DeeListModel* resultModel READ resultModel WRITE setResultModel NOTIFY resultModelChanged)
38 Q_PROPERTY(DeeListModel* resultModel READ resultModel WRITE setResultModel NOTIFY resultModelChanged)
39−// Q_PROPERTY(DeeListModel* globalResultModel READ globalResultModel WRITE setResultModel NOTIFY globalResultModelChanged)
40
39
41public:
40public:
42 explicit Categories(QObject* parent = 0);
41 explicit Categories(QObject* parent = 0);
@@ -49,9 +48,7 @@ public:
49 RoleRenderer,
48 RoleRenderer,
50 RoleHints,
49 RoleHints,
51 RoleResults,
50 RoleResults,
52− RoleGlobalResults,
53− RoleCount,
51+ RoleCount
54− RoleGlobalCount
55 };
52 };
56
53
57 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
54 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
@@ -60,32 +57,25 @@ public:
60
57
61 /* getters */
58 /* getters */
62 DeeListModel* resultModel() { return m_resultModel; }
59 DeeListModel* resultModel() { return m_resultModel; }
63−// DeeListModel* globalResultModel() { return m_globalResultModel; }
64
60
65 /* setters */
61 /* setters */
66 void setResultModel(DeeListModel*);
62 void setResultModel(DeeListModel*);
67−// void setGlobalResultModel(DeeListModel*);
68
63
69Q_SIGNALS:
64Q_SIGNALS:
70 void resultModelChanged(DeeListModel*);
65 void resultModelChanged(DeeListModel*);
71−// void globalResultModelChanged(DeeListModel*);
72
66
73private Q_SLOTS:
67private Q_SLOTS:
74 void onCountChanged();
68 void onCountChanged();
75−// void onGlobalCountChanged();
76 void onEmitCountChanged();
69 void onEmitCountChanged();
77
70
78private:
71private:
79 CategoryFilter* getFilter(int index) const;
72 CategoryFilter* getFilter(int index) const;
80−// CategoryFilter* getGlobalFilter(int index) const;
81
73
82 QTimer m_timer;
74 QTimer m_timer;
83 QSet<CategoryFilter*> m_timerFilters;
75 QSet<CategoryFilter*> m_timerFilters;
84 QHash<int, QByteArray> m_roles;
76 QHash<int, QByteArray> m_roles;
85 DeeListModel* m_resultModel;
77 DeeListModel* m_resultModel;
86−// DeeListModel* m_globalResultModel;
87 mutable QMap<int, CategoryFilter*> m_filters;
78 mutable QMap<int, CategoryFilter*> m_filters;
88−// mutable QMap<int, CategoryFilter*> m_globalFilters;
89};
79};
90
80
91#endif // CATEGORIES_H
81#endif // CATEGORIES_H