screensavermodel/inc/iscreensaverprovider.h
changeset 93 82b66994846c
parent 92 782e3408c2ab
child 94 dbb8300717f7
equal deleted inserted replaced
92:782e3408c2ab 93:82b66994846c
     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:  Screensaver provider interface.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef ISCREENSAVERPROVIDER_H
       
    19 #define ISCREENSAVERPROVIDER_H
       
    20 
       
    21 #include <QtPlugin>
       
    22 #include <QVariant>
       
    23 
       
    24 /*!
       
    25     \class ScreensaverToken
       
    26     \brief Represents a screensaver that can be created.
       
    27 
       
    28     Screensavers are located in screensaver providers. Each provider
       
    29     exposes its contained screensavers as screensaver tokens. A token has
       
    30     all the needed information for screensaver selection and creation.
       
    31 */
       
    32 class ScreensaverToken
       
    33 {
       
    34 
       
    35 public:
       
    36 
       
    37     /*!
       
    38         The name of the library/plugin that contains the screensaver.
       
    39     */
       
    40     QString mLibrary;
       
    41 
       
    42     /*!
       
    43         Uniquely identifies the screensaver.
       
    44     */
       
    45     QString mUri;
       
    46 
       
    47 };
       
    48 
       
    49 class Screensaver;
       
    50 
       
    51 /*!
       
    52     \class IScreensaverProvider
       
    53     \brief Defines a mechanism for retrieving a screensaver.
       
    54 
       
    55     Interface that defines a mechanism for retrieving a screensaver.
       
    56     Each screensaver provider implements this interface. 
       
    57 */
       
    58 class IScreensaverProvider
       
    59 {
       
    60 
       
    61 public:
       
    62 
       
    63     /*!
       
    64         Destructs the class.
       
    65     */
       
    66     virtual ~IScreensaverProvider() {}
       
    67 
       
    68 public:
       
    69 
       
    70     /*!
       
    71         Returns contained screensavers as a list of screensaver tokens.
       
    72         \return Contained screensavers as tokens.
       
    73     */
       
    74     virtual QList<ScreensaverToken> screensavers() = 0;
       
    75 
       
    76     /*!
       
    77         Creates and returns a screensaver based on the given token.
       
    78         \param token Identifies the screensaver to be created.
       
    79         \return The created screensaver or null in failure cases.
       
    80     */
       
    81     virtual Screensaver *createScreensaver(const ScreensaverToken &token) = 0;
       
    82 
       
    83 };
       
    84 
       
    85 Q_DECLARE_METATYPE(ScreensaverToken)
       
    86 Q_DECLARE_INTERFACE(IScreensaverProvider,
       
    87     "com.nokia.screensaver.iscreensaverprovider/1.0")
       
    88 
       
    89 #endif // ISCREENSAVERPROVIDER_H