Skip to content

Commit

Permalink
FIx video scanning following [a05b4d4]. Calling QDir::setFilter() wit…
Browse files Browse the repository at this point in the history
…h a negative filter overwrites the default positive filters of QDir::Files | QDir::Dirs.
  • Loading branch information
stuartm authored and jyavenard committed Mar 8, 2013
1 parent b2d69b4 commit 507c924
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythmedia.cpp
Expand Up @@ -249,7 +249,7 @@ bool MythMediaDevice::ScanMediaType(const QString &directory, ext_cnt_t &cnt)
if (!d.exists())
return false;

d.setFilter(QDir::NoDotAndDotDot);
d.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList list = d.entryInfoList();

for( QFileInfoList::iterator it = list.begin();
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythbase/storagegroup.cpp
Expand Up @@ -300,9 +300,9 @@ QStringList StorageGroup::GetFileInfoList(QString Path)
if (!d.exists())
return files;

d.setFilter(QDir::NoDotAndDotDot);
d.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList list = d.entryInfoList();
if (!list.size())
if (list.isEmpty())
return files;

for (QFileInfoList::iterator p = list.begin(); p != list.end(); ++p)
Expand Down
6 changes: 3 additions & 3 deletions mythtv/libs/libmythmetadata/dirscan.cpp
Expand Up @@ -55,10 +55,10 @@ namespace
if (!d.exists())
return false;

d.setFilter(QDir::NoDotAndDotDot);
d.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList list = d.entryInfoList();
// An empty directory is fine
if (!list.size())
if (list.isEmpty())
return true;

QDir dir_tester;
Expand Down Expand Up @@ -149,7 +149,7 @@ namespace
return false;
}

if ((!list.size()) || (list.at(0) == "EMPTY LIST"))
if (list.isEmpty() || (list.at(0) == "EMPTY LIST"))
return true;

for (QStringList::iterator p = list.begin(); p != list.end(); ++p)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythmetadata/videometadata.cpp
Expand Up @@ -415,7 +415,7 @@ bool VideoMetadataImp::removeDir(const QString &dirName)
{
QDir d(dirName);

d.setFilter(QDir::NoDotAndDotDot);
d.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList contents = d.entryInfoList();
if (!contents.size())
{
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythui/mythuihelper.cpp
Expand Up @@ -746,7 +746,7 @@ void MythUIHelper::ClearOldImageCache(void)

dir.setPath(cachedirname);

dir.setFilter(QDir::NoDotAndDotDot);
dir.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList list = dir.entryInfoList();

QFileInfoList::const_iterator it = list.begin();
Expand Down Expand Up @@ -803,7 +803,7 @@ void MythUIHelper::RemoveCacheDir(const QString &dirname)
if (!dir.exists())
return;

dir.setFilter(QDir::NoDotAndDotDot);
dir.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList list = dir.entryInfoList();
QFileInfoList::const_iterator it = list.begin();
const QFileInfo *fi;
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythbackend/mainserver.cpp
Expand Up @@ -3365,7 +3365,7 @@ void MainServer::HandleSGGetFileList(QStringList &sList,
if (slaveUnreachable)
strList << "SLAVE UNREACHABLE: " << host;

if (strList.count() == 0 || (strList.at(0) == "0"))
if (strList.isEmpty() || (strList.at(0) == "0"))
strList << "EMPTY LIST";

SendResponse(pbssock, strList);
Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/themechooser.cpp
Expand Up @@ -853,7 +853,7 @@ void ThemeChooser::removeThemeDir(const QString &dirname)
if (!dir.exists())
return;

dir.setFilter(QDir::NoDotAndDotDot);
dir.setFilter(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList list = dir.entryInfoList();
QFileInfoList::const_iterator it = list.begin();
const QFileInfo *fi;
Expand Down

0 comments on commit 507c924

Please sign in to comment.