-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 606f8e9..f0a01a1 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,346 +1,364 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/qcopenvelope_qws.h> | 5 | #include <qpe/qcopenvelope_qws.h> |
6 | #include <qfileinfo.h> | 6 | #include <qfileinfo.h> |
7 | 7 | ||
8 | #include <qmainwindow.h> | 8 | #include <qmainwindow.h> |
9 | #include <qmessagebox.h> | 9 | #include <qmessagebox.h> |
10 | #include <qwidgetstack.h> | 10 | #include <qwidgetstack.h> |
11 | #include <qfile.h> | 11 | #include <qfile.h> |
12 | 12 | ||
13 | #include "mediaplayer.h" | 13 | #include "mediaplayer.h" |
14 | #include "playlistwidget.h" | 14 | #include "playlistwidget.h" |
15 | #include "audiowidget.h" | 15 | #include "audiowidget.h" |
16 | #include "videowidget.h" | 16 | #include "videowidget.h" |
17 | #include "volumecontrol.h" | 17 | #include "volumecontrol.h" |
18 | 18 | ||
19 | #include "mediaplayerstate.h" | 19 | #include "mediaplayerstate.h" |
20 | 20 | ||
21 | // for setBacklight() | 21 | // for setBacklight() |
22 | #include <linux/fb.h> | 22 | #include <linux/fb.h> |
23 | #include <sys/file.h> | 23 | #include <sys/file.h> |
24 | #include <sys/ioctl.h> | 24 | #include <sys/ioctl.h> |
25 | 25 | ||
26 | 26 | ||
27 | extern AudioWidget *audioUI; | 27 | extern AudioWidget *audioUI; |
28 | extern VideoWidget *videoUI; | 28 | extern VideoWidget *videoUI; |
29 | extern PlayListWidget *playList; | 29 | extern PlayListWidget *playList; |
30 | extern MediaPlayerState *mediaPlayerState; | 30 | extern MediaPlayerState *mediaPlayerState; |
31 | 31 | ||
32 | 32 | ||
33 | #define FBIOBLANK 0x4611 | 33 | #define FBIOBLANK 0x4611 |
34 | 34 | ||
35 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 35 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
36 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 36 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
37 | 37 | ||
38 | fd=-1;fl=-1; | ||
38 | playList->setCaption( tr( "OpiePlayer: Initializating" ) ); | 39 | playList->setCaption( tr( "OpiePlayer: Initializating" ) ); |
39 | 40 | ||
40 | qApp->processEvents(); | 41 | qApp->processEvents(); |
41 | // QPEApplication::grabKeyboard(); // EVIL | 42 | // QPEApplication::grabKeyboard(); // EVIL |
42 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 43 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
43 | 44 | ||
44 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 45 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
45 | 46 | ||
46 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 47 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
47 | 48 | ||
48 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 49 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
49 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 50 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
50 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); |
51 | 52 | ||
52 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 53 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
53 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 54 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
54 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 55 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
55 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 56 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
56 | 57 | ||
57 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 58 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
58 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 59 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
59 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 60 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
60 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 61 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
61 | 62 | ||
62 | volControl = new VolumeControl; | 63 | volControl = new VolumeControl; |
63 | xineControl = new XineControl(); | 64 | xineControl = new XineControl(); |
64 | playList->setCaption(tr("OpiePlayer")); | 65 | playList->setCaption(tr("OpiePlayer")); |
65 | } | 66 | } |
66 | 67 | ||
67 | MediaPlayer::~MediaPlayer() { | 68 | MediaPlayer::~MediaPlayer() { |
68 | delete xineControl; | 69 | delete xineControl; |
69 | delete volControl; | 70 | delete volControl; |
70 | } | 71 | } |
71 | 72 | ||
72 | void MediaPlayer::pauseCheck( bool b ) { | 73 | void MediaPlayer::pauseCheck( bool b ) { |
73 | if ( b && !mediaPlayerState->playing() ) { | 74 | if ( b && !mediaPlayerState->playing() ) { |
74 | mediaPlayerState->setPaused( FALSE ); | 75 | mediaPlayerState->setPaused( FALSE ); |
75 | } | 76 | } |
76 | } | 77 | } |
77 | 78 | ||
78 | void MediaPlayer::play() { | 79 | void MediaPlayer::play() { |
79 | mediaPlayerState->setPlaying( FALSE ); | 80 | mediaPlayerState->setPlaying( FALSE ); |
80 | mediaPlayerState->setPlaying( TRUE ); | 81 | mediaPlayerState->setPlaying( TRUE ); |
81 | } | 82 | } |
82 | 83 | ||
83 | void MediaPlayer::setPlaying( bool play ) { | 84 | void MediaPlayer::setPlaying( bool play ) { |
84 | if ( !play ) { | 85 | if ( !play ) { |
85 | return; | 86 | return; |
86 | } | 87 | } |
87 | 88 | ||
88 | if ( mediaPlayerState->paused() ) { | 89 | if ( mediaPlayerState->paused() ) { |
89 | mediaPlayerState->setPaused( FALSE ); | 90 | mediaPlayerState->setPaused( FALSE ); |
90 | return; | 91 | return; |
91 | } | 92 | } |
92 | 93 | ||
93 | QString tickerText, time, fileName; | 94 | QString tickerText, time, fileName; |
94 | if( playList->whichList() == 0 ) { //check for filelist | 95 | if( playList->whichList() == 0 ) { //check for filelist |
95 | const DocLnk *playListCurrent = playList->current(); | 96 | const DocLnk *playListCurrent = playList->current(); |
96 | if ( playListCurrent != NULL ) { | 97 | if ( playListCurrent != NULL ) { |
97 | currentFile = playListCurrent; | 98 | currentFile = playListCurrent; |
98 | } | 99 | } |
99 | xineControl->play( currentFile->file() ); | 100 | xineControl->play( currentFile->file() ); |
100 | fileName = currentFile->name(); | 101 | fileName = currentFile->name(); |
101 | long seconds = mediaPlayerState->length();// | 102 | long seconds = mediaPlayerState->length();// |
102 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 103 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
103 | //qDebug(time); | 104 | //qDebug(time); |
104 | 105 | ||
105 | } else { | 106 | } else { |
106 | //if playing in file list.. play in a different way | 107 | //if playing in file list.. play in a different way |
107 | // random and looping settings enabled causes problems here, | 108 | // random and looping settings enabled causes problems here, |
108 | // since there is no selected file in the playlist, but a selected file in the file list, | 109 | // since there is no selected file in the playlist, but a selected file in the file list, |
109 | // so we remember and shutoff | 110 | // so we remember and shutoff |
110 | l = mediaPlayerState->looping(); | 111 | l = mediaPlayerState->looping(); |
111 | if(l) { | 112 | if(l) { |
112 | mediaPlayerState->setLooping( false ); | 113 | mediaPlayerState->setLooping( false ); |
113 | } | 114 | } |
114 | r = mediaPlayerState->shuffled(); | 115 | r = mediaPlayerState->shuffled(); |
115 | mediaPlayerState->setShuffled( false ); | 116 | mediaPlayerState->setShuffled( false ); |
116 | 117 | ||
117 | fileName = playList->currentFileListPathName(); | 118 | fileName = playList->currentFileListPathName(); |
118 | xineControl->play( fileName ); | 119 | xineControl->play( fileName ); |
119 | long seconds = mediaPlayerState->length(); | 120 | long seconds = mediaPlayerState->length(); |
120 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 121 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
121 | //qDebug(time); | 122 | //qDebug(time); |
122 | if( fileName.left(4) != "http" ) { | 123 | if( fileName.left(4) != "http" ) { |
123 | fileName = QFileInfo( fileName ).baseName(); | 124 | fileName = QFileInfo( fileName ).baseName(); |
124 | } | 125 | } |
125 | 126 | ||
126 | } | 127 | } |
127 | 128 | ||
128 | if( fileName.left(4) == "http" ) { | 129 | if( fileName.left(4) == "http" ) { |
129 | if ( xineControl->getMetaInfo().isEmpty() ) { | 130 | if ( xineControl->getMetaInfo().isEmpty() ) { |
130 | tickerText = tr( " File: " ) + fileName; | 131 | tickerText = tr( " File: " ) + fileName; |
131 | } else { | 132 | } else { |
132 | tickerText = xineControl->getMetaInfo(); | 133 | tickerText = xineControl->getMetaInfo(); |
133 | } | 134 | } |
134 | } else { | 135 | } else { |
135 | if ( xineControl->getMetaInfo().isEmpty() ) { | 136 | if ( xineControl->getMetaInfo().isEmpty() ) { |
136 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; | 137 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; |
137 | } else { | 138 | } else { |
138 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; | 139 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; |
139 | } | 140 | } |
140 | } | 141 | } |
141 | audioUI->setTickerText( tickerText ); | 142 | audioUI->setTickerText( tickerText ); |
142 | } | 143 | } |
143 | 144 | ||
144 | 145 | ||
145 | void MediaPlayer::prev() { | 146 | void MediaPlayer::prev() { |
146 | if( playList->whichList() == 0 ) { //if using the playlist | 147 | if( playList->whichList() == 0 ) { //if using the playlist |
147 | if ( playList->prev() ) { | 148 | if ( playList->prev() ) { |
148 | play(); | 149 | play(); |
149 | } else if ( mediaPlayerState->looping() ) { | 150 | } else if ( mediaPlayerState->looping() ) { |
150 | if ( playList->last() ) { | 151 | if ( playList->last() ) { |
151 | play(); | 152 | play(); |
152 | } | 153 | } |
153 | } else { | 154 | } else { |
154 | mediaPlayerState->setList(); | 155 | mediaPlayerState->setList(); |
155 | } | 156 | } |
156 | } | 157 | } |
157 | } | 158 | } |
158 | 159 | ||
159 | 160 | ||
160 | void MediaPlayer::next() { | 161 | void MediaPlayer::next() { |
161 | 162 | ||
162 | if(playList->whichList() == 0) { //if using the playlist | 163 | if(playList->whichList() == 0) { //if using the playlist |
163 | if ( playList->next() ) { | 164 | if ( playList->next() ) { |
164 | play(); | 165 | play(); |
165 | } else if ( mediaPlayerState->looping() ) { | 166 | } else if ( mediaPlayerState->looping() ) { |
166 | if ( playList->first() ) { | 167 | if ( playList->first() ) { |
167 | play(); | 168 | play(); |
168 | } | 169 | } |
169 | } else { | 170 | } else { |
170 | mediaPlayerState->setList(); | 171 | mediaPlayerState->setList(); |
171 | } | 172 | } |
172 | } else { //if playing from file list, let's just stop | 173 | } else { //if playing from file list, let's just stop |
173 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); | 174 | qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); |
174 | mediaPlayerState->setPlaying(false); | 175 | mediaPlayerState->setPlaying(false); |
175 | mediaPlayerState->setView('l'); | 176 | mediaPlayerState->setView('l'); |
176 | if(l) mediaPlayerState->setLooping(l); | 177 | if(l) mediaPlayerState->setLooping(l); |
177 | if(r) mediaPlayerState->setShuffled(r); | 178 | if(r) mediaPlayerState->setShuffled(r); |
178 | } | 179 | } |
179 | qApp->processEvents(); | 180 | qApp->processEvents(); |
180 | } | 181 | } |
181 | 182 | ||
182 | 183 | ||
183 | void MediaPlayer::startDecreasingVolume() { | 184 | void MediaPlayer::startDecreasingVolume() { |
184 | volumeDirection = -1; | 185 | volumeDirection = -1; |
185 | startTimer( 100 ); | 186 | startTimer( 100 ); |
186 | volControl->decVol(2); | 187 | volControl->decVol(2); |
187 | } | 188 | } |
188 | 189 | ||
189 | 190 | ||
190 | void MediaPlayer::startIncreasingVolume() { | 191 | void MediaPlayer::startIncreasingVolume() { |
191 | volumeDirection = +1; | 192 | volumeDirection = +1; |
192 | startTimer( 100 ); | 193 | startTimer( 100 ); |
193 | volControl->incVol(2); | 194 | volControl->incVol(2); |
194 | } | 195 | } |
195 | 196 | ||
196 | 197 | ||
197 | bool drawnOnScreenDisplay = FALSE; | 198 | bool drawnOnScreenDisplay = FALSE; |
198 | unsigned int onScreenDisplayVolume = 0; | 199 | unsigned int onScreenDisplayVolume = 0; |
199 | const int yoff = 110; | 200 | const int yoff = 110; |
200 | 201 | ||
201 | void MediaPlayer::stopChangingVolume() { | 202 | void MediaPlayer::stopChangingVolume() { |
202 | killTimers(); | 203 | killTimers(); |
203 | // Get rid of the on-screen display stuff | 204 | // Get rid of the on-screen display stuff |
204 | drawnOnScreenDisplay = FALSE; | 205 | drawnOnScreenDisplay = FALSE; |
205 | onScreenDisplayVolume = 0; | 206 | onScreenDisplayVolume = 0; |
206 | int w=0; | 207 | int w=0; |
207 | int h=0; | 208 | int h=0; |
208 | if( !xineControl->hasVideo() ) { | 209 | if( !xineControl->hasVideo() ) { |
209 | w = audioUI->width(); | 210 | w = audioUI->width(); |
210 | h = audioUI->height(); | 211 | h = audioUI->height(); |
211 | audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 212 | audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
212 | } else { | 213 | } else { |
213 | w = videoUI->width(); | 214 | w = videoUI->width(); |
214 | h = videoUI->height(); | 215 | h = videoUI->height(); |
215 | videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 216 | videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
216 | } | 217 | } |
217 | } | 218 | } |
218 | 219 | ||
219 | 220 | ||
220 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 221 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
221 | if ( volumeDirection == +1 ) { | 222 | if ( volumeDirection == +1 ) { |
222 | volControl->incVol( 2 ); | 223 | volControl->incVol( 2 ); |
223 | } else if ( volumeDirection == -1 ) { | 224 | } else if ( volumeDirection == -1 ) { |
224 | volControl->decVol( 2 ); | 225 | volControl->decVol( 2 ); |
225 | } | 226 | } |
226 | 227 | ||
227 | 228 | ||
228 | // TODO FIXME | 229 | // TODO FIXME |
229 | // huh?? | 230 | // huh?? |
230 | unsigned int v= 0; | 231 | unsigned int v= 0; |
231 | v = volControl->volume(); | 232 | v = volControl->volume(); |
232 | v = v / 10; | 233 | v = v / 10; |
233 | 234 | ||
234 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 235 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
235 | return; | 236 | return; |
236 | } | 237 | } |
237 | 238 | ||
238 | int w=0; int h=0; | 239 | int w=0; int h=0; |
239 | if( !xineControl->hasVideo() ) { | 240 | if( !xineControl->hasVideo() ) { |
240 | w = audioUI->width(); | 241 | w = audioUI->width(); |
241 | h = audioUI->height(); | 242 | h = audioUI->height(); |
242 | 243 | ||
243 | if ( drawnOnScreenDisplay ) { | 244 | if ( drawnOnScreenDisplay ) { |
244 | if ( onScreenDisplayVolume > v ) { | 245 | if ( onScreenDisplayVolume > v ) { |
245 | audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 246 | audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
246 | } | 247 | } |
247 | } | 248 | } |
248 | drawnOnScreenDisplay = TRUE; | 249 | drawnOnScreenDisplay = TRUE; |
249 | onScreenDisplayVolume = v; | 250 | onScreenDisplayVolume = v; |
250 | QPainter p( audioUI ); | 251 | QPainter p( audioUI ); |
251 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 252 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
252 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 253 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
253 | 254 | ||
254 | QFont f; | 255 | QFont f; |
255 | f.setPixelSize( 20 ); | 256 | f.setPixelSize( 20 ); |
256 | f.setBold( TRUE ); | 257 | f.setBold( TRUE ); |
257 | p.setFont( f ); | 258 | p.setFont( f ); |
258 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 259 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
259 | 260 | ||
260 | for ( unsigned int i = 0; i < 10; i++ ) { | 261 | for ( unsigned int i = 0; i < 10; i++ ) { |
261 | if ( v > i ) { | 262 | if ( v > i ) { |
262 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 263 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
263 | } else { | 264 | } else { |
264 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 265 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
265 | } | 266 | } |
266 | } | 267 | } |
267 | } else { | 268 | } else { |
268 | w = videoUI->width(); | 269 | w = videoUI->width(); |
269 | h = videoUI->height(); | 270 | h = videoUI->height(); |
270 | 271 | ||
271 | if ( drawnOnScreenDisplay ) { | 272 | if ( drawnOnScreenDisplay ) { |
272 | if ( onScreenDisplayVolume > v ) { | 273 | if ( onScreenDisplayVolume > v ) { |
273 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); | 274 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
274 | } | 275 | } |
275 | } | 276 | } |
276 | drawnOnScreenDisplay = TRUE; | 277 | drawnOnScreenDisplay = TRUE; |
277 | onScreenDisplayVolume = v; | 278 | onScreenDisplayVolume = v; |
278 | QPainter p( videoUI ); | 279 | QPainter p( videoUI ); |
279 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 280 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
280 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 281 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
281 | 282 | ||
282 | QFont f; | 283 | QFont f; |
283 | f.setPixelSize( 20 ); | 284 | f.setPixelSize( 20 ); |
284 | f.setBold( TRUE ); | 285 | f.setBold( TRUE ); |
285 | p.setFont( f ); | 286 | p.setFont( f ); |
286 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); | 287 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); |
287 | 288 | ||
288 | for ( unsigned int i = 0; i < 10; i++ ) { | 289 | for ( unsigned int i = 0; i < 10; i++ ) { |
289 | if ( v > i ) { | 290 | if ( v > i ) { |
290 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 291 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
291 | } else { | 292 | } else { |
292 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 293 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
293 | } | 294 | } |
294 | } | 295 | } |
295 | } | 296 | } |
296 | } | 297 | } |
297 | 298 | ||
298 | 299 | ||
299 | void MediaPlayer::blank( bool b ) { | 300 | void MediaPlayer::blank( bool b ) { |
300 | fd=open("/dev/fb0",O_RDWR); | 301 | fd=open("/dev/fb0",O_RDWR); |
302 | #ifdef QT_QWS_EBX | ||
303 | fl= open( "/dev/fl", O_RDWR ); | ||
304 | #endif | ||
301 | if (fd != -1) { | 305 | if (fd != -1) { |
302 | if ( b ) { | 306 | if ( b ) { |
303 | qDebug("do blanking"); | 307 | qDebug("do blanking"); |
308 | #ifdef QT_QWS_EBX | ||
309 | ioctl( fd, FBIOBLANK, 1 ); | ||
310 | if(fl !=-1) { | ||
311 | ioctl( fl, 2 ); | ||
312 | ::close(fl); | ||
313 | } | ||
314 | #else | ||
304 | ioctl( fd, FBIOBLANK, 3 ); | 315 | ioctl( fd, FBIOBLANK, 3 ); |
316 | #endif | ||
305 | isBlanked = TRUE; | 317 | isBlanked = TRUE; |
306 | } else { | 318 | } else { |
307 | qDebug("do unblanking"); | 319 | qDebug("do unblanking"); |
308 | ioctl( fd, FBIOBLANK, 0); | 320 | ioctl( fd, FBIOBLANK, 0); |
321 | #ifdef QT_QWS_EBX | ||
322 | if(fl != -1) { | ||
323 | ioctl( fl, 1); | ||
324 | ::close(fl); | ||
325 | } | ||
326 | #endif | ||
309 | isBlanked = FALSE; | 327 | isBlanked = FALSE; |
310 | } | 328 | } |
311 | close( fd ); | 329 | close( fd ); |
312 | } else { | 330 | } else { |
313 | qDebug("<< /dev/fb0 could not be opened >>"); | 331 | qDebug("<< /dev/fb0 could not be opened >>"); |
314 | } | 332 | } |
315 | } | 333 | } |
316 | 334 | ||
317 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 335 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
318 | switch ( e->key() ) { | 336 | switch ( e->key() ) { |
319 | ////////////////////////////// Zaurus keys | 337 | ////////////////////////////// Zaurus keys |
320 | case Key_Home: | 338 | case Key_Home: |
321 | break; | 339 | break; |
322 | case Key_F9: //activity | 340 | case Key_F9: //activity |
323 | break; | 341 | break; |
324 | case Key_F10: //contacts | 342 | case Key_F10: //contacts |
325 | break; | 343 | break; |
326 | case Key_F11: //menu | 344 | case Key_F11: //menu |
327 | break; | 345 | break; |
328 | case Key_F12: //home | 346 | case Key_F12: //home |
329 | qDebug("Blank here"); | 347 | qDebug("Blank here"); |
330 | // mediaPlayerState->toggleBlank(); | 348 | // mediaPlayerState->toggleBlank(); |
331 | break; | 349 | break; |
332 | case Key_F13: //mail | 350 | case Key_F13: //mail |
333 | qDebug("Blank here"); | 351 | qDebug("Blank here"); |
334 | // mediaPlayerState->toggleBlank(); | 352 | // mediaPlayerState->toggleBlank(); |
335 | break; | 353 | break; |
336 | } | 354 | } |
337 | } | 355 | } |
338 | 356 | ||
339 | void MediaPlayer::cleanUp() {// this happens on closing | 357 | void MediaPlayer::cleanUp() {// this happens on closing |
340 | Config cfg( "OpiePlayer" ); | 358 | Config cfg( "OpiePlayer" ); |
341 | mediaPlayerState->writeConfig( cfg ); | 359 | mediaPlayerState->writeConfig( cfg ); |
342 | playList->writeDefaultPlaylist( ); | 360 | playList->writeDefaultPlaylist( ); |
343 | 361 | ||
344 | // QPEApplication::grabKeyboard(); | 362 | // QPEApplication::grabKeyboard(); |
345 | // QPEApplication::ungrabKeyboard(); | 363 | // QPEApplication::ungrabKeyboard(); |
346 | } | 364 | } |