screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrdocumentloader.cpp
changeset 97 66b5fe3c07fd
parent 95 32e56106abf2
child 98 e6f74eb7f69f
equal deleted inserted replaced
95:32e56106abf2 97:66b5fe3c07fd
     1 /*
       
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 * 
       
    14 * Description: Screensaver custom document loader.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "snsrdocumentloader.h"
       
    19 
       
    20 #include "snsranalogclockwidget.h"
       
    21 #include "snsroledclockwidget.h"
       
    22 #include "snsrlabel.h"
       
    23 #include "snsrindicatorwidget.h"
       
    24 #include "snsroledtimelabel.h"
       
    25 #include "snsrswipewidget.h"
       
    26 
       
    27 /*!
       
    28     \class SnsrDocumentLoader
       
    29     \ingroup group_snsrbigclockscreensaverplugin
       
    30     \brief Custom screensaver docml layout loader.
       
    31 
       
    32     Used to create the widgets from docml.
       
    33  */
       
    34 
       
    35 /*!
       
    36     Creates the requested widget.
       
    37     \param type Static type name.
       
    38     \param name Object name.
       
    39     \retval Created object.
       
    40  */
       
    41 QObject *SnsrDocumentLoader::createObject(const QString &type, const QString &name)
       
    42 {
       
    43     if (type == SnsrAnalogClockWidget::staticMetaObject.className()) {
       
    44         QObject *object = new SnsrAnalogClockWidget();
       
    45         object->setObjectName(name);
       
    46         return object;
       
    47     }
       
    48 
       
    49     if (type == SnsrOledClockWidget::staticMetaObject.className()) {
       
    50         QObject *object = new SnsrOledClockWidget();
       
    51         object->setObjectName(name);
       
    52         return object;
       
    53     }
       
    54 
       
    55     if (type == SnsrLabel::staticMetaObject.className()) {
       
    56         QObject *object = new SnsrLabel();
       
    57         object->setObjectName(name);
       
    58         return object;
       
    59     }
       
    60     
       
    61     if (type == SnsrIndicatorWidget::staticMetaObject.className()) {
       
    62         QObject *object = new SnsrIndicatorWidget();
       
    63         object->setObjectName(name);
       
    64         return object;
       
    65     }
       
    66 
       
    67     if (type == SnsrOledTimeLabel::staticMetaObject.className()) {
       
    68         QObject *object = new SnsrOledTimeLabel();
       
    69         object->setObjectName(name);
       
    70         return object;
       
    71     }
       
    72     
       
    73     /* Add swipeWidget implementation later on
       
    74      
       
    75      if (type == SnsrSwipeWidget::staticMetaObject.className()) {
       
    76         QObject *object = new SnsrSwipeWidget();
       
    77         object->setObjectName(name);
       
    78         return object;
       
    79     }*/
       
    80 
       
    81     return HbDocumentLoader::createObject(type, name);
       
    82 }