![]() |
Home · All Namespaces · All Classes |
00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (directui@nokia.com) 00006 ** 00007 ** This file is part of systemui. 00008 ** 00009 ** If you have questions regarding the use of this file, please contact 00010 ** Nokia at directui@nokia.com. 00011 ** 00012 ** This library is free software; you can redistribute it and/or 00013 ** modify it under the terms of the GNU Lesser General Public 00014 ** License version 2.1 as published by the Free Software Foundation 00015 ** and appearing in the file LICENSE.LGPL included in the packaging 00016 ** of this file. 00017 ** 00018 ****************************************************************************/ 00019 #ifndef VOLUMEBAR_H 00020 #define VOLUMEBAR_H 00021 00022 #include <MStylableWidget> 00023 #include <QTimer> 00024 #include "volumebarstyle.h" 00025 00026 class QPropertyAnimation; 00027 class MStylableWidget; 00028 class MImageWidget; 00029 class MOverlay; 00030 class MWindow; 00031 class QTimer; 00032 00037 class VolumeBar : public MStylableWidget { 00038 Q_OBJECT 00039 00041 Q_PROPERTY(qreal currentPercentage READ currentPercentage WRITE setCurrentPercentage) 00042 00043 public: 00045 VolumeBar(QGraphicsItem *parent = NULL); 00046 00048 ~VolumeBar(); 00049 00050 signals: 00056 void percentageChanged(qreal percentage); 00057 00059 void animationsFinished(); 00060 00061 public slots: 00067 void setTargetPercentage(qreal percentage); 00068 00069 private slots: 00071 void updateContents(); 00072 00074 void finishAnimations(); 00075 00076 protected: 00078 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event); 00079 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event); 00080 virtual void applyStyle(); 00081 virtual void drawBackground(QPainter *painter, const QStyleOptionGraphicsItem *option) const; 00083 00084 private: 00086 void calculateNewVolumeForEvent(QGraphicsSceneMouseEvent *event); 00087 00089 qreal currentPercentage() const; 00090 00092 void setCurrentPercentage(qreal percentage); 00093 00095 QTimer visibilityTimer; 00097 MImageWidget *icon; 00099 qreal currentPercentage_; 00101 qreal targetPercentage; 00103 QPropertyAnimation *percentageAnimation; 00105 QPropertyAnimation *fadeInAnimation; 00107 QPropertyAnimation *fadeOutAnimation; 00108 00109 private: 00110 Q_DISABLE_COPY(VolumeBar) 00111 M_STYLABLE_WIDGET(VolumeBarStyle) 00112 00113 #ifdef UNIT_TEST 00114 friend class Ut_VolumeBar; 00115 #endif 00116 }; 00117 00118 #endif
Copyright © 2011 Nokia Corporation | Generated on Tue Aug 30 2011 16:38:12 Doxygen 1.7.1 |
MeeGo Touch |