Commit e5056b7bbbb96a5371de9e1d5632cc8d700d0e0e

Authored by Josh Klontz
1 parent 3df533ac

introduced xmlGallery::skipMissing

openbr/plugins/gallery/xml.cpp
@@ -31,7 +31,9 @@ class xmlGallery : public FileGallery @@ -31,7 +31,9 @@ class xmlGallery : public FileGallery
31 { 31 {
32 Q_OBJECT 32 Q_OBJECT
33 Q_PROPERTY(bool ignoreMetadata READ get_ignoreMetadata WRITE set_ignoreMetadata RESET reset_ignoreMetadata STORED false) 33 Q_PROPERTY(bool ignoreMetadata READ get_ignoreMetadata WRITE set_ignoreMetadata RESET reset_ignoreMetadata STORED false)
  34 + Q_PROPERTY(bool skipMissing READ get_skipMissing WRITE set_skipMissing RESET reset_skipMissing STORED false)
34 BR_PROPERTY(bool, ignoreMetadata, false) 35 BR_PROPERTY(bool, ignoreMetadata, false)
  36 + BR_PROPERTY(bool, skipMissing, false)
35 FileList files; 37 FileList files;
36 38
37 QXmlStreamReader reader; 39 QXmlStreamReader reader;
@@ -116,6 +118,12 @@ class xmlGallery : public FileGallery @@ -116,6 +118,12 @@ class xmlGallery : public FileGallery
116 118
117 // we read another complete template 119 // we read another complete template
118 count++; 120 count++;
  121 +
  122 + // optionally remove templates whose files don't exist or are empty
  123 + if (skipMissing && !QFileInfo(templates.last().file.resolved()).size()) {
  124 + templates.removeLast();
  125 + count--;
  126 + }
119 } 127 }
120 } 128 }
121 } 129 }