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;