Split of CSimulatorPluginInfo and CSimulatorSetup

refs #404, and discussion https://dev.vatsim-germany.org/issues/404#note-8

* Changed CSimulatorSetup to use CNameVariantPairList as data. The old version was an hack and had to go, CNameVariantPairList would allow complex types in the future and can be already shown in the GUI.
* CNameVariantPairList was improved slightly in the same step
* Functions to get CSimulatorSetup from driver / context
* Removed CSimulatorSetup data from CSimulatorPluginInfo
This commit is contained in:
Klaus Basan
2015-04-11 01:51:21 +02:00
parent 291746bc57
commit 5d819b30f5
26 changed files with 448 additions and 349 deletions

View File

@@ -18,9 +18,8 @@
namespace BlackMisc
{
/*!
* Value object encapsulating a list of name/variant pairs.
*/
//! Value object encapsulating a list of name/variant pairs
//! Currently name must be unique
class CNameVariantPairList : public CSequence<CNameVariantPair>
{
public:
@@ -30,12 +29,25 @@ namespace BlackMisc
//! Construct from a base class object.
CNameVariantPairList(const CSequence<CNameVariantPair> &other);
//! Get name index
int getNameRowIndex(const QString &name) const;
//! Get name's index, -1 if not found
int getIndexForName(const QString &name) const;
//! Contains name
bool containsName(const QString &name) const;
//! Get value
CNameVariantPair getValue(const QString &name) const;
//! Get pair's variant value or default if not existing
CVariant getVariantValue(const QString &name) const;
//! Get pair's variant value as string (empty if not existing)
QString getValueAsString(const QString &name) const;
//! Add value, if name already exists replace (true)
//! If one is sure(!) the name does not exists, \sa push_back() can be used
bool addOrReplaceValue(const QString &name, const CVariant &value, const CIcon &icon = CIcon());
//! \copydoc CValueObject::toQVariant
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }