85
|
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: Base class for all screensavers.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#ifndef SCREENSAVER_H
|
|
19 |
#define SCREENSAVER_H
|
|
20 |
|
|
21 |
#include <QGraphicsWidget>
|
|
22 |
|
|
23 |
#include "screensavermodel_global.h"
|
|
24 |
|
|
25 |
class ScreensaverPrivate;
|
|
26 |
|
|
27 |
enum ScreensaverState
|
|
28 |
{
|
|
29 |
ScreensaverStateConstructed = 0,
|
|
30 |
ScreensaverStateInitialized,
|
|
31 |
ScreensaverStateBackground,
|
|
32 |
ScreensaverStateForeground,
|
|
33 |
ScreensaverStatePartialForeground,
|
|
34 |
ScreensaverStatePowerSave,
|
|
35 |
ScreensaverStateClosed
|
|
36 |
};
|
|
37 |
|
|
38 |
class SREENSAVERMODEL_EXPORT Screensaver : public QObject
|
|
39 |
{
|
|
40 |
Q_OBJECT
|
|
41 |
|
|
42 |
public:
|
|
43 |
|
|
44 |
Screensaver(QObject *parent = 0);
|
|
45 |
virtual ~Screensaver();
|
|
46 |
|
|
47 |
ScreensaverState currentState();
|
|
48 |
|
|
49 |
public slots:
|
|
50 |
|
|
51 |
void initialize();
|
|
52 |
void foreground();
|
|
53 |
void partialForeground();
|
|
54 |
void background();
|
|
55 |
void powerSave();
|
|
56 |
void close();
|
|
57 |
|
|
58 |
protected:
|
|
59 |
|
|
60 |
virtual bool onInitialize();
|
|
61 |
virtual bool onForeground() = 0;
|
|
62 |
virtual bool onPartialForeground() = 0;
|
|
63 |
virtual bool onBackground() = 0;
|
|
64 |
virtual bool onPowerSave() = 0;
|
|
65 |
virtual bool onClose();
|
|
66 |
|
|
67 |
signals:
|
|
68 |
|
|
69 |
void faulted();
|
|
70 |
void viewChanged(QGraphicsWidget *widget);
|
|
71 |
|
|
72 |
private:
|
|
73 |
|
|
74 |
Q_DISABLE_COPY(Screensaver)
|
|
75 |
|
|
76 |
private:
|
|
77 |
|
|
78 |
ScreensaverPrivate * const m_d;
|
|
79 |
friend class ScreensaverPrivate;
|
|
80 |
|
|
81 |
};
|
|
82 |
|
|
83 |
#endif // SCREENSAVER_H
|