screensaver/screensaverplugins/snsrbigclockscreensaverplugin/src/snsrdocumentloader.cpp
changeset 62 341166945d65
child 69 87476091b3f5
equal deleted inserted replaced
57:2e2dc3d30ca8 62:341166945d65
       
     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 "snsrswipewidget.h"
       
    25 
       
    26 /*!
       
    27     \class SnsrDocumentLoader
       
    28     \ingroup group_snsrbigclockscreensaverplugin
       
    29     \brief Custom screensaver docml layout loader.
       
    30 
       
    31     Used mainly to create the analog clock widget from docml.
       
    32  */
       
    33 
       
    34 /*!
       
    35     Creates the analog clock.
       
    36     \param type Static type name.
       
    37     \param name Object name.
       
    38     \retval Created object.
       
    39  */
       
    40 QObject *SnsrDocumentLoader::createObject(const QString &type, const QString &name)
       
    41 {
       
    42     if (type == SnsrAnalogClockWidget::staticMetaObject.className()) {
       
    43         QObject *object = new SnsrAnalogClockWidget();
       
    44         object->setObjectName(name);
       
    45         return object;
       
    46     }
       
    47 
       
    48     if (type == SnsrOledClockWidget::staticMetaObject.className()) {
       
    49         QObject *object = new SnsrOledClockWidget();
       
    50         object->setObjectName(name);
       
    51         return object;
       
    52     }
       
    53 
       
    54     if (type == SnsrLabel::staticMetaObject.className()) {
       
    55         QObject *object = new SnsrLabel();
       
    56         object->setObjectName(name);
       
    57         return object;
       
    58     }
       
    59     
       
    60     if (type == SnsrIndicatorWidget::staticMetaObject.className()) {
       
    61         QObject *object = new SnsrIndicatorWidget();
       
    62         object->setObjectName(name);
       
    63         return object;
       
    64     }
       
    65 
       
    66     /* Add swipeWidget implementation later on
       
    67      
       
    68      if (type == SnsrSwipeWidget::staticMetaObject.className()) {
       
    69         QObject *object = new SnsrSwipeWidget();
       
    70         object->setObjectName(name);
       
    71         return object;
       
    72     }*/
       
    73 
       
    74     return HbDocumentLoader::createObject(type, name);
       
    75 }