![]() |
Home · All Namespaces · All Classes |
The volume-bar widget. More...
#include <volumebar.h>


Public Slots | |
| void | updateVolume (int val, int max) |
Signals | |
| void | volumeChanged (int val) |
| void | animationsFinished () |
| this signal emitted when volume-bar runs to timeout | |
Public Member Functions | |
| VolumeBar (QGraphicsItem *parent=0) | |
| Constructs a VolumeBar instance. | |
| ~VolumeBar () | |
| Destructs a VolumeBar instance. | |
Protected Member Functions | |
| virtual void | mousePressEvent (QGraphicsSceneMouseEvent *event) |
| REIMPLEMENTATION | |
| virtual void | mouseMoveEvent (QGraphicsSceneMouseEvent *event) |
| virtual void | applyStyle () |
The volume-bar widget.
Definition at line 35 of file volumebar.h.
| VolumeBar::VolumeBar | ( | QGraphicsItem * | parent = 0 |
) |
Constructs a VolumeBar instance.
Definition at line 35 of file volumebar.cpp.
00035 : 00036 MStylableWidget (parent), 00037 slider (0), 00038 icon (0), 00039 value (0), 00040 valueMax (0), 00041 animMove (0), 00042 animFadeIn (0), 00043 animFadeOut (0) 00044 { 00045 constructUi (); 00046 setOpacity (0.0); 00047 }
| VolumeBar::~VolumeBar | ( | ) |
| void VolumeBar::animationsFinished | ( | ) | [signal] |
this signal emitted when volume-bar runs to timeout
| void VolumeBar::applyStyle | ( | ) | [protected, virtual] |
Definition at line 53 of file volumebar.cpp.
00054 { 00055 MStylableWidget::applyStyle (); 00056 00057 int timeout = style ()->visibleTimeout (); 00058 int animDuration = style ()->fadeDuration (); 00059 qreal opacity = style ()->volumebarOpacity (); 00060 00061 if (animDuration * 2 > timeout) 00062 { // handle the error: 00063 qWarning () << "ERROR in VolumeBars CSS: animDuration * 2 > timeout!"; 00064 animDuration = timeout / 2; 00065 } 00066 00067 // first fade out animation started and after its finished we emit animationsFinished () 00068 timer.setInterval (timeout - animDuration); 00069 00070 animFadeIn->setDuration (animDuration); 00071 animFadeOut->setDuration (animDuration); 00072 00073 animFadeIn->setEndValue (opacity); 00074 }
| void VolumeBar::mouseMoveEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected, virtual] |
Definition at line 115 of file volumebar.cpp.
00116 { 00117 MStylableWidget::mouseMoveEvent (event); 00118 // just pass the event to mousePressEvent handler 00119 mousePressEvent (event); 00120 }

| void VolumeBar::mousePressEvent | ( | QGraphicsSceneMouseEvent * | event | ) | [protected, virtual] |
REIMPLEMENTATION
Definition at line 122 of file volumebar.cpp.
00123 { 00124 MStylableWidget::mousePressEvent (event); 00125 qreal percentage = 0.0; 00126 /* 00127 * increase & decrease the volume based on the tap/movement 00128 * coordinates... 00129 */ 00130 if (sceneManager()->orientation() == M::Portrait) 00131 percentage = (geometry().height() - event->pos().y()) / geometry().height(); 00132 else 00133 percentage = (geometry().width() - event->pos().x()) / geometry().width(); 00134 00135 value = valueMax * percentage; 00136 00137 if (value >= valueMax) 00138 value = valueMax - 1; 00139 00140 /* emit volumeChanged signal... */ 00141 emit volumeChanged (value); 00142 /* and the update the UI */ 00143 updateVolume (value, valueMax); 00144 }

| void VolumeBar::updateVolume | ( | int | val, | |
| int | max | |||
| ) | [slot] |
This method makes volume-bar visible, and updates its contents (with animations)
| val | The actual volume level (valid range: [0 - max-1]) | |
| max | The maximal count of the volume-levels |
Definition at line 193 of file volumebar.cpp.
00194 { 00195 timer.stop (); 00196 00197 value = val; 00198 valueMax = max; 00199 00200 updateContents (); 00201 00202 if (animFadeOut->state () != QAbstractAnimation::Stopped) { 00203 // stop the fade-out animation in case if it is not stopped 00204 animFadeOut->stop (); 00205 // start the fade-in animation to get the wanted opacity back 00206 animFadeIn->start (); 00207 } else if (animFadeIn->state () != QAbstractAnimation::Running && (opacity () <= 0.1)) { 00208 // start the fade-in animation (only if needed ^^^) 00209 animFadeIn->start (); 00210 } 00211 00212 timer.start (); 00213 }
| void VolumeBar::volumeChanged | ( | int | val | ) | [signal] |
This signal emitted when user modifies the volume level by touching the volume-bar
| val | The new volume level |
| Copyright © 2010 Nokia Corporation | Generated on Wed Nov 10 16:05:14 2010 Doxygen 1.6.1 |
MeeGo Touch |