summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h4
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp18
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h2
4 files changed, 14 insertions, 12 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp
index 2726296..1e2ef89 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.cpp
+++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp
@@ -1,31 +1,31 @@
#include "playlistfileview.h"
#include <qpe/global.h>
PlayListFileView::PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name )
- : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern )
+ : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_scannedFiles( false )
{
addColumn( tr( "Title" ), 140);
addColumn( tr( "Size" ), -1 );
addColumn(tr( "Media" ), 0 );
addColumn(tr( "Path" ), -1 );
setColumnAlignment( 1, Qt::AlignRight );
setColumnAlignment( 2, Qt::AlignRight );
setAllColumnsShowFocus( TRUE );
setSorting( 3, TRUE );
setMultiSelection( TRUE );
setSelectionMode( QListView::Extended );
}
PlayListFileView::~PlayListFileView()
{
}
void PlayListFileView::scanFiles()
{
m_files.detachChildren();
QListIterator<DocLnk> sdit( m_files.children() );
for ( ; sdit.current(); ++sdit )
delete sdit.current();
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index 08db929..4e17966 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -1,27 +1,31 @@
#ifndef PLAYLISTFILEVIEW_H
#define PLAYLISTFILEVIEW_H
#include "playlistview.h"
#include <qpe/applnk.h>
class PlayListFileView : public PlayListView
{
Q_OBJECT
public:
PlayListFileView( const QString &mimeTypePattern, QWidget *parent, const char *name = 0 );
virtual ~PlayListFileView();
+ // both temporarily accessible that way until the caller code has
+ // been migrated into this class
DocLnkSet &files() { return m_files; }
+ bool &scannedFiles() { return m_scannedFiles; }
public slots:
void scanFiles();
private:
QString m_mimeTypePattern;
DocLnkSet m_files;
+ bool m_scannedFiles;
};
#endif // PLAYLISTFILEVIEW_H
/* vim: et sw=4 ts=4
*/
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 93e7919..12b8a71 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -130,50 +130,48 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
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( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ),
this, SLOT( playIt( QListViewItem *) ) );
connect ( gammaSlider, SIGNAL( valueChanged( int ) ),
&mediaPlayerState, SLOT( setVideoGamma( int ) ) );
// see which skins are installed
- videoScan=false;
- audioScan=false;
audioPopulated=false;
videoPopulated=false;
populateSkinsMenu();
initializeStates();
cfg.setGroup("PlayList");
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
loadList(DocLnk( currentPlaylist ) );
}
PlayListWidget::~PlayListWidget() {
delete d;
}
void PlayListWidget::initializeStates() {
d->tbPlay->setOn( mediaPlayerState.isPlaying() );
d->tbLoop->setOn( mediaPlayerState.isLooping() );
d->tbShuffle->setOn( mediaPlayerState.isShuffled() );
d->playListFrame->show();
}
void PlayListWidget::writeDefaultPlaylist() {
@@ -233,142 +231,142 @@ void PlayListWidget::viewPressed( int mouse, QListViewItem *, const QPoint& , in
}
void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoint& , int ) {
switch (mouse) {
case 1:
break;
case 2:
{
QPopupMenu m;
m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
m.exec( QCursor::pos() );
}
break;
}
}
void PlayListWidget::addAllToList() {
// QTime t;
// t.start();
- if(!audioScan) {
+ if(!audioView->scannedFiles()) {
if(audioView->childCount() < 1)
populateAudioView();
}
QListViewItemIterator audioIt( audioView );
DocLnk lnk;
QString filename;
// iterate through all items of the listview
for ( ; audioIt.current(); ++audioIt ) {
filename = audioIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
- if(!videoScan) {
+ if(!videoView->scannedFiles()) {
if(videoView->childCount() < 1)
populateVideoView();
}
QListViewItemIterator videoIt( videoView );
for ( ; videoIt.current(); ++videoIt ) {
filename = videoIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
// d->selectedFiles->addToSelection( );
// if ( it.current()->isSelected() )
// lst->append( audioIt.current() );
// }
// if(!audioScan)
// scanForAudio();
// if(!videoScan)
// scanForVideo();
// DocLnkSet filesAll;
// Global::findDocuments(&filesAll, "video/*;"+audioMimes);
// QListIterator<DocLnk> Adit( filesAll.children() );
// for ( ; Adit.current(); ++Adit ) {
// if( QFileInfo( Adit.current()->file() ).exists() ) {
// d->selectedFiles->addToSelection( **Adit );
// }
// }
// qDebug("elapsed time %d", t.elapsed() );
tabWidget->setCurrentPage(0);
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::addAllMusicToList() {
- if(!audioScan) {
+ if(!audioView->scannedFiles()) {
if(audioView->childCount() < 1)
populateAudioView();
}
QListViewItemIterator audioIt( audioView );
DocLnk lnk;
QString filename;
// iterate through all items of the listview
for ( ; audioIt.current(); ++audioIt ) {
filename = audioIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
/* if(!audioScan)
scanForAudio();
QListIterator<DocLnk> dit( files.children() );
for ( ; dit.current(); ++dit ) {
if( QFileInfo(dit.current()->file() ).exists() ) {
d->selectedFiles->addToSelection( **dit );
}
}
*/
tabWidget->setCurrentPage(0);
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::addAllVideoToList() {
- if(!videoScan) {
+ if(!videoView->scannedFiles()) {
if(videoView->childCount() < 1)
populateVideoView();
}
QListViewItemIterator videoIt( videoView );
DocLnk lnk;
QString filename;
for ( ; videoIt.current(); ++videoIt ) {
filename = videoIt.current()->text(3);
lnk.setName( QFileInfo(filename).baseName() ); //sets name
lnk.setFile( filename ); //sets file name
d->selectedFiles->addToSelection( lnk);
}
/* if(!videoScan)
scanForVideo();
QListIterator<DocLnk> dit( vFiles.children() );
for ( ; dit.current(); ++dit ) {
if( QFileInfo( dit.current()->file() ).exists() ) {
d->selectedFiles->addToSelection( **dit );
}
}
*/
@@ -617,106 +615,106 @@ void PlayListWidget::btnPlay(bool b) {
}
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::playSelected() {
btnPlay( TRUE);
}
void PlayListWidget::scanForAudio() {
audioView->scanFiles();
- audioScan = true;
+ audioView->scannedFiles() = true;
populateAudioView();
}
void PlayListWidget::scanForVideo() {
videoView->scanFiles();
- videoScan = true;
+ videoView->scannedFiles() = true;
populateVideoView();
}
void PlayListWidget::populateAudioView() {
audioView->clear();
StorageInfo storageInfo;
// const QList<FileSystem> &fs = storageInfo.fileSystems();
- if(!audioScan) {
+ if(!audioView->scannedFiles()) {
scanForAudio();
}
QListIterator<DocLnk> dit( audioView->files().children() );
// QListIterator<FileSystem> it ( fs );
audioView->clear();
QString storage;
for ( ; dit.current(); ++dit ) {
// // for( ; it.current(); ++it ){
// const QString name = (*dit)->name();
// const QString path = (*dit)->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();
newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(),
QString::number(size ), "" /*storage*/,
dit.current()->file() );
newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) );
// qDebug("<<<< "+dit.current()->file());
}
}
audioPopulated=true;
}
void PlayListWidget::populateVideoView() {
videoView->clear();
StorageInfo storageInfo;
// const QList<FileSystem> &fs = storageInfo.fileSystems();
- if(!videoScan ) {
+ if(!videoView->scannedFiles()) {
scanForVideo();
}
QListIterator<DocLnk> Vdit( videoView->files().children() );
// QListIterator<FileSystem> it ( fs );
videoView->clear();
QString storage, pathName;
for ( ; Vdit.current(); ++Vdit ) {
// // for( ; it.current(); ++it ) {
// const QString name = (*Vdit)->name();
// const QString path = (*Vdit)->path();
// if( Vdit.current()->file().find(path) != -1 ) {
// storage=name;
// pathName=path;
// // }
// }
QListViewItem * newItem;
if ( QFile( Vdit.current()->file() ).exists() ) {
newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(),
QString::number( QFile( Vdit.current()->file() ).size() ),
""/*storage*/, Vdit.current()->file());
newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) );
}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index e81ef3c..58efd47 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -73,49 +73,49 @@ public:
~PlayListWidget();
// retrieve the current playlist entry (media file link)
const DocLnk *current() const;
void useSelectedDocument();
TabType currentTab() const;
Entry currentEntry() const;
public slots:
bool first();
bool last();
bool next();
bool prev();
void writeDefaultPlaylist( );
QString currentFileListPathName() const;
protected:
void keyReleaseEvent( QKeyEvent *e);
signals:
void skinSelected();
private:
int defaultSkinIndex;
- bool audioScan, videoScan, audioPopulated, videoPopulated;
+ bool audioPopulated, videoPopulated;
void readm3u(const QString &);
void readPls(const QString &);
void initializeStates();
void populateAudioView();
void populateVideoView();
QListView *currentFileListView() const;
bool inFileListMode() const;
private slots:
void populateSkinsMenu();
void skinsMenuActivated(int);
void pmViewActivated(int);
void writem3u();
void writeCurrentM3u();
void scanForAudio();
void scanForVideo();
void openFile();
void setDocument( const QString& fileref );
void addToSelection( const DocLnk& ); // Add a media file to the playlist
void addToSelection( QListViewItem* ); // Add a media file to the playlist
void clearList();
void addAllToList();