@@ -30,7 +30,7 @@
30 \qmltype IndicatorsModel
30 \qmltype IndicatorsModel
31 \inherits QAbstractListModel
31 \inherits QAbstractListModel
33− \brief The IndicatorsModel class defines the list model for indicators plugins
33+ \brief The IndicatorsModel class defines the list model for indicators
35 \b {This component is under heavy development.}
35 \b {This component is under heavy development.}
@@ -81,18 +81,18 @@ int IndicatorsModel::count() const
82 \qmlmethod IndicatorsModel::unload()
82 \qmlmethod IndicatorsModel::unload()
84− Load all plugins.
84+ Load all indicators.
86void IndicatorsModel::load()
86void IndicatorsModel::load()
88− m_plugins.clear();
88+ m_indicators.clear();
89 m_manager->load();
89 m_manager->load();
93 \qmlmethod IndicatorsModel::unload()
93 \qmlmethod IndicatorsModel::unload()
95− Unload all plugins.
95+ Unload all indicators.
97void IndicatorsModel::unload()
97void IndicatorsModel::unload()
@@ -100,49 +100,57 @@ void IndicatorsModel::unload()
102/*! \internal */
102/*! \internal */
103−void IndicatorsModel::onIndicatorLoaded(const QString& indicator)
103+void IndicatorsModel::onIndicatorLoaded(const QString& indicator_name)
105− Indicator::Ptr plugin = m_manager->indicator(indicator);
105+ Indicator::Ptr indicator = m_manager->indicator(indicator_name);
106− if (!plugin)
106+ if (!indicator)
109− if (m_plugins.indexOf(plugin) >= 0)
111+ if (m_indicators.indexOf(indicator) >= 0)
112 // find the insert position
116 // find the insert position
113 int pos = 0;
117 int pos = 0;
114− while (pos < count()) {
118+ while (pos < count())
115 // keep going while the existing priority is less.
120 // keep going while the existing priority is less.
116− if (indicatorData(plugin, Priority).toInt() < data(index(pos), Priority).toInt())
121+ if (indicatorData(indicator, Priority).toInt() < data(index(pos), Priority).toInt())
121− QObject::connect(plugin.data(), SIGNAL(identifierChanged(const QString&)), this, SLOT(onIdentifierChanged()));
126+ QObject::connect(indicator.data(), SIGNAL(identifierChanged(const QString&)), this, SLOT(onIdentifierChanged()));
122− QObject::connect(plugin.data(), SIGNAL(indicatorPropertiesChanged(const QVariant&)), this, SLOT(onIndicatorPropertiesChanged()));
127+ QObject::connect(indicator.data(), SIGNAL(indicatorPropertiesChanged(const QVariant&)), this, SLOT(onIndicatorPropertiesChanged()));
124 beginInsertRows(QModelIndex(), pos, pos);
129 beginInsertRows(QModelIndex(), pos, pos);
126− m_plugins.insert(pos, plugin);
131+ m_indicators.insert(pos, indicator);
127 endInsertRows();
132 endInsertRows();
130/*! \internal */
135/*! \internal */
131−void IndicatorsModel::onIndicatorAboutToBeUnloaded(const QString& indicator)
136+void IndicatorsModel::onIndicatorAboutToBeUnloaded(const QString& indicator_name)
133− Indicator::Ptr plugin = m_manager->indicator(indicator);
138+ Indicator::Ptr indicator = m_manager->indicator(indicator_name);
134− if (!plugin)
139+ if (!indicator)
137 int i = 0;
144 int i = 0;
138− QMutableListIterator<Indicator::Ptr> iter(m_plugins);
145+ QMutableListIterator<Indicator::Ptr> iter(m_indicators);
139 while(iter.hasNext())
146 while(iter.hasNext())
141− if (plugin == iter.next())
148+ if (indicator == iter.next())
143 beginRemoveRows(QModelIndex(), i, i);
150 beginRemoveRows(QModelIndex(), i, i);
144 iter.remove();
151 iter.remove();
145 endRemoveRows();
152 endRemoveRows();
@@ -164,15 +172,17 @@ void IndicatorsModel::onIndicatorPropertiesChanged()
164/*! \internal */
172/*! \internal */
165void IndicatorsModel::notifyDataChanged(QObject *sender, int role)
173void IndicatorsModel::notifyDataChanged(QObject *sender, int role)
167− Indicator* plugin = qobject_cast<Indicator*>(sender);
175+ Indicator* indicator = qobject_cast<Indicator*>(sender);
168− if (!plugin)
176+ if (!indicator)
171 int index = 0;
181 int index = 0;
172− QMutableListIterator<Indicator::Ptr> iter(m_plugins);
182+ QMutableListIterator<Indicator::Ptr> iter(m_indicators);
173 while(iter.hasNext())
183 while(iter.hasNext())
175− if (iter.next().data() == plugin)
185+ if (indicator == iter.next())
177 QModelIndex changedIndex = this->index(index);
187 QModelIndex changedIndex = this->index(index);
178 dataChanged(changedIndex, changedIndex, QVector<int>() << role);
188 dataChanged(changedIndex, changedIndex, QVector<int>() << role);
@@ -207,14 +217,14 @@ int IndicatorsModel::columnCount(const QModelIndex &) const
209/*! \internal */
219/*! \internal */
210−QVariant IndicatorsModel::defaultData(Indicator::Ptr plugin, int role)
220+QVariant IndicatorsModel::defaultData(Indicator::Ptr indicator, int role)
212 switch (role)
222 switch (role)
214 case Priority:
224 case Priority:
215 return 0;
225 return 0;
216 case Title:
226 case Title:
217− return plugin ? plugin->identifier() : "Unknown";
227+ return indicator ? indicator->identifier() : "Unknown";
218 case Description:
228 case Description:
219 return "";
229 return "";
220 case WidgetSource:
230 case WidgetSource:
@@ -233,47 +243,47 @@ Q_INVOKABLE QVariant IndicatorsModel::data(int row, int role) const
233/*! \internal */
243/*! \internal */
234QVariant IndicatorsModel::data(const QModelIndex &index, int role) const
244QVariant IndicatorsModel::data(const QModelIndex &index, int role) const
236− if (!index.isValid() || index.row() >= m_plugins.size())
246+ if (!index.isValid() || index.row() >= m_indicators.size())
237 return QVariant();
247 return QVariant();
239− Indicator::Ptr plugin = m_plugins[index.row()];
249+ Indicator::Ptr indicator = m_indicators[index.row()];
241 switch (role)
251 switch (role)
243 case Identifier:
253 case Identifier:
244− if (plugin)
254+ if (indicator)
246− return QVariant(plugin->identifier());
256+ return QVariant(indicator->identifier());
249 case IndicatorProperties:
259 case IndicatorProperties:
250− if (plugin)
260+ if (indicator)
252− return QVariant(plugin->indicatorProperties());
262+ return QVariant(indicator->indicatorProperties());
255 case IsValid:
265 case IsValid:
256− return (plugin ? true : false);
266+ return (indicator ? true : false);
257 case Priority:
267 case Priority:
258 case Title:
268 case Title:
259 case Description:
269 case Description:
260 case WidgetSource:
270 case WidgetSource:
261 case PageSource:
271 case PageSource:
262− return indicatorData(plugin, role);
272+ return indicatorData(indicator, role);
266 return QVariant();
276 return QVariant();
269−QVariant IndicatorsModel::indicatorData(const Indicator::Ptr& plugin, int role) const
279+QVariant IndicatorsModel::indicatorData(const Indicator::Ptr& indicator, int role) const
271− if (plugin && m_parsed_indicator_data.contains(plugin->identifier()))
281+ if (indicator && m_parsed_indicator_data.contains(indicator->identifier()))
273− QVariantMap data = m_parsed_indicator_data[plugin->identifier()];
283+ QVariantMap data = m_parsed_indicator_data[indicator->identifier()];
274 return data.value(roleNames()[role], QVariant());
284 return data.value(roleNames()[role], QVariant());
276− return defaultData(plugin, role);
286+ return defaultData(indicator, role);
279/*! \internal */
289/*! \internal */
@@ -285,7 +295,7 @@ QModelIndex IndicatorsModel::parent(const QModelIndex&) const
285/*! \internal */
295/*! \internal */
286int IndicatorsModel::rowCount(const QModelIndex&) const
296int IndicatorsModel::rowCount(const QModelIndex&) const
288− return m_plugins.count();
298+ return m_indicators.count();
291void IndicatorsModel::setIndicatorData(const QVariant& data)
301void IndicatorsModel::setIndicatorData(const QVariant& data)