mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-31 21:15:33 +08:00
refs #404 Added human-readable plugin names
* Added new "identifier" attribute in JSON metadata files * "identifier" is now the one that makes plugins unique * "name" attribute is a human-readable name
This commit is contained in:
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
QJsonObject data = json["MetaData"].toObject();
|
||||
if (data["name"].isUndefined() || data["simulator"].isUndefined())
|
||||
if (data.value("identifier").isUndefined() || data.value("simulator").isUndefined())
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ namespace BlackMisc
|
||||
QString CSimulatorPluginInfo::convertToQString(bool i18n) const
|
||||
{
|
||||
Q_UNUSED(i18n);
|
||||
return QString("%1 (%2)").arg(m_name, m_simulator);
|
||||
return QString("%1 (%2)").arg(m_name, m_identifier);
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -22,17 +22,20 @@ namespace BlackMisc
|
||||
//! Describing a simulator plugin
|
||||
class CSimulatorPluginInfo : public BlackMisc::CValueObject<CSimulatorPluginInfo>
|
||||
{
|
||||
//! The _name_ property identifies the plugin itself and must be uniqe.
|
||||
Q_PROPERTY(QString getName READ getName)
|
||||
//! The _identifier_ property identifies the plugin itself and must be uniqe.
|
||||
Q_PROPERTY(QString identifier READ getIdentifier)
|
||||
|
||||
//! The _name_ property is a human-readable plugin name.
|
||||
Q_PROPERTY(QString same READ getName)
|
||||
|
||||
//! The _simulator_ property specifies which simulator the plugin handles.
|
||||
//! There cannot be two plugins loaded for the same simulator.
|
||||
//! swift enables some features for particular simulators. Currently recognized are:
|
||||
//! fsx, fs9, xplane
|
||||
Q_PROPERTY(QString getSimulator READ getSimulator)
|
||||
Q_PROPERTY(QString simulator READ getSimulator)
|
||||
|
||||
//! The _description_ property provides a short, human-readable description of the plugin.
|
||||
Q_PROPERTY(QString getDescription READ getDescription)
|
||||
Q_PROPERTY(QString description READ getDescription)
|
||||
|
||||
public:
|
||||
//! Default constructor
|
||||
@@ -52,7 +55,10 @@ namespace BlackMisc
|
||||
bool isValid() const { return m_valid; }
|
||||
|
||||
//! Equals
|
||||
bool operator==(const CSimulatorPluginInfo &other) { return getName() == other.getName(); }
|
||||
bool operator==(const CSimulatorPluginInfo &other) { return getIdentifier() == other.getIdentifier(); }
|
||||
|
||||
//! Identifier
|
||||
const QString &getIdentifier() const { return m_identifier; }
|
||||
|
||||
//! Name
|
||||
const QString &getName() const { return m_name; }
|
||||
@@ -69,6 +75,7 @@ namespace BlackMisc
|
||||
|
||||
private:
|
||||
BLACK_ENABLE_TUPLE_CONVERSION(CSimulatorPluginInfo)
|
||||
QString m_identifier;
|
||||
QString m_name;
|
||||
QString m_simulator;
|
||||
QString m_description;
|
||||
@@ -78,6 +85,7 @@ namespace BlackMisc
|
||||
} // ns
|
||||
|
||||
BLACK_DECLARE_TUPLE_CONVERSION(BlackMisc::Simulation::CSimulatorPluginInfo, (
|
||||
attr(o.m_identifier),
|
||||
attr(o.m_name),
|
||||
attr(o.m_simulator),
|
||||
attr(o.m_description),
|
||||
|
||||
Reference in New Issue
Block a user