summaryrefslogtreecommitdiff
path: root/libsowatch/declarativewatchlet.cpp
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2013-05-12 03:49:38 +0200
committerJavier S. Pedro <maemo@javispedro.com>2013-05-12 03:49:38 +0200
commit3ca9235ddb93b52730099164a0dc387f7a301280 (patch)
treeaa6e74210ce6075fc9e974dd275d28adf5f5d0c5 /libsowatch/declarativewatchlet.cpp
parentac182bd9bf076b4d03d4812e85b989edae32d756 (diff)
downloadsowatch-3ca9235ddb93b52730099164a0dc387f7a301280.tar.gz
sowatch-3ca9235ddb93b52730099164a0dc387f7a301280.zip
weather rendering in metawatchwatchlets
Diffstat (limited to 'libsowatch/declarativewatchlet.cpp')
-rw-r--r--libsowatch/declarativewatchlet.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/libsowatch/declarativewatchlet.cpp b/libsowatch/declarativewatchlet.cpp
index c223b8d..4683dcb 100644
--- a/libsowatch/declarativewatchlet.cpp
+++ b/libsowatch/declarativewatchlet.cpp
@@ -2,6 +2,7 @@
#include <QtDeclarative/QtDeclarative>
#include "watchserver.h"
#include "watch.h"
+#include "watchletsmodel.h"
#include "notificationsmodel.h"
#include "gconfkey.h"
#include "declarativewatchwrapper.h"
@@ -24,9 +25,15 @@ DeclarativeWatchlet::DeclarativeWatchlet(Watch* watch, const QString& id) :
if (!_registered) {
qRegisterMetaType<Notification::Type>("Notification::Type");
+ qRegisterMetaType<Notification::Priority>("Notification::Priority");
qRegisterMetaType<WeatherNotification::WeatherType>("WeatherNotification::WeatherType");
+ qRegisterMetaType<WeatherNotification::Unit>("WeatherNotification::Unit");
qmlRegisterUncreatableType<DeclarativeWatchWrapper>("com.javispedro.sowatch", 1, 0,
"Watch", "Watch is only available via the 'watch' context property");
+ qmlRegisterUncreatableType<WatchletsModel>("com.javispedro.sowatch", 1, 0,
+ "Notification", "WatchletsModel is only available via the 'notifications' context property");
+ qmlRegisterUncreatableType<Watchlet>("com.javispedro.sowatch", 1, 0,
+ "Notification", "Watchlet is an abstract class");
qmlRegisterUncreatableType<NotificationsModel>("com.javispedro.sowatch", 1, 0,
"NotificationsModel", "NotificationsModel is only available via the 'notifications' context property");
qmlRegisterUncreatableType<Notification>("com.javispedro.sowatch", 1, 0,
@@ -48,6 +55,7 @@ DeclarativeWatchlet::DeclarativeWatchlet(Watch* watch, const QString& id) :
_engine->addImportPath(SOWATCH_QML_DIR);
// Set context properties that are shared by all watchlets here
+ _engine->rootContext()->setContextProperty("watchlets", 0);
_engine->rootContext()->setContextProperty("notifications", 0);
watch->setProperty("declarativeEngine", QVariant::fromValue(_engine));
@@ -126,6 +134,11 @@ void DeclarativeWatchlet::deactivate()
GraphicsWatchlet::deactivate();
}
+void DeclarativeWatchlet::setWatchletsModel(WatchletsModel *model)
+{
+ _context->setContextProperty("watchlets", model);
+}
+
void DeclarativeWatchlet::setNotificationsModel(NotificationsModel *model)
{
_context->setContextProperty("notifications", model);