From 4318215dbbf59c5017dde984d2bb40312c01b52b Mon Sep 17 00:00:00 2001 From: Tobias Rundstrom Date: Wed, 15 Mar 2006 20:45:03 -0400 Subject: [PATCH] Make add DIR to work. --- Playlist.cpp | 24 +++++++++++++++++------- Playlist.h | 1 + 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/Playlist.cpp b/Playlist.cpp index ac1b324..44557f8 100644 --- a/Playlist.cpp +++ b/Playlist.cpp @@ -321,23 +321,33 @@ PlaylistWidget::addButtons (void) } void -PlaylistWidget::menuAddDir () +PlaylistWidget::diveDir (const QString &dir) { XMMSHandler *xmmsh = XMMSHandler::getInstance(); - QString dir; - dir = QFileDialog::getExistingDirectory (this, "Select files to play", - QDir::homePath ()); QDir d (dir); - d.setFilter (QDir::Files); + d.setFilter (QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); QFileInfoList list = d.entryInfoList(); for (int i = 0; i < list.size(); ++i) { QFileInfo fileInfo = list.at(i); - QString fname = fileInfo.filePath(); - xmmsh->playlistAddURL ("file://" + fname); + if (fileInfo.isDir ()) { + diveDir (fileInfo.filePath ()); + } else { + QString fname = fileInfo.filePath(); + xmmsh->playlistAddURL ("file://" + fname); + } } +} + +void +PlaylistWidget::menuAddDir () +{ + QString dir; + dir = QFileDialog::getExistingDirectory (this, "Select files to play", + QDir::homePath ()); + diveDir (dir); } void diff --git a/Playlist.h b/Playlist.h index 1c9ef79..a8de8b9 100644 --- a/Playlist.h +++ b/Playlist.h @@ -91,6 +91,7 @@ class PlaylistWidget : public QWidget { void paintEvent (QPaintEvent *event); void mouseDoubleClickEvent (QMouseEvent *event); void addButtons (void); + void diveDir (const QString &); QPixmap m_corner1; QPixmap m_corner2;