homescreenapp/widgetplugins/hsclockwidgetplugin/inc/hsclockwidget.h
changeset 35 f9ce957a272c
child 39 4e8ebe173323
equal deleted inserted replaced
5:c743ef5928ba 35:f9ce957a272c
       
     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:  Clock widget
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef HSCLOCKWIDGET_H
       
    19 #define HSCLOCKWIDGET_H
       
    20 
       
    21 #include <QGraphicsSvgItem>
       
    22 #include <QTime>
       
    23 #include <QWidget>
       
    24 #include <QGraphicsWidget>
       
    25 #include <QImage>
       
    26 #include <hbwidget.h>
       
    27 #include <hstest_global.h>
       
    28 #include "hsanalogclockstyleoption.h"
       
    29 
       
    30 HOMESCREEN_TEST_CLASS(TestClockWidget)
       
    31 
       
    32 class HbWidget;
       
    33 class QGraphicsLinearLayout;
       
    34 
       
    35 class HsClockWidget : public HbWidget
       
    36 {
       
    37     Q_OBJECT
       
    38     Q_PROPERTY(QString clockType READ clockType WRITE setClockType)
       
    39 
       
    40 public:
       
    41 
       
    42     HsClockWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0);
       
    43     ~HsClockWidget();
       
    44 
       
    45     QString clockType() const;
       
    46     void setClockType(const QString &type);
       
    47 
       
    48 public slots:
       
    49 
       
    50     void onInitialize();
       
    51     void onShow();
       
    52     void onHide();
       
    53     void onUninitialize();
       
    54 
       
    55     void updateTime();
       
    56     void onTypeChanged(QString type);
       
    57     
       
    58 signals:
       
    59     void setPreferences(const QStringList &names);
       
    60 
       
    61 protected:
       
    62 
       
    63     void mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_UNUSED(event) }
       
    64     void mouseReleaseEvent(QGraphicsSceneMouseEvent *aEvent);
       
    65 
       
    66 private:
       
    67     void toggleClockType();
       
    68     HbWidget *loadClockWidget();
       
    69 
       
    70 private:
       
    71 
       
    72     QTimer *mTimer;
       
    73     QString mClockType;
       
    74     HbWidget *mWidget;
       
    75     QGraphicsLinearLayout *mLayout;
       
    76     bool mWidgetShown;
       
    77 
       
    78     Q_DISABLE_COPY(HsClockWidget)
       
    79 
       
    80     HOMESCREEN_TEST_FRIEND_CLASS(TestClockWidget)
       
    81 
       
    82 };
       
    83 
       
    84 
       
    85 
       
    86 
       
    87 #endif