Ref T660, utility functions

* check if model is in path
* addAsValidOrInvalidModel
* set corresponding simulator for validation
* display validation of empty model set
This commit is contained in:
Klaus Basan
2019-06-08 21:41:22 +02:00
committed by Mat Sutcliffe
parent d59e1c3332
commit f3ec7a8a68
12 changed files with 99 additions and 48 deletions

View File

@@ -766,6 +766,19 @@ namespace BlackMisc
return this->getFileDirectory().absolutePath();
}
bool CAircraftModel::isInPath(const QString &path, Qt::CaseSensitivity cs) const
{
const QString p(this->getFileDirectoryPath());
if (path.isEmpty() || p.isEmpty()) { return false; }
if (path.startsWith('/'))
{
if (path.endsWith('/')) { return p.contains(path.mid(1, path.length() - 2), cs); }
return p.contains(path.mid(1));
}
if (path.endsWith('/')) { return p.contains(path.left(path.length() - 1), cs); }
return (p.contains(path, cs));
}
bool CAircraftModel::hasExistingIconFile() const
{
if (m_iconFile.isEmpty()) { return false; }