From 5ae8f074b869c1bfc3494327440997d3a67536a1 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Sun, 18 Jan 2015 23:20:28 +0100 Subject: [PATCH] refs #368, updated models to reflect changes * update count with filter * used alternative sortable columns * added classes for SimulatedAircraft * supporting filters --- src/blackgui/models/aircraftlistmodel.cpp | 2 +- src/blackgui/models/aircraftlistmodel.h | 4 +- .../models/aircraftmodellistmodel.cpp | 7 +- src/blackgui/models/aircraftmodellistmodel.h | 4 +- src/blackgui/models/atcstationlistmodel.cpp | 49 ++++++---- src/blackgui/models/clientlistmodel.cpp | 20 +++- .../models/simulatedaircraftlistmodel.cpp | 95 +++++++++++++++++++ .../models/simulatedaircraftlistmodel.h | 52 ++++++++++ src/blackgui/models/userlistmodel.cpp | 15 +-- src/blackgui/views/aircraftview.h | 6 +- src/blackgui/views/simulatedaircraftview.cpp | 31 ++++++ src/blackgui/views/simulatedaircraftview.h | 35 +++++++ 12 files changed, 278 insertions(+), 42 deletions(-) create mode 100644 src/blackgui/models/simulatedaircraftlistmodel.cpp create mode 100644 src/blackgui/models/simulatedaircraftlistmodel.h create mode 100644 src/blackgui/views/simulatedaircraftview.cpp create mode 100644 src/blackgui/views/simulatedaircraftview.h diff --git a/src/blackgui/models/aircraftlistmodel.cpp b/src/blackgui/models/aircraftlistmodel.cpp index 855b74fd1..65eb963ff 100644 --- a/src/blackgui/models/aircraftlistmodel.cpp +++ b/src/blackgui/models/aircraftlistmodel.cpp @@ -24,7 +24,7 @@ namespace BlackGui */ CAircraftListModel::CAircraftListModel(QObject *parent) : CListModelBase("ViewAircraftList", parent) { - this->m_columns.addColumn(CColumn::standardValueObject("call", "callsign", CAircraft::IndexCallsign)); + this->m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", { CAircraft::IndexCallsign, CCallsign::IndexCallsignString })); this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CAircraft::IndexPilot, CUser::IndexRealName })); this->m_columns.addColumn(CColumn("distance", CAircraft::IndexDistance, new CAirspaceDistanceFormatter())); this->m_columns.addColumn(CColumn("frequency", { CAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter())); diff --git a/src/blackgui/models/aircraftlistmodel.h b/src/blackgui/models/aircraftlistmodel.h index ce4766d6b..0a30d4285 100644 --- a/src/blackgui/models/aircraftlistmodel.h +++ b/src/blackgui/models/aircraftlistmodel.h @@ -35,6 +35,6 @@ namespace BlackGui virtual ~CAircraftListModel() {} }; - } -} + } // namespace +} // namespace #endif // guard diff --git a/src/blackgui/models/aircraftmodellistmodel.cpp b/src/blackgui/models/aircraftmodellistmodel.cpp index afd4ee002..5ce4f6e17 100644 --- a/src/blackgui/models/aircraftmodellistmodel.cpp +++ b/src/blackgui/models/aircraftmodellistmodel.cpp @@ -13,6 +13,7 @@ #include "blackmisc/blackmiscfreefunctions.h" using namespace BlackMisc; +using namespace BlackMisc::Simulation; using namespace BlackMisc::Aviation; using namespace BlackMisc::Network; @@ -53,14 +54,14 @@ namespace BlackGui case MappedModel: this->m_columns.addColumn(CColumn::standardValueObject("call", "callsign", CAircraftModel::IndexCallsign)); - this->m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexModelString})); + this->m_columns.addColumn(CColumn::standardString("model", CAircraftModel::IndexModelString)); this->m_columns.addColumn(CColumn::standardString("ac", "aircraft ICAO", { CAircraftModel::IndexIcao, CAircraftIcao::IndexAircraftDesignator})); this->m_columns.addColumn(CColumn::standardString("al", "airline ICAO", { CAircraftModel::IndexIcao, CAircraftIcao::IndexAirlineDesignator})); // this->m_columns.addColumn(CColumn::standardString("ct", "combined type", { CAircraftModel::IndexIcao, CAircraftIcao::IndexCombinedAircraftType})); this->m_columns.addColumn(CColumn("q.?", "queried", CAircraftModel::IndexHasQueriedModelString, new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "queried", "not queried"))); - this->m_columns.addColumn(CColumn::standardString("description", { CAircraftModel::IndexDescription})); - this->m_columns.addColumn(CColumn::standardString("filename", { CAircraftModel::IndexFileName})); + this->m_columns.addColumn(CColumn::standardString("description", CAircraftModel::IndexDescription)); + this->m_columns.addColumn(CColumn::standardString("filename", CAircraftModel::IndexFileName)); // default sort order this->setSortColumnByPropertyIndex(CAircraftModel::IndexModelString); diff --git a/src/blackgui/models/aircraftmodellistmodel.h b/src/blackgui/models/aircraftmodellistmodel.h index 76f854ca7..3b924d2f5 100644 --- a/src/blackgui/models/aircraftmodellistmodel.h +++ b/src/blackgui/models/aircraftmodellistmodel.h @@ -12,7 +12,7 @@ #ifndef BLACKGUI_AIRCRAFTMODELLISTMODEL_H #define BLACKGUI_AIRCRAFTMODELLISTMODEL_H -#include "blackmisc/nwaircraftmodellist.h" +#include "blackmisc/simulation/aircraftmodellist.h" #include "blackgui/models/listmodelbase.h" #include #include @@ -23,7 +23,7 @@ namespace BlackGui { //! Aircraft model list model - class CAircraftModelListModel : public CListModelBase + class CAircraftModelListModel : public CListModelBase { public: diff --git a/src/blackgui/models/atcstationlistmodel.cpp b/src/blackgui/models/atcstationlistmodel.cpp index a08dbbf3d..54968842e 100644 --- a/src/blackgui/models/atcstationlistmodel.cpp +++ b/src/blackgui/models/atcstationlistmodel.cpp @@ -49,32 +49,39 @@ namespace BlackGui { case NotSet: case StationsOnline: - this->m_columns.addColumn(CColumn::standardString("call", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet })); - this->m_columns.addColumn(CColumn("type", CAtcStation::IndexIcon)); - this->m_columns.addColumn(CColumn("distance", CAtcStation::IndexDistance, new CAirspaceDistanceFormatter())); - this->m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter())); - this->m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName })); - this->m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatHm()))); - this->m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatHm()))); - this->m_columns.addColumn(CColumn::standardString("voiceroomurl", { CAtcStation::IndexVoiceRoom, CVoiceRoom::IndexUrl })); + { + this->m_columns.addColumn(CColumn::standardString("call", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet })); + CColumn col = CColumn("type", CAtcStation::IndexIcon); + col.setSortPropertyIndex({ CAtcStation::IndexCallsign, CCallsign::IndexSuffix }); + this->m_columns.addColumn(col); + this->m_columns.addColumn(CColumn("distance", CAtcStation::IndexDistance, new CAirspaceDistanceFormatter())); + this->m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter())); + this->m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName })); + this->m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatHm()))); + this->m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatHm()))); + this->m_columns.addColumn(CColumn::standardString("voiceroomurl", { CAtcStation::IndexVoiceRoom, CVoiceRoom::IndexUrl })); - // default sort order - this->setSortColumnByPropertyIndex(CAtcStation::IndexDistance); - this->m_sortOrder = Qt::AscendingOrder; + // default sort order + this->setSortColumnByPropertyIndex(CAtcStation::IndexDistance); + this->m_sortOrder = Qt::AscendingOrder; + } break; case StationsBooked: - this->m_columns.addColumn(CColumn::standardString("call", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet })); - this->m_columns.addColumn(CColumn("type", CAtcStation::IndexIcon)); - this->m_columns.addColumn(CColumn("", "on/offline", CAtcStation::IndexIsOnline, new CBoolLedFormatter("online", "offline"))); - this->m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName })); - this->m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm()))); - this->m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm()))); - this->m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter())); + { + this->m_columns.addColumn(CColumn::standardString("call", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet })); + CColumn col = CColumn("type", CAtcStation::IndexIcon); + col.setSortPropertyIndex({ CAtcStation::IndexCallsign, CCallsign::IndexSuffix }); + this->m_columns.addColumn(col); this->m_columns.addColumn(CColumn("", "on/offline", CAtcStation::IndexIsOnline, new CBoolLedFormatter("online", "offline"))); + this->m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName })); + this->m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm()))); + this->m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm()))); + this->m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter())); - // default sort order - this->setSortColumnByPropertyIndex(CAtcStation::IndexBookedFrom); - this->m_sortOrder = Qt::AscendingOrder; + // default sort order + this->setSortColumnByPropertyIndex(CAtcStation::IndexBookedFrom); + this->m_sortOrder = Qt::AscendingOrder; + } break; default: diff --git a/src/blackgui/models/clientlistmodel.cpp b/src/blackgui/models/clientlistmodel.cpp index 93c942586..463e603e2 100644 --- a/src/blackgui/models/clientlistmodel.cpp +++ b/src/blackgui/models/clientlistmodel.cpp @@ -14,6 +14,7 @@ #include using namespace BlackMisc; +using namespace BlackMisc::Simulation; using namespace BlackMisc::Network; namespace BlackGui @@ -29,7 +30,7 @@ namespace BlackGui this->m_columns.addColumn(CColumn("client", CClient::IndexIcon)); this->m_columns.addColumn(CColumn::standardValueObject("callsign", CClient::IndexCallsign)); this->m_columns.addColumn(CColumn::standardString("realname", { CClient::IndexUser, CUser::IndexRealName })); - this->m_columns.addColumn(CColumn("capabilities", CClient::IndexVoiceCapabilitiesIcon)); + this->m_columns.addColumn(CColumn("vo.", "voice capabilities", CClient::IndexVoiceCapabilitiesIcon,new CPixmapFormatter())); this->m_columns.addColumn(CColumn::standardString("capabilities", CClient::IndexCapabilitiesString)); this->m_columns.addColumn(CColumn::standardString("model", {CClient::IndexModel, CAircraftModel::IndexModelString})); this->m_columns.addColumn(CColumn("q.?", "queried", {CClient::IndexModel, CAircraftModel::IndexHasQueriedModelString}, @@ -47,18 +48,29 @@ namespace BlackGui QVariant CClientListModel::data(const QModelIndex &index, int role) const { static const CPropertyIndex ms( {CClient::IndexModel, CAircraftModel::IndexModelString}); - if (role != Qt::DisplayRole) { return CListModelBase::data(index, role); } + static const CPropertyIndex qf( {CClient::IndexModel, CAircraftModel::IndexHasQueriedModelString}); + if (role != Qt::DisplayRole && role != Qt::DecorationRole) { return CListModelBase::data(index, role); } CPropertyIndex pi = modelIndexToPropertyIndex(index); - if (pi == ms) + if (pi == ms && role == Qt::DisplayRole) { // no model string for ATC - CClient client = this->at(index); + const CClient client = this->at(index); bool atc = client.isAtc(); if (atc) { return QVariant("ATC"); } } + else if (pi == qf && role == Qt::DecorationRole) + { + // no symbol for ATC + const CClient client = this->at(index); + bool atc = client.isAtc(); + if (atc) + { + return QVariant(); + } + } return CListModelBase::data(index, role); } } // namespace diff --git a/src/blackgui/models/simulatedaircraftlistmodel.cpp b/src/blackgui/models/simulatedaircraftlistmodel.cpp new file mode 100644 index 000000000..6e8227e74 --- /dev/null +++ b/src/blackgui/models/simulatedaircraftlistmodel.cpp @@ -0,0 +1,95 @@ +/* Copyright (C) 2013 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#include "simulatedaircraftlistmodel.h" +#include "blackmisc/nwuser.h" +#include "blackmisc/avaircraftsituation.h" +#include "blackmisc/blackmiscfreefunctions.h" + +using namespace BlackMisc::Simulation; +using namespace BlackMisc::Aviation; +using namespace BlackMisc::Network; +using namespace BlackMisc; + +namespace BlackGui +{ + namespace Models + { + /* + * Constructor + */ + CSimulatedAircraftListModel::CSimulatedAircraftListModel(QObject *parent) : CListModelBase("ModelSimulatedAircraftList", parent) + { + this->setAircraftMode(InfoMode); + + // force strings for translation in resource files + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "callsign"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "pilotrealname"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "latitude"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "longitude"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "altitude"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "distance"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "height"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "transponder"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "groundspeed"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "icao"); + (void)QT_TRANSLATE_NOOP("ModelSimulatedAircraftList", "model"); + } + + void CSimulatedAircraftListModel::setAircraftMode(AircraftMode mode) + { + if (this->m_mode == mode) { return; } + this->m_mode = mode; + this->m_columns.clear(); + switch (mode) + { + case NotSet: + case InfoMode: + this->m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", CSimulatedAircraft::IndexCallsign, CCallsign::IndexCallsignString)); + this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName })); + this->m_columns.addColumn(CColumn("distance", CSimulatedAircraft::IndexDistance, new CAirspaceDistanceFormatter())); + this->m_columns.addColumn(CColumn("frequency", { CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter())); + this->m_columns.addColumn(CColumn::standardString("icao", { CSimulatedAircraft::IndexIcao, CAircraftIcao::IndexAsString})); + this->m_columns.addColumn(CColumn::standardString("transponder", { CSimulatedAircraft::IndexTransponder, CTransponder::IndexTransponderCodeAndModeFormatted })); + this->m_columns.addColumn(CColumn("latitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexLatitude }, new CLatLonFormatter())); + this->m_columns.addColumn(CColumn("longitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexLongitude }, new CLatLonFormatter())); + this->m_columns.addColumn(CColumn::standardValueObject("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, CDefaultFormatter::alignRightVCenter())); + this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter())); + + // default sort order + this->setSortColumnByPropertyIndex(CSimulatedAircraft::IndexDistance); + this->m_sortOrder = Qt::AscendingOrder; + break; + + case ModelMode: + this->m_columns.addColumn(CColumn("e.", "enabled", CSimulatedAircraft::IndexEnabled, + new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "enabled", "disabled"), true)); + this->m_columns.addColumn(CColumn::standardValueObject("cs.", "callsign", { CSimulatedAircraft::IndexCallsign, CCallsign::IndexCallsignString })); + this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName })); + this->m_columns.addColumn(CColumn("distance", CSimulatedAircraft::IndexDistance, new CAirspaceDistanceFormatter())); + this->m_columns.addColumn(CColumn::standardString("icao", { CSimulatedAircraft::IndexIcao, CAircraftIcao::IndexAsString})); + this->m_columns.addColumn(CColumn::standardString("model", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexModelString})); + this->m_columns.addColumn(CColumn::standardString("desc.", "description", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexDescription})); + this->m_columns.addColumn(CColumn::standardString("type", { CSimulatedAircraft::IndexModel, CAircraftModel::IndexModelTypeAsString})); + this->m_columns.addColumn(CColumn::standardValueObject("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, CDefaultFormatter::alignRightVCenter())); + this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter())); + + // default sort order + this->setSortColumnByPropertyIndex(CSimulatedAircraft::IndexCallsign); + this->m_sortOrder = Qt::AscendingOrder; + break; + + default: + qFatal("Wrong mode"); + break; + } + } + + } // namespace +} // namespace diff --git a/src/blackgui/models/simulatedaircraftlistmodel.h b/src/blackgui/models/simulatedaircraftlistmodel.h new file mode 100644 index 000000000..86e3f23e4 --- /dev/null +++ b/src/blackgui/models/simulatedaircraftlistmodel.h @@ -0,0 +1,52 @@ +/* Copyright (C) 2013 + * swift project Community / Contributors + * + * This file is part of swift Project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKGUI_SIMULATEDAIRCRAFTLISTMODEL_H +#define BLACKGUI_SIMULATEDAIRCRAFTLISTMODEL_H + +#include "blackmisc/simulation/simulatedaircraftlist.h" +#include "blackgui/models/listmodelbase.h" +#include +#include + +namespace BlackGui +{ + namespace Models + { + + //! Aircraft list model + class CSimulatedAircraftListModel : public CListModelBase + { + + public: + //! Model modes + enum AircraftMode + { + InfoMode, //!< like aircraft in range + ModelMode, //!< focusing on used model + NotSet + }; + + //! Constructor + explicit CSimulatedAircraftListModel(QObject *parent = nullptr); + + //! Destructor + virtual ~CSimulatedAircraftListModel() {} + + //! Mode + void setAircraftMode(AircraftMode mode); + + private: + AircraftMode m_mode = NotSet; + }; + } +} +#endif // guard diff --git a/src/blackgui/models/userlistmodel.cpp b/src/blackgui/models/userlistmodel.cpp index 1d375315f..3c48693ad 100644 --- a/src/blackgui/models/userlistmodel.cpp +++ b/src/blackgui/models/userlistmodel.cpp @@ -13,6 +13,7 @@ #include using namespace BlackMisc::Network; +using namespace BlackMisc::Aviation; namespace BlackGui { @@ -22,15 +23,16 @@ namespace BlackGui * Constructor */ CUserListModel::CUserListModel(UserMode userMode, QObject *parent) : - CListModelBase("ViewUserList", parent), m_userMode(NotSet) + CListModelBase("ModelUserList", parent), m_userMode(NotSet) { this->setUserMode(userMode); // force strings for translation in resource files - (void)QT_TRANSLATE_NOOP("ViewUserList", "callsign"); - (void)QT_TRANSLATE_NOOP("ViewUserList", "realname"); - (void)QT_TRANSLATE_NOOP("ViewUserList", "userid"); - (void)QT_TRANSLATE_NOOP("ViewUserList", "email"); + (void)QT_TRANSLATE_NOOP("ModelUserList", "callsign"); + (void)QT_TRANSLATE_NOOP("ModelUserList", "realname"); + (void)QT_TRANSLATE_NOOP("ModelUserList", "homebase"); + (void)QT_TRANSLATE_NOOP("ModelUserList", "userid"); + (void)QT_TRANSLATE_NOOP("ModelUserList", "email"); } /* @@ -47,7 +49,8 @@ namespace BlackGui case UserDetailed: this->m_columns.addColumn(CColumn(CUser::IndexIcon)); this->m_columns.addColumn(CColumn::standardString("realname", CUser::IndexRealName)); - this->m_columns.addColumn(CColumn::standardValueObject("callsign", CUser::IndexCallsign)); + this->m_columns.addColumn(CColumn::standardValueObject("callsign", { CUser::IndexCallsign, CCallsign::IndexCallsignString })); + this->m_columns.addColumn(CColumn::standardValueObject("hb.", "homebase", { CUser::IndexHomebase, CAirportIcao::IndexString })); this->m_columns.addColumn(CColumn::standardString("userid", CUser::IndexId)); // default sort order diff --git a/src/blackgui/views/aircraftview.h b/src/blackgui/views/aircraftview.h index 3e80d0124..ade70c459 100644 --- a/src/blackgui/views/aircraftview.h +++ b/src/blackgui/views/aircraftview.h @@ -24,10 +24,10 @@ namespace BlackGui { public: - //! Constructor explicit CAircraftView(QWidget *parent = nullptr); }; - } -} + + } // namespace +} // namespace #endif // guard diff --git a/src/blackgui/views/simulatedaircraftview.cpp b/src/blackgui/views/simulatedaircraftview.cpp new file mode 100644 index 000000000..ea107814c --- /dev/null +++ b/src/blackgui/views/simulatedaircraftview.cpp @@ -0,0 +1,31 @@ +/* Copyright (C) 2013 + * swift project Community / Contributors + * + * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +#include "simulatedaircraftview.h" +#include + +using namespace BlackMisc::Simulation; +using namespace BlackGui::Models; + +namespace BlackGui +{ + namespace Views + { + CSimulatedAircraftView::CSimulatedAircraftView(QWidget *parent) : CViewBase(parent) + { + this->standardInit(new CSimulatedAircraftListModel(this)); + this->m_withMenuItemRefresh = true; + } + + void CSimulatedAircraftView::setAircraftMode(CSimulatedAircraftListModel::AircraftMode mode) + { + this->m_model->setAircraftMode(mode); + } + } +} diff --git a/src/blackgui/views/simulatedaircraftview.h b/src/blackgui/views/simulatedaircraftview.h new file mode 100644 index 000000000..40b3eb32f --- /dev/null +++ b/src/blackgui/views/simulatedaircraftview.h @@ -0,0 +1,35 @@ +/* Copyright (C) 2013 + * swift project Community / Contributors + * + * This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level + * directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project, + * including this file, may be copied, modified, propagated, or distributed except according to the terms + * contained in the LICENSE file. + */ + +//! \file + +#ifndef BLACKGUI_SIMULATEDAIRCRAFTVIEW_H +#define BLACKGUI_SIMULATEDAIRCRAFTVIEW_H + +#include "viewbase.h" +#include "../models/simulatedaircraftlistmodel.h" + +namespace BlackGui +{ + namespace Views + { + //! Aircrafts view + class CSimulatedAircraftView : public CViewBase + { + + public: + //! Constructor + explicit CSimulatedAircraftView(QWidget *parent = nullptr); + + //! Mode + void setAircraftMode(Models::CSimulatedAircraftListModel::AircraftMode mode); + }; + } +} +#endif // guard