From bc5b70046e84c6e5a33a19bd2e64e626fdf0579e Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Thu, 9 Aug 2012 18:50:23 +0200 Subject: first UI editable settings! --- sowatchui/watchesmodel.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sowatchui/watchesmodel.cpp') diff --git a/sowatchui/watchesmodel.cpp b/sowatchui/watchesmodel.cpp index 5644466..c45a229 100644 --- a/sowatchui/watchesmodel.cpp +++ b/sowatchui/watchesmodel.cpp @@ -14,6 +14,8 @@ WatchesModel::WatchesModel(QObject *parent) : roles[Qt::DisplayRole] = QByteArray("title"); roles[Qt::StatusTipRole] = QByteArray("subtitle"); roles[ObjectRole] = QByteArray("object"); + roles[ConfigKeyRole] = QByteArray("configKey"); + roles[ConfigQmlUrlRole] = QByteArray("configQmlUrl"); setRoleNames(roles); connect(_config, SIGNAL(changed()), @@ -57,6 +59,17 @@ QVariant WatchesModel::data(const QModelIndex &index, int role) const } else { return QVariant(tr("Disabled")); } + case ConfigKeyRole: + return QVariant::fromValue(key); + case ConfigQmlUrlRole: + if (config->isSet("driver")) { + QString driver = config->value("driver").toString(); + WatchPluginInterface *plugin = Registry::registry()->getWatchPlugin(driver); + if (plugin) { + return QVariant::fromValue(plugin->getConfigQmlUrl(driver)); + } + } + return QVariant::fromValue(QUrl()); } return QVariant(); } -- cgit v1.2.3