18 #include <QDirIterator>
64 std::map<QString,std::pair<QDateTime,QList<VP1EventFile> > >
dircache;
76 m_d->
tmpDir = QString(td + (td.endsWith(
"/")?
"":
"/")).replace(
"//",
"/");
112 QList<VP1EventFile>
l;
115 std::set<Imp::EventID>::const_iterator histIt, histItE(
m_d->
historySorted.end());
205 return QList<VP1EventFile>();
207 QFileInfo fi_dir(
dir);
208 if (!fi_dir.exists()||!fi_dir.isDir())
209 return QList<VP1EventFile>();
211 QDateTime modtime = fi_dir.lastModified();
212 if (abs(modtime.time().msecsTo(QTime::currentTime()))>50) {
215 return it->second.second;
219 filters <<
"*_*.pool.root";
221 QDirIterator itDir(
dir,filters,
QDir::Files | QDir::NoDotAndDotDot | QDir::Readable | QDir::CaseSensitive);
223 QList<VP1EventFile>
l;
224 while (itDir.hasNext()) {
225 QString
fn = itDir.next();
226 fn.replace(
"//",
"/");
231 message(
"Could not decode event file name: "+
fn);
234 std::sort(
l.begin(),
l.end());
250 if (!cachevar.isEmpty())
251 return cachevar==
"bad"?
"":cachevar;
254 if (!(
fi.exists()&&
fi.isDir())) {
255 theclass->
message(
"Could not create subdir in "+
tmpDir+
", since it does not exists or is not a directory" );
264 bool ok = QDir().mkdir(
dir);
295 QString
dir = theclass->tmpLocalFileDir();
299 QList<VP1EventFile>
events = theclass->allLocalEvents();
309 QList<Imp::EventID> protectedEvents;
310 if (!historyOrdered.isEmpty()) {
311 protectedEvents << historyOrdered.back();
312 if (historyOrdered.count()>1)
313 protectedEvents << historyOrdered.at(historyOrdered.count()-2);
315 QList<VP1EventFile> freshEvts = theclass->freshEvents();
324 for (
int i =
events.count()-1;
i>=0; --
i ) {
332 theclass->invalidateDirCache(theclass->tmpLocalFileDir());
347 return evt.rawTime() >= oldest_time;