mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-29 12:45:40 +08:00
Ref T348, file handling in aircraft model (renaming)
Related: Ref T317 Ref T247 Ref T335
This commit is contained in:
@@ -142,7 +142,7 @@ namespace BlackMisc
|
|||||||
const ModelType t = this->getModelType();
|
const ModelType t = this->getModelType();
|
||||||
if (t == TypeOwnSimulatorModel || t == TypeManuallySet || t == TypeDatabaseEntry)
|
if (t == TypeOwnSimulatorModel || t == TypeManuallySet || t == TypeDatabaseEntry)
|
||||||
{
|
{
|
||||||
if (!this->existsCorrespondingFile())
|
if (!this->hasExistingCorrespondingFile())
|
||||||
{
|
{
|
||||||
const CStatusMessage m = CStatusMessage(this).validationError("File '%1' not readable") << this->getFileName();
|
const CStatusMessage m = CStatusMessage(this).validationError("File '%1' not readable") << this->getFileName();
|
||||||
msgs.push_back(m);
|
msgs.push_back(m);
|
||||||
@@ -631,7 +631,7 @@ namespace BlackMisc
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAircraftModel::existsCorrespondingFile() const
|
bool CAircraftModel::hasExistingCorrespondingFile() const
|
||||||
{
|
{
|
||||||
if (!this->hasFileName()) { return false; }
|
if (!this->hasFileName()) { return false; }
|
||||||
const QFileInfo fi(this->getFileName());
|
const QFileInfo fi(this->getFileName());
|
||||||
|
|||||||
@@ -374,11 +374,14 @@ namespace BlackMisc
|
|||||||
// ---------------- simulator file related functions -------------------
|
// ---------------- simulator file related functions -------------------
|
||||||
|
|
||||||
//! File name (corresponding data for simulator, only available if representing simulator model
|
//! File name (corresponding data for simulator, only available if representing simulator model
|
||||||
QString getFileName() const { return m_fileName; }
|
const QString &getFileName() const { return m_fileName; }
|
||||||
|
|
||||||
//! File name?
|
//! File name?
|
||||||
bool hasFileName() const { return !m_fileName.isEmpty(); }
|
bool hasFileName() const { return !m_fileName.isEmpty(); }
|
||||||
|
|
||||||
|
//! Does the corresponding file exist?
|
||||||
|
bool hasExistingCorrespondingFile() const;
|
||||||
|
|
||||||
//! File name
|
//! File name
|
||||||
void setFileName(const QString &fileName) { m_fileName = fileName; }
|
void setFileName(const QString &fileName) { m_fileName = fileName; }
|
||||||
|
|
||||||
@@ -419,9 +422,6 @@ namespace BlackMisc
|
|||||||
//! Adjust file names to a new directory
|
//! Adjust file names to a new directory
|
||||||
bool adjustLocalFileNames(const QString &newModelDir, const QString &stripModelDirIndicator = {});
|
bool adjustLocalFileNames(const QString &newModelDir, const QString &stripModelDirIndicator = {});
|
||||||
|
|
||||||
//! Does the corresponding file exist?
|
|
||||||
bool existsCorrespondingFile() const;
|
|
||||||
|
|
||||||
// ---------------- end file related functions --------------
|
// ---------------- end file related functions --------------
|
||||||
|
|
||||||
//! Verify the model data
|
//! Verify the model data
|
||||||
|
|||||||
@@ -349,7 +349,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
return this->findBy([](const CAircraftModel & model)
|
return this->findBy([](const CAircraftModel & model)
|
||||||
{
|
{
|
||||||
return !model.existsCorrespondingFile();
|
return !model.hasExistingCorrespondingFile();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,7 +357,7 @@ namespace BlackMisc
|
|||||||
{
|
{
|
||||||
return this->findBy([](const CAircraftModel & model)
|
return this->findBy([](const CAircraftModel & model)
|
||||||
{
|
{
|
||||||
return model.existsCorrespondingFile();
|
return model.hasExistingCorrespondingFile();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user