-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 2 |
3 files changed, 3 insertions, 4 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 6a48b82..0526c2a 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -168,132 +168,134 @@ void MediaPlayer::stopChangingVolume() { | |||
168 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 168 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
169 | } else { | 169 | } else { |
170 | w = videoUI->width(); | 170 | w = videoUI->width(); |
171 | h = videoUI->height(); | 171 | h = videoUI->height(); |
172 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 172 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
176 | 176 | ||
177 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 177 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
178 | if ( volumeDirection == +1 ) { | 178 | if ( volumeDirection == +1 ) { |
179 | volControl->incVol(2); | 179 | volControl->incVol(2); |
180 | } else if ( volumeDirection == -1 ) { | 180 | } else if ( volumeDirection == -1 ) { |
181 | volControl->decVol(2); | 181 | volControl->decVol(2); |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | // TODO FIXME | 185 | // TODO FIXME |
186 | unsigned int v= 0; | 186 | unsigned int v= 0; |
187 | v = volControl->volume(); | 187 | v = volControl->volume(); |
188 | v = v / 10; | 188 | v = v / 10; |
189 | 189 | ||
190 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 190 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
191 | return; | 191 | return; |
192 | } | 192 | } |
193 | 193 | ||
194 | int w=0; int h=0; | 194 | int w=0; int h=0; |
195 | if( !xineControl->hasVideo()) { | 195 | if( !xineControl->hasVideo()) { |
196 | w = audioUI->width(); | 196 | w = audioUI->width(); |
197 | h = audioUI->height(); | 197 | h = audioUI->height(); |
198 | 198 | ||
199 | if ( drawnOnScreenDisplay ) { | 199 | if ( drawnOnScreenDisplay ) { |
200 | if ( onScreenDisplayVolume > v ) { | 200 | if ( onScreenDisplayVolume > v ) { |
201 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 201 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
202 | } | 202 | } |
203 | } | 203 | } |
204 | drawnOnScreenDisplay = TRUE; | 204 | drawnOnScreenDisplay = TRUE; |
205 | onScreenDisplayVolume = v; | 205 | onScreenDisplayVolume = v; |
206 | QPainter p( audioUI ); | 206 | QPainter p( audioUI ); |
207 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 207 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
208 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 208 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
209 | 209 | ||
210 | QFont f; | 210 | QFont f; |
211 | f.setPixelSize( 20 ); | 211 | f.setPixelSize( 20 ); |
212 | f.setBold( TRUE ); | 212 | f.setBold( TRUE ); |
213 | p.setFont( f ); | 213 | p.setFont( f ); |
214 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 214 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
215 | 215 | ||
216 | for ( unsigned int i = 0; i < 10; i++ ) { | 216 | for ( unsigned int i = 0; i < 10; i++ ) { |
217 | if ( v > i ) { | 217 | if ( v > i ) { |
218 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 218 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
219 | } else { | 219 | } else { |
220 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 220 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
221 | } | 221 | } |
222 | } | 222 | } |
223 | } else { | 223 | } else { |
224 | w = videoUI->width(); | 224 | w = videoUI->width(); |
225 | h = videoUI->height(); | 225 | h = videoUI->height(); |
226 | 226 | ||
227 | if ( drawnOnScreenDisplay ) { | 227 | if ( drawnOnScreenDisplay ) { |
228 | if ( onScreenDisplayVolume > v ) { | 228 | if ( onScreenDisplayVolume > v ) { |
229 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 229 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | drawnOnScreenDisplay = TRUE; | 232 | drawnOnScreenDisplay = TRUE; |
233 | onScreenDisplayVolume = v; | 233 | onScreenDisplayVolume = v; |
234 | QPainter p( videoUI ); | 234 | QPainter p( videoUI ); |
235 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 235 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
236 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 236 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
237 | 237 | ||
238 | QFont f; | 238 | QFont f; |
239 | f.setPixelSize( 20 ); | 239 | f.setPixelSize( 20 ); |
240 | f.setBold( TRUE ); | 240 | f.setBold( TRUE ); |
241 | p.setFont( f ); | 241 | p.setFont( f ); |
242 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 242 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
243 | 243 | ||
244 | for ( unsigned int i = 0; i < 10; i++ ) { | 244 | for ( unsigned int i = 0; i < 10; i++ ) { |
245 | if ( v > i ) { | 245 | if ( v > i ) { |
246 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 246 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
247 | } else { | 247 | } else { |
248 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 248 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | 254 | ||
255 | void MediaPlayer::blank( bool b ) { | 255 | void MediaPlayer::blank( bool b ) { |
256 | fd=open("/dev/fb0",O_RDWR); | 256 | fd=open("/dev/fb0",O_RDWR); |
257 | if (fd != -1) { | 257 | if (fd != -1) { |
258 | if ( b ) { | 258 | if ( b ) { |
259 | qDebug("do blanking"); | 259 | qDebug("do blanking"); |
260 | ioctl( fd, FBIOBLANK, 3 ); | 260 | ioctl( fd, FBIOBLANK, 3 ); |
261 | isBlanked = TRUE; | 261 | isBlanked = TRUE; |
262 | } else { | 262 | } else { |
263 | qDebug("do unblanking"); | 263 | qDebug("do unblanking"); |
264 | ioctl( fd, FBIOBLANK, 0); | 264 | ioctl( fd, FBIOBLANK, 0); |
265 | isBlanked = FALSE; | 265 | isBlanked = FALSE; |
266 | } | 266 | } |
267 | close( fd ); | 267 | close( fd ); |
268 | } else { | 268 | } else { |
269 | qDebug("<< /dev/fb0 could not be opened >>"); | 269 | qDebug("<< /dev/fb0 could not be opened >>"); |
270 | } | 270 | } |
271 | } | 271 | } |
272 | 272 | ||
273 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 273 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
274 | switch ( e->key() ) { | 274 | switch ( e->key() ) { |
275 | ////////////////////////////// Zaurus keys | 275 | ////////////////////////////// Zaurus keys |
276 | case Key_Home: | 276 | case Key_Home: |
277 | break; | 277 | break; |
278 | case Key_F9: //activity | 278 | case Key_F9: //activity |
279 | break; | 279 | break; |
280 | case Key_F10: //contacts | 280 | case Key_F10: //contacts |
281 | break; | 281 | break; |
282 | case Key_F11: //menu | 282 | case Key_F11: //menu |
283 | break; | 283 | break; |
284 | case Key_F12: //home | 284 | case Key_F12: //home |
285 | qDebug("Blank here"); | 285 | qDebug("Blank here"); |
286 | // mediaPlayerState->toggleBlank(); | 286 | // mediaPlayerState->toggleBlank(); |
287 | break; | 287 | break; |
288 | case Key_F13: //mail | 288 | case Key_F13: //mail |
289 | qDebug("Blank here"); | 289 | qDebug("Blank here"); |
290 | // mediaPlayerState->toggleBlank(); | 290 | // mediaPlayerState->toggleBlank(); |
291 | break; | 291 | break; |
292 | } | 292 | } |
293 | } | 293 | } |
294 | 294 | ||
295 | void MediaPlayer::cleanUp() {// this happens on closing | 295 | void MediaPlayer::cleanUp() {// this happens on closing |
296 | Config cfg( "OpiePlayer" ); | ||
297 | playList->writeConfig( cfg ); | ||
296 | 298 | ||
297 | // QPEApplication::grabKeyboard(); | 299 | // QPEApplication::grabKeyboard(); |
298 | // QPEApplication::ungrabKeyboard(); | 300 | // QPEApplication::ungrabKeyboard(); |
299 | } | 301 | } |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 404e1fe..bc9b166 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -182,259 +182,256 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
182 | QGridLayout *Playout = new QGridLayout( pTab ); | 182 | QGridLayout *Playout = new QGridLayout( pTab ); |
183 | Playout->setSpacing( 2); | 183 | Playout->setSpacing( 2); |
184 | Playout->setMargin( 2); | 184 | Playout->setMargin( 2); |
185 | 185 | ||
186 | // Add the playlist area | 186 | // Add the playlist area |
187 | 187 | ||
188 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 188 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
189 | d->playListFrame = vbox3; | 189 | d->playListFrame = vbox3; |
190 | 190 | ||
191 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 191 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
192 | 192 | ||
193 | d->selectedFiles = new PlayListSelection( hbox2); | 193 | d->selectedFiles = new PlayListSelection( hbox2); |
194 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 194 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
195 | 195 | ||
196 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 196 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
197 | 197 | ||
198 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 198 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
199 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 199 | (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
200 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected()) ); | 200 | (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", d->selectedFiles, SLOT(removeSelected()) ); |
201 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 201 | (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
202 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 202 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
203 | 203 | ||
204 | 204 | ||
205 | Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); | 205 | Playout->addMultiCellWidget( vbox3, 0, 0, 0, 1 ); |
206 | 206 | ||
207 | QWidget *aTab; | 207 | QWidget *aTab; |
208 | aTab = new QWidget( tabWidget, "aTab" ); | 208 | aTab = new QWidget( tabWidget, "aTab" ); |
209 | 209 | ||
210 | QGridLayout *Alayout = new QGridLayout( aTab ); | 210 | QGridLayout *Alayout = new QGridLayout( aTab ); |
211 | Alayout->setSpacing( 2); | 211 | Alayout->setSpacing( 2); |
212 | Alayout->setMargin( 2); | 212 | Alayout->setMargin( 2); |
213 | 213 | ||
214 | audioView = new QListView( aTab, "Audioview" ); | 214 | audioView = new QListView( aTab, "Audioview" ); |
215 | audioView->addColumn( tr("Title"),140); | 215 | audioView->addColumn( tr("Title"),140); |
216 | audioView->addColumn(tr("Size"), -1); | 216 | audioView->addColumn(tr("Size"), -1); |
217 | audioView->addColumn(tr("Media"),-1); | 217 | audioView->addColumn(tr("Media"),-1); |
218 | audioView->setColumnAlignment(1, Qt::AlignRight); | 218 | audioView->setColumnAlignment(1, Qt::AlignRight); |
219 | audioView->setColumnAlignment(2, Qt::AlignRight); | 219 | audioView->setColumnAlignment(2, Qt::AlignRight); |
220 | audioView->setAllColumnsShowFocus(TRUE); | 220 | audioView->setAllColumnsShowFocus(TRUE); |
221 | audioView->setSorting(0,TRUE); | 221 | audioView->setSorting(0,TRUE); |
222 | 222 | ||
223 | audioView->setMultiSelection( TRUE ); | 223 | audioView->setMultiSelection( TRUE ); |
224 | audioView->setSelectionMode( QListView::Extended); | 224 | audioView->setSelectionMode( QListView::Extended); |
225 | 225 | ||
226 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 226 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
227 | 227 | ||
228 | tabWidget->insertTab(aTab,tr("Audio")); | 228 | tabWidget->insertTab(aTab,tr("Audio")); |
229 | 229 | ||
230 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 230 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
231 | 231 | ||
232 | QWidget *vTab; | 232 | QWidget *vTab; |
233 | vTab = new QWidget( tabWidget, "vTab" ); | 233 | vTab = new QWidget( tabWidget, "vTab" ); |
234 | 234 | ||
235 | QGridLayout *Vlayout = new QGridLayout( vTab ); | 235 | QGridLayout *Vlayout = new QGridLayout( vTab ); |
236 | Vlayout->setSpacing( 2); | 236 | Vlayout->setSpacing( 2); |
237 | Vlayout->setMargin( 2); | 237 | Vlayout->setMargin( 2); |
238 | 238 | ||
239 | videoView = new QListView( vTab, "Videoview" ); | 239 | videoView = new QListView( vTab, "Videoview" ); |
240 | 240 | ||
241 | videoView->addColumn(tr("Title"),140); | 241 | videoView->addColumn(tr("Title"),140); |
242 | videoView->addColumn(tr("Size"),-1); | 242 | videoView->addColumn(tr("Size"),-1); |
243 | videoView->addColumn(tr("Media"),-1); | 243 | videoView->addColumn(tr("Media"),-1); |
244 | videoView->setColumnAlignment(1, Qt::AlignRight); | 244 | videoView->setColumnAlignment(1, Qt::AlignRight); |
245 | videoView->setColumnAlignment(2, Qt::AlignRight); | 245 | videoView->setColumnAlignment(2, Qt::AlignRight); |
246 | videoView->setAllColumnsShowFocus(TRUE); | 246 | videoView->setAllColumnsShowFocus(TRUE); |
247 | videoView->setSorting(0,TRUE); | 247 | videoView->setSorting(0,TRUE); |
248 | 248 | ||
249 | videoView->setMultiSelection( TRUE ); | 249 | videoView->setMultiSelection( TRUE ); |
250 | videoView->setSelectionMode( QListView::Extended); | 250 | videoView->setSelectionMode( QListView::Extended); |
251 | 251 | ||
252 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 252 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
253 | 253 | ||
254 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); | 254 | QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); |
255 | 255 | ||
256 | tabWidget->insertTab( vTab,tr("Video")); | 256 | tabWidget->insertTab( vTab,tr("Video")); |
257 | 257 | ||
258 | //playlists list | 258 | //playlists list |
259 | QWidget *LTab; | 259 | QWidget *LTab; |
260 | LTab = new QWidget( tabWidget, "LTab" ); | 260 | LTab = new QWidget( tabWidget, "LTab" ); |
261 | QGridLayout *Llayout = new QGridLayout( LTab ); | 261 | QGridLayout *Llayout = new QGridLayout( LTab ); |
262 | Llayout->setSpacing( 2); | 262 | Llayout->setSpacing( 2); |
263 | Llayout->setMargin( 2); | 263 | Llayout->setMargin( 2); |
264 | 264 | ||
265 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy | 265 | playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy |
266 | Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); | 266 | Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); |
267 | 267 | ||
268 | tabWidget->insertTab(LTab,tr("Lists")); | 268 | tabWidget->insertTab(LTab,tr("Lists")); |
269 | 269 | ||
270 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); | 270 | connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); |
271 | 271 | ||
272 | connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); | 272 | connect( pmView, SIGNAL( activated(int)), this, SLOT( pmViewActivated(int) ) ); |
273 | 273 | ||
274 | connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); | 274 | connect( skinsMenu, SIGNAL( activated(int)), this, SLOT(skinsMenuActivated(int) ) ); |
275 | 275 | ||
276 | // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); | 276 | // connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled() ) ); |
277 | 277 | ||
278 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 278 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
279 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); | 279 | this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); |
280 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 280 | connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
281 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 281 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
282 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), | 282 | connect( audioView, SIGNAL( returnPressed( QListViewItem *)), |
283 | this,SLOT( playIt( QListViewItem *)) ); | 283 | this,SLOT( playIt( QListViewItem *)) ); |
284 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 284 | connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
285 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), | 285 | connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), |
286 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); | 286 | this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); |
287 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), | 287 | connect( videoView, SIGNAL( returnPressed( QListViewItem *)), |
288 | this,SLOT( playIt( QListViewItem *)) ); | 288 | this,SLOT( playIt( QListViewItem *)) ); |
289 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); | 289 | connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); |
290 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 290 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
291 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); | 291 | connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); |
292 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); | 292 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); |
293 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); | 293 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); |
294 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); | 294 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); |
295 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); | 295 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); |
296 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); | 296 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); |
297 | 297 | ||
298 | setCentralWidget( vbox5 ); | 298 | setCentralWidget( vbox5 ); |
299 | 299 | ||
300 | readConfig( cfg ); | 300 | readConfig( cfg ); |
301 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 301 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
302 | loadList(DocLnk( currentPlaylist)); | 302 | loadList(DocLnk( currentPlaylist)); |
303 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); | 303 | setCaption(tr("OpiePlayer: ")+ currentPlaylist ); |
304 | 304 | ||
305 | initializeStates(); | 305 | initializeStates(); |
306 | } | 306 | } |
307 | 307 | ||
308 | 308 | ||
309 | PlayListWidget::~PlayListWidget() { | 309 | PlayListWidget::~PlayListWidget() { |
310 | Config cfg( "OpiePlayer" ); | ||
311 | writeConfig( cfg ); | ||
312 | |||
313 | if ( d->current ) { | 310 | if ( d->current ) { |
314 | delete d->current; | 311 | delete d->current; |
315 | } | 312 | } |
316 | delete d; | 313 | delete d; |
317 | } | 314 | } |
318 | 315 | ||
319 | 316 | ||
320 | void PlayListWidget::initializeStates() { | 317 | void PlayListWidget::initializeStates() { |
321 | 318 | ||
322 | d->tbPlay->setOn( mediaPlayerState->playing() ); | 319 | d->tbPlay->setOn( mediaPlayerState->playing() ); |
323 | d->tbLoop->setOn( mediaPlayerState->looping() ); | 320 | d->tbLoop->setOn( mediaPlayerState->looping() ); |
324 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); | 321 | d->tbShuffle->setOn( mediaPlayerState->shuffled() ); |
325 | setPlaylist( true); | 322 | setPlaylist( true); |
326 | } | 323 | } |
327 | 324 | ||
328 | 325 | ||
329 | void PlayListWidget::readConfig( Config& cfg ) { | 326 | void PlayListWidget::readConfig( Config& cfg ) { |
330 | cfg.setGroup("PlayList"); | 327 | cfg.setGroup("PlayList"); |
331 | QString currentString = cfg.readEntry("current", "" ); | 328 | QString currentString = cfg.readEntry("current", "" ); |
332 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 329 | int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
333 | for ( int i = 0; i < noOfFiles; i++ ) { | 330 | for ( int i = 0; i < noOfFiles; i++ ) { |
334 | QString entryName; | 331 | QString entryName; |
335 | entryName.sprintf( "File%i", i + 1 ); | 332 | entryName.sprintf( "File%i", i + 1 ); |
336 | QString linkFile = cfg.readEntry( entryName ); | 333 | QString linkFile = cfg.readEntry( entryName ); |
337 | if(QFileInfo( linkFile).exists() ) { | 334 | if(QFileInfo( linkFile).exists() ) { |
338 | DocLnk lnk( linkFile ); | 335 | DocLnk lnk( linkFile ); |
339 | if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) { | 336 | if ( QFileInfo( lnk.file()).exists() || linkFile.find("http",0,TRUE) != -1) { |
340 | d->selectedFiles->addToSelection( lnk ); | 337 | d->selectedFiles->addToSelection( lnk ); |
341 | } | 338 | } |
342 | } | 339 | } |
343 | } | 340 | } |
344 | d->selectedFiles->setSelectedItem( currentString); | 341 | d->selectedFiles->setSelectedItem( currentString); |
345 | } | 342 | } |
346 | 343 | ||
347 | 344 | ||
348 | void PlayListWidget::writeConfig( Config& cfg ) const { | 345 | void PlayListWidget::writeConfig( Config& cfg ) const { |
349 | 346 | ||
350 | d->selectedFiles->writeCurrent( cfg); | 347 | d->selectedFiles->writeCurrent( cfg); |
351 | cfg.setGroup("PlayList"); | 348 | cfg.setGroup("PlayList"); |
352 | int noOfFiles = 0; | 349 | int noOfFiles = 0; |
353 | d->selectedFiles->first(); | 350 | d->selectedFiles->first(); |
354 | do { | 351 | do { |
355 | const DocLnk *lnk = d->selectedFiles->current(); | 352 | const DocLnk *lnk = d->selectedFiles->current(); |
356 | if ( lnk ) { | 353 | if ( lnk ) { |
357 | QString entryName; | 354 | QString entryName; |
358 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 355 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
359 | cfg.writeEntry( entryName, lnk->linkFile() ); | 356 | cfg.writeEntry( entryName, lnk->linkFile() ); |
360 | // if this link does exist, add it so we have the file | 357 | // if this link does exist, add it so we have the file |
361 | // next time... | 358 | // next time... |
362 | if ( !QFile::exists( lnk->linkFile() ) ) { | 359 | if ( !QFile::exists( lnk->linkFile() ) ) { |
363 | // the way writing lnks doesn't really check for out | 360 | // the way writing lnks doesn't really check for out |
364 | // of disk space, but check it anyway. | 361 | // of disk space, but check it anyway. |
365 | if ( !lnk->writeLink() ) { | 362 | if ( !lnk->writeLink() ) { |
366 | QMessageBox::critical( 0, tr("Out of space"), | 363 | QMessageBox::critical( 0, tr("Out of space"), |
367 | tr( "There was a problem saving " | 364 | tr( "There was a problem saving " |
368 | "the playlist.\n" | 365 | "the playlist.\n" |
369 | "Your playlist " | 366 | "Your playlist " |
370 | "may be missing some entries\n" | 367 | "may be missing some entries\n" |
371 | "the next time you start it." ) | 368 | "the next time you start it." ) |
372 | ); | 369 | ); |
373 | } | 370 | } |
374 | } | 371 | } |
375 | noOfFiles++; | 372 | noOfFiles++; |
376 | } | 373 | } |
377 | } | 374 | } |
378 | while ( d->selectedFiles->next() ); | 375 | while ( d->selectedFiles->next() ); |
379 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 376 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
380 | } | 377 | } |
381 | 378 | ||
382 | 379 | ||
383 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 380 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
384 | d->setDocumentUsed = FALSE; | 381 | d->setDocumentUsed = FALSE; |
385 | if ( mediaPlayerState->playlist() ) { | 382 | if ( mediaPlayerState->playlist() ) { |
386 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) | 383 | if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" ) |
387 | d->selectedFiles->addToSelection( lnk ); | 384 | d->selectedFiles->addToSelection( lnk ); |
388 | } | 385 | } |
389 | else | 386 | else |
390 | mediaPlayerState->setPlaying( TRUE ); | 387 | mediaPlayerState->setPlaying( TRUE ); |
391 | } | 388 | } |
392 | 389 | ||
393 | 390 | ||
394 | void PlayListWidget::clearList() { | 391 | void PlayListWidget::clearList() { |
395 | while ( first() ) { | 392 | while ( first() ) { |
396 | d->selectedFiles->removeSelected(); | 393 | d->selectedFiles->removeSelected(); |
397 | } | 394 | } |
398 | } | 395 | } |
399 | 396 | ||
400 | 397 | ||
401 | void PlayListWidget::addAllToList() { | 398 | void PlayListWidget::addAllToList() { |
402 | DocLnkSet filesAll; | 399 | DocLnkSet filesAll; |
403 | Global::findDocuments(&filesAll, "video/*;audio/*"); | 400 | Global::findDocuments(&filesAll, "video/*;audio/*"); |
404 | QListIterator<DocLnk> Adit( filesAll.children() ); | 401 | QListIterator<DocLnk> Adit( filesAll.children() ); |
405 | for ( ; Adit.current(); ++Adit ) { | 402 | for ( ; Adit.current(); ++Adit ) { |
406 | if(QFileInfo(Adit.current()->file()).exists()) { | 403 | if(QFileInfo(Adit.current()->file()).exists()) { |
407 | d->selectedFiles->addToSelection( **Adit ); | 404 | d->selectedFiles->addToSelection( **Adit ); |
408 | } | 405 | } |
409 | } | 406 | } |
410 | } | 407 | } |
411 | 408 | ||
412 | 409 | ||
413 | void PlayListWidget::addAllMusicToList() { | 410 | void PlayListWidget::addAllMusicToList() { |
414 | QListIterator<DocLnk> dit( files.children() ); | 411 | QListIterator<DocLnk> dit( files.children() ); |
415 | for ( ; dit.current(); ++dit ) { | 412 | for ( ; dit.current(); ++dit ) { |
416 | if(QFileInfo(dit.current()->file()).exists()) { | 413 | if(QFileInfo(dit.current()->file()).exists()) { |
417 | d->selectedFiles->addToSelection( **dit ); | 414 | d->selectedFiles->addToSelection( **dit ); |
418 | } | 415 | } |
419 | } | 416 | } |
420 | } | 417 | } |
421 | 418 | ||
422 | 419 | ||
423 | void PlayListWidget::addAllVideoToList() { | 420 | void PlayListWidget::addAllVideoToList() { |
424 | QListIterator<DocLnk> dit( vFiles.children() ); | 421 | QListIterator<DocLnk> dit( vFiles.children() ); |
425 | for ( ; dit.current(); ++dit ) | 422 | for ( ; dit.current(); ++dit ) |
426 | if(QFileInfo( dit.current()->file()).exists()) | 423 | if(QFileInfo( dit.current()->file()).exists()) |
427 | d->selectedFiles->addToSelection( **dit ); | 424 | d->selectedFiles->addToSelection( **dit ); |
428 | } | 425 | } |
429 | 426 | ||
430 | 427 | ||
431 | void PlayListWidget::setDocument(const QString& fileref) { | 428 | void PlayListWidget::setDocument(const QString& fileref) { |
432 | qDebug(fileref); | 429 | qDebug(fileref); |
433 | fromSetDocument = TRUE; | 430 | fromSetDocument = TRUE; |
434 | if ( fileref.isNull() ) { | 431 | if ( fileref.isNull() ) { |
435 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); | 432 | QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); |
436 | return; | 433 | return; |
437 | } | 434 | } |
438 | 435 | ||
439 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u | 436 | if(fileref.find("m3u",0,TRUE) != -1) { //is m3u |
440 | readm3u( fileref); | 437 | readm3u( fileref); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 8076707..8710a99 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -1,111 +1,111 @@ | |||
1 | 1 | ||
2 | #ifndef PLAY_LIST_WIDGET_H | 2 | #ifndef PLAY_LIST_WIDGET_H |
3 | #define PLAY_LIST_WIDGET_H | 3 | #define PLAY_LIST_WIDGET_H |
4 | 4 | ||
5 | #include <qmainwindow.h> | 5 | #include <qmainwindow.h> |
6 | #include <qpe/applnk.h> | 6 | #include <qpe/applnk.h> |
7 | #include <qtabwidget.h> | 7 | #include <qtabwidget.h> |
8 | #include <qpe/fileselector.h> | 8 | #include <qpe/fileselector.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qpopupmenu.h> | 10 | #include <qpopupmenu.h> |
11 | 11 | ||
12 | /* #include <qtimer.h> */ | 12 | /* #include <qtimer.h> */ |
13 | 13 | ||
14 | 14 | ||
15 | class PlayListWidgetPrivate; | 15 | class PlayListWidgetPrivate; |
16 | class Config; | 16 | class Config; |
17 | class QListViewItem; | 17 | class QListViewItem; |
18 | class QListView; | 18 | class QListView; |
19 | class QPoint; | 19 | class QPoint; |
20 | class QAction; | 20 | class QAction; |
21 | class QLabel; | 21 | class QLabel; |
22 | 22 | ||
23 | class PlayListWidget : public QMainWindow { | 23 | class PlayListWidget : public QMainWindow { |
24 | Q_OBJECT | 24 | Q_OBJECT |
25 | public: | 25 | public: |
26 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 26 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
27 | ~PlayListWidget(); | 27 | ~PlayListWidget(); |
28 | QTabWidget * tabWidget; | 28 | QTabWidget * tabWidget; |
29 | // MenuItem *fullScreenButton, *scaleButton; | 29 | // MenuItem *fullScreenButton, *scaleButton; |
30 | // QAction *fullScreenButton, *scaleButton; | 30 | // QAction *fullScreenButton, *scaleButton; |
31 | DocLnkSet files; | 31 | DocLnkSet files; |
32 | DocLnkSet vFiles; | 32 | DocLnkSet vFiles; |
33 | QListView *audioView, *videoView, *playlistView; | 33 | QListView *audioView, *videoView, *playlistView; |
34 | QLabel *libString; | 34 | QLabel *libString; |
35 | QPopupMenu *pmView ; | 35 | QPopupMenu *pmView ; |
36 | bool fromSetDocument; | 36 | bool fromSetDocument; |
37 | bool insanityBool; | 37 | bool insanityBool; |
38 | QString setDocFileRef; | 38 | QString setDocFileRef; |
39 | // retrieve the current playlist entry (media file link) | 39 | // retrieve the current playlist entry (media file link) |
40 | const DocLnk *current(); | 40 | const DocLnk *current(); |
41 | void useSelectedDocument(); | 41 | void useSelectedDocument(); |
42 | /* QTimer * menuTimer; */ | 42 | /* QTimer * menuTimer; */ |
43 | FileSelector* playLists; | 43 | FileSelector* playLists; |
44 | QPushButton *tbDeletePlaylist; | 44 | QPushButton *tbDeletePlaylist; |
45 | int selected; | 45 | int selected; |
46 | public slots: | 46 | public slots: |
47 | bool first(); | 47 | bool first(); |
48 | bool last(); | 48 | bool last(); |
49 | bool next(); | 49 | bool next(); |
50 | bool prev(); | 50 | bool prev(); |
51 | void writeConfig( Config& cfg ) const; | ||
51 | /* void setFullScreen(); */ | 52 | /* void setFullScreen(); */ |
52 | /* void setScaled(); */ | 53 | /* void setScaled(); */ |
53 | protected: | 54 | protected: |
54 | /* void contentsMousePressEvent( QMouseEvent * e ); */ | 55 | /* void contentsMousePressEvent( QMouseEvent * e ); */ |
55 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ | 56 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ |
56 | void keyReleaseEvent( QKeyEvent *e); | 57 | void keyReleaseEvent( QKeyEvent *e); |
57 | void keyPressEvent( QKeyEvent *e); | 58 | void keyPressEvent( QKeyEvent *e); |
58 | private: | 59 | private: |
59 | int defaultSkinIndex; | 60 | int defaultSkinIndex; |
60 | QPopupMenu *skinsMenu; | 61 | QPopupMenu *skinsMenu; |
61 | bool audioScan, videoScan; | 62 | bool audioScan, videoScan; |
62 | void readm3u(const QString &); | 63 | void readm3u(const QString &); |
63 | void readPls(const QString &); | 64 | void readPls(const QString &); |
64 | 65 | ||
65 | void initializeStates(); | 66 | void initializeStates(); |
66 | void readConfig( Config& cfg ); | 67 | void readConfig( Config& cfg ); |
67 | void writeConfig( Config& cfg ) const; | ||
68 | PlayListWidgetPrivate *d; // Private implementation data | 68 | PlayListWidgetPrivate *d; // Private implementation data |
69 | void populateAudioView(); | 69 | void populateAudioView(); |
70 | void populateVideoView(); | 70 | void populateVideoView(); |
71 | private slots: | 71 | private slots: |
72 | void populateSkinsMenu(); | 72 | void populateSkinsMenu(); |
73 | void skinsMenuActivated(int); | 73 | void skinsMenuActivated(int); |
74 | void pmViewActivated(int); | 74 | void pmViewActivated(int); |
75 | void writem3u(); | 75 | void writem3u(); |
76 | void scanForAudio(); | 76 | void scanForAudio(); |
77 | void scanForVideo(); | 77 | void scanForVideo(); |
78 | void openFile(); | 78 | void openFile(); |
79 | void setDocument( const QString& fileref ); | 79 | void setDocument( const QString& fileref ); |
80 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 80 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
81 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 81 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
82 | void setActiveWindow(); // need to handle this to show the right view | 82 | void setActiveWindow(); // need to handle this to show the right view |
83 | void setPlaylist( bool ); // Show/Hide the playlist | 83 | void setPlaylist( bool ); // Show/Hide the playlist |
84 | void setView( char ); | 84 | void setView( char ); |
85 | void clearList(); | 85 | void clearList(); |
86 | void addAllToList(); | 86 | void addAllToList(); |
87 | void addAllMusicToList(); | 87 | void addAllMusicToList(); |
88 | void addAllVideoToList(); | 88 | void addAllVideoToList(); |
89 | void saveList(); // Save the playlist | 89 | void saveList(); // Save the playlist |
90 | void loadList( const DocLnk &); // Load a playlist | 90 | void loadList( const DocLnk &); // Load a playlist |
91 | void playIt( QListViewItem *); | 91 | void playIt( QListViewItem *); |
92 | 92 | ||
93 | void btnPlay(bool); | 93 | void btnPlay(bool); |
94 | void deletePlaylist(); | 94 | void deletePlaylist(); |
95 | void addSelected(); | 95 | void addSelected(); |
96 | void removeSelected(); | 96 | void removeSelected(); |
97 | void tabChanged(QWidget*); | 97 | void tabChanged(QWidget*); |
98 | void viewPressed( int, QListViewItem *, const QPoint&, int); | 98 | void viewPressed( int, QListViewItem *, const QPoint&, int); |
99 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); | 99 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); |
100 | void playSelected(); | 100 | void playSelected(); |
101 | 101 | ||
102 | protected slots: | 102 | protected slots: |
103 | /* void cancelMenuTimer(); */ | 103 | /* void cancelMenuTimer(); */ |
104 | /* void showFileMenu(); */ | 104 | /* void showFileMenu(); */ |
105 | 105 | ||
106 | 106 | ||
107 | }; | 107 | }; |
108 | 108 | ||
109 | 109 | ||
110 | #endif // PLAY_LIST_WIDGET_H | 110 | #endif // PLAY_LIST_WIDGET_H |
111 | 111 | ||