-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 22afe19..8dadf96 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -88,193 +88,193 @@ void MediaPlayer::setPlaying( bool play ) { | |||
88 | xineControl->play( currentFile->file() ); | 88 | xineControl->play( currentFile->file() ); |
89 | 89 | ||
90 | xineControl->length(); | 90 | xineControl->length(); |
91 | long seconds = mediaPlayerState->length();// | 91 | long seconds = mediaPlayerState->length();// |
92 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 92 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
93 | qDebug(time); | 93 | qDebug(time); |
94 | 94 | ||
95 | QString tickerText; | 95 | QString tickerText; |
96 | if( currentFile->file().left(4) == "http" ) | 96 | if( currentFile->file().left(4) == "http" ) |
97 | tickerText= tr( " File: " ) + currentFile->name(); | 97 | tickerText= tr( " File: " ) + currentFile->name(); |
98 | else | 98 | else |
99 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | 99 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; |
100 | 100 | ||
101 | // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); | 101 | // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); |
102 | 102 | ||
103 | // if ( !fileInfo.isEmpty() ) | 103 | // if ( !fileInfo.isEmpty() ) |
104 | // tickerText += ", " + fileInfo; | 104 | // tickerText += ", " + fileInfo; |
105 | // audioUI->setTickerText( tickerText + "." ); | 105 | // audioUI->setTickerText( tickerText + "." ); |
106 | 106 | ||
107 | audioUI->setTickerText( currentFile->file( ) ); | 107 | audioUI->setTickerText( currentFile->file( ) ); |
108 | 108 | ||
109 | } | 109 | } |
110 | 110 | ||
111 | 111 | ||
112 | void MediaPlayer::prev() { | 112 | void MediaPlayer::prev() { |
113 | if ( playList->prev() ) { | 113 | if ( playList->prev() ) { |
114 | play(); | 114 | play(); |
115 | } else if ( mediaPlayerState->looping() ) { | 115 | } else if ( mediaPlayerState->looping() ) { |
116 | if ( playList->last() ) { | 116 | if ( playList->last() ) { |
117 | play(); | 117 | play(); |
118 | } | 118 | } |
119 | } else { | 119 | } else { |
120 | mediaPlayerState->setList(); | 120 | mediaPlayerState->setList(); |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | 124 | ||
125 | void MediaPlayer::next() { | 125 | void MediaPlayer::next() { |
126 | if ( playList->next() ) { | 126 | if ( playList->next() ) { |
127 | play(); | 127 | play(); |
128 | } else if ( mediaPlayerState->looping() ) { | 128 | } else if ( mediaPlayerState->looping() ) { |
129 | if ( playList->first() ) { | 129 | if ( playList->first() ) { |
130 | play(); | 130 | play(); |
131 | } | 131 | } |
132 | } else { | 132 | } else { |
133 | mediaPlayerState->setList(); | 133 | mediaPlayerState->setList(); |
134 | } | 134 | } |
135 | } | 135 | } |
136 | 136 | ||
137 | 137 | ||
138 | void MediaPlayer::startDecreasingVolume() { | 138 | void MediaPlayer::startDecreasingVolume() { |
139 | volumeDirection = -1; | 139 | volumeDirection = -1; |
140 | startTimer( 100 ); | 140 | startTimer( 100 ); |
141 | volControl->decVol(2); | 141 | volControl->decVol(2); |
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | void MediaPlayer::startIncreasingVolume() { | 145 | void MediaPlayer::startIncreasingVolume() { |
146 | volumeDirection = +1; | 146 | volumeDirection = +1; |
147 | startTimer( 100 ); | 147 | startTimer( 100 ); |
148 | volControl->incVol(2); | 148 | volControl->incVol(2); |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | bool drawnOnScreenDisplay = FALSE; | 152 | bool drawnOnScreenDisplay = FALSE; |
153 | unsigned int onScreenDisplayVolume = 0; | 153 | unsigned int onScreenDisplayVolume = 0; |
154 | const int yoff = 110; | 154 | const int yoff = 110; |
155 | 155 | ||
156 | void MediaPlayer::stopChangingVolume() { | 156 | void MediaPlayer::stopChangingVolume() { |
157 | killTimers(); | 157 | killTimers(); |
158 | // Get rid of the on-screen display stuff | 158 | // Get rid of the on-screen display stuff |
159 | drawnOnScreenDisplay = FALSE; | 159 | drawnOnScreenDisplay = FALSE; |
160 | onScreenDisplayVolume = 0; | 160 | onScreenDisplayVolume = 0; |
161 | int w=0; | 161 | int w=0; |
162 | int h=0; | 162 | int h=0; |
163 | if( !xineControl->hasVideo()) { | 163 | if( !xineControl->hasVideo()) { |
164 | w = audioUI->width(); | 164 | w = audioUI->width(); |
165 | h = audioUI->height(); | 165 | h = audioUI->height(); |
166 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 166 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
167 | } else { | 167 | } else { |
168 | w = videoUI->width(); | 168 | w = videoUI->width(); |
169 | h = videoUI->height(); | 169 | h = videoUI->height(); |
170 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 170 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | 174 | ||
175 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 175 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
176 | if ( volumeDirection == +1 ) { | 176 | if ( volumeDirection == +1 ) { |
177 | volControl->incVol(2); | 177 | volControl->incVol(2); |
178 | } else if ( volumeDirection == -1 ) { | 178 | } else if ( volumeDirection == -1 ) { |
179 | volControl->decVol(2); | 179 | volControl->decVol(2); |
180 | } | 180 | } |
181 | 181 | ||
182 | 182 | ||
183 | // TODO FIXME | 183 | // TODO FIXME |
184 | int v; | 184 | unsigned int v; |
185 | v = volControl->getVolume(); | 185 | v = volControl->getVolume(); |
186 | v = v / 10; | 186 | v = v / 10; |
187 | 187 | ||
188 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 188 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
189 | return; | 189 | return; |
190 | } | 190 | } |
191 | 191 | ||
192 | int w=0; int h=0; | 192 | int w=0; int h=0; |
193 | if( !xineControl->hasVideo()) { | 193 | if( !xineControl->hasVideo()) { |
194 | w = audioUI->width(); | 194 | w = audioUI->width(); |
195 | h = audioUI->height(); | 195 | h = audioUI->height(); |
196 | 196 | ||
197 | if ( drawnOnScreenDisplay ) { | 197 | if ( drawnOnScreenDisplay ) { |
198 | if ( onScreenDisplayVolume > v ) { | 198 | if ( onScreenDisplayVolume > v ) { |
199 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 199 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | drawnOnScreenDisplay = TRUE; | 202 | drawnOnScreenDisplay = TRUE; |
203 | onScreenDisplayVolume = v; | 203 | onScreenDisplayVolume = v; |
204 | QPainter p( audioUI ); | 204 | QPainter p( audioUI ); |
205 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 205 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
206 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 206 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
207 | 207 | ||
208 | QFont f; | 208 | QFont f; |
209 | f.setPixelSize( 20 ); | 209 | f.setPixelSize( 20 ); |
210 | f.setBold( TRUE ); | 210 | f.setBold( TRUE ); |
211 | p.setFont( f ); | 211 | p.setFont( f ); |
212 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 212 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
213 | 213 | ||
214 | for ( unsigned int i = 0; i < 10; i++ ) { | 214 | for ( unsigned int i = 0; i < 10; i++ ) { |
215 | if ( v > i ) { | 215 | if ( v > i ) { |
216 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 216 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
217 | } else { | 217 | } else { |
218 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 218 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } else { | 221 | } else { |
222 | w = videoUI->width(); | 222 | w = videoUI->width(); |
223 | h = videoUI->height(); | 223 | h = videoUI->height(); |
224 | 224 | ||
225 | if ( drawnOnScreenDisplay ) { | 225 | if ( drawnOnScreenDisplay ) { |
226 | if ( onScreenDisplayVolume > v ) { | 226 | if ( onScreenDisplayVolume > v ) { |
227 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 227 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
228 | } | 228 | } |
229 | } | 229 | } |
230 | drawnOnScreenDisplay = TRUE; | 230 | drawnOnScreenDisplay = TRUE; |
231 | onScreenDisplayVolume = v; | 231 | onScreenDisplayVolume = v; |
232 | QPainter p( videoUI ); | 232 | QPainter p( videoUI ); |
233 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 233 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
234 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 234 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
235 | 235 | ||
236 | QFont f; | 236 | QFont f; |
237 | f.setPixelSize( 20 ); | 237 | f.setPixelSize( 20 ); |
238 | f.setBold( TRUE ); | 238 | f.setBold( TRUE ); |
239 | p.setFont( f ); | 239 | p.setFont( f ); |
240 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 240 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
241 | 241 | ||
242 | for ( unsigned int i = 0; i < 10; i++ ) { | 242 | for ( unsigned int i = 0; i < 10; i++ ) { |
243 | if ( v > i ) { | 243 | if ( v > i ) { |
244 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 244 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
245 | } else { | 245 | } else { |
246 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 246 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 252 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
253 | switch ( e->key() ) { | 253 | switch ( e->key() ) { |
254 | ////////////////////////////// Zaurus keys | 254 | ////////////////////////////// Zaurus keys |
255 | case Key_Home: | 255 | case Key_Home: |
256 | break; | 256 | break; |
257 | case Key_F9: //activity | 257 | case Key_F9: //activity |
258 | break; | 258 | break; |
259 | case Key_F10: //contacts | 259 | case Key_F10: //contacts |
260 | break; | 260 | break; |
261 | case Key_F11: //menu | 261 | case Key_F11: //menu |
262 | break; | 262 | break; |
263 | case Key_F12: //home | 263 | case Key_F12: //home |
264 | qDebug("Blank here"); | 264 | qDebug("Blank here"); |
265 | break; | 265 | break; |
266 | case Key_F13: //mail | 266 | case Key_F13: //mail |
267 | break; | 267 | break; |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | void MediaPlayer::doBlank() { | 271 | void MediaPlayer::doBlank() { |
272 | 272 | ||
273 | } | 273 | } |
274 | 274 | ||
275 | void MediaPlayer::doUnblank() { | 275 | void MediaPlayer::doUnblank() { |
276 | 276 | ||
277 | } | 277 | } |
278 | 278 | ||
279 | void MediaPlayer::cleanUp() { | 279 | void MediaPlayer::cleanUp() { |
280 | // QPEApplication::grabKeyboard(); | 280 | // QPEApplication::grabKeyboard(); |