summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-09-11 00:51:09 (UTC)
committer llornkcor <llornkcor>2002-09-11 00:51:09 (UTC)
commit6013fac8a6ea871453565faf0f8b51c62465cf71 (patch) (side-by-side diff)
treee93c0418bef8bd0f1ebcbd8dda42111ba4aeefba
parentd478be344e2ba383a1e38d2a1705de1cdbe2e838 (diff)
downloadopie-6013fac8a6ea871453565faf0f8b51c62465cf71.zip
opie-6013fac8a6ea871453565faf0f8b51c62465cf71.tar.gz
opie-6013fac8a6ea871453565faf0f8b51c62465cf71.tar.bz2
fix for 2.3.4
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp39
1 files changed, 5 insertions, 34 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 8d66407..5be0d6d 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -256,139 +256,116 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
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->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"));
-// populateVideoView();
-//playlists list
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( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
-
-// add the library area
-
-// connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
-// this, SLOT( fauxPlay( QListViewItem *) ) );
-// connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)),
-// this, SLOT( fauxPlay( QListViewItem *)) );
-
-// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
-// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
-
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)) );
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 *) ) );
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 *) ) );
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 *) ) );
-// connect( d->selectedFiles, SIGNAL( fileSelected( const DocLnk & ) ), this, SLOT( addToSelection( const DocLnk & ) ) );
setCentralWidget( vbox5 );
Config cfg( "OpiePlayer" );
readConfig( cfg );
QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
-// qDebug("currentList is "+currentPlaylist);
loadList(DocLnk( currentPlaylist));
setCaption(tr("OpiePlayer: ")+ currentPlaylist );
initializeStates();
}
PlayListWidget::~PlayListWidget() {
Config cfg( "OpiePlayer" );
writeConfig( cfg );
if ( d->current )
delete d->current;
delete d;
}
void PlayListWidget::initializeStates() {
d->tbPlay->setOn( mediaPlayerState->playing() );
d->tbLoop->setOn( mediaPlayerState->looping() );
d->tbShuffle->setOn( mediaPlayerState->shuffled() );
-// d->tbFull->setOn( mediaPlayerState->fullscreen() );
-// d->tbScale->setOn( mediaPlayerState->scaled() );
-// d->tbScale->setEnabled( mediaPlayerState->fullscreen() );
-// setPlaylist( mediaPlayerState->playlist() );
setPlaylist( true);
-// d->selectedFiles->first();
-
}
void PlayListWidget::readConfig( Config& cfg ) {
cfg.setGroup("PlayList");
QString currentString = cfg.readEntry("current", "" );
int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
for ( int i = 0; i < noOfFiles; i++ ) {
QString entryName;
entryName.sprintf( "File%i", i + 1 );
QString linkFile = cfg.readEntry( entryName );
DocLnk lnk( linkFile );
if ( lnk.isValid() ) {
d->selectedFiles->addToSelection( lnk );
}
}
d->selectedFiles->setSelectedItem( currentString);
-// d->selectedFiles->setSelectedItem( (const QString &)currentString);
}
void PlayListWidget::writeConfig( Config& cfg ) const {
d->selectedFiles->writeCurrent( cfg);
cfg.setGroup("PlayList");
int noOfFiles = 0;
d->selectedFiles->first();
do {
const DocLnk *lnk = d->selectedFiles->current();
if ( lnk ) {
QString entryName;
entryName.sprintf( "File%i", noOfFiles + 1 );
// qDebug(entryName);
cfg.writeEntry( entryName, lnk->linkFile() );
@@ -403,46 +380,39 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
"the playlist.\n"
"Your playlist "
"may be missing some entries\n"
"the next time you start it." )
);
}
}
noOfFiles++;
}
}
while ( d->selectedFiles->next() );
cfg.writeEntry("NumberOfFiles", noOfFiles );
}
void PlayListWidget::addToSelection( const DocLnk& lnk ) {
-// qDebug("add");
-// if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) {
-// QMessageBox::message("Note","You are trying to play\na malformed url.");
-
-// } else {
-
d->setDocumentUsed = FALSE;
if ( mediaPlayerState->playlist() ) {
if(QFileInfo(lnk.file()).exists() || lnk.file().left(4) == "http" )
d->selectedFiles->addToSelection( lnk );
}
else
mediaPlayerState->setPlaying( TRUE );
-// }
}
void PlayListWidget::clearList() {
while ( first() )
d->selectedFiles->removeSelected();
}
void PlayListWidget::addAllToList() {
DocLnkSet filesAll;
Global::findDocuments(&filesAll, "video/*;audio/*");
QListIterator<DocLnk> Adit( filesAll.children() );
for ( ; Adit.current(); ++Adit )
if(QFileInfo(Adit.current()->file()).exists())
d->selectedFiles->addToSelection( **Adit );
@@ -524,33 +494,33 @@ const DocLnk *PlayListWidget::current() { // this is fugly
// return dit;
// }
// }
// } else
switch (tabWidget->currentPageIndex()) {
case 0: //playlist
{
qDebug("playlist");
if ( mediaPlayerState->playlist() ) {
return d->selectedFiles->current();
}
else if ( d->setDocumentUsed && d->current ) {
return d->current;
} else {
- return d->files->selected();
+ return &(d->files->selectedDocument());
}
}
break;
case 1://audio
{
qDebug("audioView");
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;
@@ -880,35 +850,35 @@ void PlayListWidget::btnPlay(bool b) {
qApp->processEvents();
d->selectedFiles->removeSelected( );
tabWidget->setCurrentPage(2);
d->selectedFiles->unSelect();
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->selected()->file());
- QFile().remove(playLists->selected()->linkFile());
- playLists->reread();
+// 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;
m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
@@ -1023,32 +993,33 @@ void PlayListWidget::populateAudioView() {
QString storage;
for ( ; dit.current(); ++dit ) {
for( ; it.current(); ++it ){
const QString name = (*it)->name();
const QString path = (*it)->path();
if(dit.current()->file().find(path) != -1 ) storage=name;
}
QListViewItem * newItem;
if ( QFile( dit.current()->file()).exists() || dit.current()->file().left(4) == "http" ) {
long size;
if( dit.current()->file().left(4) == "http" )
size=0;
else
size = QFile( dit.current()->file() ).size();
+ qDebug(dit.current()->name());
newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
QString::number(size ), storage);
newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/musicfile" ));
}
}
}
void PlayListWidget::populateVideoView() {
videoView->clear();
StorageInfo storageInfo;
const QList<FileSystem> &fs = storageInfo.fileSystems();
if(!videoScan ) scanForVideo();
QListIterator<DocLnk> Vdit( vFiles.children() );