Improve file identification in Icon loader

Will no longer attempt to process SleepStyle data with Icon loader
   A new loader for SleepStyle machines is forthcoming.
This commit is contained in:
Guy Scharf 2021-04-04 04:56:39 -07:00
parent e3a87a3148
commit 3114cf517d

View File

@ -66,6 +66,26 @@ bool FPIconLoader::Detect(const QString & givenpath)
return false;
}
// ICON serial numbers (directory names) are all digits (SleepStyle are mixed alpha and numeric)
QString serialDir(dir.path() + "/FPHCARE/ICON");
QDir iconDir(serialDir);
iconDir.setFilter(QDir::NoDotAndDotDot | QDir::Dirs | QDir::Files | QDir::Hidden | QDir::NoSymLinks);
iconDir.setSorting(QDir::Name);
QFileInfoList flist = iconDir.entryInfoList();
bool ok;
for (int i = 0; i < flist.size(); i++) {
QFileInfo fi = flist.at(i);
QString filename = fi.fileName();
filename.toInt(&ok);
if (!ok) {
return false;
}
}
return true;
}