mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-15 01:05:35 +08:00
refactor: Remove model preview
This feature was not documented and only worked for some MS flight simulators
This commit is contained in:
@@ -263,9 +263,6 @@ namespace swift::core::context
|
|||||||
//! Is available simulator simulating? Returns false if no simulator is available
|
//! Is available simulator simulating? Returns false if no simulator is available
|
||||||
bool isSimulatorSimulating() const;
|
bool isSimulatorSimulating() const;
|
||||||
|
|
||||||
//! Icon representing the model
|
|
||||||
virtual swift::misc::CPixmap iconForModel(const QString &modelString) const = 0;
|
|
||||||
|
|
||||||
//! Get mapping messages
|
//! Get mapping messages
|
||||||
virtual swift::misc::CStatusMessageList
|
virtual swift::misc::CStatusMessageList
|
||||||
getMatchingMessages(const swift::misc::aviation::CCallsign &callsign) const = 0;
|
getMatchingMessages(const swift::misc::aviation::CCallsign &callsign) const = 0;
|
||||||
|
|||||||
@@ -288,14 +288,6 @@ namespace swift::core::context
|
|||||||
return swift::misc::physical_quantities::CTime();
|
return swift::misc::physical_quantities::CTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::iconForModel
|
|
||||||
virtual swift::misc::CPixmap iconForModel(const QString &modelString) const override
|
|
||||||
{
|
|
||||||
Q_UNUSED(modelString)
|
|
||||||
logEmptyContextWarning(Q_FUNC_INFO);
|
|
||||||
return swift::misc::CPixmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! \copydoc IContextSimulator::followAircraft
|
//! \copydoc IContextSimulator::followAircraft
|
||||||
virtual bool followAircraft(const swift::misc::aviation::CCallsign &callsign) override
|
virtual bool followAircraft(const swift::misc::aviation::CCallsign &callsign) override
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -967,18 +967,6 @@ namespace swift::core::context
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CPixmap CContextSimulator::iconForModel(const QString &modelString) const
|
|
||||||
{
|
|
||||||
if (!m_simulatorPlugin.second || m_simulatorPlugin.first.isUnspecified()) { return CPixmap(); }
|
|
||||||
|
|
||||||
// load from file
|
|
||||||
CStatusMessage msg;
|
|
||||||
const CAircraftModel model(this->getModelSet().findFirstByModelStringAliasOrDefault(modelString));
|
|
||||||
const CPixmap pm(model.loadIcon(msg));
|
|
||||||
if (!msg.isEmpty()) { CLogMessage::preformatted(msg); }
|
|
||||||
return pm;
|
|
||||||
}
|
|
||||||
|
|
||||||
CStatusMessageList CContextSimulator::getMatchingMessages(const CCallsign &callsign) const
|
CStatusMessageList CContextSimulator::getMatchingMessages(const CCallsign &callsign) const
|
||||||
{
|
{
|
||||||
if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
if (isDebugEnabled()) { CLogMessage(this, CLogCategories::contextSlot()).debug() << Q_FUNC_INFO << callsign; }
|
||||||
|
|||||||
@@ -185,9 +185,6 @@ namespace swift::core
|
|||||||
virtual swift::misc::CStatusMessageList
|
virtual swift::misc::CStatusMessageList
|
||||||
getInterpolationMessages(const swift::misc::aviation::CCallsign &callsign) const override;
|
getInterpolationMessages(const swift::misc::aviation::CCallsign &callsign) const override;
|
||||||
|
|
||||||
//! \copydoc swift::core::context::IContextSimulator::iconForModel
|
|
||||||
virtual swift::misc::CPixmap iconForModel(const QString &modelString) const override;
|
|
||||||
|
|
||||||
//! \copydoc swift::core::context::IContextSimulator::followAircraft
|
//! \copydoc swift::core::context::IContextSimulator::followAircraft
|
||||||
virtual bool followAircraft(const swift::misc::aviation::CCallsign &callsign) override;
|
virtual bool followAircraft(const swift::misc::aviation::CCallsign &callsign) override;
|
||||||
|
|
||||||
|
|||||||
@@ -300,11 +300,6 @@ namespace swift::core::context
|
|||||||
return m_dBusInterface->callDBusRet<int>(QLatin1String("checkListeners"));
|
return m_dBusInterface->callDBusRet<int>(QLatin1String("checkListeners"));
|
||||||
}
|
}
|
||||||
|
|
||||||
CPixmap CContextSimulatorProxy::iconForModel(const QString &modelString) const
|
|
||||||
{
|
|
||||||
return m_dBusInterface->callDBusRet<CPixmap>(QLatin1String("iconForModel"), modelString);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CContextSimulatorProxy::followAircraft(const CCallsign &callsign)
|
bool CContextSimulatorProxy::followAircraft(const CCallsign &callsign)
|
||||||
{
|
{
|
||||||
return m_dBusInterface->callDBusRet<bool>(QLatin1String("followAircraft"), callsign);
|
return m_dBusInterface->callDBusRet<bool>(QLatin1String("followAircraft"), callsign);
|
||||||
|
|||||||
@@ -174,9 +174,6 @@ namespace swift::core
|
|||||||
//! \copydoc swift::core::context::IContextSimulator::getTimeSynchronizationOffset
|
//! \copydoc swift::core::context::IContextSimulator::getTimeSynchronizationOffset
|
||||||
virtual swift::misc::physical_quantities::CTime getTimeSynchronizationOffset() const override;
|
virtual swift::misc::physical_quantities::CTime getTimeSynchronizationOffset() const override;
|
||||||
|
|
||||||
//! \copydoc swift::core::context::IContextSimulator::iconForModel
|
|
||||||
virtual swift::misc::CPixmap iconForModel(const QString &modelString) const override;
|
|
||||||
|
|
||||||
//! \copydoc swift::core::context::IContextSimulator::followAircraft
|
//! \copydoc swift::core::context::IContextSimulator::followAircraft
|
||||||
virtual bool followAircraft(const swift::misc::aviation::CCallsign &callsign) override;
|
virtual bool followAircraft(const swift::misc::aviation::CCallsign &callsign) override;
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,6 @@ namespace swift::gui::components
|
|||||||
&CMappingComponent::onModelsUpdateRequested);
|
&CMappingComponent::onModelsUpdateRequested);
|
||||||
connect(ui->tvp_AircraftModels, &CAircraftModelView::modelDataChanged, this,
|
connect(ui->tvp_AircraftModels, &CAircraftModelView::modelDataChanged, this,
|
||||||
&CMappingComponent::onRowCountChanged);
|
&CMappingComponent::onRowCountChanged);
|
||||||
connect(ui->tvp_AircraftModels, &CAircraftModelView::clicked, this, &CMappingComponent::onModelSelectedInView);
|
|
||||||
connect(ui->tvp_AircraftModels, &CAircraftModelView::requestTempDisableModelsForMatching, this,
|
connect(ui->tvp_AircraftModels, &CAircraftModelView::requestTempDisableModelsForMatching, this,
|
||||||
&CMappingComponent::onTempDisableModelsForMatchingRequested);
|
&CMappingComponent::onTempDisableModelsForMatchingRequested);
|
||||||
|
|
||||||
@@ -259,21 +258,6 @@ namespace swift::gui::components
|
|||||||
ui->completer_ModelStrings->setModel(simAircraft.getModel());
|
ui->completer_ModelStrings->setModel(simAircraft.getModel());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMappingComponent::onModelSelectedInView(const QModelIndex &index)
|
|
||||||
{
|
|
||||||
const CAircraftModel model = ui->tvp_AircraftModels->at(index);
|
|
||||||
ui->completer_ModelStrings->setModel(model);
|
|
||||||
|
|
||||||
if (ui->cb_AircraftIconDisplayed->isChecked())
|
|
||||||
{
|
|
||||||
const QString modelString(model.getModelString());
|
|
||||||
const CPixmap pm = sGui->getIContextSimulator()->iconForModel(modelString);
|
|
||||||
if (pm.isNull()) { this->closeOverlay(); }
|
|
||||||
else { this->showOverlayImage(pm); }
|
|
||||||
}
|
|
||||||
else { this->onModelPreviewChanged(Qt::Unchecked); }
|
|
||||||
}
|
|
||||||
|
|
||||||
CCallsign CMappingComponent::validateRenderedCallsign()
|
CCallsign CMappingComponent::validateRenderedCallsign()
|
||||||
{
|
{
|
||||||
const QString cs = ui->le_Callsign->text().trimmed();
|
const QString cs = ui->le_Callsign->text().trimmed();
|
||||||
|
|||||||
@@ -113,9 +113,6 @@ namespace swift::gui
|
|||||||
//! Aircraft selected (in view)
|
//! Aircraft selected (in view)
|
||||||
void onAircraftSelectedInView(const QModelIndex &index);
|
void onAircraftSelectedInView(const QModelIndex &index);
|
||||||
|
|
||||||
//! Model selected (in view)
|
|
||||||
void onModelSelectedInView(const QModelIndex &index);
|
|
||||||
|
|
||||||
//! Save changed aircraft
|
//! Save changed aircraft
|
||||||
void onSaveAircraft();
|
void onSaveAircraft();
|
||||||
|
|
||||||
|
|||||||
@@ -96,15 +96,6 @@ namespace swift::gui::menus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_messageFrame && !model.getIconFile().isEmpty())
|
|
||||||
{
|
|
||||||
added = true;
|
|
||||||
menuActions.addMenuSimulator();
|
|
||||||
m_iconAction =
|
|
||||||
menuActions.addAction(m_iconAction, CIcons::appAircraft16(), "Display icon",
|
|
||||||
CMenuAction::pathSimulator(), { this, &CShowSimulatorFileMenu::displayIcon });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (added) { menuActions.addSeparator(CMenuAction::pathSimulator()); }
|
if (added) { menuActions.addSeparator(CMenuAction::pathSimulator()); }
|
||||||
}
|
}
|
||||||
this->nestedCustomMenu(menuActions);
|
this->nestedCustomMenu(menuActions);
|
||||||
@@ -131,18 +122,6 @@ namespace swift::gui::menus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CShowSimulatorFileMenu::displayIcon()
|
|
||||||
{
|
|
||||||
const CAircraftModelView *mv = modelView();
|
|
||||||
if (!mv->hasSingleSelectedRow()) { return; }
|
|
||||||
const CAircraftModel model(mv->selectedObject());
|
|
||||||
if (model.getIconFile().isEmpty()) { return; }
|
|
||||||
CStatusMessage msg(this);
|
|
||||||
const CPixmap pm(model.loadIcon(msg));
|
|
||||||
if (msg.isSuccess()) { m_messageFrame->showOverlayImage(pm); }
|
|
||||||
else { CLogMessage::preformatted(msg); }
|
|
||||||
}
|
|
||||||
|
|
||||||
void CShowSimulatorFileMenu::startModelConverterX()
|
void CShowSimulatorFileMenu::startModelConverterX()
|
||||||
{
|
{
|
||||||
if (!CModelConverterX::supportsModelConverterX()) { return; }
|
if (!CModelConverterX::supportsModelConverterX()) { return; }
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ namespace swift::gui
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void showSimulatorFile(); //!< simulator file
|
void showSimulatorFile(); //!< simulator file
|
||||||
void displayIcon(); //!< aircraft icon if any
|
|
||||||
void startModelConverterX(); //!< show in model converter X
|
void startModelConverterX(); //!< show in model converter X
|
||||||
|
|
||||||
swift::gui::COverlayMessagesFrame *m_messageFrame = nullptr;
|
swift::gui::COverlayMessagesFrame *m_messageFrame = nullptr;
|
||||||
|
|||||||
@@ -120,7 +120,6 @@ namespace swift::gui::models
|
|||||||
m_columns.addColumn(CColumn::standardString("filename", CAircraftModel::IndexFileName));
|
m_columns.addColumn(CColumn::standardString("filename", CAircraftModel::IndexFileName));
|
||||||
m_columns.addColumn(CColumn::standardString("file ts.", "file timestamp",
|
m_columns.addColumn(CColumn::standardString("file ts.", "file timestamp",
|
||||||
CAircraftModel::IndexFileTimestampFormattedYmdhms));
|
CAircraftModel::IndexFileTimestampFormattedYmdhms));
|
||||||
m_columns.addColumn(CColumn::standardString("icon", CAircraftModel::IndexIconPath));
|
|
||||||
m_columns.addColumn(CColumn::standardString("version", CAircraftModel::IndexVersion));
|
m_columns.addColumn(CColumn::standardString("version", CAircraftModel::IndexVersion));
|
||||||
m_columns.addColumn(CColumn::standardString("changed", CAircraftModel::IndexUtcTimestampFormattedYmdhms));
|
m_columns.addColumn(CColumn::standardString("changed", CAircraftModel::IndexUtcTimestampFormattedYmdhms));
|
||||||
|
|
||||||
|
|||||||
@@ -270,7 +270,6 @@ namespace swift::misc::simulation
|
|||||||
case IndexSupportedParts: return QVariant(m_supportedParts);
|
case IndexSupportedParts: return QVariant(m_supportedParts);
|
||||||
case IndexFileTimestamp: return QVariant::fromValue(this->getFileTimestamp());
|
case IndexFileTimestamp: return QVariant::fromValue(this->getFileTimestamp());
|
||||||
case IndexFileTimestampFormattedYmdhms: return QVariant::fromValue(this->getFormattedFileTimestampYmdhms());
|
case IndexFileTimestampFormattedYmdhms: return QVariant::fromValue(this->getFormattedFileTimestampYmdhms());
|
||||||
case IndexIconPath: return QVariant(m_iconFile);
|
|
||||||
case IndexAircraftIcaoCode: return m_aircraftIcao.propertyByIndex(index.copyFrontRemoved());
|
case IndexAircraftIcaoCode: return m_aircraftIcao.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexLivery: return m_livery.propertyByIndex(index.copyFrontRemoved());
|
case IndexLivery: return m_livery.propertyByIndex(index.copyFrontRemoved());
|
||||||
case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved());
|
case IndexCallsign: return m_callsign.propertyByIndex(index.copyFrontRemoved());
|
||||||
@@ -308,7 +307,6 @@ namespace swift::misc::simulation
|
|||||||
case IndexDescription: m_description = variant.toString(); break;
|
case IndexDescription: m_description = variant.toString(); break;
|
||||||
case IndexSimulatorInfo: m_simulator.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexSimulatorInfo: m_simulator.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexName: m_name = variant.toString(); break;
|
case IndexName: m_name = variant.toString(); break;
|
||||||
case IndexIconPath: m_iconFile = variant.toString(); break;
|
|
||||||
case IndexCG: m_cg.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
case IndexCG: m_cg.setPropertyByIndex(index.copyFrontRemoved(), variant); break;
|
||||||
case IndexSupportedParts: this->setSupportedParts(variant.toString()); break;
|
case IndexSupportedParts: this->setSupportedParts(variant.toString()); break;
|
||||||
case IndexModelType: m_modelType = variant.value<ModelType>(); break;
|
case IndexModelType: m_modelType = variant.value<ModelType>(); break;
|
||||||
@@ -370,7 +368,6 @@ namespace swift::misc::simulation
|
|||||||
case IndexCallsign:
|
case IndexCallsign:
|
||||||
return m_callsign.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCallsign());
|
return m_callsign.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCallsign());
|
||||||
case IndexFileName: return m_fileName.compare(compareValue.getFileName(), Qt::CaseInsensitive);
|
case IndexFileName: return m_fileName.compare(compareValue.getFileName(), Qt::CaseInsensitive);
|
||||||
case IndexIconPath: return m_iconFile.compare(compareValue.getIconFile(), Qt::CaseInsensitive);
|
|
||||||
case IndexCG: return m_cg.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCG());
|
case IndexCG: return m_cg.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getCG());
|
||||||
case IndexSupportedParts: return m_supportedParts.compare(compareValue.getSupportedParts());
|
case IndexSupportedParts: return m_supportedParts.compare(compareValue.getSupportedParts());
|
||||||
case IndexModelTypeAsString:
|
case IndexModelTypeAsString:
|
||||||
@@ -556,31 +553,6 @@ namespace swift::misc::simulation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CPixmap CAircraftModel::loadIcon(CStatusMessage &success) const
|
|
||||||
{
|
|
||||||
static const CStatusMessage noIcon(this, CStatusMessage::SeverityInfo, u"no icon");
|
|
||||||
static const CStatusMessage loaded(this, CStatusMessage::SeverityInfo, u"icon loaded");
|
|
||||||
if (m_iconFile.isEmpty())
|
|
||||||
{
|
|
||||||
success = noIcon;
|
|
||||||
return CPixmap();
|
|
||||||
}
|
|
||||||
if (!QFile(m_iconFile).exists())
|
|
||||||
{
|
|
||||||
success = noIcon;
|
|
||||||
return CPixmap();
|
|
||||||
}
|
|
||||||
|
|
||||||
QPixmap pm;
|
|
||||||
if (!pm.load(m_iconFile))
|
|
||||||
{
|
|
||||||
success = noIcon;
|
|
||||||
return CPixmap();
|
|
||||||
}
|
|
||||||
success = loaded;
|
|
||||||
return pm;
|
|
||||||
}
|
|
||||||
|
|
||||||
const QString &CAircraftModel::liveryStringPrefix()
|
const QString &CAircraftModel::liveryStringPrefix()
|
||||||
{
|
{
|
||||||
static const QString p("swift_");
|
static const QString p("swift_");
|
||||||
@@ -688,7 +660,6 @@ namespace swift::misc::simulation
|
|||||||
void CAircraftModel::updateByExistingDirectories(const CAircraftModel &otherModel)
|
void CAircraftModel::updateByExistingDirectories(const CAircraftModel &otherModel)
|
||||||
{
|
{
|
||||||
if (otherModel.hasExistingCorrespondingFile()) { this->setFileName(otherModel.getFileName()); }
|
if (otherModel.hasExistingCorrespondingFile()) { this->setFileName(otherModel.getFileName()); }
|
||||||
if (otherModel.hasExistingIconFile()) { this->setIconFile(otherModel.getIconFile()); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAircraftModel::hasQueriedModelString() const
|
bool CAircraftModel::hasQueriedModelString() const
|
||||||
@@ -736,13 +707,11 @@ namespace swift::misc::simulation
|
|||||||
{
|
{
|
||||||
// other local, priority
|
// other local, priority
|
||||||
this->setFileName(model.getFileName());
|
this->setFileName(model.getFileName());
|
||||||
this->setIconFile(model.getIconFile());
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// both not local, override empty values
|
// both not local, override empty values
|
||||||
if (m_fileName.isEmpty()) { this->setFileName(model.getFileName()); }
|
if (m_fileName.isEmpty()) { this->setFileName(model.getFileName()); }
|
||||||
if (m_iconFile.isEmpty()) { this->setIconFile(model.getIconFile()); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAircraftModel::adjustLocalFileNames(const QString &newModelDir, const QString &stripModelDirIndicator)
|
bool CAircraftModel::adjustLocalFileNames(const QString &newModelDir, const QString &stripModelDirIndicator)
|
||||||
@@ -796,13 +765,6 @@ namespace swift::misc::simulation
|
|||||||
return (p.contains(path, cs));
|
return (p.contains(path, cs));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CAircraftModel::hasExistingIconFile() const
|
|
||||||
{
|
|
||||||
if (m_iconFile.isEmpty()) { return false; }
|
|
||||||
const QFileInfo fi(m_iconFile);
|
|
||||||
return fi.exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CAircraftModel::matchesModelString(const QString &modelString, Qt::CaseSensitivity sensitivity) const
|
bool CAircraftModel::matchesModelString(const QString &modelString, Qt::CaseSensitivity sensitivity) const
|
||||||
{
|
{
|
||||||
return stringCompare(modelString, m_modelString, sensitivity);
|
return stringCompare(modelString, m_modelString, sensitivity);
|
||||||
|
|||||||
@@ -117,7 +117,6 @@ namespace swift::misc
|
|||||||
IndexFileName,
|
IndexFileName,
|
||||||
IndexFileTimestamp,
|
IndexFileTimestamp,
|
||||||
IndexFileTimestampFormattedYmdhms,
|
IndexFileTimestampFormattedYmdhms,
|
||||||
IndexIconPath,
|
|
||||||
IndexModelType,
|
IndexModelType,
|
||||||
IndexModelTypeAsString,
|
IndexModelTypeAsString,
|
||||||
IndexModelMode,
|
IndexModelMode,
|
||||||
@@ -481,15 +480,6 @@ namespace swift::misc
|
|||||||
//! File name
|
//! File name
|
||||||
void setFileName(const QString &fileName) { m_fileName = fileName; }
|
void setFileName(const QString &fileName) { m_fileName = fileName; }
|
||||||
|
|
||||||
//! Icon file representing model
|
|
||||||
const QString &getIconFile() const { return m_iconFile; }
|
|
||||||
|
|
||||||
//! Icon file representing model
|
|
||||||
void setIconFile(const QString &iconFile) { m_iconFile = iconFile; }
|
|
||||||
|
|
||||||
//! Is the icon file existing?
|
|
||||||
bool hasExistingIconFile() const;
|
|
||||||
|
|
||||||
//! Get timestamp
|
//! Get timestamp
|
||||||
QDateTime getFileTimestamp() const;
|
QDateTime getFileTimestamp() const;
|
||||||
|
|
||||||
@@ -508,9 +498,6 @@ namespace swift::misc
|
|||||||
//! Set file timestamp, timestamp and file name
|
//! Set file timestamp, timestamp and file name
|
||||||
void setFileDetailsAndTimestamp(const QFileInfo &fileInfo);
|
void setFileDetailsAndTimestamp(const QFileInfo &fileInfo);
|
||||||
|
|
||||||
//! Load icon from disk
|
|
||||||
CPixmap loadIcon(CStatusMessage &success) const;
|
|
||||||
|
|
||||||
//! File path for DB (absolute paths make no sense in DB)
|
//! File path for DB (absolute paths make no sense in DB)
|
||||||
void normalizeFileNameForDb();
|
void normalizeFileNameForDb();
|
||||||
|
|
||||||
@@ -584,7 +571,6 @@ namespace swift::misc
|
|||||||
QString m_name; //!< Model name
|
QString m_name; //!< Model name
|
||||||
QString m_description; //!< descriptive text
|
QString m_description; //!< descriptive text
|
||||||
QString m_fileName; //!< file name
|
QString m_fileName; //!< file name
|
||||||
QString m_iconFile; //!< a file representing the aircraft as icon
|
|
||||||
QString m_supportedParts; //!< supported parts
|
QString m_supportedParts; //!< supported parts
|
||||||
qint64 m_fileTimestamp = -1; //!< file timestamp of originating file (if applicable)
|
qint64 m_fileTimestamp = -1; //!< file timestamp of originating file (if applicable)
|
||||||
ModelType m_modelType = TypeUnknown; //!< model string is coming representing ...?
|
ModelType m_modelType = TypeUnknown; //!< model string is coming representing ...?
|
||||||
@@ -608,7 +594,6 @@ namespace swift::misc
|
|||||||
SWIFT_METAMEMBER(name),
|
SWIFT_METAMEMBER(name),
|
||||||
SWIFT_METAMEMBER(description, 0, DisabledForComparison),
|
SWIFT_METAMEMBER(description, 0, DisabledForComparison),
|
||||||
SWIFT_METAMEMBER(fileName, 0, DisabledForComparison),
|
SWIFT_METAMEMBER(fileName, 0, DisabledForComparison),
|
||||||
SWIFT_METAMEMBER(iconFile, 0, DisabledForComparison),
|
|
||||||
SWIFT_METAMEMBER(fileTimestamp, 0, DisabledForComparison),
|
SWIFT_METAMEMBER(fileTimestamp, 0, DisabledForComparison),
|
||||||
SWIFT_METAMEMBER(modelType),
|
SWIFT_METAMEMBER(modelType),
|
||||||
SWIFT_METAMEMBER(modelMode));
|
SWIFT_METAMEMBER(modelMode));
|
||||||
|
|||||||
@@ -559,20 +559,6 @@ namespace swift::misc::simulation
|
|||||||
return ac.key(max);
|
return ac.key(max);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAircraftModelList::findModelIconPathByModelString(const QString &modelString) const
|
|
||||||
{
|
|
||||||
if (modelString.isEmpty()) { return {}; }
|
|
||||||
const CAircraftModel m(findFirstByModelStringOrDefault(modelString, Qt::CaseInsensitive));
|
|
||||||
return m.getIconFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CAircraftModelList::findModelIconPathByCallsign(const CCallsign &callsign) const
|
|
||||||
{
|
|
||||||
if (callsign.isEmpty()) { return {}; }
|
|
||||||
const CAircraftModel m(findFirstByCallsignOrDefault(callsign));
|
|
||||||
return m.getIconFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
CAircraftModelList CAircraftModelList::findModelsWithoutExistingFile() const
|
CAircraftModelList CAircraftModelList::findModelsWithoutExistingFile() const
|
||||||
{
|
{
|
||||||
return this->findBy([](const CAircraftModel &model) { return !model.hasExistingCorrespondingFile(); });
|
return this->findBy([](const CAircraftModel &model) { return !model.hasExistingCorrespondingFile(); });
|
||||||
|
|||||||
@@ -261,12 +261,6 @@ namespace swift::misc
|
|||||||
//! Find by categories
|
//! Find by categories
|
||||||
CAircraftModelList findByCategories(const aviation::CAircraftCategoryList &categories) const;
|
CAircraftModelList findByCategories(const aviation::CAircraftCategoryList &categories) const;
|
||||||
|
|
||||||
//! Model icon path
|
|
||||||
QString findModelIconPathByModelString(const QString &modelString) const;
|
|
||||||
|
|
||||||
//! Model icon path
|
|
||||||
QString findModelIconPathByCallsign(const aviation::CCallsign &callsign) const;
|
|
||||||
|
|
||||||
//! Find models where the filename is not set or the file no longer exists
|
//! Find models where the filename is not set or the file no longer exists
|
||||||
CAircraftModelList findModelsWithoutExistingFile() const;
|
CAircraftModelList findModelsWithoutExistingFile() const;
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ namespace swift::misc::simulation::fscommon
|
|||||||
model.setName(this->getSimName());
|
model.setName(this->getSimName());
|
||||||
model.setMSecsSinceEpoch(m_timestampMSecsSinceEpoch); // aircraft.cfg file timestamp
|
model.setMSecsSinceEpoch(m_timestampMSecsSinceEpoch); // aircraft.cfg file timestamp
|
||||||
model.setFileTimestamp(m_timestampMSecsSinceEpoch);
|
model.setFileTimestamp(m_timestampMSecsSinceEpoch);
|
||||||
model.setIconFile(this->getThumbnailFileNameChecked());
|
|
||||||
|
|
||||||
const QString designator(CAircraftIcaoCode::normalizeDesignator(this->getAtcModel()));
|
const QString designator(CAircraftIcaoCode::normalizeDesignator(this->getAtcModel()));
|
||||||
CAircraftIcaoCode aircraft(CAircraftIcaoCode::isValidDesignator(designator) ?
|
CAircraftIcaoCode aircraft(CAircraftIcaoCode::isValidDesignator(designator) ?
|
||||||
@@ -125,23 +124,6 @@ namespace swift::misc::simulation::fscommon
|
|||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CAircraftCfgEntries::getThumbnailFileNameGuess() const
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString CAircraftCfgEntries::getThumbnailFileNameChecked() const
|
|
||||||
{
|
|
||||||
const QString f(getThumbnailFileNameGuess());
|
|
||||||
if (f.isEmpty()) { return {}; }
|
|
||||||
if (QFile(f).exists()) { return f; }
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariant CAircraftCfgEntries::propertyByIndex(swift::misc::CPropertyIndexRef index) const
|
QVariant CAircraftCfgEntries::propertyByIndex(swift::misc::CPropertyIndexRef index) const
|
||||||
{
|
{
|
||||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||||
|
|||||||
@@ -162,13 +162,6 @@ namespace swift::misc::simulation::fscommon
|
|||||||
//! To aircraft model
|
//! To aircraft model
|
||||||
swift::misc::simulation::CAircraftModel toAircraftModel() const;
|
swift::misc::simulation::CAircraftModel toAircraftModel() const;
|
||||||
|
|
||||||
//! Thumbnail.jpg path if possible
|
|
||||||
QString getThumbnailFileNameGuess() const;
|
|
||||||
|
|
||||||
//! Thumbnail.jpg path if possible, and checked if file exists
|
|
||||||
//! \remark checks file existence, consider I/O load
|
|
||||||
QString getThumbnailFileNameChecked() const;
|
|
||||||
|
|
||||||
//! \copydoc swift::misc::mixin::Index::propertyByIndex
|
//! \copydoc swift::misc::mixin::Index::propertyByIndex
|
||||||
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
|
QVariant propertyByIndex(swift::misc::CPropertyIndexRef index) const;
|
||||||
|
|
||||||
|
|||||||
@@ -406,9 +406,6 @@ namespace swift::misc
|
|||||||
//! Difference of network and (rendered) livery code
|
//! Difference of network and (rendered) livery code
|
||||||
QString getNetworkModelLiveryDifference() const;
|
QString getNetworkModelLiveryDifference() const;
|
||||||
|
|
||||||
//! \copydoc swift::misc::simulation::CAircraftModel::getIconFile
|
|
||||||
const QString &getIconFile() const { return m_models[CurrentModel].getIconFile(); }
|
|
||||||
|
|
||||||
//! Get model string
|
//! Get model string
|
||||||
const QString &getModelString() const { return m_models[CurrentModel].getModelString(); }
|
const QString &getModelString() const { return m_models[CurrentModel].getModelString(); }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user