diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-05-05 01:44:40 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-05-05 01:44:40 +0200 |
commit | 24c7c2f6f1429103d922ef940c0e17a3d4778059 (patch) | |
tree | 76ab9ac2c9fade7db77f64424a17c478979d8a8b /libsowatch/declarativewatchlet.cpp | |
parent | ea5123cb6b30d5ab083ee3821269537b1d31b9f0 (diff) | |
download | sowatch-24c7c2f6f1429103d922ef940c0e17a3d4778059.tar.gz sowatch-24c7c2f6f1429103d922ef940c0e17a3d4778059.zip |
ABI change: Watchlet now depends on Watch, not WatchServer
Diffstat (limited to 'libsowatch/declarativewatchlet.cpp')
-rw-r--r-- | libsowatch/declarativewatchlet.cpp | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/libsowatch/declarativewatchlet.cpp b/libsowatch/declarativewatchlet.cpp index 7e3ac53..ed6ec26 100644 --- a/libsowatch/declarativewatchlet.cpp +++ b/libsowatch/declarativewatchlet.cpp @@ -10,8 +10,8 @@ using namespace sowatch; bool DeclarativeWatchlet::_registered = false; -DeclarativeWatchlet::DeclarativeWatchlet(WatchServer* server, const QString& id) : - GraphicsWatchlet(server, id), +DeclarativeWatchlet::DeclarativeWatchlet(Watch* watch, const QString& id) : + GraphicsWatchlet(watch, id), _engine(0), _component(0), _item(0), @@ -31,27 +31,26 @@ DeclarativeWatchlet::DeclarativeWatchlet(WatchServer* server, const QString& id) _registered = true; } - // A dynamic property on the WatchServer object is used to share a single + // A dynamic property on the Watch object is used to share a single // DeclarativeEngine amongst all DeclarativeWatchlet instances. - QVariant serverEngine = server->property("declarativeEngine"); - if (!serverEngine.isValid()) { + QVariant watchEngine = watch->property("declarativeEngine"); + if (!watchEngine.isValid()) { // Create the shared engine qDebug() << "Starting QDeclarativeEngine"; - _engine = new QDeclarativeEngine(server); + _engine = new QDeclarativeEngine(watch); _engine->addImportPath(SOWATCH_QML_DIR); // Set context properties that are shared by all watchlets here - _engine->rootContext()->setContextProperty("notifications", - const_cast<NotificationsModel*>(server->notifications())); + _engine->rootContext()->setContextProperty("notifications", 0); - server->setProperty("declarativeEngine", QVariant::fromValue(_engine)); + watch->setProperty("declarativeEngine", QVariant::fromValue(_engine)); } else { - _engine = serverEngine.value<QDeclarativeEngine*>(); + _engine = watchEngine.value<QDeclarativeEngine*>(); } _context = new QDeclarativeContext(_engine, this); - _wrapper = new DeclarativeWatchWrapper(server, server->watch(), this); + _wrapper = new DeclarativeWatchWrapper(watch, this); _context->setContextProperty("watch", _wrapper); } @@ -125,6 +124,12 @@ void DeclarativeWatchlet::deactivate() GraphicsWatchlet::deactivate(); } +void DeclarativeWatchlet::setNotificationsModel(NotificationsModel *model) +{ + qDebug() << Q_FUNC_INFO; + _context->setContextProperty("notifications", model); +} + void DeclarativeWatchlet::setRootObject(QDeclarativeItem *item) { Q_ASSERT(_item == 0); /* This function should not be called with a current object. */ |