summaryrefslogtreecommitdiff
path: root/core
authorllornkcor <llornkcor>2002-03-20 02:07:17 (UTC)
committer llornkcor <llornkcor>2002-03-20 02:07:17 (UTC)
commitea1f3581a3452f735bb0cf5703b9bf1b20316b71 (patch) (side-by-side diff)
treead31a417eee542534b42ed229d70cae834414e9d /core
parent25653ee75580cdd24a16e82abe7271c9402429c7 (diff)
downloadopie-ea1f3581a3452f735bb0cf5703b9bf1b20316b71.zip
opie-ea1f3581a3452f735bb0cf5703b9bf1b20316b71.tar.gz
opie-ea1f3581a3452f735bb0cf5703b9bf1b20316b71.tar.bz2
added slight workaround for audio/video playig continuing in playlist
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistselection.cpp6
-rw-r--r--core/multimedia/opieplayer/playlistselection.h1
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp8
3 files changed, 11 insertions, 4 deletions
diff --git a/core/multimedia/opieplayer/playlistselection.cpp b/core/multimedia/opieplayer/playlistselection.cpp
index 756e3b4..6259b3f 100644
--- a/core/multimedia/opieplayer/playlistselection.cpp
+++ b/core/multimedia/opieplayer/playlistselection.cpp
@@ -116,68 +116,72 @@ void PlayListSelection::removeSelected() {
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() );
ensureItemVisible( selectedItem() );
}
bool PlayListSelection::prev() {
QListViewItem *item = selectedItem();
if ( item && item->itemAbove() )
setSelected( item->itemAbove(), TRUE );
else
return FALSE;
ensureItemVisible( selectedItem() );
return TRUE;
}
-
bool PlayListSelection::next() {
QListViewItem *item = selectedItem();
if ( item && item->itemBelow() )
setSelected( item->itemBelow(), TRUE );
else
return FALSE;
ensureItemVisible( selectedItem() );
return TRUE;
}
bool PlayListSelection::first() {
QListViewItem *item = firstChild();
if ( item )
setSelected( item, TRUE );
else
return FALSE;
ensureItemVisible( selectedItem() );
return TRUE;
}
bool PlayListSelection::last() {
QListViewItem *prevItem = NULL;
QListViewItem *item = firstChild();
while ( ( item = item->nextSibling() ) )
prevItem = item;
if ( prevItem )
setSelected( prevItem, TRUE );
else
return FALSE;
ensureItemVisible( selectedItem() );
return TRUE;
}
+void PlayListSelection::unSelect()
+{
+ QListViewItem *item = selectedItem();
+ setSelected( currentItem(), FALSE);
+} \ No newline at end of file
diff --git a/core/multimedia/opieplayer/playlistselection.h b/core/multimedia/opieplayer/playlistselection.h
index b0d249c..ba37271 100644
--- a/core/multimedia/opieplayer/playlistselection.h
+++ b/core/multimedia/opieplayer/playlistselection.h
@@ -8,53 +8,54 @@
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#ifndef PLAY_LIST_SELECTION_H
#define PLAY_LIST_SELECTION_H
#include <qlist.h>
#include <qlistview.h>
#include <qpe/applnk.h>
class PlayListSelection : public QListView {
Q_OBJECT
public:
PlayListSelection( QWidget *parent, const char *name=0 );
~PlayListSelection();
const DocLnk *current(); // retrieve the current playlist entry (media file link)
public slots:
void addToSelection( const DocLnk & ); // Add a media file to the playlist
void removeSelected(); // Remove a media file from the playlist
void moveSelectedUp(); // Move the media file up the playlist so it is played earlier
void moveSelectedDown(); // Move the media file down the playlist so it is played later
+ void unSelect();
bool prev();
bool next();
bool first();
bool last();
protected:
virtual void contentsMouseMoveEvent(QMouseEvent *);
/* #ifdef USE_PLAYLIST_BACKGROUND */
virtual void drawBackground( QPainter *p, const QRect &r );
virtual void paintEmptyArea( QPainter *p, const QRect &r ) { drawBackground( p, r ); };
/* #endif */
private:
QList<DocLnk> selectedList;
const DocLnk *lnk;
};
#endif // PLAY_LIST_SELECTION_H
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index cf665c8..db6533a 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -142,65 +142,65 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
d->tbPlay = new ToolButton( bar, tr( "Play" ), "mpegplayer/play",
this , SLOT( btnPlay(bool) ), TRUE );
d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"mpegplayer/shuffle",
mediaPlayerState, SLOT(setShuffled(bool)), TRUE );
d->tbLoop = new ToolButton( bar, tr( "Loop" ),"mpegplayer/loop",
mediaPlayerState, SLOT(setLooping(bool)), TRUE );
tbDeletePlaylist->hide();
QPopupMenu *pmPlayList = new QPopupMenu( this );
menu->insertItem( tr( "File" ), pmPlayList );
new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) );
new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) );
new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) );
new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) );
new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) );
// new MenuItem( pmPlayList, tr( "Load PlayList" ), this, SLOT( loadList() ) );
QPopupMenu *pmView = new QPopupMenu( this );
menu->insertItem( tr( "View" ), pmView );
fullScreenButton = new QAction(tr("Full Screen"), Resource::loadPixmap("fullscreen"), QString::null, 0, this, 0);
connect( fullScreenButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleFullscreen()) );
fullScreenButton->addTo(pmView);
scaleButton = new QAction(tr("Scale"), Resource::loadPixmap("mpegplayer/scale"), QString::null, 0, this, 0);
connect( scaleButton, SIGNAL(activated()), mediaPlayerState, SLOT(toggleScaled()) );
scaleButton->addTo(pmView);
QVBox *vbox5 = new QVBox( this ); vbox5->setBackgroundMode( PaletteButton );
QVBox *vbox4 = new QVBox( vbox5 ); vbox4->setBackgroundMode( PaletteButton );
QHBox *hbox6 = new QHBox( vbox4 ); hbox6->setBackgroundMode( PaletteButton );
- tabWidget = new QTabWidget( hbox6, "tabWidget" );
+ tabWidget = new QTabWidget( hbox6, "tabWidget" );
tabWidget->setTabShape(QTabWidget::Triangular);
QWidget *pTab;
pTab = new QWidget( tabWidget, "pTab" );
// playlistView = new QListView( pTab, "playlistview" );
// playlistView->setMinimumSize(236,260);
tabWidget->insertTab( pTab,"Playlist");
// Add the playlist area
QVBox *vbox3 = new QVBox( pTab ); vbox3->setBackgroundMode( PaletteButton );
d->playListFrame = vbox3;
d->playListFrame ->setMinimumSize(235,260);
QHBox *hbox2 = new QHBox( vbox3 ); hbox2->setBackgroundMode( PaletteButton );
d->selectedFiles = new PlayListSelection( hbox2);
QVBox *vbox1 = new QVBox( hbox2 ); vbox1->setBackgroundMode( PaletteButton );
QPEApplication::setStylusOperation( d->selectedFiles->viewport(),QPEApplication::RightOnHold);
connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
this,SLOT( playlistViewPressed(int, QListViewItem *, const QPoint&, int)) );
QVBox *stretch1 = new QVBox( vbox1 ); stretch1->setBackgroundMode( PaletteButton ); // add stretch
new ToolButton( vbox1, tr( "Move Up" ), "mpegplayer/up", d->selectedFiles, SLOT(moveSelectedUp()) );
new ToolButton( vbox1, tr( "Remove" ), "mpegplayer/cut", d->selectedFiles, SLOT(removeSelected()) );
new ToolButton( vbox1, tr( "Move Down" ), "mpegplayer/down", d->selectedFiles, SLOT(moveSelectedDown()) );
QVBox *stretch2 = new QVBox( vbox1 ); stretch2->setBackgroundMode( PaletteButton ); // add stretch
QWidget *aTab;
@@ -453,76 +453,76 @@ void PlayListWidget::setDocument(const QString& fileref) {
setCaption("OpiePlayer");
} else { //is playlist
clearList();
loadList(DocLnk(fileref));
d->selectedFiles->first();
}
}
void PlayListWidget::setActiveWindow() {
// When we get raised we need to ensure that it switches views
char origView = mediaPlayerState->view();
mediaPlayerState->setView( 'l' ); // invalidate
mediaPlayerState->setView( origView ); // now switch back
}
void PlayListWidget::useSelectedDocument() {
d->setDocumentUsed = FALSE;
}
const DocLnk *PlayListWidget::current() { // this is fugly
// if( fromSetDocument) {
// qDebug("from setDoc");
// DocLnkSet files;
// Global::findDocuments(&files, "video/*;audio/*");
// QListIterator<DocLnk> dit( files.children() );
// for ( ; dit.current(); ++dit ) {
// if(dit.current()->linkFile() == setDocFileRef) {
-// qDebug(setDocFileRef);
+// qDebug(setDocFileRef);
// return dit;
// }
// }
// } else
// qDebug("current");
// switch (tabWidget->currentPageIndex()) {
// case 0: //playlist
// {
qDebug("playlist");
if ( mediaPlayerState->playlist() ) {
- return d->selectedFiles->current();
+ return d->selectedFiles->current();
}
else if ( d->setDocumentUsed && d->current ) {
return d->current;
} else {
return d->files->selected();
}
// }
// break;
// case 1://audio
// {
// qDebug("audioView");
// Global::findDocuments(&files, "audio/*");
// QListIterator<DocLnk> dit( files.children() );
// for ( ; dit.current(); ++dit ) {
// if( dit.current()->name() == audioView->currentItem()->text(0) && !insanityBool) {
// qDebug("here");
// insanityBool=TRUE;
// return dit;
// }
// }
// }
// break;
// case 2: // video
// {
// qDebug("videoView");
// Global::findDocuments(&vFiles, "video/*");
// QListIterator<DocLnk> Vdit( vFiles.children() );
// for ( ; Vdit.current(); ++Vdit ) {
// if( Vdit.current()->name() == videoView->currentItem()->text(0) && !insanityBool) {
// insanityBool=TRUE;
// return Vdit;
// }
@@ -784,74 +784,76 @@ void PlayListWidget::tabChanged(QWidget *widg) {
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
}
break;
case 3:
{
if( tbDeletePlaylist->isHidden())
tbDeletePlaylist->show();
playLists->reread();
}
break;
};
}
/*
play button is pressed*/
void PlayListWidget::btnPlay(bool b) {
// mediaPlayerState->setPlaying(b);
switch ( tabWidget->currentPageIndex()) {
case 0:
{
mediaPlayerState->setPlaying(b);
}
break;
case 1:
{
addToSelection( audioView->selectedItem() );
mediaPlayerState->setPlaying(b);
// qApp->processEvents();
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(1);
+ d->selectedFiles->unSelect();
// mediaPlayerState->setPlaying(FALSE);
}
break;
case 2:
{
addToSelection( videoView->selectedItem() );
mediaPlayerState->setPlaying(b);
qApp->processEvents();
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(2);
+ d->selectedFiles->unSelect();
// mediaPlayerState->setPlaying(FALSE);
}
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->selected()->file());
QFile().remove(playLists->selected()->linkFile());
playLists->reread();
break;
case 1: // Cancel
break;
};
}
void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
{
switch (mouse) {
case 1:
break;
case 2:{
QPopupMenu m;