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