screensavermodel/inc/screensaver.h
author hgs
Tue, 23 Mar 2010 23:55:55 +0200
changeset 88 7f0462e8c3da
parent 85 7feec50967db
permissions -rw-r--r--
201009
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
85
7feec50967db 201003_02
hgs
parents:
diff changeset
     1
/*
7feec50967db 201003_02
hgs
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
7feec50967db 201003_02
hgs
parents:
diff changeset
     3
* All rights reserved.
7feec50967db 201003_02
hgs
parents:
diff changeset
     4
* This component and the accompanying materials are made available
7feec50967db 201003_02
hgs
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
7feec50967db 201003_02
hgs
parents:
diff changeset
     6
* which accompanies this distribution, and is available
7feec50967db 201003_02
hgs
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
7feec50967db 201003_02
hgs
parents:
diff changeset
     8
*
7feec50967db 201003_02
hgs
parents:
diff changeset
     9
* Initial Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
7feec50967db 201003_02
hgs
parents:
diff changeset
    11
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    12
* Contributors:
7feec50967db 201003_02
hgs
parents:
diff changeset
    13
* 
7feec50967db 201003_02
hgs
parents:
diff changeset
    14
* Description:  Base class for all screensavers.
7feec50967db 201003_02
hgs
parents:
diff changeset
    15
*
7feec50967db 201003_02
hgs
parents:
diff changeset
    16
*/
7feec50967db 201003_02
hgs
parents:
diff changeset
    17
7feec50967db 201003_02
hgs
parents:
diff changeset
    18
#ifndef SCREENSAVER_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    19
#define SCREENSAVER_H
7feec50967db 201003_02
hgs
parents:
diff changeset
    20
7feec50967db 201003_02
hgs
parents:
diff changeset
    21
#include <QGraphicsWidget>
7feec50967db 201003_02
hgs
parents:
diff changeset
    22
7feec50967db 201003_02
hgs
parents:
diff changeset
    23
#include "screensavermodel_global.h"
7feec50967db 201003_02
hgs
parents:
diff changeset
    24
7feec50967db 201003_02
hgs
parents:
diff changeset
    25
class ScreensaverPrivate;
7feec50967db 201003_02
hgs
parents:
diff changeset
    26
7feec50967db 201003_02
hgs
parents:
diff changeset
    27
enum ScreensaverState
7feec50967db 201003_02
hgs
parents:
diff changeset
    28
{
7feec50967db 201003_02
hgs
parents:
diff changeset
    29
    ScreensaverStateConstructed = 0,
7feec50967db 201003_02
hgs
parents:
diff changeset
    30
    ScreensaverStateInitialized,
7feec50967db 201003_02
hgs
parents:
diff changeset
    31
    ScreensaverStateBackground,
7feec50967db 201003_02
hgs
parents:
diff changeset
    32
    ScreensaverStateForeground,
7feec50967db 201003_02
hgs
parents:
diff changeset
    33
    ScreensaverStatePartialForeground,
7feec50967db 201003_02
hgs
parents:
diff changeset
    34
    ScreensaverStatePowerSave,
7feec50967db 201003_02
hgs
parents:
diff changeset
    35
    ScreensaverStateClosed
7feec50967db 201003_02
hgs
parents:
diff changeset
    36
};
7feec50967db 201003_02
hgs
parents:
diff changeset
    37
7feec50967db 201003_02
hgs
parents:
diff changeset
    38
class SREENSAVERMODEL_EXPORT Screensaver : public QObject
7feec50967db 201003_02
hgs
parents:
diff changeset
    39
{
7feec50967db 201003_02
hgs
parents:
diff changeset
    40
    Q_OBJECT
7feec50967db 201003_02
hgs
parents:
diff changeset
    41
7feec50967db 201003_02
hgs
parents:
diff changeset
    42
public:
7feec50967db 201003_02
hgs
parents:
diff changeset
    43
7feec50967db 201003_02
hgs
parents:
diff changeset
    44
    Screensaver(QObject *parent = 0);
7feec50967db 201003_02
hgs
parents:
diff changeset
    45
    virtual ~Screensaver();
7feec50967db 201003_02
hgs
parents:
diff changeset
    46
7feec50967db 201003_02
hgs
parents:
diff changeset
    47
    ScreensaverState currentState();
7feec50967db 201003_02
hgs
parents:
diff changeset
    48
7feec50967db 201003_02
hgs
parents:
diff changeset
    49
public slots:
7feec50967db 201003_02
hgs
parents:
diff changeset
    50
7feec50967db 201003_02
hgs
parents:
diff changeset
    51
    void initialize();
7feec50967db 201003_02
hgs
parents:
diff changeset
    52
    void foreground();
7feec50967db 201003_02
hgs
parents:
diff changeset
    53
    void partialForeground();
7feec50967db 201003_02
hgs
parents:
diff changeset
    54
    void background();
7feec50967db 201003_02
hgs
parents:
diff changeset
    55
    void powerSave();
7feec50967db 201003_02
hgs
parents:
diff changeset
    56
    void close();
7feec50967db 201003_02
hgs
parents:
diff changeset
    57
7feec50967db 201003_02
hgs
parents:
diff changeset
    58
protected:
7feec50967db 201003_02
hgs
parents:
diff changeset
    59
7feec50967db 201003_02
hgs
parents:
diff changeset
    60
    virtual bool onInitialize();
7feec50967db 201003_02
hgs
parents:
diff changeset
    61
    virtual bool onForeground() = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    62
    virtual bool onPartialForeground() = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    63
    virtual bool onBackground() = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    64
    virtual bool onPowerSave() = 0;
7feec50967db 201003_02
hgs
parents:
diff changeset
    65
    virtual bool onClose();
7feec50967db 201003_02
hgs
parents:
diff changeset
    66
7feec50967db 201003_02
hgs
parents:
diff changeset
    67
signals:
7feec50967db 201003_02
hgs
parents:
diff changeset
    68
7feec50967db 201003_02
hgs
parents:
diff changeset
    69
    void faulted();
7feec50967db 201003_02
hgs
parents:
diff changeset
    70
    void viewChanged(QGraphicsWidget *widget);
7feec50967db 201003_02
hgs
parents:
diff changeset
    71
7feec50967db 201003_02
hgs
parents:
diff changeset
    72
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
    73
7feec50967db 201003_02
hgs
parents:
diff changeset
    74
    Q_DISABLE_COPY(Screensaver)
7feec50967db 201003_02
hgs
parents:
diff changeset
    75
7feec50967db 201003_02
hgs
parents:
diff changeset
    76
private:
7feec50967db 201003_02
hgs
parents:
diff changeset
    77
7feec50967db 201003_02
hgs
parents:
diff changeset
    78
    ScreensaverPrivate * const m_d;
7feec50967db 201003_02
hgs
parents:
diff changeset
    79
    friend class ScreensaverPrivate;
7feec50967db 201003_02
hgs
parents:
diff changeset
    80
7feec50967db 201003_02
hgs
parents:
diff changeset
    81
};
7feec50967db 201003_02
hgs
parents:
diff changeset
    82
7feec50967db 201003_02
hgs
parents:
diff changeset
    83
#endif // SCREENSAVER_H