summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp56
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h1
4 files changed, 59 insertions, 12 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp
index 3ef4d03..3094876 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.cpp
+++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp
@@ -79,5 +79,7 @@ void PlayListFileView::populateView()
unsigned long size = QFile( dit.current()->file() ).size();
+ QString sizestr;
+ fileSize(size, sizestr);
newItem = new QListViewItem( this, dit.current()->name(),
- QString::number( size ), "" /*storage*/,
+ sizestr, "" /*storage*/,
dit.current()->file() );
@@ -93,2 +95,11 @@ void PlayListFileView::checkSelection()
+void PlayListFileView::fileSize(unsigned long size, QString &str) {
+ if( size > 1048576 )
+ str.sprintf( "%.0fM", size / 1048576.0 );
+ else if( size > 1024 )
+ str.sprintf( "%.0fK", size / 1024.0 );
+ else
+ str.sprintf( "%d", size );
+}
+
/* vim: et sw=4 ts=4
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index 5b15526..d92f258 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -27,2 +27,3 @@ private slots:
private:
+ void fileSize(unsigned long size, QString &str);
QString m_mimeTypePattern;
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 5f4159c..83eb83b 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -182,2 +182,34 @@ void PlayListWidget::initializeStates() {
+void PlayListWidget::setButtons(void) {
+ bool hasitem;
+
+ switch ( currentTab() ) {
+ case CurrentPlayList:
+ {
+ hasitem = !d->selectedFiles->isEmpty();
+ d->tbPlay->setEnabled( hasitem );
+ d->tbRemoveFromList->setEnabled( hasitem );
+ }
+ break;
+ case AudioFiles:
+ {
+ d->tbPlay->setEnabled( audioView->hasSelection() );
+ d->tbRemoveFromList->setEnabled( false );
+ }
+ break;
+ case VideoFiles:
+ {
+ d->tbPlay->setEnabled( videoView->hasSelection() );
+ d->tbRemoveFromList->setEnabled( false );
+ }
+ break;
+ case PlayLists:
+ {
+ d->tbPlay->setEnabled( false );
+ d->tbRemoveFromList->setEnabled( false );
+ }
+ break;
+ };
+}
+
void PlayListWidget::writeDefaultPlaylist() {
@@ -222,2 +254,3 @@ void PlayListWidget::clearList() {
setCaption("OpiePlayer");
+ setButtons();
}
@@ -286,2 +319,4 @@ void PlayListWidget::addAllToList() {
d->selectedFiles->first();
+
+ setButtons();
}
@@ -307,2 +342,4 @@ void PlayListWidget::addAllMusicToList() {
d->selectedFiles->first();
+
+ setButtons();
}
@@ -326,2 +363,4 @@ void PlayListWidget::addAllVideoToList() {
d->selectedFiles->first();
+
+ setButtons();
}
@@ -478,2 +517,3 @@ void PlayListWidget::removeSelected() {
writeCurrentM3u();
+ setButtons();
}
@@ -512,4 +552,2 @@ void PlayListWidget::tabChanged(QWidget *) {
- d->tbPlay->setEnabled( true );
-
disconnect( audioView, SIGNAL( itemsSelected(bool) ),
@@ -527,6 +565,4 @@ void PlayListWidget::tabChanged(QWidget *) {
}
- d->tbRemoveFromList->setEnabled(TRUE);
d->tbAddToList->setEnabled(FALSE);
- d->tbPlay->setEnabled( !d->selectedFiles->isEmpty() );
}
@@ -540,3 +576,2 @@ void PlayListWidget::tabChanged(QWidget *) {
}
- d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
@@ -546,4 +581,2 @@ void PlayListWidget::tabChanged(QWidget *) {
- d->tbPlay->setEnabled( audioView->hasSelection() );
-
currentFileListView = audioView;
@@ -557,3 +590,2 @@ void PlayListWidget::tabChanged(QWidget *) {
}
- d->tbRemoveFromList->setEnabled(FALSE);
d->tbAddToList->setEnabled(TRUE);
@@ -563,4 +595,2 @@ void PlayListWidget::tabChanged(QWidget *) {
- d->tbPlay->setEnabled( videoView->hasSelection() );
-
currentFileListView = videoView;
@@ -576,3 +606,2 @@ void PlayListWidget::tabChanged(QWidget *) {
- d->tbPlay->setEnabled( false );
}
@@ -580,2 +609,4 @@ void PlayListWidget::tabChanged(QWidget *) {
};
+
+ setButtons();
}
@@ -712,2 +743,4 @@ void PlayListWidget::openFile() {
}
+
+ setButtons();
}
@@ -781,2 +814,3 @@ void PlayListWidget::readListFromFile( const QString &filename ) {
+ setButtons();
}
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 1f5ba92..7db0029 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -134,2 +134,3 @@ private:
DocLnk addFileToPlaylist(const QString& directory, const QString& name);
+ void setButtons(void);
bool fromSetDocument;