screensavermodel/inc/iscreensaverprovider.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 03 May 2010 12:48:45 +0300
changeset 66 32469d7d46ff
parent 60 f62f87b200ec
permissions -rw-r--r--
Revision: 201015 Kit: 201018

/*
* Copyright (c) 2009 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 provider interface.
*
*/

#ifndef ISCREENSAVERPROVIDER_H
#define ISCREENSAVERPROVIDER_H

#include <QtPlugin>
#include <QVariant>

/*!
    \class ScreensaverToken
    \brief Represents a screensaver that can be created.

    Screensavers are located in screensaver providers. Each provider
    exposes its contained screensavers as screensaver tokens. A token has
    all the needed information for screensaver selection and creation.
*/
class ScreensaverToken
{

public:

    /*!
        The name of the library/plugin that contains the screensaver.
    */
    QString mLibrary;

    /*!
        Uniquely identifies the screensaver.
    */
    QString mUri;

};

class Screensaver;

/*!
    \class IScreensaverProvider
    \brief Defines a mechanism for retrieving a screensaver.

    Interface that defines a mechanism for retrieving a screensaver.
    Each screensaver provider implements this interface. 
*/
class IScreensaverProvider
{

public:

    /*!
        Destructs the class.
    */
    virtual ~IScreensaverProvider() {}

public:

    /*!
        Returns contained screensavers as a list of screensaver tokens.
        \return Contained screensavers as tokens.
    */
    virtual QList<ScreensaverToken> screensavers() = 0;

    /*!
        Creates and returns a screensaver based on the given token.
        \param token Identifies the screensaver to be created.
        \return The created screensaver or null in failure cases.
    */
    virtual Screensaver *createScreensaver(const ScreensaverToken &token) = 0;

};

Q_DECLARE_METATYPE(ScreensaverToken)
Q_DECLARE_INTERFACE(IScreensaverProvider,
    "com.nokia.screensaver.iscreensaverprovider/1.0")

#endif // ISCREENSAVERPROVIDER_H