refs #283 Added ISimulator::getInstalledModels method, with stub implementations

This commit is contained in:
Mathew Sutcliffe
2014-08-19 18:36:57 +01:00
parent 09f0d008cb
commit 4aef58564e
7 changed files with 121 additions and 2 deletions

View File

@@ -0,0 +1,50 @@
/* Copyright (C) 2013 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nwaircraftmodellist.h"
#include "predicates.h"
using namespace BlackMisc::Network;
using namespace BlackMisc::Aviation;
namespace BlackMisc
{
namespace Network
{
/*
* Empty constructor
*/
CAircraftModelList::CAircraftModelList() { }
/*
* Construct from base class object
*/
CAircraftModelList::CAircraftModelList(const CSequence<CAircraftModel> &other) :
CSequence<CAircraftModel>(other)
{ }
CAircraftModelList CAircraftModelList::findByModelString(const QString modelString, Qt::CaseSensitivity sensitivity) const
{
return this->findBy([ = ](const CAircraftModel &model)
{
return model.matchesModelString(modelString, sensitivity);
});
}
/*
* Register metadata
*/
void CAircraftModelList::registerMetadata()
{
qRegisterMetaType<BlackMisc::CSequence<CAircraftModel>>();
qDBusRegisterMetaType<BlackMisc::CSequence<CAircraftModel>>();
qRegisterMetaType<BlackMisc::CCollection<CAircraftModel>>();
qDBusRegisterMetaType<BlackMisc::CCollection<CAircraftModel>>();
qRegisterMetaType<CAircraftModelList>();
qDBusRegisterMetaType<CAircraftModelList>();
}
} // namespace
} // namespace

View File

@@ -0,0 +1,49 @@
/* Copyright (C) 2014 VATSIM Community / authors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! \file
#ifndef BLACKMISC_AIRCRAFTMODELLIST_H
#define BLACKMISC_AIRCRAFTMODELLIST_H
#include "nwaircraftmodel.h"
#include "collection.h"
#include "sequence.h"
namespace BlackMisc
{
namespace Network
{
/*!
* Value object encapsulating a list of aircraft models
*/
class CAircraftModelList : public CSequence<CAircraftModel>
{
public:
//! Empty constructor.
CAircraftModelList();
//! Construct from a base class object.
CAircraftModelList(const CSequence<CAircraftModel> &other);
//! QVariant, required for DBus QVariant lists
virtual QVariant toQVariant() const override { return QVariant::fromValue(*this); }
//! Find by model string
CAircraftModelList findByModelString(const QString modelString, Qt::CaseSensitivity sensitivity) const;
//! Register metadata
static void registerMetadata();
};
} //namespace
} // namespace
Q_DECLARE_METATYPE(BlackMisc::Network::CAircraftModelList)
Q_DECLARE_METATYPE(BlackMisc::CCollection<BlackMisc::Network::CAircraftModel>)
Q_DECLARE_METATYPE(BlackMisc::CSequence<BlackMisc::Network::CAircraftModel>)
#endif //guard