screensaverapp/stateproviders/snsrdefaultstateprovider/src/snsrdefaultstateprovider.cpp
changeset 39 4e8ebe173323
parent 36 cdae8c6c3876
child 42 517f4fb5ec74
child 46 23b5d6a29cce
equal deleted inserted replaced
36:cdae8c6c3876 39:4e8ebe173323
     1 /*
       
     2 * Copyright (c) 2009 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: Default Screensaver provider.
       
    15 *
       
    16 */
       
    17 
       
    18 #include "snsrdefaultstateprovider.h"
       
    19 
       
    20 #include <QState>
       
    21 
       
    22 #include "snsrrootstate.h"
       
    23 
       
    24 /*!
       
    25     \class SnsrDefaultStateProvider
       
    26     \ingroup group_snsrdefaultstateprovider
       
    27     \brief Provides a default implementation for each screensaver state.
       
    28 
       
    29     States are described in the snsrdefaultstateprovider.manifest file.
       
    30 */
       
    31 
       
    32 /*!
       
    33     Constructs a new SnsrDefaultStateProvider.
       
    34 */
       
    35 SnsrDefaultStateProvider::SnsrDefaultStateProvider()
       
    36 {
       
    37     mSnsrRootStateToken.mLibrary = "snsrdefaultstateprovider.dll";
       
    38     mSnsrRootStateToken.mUri = "screensaver.nokia.com/state/root";
       
    39 }
       
    40 
       
    41 /*!
       
    42     Destructs the class.
       
    43 */
       
    44 SnsrDefaultStateProvider::~SnsrDefaultStateProvider()
       
    45 {
       
    46 }
       
    47 
       
    48 /*!
       
    49     Returns contained states as a list of tokens.
       
    50 */
       
    51 QList<HsStateToken> SnsrDefaultStateProvider::states()
       
    52 {
       
    53     return QList<HsStateToken>() << mSnsrRootStateToken;
       
    54 }
       
    55 
       
    56 /*!
       
    57     Creates a state based on the given token.
       
    58     \param token - Identifies the state to be created.
       
    59 */
       
    60 QState *SnsrDefaultStateProvider::createState(const HsStateToken& token)
       
    61 {
       
    62     if ((token.mLibrary == mSnsrRootStateToken.mLibrary) &&
       
    63         (token.mUri == mSnsrRootStateToken.mUri)) {
       
    64             return new SnsrRootState();
       
    65     }
       
    66     return 0;
       
    67 }
       
    68 
       
    69 #ifndef COVERAGE_MEASUREMENT
       
    70 Q_EXPORT_PLUGIN2(snsrdefaultstateprovider, SnsrDefaultStateProvider)
       
    71 #endif // COVERAGE_MEASUREMENT