diff -r 2e2dc3d30ca8 -r 341166945d65 homescreenapp/examples/batterywidgetplugin/inc/batterywidget.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/homescreenapp/examples/batterywidgetplugin/inc/batterywidget.h Fri Jun 25 19:19:22 2010 +0300 @@ -0,0 +1,77 @@ +/* +* Copyright (c) 2010 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: Example of home screen widget +* +*/ + +#ifndef BatteryWidget_H +#define BatteryWidget_H + +#include + +#include +QTM_USE_NAMESPACE + + +class BatteryWidget : public HbWidget +{ + Q_OBJECT +// Start of snippet 1 + Q_PROPERTY(QString rootPath READ rootPath WRITE setRootPath) +// End of snippet 1 + +public: + BatteryWidget(QGraphicsItem *parent = 0, Qt::WindowFlags flags = 0); + ~BatteryWidget(); + +// Start of snippet 2 +public: + QString rootPath() const; + void setRootPath(QString &rootPath); +// End of snippet 2 + +public: + QRectF boundingRect() const; + QPainterPath shape() const; + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); + +public slots: // from home screen widget model + void onShow(); + void onHide(); + void onInitialize(); + void onUninitialize(); + +public slots: + void batteryLevelChanged(int level); + void powerStateChanged(QSystemDeviceInfo::PowerState powerState); + void updateChargingBatteryValue(); + +signals: + void error(); + +private: + void drawBatteryImage(); + void stateChanged(); + +private: + Q_DISABLE_COPY(BatteryWidget) + QString mRootPath; + QSystemDeviceInfo *mDeviceInfo; + int mBatteryValue; + QPixmap mBatteryBackgroundBitmap; + QPixmap mUnifiedBatteryBitmap; + QTimer *mChargingTimer; +}; + +#endif // BatteryWidget_H