Commit 085f605116df486721c6e61a0e3aceaddbc92897

Authored by Josh Klontz
1 parent a13f9edb

EmptyGallery cleanup

Showing 1 changed file with 4 additions and 14 deletions
sdk/plugins/gallery.cpp
... ... @@ -63,7 +63,6 @@ class galGallery : public Gallery
63 63 while ((templates.size() < Globals->blockSize) && !stream.atEnd()) {
64 64 Template m;
65 65 stream >> m;
66   - //qWarning("?? %s\n", qPrintable(m.file.name));
67 66 templates.append(m);
68 67 }
69 68  
... ... @@ -73,7 +72,6 @@ class galGallery : public Gallery
73 72  
74 73 void write(const Template &t)
75 74 {
76   - //qWarning("$$ %s\n", qPrintable(t.file.name));
77 75 stream << t;
78 76 }
79 77 };
... ... @@ -88,10 +86,6 @@ BR_REGISTER(Gallery, galGallery)
88 86 class EmptyGallery : public Gallery
89 87 {
90 88 Q_OBJECT
91   - Q_PROPERTY(bool cache READ get_cache WRITE set_cache RESET reset_cache)
92   - Q_PROPERTY(QString postfix READ get_postfix WRITE set_postfix RESET reset_postfix)
93   - BR_PROPERTY(bool, cache, false)
94   - BR_PROPERTY(QString, postfix, "")
95 89  
96 90 void init()
97 91 {
... ... @@ -100,12 +94,11 @@ class EmptyGallery : public Gallery
100 94  
101 95 TemplateList readBlock(bool *done)
102 96 {
  97 + TemplateList templates;
103 98 *done = true;
104 99  
105 100 // Enrolling a null file is used as an idiom to initialize an algorithm
106   - if (file.name.isEmpty()) return TemplateList();
107   -
108   - TemplateList templates;
  101 + if (file.isNull()) return templates;
109 102  
110 103 // Add immediate subfolders
111 104 QDir dir(file);
... ... @@ -128,11 +121,8 @@ class EmptyGallery : public Gallery
128 121 if (file.name.isEmpty()) return;
129 122  
130 123 QMutexLocker diskLocker(&diskLock);
131   - const QString destination = file.name + "/" + t.file.baseName() + postfix + ".png";
132   - if (!cache || !QFileInfo(destination).exists()) {
133   - if (t.isNull()) QFile::copy((t.file.exists() ? QString() : Globals->path+"/") + t.file.name, destination);
134   - else OpenCVUtils::saveImage(t, destination);
135   - }
  124 + if (t.isNull()) QFile::copy((t.file.exists() ? QString() : Globals->path+"/") + t.file.name, file.name + "/" + t.file.fileName());
  125 + else OpenCVUtils::saveImage(t, file.name + "/" + t.file.baseName() + ".png");
136 126 }
137 127 };
138 128  
... ...