mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-09 21:45:34 +08:00
refs #283 Added ISimulator::getInstalledModels method, with stub implementations
This commit is contained in:
50
src/blackmisc/nwaircraftmodellist.cpp
Normal file
50
src/blackmisc/nwaircraftmodellist.cpp
Normal 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
|
||||
49
src/blackmisc/nwaircraftmodellist.h
Normal file
49
src/blackmisc/nwaircraftmodellist.h
Normal 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
|
||||
Reference in New Issue
Block a user