From e5056b7bbbb96a5371de9e1d5632cc8d700d0e0e Mon Sep 17 00:00:00 2001 From: Josh Klontz Date: Fri, 12 Jun 2015 09:35:19 -0400 Subject: [PATCH] introduced xmlGallery::skipMissing --- openbr/plugins/gallery/xml.cpp | 8 ++++++++ 1 file changed, 8 insertions(+), 0 deletions(-) diff --git a/openbr/plugins/gallery/xml.cpp b/openbr/plugins/gallery/xml.cpp index cfe9dbd..4df2e00 100644 --- a/openbr/plugins/gallery/xml.cpp +++ b/openbr/plugins/gallery/xml.cpp @@ -31,7 +31,9 @@ class xmlGallery : public FileGallery { Q_OBJECT Q_PROPERTY(bool ignoreMetadata READ get_ignoreMetadata WRITE set_ignoreMetadata RESET reset_ignoreMetadata STORED false) + Q_PROPERTY(bool skipMissing READ get_skipMissing WRITE set_skipMissing RESET reset_skipMissing STORED false) BR_PROPERTY(bool, ignoreMetadata, false) + BR_PROPERTY(bool, skipMissing, false) FileList files; QXmlStreamReader reader; @@ -116,6 +118,12 @@ class xmlGallery : public FileGallery // we read another complete template count++; + + // optionally remove templates whose files don't exist or are empty + if (skipMissing && !QFileInfo(templates.last().file.resolved()).size()) { + templates.removeLast(); + count--; + } } } } -- libgit2 0.21.4