author | zecke <zecke> | 2003-10-07 13:01:51 (UTC) |
---|---|---|
committer | zecke <zecke> | 2003-10-07 13:01:51 (UTC) |
commit | d72a9cfe61cbc0910373e4604220021ebbcedaeb (patch) (unidiff) | |
tree | 285eb69e028889fe8d9af57d5db5cd4304509a32 | |
parent | 62d81aa76146401087e3ec9dcebd298a7d030c4a (diff) | |
download | opie-d72a9cfe61cbc0910373e4604220021ebbcedaeb.zip opie-d72a9cfe61cbc0910373e4604220021ebbcedaeb.tar.gz opie-d72a9cfe61cbc0910373e4604220021ebbcedaeb.tar.bz2 |
Add a FIXME to the MediaPlayer::blank method
why don't we use ODevice::inst()->setDisplayStatus() ?
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 9f51006..4c9afca 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -30,376 +30,377 @@ MediaPlayer::MediaPlayer( PlayListWidget &_playList, MediaPlayerState &_mediaPla | |||
30 | 30 | ||
31 | fd=-1;fl=-1; | 31 | fd=-1;fl=-1; |
32 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); | 32 | playList.setCaption( tr( "OpiePlayer: Initializating" ) ); |
33 | 33 | ||
34 | qApp->processEvents(); | 34 | qApp->processEvents(); |
35 | // QPEApplication::grabKeyboard(); // EVIL | 35 | // QPEApplication::grabKeyboard(); // EVIL |
36 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 36 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
37 | 37 | ||
38 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 38 | connect( &mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
39 | 39 | ||
40 | // What is pauseCheck good for? (Simon) | 40 | // What is pauseCheck good for? (Simon) |
41 | // connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 41 | // connect( &mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
42 | 42 | ||
43 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 43 | connect( &mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
44 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 44 | connect( &mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
45 | connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | 45 | connect( &mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); |
46 | 46 | ||
47 | volControl = new VolumeControl; | 47 | volControl = new VolumeControl; |
48 | Config cfg( "OpiePlayer" ); | 48 | Config cfg( "OpiePlayer" ); |
49 | cfg.setGroup("PlayList"); | 49 | cfg.setGroup("PlayList"); |
50 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 50 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
51 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); | 51 | playList.setCaption( tr( "OpiePlayer: " ) + QFileInfo(currentPlaylist).baseName() ); |
52 | 52 | ||
53 | m_skinLoader = new SkinLoader; | 53 | m_skinLoader = new SkinLoader; |
54 | m_skinLoader->schedule( AudioWidget::guiInfo() ); | 54 | m_skinLoader->schedule( AudioWidget::guiInfo() ); |
55 | m_skinLoader->schedule( VideoWidget::guiInfo() ); | 55 | m_skinLoader->schedule( VideoWidget::guiInfo() ); |
56 | m_skinLoader->start(); | 56 | m_skinLoader->start(); |
57 | } | 57 | } |
58 | 58 | ||
59 | MediaPlayer::~MediaPlayer() { | 59 | MediaPlayer::~MediaPlayer() { |
60 | // this shold never happen, but one never knows... | 60 | // this shold never happen, but one never knows... |
61 | if ( xine ) { | 61 | if ( xine ) { |
62 | xine->ensureInitialized(); | 62 | xine->ensureInitialized(); |
63 | delete xine; | 63 | delete xine; |
64 | } | 64 | } |
65 | delete m_xineControl; | 65 | delete m_xineControl; |
66 | delete m_audioUI; | 66 | delete m_audioUI; |
67 | delete m_videoUI; | 67 | delete m_videoUI; |
68 | delete volControl; | 68 | delete volControl; |
69 | } | 69 | } |
70 | 70 | ||
71 | void MediaPlayer::pauseCheck( bool b ) { | 71 | void MediaPlayer::pauseCheck( bool b ) { |
72 | if ( b && !mediaPlayerState.isPlaying() ) { | 72 | if ( b && !mediaPlayerState.isPlaying() ) { |
73 | mediaPlayerState.setPaused( FALSE ); | 73 | mediaPlayerState.setPaused( FALSE ); |
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | void MediaPlayer::play() { | 77 | void MediaPlayer::play() { |
78 | mediaPlayerState.setPlaying( FALSE ); | 78 | mediaPlayerState.setPlaying( FALSE ); |
79 | mediaPlayerState.setPlaying( TRUE ); | 79 | mediaPlayerState.setPlaying( TRUE ); |
80 | } | 80 | } |
81 | 81 | ||
82 | void MediaPlayer::setPlaying( bool play ) { | 82 | void MediaPlayer::setPlaying( bool play ) { |
83 | if ( !play ) { | 83 | if ( !play ) { |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | 86 | ||
87 | if ( mediaPlayerState.isPaused() ) { | 87 | if ( mediaPlayerState.isPaused() ) { |
88 | mediaPlayerState.setPaused( FALSE ); | 88 | mediaPlayerState.setPaused( FALSE ); |
89 | return; | 89 | return; |
90 | } | 90 | } |
91 | 91 | ||
92 | QString tickerText, time, fileName; | 92 | QString tickerText, time, fileName; |
93 | if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { | 93 | if ( playList.currentTab() != PlayListWidget::CurrentPlayList ) { |
94 | //if playing in file list.. play in a different way | 94 | //if playing in file list.. play in a different way |
95 | // random and looping settings enabled causes problems here, | 95 | // random and looping settings enabled causes problems here, |
96 | // since there is no selected file in the playlist, but a selected file in the file list, | 96 | // since there is no selected file in the playlist, but a selected file in the file list, |
97 | // so we remember and shutoff | 97 | // so we remember and shutoff |
98 | l = mediaPlayerState.isLooping(); | 98 | l = mediaPlayerState.isLooping(); |
99 | if(l) { | 99 | if(l) { |
100 | mediaPlayerState.setLooping( false ); | 100 | mediaPlayerState.setLooping( false ); |
101 | } | 101 | } |
102 | r = mediaPlayerState.isShuffled(); | 102 | r = mediaPlayerState.isShuffled(); |
103 | mediaPlayerState.setShuffled( false ); | 103 | mediaPlayerState.setShuffled( false ); |
104 | } | 104 | } |
105 | 105 | ||
106 | PlayListWidget::Entry playListEntry = playList.currentEntry(); | 106 | PlayListWidget::Entry playListEntry = playList.currentEntry(); |
107 | fileName = playListEntry.name; | 107 | fileName = playListEntry.name; |
108 | xineControl()->play( playListEntry.file ); | 108 | xineControl()->play( playListEntry.file ); |
109 | 109 | ||
110 | long seconds = mediaPlayerState.length(); | 110 | long seconds = mediaPlayerState.length(); |
111 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 111 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
112 | 112 | ||
113 | if( fileName.left(4) == "http" ) { | 113 | if( fileName.left(4) == "http" ) { |
114 | fileName = QFileInfo( fileName ).baseName(); | 114 | fileName = QFileInfo( fileName ).baseName(); |
115 | if ( xineControl()->getMetaInfo().isEmpty() ) { | 115 | if ( xineControl()->getMetaInfo().isEmpty() ) { |
116 | tickerText = tr( " File: " ) + fileName; | 116 | tickerText = tr( " File: " ) + fileName; |
117 | } else { | 117 | } else { |
118 | tickerText = xineControl()->getMetaInfo(); | 118 | tickerText = xineControl()->getMetaInfo(); |
119 | } | 119 | } |
120 | } else { | 120 | } else { |
121 | if ( xineControl()->getMetaInfo().isEmpty() ) { | 121 | if ( xineControl()->getMetaInfo().isEmpty() ) { |
122 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; | 122 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; |
123 | } else { | 123 | } else { |
124 | tickerText = xineControl()->getMetaInfo() + " Length: " + time + " "; | 124 | tickerText = xineControl()->getMetaInfo() + " Length: " + time + " "; |
125 | } | 125 | } |
126 | } | 126 | } |
127 | audioUI()->setTickerText( tickerText ); | 127 | audioUI()->setTickerText( tickerText ); |
128 | } | 128 | } |
129 | 129 | ||
130 | 130 | ||
131 | void MediaPlayer::prev() { | 131 | void MediaPlayer::prev() { |
132 | if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist | 132 | if( playList.currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist |
133 | if ( playList.prev() ) { | 133 | if ( playList.prev() ) { |
134 | play(); | 134 | play(); |
135 | } else if ( mediaPlayerState.isLooping() ) { | 135 | } else if ( mediaPlayerState.isLooping() ) { |
136 | if ( playList.last() ) { | 136 | if ( playList.last() ) { |
137 | play(); | 137 | play(); |
138 | } | 138 | } |
139 | } else { | 139 | } else { |
140 | mediaPlayerState.setList(); | 140 | mediaPlayerState.setList(); |
141 | } | 141 | } |
142 | } | 142 | } |
143 | } | 143 | } |
144 | 144 | ||
145 | 145 | ||
146 | void MediaPlayer::next() { | 146 | void MediaPlayer::next() { |
147 | 147 | ||
148 | if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist | 148 | if(playList.currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist |
149 | if ( playList.next() ) { | 149 | if ( playList.next() ) { |
150 | play(); | 150 | play(); |
151 | } else if ( mediaPlayerState.isLooping() ) { | 151 | } else if ( mediaPlayerState.isLooping() ) { |
152 | if ( playList.first() ) { | 152 | if ( playList.first() ) { |
153 | play(); | 153 | play(); |
154 | } | 154 | } |
155 | } else { | 155 | } else { |
156 | mediaPlayerState.setList(); | 156 | mediaPlayerState.setList(); |
157 | } | 157 | } |
158 | } else { //if playing from file list, let's just stop | 158 | } else { //if playing from file list, let's just stop |
159 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); | 159 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); |
160 | mediaPlayerState.setPlaying(false); | 160 | mediaPlayerState.setPlaying(false); |
161 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); | 161 | mediaPlayerState.setDisplayType( MediaPlayerState::MediaSelection ); |
162 | if(l) mediaPlayerState.setLooping(l); | 162 | if(l) mediaPlayerState.setLooping(l); |
163 | if(r) mediaPlayerState.setShuffled(r); | 163 | if(r) mediaPlayerState.setShuffled(r); |
164 | } | 164 | } |
165 | qApp->processEvents(); | 165 | qApp->processEvents(); |
166 | } | 166 | } |
167 | 167 | ||
168 | 168 | ||
169 | void MediaPlayer::startDecreasingVolume() { | 169 | void MediaPlayer::startDecreasingVolume() { |
170 | volumeDirection = -1; | 170 | volumeDirection = -1; |
171 | startTimer( 100 ); | 171 | startTimer( 100 ); |
172 | volControl->decVol(2); | 172 | volControl->decVol(2); |
173 | } | 173 | } |
174 | 174 | ||
175 | 175 | ||
176 | void MediaPlayer::startIncreasingVolume() { | 176 | void MediaPlayer::startIncreasingVolume() { |
177 | volumeDirection = +1; | 177 | volumeDirection = +1; |
178 | startTimer( 100 ); | 178 | startTimer( 100 ); |
179 | volControl->incVol(2); | 179 | volControl->incVol(2); |
180 | } | 180 | } |
181 | 181 | ||
182 | 182 | ||
183 | bool drawnOnScreenDisplay = FALSE; | 183 | bool drawnOnScreenDisplay = FALSE; |
184 | unsigned int onScreenDisplayVolume = 0; | 184 | unsigned int onScreenDisplayVolume = 0; |
185 | const int yoff = 110; | 185 | const int yoff = 110; |
186 | 186 | ||
187 | void MediaPlayer::stopChangingVolume() { | 187 | void MediaPlayer::stopChangingVolume() { |
188 | killTimers(); | 188 | killTimers(); |
189 | // Get rid of the on-screen display stuff | 189 | // Get rid of the on-screen display stuff |
190 | drawnOnScreenDisplay = FALSE; | 190 | drawnOnScreenDisplay = FALSE; |
191 | onScreenDisplayVolume = 0; | 191 | onScreenDisplayVolume = 0; |
192 | int w=0; | 192 | int w=0; |
193 | int h=0; | 193 | int h=0; |
194 | if( !xineControl()->hasVideo() ) { | 194 | if( !xineControl()->hasVideo() ) { |
195 | w = audioUI()->width(); | 195 | w = audioUI()->width(); |
196 | h = audioUI()->height(); | 196 | h = audioUI()->height(); |
197 | audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 197 | audioUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
198 | } else { | 198 | } else { |
199 | w = videoUI()->width(); | 199 | w = videoUI()->width(); |
200 | h = videoUI()->height(); | 200 | h = videoUI()->height(); |
201 | videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 201 | videoUI()->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | 204 | ||
205 | 205 | ||
206 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 206 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
207 | if ( volumeDirection == +1 ) { | 207 | if ( volumeDirection == +1 ) { |
208 | volControl->incVol( 2 ); | 208 | volControl->incVol( 2 ); |
209 | } else if ( volumeDirection == -1 ) { | 209 | } else if ( volumeDirection == -1 ) { |
210 | volControl->decVol( 2 ); | 210 | volControl->decVol( 2 ); |
211 | } | 211 | } |
212 | 212 | ||
213 | 213 | ||
214 | // TODO FIXME | 214 | // TODO FIXME |
215 | // huh?? | 215 | // huh?? |
216 | unsigned int v= 0; | 216 | unsigned int v= 0; |
217 | v = volControl->volume(); | 217 | v = volControl->volume(); |
218 | v = v / 10; | 218 | v = v / 10; |
219 | 219 | ||
220 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 220 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
221 | return; | 221 | return; |
222 | } | 222 | } |
223 | 223 | ||
224 | int w=0; int h=0; | 224 | int w=0; int h=0; |
225 | if( !xineControl()->hasVideo() ) { | 225 | if( !xineControl()->hasVideo() ) { |
226 | w = audioUI()->width(); | 226 | w = audioUI()->width(); |
227 | h = audioUI()->height(); | 227 | h = audioUI()->height(); |
228 | 228 | ||
229 | if ( drawnOnScreenDisplay ) { | 229 | if ( drawnOnScreenDisplay ) { |
230 | if ( onScreenDisplayVolume > v ) { | 230 | if ( onScreenDisplayVolume > v ) { |
231 | audioUI()->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 231 | audioUI()->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
232 | } | 232 | } |
233 | } | 233 | } |
234 | drawnOnScreenDisplay = TRUE; | 234 | drawnOnScreenDisplay = TRUE; |
235 | onScreenDisplayVolume = v; | 235 | onScreenDisplayVolume = v; |
236 | QPainter p( audioUI() ); | 236 | QPainter p( audioUI() ); |
237 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 237 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
238 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 238 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
239 | 239 | ||
240 | QFont f; | 240 | QFont f; |
241 | f.setPixelSize( 20 ); | 241 | f.setPixelSize( 20 ); |
242 | f.setBold( TRUE ); | 242 | f.setBold( TRUE ); |
243 | p.setFont( f ); | 243 | p.setFont( f ); |
244 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 244 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
245 | 245 | ||
246 | for ( unsigned int i = 0; i < 10; i++ ) { | 246 | for ( unsigned int i = 0; i < 10; i++ ) { |
247 | if ( v > i ) { | 247 | if ( v > i ) { |
248 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 248 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
249 | } else { | 249 | } else { |
250 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 250 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | } else { | 253 | } else { |
254 | w = videoUI()->width(); | 254 | w = videoUI()->width(); |
255 | h = videoUI()->height(); | 255 | h = videoUI()->height(); |
256 | 256 | ||
257 | if ( drawnOnScreenDisplay ) { | 257 | if ( drawnOnScreenDisplay ) { |
258 | if ( onScreenDisplayVolume > v ) { | 258 | if ( onScreenDisplayVolume > v ) { |
259 | videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 259 | videoUI()->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
260 | } | 260 | } |
261 | } | 261 | } |
262 | drawnOnScreenDisplay = TRUE; | 262 | drawnOnScreenDisplay = TRUE; |
263 | onScreenDisplayVolume = v; | 263 | onScreenDisplayVolume = v; |
264 | QPainter p( videoUI() ); | 264 | QPainter p( videoUI() ); |
265 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 265 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
266 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 266 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
267 | 267 | ||
268 | QFont f; | 268 | QFont f; |
269 | f.setPixelSize( 20 ); | 269 | f.setPixelSize( 20 ); |
270 | f.setBold( TRUE ); | 270 | f.setBold( TRUE ); |
271 | p.setFont( f ); | 271 | p.setFont( f ); |
272 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); | 272 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); |
273 | 273 | ||
274 | for ( unsigned int i = 0; i < 10; i++ ) { | 274 | for ( unsigned int i = 0; i < 10; i++ ) { |
275 | if ( v > i ) { | 275 | if ( v > i ) { |
276 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 276 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
277 | } else { | 277 | } else { |
278 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 278 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
279 | } | 279 | } |
280 | } | 280 | } |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | 284 | ||
285 | void MediaPlayer::blank( bool b ) { | 285 | void MediaPlayer::blank( bool b ) { |
286 | // ### FIXME use ODevice::inst()->setDisplayStatus( b ); | ||
286 | fd=open("/dev/fb0",O_RDWR); | 287 | fd=open("/dev/fb0",O_RDWR); |
287 | #ifdef QT_QWS_SL5XXX | 288 | #ifdef QT_QWS_SL5XXX |
288 | fl= open( "/dev/fl", O_RDWR ); | 289 | fl= open( "/dev/fl", O_RDWR ); |
289 | #endif | 290 | #endif |
290 | if (fd != -1) { | 291 | if (fd != -1) { |
291 | if ( b ) { | 292 | if ( b ) { |
292 | qDebug("do blanking"); | 293 | qDebug("do blanking"); |
293 | #ifdef QT_QWS_SL5XXX | 294 | #ifdef QT_QWS_SL5XXX |
294 | ioctl( fd, FBIOBLANK, 1 ); | 295 | ioctl( fd, FBIOBLANK, 1 ); |
295 | if(fl !=-1) { | 296 | if(fl !=-1) { |
296 | ioctl( fl, 2 ); | 297 | ioctl( fl, 2 ); |
297 | ::close(fl); | 298 | ::close(fl); |
298 | } | 299 | } |
299 | #else | 300 | #else |
300 | ioctl( fd, FBIOBLANK, 3 ); | 301 | ioctl( fd, FBIOBLANK, 3 ); |
301 | #endif | 302 | #endif |
302 | isBlanked = TRUE; | 303 | isBlanked = TRUE; |
303 | } else { | 304 | } else { |
304 | qDebug("do unblanking"); | 305 | qDebug("do unblanking"); |
305 | ioctl( fd, FBIOBLANK, 0); | 306 | ioctl( fd, FBIOBLANK, 0); |
306 | #ifdef QT_QWS_SL5XXX | 307 | #ifdef QT_QWS_SL5XXX |
307 | if(fl != -1) { | 308 | if(fl != -1) { |
308 | ioctl( fl, 1); | 309 | ioctl( fl, 1); |
309 | ::close(fl); | 310 | ::close(fl); |
310 | } | 311 | } |
311 | #endif | 312 | #endif |
312 | isBlanked = FALSE; | 313 | isBlanked = FALSE; |
313 | } | 314 | } |
314 | close( fd ); | 315 | close( fd ); |
315 | } else { | 316 | } else { |
316 | qDebug("<< /dev/fb0 could not be opened >>"); | 317 | qDebug("<< /dev/fb0 could not be opened >>"); |
317 | } | 318 | } |
318 | } | 319 | } |
319 | 320 | ||
320 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 321 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
321 | switch ( e->key() ) { | 322 | switch ( e->key() ) { |
322 | ////////////////////////////// Zaurus keys | 323 | ////////////////////////////// Zaurus keys |
323 | case Key_Home: | 324 | case Key_Home: |
324 | break; | 325 | break; |
325 | case Key_F9: //activity | 326 | case Key_F9: //activity |
326 | break; | 327 | break; |
327 | case Key_F10: //contacts | 328 | case Key_F10: //contacts |
328 | break; | 329 | break; |
329 | case Key_F11: //menu | 330 | case Key_F11: //menu |
330 | break; | 331 | break; |
331 | case Key_F12: //home | 332 | case Key_F12: //home |
332 | qDebug("Blank here"); | 333 | qDebug("Blank here"); |
333 | // mediaPlayerState->toggleBlank(); | 334 | // mediaPlayerState->toggleBlank(); |
334 | break; | 335 | break; |
335 | case Key_F13: //mail | 336 | case Key_F13: //mail |
336 | qDebug("Blank here"); | 337 | qDebug("Blank here"); |
337 | // mediaPlayerState->toggleBlank(); | 338 | // mediaPlayerState->toggleBlank(); |
338 | break; | 339 | break; |
339 | } | 340 | } |
340 | } | 341 | } |
341 | 342 | ||
342 | void MediaPlayer::cleanUp() {// this happens on closing | 343 | void MediaPlayer::cleanUp() {// this happens on closing |
343 | Config cfg( "OpiePlayer" ); | 344 | Config cfg( "OpiePlayer" ); |
344 | mediaPlayerState.writeConfig( cfg ); | 345 | mediaPlayerState.writeConfig( cfg ); |
345 | playList.writeDefaultPlaylist( ); | 346 | playList.writeDefaultPlaylist( ); |
346 | 347 | ||
347 | // QPEApplication::grabKeyboard(); | 348 | // QPEApplication::grabKeyboard(); |
348 | // QPEApplication::ungrabKeyboard(); | 349 | // QPEApplication::ungrabKeyboard(); |
349 | } | 350 | } |
350 | 351 | ||
351 | void MediaPlayer::recreateAudioAndVideoWidgets() const | 352 | void MediaPlayer::recreateAudioAndVideoWidgets() const |
352 | { | 353 | { |
353 | delete m_skinLoader; | 354 | delete m_skinLoader; |
354 | 355 | ||
355 | delete m_xineControl; | 356 | delete m_xineControl; |
356 | delete m_audioUI; | 357 | delete m_audioUI; |
357 | delete m_videoUI; | 358 | delete m_videoUI; |
358 | m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); | 359 | m_audioUI = new AudioWidget( playList, mediaPlayerState, 0, "audioUI" ); |
359 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); | 360 | m_videoUI = new VideoWidget( playList, mediaPlayerState, 0, "videoUI" ); |
360 | 361 | ||
361 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 362 | connect( m_audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
362 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 363 | connect( m_audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
363 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 364 | connect( m_audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
364 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 365 | connect( m_audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
365 | 366 | ||
366 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 367 | connect( m_videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
367 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 368 | connect( m_videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
368 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 369 | connect( m_videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
369 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 370 | connect( m_videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
370 | 371 | ||
371 | if ( !xine ) | 372 | if ( !xine ) |
372 | xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); | 373 | xine = new XINE::Lib( XINE::Lib::InitializeImmediately ); |
373 | 374 | ||
374 | m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); | 375 | m_xineControl = new XineControl( xine, m_videoUI->vidWidget(), mediaPlayerState ); |
375 | 376 | ||
376 | xine = 0; | 377 | xine = 0; |
377 | } | 378 | } |
378 | 379 | ||
379 | AudioWidget *MediaPlayer::audioUI() const | 380 | AudioWidget *MediaPlayer::audioUI() const |
380 | { | 381 | { |
381 | if ( !m_audioUI ) | 382 | if ( !m_audioUI ) |
382 | recreateAudioAndVideoWidgets(); | 383 | recreateAudioAndVideoWidgets(); |
383 | return m_audioUI; | 384 | return m_audioUI; |
384 | } | 385 | } |
385 | 386 | ||
386 | VideoWidget *MediaPlayer::videoUI() const | 387 | VideoWidget *MediaPlayer::videoUI() const |
387 | { | 388 | { |
388 | if ( !m_videoUI ) | 389 | if ( !m_videoUI ) |
389 | recreateAudioAndVideoWidgets(); | 390 | recreateAudioAndVideoWidgets(); |
390 | return m_videoUI; | 391 | return m_videoUI; |
391 | } | 392 | } |
392 | 393 | ||
393 | XineControl *MediaPlayer::xineControl() const | 394 | XineControl *MediaPlayer::xineControl() const |
394 | { | 395 | { |
395 | if ( !m_xineControl ) | 396 | if ( !m_xineControl ) |
396 | recreateAudioAndVideoWidgets(); | 397 | recreateAudioAndVideoWidgets(); |
397 | return m_xineControl; | 398 | return m_xineControl; |
398 | } | 399 | } |
399 | 400 | ||
400 | void MediaPlayer::reloadSkins() | 401 | void MediaPlayer::reloadSkins() |
401 | { | 402 | { |
402 | audioUI()->loadSkin(); | 403 | audioUI()->loadSkin(); |
403 | videoUI()->loadSkin(); | 404 | videoUI()->loadSkin(); |
404 | } | 405 | } |
405 | 406 | ||