screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrdocumentloader.cpp
changeset 62 341166945d65
child 69 87476091b3f5
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrdocumentloader.cpp	Fri Jun 25 19:19:22 2010 +0300
@@ -0,0 +1,75 @@
+/*
+* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+* 
+* Description: Screensaver custom document loader.
+*
+*/
+
+#include "snsrdocumentloader.h"
+
+#include "snsranalogclockwidget.h"
+#include "snsroledclockwidget.h"
+#include "snsrlabel.h"
+#include "snsrindicatorwidget.h"
+#include "snsrswipewidget.h"
+
+/*!
+    \class SnsrDocumentLoader
+    \ingroup group_snsrbigclockscreensaverplugin
+    \brief Custom screensaver docml layout loader.
+
+    Used mainly to create the analog clock widget from docml.
+ */
+
+/*!
+    Creates the analog clock.
+    \param type Static type name.
+    \param name Object name.
+    \retval Created object.
+ */
+QObject *SnsrDocumentLoader::createObject(const QString &type, const QString &name)
+{
+    if (type == SnsrAnalogClockWidget::staticMetaObject.className()) {
+        QObject *object = new SnsrAnalogClockWidget();
+        object->setObjectName(name);
+        return object;
+    }
+
+    if (type == SnsrOledClockWidget::staticMetaObject.className()) {
+        QObject *object = new SnsrOledClockWidget();
+        object->setObjectName(name);
+        return object;
+    }
+
+    if (type == SnsrLabel::staticMetaObject.className()) {
+        QObject *object = new SnsrLabel();
+        object->setObjectName(name);
+        return object;
+    }
+    
+    if (type == SnsrIndicatorWidget::staticMetaObject.className()) {
+        QObject *object = new SnsrIndicatorWidget();
+        object->setObjectName(name);
+        return object;
+    }
+
+    /* Add swipeWidget implementation later on
+     
+     if (type == SnsrSwipeWidget::staticMetaObject.className()) {
+        QObject *object = new SnsrSwipeWidget();
+        object->setObjectName(name);
+        return object;
+    }*/
+
+    return HbDocumentLoader::createObject(type, name);
+}