on xenial help sign in
Removed commented code.
commit1099b0b3fc57d95e02c19cc898b5bbbeaa05523e authorPawel Stolowski <pawel.stolowski@canonical.com> dateThu 6 Jun 2013, 18:03 (13 years ago) parentd23f92a
2 files changed+1−68
plugins/Unity/categories.cpp−57 plugins/Unity/categories.h+1−11
plugins/Unity/categories.cpp−57
@@ -20,12 +20,10 @@
2020// self
2121#include "categories.h"
2222#include "categoryfilter.h"
23−#include <QDebug>
2423
2524Categories::Categories(QObject* parent)
2625 : DeeListModel(parent)
2726 , m_resultModel(0)
28−// , m_globalResultModel(0)
2927{
3028 // FIXME: need to clean up unused filters on countChanged
3129 m_roles[Categories::RoleId] = "id";
@@ -34,9 +32,7 @@ Categories::Categories(QObject* parent)
3432 m_roles[Categories::RoleRenderer] = "renderer";
3533 m_roles[Categories::RoleHints] = "hints";
3634 m_roles[Categories::RoleResults] = "results";
37− m_roles[Categories::RoleGlobalResults] = "globalResults";
3835 m_roles[Categories::RoleCount] = "count";
39− m_roles[Categories::RoleGlobalCount] = "globalCount";
4036
4137 // TODO This should not be needed but accumulatting the count changes
4238 // makes the visualization more stable and also makes crashes on fast
@@ -49,7 +45,6 @@ Categories::Categories(QObject* parent)
4945Categories::~Categories()
5046{
5147 qDeleteAll(m_filters);
52−// qDeleteAll(m_globalFilters);
5348}
5449
5550CategoryFilter*
@@ -67,21 +62,6 @@ Categories::getFilter(int index) const
6762 return m_filters[index];
6863}
6964
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−
8565void
8666Categories::setResultModel(DeeListModel* model)
8767{
@@ -96,21 +76,6 @@ Categories::setResultModel(DeeListModel* model)
9676 }
9777}
9878
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−
11479void
11580Categories::onCountChanged()
11681{
@@ -133,19 +98,6 @@ Categories::onEmitCountChanged()
13398 m_timerFilters.clear();
13499}
135100
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−
149101QHash<int, QByteArray>
150102Categories::roleNames() const
151103{
@@ -171,18 +123,9 @@ Categories::data(const QModelIndex& index, int role) const
171123 return QVariant::fromValue(DeeListModel::data(index, 4)); //HINTS
172124 } else if (role == RoleResults) {
173125 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();
178126 } else if (role == RoleCount) {
179127 CategoryFilter* filter = getFilter(index.row());
180128 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();
186129 } else {
187130 return QVariant();
188131 }
plugins/Unity/categories.h+1−11
@@ -36,7 +36,6 @@ class Categories : public DeeListModel
3636 Q_ENUMS(Roles)
3737
3838 Q_PROPERTY(DeeListModel* resultModel READ resultModel WRITE setResultModel NOTIFY resultModelChanged)
39−// Q_PROPERTY(DeeListModel* globalResultModel READ globalResultModel WRITE setResultModel NOTIFY globalResultModelChanged)
4039
4140public:
4241 explicit Categories(QObject* parent = 0);
@@ -49,9 +48,7 @@ public:
4948 RoleRenderer,
5049 RoleHints,
5150 RoleResults,
52− RoleGlobalResults,
53− RoleCount,
54− RoleGlobalCount
51+ RoleCount
5552 };
5653
5754 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
@@ -60,32 +57,25 @@ public:
6057
6158 /* getters */
6259 DeeListModel* resultModel() { return m_resultModel; }
63−// DeeListModel* globalResultModel() { return m_globalResultModel; }
6460
6561 /* setters */
6662 void setResultModel(DeeListModel*);
67−// void setGlobalResultModel(DeeListModel*);
6863
6964Q_SIGNALS:
7065 void resultModelChanged(DeeListModel*);
71−// void globalResultModelChanged(DeeListModel*);
7266
7367private Q_SLOTS:
7468 void onCountChanged();
75−// void onGlobalCountChanged();
7669 void onEmitCountChanged();
7770
7871private:
7972 CategoryFilter* getFilter(int index) const;
80−// CategoryFilter* getGlobalFilter(int index) const;
8173
8274 QTimer m_timer;
8375 QSet<CategoryFilter*> m_timerFilters;
8476 QHash<int, QByteArray> m_roles;
8577 DeeListModel* m_resultModel;
86−// DeeListModel* m_globalResultModel;
8778 mutable QMap<int, CategoryFilter*> m_filters;
88−// mutable QMap<int, CategoryFilter*> m_globalFilters;
8979};
9080
9181#endif // CATEGORIES_H