Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 176 |
1 files changed, 89 insertions, 87 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 3609f5d..d85ce50 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -15,35 +15,37 @@ | |||
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | 20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 |
21 | #define QTOPIA_INTERNAL_FSLP | 21 | #define QTOPIA_INTERNAL_FSLP |
22 | 22 | ||
23 | #include <qtoolbar.h> | 23 | #include "playlistselection.h" |
24 | #include "playlistwidget.h" | ||
25 | #include "mediaplayerstate.h" | ||
26 | #include "inputDialog.h" | ||
27 | #include "audiowidget.h" | ||
28 | #include "videowidget.h" | ||
29 | |||
30 | /* OPIE */ | ||
24 | #include <qpe/qpemenubar.h> | 31 | #include <qpe/qpemenubar.h> |
25 | #include <qpe/lnkproperties.h> | 32 | #include <qpe/lnkproperties.h> |
33 | #include <opie2/odebug.h> | ||
26 | 34 | ||
35 | /* QT */ | ||
36 | #include <qtoolbar.h> | ||
27 | #include <qaction.h> | 37 | #include <qaction.h> |
28 | #include <qlayout.h> | 38 | #include <qlayout.h> |
29 | #include <qmessagebox.h> | 39 | #include <qmessagebox.h> |
30 | |||
31 | //#include <qtimer.h> | 40 | //#include <qtimer.h> |
32 | 41 | ||
33 | #include "playlistselection.h" | 42 | /* STD */ |
34 | #include "playlistwidget.h" | ||
35 | #include "mediaplayerstate.h" | ||
36 | |||
37 | #include "inputDialog.h" | ||
38 | |||
39 | #include <stdlib.h> | 43 | #include <stdlib.h> |
40 | #include "audiowidget.h" | ||
41 | #include "videowidget.h" | ||
42 | 44 | ||
43 | #include <unistd.h> | 45 | #include <unistd.h> |
44 | #include <sys/file.h> | 46 | #include <sys/file.h> |
45 | #include <sys/ioctl.h> | 47 | #include <sys/ioctl.h> |
46 | #include <sys/soundcard.h> | 48 | #include <sys/soundcard.h> |
47 | 49 | ||
48 | // for setBacklight() | 50 | // for setBacklight() |
49 | #include <linux/fb.h> | 51 | #include <linux/fb.h> |
@@ -140,17 +142,17 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
140 | QToolBar *bar = new QToolBar( this ); | 142 | QToolBar *bar = new QToolBar( this ); |
141 | bar->setLabel( tr( "Play Operations" ) ); | 143 | bar->setLabel( tr( "Play Operations" ) ); |
142 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", | 144 | // d->tbPlayCurList = new ToolButton( bar, tr( "play List" ), "opieplayer/play_current_list", |
143 | // this , SLOT( addSelected()) ); | 145 | // this , SLOT( addSelected()) ); |
144 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 146 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
145 | tbDeletePlaylist->setFlat(TRUE); | 147 | tbDeletePlaylist->setFlat(TRUE); |
146 | 148 | ||
147 | tbDeletePlaylist->setFixedSize(20,20); | 149 | tbDeletePlaylist->setFixedSize(20,20); |
148 | 150 | ||
149 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", | 151 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer/add_to_playlist", |
150 | this , SLOT(addSelected()) ); | 152 | this , SLOT(addSelected()) ); |
151 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", | 153 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer/remove_from_playlist", |
152 | this , SLOT(removeSelected()) ); | 154 | this , SLOT(removeSelected()) ); |
153 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE ); | 155 | // d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", /*this */mediaPlayerState , SLOT(setPlaying(bool)/*btnPlay()*/), TRUE ); |
154 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", | 156 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer/play", |
155 | this , SLOT( btnPlay(bool) ), TRUE ); | 157 | this , SLOT( btnPlay(bool) ), TRUE ); |
156 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", | 158 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer/shuffle", |
@@ -187,46 +189,46 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
187 | connect( skinsMenu, SIGNAL( activated(int) ) , | 189 | connect( skinsMenu, SIGNAL( activated(int) ) , |
188 | this, SLOT( skinsMenuActivated(int) ) ); | 190 | this, SLOT( skinsMenuActivated(int) ) ); |
189 | populateSkinsMenu(); | 191 | populateSkinsMenu(); |
190 | 192 | ||
191 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); | 193 | QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton ); |
192 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); | 194 | QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton ); |
193 | 195 | ||
194 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); | 196 | QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton ); |
195 | 197 | ||
196 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); | 198 | tabWidget = new QTabWidget( hbox6, "tabWidget" ); |
197 | // tabWidget->setTabShape(QTabWidget::Triangular); | 199 | // tabWidget->setTabShape(QTabWidget::Triangular); |
198 | 200 | ||
199 | QWidget *pTab; | 201 | QWidget *pTab; |
200 | pTab = new QWidget( tabWidget, "pTab" ); | 202 | pTab = new QWidget( tabWidget, "pTab" ); |
201 | // playlistView = new QListView( pTab, "playlistview" ); | 203 | // playlistView = new QListView( pTab, "playlistview" ); |
202 | // playlistView->setMinimumSize(236,260); | 204 | // playlistView->setMinimumSize(236,260); |
203 | tabWidget->insertTab( pTab,"Playlist"); | 205 | tabWidget->insertTab( pTab,"Playlist"); |
204 | 206 | ||
205 | 207 | ||
206 | // Add the playlist area | 208 | // Add the playlist area |
207 | 209 | ||
208 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); | 210 | QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton ); |
209 | d->playListFrame = vbox3; | 211 | d->playListFrame = vbox3; |
210 | 212 | ||
211 | QGridLayout *layoutF = new QGridLayout( pTab ); | 213 | QGridLayout *layoutF = new QGridLayout( pTab ); |
212 | layoutF->setSpacing( 2); | 214 | layoutF->setSpacing( 2); |
213 | layoutF->setMargin( 2); | 215 | layoutF->setMargin( 2); |
214 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); | 216 | layoutF->addMultiCellWidget( d->playListFrame , 0, 0, 0, 1 ); |
215 | 217 | ||
216 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); | 218 | QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton ); |
217 | 219 | ||
218 | d->selectedFiles = new PlayListSelection( hbox2); | 220 | d->selectedFiles = new PlayListSelection( hbox2); |
219 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); | 221 | QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton ); |
220 | 222 | ||
221 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); | 223 | QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold); |
222 | 224 | ||
223 | 225 | ||
224 | 226 | ||
225 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch | 227 | QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch |
226 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); | 228 | new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); |
227 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); | 229 | new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); |
228 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); | 230 | new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); |
229 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch | 231 | QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch |
230 | 232 | ||
231 | QWidget *aTab; | 233 | QWidget *aTab; |
232 | aTab = new QWidget( tabWidget, "aTab" ); | 234 | aTab = new QWidget( tabWidget, "aTab" ); |
@@ -236,42 +238,42 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
236 | layoutA->setSpacing( 2); | 238 | layoutA->setSpacing( 2); |
237 | layoutA->setMargin( 2); | 239 | layoutA->setMargin( 2); |
238 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 240 | layoutA->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
239 | 241 | ||
240 | audioView->addColumn( tr("Title"),-1); | 242 | audioView->addColumn( tr("Title"),-1); |
241 | audioView->addColumn(tr("Size"), -1); | 243 | audioView->addColumn(tr("Size"), -1); |
242 | audioView->addColumn(tr("Media"),-1); | 244 | audioView->addColumn(tr("Media"),-1); |
243 | audioView->addColumn( tr( "Path" ), -1 ); | 245 | audioView->addColumn( tr( "Path" ), -1 ); |
244 | 246 | ||
245 | audioView->setColumnAlignment(1, Qt::AlignRight); | 247 | audioView->setColumnAlignment(1, Qt::AlignRight); |
246 | audioView->setColumnAlignment(2, Qt::AlignRight); | 248 | audioView->setColumnAlignment(2, Qt::AlignRight); |
247 | audioView->setAllColumnsShowFocus(TRUE); | 249 | audioView->setAllColumnsShowFocus(TRUE); |
248 | 250 | ||
249 | audioView->setMultiSelection( TRUE ); | 251 | audioView->setMultiSelection( TRUE ); |
250 | audioView->setSelectionMode( QListView::Extended); | 252 | audioView->setSelectionMode( QListView::Extended); |
251 | audioView->setSorting( 3, TRUE ); | 253 | audioView->setSorting( 3, TRUE ); |
252 | 254 | ||
253 | tabWidget->insertTab(aTab,tr("Audio")); | 255 | tabWidget->insertTab(aTab,tr("Audio")); |
254 | 256 | ||
255 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); | 257 | QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); |
256 | 258 | ||
257 | // audioView | 259 | // audioView |
258 | // populateAudioView(); | 260 | // populateAudioView(); |
259 | // videowidget | 261 | // videowidget |
260 | 262 | ||
261 | QWidget *vTab; | 263 | QWidget *vTab; |
262 | vTab = new QWidget( tabWidget, "vTab" ); | 264 | vTab = new QWidget( tabWidget, "vTab" ); |
263 | videoView = new QListView( vTab, "Videoview" ); | 265 | videoView = new QListView( vTab, "Videoview" ); |
264 | 266 | ||
265 | QGridLayout *layoutV = new QGridLayout( vTab ); | 267 | QGridLayout *layoutV = new QGridLayout( vTab ); |
266 | layoutV->setSpacing( 2); | 268 | layoutV->setSpacing( 2); |
267 | layoutV->setMargin( 2); | 269 | layoutV->setMargin( 2); |
268 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 270 | layoutV->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
269 | 271 | ||
270 | videoView->addColumn(tr("Title"),-1); | 272 | videoView->addColumn(tr("Title"),-1); |
271 | videoView->addColumn(tr("Size"),-1); | 273 | videoView->addColumn(tr("Size"),-1); |
272 | videoView->addColumn(tr("Media"),-1); | 274 | videoView->addColumn(tr("Media"),-1); |
273 | videoView->addColumn(tr( "Path" ), -1 ); | 275 | videoView->addColumn(tr( "Path" ), -1 ); |
274 | videoView->setColumnAlignment(1, Qt::AlignRight); | 276 | videoView->setColumnAlignment(1, Qt::AlignRight); |
275 | videoView->setColumnAlignment(2, Qt::AlignRight); | 277 | videoView->setColumnAlignment(2, Qt::AlignRight); |
276 | videoView->setAllColumnsShowFocus(TRUE); | 278 | videoView->setAllColumnsShowFocus(TRUE); |
277 | videoView->setMultiSelection( TRUE ); | 279 | videoView->setMultiSelection( TRUE ); |
@@ -298,17 +300,17 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
298 | 300 | ||
299 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 301 | connect( d->selectedFiles, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
300 | this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int)) ); | 302 | this,SLOT( playlistViewPressed(int,QListViewItem*,const QPoint&,int)) ); |
301 | 303 | ||
302 | 304 | ||
303 | ///audioView | 305 | ///audioView |
304 | connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 306 | connect( audioView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
305 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int)) ); | 307 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int)) ); |
306 | 308 | ||
307 | connect( audioView, SIGNAL( returnPressed(QListViewItem*)), | 309 | connect( audioView, SIGNAL( returnPressed(QListViewItem*)), |
308 | this,SLOT( playIt(QListViewItem*)) ); | 310 | this,SLOT( playIt(QListViewItem*)) ); |
309 | connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( addToSelection(QListViewItem*) ) ); | 311 | connect( audioView, SIGNAL( doubleClicked(QListViewItem*) ), this, SLOT( addToSelection(QListViewItem*) ) ); |
310 | 312 | ||
311 | 313 | ||
312 | //videoView | 314 | //videoView |
313 | connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), | 315 | connect( videoView, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int)), |
314 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int)) ); | 316 | this,SLOT( viewPressed(int,QListViewItem*,const QPoint&,int)) ); |
@@ -332,17 +334,17 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
332 | setCentralWidget( vbox5 ); | 334 | setCentralWidget( vbox5 ); |
333 | 335 | ||
334 | Config cfg( "OpiePlayer" ); | 336 | Config cfg( "OpiePlayer" ); |
335 | readConfig( cfg ); | 337 | readConfig( cfg ); |
336 | 338 | ||
337 | currentPlayList = cfg.readEntry("CurrentPlaylist","default"); | 339 | currentPlayList = cfg.readEntry("CurrentPlaylist","default"); |
338 | loadList(DocLnk( currentPlayList)); | 340 | loadList(DocLnk( currentPlayList)); |
339 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); | 341 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlayList))); |
340 | 342 | ||
341 | initializeStates(); | 343 | initializeStates(); |
342 | } | 344 | } |
343 | 345 | ||
344 | 346 | ||
345 | PlayListWidget::~PlayListWidget() { | 347 | PlayListWidget::~PlayListWidget() { |
346 | Config cfg( "OpiePlayer" ); | 348 | Config cfg( "OpiePlayer" ); |
347 | writeConfig( cfg ); | 349 | writeConfig( cfg ); |
348 | 350 | ||
@@ -384,34 +386,34 @@ void PlayListWidget::writeConfig( Config& cfg ) const { | |||
384 | cfg.setGroup("PlayList"); | 386 | cfg.setGroup("PlayList"); |
385 | int noOfFiles = 0; | 387 | int noOfFiles = 0; |
386 | d->selectedFiles->first(); | 388 | d->selectedFiles->first(); |
387 | do { | 389 | do { |
388 | const DocLnk *lnk = d->selectedFiles->current(); | 390 | const DocLnk *lnk = d->selectedFiles->current(); |
389 | if ( lnk ) { | 391 | if ( lnk ) { |
390 | QString entryName; | 392 | QString entryName; |
391 | entryName.sprintf( "File%i", noOfFiles + 1 ); | 393 | entryName.sprintf( "File%i", noOfFiles + 1 ); |
392 | // qDebug(entryName); | 394 | // odebug << entryName << oendl; |
393 | cfg.writeEntry( entryName, lnk->linkFile() ); | 395 | cfg.writeEntry( entryName, lnk->linkFile() ); |
394 | // if this link does exist, add it so we have the file | 396 | // if this link does exist, add it so we have the file |
395 | // next time... | 397 | // next time... |
396 | if ( !QFile::exists( lnk->linkFile() ) ) { | 398 | if ( !QFile::exists( lnk->linkFile() ) ) { |
397 | // the way writing lnks doesn't really check for out | 399 | // the way writing lnks doesn't really check for out |
398 | // of disk space, but check it anyway. | 400 | // of disk space, but check it anyway. |
399 | // if ( !lnk->writeLink() ) { | 401 | // if ( !lnk->writeLink() ) { |
400 | // QMessageBox::critical( 0, tr("Out of space"), | 402 | // QMessageBox::critical( 0, tr("Out of space"), |
401 | // tr( "There was a problem saving " | 403 | // tr( "There was a problem saving " |
402 | // "the playlist.\n" | 404 | // "the playlist.\n" |
403 | // "Your playlist " | 405 | // "Your playlist " |
404 | // "may be missing some entries\n" | 406 | // "may be missing some entries\n" |
405 | // "the next time you start it." ) | 407 | // "the next time you start it." ) |
406 | // ); | 408 | // ); |
407 | // } | 409 | // } |
408 | 410 | ||
409 | } | 411 | } |
410 | noOfFiles++; | 412 | noOfFiles++; |
411 | } | 413 | } |
412 | } | 414 | } |
413 | while ( d->selectedFiles->next() ); | 415 | while ( d->selectedFiles->next() ); |
414 | cfg.writeEntry("NumberOfFiles", noOfFiles ); | 416 | cfg.writeEntry("NumberOfFiles", noOfFiles ); |
415 | } | 417 | } |
416 | 418 | ||
417 | 419 | ||
@@ -441,63 +443,63 @@ void PlayListWidget::clearList() { | |||
441 | void PlayListWidget::addAllToList() { | 443 | void PlayListWidget::addAllToList() { |
442 | DocLnkSet filesAll; | 444 | DocLnkSet filesAll; |
443 | Global::findDocuments(&filesAll, "video/*;audio/*"); | 445 | Global::findDocuments(&filesAll, "video/*;audio/*"); |
444 | QListIterator<DocLnk> Adit( filesAll.children() ); | 446 | QListIterator<DocLnk> Adit( filesAll.children() ); |
445 | for ( ; Adit.current(); ++Adit ) | 447 | for ( ; Adit.current(); ++Adit ) |
446 | if(QFileInfo(Adit.current()->file()).exists()) | 448 | if(QFileInfo(Adit.current()->file()).exists()) |
447 | d->selectedFiles->addToSelection( **Adit ); | 449 | d->selectedFiles->addToSelection( **Adit ); |
448 | tabWidget->setCurrentPage(0); | 450 | tabWidget->setCurrentPage(0); |
449 | 451 | ||
450 | writeCurrentM3u(); | 452 | writeCurrentM3u(); |
451 | d->selectedFiles->first(); | 453 | d->selectedFiles->first(); |
452 | } | 454 | } |
453 | 455 | ||
454 | 456 | ||
455 | void PlayListWidget::addAllMusicToList() { | 457 | void PlayListWidget::addAllMusicToList() { |
456 | QListIterator<DocLnk> dit( files.children() ); | 458 | QListIterator<DocLnk> dit( files.children() ); |
457 | for ( ; dit.current(); ++dit ) | 459 | for ( ; dit.current(); ++dit ) |
458 | if(QFileInfo(dit.current()->file()).exists()) | 460 | if(QFileInfo(dit.current()->file()).exists()) |
459 | d->selectedFiles->addToSelection( **dit ); | 461 | d->selectedFiles->addToSelection( **dit ); |
460 | tabWidget->setCurrentPage(0); | 462 | tabWidget->setCurrentPage(0); |
461 | 463 | ||
462 | writeCurrentM3u(); | 464 | writeCurrentM3u(); |
463 | d->selectedFiles->first(); | 465 | d->selectedFiles->first(); |
464 | } | 466 | } |
465 | 467 | ||
466 | 468 | ||
467 | void PlayListWidget::addAllVideoToList() { | 469 | void PlayListWidget::addAllVideoToList() { |
468 | QListIterator<DocLnk> dit( vFiles.children() ); | 470 | QListIterator<DocLnk> dit( vFiles.children() ); |
469 | for ( ; dit.current(); ++dit ) | 471 | for ( ; dit.current(); ++dit ) |
470 | if(QFileInfo( dit.current()->file()).exists()) | 472 | if(QFileInfo( dit.current()->file()).exists()) |
471 | d->selectedFiles->addToSelection( **dit ); | 473 | d->selectedFiles->addToSelection( **dit ); |
472 | tabWidget->setCurrentPage(0); | 474 | tabWidget->setCurrentPage(0); |
473 | 475 | ||
474 | writeCurrentM3u(); | 476 | writeCurrentM3u(); |
475 | d->selectedFiles->first(); | 477 | d->selectedFiles->first(); |
476 | } | 478 | } |
477 | 479 | ||
478 | 480 | ||
479 | void PlayListWidget::setDocument(const QString& fileref) { | 481 | void PlayListWidget::setDocument(const QString& fileref) { |
480 | fromSetDocument = true; | 482 | fromSetDocument = true; |
481 | d->setDocumentUsed = TRUE; | 483 | d->setDocumentUsed = TRUE; |
482 | setDocumentEx(fileref); | 484 | setDocumentEx(fileref); |
483 | } | 485 | } |
484 | 486 | ||
485 | void PlayListWidget::setDocumentEx(const QString& fileref) { | 487 | void PlayListWidget::setDocumentEx(const QString& fileref) { |
486 | qDebug("opieplayer receive "+fileref); | 488 | odebug << "opieplayer receive "+fileref << oendl; |
487 | clearList(); | 489 | clearList(); |
488 | DocLnk lnk; | 490 | DocLnk lnk; |
489 | QFileInfo fileInfo(fileref); | 491 | QFileInfo fileInfo(fileref); |
490 | if ( !fileInfo.exists() ) { | 492 | if ( !fileInfo.exists() ) { |
491 | QMessageBox::critical( 0, tr( "Invalid File" ), | 493 | QMessageBox::critical( 0, tr( "Invalid File" ), |
492 | tr( "There was a problem in getting the file." ) ); | 494 | tr( "There was a problem in getting the file." ) ); |
493 | return; | 495 | return; |
494 | } | 496 | } |
495 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref); | 497 | // odebug << "<<<<<<<<<<<<<<<<<<<<<<setDocument "+fileref << oendl; |
496 | QString extension = fileInfo.extension(false); | 498 | QString extension = fileInfo.extension(false); |
497 | if( extension.find( "m3u", 0, false) != -1) { //is m3u | 499 | if( extension.find( "m3u", 0, false) != -1) { //is m3u |
498 | readm3u( fileref); | 500 | readm3u( fileref); |
499 | } | 501 | } |
500 | else if( extension.find( "pls", 0, false) != -1 ) { //is pls | 502 | else if( extension.find( "pls", 0, false) != -1 ) { //is pls |
501 | readPls( fileref); | 503 | readPls( fileref); |
502 | } | 504 | } |
503 | else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist | 505 | else if( fileref.find("playlist",0,TRUE) != -1) {//is playlist |
@@ -529,55 +531,55 @@ void PlayListWidget::setDocumentEx(const QString& fileref) { | |||
529 | mediaPlayerState->setPlaying( FALSE ); | 531 | mediaPlayerState->setPlaying( FALSE ); |
530 | qApp->processEvents(); | 532 | qApp->processEvents(); |
531 | mediaPlayerState->setPlaying( TRUE ); | 533 | mediaPlayerState->setPlaying( TRUE ); |
532 | 534 | ||
533 | } | 535 | } |
534 | 536 | ||
535 | 537 | ||
536 | void PlayListWidget::setActiveWindow() { | 538 | void PlayListWidget::setActiveWindow() { |
537 | // qDebug("SETTING active window"); | 539 | // odebug << "SETTING active window" << oendl; |
538 | // When we get raised we need to ensure that it switches views | 540 | // When we get raised we need to ensure that it switches views |
539 | char origView = mediaPlayerState->view(); | 541 | char origView = mediaPlayerState->view(); |
540 | mediaPlayerState->setView( 'l' ); // invalidate | 542 | mediaPlayerState->setView( 'l' ); // invalidate |
541 | mediaPlayerState->setView( origView ); // now switch back | 543 | mediaPlayerState->setView( origView ); // now switch back |
542 | } | 544 | } |
543 | 545 | ||
544 | 546 | ||
545 | void PlayListWidget::useSelectedDocument() { | 547 | void PlayListWidget::useSelectedDocument() { |
546 | d->setDocumentUsed = FALSE; | 548 | d->setDocumentUsed = FALSE; |
547 | } | 549 | } |
548 | 550 | ||
549 | 551 | ||
550 | const DocLnk *PlayListWidget::current() { // this is fugly | 552 | const DocLnk *PlayListWidget::current() { // this is fugly |
551 | switch (tabWidget->currentPageIndex()) { | 553 | switch (tabWidget->currentPageIndex()) { |
552 | case 0: //playlist | 554 | case 0: //playlist |
553 | { | 555 | { |
554 | // qDebug("playlist"); | 556 | // odebug << "playlist" << oendl; |
555 | if ( mediaPlayerState->playlist() ) { | 557 | if ( mediaPlayerState->playlist() ) { |
556 | return d->selectedFiles->current(); | 558 | return d->selectedFiles->current(); |
557 | } | 559 | } |
558 | else if ( d->setDocumentUsed && d->current ) { | 560 | else if ( d->setDocumentUsed && d->current ) { |
559 | return d->current; | 561 | return d->current; |
560 | } else { | 562 | } else { |
561 | return &(d->files->selectedDocument()); | 563 | return &(d->files->selectedDocument()); |
562 | } | 564 | } |
563 | } | 565 | } |
564 | break; | 566 | break; |
565 | case 1://audio | 567 | case 1://audio |
566 | { | 568 | { |
567 | // qDebug("audioView"); | 569 | // odebug << "audioView" << oendl; |
568 | QListIterator<DocLnk> dit( files.children() ); | 570 | QListIterator<DocLnk> dit( files.children() ); |
569 | for ( ; dit.current(); ++dit ) { | 571 | for ( ; dit.current(); ++dit ) { |
570 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { | 572 | if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) { |
571 | insanityBool=TRUE; | 573 | insanityBool=TRUE; |
572 | return dit; | 574 | return dit; |
573 | } | 575 | } |
574 | } | 576 | } |
575 | } | 577 | } |
576 | break; | 578 | break; |
577 | case 2: // video | 579 | case 2: // video |
578 | { | 580 | { |
579 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 581 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
580 | for ( ; Vdit.current(); ++Vdit ) { | 582 | for ( ; Vdit.current(); ++Vdit ) { |
581 | if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { | 583 | if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) { |
582 | insanityBool=TRUE; | 584 | insanityBool=TRUE; |
583 | return Vdit; | 585 | return Vdit; |
@@ -655,29 +657,29 @@ bool PlayListWidget::last() { | |||
655 | 657 | ||
656 | 658 | ||
657 | void PlayListWidget::saveList() { | 659 | void PlayListWidget::saveList() { |
658 | writem3u(); | 660 | writem3u(); |
659 | } | 661 | } |
660 | 662 | ||
661 | void PlayListWidget::loadList( const DocLnk & lnk) { | 663 | void PlayListWidget::loadList( const DocLnk & lnk) { |
662 | QString name = lnk.name(); | 664 | QString name = lnk.name(); |
663 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); | 665 | // odebug << "<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name << oendl; |
664 | 666 | ||
665 | if( name.length()>0) { | 667 | if( name.length()>0) { |
666 | setCaption("OpiePlayer: "+name); | 668 | setCaption("OpiePlayer: "+name); |
667 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); | 669 | // odebug << "<<<<<<<<<<<<load list "+ lnk.file() << oendl; |
668 | clearList(); | 670 | clearList(); |
669 | readm3u(lnk.file()); | 671 | readm3u(lnk.file()); |
670 | tabWidget->setCurrentPage(0); | 672 | tabWidget->setCurrentPage(0); |
671 | } | 673 | } |
672 | } | 674 | } |
673 | 675 | ||
674 | void PlayListWidget::setPlaylist( bool shown ) { | 676 | void PlayListWidget::setPlaylist( bool shown ) { |
675 | if ( shown ) | 677 | if ( shown ) |
676 | d->playListFrame->show(); | 678 | d->playListFrame->show(); |
677 | else | 679 | else |
678 | d->playListFrame->hide(); | 680 | d->playListFrame->hide(); |
679 | } | 681 | } |
680 | 682 | ||
681 | void PlayListWidget::setView( char view ) { | 683 | void PlayListWidget::setView( char view ) { |
682 | if ( view == 'l' ) | 684 | if ( view == 'l' ) |
683 | QPEApplication::showWidget( this ); | 685 | QPEApplication::showWidget( this ); |
@@ -702,34 +704,34 @@ void PlayListWidget::addSelected() { | |||
702 | lnk.setFile( filename ); //sets file name | 704 | lnk.setFile( filename ); //sets file name |
703 | d->selectedFiles->addToSelection( lnk); | 705 | d->selectedFiles->addToSelection( lnk); |
704 | } | 706 | } |
705 | } | 707 | } |
706 | audioView->clearSelection(); | 708 | audioView->clearSelection(); |
707 | // d->selectedFiles->next(); | 709 | // d->selectedFiles->next(); |
708 | } | 710 | } |
709 | break; | 711 | break; |
710 | 712 | ||
711 | case 2: { // video | 713 | case 2: { // video |
712 | QListViewItemIterator it( videoView ); | 714 | QListViewItemIterator it( videoView ); |
713 | for ( ; it.current(); ++it ) { | 715 | for ( ; it.current(); ++it ) { |
714 | if ( it.current()->isSelected() ) { | 716 | if ( it.current()->isSelected() ) { |
715 | 717 | ||
716 | filename = it.current()->text(3); | 718 | filename = it.current()->text(3); |
717 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 719 | lnk.setName( QFileInfo(filename).baseName() ); //sets name |
718 | lnk.setFile( filename ); //sets file name | 720 | lnk.setFile( filename ); //sets file name |
719 | d->selectedFiles->addToSelection( lnk); | 721 | d->selectedFiles->addToSelection( lnk); |
720 | } | 722 | } |
721 | } | 723 | } |
722 | videoView->clearSelection(); | 724 | videoView->clearSelection(); |
723 | } | 725 | } |
724 | break; | 726 | break; |
725 | }; | 727 | }; |
726 | // tabWidget->setCurrentPage(0); | 728 | // tabWidget->setCurrentPage(0); |
727 | writeCurrentM3u(); | 729 | writeCurrentM3u(); |
728 | 730 | ||
729 | } | 731 | } |
730 | 732 | ||
731 | void PlayListWidget::removeSelected() { | 733 | void PlayListWidget::removeSelected() { |
732 | d->selectedFiles->removeSelected( ); | 734 | d->selectedFiles->removeSelected( ); |
733 | } | 735 | } |
734 | 736 | ||
735 | void PlayListWidget::playIt( QListViewItem *) { | 737 | void PlayListWidget::playIt( QListViewItem *) { |
@@ -752,21 +754,21 @@ void PlayListWidget::addToSelection( QListViewItem *it) { | |||
752 | // case 1: { | 754 | // case 1: { |
753 | DocLnk lnk; | 755 | DocLnk lnk; |
754 | QString filename; | 756 | QString filename; |
755 | 757 | ||
756 | filename=it->text(3); | 758 | filename=it->text(3); |
757 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 759 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
758 | lnk.setFile( filename ); //sets file name | 760 | lnk.setFile( filename ); //sets file name |
759 | d->selectedFiles->addToSelection( lnk); | 761 | d->selectedFiles->addToSelection( lnk); |
760 | 762 | ||
761 | if(tabWidget->currentPageIndex() == 0) | 763 | if(tabWidget->currentPageIndex() == 0) |
762 | writeCurrentM3u(); | 764 | writeCurrentM3u(); |
763 | // tabWidget->setCurrentPage(0); | 765 | // tabWidget->setCurrentPage(0); |
764 | 766 | ||
765 | } | 767 | } |
766 | } | 768 | } |
767 | 769 | ||
768 | void PlayListWidget::tabChanged(QWidget *) { | 770 | void PlayListWidget::tabChanged(QWidget *) { |
769 | 771 | ||
770 | switch ( tabWidget->currentPageIndex()) { | 772 | switch ( tabWidget->currentPageIndex()) { |
771 | case 0: | 773 | case 0: |
772 | { | 774 | { |
@@ -813,45 +815,45 @@ void PlayListWidget::btnPlay(bool b) { | |||
813 | case 0: | 815 | case 0: |
814 | { | 816 | { |
815 | // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 | 817 | // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 |
816 | // if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { | 818 | // if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { |
817 | // QMessageBox::message("Note","You are trying to play\na malformed url."); | 819 | // QMessageBox::message("Note","You are trying to play\na malformed url."); |
818 | // } else { | 820 | // } else { |
819 | mediaPlayerState->setPlaying(b); | 821 | mediaPlayerState->setPlaying(b); |
820 | insanityBool=FALSE; | 822 | insanityBool=FALSE; |
821 | qDebug("insanity"); | 823 | odebug << "insanity" << oendl; |
822 | // } | 824 | // } |
823 | } | 825 | } |
824 | break; | 826 | break; |
825 | case 1: | 827 | case 1: |
826 | { | 828 | { |
827 | // d->selectedFiles->unSelect(); | 829 | // d->selectedFiles->unSelect(); |
828 | addToSelection( audioView->currentItem() ); | 830 | addToSelection( audioView->currentItem() ); |
829 | mediaPlayerState->setPlaying( b); | 831 | mediaPlayerState->setPlaying( b); |
830 | d->selectedFiles->removeSelected( ); | 832 | d->selectedFiles->removeSelected( ); |
831 | d->selectedFiles->unSelect(); | 833 | d->selectedFiles->unSelect(); |
832 | tabWidget->setCurrentPage(1); | 834 | tabWidget->setCurrentPage(1); |
833 | insanityBool=FALSE; | 835 | insanityBool=FALSE; |
834 | }// audioView->clearSelection(); | 836 | }// audioView->clearSelection(); |
835 | break; | 837 | break; |
836 | case 2: | 838 | case 2: |
837 | { | 839 | { |
838 | 840 | ||
839 | addToSelection( videoView->currentItem() ); | 841 | addToSelection( videoView->currentItem() ); |
840 | mediaPlayerState->setPlaying( b); | 842 | mediaPlayerState->setPlaying( b); |
841 | // qApp->processEvents(); | 843 | // qApp->processEvents(); |
842 | d->selectedFiles->removeSelected( ); | 844 | d->selectedFiles->removeSelected( ); |
843 | d->selectedFiles->unSelect(); | 845 | d->selectedFiles->unSelect(); |
844 | tabWidget->setCurrentPage(2); | 846 | tabWidget->setCurrentPage(2); |
845 | insanityBool=FALSE; | 847 | insanityBool=FALSE; |
846 | }// videoView->clearSelection(); | 848 | }// videoView->clearSelection(); |
847 | break; | 849 | break; |
848 | }; | 850 | }; |
849 | 851 | ||
850 | } | 852 | } |
851 | 853 | ||
852 | void PlayListWidget::deletePlaylist() { | 854 | void PlayListWidget::deletePlaylist() { |
853 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), | 855 | switch( QMessageBox::information( this, (tr("Remove Playlist?")), |
854 | (tr("You really want to delete\nthis playlist?")), | 856 | (tr("You really want to delete\nthis playlist?")), |
855 | (tr("Yes")), (tr("No")), 0 )){ | 857 | (tr("Yes")), (tr("No")), 0 )){ |
856 | case 0: // Yes clicked, | 858 | case 0: // Yes clicked, |
857 | QFile().remove(playLists->selectedDocument().file()); | 859 | QFile().remove(playLists->selectedDocument().file()); |
@@ -869,36 +871,36 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int | |||
869 | case 1: | 871 | case 1: |
870 | break; | 872 | break; |
871 | case 2:{ | 873 | case 2:{ |
872 | 874 | ||
873 | QPopupMenu m; | 875 | QPopupMenu m; |
874 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); | 876 | m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); |
875 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); | 877 | m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); |
876 | m.insertSeparator(); | 878 | m.insertSeparator(); |
877 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) | 879 | if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) |
878 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 880 | m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
879 | 881 | ||
880 | m.exec( QCursor::pos() ); | 882 | m.exec( QCursor::pos() ); |
881 | } | 883 | } |
882 | break; | 884 | break; |
883 | }; | 885 | }; |
884 | } | 886 | } |
885 | 887 | ||
886 | void PlayListWidget::playSelected() | 888 | void PlayListWidget::playSelected() |
887 | { | 889 | { |
888 | btnPlay( true); | 890 | btnPlay( true); |
889 | // d->selectedFiles->unSelect(); | 891 | // d->selectedFiles->unSelect(); |
890 | } | 892 | } |
891 | 893 | ||
892 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int) | 894 | void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint&, int) |
893 | { | 895 | { |
894 | switch (mouse) { | 896 | switch (mouse) { |
895 | case 1: | 897 | case 1: |
896 | 898 | ||
897 | break; | 899 | break; |
898 | case 2:{ | 900 | case 2:{ |
899 | QPopupMenu m; | 901 | QPopupMenu m; |
900 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); | 902 | m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); |
901 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); | 903 | m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); |
902 | // m.insertSeparator(); | 904 | // m.insertSeparator(); |
903 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); | 905 | // m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); |
904 | m.exec( QCursor::pos() ); | 906 | m.exec( QCursor::pos() ); |
@@ -910,17 +912,17 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi | |||
910 | 912 | ||
911 | void PlayListWidget::listDelete() { | 913 | void PlayListWidget::listDelete() { |
912 | Config cfg( "OpiePlayer" ); | 914 | Config cfg( "OpiePlayer" ); |
913 | cfg.setGroup("PlayList"); | 915 | cfg.setGroup("PlayList"); |
914 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); | 916 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); |
915 | QString file; | 917 | QString file; |
916 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 918 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
917 | switch ( tabWidget->currentPageIndex()) { | 919 | switch ( tabWidget->currentPageIndex()) { |
918 | case 0: | 920 | case 0: |
919 | break; | 921 | break; |
920 | case 1: | 922 | case 1: |
921 | { | 923 | { |
922 | file = audioView->currentItem()->text(0); | 924 | file = audioView->currentItem()->text(0); |
923 | QListIterator<DocLnk> Pdit( files.children() ); | 925 | QListIterator<DocLnk> Pdit( files.children() ); |
924 | for ( ; Pdit.current(); ++Pdit ) { | 926 | for ( ; Pdit.current(); ++Pdit ) { |
925 | if( Pdit.current()->name() == file) { | 927 | if( Pdit.current()->name() == file) { |
926 | LnkProperties prop( Pdit.current() ); | 928 | LnkProperties prop( Pdit.current() ); |
@@ -946,27 +948,27 @@ void PlayListWidget::listDelete() { | |||
946 | // } | 948 | // } |
947 | // } | 949 | // } |
948 | } | 950 | } |
949 | break; | 951 | break; |
950 | }; | 952 | }; |
951 | } | 953 | } |
952 | 954 | ||
953 | void PlayListWidget::scanForAudio() { | 955 | void PlayListWidget::scanForAudio() { |
954 | // qDebug("scan for audio"); | 956 | // odebug << "scan for audio" << oendl; |
955 | files.detachChildren(); | 957 | files.detachChildren(); |
956 | QListIterator<DocLnk> sdit( files.children() ); | 958 | QListIterator<DocLnk> sdit( files.children() ); |
957 | for ( ; sdit.current(); ++sdit ) { | 959 | for ( ; sdit.current(); ++sdit ) { |
958 | delete sdit.current(); | 960 | delete sdit.current(); |
959 | } | 961 | } |
960 | Global::findDocuments( &files, audioMimes); | 962 | Global::findDocuments( &files, audioMimes); |
961 | audioScan = true; | 963 | audioScan = true; |
962 | } | 964 | } |
963 | void PlayListWidget::scanForVideo() { | 965 | void PlayListWidget::scanForVideo() { |
964 | // qDebug("scan for video"); | 966 | // odebug << "scan for video" << oendl; |
965 | vFiles.detachChildren(); | 967 | vFiles.detachChildren(); |
966 | QListIterator<DocLnk> sdit( vFiles.children() ); | 968 | QListIterator<DocLnk> sdit( vFiles.children() ); |
967 | for ( ; sdit.current(); ++sdit ) { | 969 | for ( ; sdit.current(); ++sdit ) { |
968 | delete sdit.current(); | 970 | delete sdit.current(); |
969 | } | 971 | } |
970 | Global::findDocuments(&vFiles, "video/*"); | 972 | Global::findDocuments(&vFiles, "video/*"); |
971 | videoScan = true; | 973 | videoScan = true; |
972 | } | 974 | } |
@@ -989,19 +991,19 @@ void PlayListWidget::populateAudioView() { | |||
989 | if(dit.current()->file().find(path) != -1 ) storage=name; | 991 | if(dit.current()->file().find(path) != -1 ) storage=name; |
990 | } | 992 | } |
991 | 993 | ||
992 | QListViewItem * newItem; | 994 | QListViewItem * newItem; |
993 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { | 995 | if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) { |
994 | long size; | 996 | long size; |
995 | if( dit.current()->file().left(4) == "http" ) | 997 | if( dit.current()->file().left(4) == "http" ) |
996 | size=0; | 998 | size=0; |
997 | else | 999 | else |
998 | size = QFile( dit.current()->file() ).size(); | 1000 | size = QFile( dit.current()->file() ).size(); |
999 | // qDebug(dit.current()->name()); | 1001 | // odebug << dit.current()->name() << oendl; |
1000 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 1002 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
1001 | QString::number(size ), storage, dit.current()->file()); | 1003 | QString::number(size ), storage, dit.current()->file()); |
1002 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); | 1004 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" )); |
1003 | } | 1005 | } |
1004 | } | 1006 | } |
1005 | 1007 | ||
1006 | } | 1008 | } |
1007 | 1009 | ||
@@ -1035,17 +1037,17 @@ void PlayListWidget::populateVideoView() { | |||
1035 | 1037 | ||
1036 | void PlayListWidget::openFile() { | 1038 | void PlayListWidget::openFile() { |
1037 | QString filename, name; | 1039 | QString filename, name; |
1038 | InputDialog *fileDlg; | 1040 | InputDialog *fileDlg; |
1039 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1041 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1040 | fileDlg->exec(); | 1042 | fileDlg->exec(); |
1041 | if( fileDlg->result() == 1 ) { | 1043 | if( fileDlg->result() == 1 ) { |
1042 | filename = fileDlg->text(); | 1044 | filename = fileDlg->text(); |
1043 | // qDebug( "Selected filename is " + filename ); | 1045 | // odebug << "Selected filename is " + filename << oendl; |
1044 | DocLnk lnk; | 1046 | DocLnk lnk; |
1045 | Config cfg( "OpiePlayer" ); | 1047 | Config cfg( "OpiePlayer" ); |
1046 | cfg.setGroup("PlayList"); | 1048 | cfg.setGroup("PlayList"); |
1047 | 1049 | ||
1048 | QString m3uFile; | 1050 | QString m3uFile; |
1049 | m3uFile = filename; | 1051 | m3uFile = filename; |
1050 | if(filename.left(4) == "http") { | 1052 | if(filename.left(4) == "http") { |
1051 | if(filename.find(":",8,TRUE) != -1) { //found a port | 1053 | if(filename.find(":",8,TRUE) != -1) { //found a port |
@@ -1070,57 +1072,57 @@ void PlayListWidget::openFile() { | |||
1070 | } else { | 1072 | } else { |
1071 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 1073 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
1072 | lnk.setFile( filename ); //sets file name | 1074 | lnk.setFile( filename ); //sets file name |
1073 | d->selectedFiles->addToSelection( lnk); | 1075 | d->selectedFiles->addToSelection( lnk); |
1074 | lnk.removeLinkFile(); | 1076 | lnk.removeLinkFile(); |
1075 | writeCurrentM3u(); | 1077 | writeCurrentM3u(); |
1076 | } | 1078 | } |
1077 | } | 1079 | } |
1078 | 1080 | ||
1079 | if( fileDlg ) { | 1081 | if( fileDlg ) { |
1080 | delete fileDlg; | 1082 | delete fileDlg; |
1081 | } | 1083 | } |
1082 | } | 1084 | } |
1083 | 1085 | ||
1084 | 1086 | ||
1085 | /* | 1087 | /* |
1086 | reads m3u and shows files/urls to playlist widget */ | 1088 | reads m3u and shows files/urls to playlist widget */ |
1087 | void PlayListWidget::readm3u( const QString &filename ) { | 1089 | void PlayListWidget::readm3u( const QString &filename ) { |
1088 | // qDebug( "read m3u filename " + filename ); | 1090 | // odebug << "read m3u filename " + filename << oendl; |
1089 | 1091 | ||
1090 | Om3u *m3uList; | 1092 | Om3u *m3uList; |
1091 | QString s, name; | 1093 | QString s, name; |
1092 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1094 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1093 | m3uList->readM3u(); | 1095 | m3uList->readM3u(); |
1094 | DocLnk lnk; | 1096 | DocLnk lnk; |
1095 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1097 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1096 | s = *it; | 1098 | s = *it; |
1097 | // qDebug("reading "+ s); | 1099 | // odebug << "reading "+ s << oendl; |
1098 | if(s.left(4)=="http") { | 1100 | if(s.left(4)=="http") { |
1099 | lnk.setName( s ); //sets file name | 1101 | lnk.setName( s ); //sets file name |
1100 | lnk.setIcon("opieplayer2/musicfile"); | 1102 | lnk.setIcon("opieplayer2/musicfile"); |
1101 | 1103 | ||
1102 | // if(s.right(4) != '.' || s.right(5) != '.') | 1104 | // if(s.right(4) != '.' || s.right(5) != '.') |
1103 | if(s.right(4) != '.' || s.right(5) != '.' ) | 1105 | if(s.right(4) != '.' || s.right(5) != '.' ) |
1104 | if( s.right(1) != "/") | 1106 | if( s.right(1) != "/") |
1105 | lnk.setFile( s+"/"); //if url with no extension | 1107 | lnk.setFile( s+"/"); //if url with no extension |
1106 | else | 1108 | else |
1107 | lnk.setFile( s ); //sets file name | 1109 | lnk.setFile( s ); //sets file name |
1108 | 1110 | ||
1109 | } else { | 1111 | } else { |
1110 | // if( QFileInfo( s ).exists() ) { | 1112 | // if( QFileInfo( s ).exists() ) { |
1111 | lnk.setName( fullBaseName ( QFileInfo(s))); | 1113 | lnk.setName( fullBaseName ( QFileInfo(s))); |
1112 | // if(s.right(4) == '.') {//if regular file | 1114 | // if(s.right(4) == '.') {//if regular file |
1113 | if(s.left(1) != "/") { | 1115 | if(s.left(1) != "/") { |
1114 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 1116 | // odebug << "set link "+QFileInfo(filename).dirPath()+"/"+s << oendl; |
1115 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 1117 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
1116 | lnk.setIcon("SoundPlayer"); | 1118 | lnk.setIcon("SoundPlayer"); |
1117 | } else { | 1119 | } else { |
1118 | // qDebug("set link2 "+s); | 1120 | // odebug << "set link2 "+s << oendl; |
1119 | lnk.setFile( s); | 1121 | lnk.setFile( s); |
1120 | lnk.setIcon("SoundPlayer"); | 1122 | lnk.setIcon("SoundPlayer"); |
1121 | } | 1123 | } |
1122 | } | 1124 | } |
1123 | d->selectedFiles->addToSelection( lnk ); | 1125 | d->selectedFiles->addToSelection( lnk ); |
1124 | } | 1126 | } |
1125 | Config config( "OpiePlayer" ); | 1127 | Config config( "OpiePlayer" ); |
1126 | config.setGroup( "PlayList" ); | 1128 | config.setGroup( "PlayList" ); |
@@ -1130,24 +1132,24 @@ void PlayListWidget::readm3u( const QString &filename ) { | |||
1130 | currentPlayList=filename; | 1132 | currentPlayList=filename; |
1131 | 1133 | ||
1132 | // m3uList->write(); | 1134 | // m3uList->write(); |
1133 | m3uList->close(); | 1135 | m3uList->close(); |
1134 | if(m3uList) delete m3uList; | 1136 | if(m3uList) delete m3uList; |
1135 | 1137 | ||
1136 | d->selectedFiles->setSelectedItem( s); | 1138 | d->selectedFiles->setSelectedItem( s); |
1137 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); | 1139 | setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); |
1138 | 1140 | ||
1139 | } | 1141 | } |
1140 | 1142 | ||
1141 | /* | 1143 | /* |
1142 | reads pls and adds files/urls to playlist */ | 1144 | reads pls and adds files/urls to playlist */ |
1143 | void PlayListWidget::readPls( const QString &filename ) { | 1145 | void PlayListWidget::readPls( const QString &filename ) { |
1144 | 1146 | ||
1145 | // qDebug( "pls filename is " + filename ); | 1147 | // odebug << "pls filename is " + filename << oendl; |
1146 | Om3u *m3uList; | 1148 | Om3u *m3uList; |
1147 | QString s, name; | 1149 | QString s, name; |
1148 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1150 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1149 | m3uList->readPls(); | 1151 | m3uList->readPls(); |
1150 | 1152 | ||
1151 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1153 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1152 | s = *it; | 1154 | s = *it; |
1153 | // s.replace( QRegExp( "%20" )," " ); | 1155 | // s.replace( QRegExp( "%20" )," " ); |
@@ -1180,30 +1182,30 @@ void PlayListWidget::readPls( const QString &filename ) { | |||
1180 | 1182 | ||
1181 | m3uList->close(); | 1183 | m3uList->close(); |
1182 | if(m3uList) delete m3uList; | 1184 | if(m3uList) delete m3uList; |
1183 | } | 1185 | } |
1184 | 1186 | ||
1185 | /* | 1187 | /* |
1186 | writes current playlist to current m3u file */ | 1188 | writes current playlist to current m3u file */ |
1187 | void PlayListWidget::writeCurrentM3u() { | 1189 | void PlayListWidget::writeCurrentM3u() { |
1188 | // qDebug("writing to current m3u"); | 1190 | // odebug << "writing to current m3u" << oendl; |
1189 | Config cfg( "OpiePlayer" ); | 1191 | Config cfg( "OpiePlayer" ); |
1190 | cfg.setGroup("PlayList"); | 1192 | cfg.setGroup("PlayList"); |
1191 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); | 1193 | currentPlayList = cfg.readEntry("CurrentPlaylist",""); |
1192 | Om3u *m3uList; | 1194 | Om3u *m3uList; |
1193 | m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate ); | 1195 | m3uList = new Om3u( currentPlayList, IO_ReadWrite | IO_Truncate ); |
1194 | 1196 | ||
1195 | if( d->selectedFiles->first()) { | 1197 | if( d->selectedFiles->first()) { |
1196 | do { | 1198 | do { |
1197 | // qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); | 1199 | // odebug << "writeCurrentM3u " +d->selectedFiles->current()->file() << oendl; |
1198 | m3uList->add( d->selectedFiles->current()->file() ); | 1200 | m3uList->add( d->selectedFiles->current()->file() ); |
1199 | } | 1201 | } |
1200 | while ( d->selectedFiles->next() ); | 1202 | while ( d->selectedFiles->next() ); |
1201 | // qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" ); | 1203 | // odebug << "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" << oendl; |
1202 | m3uList->write(); | 1204 | m3uList->write(); |
1203 | m3uList->close(); | 1205 | m3uList->close(); |
1204 | 1206 | ||
1205 | if(m3uList) delete m3uList; | 1207 | if(m3uList) delete m3uList; |
1206 | } | 1208 | } |
1207 | } | 1209 | } |
1208 | 1210 | ||
1209 | /* | 1211 | /* |
@@ -1212,55 +1214,55 @@ void PlayListWidget::writem3u() { | |||
1212 | InputDialog *fileDlg; | 1214 | InputDialog *fileDlg; |
1213 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); | 1215 | fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0); |
1214 | fileDlg->exec(); | 1216 | fileDlg->exec(); |
1215 | QString name, filename, list; | 1217 | QString name, filename, list; |
1216 | Om3u *m3uList; | 1218 | Om3u *m3uList; |
1217 | 1219 | ||
1218 | if( fileDlg->result() == 1 ) { | 1220 | if( fileDlg->result() == 1 ) { |
1219 | name = fileDlg->text(); | 1221 | name = fileDlg->text(); |
1220 | // qDebug( filename ); | 1222 | // odebug << filename << oendl; |
1221 | if( name.find("/",0,true) != -1) {// assume they specify a file path | 1223 | if( name.find("/",0,true) != -1) {// assume they specify a file path |
1222 | filename = name; | 1224 | filename = name; |
1223 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); | 1225 | name = name.right(name.length()- name.findRev("/",-1,true) - 1 ); |
1224 | } | 1226 | } |
1225 | else //otherwise dump it somewhere noticable | 1227 | else //otherwise dump it somewhere noticable |
1226 | filename = QPEApplication::documentDir() + "/" + name; | 1228 | filename = QPEApplication::documentDir() + "/" + name; |
1227 | 1229 | ||
1228 | if( filename.right( 3 ) != "m3u" ) //needs filename extension | 1230 | if( filename.right( 3 ) != "m3u" ) //needs filename extension |
1229 | filename += ".m3u"; | 1231 | filename += ".m3u"; |
1230 | 1232 | ||
1231 | if( d->selectedFiles->first()) { | 1233 | if( d->selectedFiles->first()) { |
1232 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); | 1234 | m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); |
1233 | 1235 | ||
1234 | do { | 1236 | do { |
1235 | m3uList->add( d->selectedFiles->current()->file()); | 1237 | m3uList->add( d->selectedFiles->current()->file()); |
1236 | } | 1238 | } |
1237 | while ( d->selectedFiles->next() ); | 1239 | while ( d->selectedFiles->next() ); |
1238 | // qDebug( list ); | 1240 | // odebug << list << oendl; |
1239 | m3uList->write(); | 1241 | m3uList->write(); |
1240 | m3uList->close(); | 1242 | m3uList->close(); |
1241 | if(m3uList) delete m3uList; | 1243 | if(m3uList) delete m3uList; |
1242 | 1244 | ||
1243 | if(fileDlg) delete fileDlg; | 1245 | if(fileDlg) delete fileDlg; |
1244 | 1246 | ||
1245 | DocLnk lnk; | 1247 | DocLnk lnk; |
1246 | lnk.setFile( filename); | 1248 | lnk.setFile( filename); |
1247 | lnk.setIcon("opieplayer2/playlist2"); | 1249 | lnk.setIcon("opieplayer2/playlist2"); |
1248 | lnk.setName( name); //sets file name | 1250 | lnk.setName( name); //sets file name |
1249 | 1251 | ||
1250 | // qDebug(filename); | 1252 | // odebug << filename << oendl; |
1251 | Config config( "OpiePlayer" ); | 1253 | Config config( "OpiePlayer" ); |
1252 | config.setGroup( "PlayList" ); | 1254 | config.setGroup( "PlayList" ); |
1253 | 1255 | ||
1254 | config.writeEntry("CurrentPlaylist",filename); | 1256 | config.writeEntry("CurrentPlaylist",filename); |
1255 | currentPlayList=filename; | 1257 | currentPlayList=filename; |
1256 | 1258 | ||
1257 | if(!lnk.writeLink()) { | 1259 | if(!lnk.writeLink()) { |
1258 | // qDebug("Writing doclink did not work"); | 1260 | // odebug << "Writing doclink did not work" << oendl; |
1259 | } | 1261 | } |
1260 | 1262 | ||
1261 | setCaption(tr("OpiePlayer: ") + name); | 1263 | setCaption(tr("OpiePlayer: ") + name); |
1262 | } | 1264 | } |
1263 | } | 1265 | } |
1264 | } | 1266 | } |
1265 | 1267 | ||
1266 | 1268 | ||
@@ -1286,89 +1288,89 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | |||
1286 | break; | 1288 | break; |
1287 | case Key_Q: //add to playlist | 1289 | case Key_Q: //add to playlist |
1288 | addSelected(); | 1290 | addSelected(); |
1289 | break; | 1291 | break; |
1290 | case Key_R: //remove from playlist | 1292 | case Key_R: //remove from playlist |
1291 | removeSelected(); | 1293 | removeSelected(); |
1292 | break; | 1294 | break; |
1293 | // case Key_P: //play | 1295 | // case Key_P: //play |
1294 | // qDebug("Play"); | 1296 | // odebug << "Play" << oendl; |
1295 | // playSelected(); | 1297 | // playSelected(); |
1296 | // break; | 1298 | // break; |
1297 | case Key_Space: | 1299 | case Key_Space: |
1298 | // playSelected(); puh | 1300 | // playSelected(); puh |
1299 | break; | 1301 | break; |
1300 | case Key_1: | 1302 | case Key_1: |
1301 | tabWidget->setCurrentPage(0); | 1303 | tabWidget->setCurrentPage(0); |
1302 | break; | 1304 | break; |
1303 | case Key_2: | 1305 | case Key_2: |
1304 | tabWidget->setCurrentPage(1); | 1306 | tabWidget->setCurrentPage(1); |
1305 | break; | 1307 | break; |
1306 | case Key_3: | 1308 | case Key_3: |
1307 | tabWidget->setCurrentPage(2); | 1309 | tabWidget->setCurrentPage(2); |
1308 | break; | 1310 | break; |
1309 | case Key_4: | 1311 | case Key_4: |
1310 | tabWidget->setCurrentPage(3); | 1312 | tabWidget->setCurrentPage(3); |
1311 | break; | 1313 | break; |
1312 | case Key_Down: | 1314 | case Key_Down: |
1313 | if ( !d->selectedFiles->next() ) | 1315 | if ( !d->selectedFiles->next() ) |
1314 | d->selectedFiles->first(); | 1316 | d->selectedFiles->first(); |
1315 | 1317 | ||
1316 | break; | 1318 | break; |
1317 | case Key_Up: | 1319 | case Key_Up: |
1318 | if ( !d->selectedFiles->prev() ) | 1320 | if ( !d->selectedFiles->prev() ) |
1319 | // d->selectedFiles->last(); | 1321 | // d->selectedFiles->last(); |
1320 | 1322 | ||
1321 | break; | 1323 | break; |
1322 | 1324 | ||
1323 | } | 1325 | } |
1324 | } | 1326 | } |
1325 | 1327 | ||
1326 | void PlayListWidget::keyPressEvent( QKeyEvent *) | 1328 | void PlayListWidget::keyPressEvent( QKeyEvent *) |
1327 | { | 1329 | { |
1328 | // qDebug("Key press"); | 1330 | // odebug << "Key press" << oendl; |
1329 | // switch ( e->key() ) { | 1331 | // switch ( e->key() ) { |
1330 | // ////////////////////////////// Zaurus keys | 1332 | // ////////////////////////////// Zaurus keys |
1331 | // case Key_A: //add to playlist | 1333 | // case Key_A: //add to playlist |
1332 | // qDebug("Add"); | 1334 | // odebug << "Add" << oendl; |
1333 | // addSelected(); | 1335 | // addSelected(); |
1334 | // break; | 1336 | // break; |
1335 | // case Key_R: //remove from playlist | 1337 | // case Key_R: //remove from playlist |
1336 | // removeSelected(); | 1338 | // removeSelected(); |
1337 | // break; | 1339 | // break; |
1338 | // case Key_P: //play | 1340 | // case Key_P: //play |
1339 | // qDebug("Play"); | 1341 | // odebug << "Play" << oendl; |
1340 | // playSelected(); | 1342 | // playSelected(); |
1341 | // break; | 1343 | // break; |
1342 | // case Key_Space: | 1344 | // case Key_Space: |
1343 | // qDebug("Play"); | 1345 | // odebug << "Play" << oendl; |
1344 | // playSelected(); | 1346 | // playSelected(); |
1345 | // break; | 1347 | // break; |
1346 | // } | 1348 | // } |
1347 | } | 1349 | } |
1348 | 1350 | ||
1349 | void PlayListWidget::doBlank() { | 1351 | void PlayListWidget::doBlank() { |
1350 | // qDebug("do blanking"); | 1352 | // odebug << "do blanking" << oendl; |
1351 | #ifdef QT_QWS_DEVFS | 1353 | #ifdef QT_QWS_DEVFS |
1352 | fd=open("/dev/fb/0",O_RDWR); | 1354 | fd=open("/dev/fb/0",O_RDWR); |
1353 | #else | 1355 | #else |
1354 | fd=open("/dev/fb0",O_RDWR); | 1356 | fd=open("/dev/fb0",O_RDWR); |
1355 | #endif | 1357 | #endif |
1356 | if (fd != -1) { | 1358 | if (fd != -1) { |
1357 | ioctl(fd,FBIOBLANK,1); | 1359 | ioctl(fd,FBIOBLANK,1); |
1358 | // close(fd); | 1360 | // close(fd); |
1359 | } | 1361 | } |
1360 | } | 1362 | } |
1361 | 1363 | ||
1362 | void PlayListWidget::doUnblank() { | 1364 | void PlayListWidget::doUnblank() { |
1363 | // this crashes opieplayer with a segfault | 1365 | // this crashes opieplayer with a segfault |
1364 | // int fd; | 1366 | // int fd; |
1365 | // fd=open("/dev/fb0",O_RDWR); | 1367 | // fd=open("/dev/fb0",O_RDWR); |
1366 | // qDebug("do unblanking"); | 1368 | // odebug << "do unblanking" << oendl; |
1367 | if (fd != -1) { | 1369 | if (fd != -1) { |
1368 | ioctl(fd,FBIOBLANK,0); | 1370 | ioctl(fd,FBIOBLANK,0); |
1369 | close(fd); | 1371 | close(fd); |
1370 | } | 1372 | } |
1371 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | 1373 | QCopEnvelope h("QPE/System", "setBacklight(int)"); |
1372 | h <<-3;// v[1]; // -3 Force on | 1374 | h <<-3;// v[1]; // -3 Force on |
1373 | } | 1375 | } |
1374 | 1376 | ||
@@ -1383,17 +1385,17 @@ void PlayListWidget::populateSkinsMenu() { | |||
1383 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); | 1385 | QDir skinsDir( QPEApplication::qpeDir() + "/pics/opieplayer2/skins" ); |
1384 | skinsDir.setFilter( QDir::Dirs ); | 1386 | skinsDir.setFilter( QDir::Dirs ); |
1385 | skinsDir.setSorting(QDir::Name ); | 1387 | skinsDir.setSorting(QDir::Name ); |
1386 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); | 1388 | const QFileInfoList *skinslist = skinsDir.entryInfoList(); |
1387 | QFileInfoListIterator it( *skinslist ); | 1389 | QFileInfoListIterator it( *skinslist ); |
1388 | QFileInfo *fi; | 1390 | QFileInfo *fi; |
1389 | while ( ( fi = it.current() ) ) { | 1391 | while ( ( fi = it.current() ) ) { |
1390 | skinName = fi->fileName(); | 1392 | skinName = fi->fileName(); |
1391 | // qDebug( fi->fileName() ); | 1393 | // odebug << fi->fileName() << oendl; |
1392 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { | 1394 | if( skinName != "." && skinName != ".." && skinName !="CVS" ) { |
1393 | item = skinsMenu->insertItem( fi->fileName() ) ; | 1395 | item = skinsMenu->insertItem( fi->fileName() ) ; |
1394 | } | 1396 | } |
1395 | if( skinName == "default" ) { | 1397 | if( skinName == "default" ) { |
1396 | defaultSkinIndex = item; | 1398 | defaultSkinIndex = item; |
1397 | } | 1399 | } |
1398 | if( skinName == skin ) { | 1400 | if( skinName == skin ) { |
1399 | skinsMenu->setItemChecked( item, TRUE ); | 1401 | skinsMenu->setItemChecked( item, TRUE ); |
@@ -1409,28 +1411,28 @@ void PlayListWidget::skinsMenuActivated( int item ) { | |||
1409 | skinsMenu->setItemChecked( item, TRUE ); | 1411 | skinsMenu->setItemChecked( item, TRUE ); |
1410 | 1412 | ||
1411 | Config cfg( "OpiePlayer" ); | 1413 | Config cfg( "OpiePlayer" ); |
1412 | cfg.setGroup("Options"); | 1414 | cfg.setGroup("Options"); |
1413 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); | 1415 | cfg.writeEntry("Skin", skinsMenu->text( item ) ); |
1414 | } | 1416 | } |
1415 | 1417 | ||
1416 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { | 1418 | void PlayListWidget::qcopReceive(const QCString &msg, const QByteArray &data) { |
1417 | // qDebug("qcop message "+msg ); | 1419 | // odebug << "qcop message "+msg << oendl; |
1418 | QDataStream stream ( data, IO_ReadOnly ); | 1420 | QDataStream stream ( data, IO_ReadOnly ); |
1419 | if ( msg == "play()" ) { //plays current selection | 1421 | if ( msg == "play()" ) { //plays current selection |
1420 | btnPlay( true); | 1422 | btnPlay( true); |
1421 | } else if ( msg == "stop()" ) { | 1423 | } else if ( msg == "stop()" ) { |
1422 | mediaPlayerState->setPlaying( false); | 1424 | mediaPlayerState->setPlaying( false); |
1423 | } else if ( msg == "togglePause()" ) { | 1425 | } else if ( msg == "togglePause()" ) { |
1424 | mediaPlayerState->togglePaused(); | 1426 | mediaPlayerState->togglePaused(); |
1425 | } else if ( msg == "next()" ) { //select next in lis | 1427 | } else if ( msg == "next()" ) { //select next in lis |
1426 | mediaPlayerState->setNext(); | 1428 | mediaPlayerState->setNext(); |
1427 | } else if ( msg == "prev()" ) { //select previous in list | 1429 | } else if ( msg == "prev()" ) { //select previous in list |
1428 | mediaPlayerState->setPrev(); | 1430 | mediaPlayerState->setPrev(); |
1429 | } else if ( msg == "toggleLooping()" ) { //loop or not loop | 1431 | } else if ( msg == "toggleLooping()" ) { //loop or not loop |
1430 | mediaPlayerState->toggleLooping(); | 1432 | mediaPlayerState->toggleLooping(); |
1431 | } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled | 1433 | } else if ( msg == "toggleShuffled()" ) { //shuffled or not shuffled |
1432 | mediaPlayerState->toggleShuffled(); | 1434 | mediaPlayerState->toggleShuffled(); |
1433 | } else if ( msg == "volUp()" ) { //volume more | 1435 | } else if ( msg == "volUp()" ) { //volume more |
1434 | // emit moreClicked(); | 1436 | // emit moreClicked(); |
1435 | // emit moreReleased(); | 1437 | // emit moreReleased(); |
1436 | } else if ( msg == "volDown()" ) { //volume less | 1438 | } else if ( msg == "volDown()" ) { //volume less |