screensaver/screensavermodel/inc/screensaver.h
changeset 62 341166945d65
child 69 87476091b3f5
equal deleted inserted replaced
57:2e2dc3d30ca8 62:341166945d65
       
     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 class HbIndicatorInterface;
       
    27 
       
    28 enum ScreensaverState
       
    29 {
       
    30     ScreensaverStateConstructed = 0,
       
    31     ScreensaverStateInitialized,
       
    32     ScreensaverStateBackground,
       
    33     ScreensaverStateForeground,
       
    34     ScreensaverStatePartialForeground,
       
    35     ScreensaverStatePowerSave,
       
    36     ScreensaverStateClosed
       
    37 };
       
    38 
       
    39 class SREENSAVERMODEL_EXPORT Screensaver : public QObject
       
    40 {
       
    41     Q_OBJECT
       
    42 
       
    43 public:
       
    44 
       
    45     Screensaver(QObject *parent = 0);
       
    46     virtual ~Screensaver();
       
    47 
       
    48     ScreensaverState currentState();
       
    49 
       
    50 public slots:
       
    51 
       
    52     void initialize();
       
    53     void foreground();
       
    54     void partialForeground();
       
    55     void background();
       
    56     void powerSave();
       
    57     void close();
       
    58     
       
    59     void handleActiveIndicators(const QList<HbIndicatorInterface*> &activeIndicators);
       
    60     // TODO: change to const reference or something or leave it?
       
    61     void handleActivatedIndicator(HbIndicatorInterface *activatedIndicator);
       
    62     void handleDeactivatedIndicator(HbIndicatorInterface *deactivatedIndicator);
       
    63 
       
    64 protected:
       
    65 
       
    66     virtual bool onInitialize();
       
    67     virtual bool onForeground() = 0;
       
    68     virtual bool onPartialForeground() = 0;
       
    69     virtual bool onBackground() = 0;
       
    70     virtual bool onPowerSave() = 0;
       
    71     virtual bool onClose();
       
    72     
       
    73     virtual void onHandleActiveIndicators(const QList<HbIndicatorInterface*> &activeIndicators);
       
    74     // TODO: change to const reference or something or leave it?
       
    75     virtual void onHandleActivatedIndicator(HbIndicatorInterface *activatedIndicator);
       
    76     virtual void onHandleDeactivatedIndicator(HbIndicatorInterface *deactivatedIndicator);
       
    77 
       
    78 signals:
       
    79 
       
    80     void faulted();
       
    81     void viewChanged(QGraphicsWidget *widget);
       
    82     void unlockRequested();
       
    83 
       
    84 private:
       
    85 
       
    86     Q_DISABLE_COPY(Screensaver)
       
    87 
       
    88 private:
       
    89 
       
    90     ScreensaverPrivate * const m_d;
       
    91     friend class ScreensaverPrivate;
       
    92 
       
    93 };
       
    94 
       
    95 #endif // SCREENSAVER_H