author | harlekin <harlekin> | 2002-08-15 21:32:31 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-15 21:32:31 (UTC) |
commit | a7f51d623fd3419cb70c8911e54405c978836330 (patch) (unidiff) | |
tree | c46b5baacd9140f6c8b3d630c189659895482cf3 | |
parent | 7056522970390e51207e0d59296365ec893af026 (diff) | |
download | opie-a7f51d623fd3419cb70c8911e54405c978836330.zip opie-a7f51d623fd3419cb70c8911e54405c978836330.tar.gz opie-a7f51d623fd3419cb70c8911e54405c978836330.tar.bz2 |
got rid of some compiler warnings
-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 | |||
@@ -1,283 +1,283 @@ | |||
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 | 5 | ||
6 | #include <qmainwindow.h> | 6 | #include <qmainwindow.h> |
7 | #include <qmessagebox.h> | 7 | #include <qmessagebox.h> |
8 | #include <qwidgetstack.h> | 8 | #include <qwidgetstack.h> |
9 | #include <qfile.h> | 9 | #include <qfile.h> |
10 | 10 | ||
11 | #include "mediaplayer.h" | 11 | #include "mediaplayer.h" |
12 | #include "playlistwidget.h" | 12 | #include "playlistwidget.h" |
13 | #include "audiowidget.h" | 13 | #include "audiowidget.h" |
14 | #include "videowidget.h" | 14 | #include "videowidget.h" |
15 | #include "volumecontrol.h" | 15 | #include "volumecontrol.h" |
16 | 16 | ||
17 | #include "mediaplayerstate.h" | 17 | #include "mediaplayerstate.h" |
18 | 18 | ||
19 | 19 | ||
20 | 20 | ||
21 | extern AudioWidget *audioUI; | 21 | extern AudioWidget *audioUI; |
22 | extern VideoWidget *videoUI; | 22 | extern VideoWidget *videoUI; |
23 | extern PlayListWidget *playList; | 23 | extern PlayListWidget *playList; |
24 | extern MediaPlayerState *mediaPlayerState; | 24 | extern MediaPlayerState *mediaPlayerState; |
25 | 25 | ||
26 | 26 | ||
27 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 27 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
28 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 28 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
29 | 29 | ||
30 | 30 | ||
31 | xineControl = new XineControl(); | 31 | xineControl = new XineControl(); |
32 | // QPEApplication::grabKeyboard(); // EVIL | 32 | // QPEApplication::grabKeyboard(); // EVIL |
33 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 33 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
34 | 34 | ||
35 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 35 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
36 | 36 | ||
37 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 37 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
38 | 38 | ||
39 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 39 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
40 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 40 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
41 | 41 | ||
42 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 42 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
43 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 43 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
44 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 44 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
45 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 45 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
46 | 46 | ||
47 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 47 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
48 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 48 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
49 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 49 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
50 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 50 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
51 | 51 | ||
52 | volControl = new VolumeControl; | 52 | volControl = new VolumeControl; |
53 | 53 | ||
54 | } | 54 | } |
55 | 55 | ||
56 | MediaPlayer::~MediaPlayer() { | 56 | MediaPlayer::~MediaPlayer() { |
57 | delete xineControl; | 57 | delete xineControl; |
58 | delete volControl; | 58 | delete volControl; |
59 | } | 59 | } |
60 | 60 | ||
61 | void MediaPlayer::pauseCheck( bool b ) { | 61 | void MediaPlayer::pauseCheck( bool b ) { |
62 | if ( b && !mediaPlayerState->playing() ) { | 62 | if ( b && !mediaPlayerState->playing() ) { |
63 | mediaPlayerState->setPaused( FALSE ); | 63 | mediaPlayerState->setPaused( FALSE ); |
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | void MediaPlayer::play() { | 67 | void MediaPlayer::play() { |
68 | mediaPlayerState->setPlaying( FALSE ); | 68 | mediaPlayerState->setPlaying( FALSE ); |
69 | mediaPlayerState->setPlaying( TRUE ); | 69 | mediaPlayerState->setPlaying( TRUE ); |
70 | } | 70 | } |
71 | 71 | ||
72 | void MediaPlayer::setPlaying( bool play ) { | 72 | void MediaPlayer::setPlaying( bool play ) { |
73 | if ( !play ) { | 73 | if ( !play ) { |
74 | // mediaPlayerState->setPaused( FALSE ); | 74 | // mediaPlayerState->setPaused( FALSE ); |
75 | return; | 75 | return; |
76 | } | 76 | } |
77 | 77 | ||
78 | if ( mediaPlayerState->paused() ) { | 78 | if ( mediaPlayerState->paused() ) { |
79 | mediaPlayerState->setPaused( FALSE ); | 79 | mediaPlayerState->setPaused( FALSE ); |
80 | return; | 80 | return; |
81 | } | 81 | } |
82 | 82 | ||
83 | const DocLnk *playListCurrent = playList->current(); | 83 | const DocLnk *playListCurrent = playList->current(); |
84 | if ( playListCurrent != NULL ) { | 84 | if ( playListCurrent != NULL ) { |
85 | currentFile = playListCurrent; | 85 | currentFile = playListCurrent; |
86 | } | 86 | } |
87 | 87 | ||
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(); |
281 | // QPEApplication::ungrabKeyboard(); | 281 | // QPEApplication::ungrabKeyboard(); |
282 | 282 | ||
283 | } | 283 | } |