-rw-r--r-- | core/multimedia/opieplayer/playlistselection.cpp | 11 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 22 |
2 files changed, 21 insertions, 12 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp index 85228a9..67187f8 100644 --- a/core/multimedia/opieplayer/playlistselection.cpp +++ b/core/multimedia/opieplayer/playlistselection.cpp @@ -42,94 +42,95 @@ public: ~PlayListSelectionItem() { }; const DocLnk *file() const { return fl; } private: const DocLnk *fl; }; PlayListSelection::PlayListSelection( QWidget *parent, const char *name ) : QListView( parent, name ) { // qDebug("starting playlistselector"); // #ifdef USE_PLAYLIST_BACKGROUND // setStaticBackground( TRUE ); // setBackgroundPixmap( Resource::loadPixmap( "opieplayer/background" ) ); // setBackgroundPixmap( Resource::loadPixmap( "launcher/opielogo" ) ); // #endif // addColumn("Title",236); // setAllColumnsShowFocus( TRUE ); addColumn( tr( "Playlist Selection" ) ); header()->hide(); - setSorting( -1, FALSE ); +// setSorting( -1, FALSE ); + // FIXME } PlayListSelection::~PlayListSelection() { } // #ifdef USE_PLAYLIST_BACKGROUND void PlayListSelection::drawBackground( QPainter *p, const QRect &r ) { // qDebug("drawBackground"); p->fillRect( r, QBrush( white ) ); // QImage logo = Resource::loadImage( "launcher/opielogo" ); // if ( !logo.isNull() ) // p->drawImage( (width() - logo.width()) / 2, (height() - logo.height()) / 2, logo ); } // #endif void PlayListSelection::contentsMouseMoveEvent( QMouseEvent *event ) { if ( event->state() == QMouseEvent::LeftButton ) { QListViewItem *currentItem = selectedItem(); QListViewItem *itemUnder = itemAt( QPoint( event->pos().x(), event->pos().y() - contentsY() ) ); if ( currentItem && currentItem->itemAbove() == itemUnder ) moveSelectedUp(); else if ( currentItem && currentItem->itemBelow() == itemUnder ) moveSelectedDown(); } } const DocLnk *PlayListSelection::current() { PlayListSelectionItem *item = (PlayListSelectionItem *)selectedItem(); if ( item ) return item->file(); return NULL; } void PlayListSelection::addToSelection( const DocLnk &lnk ) { PlayListSelectionItem *item = new PlayListSelectionItem( this, new DocLnk( lnk ) ); - QListViewItem *current = selectedItem(); - if ( current ) - item->moveItem( current ); + QListViewItem *current = selectedItem(); + if ( current ) + item->moveItem( current ); setSelected( item, TRUE ); - ensureItemVisible( selectedItem() ); + ensureItemVisible( item); } void PlayListSelection::removeSelected() { QListViewItem *item = selectedItem(); if ( item ) delete item; setSelected( currentItem(), TRUE ); ensureItemVisible( selectedItem() ); } void PlayListSelection::moveSelectedUp() { QListViewItem *item = selectedItem(); if ( item && item->itemAbove() ) item->itemAbove()->moveItem( item ); ensureItemVisible( selectedItem() ); } void PlayListSelection::moveSelectedDown() { QListViewItem *item = selectedItem(); if ( item && item->itemBelow() ) item->moveItem( item->itemBelow() ); diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 395037f..19c8056 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -238,102 +238,109 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch new ToolButton( vbox1, tr( "Move Up" ), "opieplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) ); new ToolButton( vbox1, tr( "Remove" ), "opieplayer/cut", d->selectedFiles, SLOT(removeSelected()) ); new ToolButton( vbox1, tr( "Move Down" ), "opieplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) ); QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch QWidget *aTab; aTab = new QWidget( tabWidget, "aTab" ); audioView = new QListView( aTab, "Audioview" ); audioView->setMinimumSize(233,260); audioView->addColumn( tr("Title"),140); audioView->addColumn(tr("Size"), -1); audioView->addColumn(tr("Media"),-1); audioView->addColumn( tr( "Path" ), 0 ); audioView->setColumnAlignment(1, Qt::AlignRight); audioView->setColumnAlignment(2, Qt::AlignRight); audioView->setAllColumnsShowFocus(TRUE); audioView->setMultiSelection( TRUE ); audioView->setSelectionMode( QListView::Extended); + audioView->setSorting( 3, TRUE ); tabWidget->insertTab(aTab,tr("Audio")); QPEApplication::setStylusOperation( audioView->viewport(),QPEApplication::RightOnHold); // audioView // populateAudioView(); // videowidget QWidget *vTab; vTab = new QWidget( tabWidget, "vTab" ); videoView = new QListView( vTab, "Videoview" ); videoView->setMinimumSize(233,260); videoView->addColumn(tr("Title"),140); videoView->addColumn(tr("Size"),-1); videoView->addColumn(tr("Media"),-1); videoView->addColumn(tr( "Path" ), 0 ); videoView->setColumnAlignment(1, Qt::AlignRight); videoView->setColumnAlignment(2, Qt::AlignRight); videoView->setAllColumnsShowFocus(TRUE); videoView->setMultiSelection( TRUE ); videoView->setSelectionMode( QListView::Extended); QPEApplication::setStylusOperation( videoView->viewport(),QPEApplication::RightOnHold); tabWidget->insertTab( vTab,tr("Video")); QWidget *LTab; LTab = new QWidget( tabWidget, "LTab" ); playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy playLists->setMinimumSize(233,260); tabWidget->insertTab(LTab,tr("Lists")); connect(tbDeletePlaylist,(SIGNAL(released())),SLOT( deletePlaylist())); connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) ); connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) ); connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) ); + +///audioView connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); connect( audioView, SIGNAL( returnPressed( QListViewItem *)), this,SLOT( playIt( QListViewItem *)) ); connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); + +//videoView connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), this,SLOT( viewPressed(int, QListViewItem *, const QPoint&, int)) ); connect( videoView, SIGNAL( returnPressed( QListViewItem *)), this,SLOT( playIt( QListViewItem *)) ); connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( addToSelection( QListViewItem *) ) ); + +//playlists connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); connect( tabWidget, SIGNAL (currentChanged(QWidget*)),this,SLOT(tabChanged(QWidget*))); // connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), d->tbPlay, SLOT( setOn( bool ) ) ); connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), d->tbLoop, SLOT( setOn( bool ) ) ); connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), d->tbShuffle, SLOT( setOn( bool ) ) ); connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), this, SLOT( setPlaylist( bool ) ) ); connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); setCentralWidget( vbox5 ); Config cfg( "OpiePlayer" ); readConfig( cfg ); QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); loadList(DocLnk( currentPlaylist)); setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); initializeStates(); } @@ -786,66 +793,67 @@ void PlayListWidget::tabChanged(QWidget *) { break; }; } void PlayListWidget::btnPlay(bool b) { qDebug("<<<<<<<<<<<<<<<BtnPlay"); // mediaPlayerState->setPlaying(b); switch ( tabWidget->currentPageIndex()) { case 0: { qDebug("1"); // if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 // if( d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { // QMessageBox::message("Note","You are trying to play\na malformed url."); // } else { mediaPlayerState->setPlaying(b); insanityBool=FALSE; qDebug("insanity"); // } } break; case 1: { qDebug("2"); +// d->selectedFiles->unSelect(); addToSelection( audioView->currentItem() ); - mediaPlayerState->setPlaying(b); - d->selectedFiles->removeSelected( ); - tabWidget->setCurrentPage(1); - d->selectedFiles->unSelect(); + mediaPlayerState->setPlaying(true); + d->selectedFiles->removeSelected( ); + d->selectedFiles->unSelect(); + tabWidget->setCurrentPage(1); insanityBool=FALSE; }// audioView->clearSelection(); break; case 2: { qDebug("3"); addToSelection( videoView->currentItem() ); - mediaPlayerState->setPlaying(b); - qApp->processEvents(); + mediaPlayerState->setPlaying(true); +// qApp->processEvents(); d->selectedFiles->removeSelected( ); - tabWidget->setCurrentPage(2); d->selectedFiles->unSelect(); + tabWidget->setCurrentPage(2); insanityBool=FALSE; }// videoView->clearSelection(); break; }; } void PlayListWidget::deletePlaylist() { switch( QMessageBox::information( this, (tr("Remove Playlist?")), (tr("You really want to delete\nthis playlist?")), (tr("Yes")), (tr("No")), 0 )){ case 0: // Yes clicked, QFile().remove(playLists->selectedDocument().file()); QFile().remove(playLists->selectedDocument().linkFile()); playLists->reread(); break; case 1: // Cancel break; }; } void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint&, int ) { switch (mouse) { |