mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-29 20:55:42 +08:00
refs #368, updated models to reflect changes
* update count with filter * used alternative sortable columns * added classes for SimulatedAircraft * supporting filters
This commit is contained in:
@@ -24,7 +24,7 @@ namespace BlackGui
|
|||||||
*/
|
*/
|
||||||
CAircraftListModel::CAircraftListModel(QObject *parent) : CListModelBase("ViewAircraftList", parent)
|
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::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("distance", CAircraft::IndexDistance, new CAirspaceDistanceFormatter()));
|
||||||
this->m_columns.addColumn(CColumn("frequency", { CAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter()));
|
this->m_columns.addColumn(CColumn("frequency", { CAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter()));
|
||||||
|
|||||||
@@ -35,6 +35,6 @@ namespace BlackGui
|
|||||||
virtual ~CAircraftListModel() {}
|
virtual ~CAircraftListModel() {}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
} // namespace
|
||||||
}
|
} // namespace
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include "blackmisc/blackmiscfreefunctions.h"
|
#include "blackmisc/blackmiscfreefunctions.h"
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackMisc::Aviation;
|
using namespace BlackMisc::Aviation;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
|
||||||
@@ -53,14 +54,14 @@ namespace BlackGui
|
|||||||
|
|
||||||
case MappedModel:
|
case MappedModel:
|
||||||
this->m_columns.addColumn(CColumn::standardValueObject("call", "callsign", CAircraftModel::IndexCallsign));
|
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("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("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::standardString("ct", "combined type", { CAircraftModel::IndexIcao, CAircraftIcao::IndexCombinedAircraftType}));
|
||||||
this->m_columns.addColumn(CColumn("q.?", "queried", CAircraftModel::IndexHasQueriedModelString,
|
this->m_columns.addColumn(CColumn("q.?", "queried", CAircraftModel::IndexHasQueriedModelString,
|
||||||
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "queried", "not queried")));
|
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "queried", "not queried")));
|
||||||
this->m_columns.addColumn(CColumn::standardString("description", { CAircraftModel::IndexDescription}));
|
this->m_columns.addColumn(CColumn::standardString("description", CAircraftModel::IndexDescription));
|
||||||
this->m_columns.addColumn(CColumn::standardString("filename", { CAircraftModel::IndexFileName}));
|
this->m_columns.addColumn(CColumn::standardString("filename", CAircraftModel::IndexFileName));
|
||||||
|
|
||||||
// default sort order
|
// default sort order
|
||||||
this->setSortColumnByPropertyIndex(CAircraftModel::IndexModelString);
|
this->setSortColumnByPropertyIndex(CAircraftModel::IndexModelString);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#ifndef BLACKGUI_AIRCRAFTMODELLISTMODEL_H
|
#ifndef BLACKGUI_AIRCRAFTMODELLISTMODEL_H
|
||||||
#define BLACKGUI_AIRCRAFTMODELLISTMODEL_H
|
#define BLACKGUI_AIRCRAFTMODELLISTMODEL_H
|
||||||
|
|
||||||
#include "blackmisc/nwaircraftmodellist.h"
|
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||||
#include "blackgui/models/listmodelbase.h"
|
#include "blackgui/models/listmodelbase.h"
|
||||||
#include <QAbstractItemModel>
|
#include <QAbstractItemModel>
|
||||||
#include <QDBusConnection>
|
#include <QDBusConnection>
|
||||||
@@ -23,7 +23,7 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
|
|
||||||
//! Aircraft model list model
|
//! Aircraft model list model
|
||||||
class CAircraftModelListModel : public CListModelBase<BlackMisc::Network::CAircraftModel, BlackMisc::Network::CAircraftModelList>
|
class CAircraftModelListModel : public CListModelBase<BlackMisc::Simulation::CAircraftModel, BlackMisc::Simulation::CAircraftModelList>
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -49,32 +49,39 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
case NotSet:
|
case NotSet:
|
||||||
case StationsOnline:
|
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::standardString("call", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet }));
|
||||||
this->m_columns.addColumn(CColumn("distance", CAtcStation::IndexDistance, new CAirspaceDistanceFormatter()));
|
CColumn col = CColumn("type", CAtcStation::IndexIcon);
|
||||||
this->m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter()));
|
col.setSortPropertyIndex({ CAtcStation::IndexCallsign, CCallsign::IndexSuffix });
|
||||||
this->m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName }));
|
this->m_columns.addColumn(col);
|
||||||
this->m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatHm())));
|
this->m_columns.addColumn(CColumn("distance", CAtcStation::IndexDistance, new CAirspaceDistanceFormatter()));
|
||||||
this->m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatHm())));
|
this->m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter()));
|
||||||
this->m_columns.addColumn(CColumn::standardString("voiceroomurl", { CAtcStation::IndexVoiceRoom, CVoiceRoom::IndexUrl }));
|
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
|
// default sort order
|
||||||
this->setSortColumnByPropertyIndex(CAtcStation::IndexDistance);
|
this->setSortColumnByPropertyIndex(CAtcStation::IndexDistance);
|
||||||
this->m_sortOrder = Qt::AscendingOrder;
|
this->m_sortOrder = Qt::AscendingOrder;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case StationsBooked:
|
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::standardString("call", "callsign", { CAtcStation::IndexCallsign, CCallsign::IndexCallsignStringAsSet }));
|
||||||
this->m_columns.addColumn(CColumn("", "on/offline", CAtcStation::IndexIsOnline, new CBoolLedFormatter("online", "offline")));
|
CColumn col = CColumn("type", CAtcStation::IndexIcon);
|
||||||
this->m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName }));
|
col.setSortPropertyIndex({ CAtcStation::IndexCallsign, CCallsign::IndexSuffix });
|
||||||
this->m_columns.addColumn(CColumn("from", "booked from", CAtcStation::IndexBookedFrom, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm())));
|
this->m_columns.addColumn(col); this->m_columns.addColumn(CColumn("", "on/offline", CAtcStation::IndexIsOnline, new CBoolLedFormatter("online", "offline")));
|
||||||
this->m_columns.addColumn(CColumn("until", "booked until", CAtcStation::IndexBookedUntil, new CDateTimeFormatter(CDateTimeFormatter::formatYmdhm())));
|
this->m_columns.addColumn(CColumn::standardString("controllername", { CAtcStation::IndexController, CUser::IndexRealName }));
|
||||||
this->m_columns.addColumn(CColumn("frequency", CAtcStation::IndexFrequency, new CComFrequencyFormatter()));
|
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
|
// default sort order
|
||||||
this->setSortColumnByPropertyIndex(CAtcStation::IndexBookedFrom);
|
this->setSortColumnByPropertyIndex(CAtcStation::IndexBookedFrom);
|
||||||
this->m_sortOrder = Qt::AscendingOrder;
|
this->m_sortOrder = Qt::AscendingOrder;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
|
|
||||||
using namespace BlackMisc;
|
using namespace BlackMisc;
|
||||||
|
using namespace BlackMisc::Simulation;
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
@@ -29,7 +30,7 @@ namespace BlackGui
|
|||||||
this->m_columns.addColumn(CColumn("client", CClient::IndexIcon));
|
this->m_columns.addColumn(CColumn("client", CClient::IndexIcon));
|
||||||
this->m_columns.addColumn(CColumn::standardValueObject("callsign", CClient::IndexCallsign));
|
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::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("capabilities", CClient::IndexCapabilitiesString));
|
||||||
this->m_columns.addColumn(CColumn::standardString("model", {CClient::IndexModel, CAircraftModel::IndexModelString}));
|
this->m_columns.addColumn(CColumn::standardString("model", {CClient::IndexModel, CAircraftModel::IndexModelString}));
|
||||||
this->m_columns.addColumn(CColumn("q.?", "queried", {CClient::IndexModel, CAircraftModel::IndexHasQueriedModelString},
|
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
|
QVariant CClientListModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
static const CPropertyIndex ms( {CClient::IndexModel, CAircraftModel::IndexModelString});
|
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);
|
CPropertyIndex pi = modelIndexToPropertyIndex(index);
|
||||||
if (pi == ms)
|
if (pi == ms && role == Qt::DisplayRole)
|
||||||
{
|
{
|
||||||
// no model string for ATC
|
// no model string for ATC
|
||||||
CClient client = this->at(index);
|
const CClient client = this->at(index);
|
||||||
bool atc = client.isAtc();
|
bool atc = client.isAtc();
|
||||||
if (atc)
|
if (atc)
|
||||||
{
|
{
|
||||||
return QVariant("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);
|
return CListModelBase::data(index, role);
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|||||||
95
src/blackgui/models/simulatedaircraftlistmodel.cpp
Normal file
95
src/blackgui/models/simulatedaircraftlistmodel.cpp
Normal file
@@ -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
|
||||||
52
src/blackgui/models/simulatedaircraftlistmodel.h
Normal file
52
src/blackgui/models/simulatedaircraftlistmodel.h
Normal file
@@ -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 <QAbstractItemModel>
|
||||||
|
#include <QDBusConnection>
|
||||||
|
|
||||||
|
namespace BlackGui
|
||||||
|
{
|
||||||
|
namespace Models
|
||||||
|
{
|
||||||
|
|
||||||
|
//! Aircraft list model
|
||||||
|
class CSimulatedAircraftListModel : public CListModelBase<BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::Simulation::CSimulatedAircraftList>
|
||||||
|
{
|
||||||
|
|
||||||
|
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
|
||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
|
|
||||||
using namespace BlackMisc::Network;
|
using namespace BlackMisc::Network;
|
||||||
|
using namespace BlackMisc::Aviation;
|
||||||
|
|
||||||
namespace BlackGui
|
namespace BlackGui
|
||||||
{
|
{
|
||||||
@@ -22,15 +23,16 @@ namespace BlackGui
|
|||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
CUserListModel::CUserListModel(UserMode userMode, QObject *parent) :
|
CUserListModel::CUserListModel(UserMode userMode, QObject *parent) :
|
||||||
CListModelBase<BlackMisc::Network::CUser, BlackMisc::Network::CUserList>("ViewUserList", parent), m_userMode(NotSet)
|
CListModelBase<BlackMisc::Network::CUser, BlackMisc::Network::CUserList>("ModelUserList", parent), m_userMode(NotSet)
|
||||||
{
|
{
|
||||||
this->setUserMode(userMode);
|
this->setUserMode(userMode);
|
||||||
|
|
||||||
// force strings for translation in resource files
|
// force strings for translation in resource files
|
||||||
(void)QT_TRANSLATE_NOOP("ViewUserList", "callsign");
|
(void)QT_TRANSLATE_NOOP("ModelUserList", "callsign");
|
||||||
(void)QT_TRANSLATE_NOOP("ViewUserList", "realname");
|
(void)QT_TRANSLATE_NOOP("ModelUserList", "realname");
|
||||||
(void)QT_TRANSLATE_NOOP("ViewUserList", "userid");
|
(void)QT_TRANSLATE_NOOP("ModelUserList", "homebase");
|
||||||
(void)QT_TRANSLATE_NOOP("ViewUserList", "email");
|
(void)QT_TRANSLATE_NOOP("ModelUserList", "userid");
|
||||||
|
(void)QT_TRANSLATE_NOOP("ModelUserList", "email");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -47,7 +49,8 @@ namespace BlackGui
|
|||||||
case UserDetailed:
|
case UserDetailed:
|
||||||
this->m_columns.addColumn(CColumn(CUser::IndexIcon));
|
this->m_columns.addColumn(CColumn(CUser::IndexIcon));
|
||||||
this->m_columns.addColumn(CColumn::standardString("realname", CUser::IndexRealName));
|
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));
|
this->m_columns.addColumn(CColumn::standardString("userid", CUser::IndexId));
|
||||||
|
|
||||||
// default sort order
|
// default sort order
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ namespace BlackGui
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
//! Constructor
|
//! Constructor
|
||||||
explicit CAircraftView(QWidget *parent = nullptr);
|
explicit CAircraftView(QWidget *parent = nullptr);
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
} // namespace
|
||||||
|
} // namespace
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
31
src/blackgui/views/simulatedaircraftview.cpp
Normal file
31
src/blackgui/views/simulatedaircraftview.cpp
Normal file
@@ -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 <QHeaderView>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
35
src/blackgui/views/simulatedaircraftview.h
Normal file
35
src/blackgui/views/simulatedaircraftview.h
Normal file
@@ -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<Models::CSimulatedAircraftListModel, BlackMisc::Simulation::CSimulatedAircraftList, BlackMisc::Simulation::CSimulatedAircraft>
|
||||||
|
{
|
||||||
|
|
||||||
|
public:
|
||||||
|
//! Constructor
|
||||||
|
explicit CSimulatedAircraftView(QWidget *parent = nullptr);
|
||||||
|
|
||||||
|
//! Mode
|
||||||
|
void setAircraftMode(Models::CSimulatedAircraftListModel::AircraftMode mode);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // guard
|
||||||
Reference in New Issue
Block a user