Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 38ba08f..43e3133 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -108,6 +108,7 @@ void MediaPlayer::startDecreasingVolume() { | |||
108 | volumeDirection = -1; | 108 | volumeDirection = -1; |
109 | startTimer( 100 ); | 109 | startTimer( 100 ); |
110 | // da kommt demnächst osound denk ich mal | 110 | // da kommt demnächst osound denk ich mal |
111 | /////////////////////////// lets just move those change volume here | ||
111 | // AudioDevice::decreaseVolume(); | 112 | // AudioDevice::decreaseVolume(); |
112 | } | 113 | } |
113 | 114 | ||
@@ -119,8 +120,18 @@ void MediaPlayer::startIncreasingVolume() { | |||
119 | } | 120 | } |
120 | 121 | ||
121 | 122 | ||
123 | bool drawnOnScreenDisplay = FALSE; | ||
124 | unsigned int onScreenDisplayVolume = 0; | ||
125 | const int yoff = 110; | ||
126 | |||
122 | void MediaPlayer::stopChangingVolume() { | 127 | void MediaPlayer::stopChangingVolume() { |
123 | killTimers(); | 128 | killTimers(); |
129 | // Get rid of the on-screen display stuff | ||
130 | drawnOnScreenDisplay = FALSE; | ||
131 | onScreenDisplayVolume = 0; | ||
132 | int w = audioUI->width(); | ||
133 | int h = audioUI->height(); | ||
134 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | ||
124 | } | 135 | } |
125 | 136 | ||
126 | 137 | ||
@@ -129,6 +140,42 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
129 | // AudioDevice::increaseVolume(); | 140 | // AudioDevice::increaseVolume(); |
130 | // else if ( volumeDirection == -1 ) | 141 | // else if ( volumeDirection == -1 ) |
131 | // AudioDevice::decreaseVolume(); | 142 | // AudioDevice::decreaseVolume(); |
143 | |||
144 | // Display an on-screen display volume | ||
145 | unsigned int l, r, v; bool m; | ||
146 | AudioDevice::getVolume( l, r, m ); | ||
147 | v = ((l + r) * 11) / (2*0xFFFF); | ||
148 | |||
149 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) | ||
150 | return; | ||
151 | |||
152 | int w = audioUI->width(); | ||
153 | int h = audioUI->height(); | ||
154 | |||
155 | if ( drawnOnScreenDisplay ) { | ||
156 | if ( onScreenDisplayVolume > v ) | ||
157 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | ||
158 | } | ||
159 | |||
160 | drawnOnScreenDisplay = TRUE; | ||
161 | onScreenDisplayVolume = v; | ||
162 | |||
163 | QPainter p( audioUI ); | ||
164 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | ||
165 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | ||
166 | |||
167 | QFont f; | ||
168 | f.setPixelSize( 20 ); | ||
169 | f.setBold( TRUE ); | ||
170 | p.setFont( f ); | ||
171 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | ||
172 | |||
173 | for ( unsigned int i = 0; i < 10; i++ ) { | ||
174 | if ( v > i ) | ||
175 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | ||
176 | else | ||
177 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | ||
178 | } | ||
132 | } | 179 | } |
133 | 180 | ||
134 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 181 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |