summaryrefslogtreecommitdiff
path: root/libsowatch/declarativewatchlet.cpp
diff options
context:
space:
mode:
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);