Added TODOs, renamed addOption to addObject in GenericListModel.
commit9db4f20049b164313c67cc6ca6959a287d044ada
authorPawel Stolowski <pawel.stolowski@canonical.com>
dateFri 12 Jul 2013, 15:35 (13 years ago)
parent4a2c801
plugins/Unity/combinedfilteroptions.cpp+2−2
@@ -35,12 +35,12 @@ void CombinedFilterOptions::initList(const std::vector<unity::dash::FilterOption
3535 unity::dash::FilterOption::Ptr option2 = list[i+1];
3636 auto co = new CombinedFilterOption(option1, option2, this);
3737 connect(co, SIGNAL(activeChanged(bool)), this, SLOT(onActiveChanged(bool)));
38− addOption(co);
38+ addObject(co);
3939 ++i;
4040 }
4141 if (list.size() > 0) {
4242 auto co = new CombinedFilterOption(list[i], nullptr, this);
43− addOption(co);
43+ addObject(co);
4444 }
4545}
4646
plugins/Unity/filters.cpp+2−2
@@ -64,9 +64,8 @@ QVariant Filters::data(const QModelIndex& index, int role) const
6464 return QVariant();
6565 }
6666
67− Filter* filter = m_filters.at(index.row());
68−
6967 if (role == Filters::RoleFilter) {
68+ Filter* filter = m_filters.at(index.row());
7069 return QVariant::fromValue(filter);
7170 } else {
7271 return QVariant();
@@ -133,6 +132,7 @@ void Filters::removeFilter(int index)
133132
134133int Filters::indexForFilter(unity::dash::Filter::Ptr unityFilter)
135134{
135+ // TODO: use a map
136136 int index;
137137 for (index=0; index<m_filters.count(); index++) {
138138 if (m_filters[index]->hasUnityFilter(unityFilter)) {
plugins/Unity/genericlistmodel.cpp+1−1
@@ -39,7 +39,7 @@ int GenericListModel::rowCount(const QModelIndex& /* parent */) const
3939 return m_list.count();
4040}
4141
42−void GenericListModel::addOption(QObject *option)
42+void GenericListModel::addObject(QObject *option)
4343{
4444 int index = m_list.count();
4545 beginInsertRows(QModelIndex(), index, index);
plugins/Unity/genericlistmodel.h+4−1
@@ -24,6 +24,9 @@
2424#include <QObject>
2525#include <QAbstractListModel>
2626
27+/*
28+ * TODO: see if it'd be better to use QVariantListModel.
29+ */
2730class Q_DECL_EXPORT GenericListModel : public QAbstractListModel
2831{
2932 Q_OBJECT
@@ -33,7 +36,7 @@ public:
3336
3437 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
3538 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
36− void addOption(QObject* option);
39+ void addObject(QObject* option);
3740
3841 QList<QObject *>::Iterator optionsBegin();
3942 QList<QObject *>::Iterator optionsEnd();
plugins/Unity/ratingsfilter.cpp+1−1
@@ -54,7 +54,7 @@ void RatingsFilter::setUnityFilter(unity::dash::Filter::Ptr filter)
5454 for (int i=1; i<=5; i++) {
5555 auto opt = new RatingFilterOption(QString::number(i), i*0.2f, this);
5656 connect(opt, SIGNAL(activeChanged(bool)), this, SLOT(onActiveChanged()));
57− m_options->addOption(opt);
57+ m_options->addObject(opt);
5858 }
5959
6060 Q_EMIT ratingsChanged();