Ref T292, Ref T285 minor style improvements, renamings

This commit is contained in:
Klaus Basan
2018-07-26 02:19:00 +02:00
parent 338c5b344a
commit a6ee6d4b72
8 changed files with 65 additions and 73 deletions

View File

@@ -274,20 +274,21 @@ namespace BlackCore
QString CApplication::getExecutableForApplication(CApplicationInfo::Application application) const
{
QString search;
QString searchFor;
switch (application)
{
case CApplicationInfo::PilotClientCore: search = "core"; break;
case CApplicationInfo::Laucher: search = "launcher"; break;
case CApplicationInfo::MappingTool: search = "data"; break;
case CApplicationInfo::PilotClientGui: search = "gui"; break;
case CApplicationInfo::PilotClientCore: searchFor = "core"; break;
case CApplicationInfo::Laucher: searchFor = "launcher"; break;
case CApplicationInfo::MappingTool: searchFor = "data"; break;
case CApplicationInfo::PilotClientGui: searchFor = "gui"; break;
default: break;
}
if (search.isEmpty()) { return ""; }
if (searchFor.isEmpty()) { return ""; }
for (const QString &executable : CFileUtils::getSwiftExecutables())
{
if (!executable.contains("swift", Qt::CaseInsensitive)) { continue; }
if (executable.contains(search, Qt::CaseInsensitive)) { return executable; }
if (executable.contains(searchFor, Qt::CaseInsensitive)) { return executable; }
}
return "";
}

View File

@@ -204,12 +204,12 @@ namespace BlackCore
{
msgs.push_back(CStatusMessage(this).error("No network interface, simulation will not work properly"));
}
const CSimulatorInfo sims = this->simulatorsWithInitializedModelSet();
if (sims.isNoSimulator())
const CSimulatorInfo simulators = this->simulatorsWithInitializedModelSet();
if (simulators.isNoSimulator())
{
msgs.push_back(CStatusMessage(this).error("No model set so far, you need at least one model set. Hint: You can create a model set in the mapping tool, or copy an existing set in the launcher."));
}
else if (sims.isXPlane() || CSimulatorInfo(m_enabledSimulators.get()).isXPlane())
else if (simulators.isXPlane() || CSimulatorInfo(m_enabledSimulators.get()).isXPlane())
{
// ever used with XPlane
const QString pluginDir = CXPlaneUtil::pluginDirFromRootDir(m_simulatorSettings.getSimulatorDirectoryOrDefault(CSimulatorInfo::XPLANE));

View File

@@ -597,11 +597,6 @@ namespace BlackGui
}
}
int CViewBaseNonTemplate::ps_updateContainer(const CVariant &variant, bool sort, bool resize)
{
return this->performUpdateContainer(variant, sort, resize);
}
void CViewBaseNonTemplate::displayFilterDialog()
{
if (!m_menus.testFlag(MenuFilter)) { return; }

View File

@@ -497,9 +497,6 @@ namespace BlackGui
BlackMisc::CSettingReadOnly<Settings::TGeneralGui> m_guiSettings { this, &CViewBaseNonTemplate::settingsChanged }; //!< general GUI settings
protected slots:
//! Helper method with template free signature serving as callback from threaded worker
int ps_updateContainer(const BlackMisc::CVariant &variant, bool sort, bool resize);
//! Remove filter
virtual void ps_removeFilter() = 0;

View File

@@ -81,11 +81,11 @@ namespace BlackMisc
QString IAircraftModelLoader::enumToString(LoadMode mode)
{
QStringList modes;
if (mode.testFlag(NotSet)) modes << enumToString(NotSet);
if (mode.testFlag(LoadDirectly)) modes << enumToString(LoadDirectly);
if (mode.testFlag(LoadInBackground)) modes << enumToString(LoadInBackground);
if (mode.testFlag(CacheFirst)) modes << enumToString(CacheFirst);
if (mode.testFlag(CacheSkipped)) modes << enumToString(CacheSkipped);
if (mode.testFlag(NotSet)) { modes << enumToString(NotSet); }
if (mode.testFlag(LoadDirectly)) { modes << enumToString(LoadDirectly); }
if (mode.testFlag(LoadInBackground)) { modes << enumToString(LoadInBackground); }
if (mode.testFlag(CacheFirst)) { modes << enumToString(CacheFirst); }
if (mode.testFlag(CacheSkipped)) { modes << enumToString(CacheSkipped); }
return modes.join(", ");
}

View File

@@ -258,10 +258,10 @@ namespace BlackMisc
//! \name Cache has been changed. This will only detect changes elsewhere, owned caches will not signal local changes
//! @{
void changedFsx() { emitCacheChanged(CSimulatorInfo::fsx()); }
void changedFs9() { emitCacheChanged(CSimulatorInfo::fs9()); }
void changedP3D() { emitCacheChanged(CSimulatorInfo::p3d()); }
void changedXP() { emitCacheChanged(CSimulatorInfo::xplane()); }
void changedFsx() { this->emitCacheChanged(CSimulatorInfo::fsx()); }
void changedFs9() { this->emitCacheChanged(CSimulatorInfo::fs9()); }
void changedP3D() { this->emitCacheChanged(CSimulatorInfo::p3d()); }
void changedXP() { this->emitCacheChanged(CSimulatorInfo::xplane()); }
//! @}
//! Emit cacheChanged() utility function (allows breakpoint)

View File

@@ -38,11 +38,10 @@ namespace BlackMisc
QString CAircraftCfgEntries::convertToQString(bool) const
{
QString s = "{%1, %2, %3, %4, %5, %6}";
s = s.
arg(this->m_fileName).arg(this->m_index).
arg(this->m_title, this->m_atcModel, this->m_atcType, this->m_atcParkingCode);
return s;
static const QString s = "{%1, %2, %3, %4, %5, %6}";
return s.
arg(m_fileName).arg(m_index).
arg(m_title, m_atcModel, m_atcType, m_atcParkingCode);
}
CAircraftCfgEntries::CAircraftCfgEntries(const QString &fileName, int index) :
@@ -51,14 +50,14 @@ namespace BlackMisc
QString CAircraftCfgEntries::getFileDirectory() const
{
if (this->m_fileName.isEmpty()) { return ""; }
const QFileInfo fileInfo(this->m_fileName);
if (m_fileName.isEmpty()) { return ""; }
const QFileInfo fileInfo(m_fileName);
return fileInfo.absolutePath();
}
QString CAircraftCfgEntries::getUiCombinedDescription() const
{
QString d(this->m_uiManufacturer);
QString d(m_uiManufacturer);
if (!this->getUiType().isEmpty())
{
d += " ";
@@ -74,69 +73,69 @@ namespace BlackMisc
void CAircraftCfgEntries::setFileName(const QString &filePath)
{
this->m_fileName = filePath.trimmed();
m_fileName = filePath.trimmed();
}
void CAircraftCfgEntries::setTitle(const QString &title)
{
this->m_title = title.trimmed();
m_title = title.trimmed();
}
void CAircraftCfgEntries::setAtcModel(const QString &atcModel)
{
this->m_atcModel = atcModel.trimmed();
m_atcModel = atcModel.trimmed();
}
void CAircraftCfgEntries::setAtcType(const QString &atcType)
{
this->m_atcType = atcType.trimmed();
m_atcType = atcType.trimmed();
}
void CAircraftCfgEntries::setAtcParkingCode(const QString &parkingCode)
{
this->m_atcParkingCode = parkingCode.trimmed();
m_atcParkingCode = parkingCode.trimmed();
}
void CAircraftCfgEntries::setAtcAirline(const QString &airline)
{
this->m_atcAirline = airline.trimmed();
m_atcAirline = airline.trimmed();
}
void CAircraftCfgEntries::setSimName(const QString &simName)
{
this->m_simName = simName.trimmed();
m_simName = simName.trimmed();
}
void CAircraftCfgEntries::setDescription(const QString &description)
{
this->m_description = description.trimmed();
m_description = description.trimmed();
}
void CAircraftCfgEntries::setCreatedBy(const QString &createdBy)
{
this->m_createdBy = createdBy.trimmed();
m_createdBy = createdBy.trimmed();
}
void CAircraftCfgEntries::setTexture(const QString &texture)
{
this->m_texture = texture.trimmed();
m_texture = texture.trimmed();
}
void CAircraftCfgEntries::setUiType(const QString &type)
{
this->m_uiType = type.trimmed();
m_uiType = type.trimmed();
}
CAircraftModel CAircraftCfgEntries::toAircraftModel() const
{
// creates raw, unconsolidated data
Q_ASSERT_X(m_timestampMSecsSinceEpoch >= 0, Q_FUNC_INFO, "Missing file timestamp");
CAircraftModel model(this->getTitle(), CAircraftModel::TypeOwnSimulatorModel);
model.setDescription(this->getUiCombinedDescription()); // Manufacturer, variation, type
model.setFileName(this->getFileName());
model.setName(this->getSimName());
Q_ASSERT_X(this->m_timestampMSecsSinceEpoch >= 0, Q_FUNC_INFO, "Missing file timestamp");
model.setMSecsSinceEpoch(this->m_timestampMSecsSinceEpoch); // aircraft.cfg file timestamp
model.setFileTimestamp(this->m_timestampMSecsSinceEpoch);
model.setMSecsSinceEpoch(m_timestampMSecsSinceEpoch); // aircraft.cfg file timestamp
model.setFileTimestamp(m_timestampMSecsSinceEpoch);
model.setIconPath(this->getThumbnailFileNameChecked());
const QString designator(CAircraftIcaoCode::normalizeDesignator(this->getAtcModel()));
@@ -169,9 +168,9 @@ namespace BlackMisc
QString CAircraftCfgEntries::getThumbnailFileNameGuess() const
{
if (this->m_texture.isEmpty()) { return ""; }
if (this->m_fileName.isEmpty()) { return ""; }
QString fn = QDir::cleanPath(this->getFileDirectory() + QDir::separator() + "texture." + this->m_texture + QDir::separator() + "thumbnail.jpg");
if (m_texture.isEmpty()) { return ""; }
if (m_fileName.isEmpty()) { return ""; }
QString fn = QDir::cleanPath(this->getFileDirectory() + QDir::separator() + "texture." + m_texture + QDir::separator() + "thumbnail.jpg");
return fn;
}
@@ -190,22 +189,22 @@ namespace BlackMisc
ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexEntryIndex: return CVariant::from(this->m_index);
case IndexFileName: return CVariant::from(this->m_fileName);
case IndexTitle: return CVariant::from(this->m_title);
case IndexAirline: return CVariant::from(this->m_atcAirline);
case IndexAtcType: return CVariant::from(this->m_atcType);
case IndexAtcModel: return CVariant::from(this->m_atcModel);
case IndexAtcIdColor: return CVariant::from(this->m_atcIdColor);
case IndexParkingCode: return CVariant::from(this->m_atcParkingCode);
case IndexDescription: return CVariant::from(this->m_description);
case IndexUiType: return CVariant::from(this->m_uiType);
case IndexUiManufacturer: return CVariant::from(this->m_uiManufacturer);
case IndexUiVariation: return CVariant::from(this->m_uiVariation);
case IndexTexture: return CVariant::from(this->m_texture);
case IndexSimulatorName: return CVariant::from(this->m_simName);
case IndexCreatedBy: return CVariant::from(this->m_createdBy);
case IndexRotorcraft: return CVariant::from(this->m_rotorcraft);
case IndexEntryIndex: return CVariant::from(m_index);
case IndexFileName: return CVariant::from(m_fileName);
case IndexTitle: return CVariant::from(m_title);
case IndexAirline: return CVariant::from(m_atcAirline);
case IndexAtcType: return CVariant::from(m_atcType);
case IndexAtcModel: return CVariant::from(m_atcModel);
case IndexAtcIdColor: return CVariant::from(m_atcIdColor);
case IndexParkingCode: return CVariant::from(m_atcParkingCode);
case IndexDescription: return CVariant::from(m_description);
case IndexUiType: return CVariant::from(m_uiType);
case IndexUiManufacturer: return CVariant::from(m_uiManufacturer);
case IndexUiVariation: return CVariant::from(m_uiVariation);
case IndexTexture: return CVariant::from(m_texture);
case IndexSimulatorName: return CVariant::from(m_simName);
case IndexCreatedBy: return CVariant::from(m_createdBy);
case IndexRotorcraft: return CVariant::from(m_rotorcraft);
default: return CValueObject::propertyByIndex(index);
}
}
@@ -220,7 +219,7 @@ namespace BlackMisc
case IndexEntryIndex: this->setIndex(variant.toInt()); break;
case IndexFileName: this->setFileName(variant.toQString()); break;
case IndexTitle: this->setTitle(variant.toQString()); break;
case IndexAirline: this->setTitle(this->m_atcAirline); break;
case IndexAirline: this->setTitle(m_atcAirline); break;
case IndexAtcType: this->setAtcType(variant.toQString()); break;
case IndexAtcModel: this->setAtcModel(variant.toQString()); break;
case IndexAtcIdColor: this->setAtcIdColor(variant.toQString()); break;

View File

@@ -140,13 +140,13 @@ namespace BlackMisc
{
if (m_parserWorker && !m_parserWorker->isFinished()) { return; }
emit this->diskLoadingStarted(simulator, mode);
m_parserWorker = BlackMisc::CWorker::fromTask(this, "CAircraftModelLoaderXPlane::performParsing",
[this, modelDirs, excludedDirectoryPatterns, modelConsolidation]()
m_parserWorker = CWorker::fromTask(this, "CAircraftModelLoaderXPlane::performParsing",
[this, modelDirs, excludedDirectoryPatterns, modelConsolidation]()
{
//! \todo KB/MS 2017-09 not high prio, but still needed: according to meet XP needs to support multiple directories
//! \todo KB with T118 now model directories are passed (changed signatures) but the code below needs to support multiple dirs
const QString modelDirectory = modelDirs.front();
auto models = performParsing(modelDirectory, excludedDirectoryPatterns);
auto models = this->performParsing(modelDirectory, excludedDirectoryPatterns);
if (modelConsolidation) { modelConsolidation(models, true); }
return models;
});
@@ -239,7 +239,7 @@ namespace BlackMisc
return installedModels;
}
BlackMisc::Simulation::CAircraftModel CAircraftModelLoaderXPlane::extractAcfProperties(const QString &filePath, const QFileInfo &fileInfo)
CAircraftModel CAircraftModelLoaderXPlane::extractAcfProperties(const QString &filePath, const QFileInfo &fileInfo)
{
BlackMisc::Simulation::CAircraftModel model;
QFile file(filePath);