From 67c0ceaa7562310a62a7d11e96f1d558950660b5 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Thu, 9 Aug 2012 19:21:39 +0200 Subject: prepare watchlet/notif lists --- libsowatch/registry.h | 13 +++++++++++++ sowatchui/watchesmodel.cpp | 11 +++++++++++ sowatchui/watchscannermodel.cpp | 1 + 3 files changed, 25 insertions(+) diff --git a/libsowatch/registry.h b/libsowatch/registry.h index 74e9388..b2e2b0e 100644 --- a/libsowatch/registry.h +++ b/libsowatch/registry.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include "sowatch_global.h" @@ -45,6 +46,18 @@ public: return _watchletIds.value(id, 0); } + inline QStringList allWatchDrivers() const { + return _driverIds.keys(); + } + + inline QStringList allNotificationProviders() const { + return _providerIds.keys(); + } + + inline QStringList allWatchlets() const { + return _watchletIds.keys(); + } + protected: Registry(); ~Registry(); diff --git a/sowatchui/watchesmodel.cpp b/sowatchui/watchesmodel.cpp index 69de3a0..617e262 100644 --- a/sowatchui/watchesmodel.cpp +++ b/sowatchui/watchesmodel.cpp @@ -34,6 +34,7 @@ WatchesModel::~WatchesModel() int WatchesModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return _list.count(); } @@ -75,6 +76,9 @@ QVariant WatchesModel::data(const QModelIndex &index, int role) const bool WatchesModel::removeRows(int row, int count, const QModelIndex &parent) { + Q_UNUSED(row); + Q_UNUSED(count); + Q_UNUSED(parent); return false; // TODO } @@ -90,11 +94,18 @@ void WatchesModel::addFoundWatch(const QVariantMap &info) name = base.arg(num); } + // Load the autodetected settings ConfigKey* newkey = _config->getSubkey(name); foreach (const QString& key, info.keys()) { newkey->set(key, info[key]); } + // Set some defaults + Registry *registry = Registry::registry(); + foreach (const QStringList& providerId, registry->allNotificationProviders()) { + qDebug() << "Would add" << providerId; + } + // Now add to active watches QStringList active = _active_watches->value().toStringList(); active << name; diff --git a/sowatchui/watchscannermodel.cpp b/sowatchui/watchscannermodel.cpp index 5d3b0ac..8dd8d1e 100644 --- a/sowatchui/watchscannermodel.cpp +++ b/sowatchui/watchscannermodel.cpp @@ -48,6 +48,7 @@ bool WatchScannerModel::active() const int WatchScannerModel::rowCount(const QModelIndex &parent) const { + Q_UNUSED(parent); return _list.count(); } -- cgit v1.2.3