summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp17
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h8
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp15
3 files changed, 40 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp
index cb16415..3ef4d03 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.cpp
+++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp
@@ -10,30 +10,42 @@ PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QStrin
m_viewPopulated( 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 );
+
+ connect( this, SIGNAL( selectionChanged() ),
+ this, SLOT( checkSelection() ) );
}
PlayListFileView::~PlayListFileView()
{
}
+bool PlayListFileView::hasSelection() const
+{
+ for ( QListViewItemIterator it( const_cast<PlayListFileView *>( this ) ); it.current(); ++it )
+ if ( it.current()->isSelected() )
+ return true;
+
+ return false;
+}
+
void PlayListFileView::scanFiles()
{
m_files.detachChildren();
QListIterator<DocLnk> sdit( m_files.children() );
for ( ; sdit.current(); ++sdit )
delete sdit.current();
Global::findDocuments( &m_files, m_mimeTypePattern );
if ( m_viewPopulated ) {
m_viewPopulated = false;
populateView();
@@ -65,14 +77,19 @@ void PlayListFileView::populateView()
dit.current()->file().left( 4 ) == "http" ) {
unsigned long size = QFile( dit.current()->file() ).size();
newItem = new QListViewItem( this, dit.current()->name(),
QString::number( size ), "" /*storage*/,
dit.current()->file() );
newItem->setPixmap( 0, Resource::loadPixmap( m_itemPixmapName ) );
}
}
}
+void PlayListFileView::checkSelection()
+{
+ emit itemsSelected( hasSelection() );
+}
+
/* vim: et sw=4 ts=4
*/
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index 6eea2fc..5b15526 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -3,27 +3,35 @@
#include "playlistview.h"
#include <qpe/applnk.h>
class PlayListFileView : public PlayListView
{
Q_OBJECT
public:
PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name = 0 );
virtual ~PlayListFileView();
+ bool hasSelection() const;
+
public slots:
void scanFiles();
void populateView();
+signals:
+ void itemsSelected( bool selected );
+
+private slots:
+ void checkSelection();
+
private:
QString m_mimeTypePattern;
QString m_itemPixmapName;
DocLnkSet m_files;
bool m_scannedFiles;
bool m_viewPopulated;
};
#endif // PLAYLISTFILEVIEW_H
/* vim: et sw=4 ts=4
*/
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 2df7f27..c05096a 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -535,55 +535,70 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
writeCurrentM3u();
tabWidget->setCurrentPage(0);
}
}
void PlayListWidget::tabChanged(QWidget *) {
d->tbPlay->setEnabled( true );
+ disconnect( audioView, SIGNAL( itemsSelected( bool ) ),
+ d->tbPlay, SLOT( setEnabled( bool ) ) );
+ disconnect( videoView, SIGNAL( itemsSelected( bool ) ),
+ d->tbPlay, SLOT( setEnabled( bool ) ) );
+
switch ( currentTab() ) {
case CurrentPlayList:
{
if( !tbDeletePlaylist->isHidden() ) {
tbDeletePlaylist->hide();
}
d->tbRemoveFromList->setEnabled(TRUE);
d->tbAddToList->setEnabled(FALSE);
d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
}
break;
case AudioFiles:
{
audioView->populateView();
if( !tbDeletePlaylist->isHidden() ) {
tbDeletePlaylist->hide();
}
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
+
+ connect( audioView, SIGNAL( itemsSelected( bool ) ),
+ d->tbPlay, SLOT( setEnabled( bool ) ) );
+
+ d->tbPlay->setEnabled( audioView->hasSelection() );
}
break;
case VideoFiles:
{
videoView->populateView();
if( !tbDeletePlaylist->isHidden() ) {
tbDeletePlaylist->hide();
}
d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
+
+ connect( videoView, SIGNAL( itemsSelected( bool ) ),
+ d->tbPlay, SLOT( setEnabled( bool ) ) );
+
+ d->tbPlay->setEnabled( videoView->hasSelection() );
}
break;
case PlayLists:
{
if( tbDeletePlaylist->isHidden() ) {
tbDeletePlaylist->show();
}
playLists->reread();
d->tbAddToList->setEnabled(FALSE);
d->tbPlay->setEnabled( false );
}