]> Some of my projects - aniplayer-old.git/commitdiff
- Filter files in DirectoryPlaylist to include only files with certain
authorAPTX <>
Sat, 11 Apr 2009 14:35:54 +0000 (16:35 +0200)
committerAPTX <APTX@.(none)>
Sat, 11 Apr 2009 14:35:54 +0000 (16:35 +0200)
extensions.
- Fix DirectoryPlaylist::previous()

src/directoryplaylist.cpp
src/videowindow.cpp

index 4aa4529b01caa73ad8eec95da87dd1225c3f225f..017e6ec96563c533d29e77d4ee533f9d05c4c1d5 100644 (file)
@@ -23,8 +23,22 @@ void DirectoryPlaylist::setDirectory(QDir directory)
                return;
 
        m_directory = directory;
-       entryList = m_directory.entryInfoList(QDir::Files | QDir::Readable, QDir::Name);
+
+       entryList = m_directory.entryInfoList(
+                       QStringList()
+                               << "*.mkv"
+                               << "*.mp4"
+                               << "*.ogg"
+                               << "*.ogm"
+                               << "*.wmv"
+                               << "*.avi",
+                       QDir::Files | QDir::Readable,
+                       QDir::Name);
        m_currentIndex = 0;
+foreach(const QFileInfo &f, entryList)
+{
+       qDebug() << f.absoluteFilePath();
+}
 }
 
 int DirectoryPlaylist::indexOfFile(const QString &file) const
@@ -63,8 +77,8 @@ void DirectoryPlaylist::next()
 void DirectoryPlaylist::previous()
 {
        --m_currentIndex;
-       if (m_currentIndex == 1)
-               m_currentIndex = entryList.count() - 1;
+       if (m_currentIndex == -1)
+               m_currentIndex = count() - 1;
 
        emit currentChanged(m_currentIndex);
        emit currentChanged(entryList[m_currentIndex].absoluteFilePath());
index fc79c444ba9b5cba43aa8363dfebb7ab4de25c9b..ad70fa74ab3b534dcf26d39f11cfa7ec1dc81348 100644 (file)
@@ -369,7 +369,6 @@ qDebug() << "Media changed state from" << oldstate << "to" << newstate;
                case Phonon::ErrorState:
                        //QMessageBox::warning(this, tr("Phonon error"), mediaObject->errorString());
                        menu->showMessage(mediaObject->errorString());
-                       m_currentFile = "";
 
                        m_actions["play"]->setDisabled(false);
                        m_actions["pause"]->setDisabled(true);