mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
refs #452 models and views created
* for new value objects (e.g. distributor, ...) * new modes are required (e.g. CStatusMessageListModel::Simplified) * model filter allowing to filter models
This commit is contained in:
committed by
Mathew Sutcliffe
parent
f9048de1e6
commit
2c91b3ada0
62
src/blackgui/models/aircrafticaofilter.cpp
Normal file
62
src/blackgui/models/aircrafticaofilter.cpp
Normal file
@@ -0,0 +1,62 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "aircrafticaofilter.h"
|
||||
#include "blackmisc/aviation/aircrafticaocode.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
CAircraftIcaoFilter::CAircraftIcaoFilter(
|
||||
const QString &designator, const QString &name,
|
||||
const QString &description, const QString &combinedType) :
|
||||
m_designator(designator.trimmed().toUpper()), m_manufacturer(name.trimmed()),
|
||||
m_description(description.trimmed()), m_combinedType(combinedType.trimmed().toUpper())
|
||||
{ }
|
||||
|
||||
CAircraftIcaoCodeList CAircraftIcaoFilter::filter(const CAircraftIcaoCodeList &inContainer) const
|
||||
{
|
||||
if (!this->isValid()) { return inContainer; }
|
||||
CAircraftIcaoCodeList outContainer;
|
||||
bool filterCombinedCode = !this->m_combinedType.isEmpty() && !this->m_combinedType.contains('-') && CAircraftIcaoCode::isValidCombinedType(this->m_combinedType);
|
||||
|
||||
for (const CAircraftIcaoCode &icao : inContainer)
|
||||
{
|
||||
if (!m_designator.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(icao.getDesignator(), m_designator)) { continue; }
|
||||
}
|
||||
if (!m_manufacturer.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(icao.getManufacturer(), m_manufacturer)) { continue; }
|
||||
}
|
||||
if (!m_description.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(icao.getModelDescription(), m_description)) { continue; }
|
||||
}
|
||||
if (filterCombinedCode)
|
||||
{
|
||||
if (icao.getCombinedType() != m_combinedType) { continue; }
|
||||
}
|
||||
outContainer.push_back(icao);
|
||||
}
|
||||
return outContainer;
|
||||
}
|
||||
|
||||
bool CAircraftIcaoFilter::isValid() const
|
||||
{
|
||||
return !(this->m_combinedType.isEmpty() && this->m_designator.isEmpty() &&
|
||||
this->m_description.isEmpty() && this->m_manufacturer.isEmpty());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
51
src/blackgui/models/aircrafticaofilter.h
Normal file
51
src/blackgui/models/aircrafticaofilter.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_AIRCRAFTICAOFILTER_H
|
||||
#define BLACKGUI_AIRCRAFTICAOFILTER_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/models/modelfilter.h"
|
||||
#include "blackmisc/aviation/aircrafticaocodelist.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
|
||||
//! Filter for aircraft ICAO data
|
||||
class BLACKGUI_EXPORT CAircraftIcaoFilter :
|
||||
public IModelFilter<BlackMisc::Aviation::CAircraftIcaoCodeList>
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CAircraftIcaoFilter(const QString &designator,
|
||||
const QString &manufacturer,
|
||||
const QString &description,
|
||||
const QString &combinedType);
|
||||
|
||||
//! \copydoc IModelFilter::filter
|
||||
virtual BlackMisc::Aviation::CAircraftIcaoCodeList filter(const BlackMisc::Aviation::CAircraftIcaoCodeList &inContainer) const override;
|
||||
|
||||
//! \copydoc IModelFilter::isValid
|
||||
virtual bool isValid() const override;
|
||||
|
||||
private:
|
||||
QString m_designator;
|
||||
QString m_manufacturer;
|
||||
QString m_description;
|
||||
QString m_combinedType;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
49
src/blackgui/models/aircrafticaolistmodel.cpp
Normal file
49
src/blackgui/models/aircrafticaolistmodel.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "aircrafticaolistmodel.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <QMetaProperty>
|
||||
#include <QBrush>
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
CAircraftIcaoCodeListModel::CAircraftIcaoCodeListModel(QObject *parent) :
|
||||
CListModelBase<BlackMisc::Aviation::CAircraftIcaoCode, BlackMisc::Aviation::CAircraftIcaoCodeList>("AircraftIcaoListModel", parent)
|
||||
{
|
||||
this->m_columns.addColumn(CColumn::standardString("id", CAircraftIcaoCode::IndexDbIntegerKey, CDefaultFormatter::alignRightVCenter()));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("ICAO", CAircraftIcaoCode::IndexAircraftDesignator));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("rank", CAircraftIcaoCode::IndexRank, CDefaultFormatter::alignRightVCenter()));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("manufacturer", CAircraftIcaoCode::IndexManufacturer));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("desc.", "description", CAircraftIcaoCode::IndexModelDescription));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("code", "combined code", CAircraftIcaoCode::IndexCombinedAircraftType));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("WTC", "wake turbulence category", CAircraftIcaoCode::IndexWtc));
|
||||
this->m_columns.addColumn(CColumn("mil.", "military", CAircraftIcaoCode::IndexIsMilitary, new CBoolIconFormatter("military", "civil")));
|
||||
this->m_columns.addColumn(CColumn("VTOL", "vertical take-off and landing", CAircraftIcaoCode::IndexIsVtol, new CBoolIconFormatter("VTOL", "non VTOL")));
|
||||
this->m_columns.addColumn(CColumn("leg.", "legacy", CAircraftIcaoCode::IndexIsLegacy, new CBoolIconFormatter("legacy", "operating")));
|
||||
this->m_columns.addColumn(CColumn("real.", "real world aircraft", CAircraftIcaoCode::IndexIsRealworld, new CBoolIconFormatter("real", "non real")));
|
||||
this->m_columns.addColumn(CColumn::standardString("changed", CAircraftIcaoCode::IndexUtcTimestampFormattedYmdhms));
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CAircraftIcaoCode::IndexAircraftDesignator);
|
||||
this->m_sortOrder = Qt::AscendingOrder;
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ModelAircraftIcaoList", "ICAO");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAircraftIcaoList", "distance");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAircraftIcaoList", "name");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAircraftIcaoList", "elevation");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAircraftIcaoList", "bearing");
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
39
src/blackgui/models/aircrafticaolistmodel.h
Normal file
39
src/blackgui/models/aircrafticaolistmodel.h
Normal file
@@ -0,0 +1,39 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_AIRCRAFTICAOLISTMODEL_H
|
||||
#define BLACKGUI_AIRCRAFTICAOLISTMODEL_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QAbstractItemModel>
|
||||
#include "blackmisc/aviation/aircrafticaocodelist.h"
|
||||
#include "blackgui/models/listmodelbase.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
|
||||
//! Airport list model
|
||||
class BLACKGUI_EXPORT CAircraftIcaoCodeListModel : public CListModelBase<BlackMisc::Aviation::CAircraftIcaoCode, BlackMisc::Aviation::CAircraftIcaoCodeList>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
explicit CAircraftIcaoCodeListModel(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CAircraftIcaoCodeListModel() {}
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // guard
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2013
|
||||
/* Copyright (C) 2015
|
||||
* 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
|
||||
@@ -17,25 +17,64 @@ namespace BlackGui
|
||||
namespace Models
|
||||
{
|
||||
|
||||
CAircraftModelFilter::CAircraftModelFilter(const QString &modelString, const QString &description) :
|
||||
m_model(modelString.trimmed()), m_description(description.trimmed())
|
||||
CAircraftModelFilter::CAircraftModelFilter(
|
||||
const QString &modelKey, const QString &description,
|
||||
const QString &aircraftIcao, const QString &aircraftManufacturer,
|
||||
const QString &airlineIcao, const QString &airlineName,
|
||||
const QString &liveryCode,
|
||||
const CSimulatorInfo &simInfo) :
|
||||
m_modelKey(modelKey.trimmed()), m_description(description.trimmed()),
|
||||
m_aircraftIcao(aircraftIcao.trimmed().toUpper()), m_aircraftManufacturer(aircraftManufacturer.trimmed().toUpper()),
|
||||
m_airlineIcao(airlineIcao.trimmed().toUpper()), m_airlineName(airlineName.trimmed().toUpper()),
|
||||
m_liveryCode(liveryCode.trimmed().toUpper()),
|
||||
m_simulatorInfo(simInfo)
|
||||
{ }
|
||||
|
||||
BlackMisc::Simulation::CAircraftModelList CAircraftModelFilter::filter(const CAircraftModelList &inContainer) const
|
||||
{
|
||||
if (!this->isValid()) { return inContainer; }
|
||||
if (!this->isEnabled()) { return inContainer; }
|
||||
CAircraftModelList outContainer;
|
||||
for (const CAircraftModel &model : inContainer)
|
||||
{
|
||||
if (!this->m_model.isEmpty())
|
||||
if (!m_simulatorInfo.isAllSimulators())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getModelString(), this->m_model)) { continue; }
|
||||
if (!this->m_simulatorInfo.matchesAny(model.getSimulatorInfo())) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_modelKey.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getModelString(), this->m_modelKey)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_description.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getDescription(), this->m_description)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_aircraftIcao.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getAircraftIcaoCodeDesignator(), this->m_aircraftIcao)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_aircraftManufacturer.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getAircraftIcaoCode().getManufacturer(), this->m_aircraftManufacturer)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_airlineIcao.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getAirlineIcaoCodeDesignator(), this->m_airlineIcao)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_airlineName.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getAirlineIcaoCode().getName(), this->m_airlineName)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_liveryCode.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(model.getLivery().getCombinedCode(), this->m_liveryCode)) { continue; }
|
||||
}
|
||||
outContainer.push_back(model);
|
||||
}
|
||||
return outContainer;
|
||||
@@ -43,7 +82,12 @@ namespace BlackGui
|
||||
|
||||
bool CAircraftModelFilter::isValid() const
|
||||
{
|
||||
return !(this->m_model.isEmpty() && this->m_description.isEmpty());
|
||||
return !(this->m_modelKey.isEmpty() && this->m_description.isEmpty() &&
|
||||
this->m_aircraftManufacturer.isEmpty() && this->m_aircraftIcao.isEmpty() &&
|
||||
this->m_airlineIcao.isEmpty() && this->m_airlineName.isEmpty() &&
|
||||
this->m_liveryCode.isEmpty() &&
|
||||
this->m_simulatorInfo.isNoSimulator()
|
||||
);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2013
|
||||
/* Copyright (C) 2015
|
||||
* 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
|
||||
@@ -13,7 +13,7 @@
|
||||
#define BLACKGUI_AIRCRAFTMODELFILTER_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "listmodelfilter.h"
|
||||
#include "modelfilter.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
|
||||
namespace BlackGui
|
||||
@@ -26,7 +26,11 @@ namespace BlackGui
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CAircraftModelFilter(const QString &modelString, const QString &description);
|
||||
CAircraftModelFilter(const QString &modelKey, const QString &description,
|
||||
const QString &aircraftIcao, const QString &aircraftManufacturer,
|
||||
const QString &airlineIcao, const QString &airlineName,
|
||||
const QString &liveryCode,
|
||||
const BlackMisc::Simulation::CSimulatorInfo &simInfo = BlackMisc::Simulation::CSimulatorInfo::allSimulators());
|
||||
|
||||
//! \copydoc IModelFilter::filter
|
||||
virtual BlackMisc::Simulation::CAircraftModelList filter(const BlackMisc::Simulation::CAircraftModelList &inContainer) const override;
|
||||
@@ -35,13 +39,17 @@ namespace BlackGui
|
||||
virtual bool isValid() const override;
|
||||
|
||||
private:
|
||||
QString m_model;
|
||||
QString m_modelKey;
|
||||
QString m_description;
|
||||
|
||||
QString m_aircraftIcao;
|
||||
QString m_aircraftManufacturer;
|
||||
QString m_airlineIcao;
|
||||
QString m_airlineName;
|
||||
QString m_liveryCode;
|
||||
BlackMisc::Simulation::CSimulatorInfo m_simulatorInfo;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
|
||||
#endif // guard
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
|
||||
#include "aircraftmodellistmodel.h"
|
||||
#include "blackmisc/aviation/aircrafticaodata.h"
|
||||
#include "blackmisc/icons.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
|
||||
@@ -21,9 +20,6 @@ namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CAircraftModelListModel::CAircraftModelListModel(AircraftModelMode mode, QObject *parent) : CListModelBase("CAircraftModelListModel", parent)
|
||||
{
|
||||
this->setAircraftModelMode(mode);
|
||||
@@ -42,10 +38,15 @@ namespace BlackGui
|
||||
switch (mode)
|
||||
{
|
||||
case NotSet:
|
||||
case ModelOnly:
|
||||
case OwnSimulatorModel:
|
||||
this->m_columns.addColumn(CColumn::standardString("model", { CAircraftModel::IndexModelString}));
|
||||
this->m_columns.addColumn(CColumn::standardString("description", { CAircraftModel::IndexDescription}));
|
||||
this->m_columns.addColumn(CColumn::standardString("name", { CAircraftModel::IndexName}));
|
||||
this->m_columns.addColumn(CColumn::standardString("filename", { CAircraftModel::IndexFileName}));
|
||||
this->m_columns.addColumn(CColumn::standardString("sim.", "simulator supported", CAircraftModel::IndexSimulatorInfoAsString));
|
||||
|
||||
this->m_columns.addColumn(CColumn::standardString("aircraft", { CAircraftModel::IndexAircraftIcaoCode, CAircraftIcaoCode::IndexDesignatorManufacturer}));
|
||||
this->m_columns.addColumn(CColumn::standardString("airline", { CAircraftModel::IndexLivery, CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexDesignatorNameCountry}));
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CAircraftModel::IndexModelString);
|
||||
@@ -55,8 +56,8 @@ 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("ac", "aircraft ICAO", { CAircraftModel::IndexIcao, CAircraftIcaoData::IndexAircraftIcao, CAircraftIcaoCode::IndexAircraftDesignator}));
|
||||
this->m_columns.addColumn(CColumn::standardString("al", "airline ICAO", { CAircraftModel::IndexIcao, CAircraftIcaoData::IndexAirlineIcao, CAirlineIcaoCode::IndexAirlineDesignator}));
|
||||
this->m_columns.addColumn(CColumn::standardString("ac", "aircraft ICAO", { CAircraftModel::IndexAircraftIcaoCode, CAircraftIcaoCode::IndexAircraftDesignator}));
|
||||
this->m_columns.addColumn(CColumn::standardString("al", "airline ICAO", { CAircraftModel::IndexLivery, CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineDesignator}));
|
||||
// this->m_columns.addColumn(CColumn::standardString("ct", "combined type", { CAircraftModel::IndexIcao, CAircraftIcaoData::IndexCombinedAircraftType}));
|
||||
this->m_columns.addColumn(CColumn("q.?", "queried", CAircraftModel::IndexHasQueriedModelString,
|
||||
new CBoolIconFormatter(CIcons::StandardIconTick16, CIcons::StandardIconCross16, "queried", "not queried")));
|
||||
@@ -68,11 +69,68 @@ namespace BlackGui
|
||||
this->m_sortOrder = Qt::AscendingOrder;
|
||||
break;
|
||||
|
||||
case Database:
|
||||
this->m_columns.addColumn(CColumn::standardString("id", CAircraftModel::IndexDbIntegerKey, CDefaultFormatter::alignRightVCenter()));
|
||||
this->m_columns.addColumn(CColumn::standardString("model", CAircraftModel::IndexModelString));
|
||||
this->m_columns.addColumn(CColumn::standardString("dist.", "distributor", { CAircraftModel::IndexDistributor, CDistributor::IndexDbStringKey}));
|
||||
this->m_columns.addColumn(CColumn::standardString("name", CAircraftModel::IndexName));
|
||||
this->m_columns.addColumn(CColumn::standardString("description", CAircraftModel::IndexDescription));
|
||||
this->m_columns.addColumn(CColumn::standardString("sim.", "simulator supported", CAircraftModel::IndexSimulatorInfoAsString));
|
||||
|
||||
this->m_columns.addColumn(CColumn::standardString("ac", "aircraft ICAO", { CAircraftModel::IndexAircraftIcaoCode, CAircraftIcaoCode::IndexAircraftDesignator}));
|
||||
this->m_columns.addColumn(CColumn::standardString("manufacturer", "aircraft ICAO", { CAircraftModel::IndexAircraftIcaoCode, CAircraftIcaoCode::IndexManufacturer}));
|
||||
|
||||
this->m_columns.addColumn(CColumn::standardString("code", { CAircraftModel::IndexLivery, CLivery::IndexCombinedCode}));
|
||||
this->m_columns.addColumn(CColumn::standardString("liv.desc.", "livery description", { CAircraftModel::IndexLivery, CLivery::IndexDescription}));
|
||||
this->m_columns.addColumn(CColumn::standardString("al", "airline ICAO", { CAircraftModel::IndexLivery, CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineDesignator}));
|
||||
this->m_columns.addColumn(CColumn::standardString("al.name", "airline name", { CAircraftModel::IndexLivery, CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineName }));
|
||||
|
||||
this->m_columns.addColumn(CColumn("fuse.", "fuselage color", { CAircraftModel::IndexLivery, CLivery::IndexColorFuselage }, new CColorFormatter()));
|
||||
this->m_columns.addColumn(CColumn("tail", "tail color", { CAircraftModel::IndexLivery, CLivery::IndexColorTail }, new CColorFormatter()));
|
||||
this->m_columns.addColumn(CColumn("mil.", "military livery", { CAircraftModel::IndexLivery, CLivery::IndexIsMilitary}, new CBoolIconFormatter("military", "civil")));
|
||||
this->m_columns.addColumn(CColumn::standardString("changed", CAircraftModel::IndexUtcTimestampFormattedYmdhms));
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CAircraftModel::IndexModelString);
|
||||
this->m_sortOrder = Qt::AscendingOrder;
|
||||
break;
|
||||
|
||||
case VPilotRuleModel:
|
||||
this->m_columns.addColumn(CColumn::standardString("model", CAircraftModel::IndexModelString));
|
||||
this->m_columns.addColumn(CColumn::standardString("dist.", "distributor", { CAircraftModel::IndexDistributor, CDistributor::IndexDbStringKey}));
|
||||
this->m_columns.addColumn(CColumn::standardString("sim.", "simulator supported", CAircraftModel::IndexSimulatorInfoAsString));
|
||||
|
||||
this->m_columns.addColumn(CColumn::standardString("ac", "aircraft ICAO", { CAircraftModel::IndexAircraftIcaoCode, CAircraftIcaoCode::IndexAircraftDesignator}));
|
||||
|
||||
this->m_columns.addColumn(CColumn::standardString("al", "airline ICAO", { CAircraftModel::IndexLivery, CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineDesignator}));
|
||||
this->m_columns.addColumn(CColumn::standardString("al.name", "airline name", { CAircraftModel::IndexLivery, CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineName }));
|
||||
|
||||
this->m_columns.addColumn(CColumn::standardString("changed", CAircraftModel::IndexUtcTimestampFormattedYmdhms));
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CAircraftModel::IndexModelString);
|
||||
this->m_sortOrder = Qt::AscendingOrder;
|
||||
break;
|
||||
|
||||
default:
|
||||
qFatal("Wrong mode");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QVariant CAircraftModelListModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if (!m_highlightDbData || role != Qt::BackgroundRole) { return CListModelBase::data(index, role); }
|
||||
CAircraftModel model(this->at(index));
|
||||
if (model.hasValidDbKey())
|
||||
{
|
||||
static const QBrush b(Qt::green);
|
||||
return b;
|
||||
}
|
||||
else
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -16,23 +16,24 @@
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackgui/models/listmodelbase.h"
|
||||
#include <QAbstractItemModel>
|
||||
#include <QDBusConnection>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
|
||||
//! Aircraft model list model
|
||||
class BLACKGUI_EXPORT CAircraftModelListModel : public CListModelBase<BlackMisc::Simulation::CAircraftModel, BlackMisc::Simulation::CAircraftModelList>
|
||||
{
|
||||
|
||||
public:
|
||||
//! How to display
|
||||
enum AircraftModelMode {
|
||||
//! \sa BlackMisc::Simulation::CAircraftModel::ModelType
|
||||
enum AircraftModelMode
|
||||
{
|
||||
NotSet,
|
||||
ModelOnly,
|
||||
MappedModel
|
||||
OwnSimulatorModel, ///< model existing with my sim
|
||||
MappedModel, ///< Model based on mapping operation
|
||||
Database, ///< Database entry
|
||||
VPilotRuleModel ///< vPilot rule turned into model
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
@@ -44,10 +45,23 @@ namespace BlackGui
|
||||
//! Mode
|
||||
void setAircraftModelMode(CAircraftModelListModel::AircraftModelMode stationMode);
|
||||
|
||||
//! Mode
|
||||
AircraftModelMode getModelMode() const { return m_mode; }
|
||||
|
||||
//! Highlight the DB models
|
||||
bool highlightDbData() const { return m_highlightDbData; }
|
||||
|
||||
//! Highlight the DB models
|
||||
void setHighlightDbData(bool highlightDbData) { m_highlightDbData = highlightDbData; }
|
||||
|
||||
protected:
|
||||
//! \copydoc QAbstractItemModel::data
|
||||
virtual QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
private:
|
||||
AircraftModelMode m_mode = NotSet; //!< current mode
|
||||
|
||||
bool m_highlightDbData = false;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
#endif // guard
|
||||
|
||||
72
src/blackgui/models/airlineicaofilter.cpp
Normal file
72
src/blackgui/models/airlineicaofilter.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "airlineicaofilter.h"
|
||||
#include "blackmisc/aviation/airlineicaocode.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
CAirlineIcaoFilter::CAirlineIcaoFilter(const QString &vDesignator, const QString &name,
|
||||
const QString &countryIso, bool isReal, bool isVa) :
|
||||
m_vDesignator(vDesignator.trimmed().toUpper()), m_name(name.trimmed()),
|
||||
m_countryIso(countryIso.trimmed().toUpper()), m_real(isReal), m_va(isVa)
|
||||
{ }
|
||||
|
||||
CAirlineIcaoCodeList CAirlineIcaoFilter::filter(const CAirlineIcaoCodeList &inContainer) const
|
||||
{
|
||||
if (!this->isValid()) { return inContainer; }
|
||||
CAirlineIcaoCodeList outContainer;
|
||||
bool end = false;
|
||||
for (const CAirlineIcaoCode &icao : inContainer)
|
||||
{
|
||||
if (!m_vDesignator.isEmpty())
|
||||
{
|
||||
if (!icao.matchesVDesignator(m_vDesignator)) { continue; }
|
||||
end = true; // there should me only one designator
|
||||
}
|
||||
|
||||
if (!this->m_name.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(icao.getName(), this->m_name)) { continue; }
|
||||
}
|
||||
|
||||
if (!this->m_countryIso.isEmpty())
|
||||
{
|
||||
if (icao.getCountryIso() != m_countryIso) { continue; }
|
||||
}
|
||||
|
||||
if (!m_real && m_va)
|
||||
{
|
||||
if (!icao.isVirtualAirline()) { continue; }
|
||||
}
|
||||
|
||||
if (m_real && !m_va)
|
||||
{
|
||||
if (icao.isVirtualAirline()) { continue; }
|
||||
}
|
||||
|
||||
outContainer.push_back(icao);
|
||||
if (end) { break; }
|
||||
}
|
||||
return outContainer;
|
||||
}
|
||||
|
||||
bool CAirlineIcaoFilter::isValid() const
|
||||
{
|
||||
return !(this->m_countryIso.isEmpty() && this->m_vDesignator.isEmpty() &&
|
||||
this->m_name.isEmpty() &&
|
||||
!m_va && !m_real);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
48
src/blackgui/models/airlineicaofilter.h
Normal file
48
src/blackgui/models/airlineicaofilter.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_AIRLINEICAOFILTER_H
|
||||
#define BLACKGUI_AIRLINEICAOFILTER_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/models/modelfilter.h"
|
||||
#include "blackmisc/aviation/airlineicaocodelist.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
//! Filter for airline ICAO data
|
||||
class BLACKGUI_EXPORT CAirlineIcaoFilter : public IModelFilter<BlackMisc::Aviation::CAirlineIcaoCodeList>
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CAirlineIcaoFilter(const QString &vDesignator, const QString &name,
|
||||
const QString &countryIso, bool isReal, bool isVa);
|
||||
|
||||
//! \copydoc IModelFilter::filter
|
||||
virtual BlackMisc::Aviation::CAirlineIcaoCodeList filter(const BlackMisc::Aviation::CAirlineIcaoCodeList &inContainer) const override;
|
||||
|
||||
//! \copydoc IModelFilter::isValid
|
||||
virtual bool isValid() const override;
|
||||
|
||||
private:
|
||||
QString m_vDesignator;
|
||||
QString m_name;
|
||||
QString m_countryIso;
|
||||
bool m_real;
|
||||
bool m_va;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
54
src/blackgui/models/airlineicaolistmodel.cpp
Normal file
54
src/blackgui/models/airlineicaolistmodel.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "airlineicaolistmodel.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <QMetaProperty>
|
||||
#include <QBrush>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
CAirlineIcaoCodeListModel::CAirlineIcaoCodeListModel(QObject *parent) :
|
||||
CListModelBase<BlackMisc::Aviation::CAirlineIcaoCode, BlackMisc::Aviation::CAirlineIcaoCodeList>("AircraftIcaoListModel", parent)
|
||||
{
|
||||
this->m_columns.addColumn(CColumn::standardString("id", CAirlineIcaoCode::IndexDbIntegerKey, CDefaultFormatter::alignRightVCenter()));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("ICAO", CAirlineIcaoCode::IndexAirlineDesignator));
|
||||
|
||||
CColumn col("airline", CAirlineIcaoCode::IndexIcon);
|
||||
col.setSortPropertyIndex(CAirlineIcaoCode::IndexAirlineDesignator);
|
||||
this->m_columns.addColumn(col);
|
||||
|
||||
this->m_columns.addColumn(CColumn("VA", "Virtual airline", CAirlineIcaoCode::IndexIsVirtualAirline, new CBoolIconFormatter("VA", "real airline")));
|
||||
this->m_columns.addColumn(CColumn("op.", "operating", CAirlineIcaoCode::IndexIsOperating, new CBoolIconFormatter("operating", "ceased")));
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("name", CAirlineIcaoCode::IndexAirlineName));
|
||||
|
||||
col = CColumn("country", {CAirlineIcaoCode::IndexAirlineCountry, CCountry::IndexIcon});
|
||||
col.setSortPropertyIndex(CAirlineIcaoCode::IndexAirlineDesignator);
|
||||
this->m_columns.addColumn(col);
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("country", "country", CAirlineIcaoCode::IndexAirlineCountry));
|
||||
this->m_columns.addColumn(CColumn::standardString("changed", CAirlineIcaoCode::IndexUtcTimestampFormattedYmdhms));
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CAirlineIcaoCode::IndexAirlineDesignator);
|
||||
this->m_sortOrder = Qt::AscendingOrder;
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirlineIcaoList", "ICAO");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirlineIcaoList", "operating");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirlineIcaoList", "name");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirlineIcaoList", "country");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirlineIcaoList", "changed");
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
36
src/blackgui/models/airlineicaolistmodel.h
Normal file
36
src/blackgui/models/airlineicaolistmodel.h
Normal file
@@ -0,0 +1,36 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_AIRLINEICAOLISTMODEL_H
|
||||
#define BLACKGUI_AIRLINEICAOLISTMODEL_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QAbstractItemModel>
|
||||
#include "blackmisc/aviation/airlineicaocodelist.h"
|
||||
#include "blackgui/models/listmodelbase.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
//! Airport list model
|
||||
class BLACKGUI_EXPORT CAirlineIcaoCodeListModel : public CListModelBase<BlackMisc::Aviation::CAirlineIcaoCode, BlackMisc::Aviation::CAirlineIcaoCodeList>
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAirlineIcaoCodeListModel(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CAirlineIcaoCodeListModel() {}
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // guard
|
||||
@@ -21,7 +21,7 @@ namespace BlackGui
|
||||
namespace Models
|
||||
{
|
||||
CAirportListModel::CAirportListModel(QObject *parent) :
|
||||
CListModelBase<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList>("ViewAirportList", parent)
|
||||
CListModelBase<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList>("AirportListModel", parent)
|
||||
{
|
||||
this->m_columns.addColumn(CColumn::standardValueObject("ICAO", CAirport::IndexIcao));
|
||||
this->m_columns.addColumn(CColumn("distance", CAirport::IndexDistanceToOwnAircraft, new CAirspaceDistanceFormatter()));
|
||||
@@ -36,11 +36,11 @@ namespace BlackGui
|
||||
this->m_sortOrder = Qt::AscendingOrder;
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ViewAirportList", "ICAO");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAirportList", "distance");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAirportList", "name");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAirportList", "elevation");
|
||||
(void)QT_TRANSLATE_NOOP("ViewAirportList", "bearing");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "ICAO");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "distance");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "name");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "elevation");
|
||||
(void)QT_TRANSLATE_NOOP("ModelAirportList", "bearing");
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
@@ -13,21 +13,18 @@
|
||||
#define BLACKGUI_AIRPORTLISTMODEL_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QAbstractItemModel>
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
#include "blackgui/models/listmodelbase.h"
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
|
||||
//! Airport list model
|
||||
class BLACKGUI_EXPORT CAirportListModel : public CListModelBase<BlackMisc::Aviation::CAirport, BlackMisc::Aviation::CAirportList>
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
//! Constructor
|
||||
explicit CAirportListModel(QObject *parent = nullptr);
|
||||
|
||||
|
||||
@@ -10,22 +10,24 @@
|
||||
#ifndef BLACKGUI_MODELS_ALLMODELCONTAINERS_H
|
||||
#define BLACKGUI_MODELS_ALLMODELCONTAINERS_H
|
||||
|
||||
#include "blackmisc/aviation/atcstationlist.h"
|
||||
#include "blackmisc/aviation/aircraftlist.h"
|
||||
#include "blackmisc/aviation/aircrafticaocodelist.h"
|
||||
#include "blackmisc/aviation/airlineicaocodelist.h"
|
||||
#include "blackmisc/aviation/airportlist.h"
|
||||
#include "blackmisc/aviation/atcstationlist.h"
|
||||
#include "blackmisc/aviation/liverylist.h"
|
||||
#include "blackmisc/network/serverlist.h"
|
||||
#include "blackmisc/network/userlist.h"
|
||||
#include "blackmisc/network/clientlist.h"
|
||||
#include "blackmisc/network/textmessagelist.h"
|
||||
#include "blackmisc/network/aircraftmappinglist.h"
|
||||
#include "blackmisc/countrylist.h"
|
||||
#include "blackmisc/identifierlist.h"
|
||||
#include "blackmisc/input/actionhotkeylist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/namevariantpairlist.h"
|
||||
#include "blackmisc/network/aircraftmappinglist.h"
|
||||
#include "blackmisc/network/clientlist.h"
|
||||
#include "blackmisc/network/serverlist.h"
|
||||
#include "blackmisc/network/textmessagelist.h"
|
||||
#include "blackmisc/network/userlist.h"
|
||||
#include "blackmisc/setkeyboardhotkeylist.h"
|
||||
#include "blackmisc/simulation/aircraftmodellist.h"
|
||||
#include "blackmisc/simulation/distributorlist.h"
|
||||
#include "blackmisc/namevariantpairlist.h"
|
||||
#include "blackmisc/simulation/simulatedaircraftlist.h"
|
||||
#include "blackmisc/statusmessagelist.h"
|
||||
#include "blackmisc/identifierlist.h"
|
||||
|
||||
#endif // guard
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2013
|
||||
/* Copyright (C) 2015
|
||||
* 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
|
||||
@@ -10,21 +10,24 @@
|
||||
#ifndef BLACKGUI_MODELS_ALLMODELS_H
|
||||
#define BLACKGUI_MODELS_ALLMODELS_H
|
||||
|
||||
#include "blackgui/models/statusmessagelistmodel.h"
|
||||
#include "blackgui/models/identifierlistmodel.h"
|
||||
#include "blackgui/models/namevariantpairlistmodel.h"
|
||||
#include "blackgui/models/atcstationlistmodel.h"
|
||||
#include "blackgui/models/aircraftmodellistmodel.h"
|
||||
#include "blackgui/models/textmessagelistmodel.h"
|
||||
#include "blackgui/models/airportlistmodel.h"
|
||||
#include "blackgui/models/airportlistmodel.h"
|
||||
#include "blackgui/models/serverlistmodel.h"
|
||||
#include "blackgui/models/userlistmodel.h"
|
||||
#include "blackgui/models/clientlistmodel.h"
|
||||
#include "blackgui/models/simulatedaircraftlistmodel.h"
|
||||
#include "blackgui/models/liverylistmodel.h"
|
||||
#include "blackgui/models/distributorlistmodel.h"
|
||||
#include "blackgui/models/actionhotkeylistmodel.h"
|
||||
#include "blackgui/models/aircrafticaolistmodel.h"
|
||||
#include "blackgui/models/aircraftmodellistmodel.h"
|
||||
#include "blackgui/models/airlineicaolistmodel.h"
|
||||
#include "blackgui/models/airportlistmodel.h"
|
||||
#include "blackgui/models/airportlistmodel.h"
|
||||
#include "blackgui/models/atcstationlistmodel.h"
|
||||
#include "blackgui/models/clientlistmodel.h"
|
||||
#include "blackgui/models/countrylistmodel.h"
|
||||
#include "blackgui/models/distributorlistmodel.h"
|
||||
#include "blackgui/models/identifierlistmodel.h"
|
||||
#include "blackgui/models/keyboardkeylistmodel.h"
|
||||
#include "blackgui/models/liverylistmodel.h"
|
||||
#include "blackgui/models/namevariantpairlistmodel.h"
|
||||
#include "blackgui/models/serverlistmodel.h"
|
||||
#include "blackgui/models/simulatedaircraftlistmodel.h"
|
||||
#include "blackgui/models/statusmessagelistmodel.h"
|
||||
#include "blackgui/models/textmessagelistmodel.h"
|
||||
#include "blackgui/models/userlistmodel.h"
|
||||
|
||||
#endif // guard
|
||||
|
||||
|
||||
53
src/blackgui/models/countryfilter.cpp
Normal file
53
src/blackgui/models/countryfilter.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "countryfilter.h"
|
||||
#include "blackmisc/country.h"
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
CCountryFilter::CCountryFilter(const QString &isoCode, const QString &name) :
|
||||
m_isoCode(isoCode.trimmed().toUpper()), m_name(name.trimmed())
|
||||
{ }
|
||||
|
||||
CCountryList CCountryFilter::filter(const CCountryList &inContainer) const
|
||||
{
|
||||
if (!this->isValid()) { return inContainer; }
|
||||
CCountryList outContainer;
|
||||
bool end = false;
|
||||
for (const CCountry &country : inContainer)
|
||||
{
|
||||
if (!m_isoCode.isEmpty())
|
||||
{
|
||||
if (country.getIsoCode() != m_isoCode) { continue; }
|
||||
end = true; // there should me only one designator
|
||||
}
|
||||
|
||||
if (!this->m_name.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(country.getName(), this->m_name)) { continue; }
|
||||
}
|
||||
|
||||
outContainer.push_back(country);
|
||||
if (end) { break; }
|
||||
}
|
||||
return outContainer;
|
||||
}
|
||||
|
||||
bool CCountryFilter::isValid() const
|
||||
{
|
||||
return !(this->m_isoCode.isEmpty() && this->m_name.isEmpty());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
44
src/blackgui/models/countryfilter.h
Normal file
44
src/blackgui/models/countryfilter.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_COUNTRYFILTER_H
|
||||
#define BLACKGUI_COUNTRYFILTER_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/models/modelfilter.h"
|
||||
#include "blackmisc/countrylist.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
//! Country filter
|
||||
class BLACKGUI_EXPORT CCountryFilter : public IModelFilter<BlackMisc::CCountryList>
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CCountryFilter(const QString &isoCode, const QString &name);
|
||||
|
||||
//! \copydoc IModelFilter::filter
|
||||
virtual BlackMisc::CCountryList filter(const BlackMisc::CCountryList &inContainer) const override;
|
||||
|
||||
//! \copydoc IModelFilter::isValid
|
||||
virtual bool isValid() const override;
|
||||
|
||||
private:
|
||||
QString m_isoCode;
|
||||
QString m_name;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
41
src/blackgui/models/countrylistmodel.cpp
Normal file
41
src/blackgui/models/countrylistmodel.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "countrylistmodel.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <QMetaProperty>
|
||||
|
||||
using namespace BlackMisc;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
CCountryListModel::CCountryListModel(QObject *parent) :
|
||||
CListModelBase<BlackMisc::CCountry, BlackMisc::CCountryList>("CountryListModel", parent)
|
||||
{
|
||||
CColumn col("country", CCountry::IndexIcon);
|
||||
col.setSortPropertyIndex(CCountry::IndexIsoCode);
|
||||
this->m_columns.addColumn(col);
|
||||
this->m_columns.addColumn(CColumn::standardString("ISO", CCountry::IndexIsoCode));
|
||||
this->m_columns.addColumn(CColumn::standardString("name", CCountry::IndexName));
|
||||
this->m_columns.addColumn(CColumn::standardString("changed", CCountry::IndexUtcTimestampFormattedYmdhms));
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CCountry::IndexIsoCode);
|
||||
this->m_sortOrder = Qt::AscendingOrder;
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ModelCountryList", "cty.");
|
||||
(void)QT_TRANSLATE_NOOP("ModelCountryList", "country");
|
||||
(void)QT_TRANSLATE_NOOP("ModelCountryList", "ISO");
|
||||
(void)QT_TRANSLATE_NOOP("ModelCountryList", "name");
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
37
src/blackgui/models/countrylistmodel.h
Normal file
37
src/blackgui/models/countrylistmodel.h
Normal file
@@ -0,0 +1,37 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_COUNTRYLISTMODEL_H
|
||||
#define BLACKGUI_COUNTRYLISTMODEL_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackmisc/countrylist.h"
|
||||
#include "blackgui/models/listmodelbase.h"
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
//! Country list model
|
||||
class BLACKGUI_EXPORT CCountryListModel : public CListModelBase<BlackMisc::CCountry, BlackMisc::CCountryList>
|
||||
{
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CCountryListModel(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CCountryListModel() {}
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // guard
|
||||
@@ -25,6 +25,7 @@ namespace BlackGui
|
||||
this->m_columns.addColumn(CColumn::standardString("description", CDistributor::IndexDescription));
|
||||
this->m_columns.addColumn(CColumn::standardString("alias1", CDistributor::IndexAlias1));
|
||||
this->m_columns.addColumn(CColumn::standardString("alias2", CDistributor::IndexAlias2));
|
||||
this->m_columns.addColumn(CColumn::standardString("changed", CDistributor::IndexUtcTimestampFormattedYmdhms));
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ModelDistributorList", "key");
|
||||
|
||||
80
src/blackgui/models/liveryfilter.cpp
Normal file
80
src/blackgui/models/liveryfilter.cpp
Normal file
@@ -0,0 +1,80 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "liveryfilter.h"
|
||||
#include "blackmisc/aviation/aircrafticaocode.h"
|
||||
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
CLiveryFilter::CLiveryFilter(const QString &combinedCode, const QString &descriptiom,
|
||||
const QString &airlineDesignator,
|
||||
const BlackMisc::CRgbColor &fuselageColor, const BlackMisc::CRgbColor &tailColor, double maxColorDistance, bool colorLiveries, bool airlineLiveries) :
|
||||
m_combinedCode(combinedCode.trimmed().toUpper()), m_description(descriptiom),
|
||||
m_airlineIcaoDesignator(airlineDesignator.trimmed().toUpper()),
|
||||
m_fuselageColor(fuselageColor), m_tailColor(tailColor), m_maxColorDistance(maxColorDistance),
|
||||
m_colorLiveries(colorLiveries), m_airlineLiveries(airlineLiveries)
|
||||
{ }
|
||||
|
||||
CLiveryList CLiveryFilter::filter(const CLiveryList &inContainer) const
|
||||
{
|
||||
if (!this->isEnabled()) { return inContainer; }
|
||||
CLiveryList outContainer;
|
||||
bool checkLiveryType = filterByLiveryType();
|
||||
for (const CLivery &livery : inContainer)
|
||||
{
|
||||
if (checkLiveryType)
|
||||
{
|
||||
if (!m_colorLiveries && livery.isColorLivery()) {continue;}
|
||||
if (!m_airlineLiveries && livery.isAirlineLivery()) { continue; }
|
||||
}
|
||||
|
||||
if (!m_combinedCode.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(livery.getCombinedCode(), m_combinedCode)) { continue; }
|
||||
}
|
||||
if (!m_description.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(livery.getDescription(), m_description)) { continue; }
|
||||
}
|
||||
if (!m_airlineIcaoDesignator.isEmpty())
|
||||
{
|
||||
if (!this->stringMatchesFilterExpression(livery.getAirlineIcaoCode().getDesignator(), m_airlineIcaoDesignator)) { continue; }
|
||||
}
|
||||
if (m_fuselageColor.isValid())
|
||||
{
|
||||
if (livery.getColorFuselage().colorDistance(m_fuselageColor) > m_maxColorDistance) { continue; }
|
||||
}
|
||||
if (m_tailColor.isValid())
|
||||
{
|
||||
if (livery.getColorTail().colorDistance(m_tailColor) > m_maxColorDistance) { continue; }
|
||||
}
|
||||
outContainer.push_back(livery);
|
||||
}
|
||||
return outContainer;
|
||||
}
|
||||
|
||||
bool CLiveryFilter::isValid() const
|
||||
{
|
||||
if (filterByLiveryType()) { return true; }
|
||||
if (m_fuselageColor.isValid() || m_tailColor.isValid()) { return true; }
|
||||
return !(this->m_combinedCode.isEmpty() && this->m_description.isEmpty() &&
|
||||
this->m_airlineIcaoDesignator.isEmpty());
|
||||
}
|
||||
|
||||
bool CLiveryFilter::filterByLiveryType() const
|
||||
{
|
||||
return (m_colorLiveries && !m_airlineLiveries) || (!m_colorLiveries && m_airlineLiveries);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
62
src/blackgui/models/liveryfilter.h
Normal file
62
src/blackgui/models/liveryfilter.h
Normal file
@@ -0,0 +1,62 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_LIVERYFILTER_H
|
||||
#define BLACKGUI_LIVERYFILTER_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/models/modelfilter.h"
|
||||
#include "blackmisc/aviation/liverylist.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
|
||||
//! Filter for aircraft liveries
|
||||
class BLACKGUI_EXPORT CLiveryFilter : public IModelFilter<BlackMisc::Aviation::CLiveryList>
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CLiveryFilter(const QString &combinedCode,
|
||||
const QString &descriptiom,
|
||||
const QString &airlineDesignator,
|
||||
const BlackMisc::CRgbColor &fuselageColor,
|
||||
const BlackMisc::CRgbColor &tailColor,
|
||||
double maxColorDistance,
|
||||
bool colorLiveries,
|
||||
bool airlineLiveries
|
||||
);
|
||||
|
||||
//! \copydoc IModelFilter::filter
|
||||
virtual BlackMisc::Aviation::CLiveryList filter(const BlackMisc::Aviation::CLiveryList &inContainer) const override;
|
||||
|
||||
//! \copydoc IModelFilter::isValid
|
||||
virtual bool isValid() const override;
|
||||
|
||||
private:
|
||||
QString m_combinedCode;
|
||||
QString m_description;
|
||||
QString m_airlineIcaoDesignator;
|
||||
BlackMisc::CRgbColor m_fuselageColor;
|
||||
BlackMisc::CRgbColor m_tailColor;
|
||||
double m_maxColorDistance = 0.5;
|
||||
bool m_colorLiveries = true;
|
||||
bool m_airlineLiveries = true;
|
||||
|
||||
//! Filter by livery type such as color or airline liveries
|
||||
bool filterByLiveryType() const;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
#endif // guard
|
||||
@@ -8,10 +8,12 @@
|
||||
*/
|
||||
|
||||
#include "liverylistmodel.h"
|
||||
#include "blackmisc/rgbcolor.h"
|
||||
#include "blackmisc/blackmiscfreefunctions.h"
|
||||
#include <QMetaProperty>
|
||||
#include <QBrush>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Aviation;
|
||||
|
||||
namespace BlackGui
|
||||
@@ -21,11 +23,22 @@ namespace BlackGui
|
||||
CLiveryListModel::CLiveryListModel(QObject *parent) :
|
||||
CListModelBase("ModelLiveryList", parent)
|
||||
{
|
||||
this->m_columns.addColumn(CColumn::standardString("id", CLivery::IndexDbIntegerKey, CDefaultFormatter::alignRightVCenter()));
|
||||
this->m_columns.addColumn(CColumn::standardString("code", CLivery::IndexCombinedCode));
|
||||
this->m_columns.addColumn(CColumn::standardString("description", CLivery::IndexDescription));
|
||||
this->m_columns.addColumn(CColumn::standardString("fuselage", CLivery::IndexColorFuselage));
|
||||
this->m_columns.addColumn(CColumn::standardString("tail", CLivery::IndexColorTail));
|
||||
this->m_columns.addColumn(CColumn("fuselage", "fuselage color", CLivery::IndexColorFuselage, new CColorFormatter()));
|
||||
this->m_columns.addColumn(CColumn("tail", "tail color", CLivery::IndexColorTail, new CColorFormatter()));
|
||||
this->m_columns.addColumn(CColumn("mil.", "military", CLivery::IndexIsMilitary, new CBoolIconFormatter("military", "civil")));
|
||||
this->m_columns.addColumn(CColumn::standardString("des.", "designator", { CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineDesignator }));
|
||||
CColumn col = CColumn("airline", { CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexIcon });
|
||||
col.setSortPropertyIndex({ CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineCountryIso});
|
||||
this->m_columns.addColumn(col);
|
||||
this->m_columns.addColumn(CColumn::standardString("name", { CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineName }));
|
||||
col = CColumn("airline country", { CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineCountry, CCountry::IndexIcon });
|
||||
col.setSortPropertyIndex({ CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexAirlineCountryIso});
|
||||
this->m_columns.addColumn(col);
|
||||
this->m_columns.addColumn(CColumn::standardString("telephony", { CLivery::IndexAirlineIcaoCode, CAirlineIcaoCode::IndexTelephonyDesignator }));
|
||||
this->m_columns.addColumn(CColumn::standardString("changed", CLivery::IndexUtcTimestampFormattedYmdhms));
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ModelLiveryList", "key");
|
||||
|
||||
88
src/blackgui/models/modelfilter.cpp
Normal file
88
src/blackgui/models/modelfilter.cpp
Normal file
@@ -0,0 +1,88 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "modelfilter.h"
|
||||
#include "blackgui/models/allmodels.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
template<class ContainerType>
|
||||
bool IModelFilter<ContainerType>::stringMatchesFilterExpression(const QString &value, const QString &filter, Qt::CaseSensitivity cs) const
|
||||
{
|
||||
QString v = value.trimmed();
|
||||
QString f = filter.trimmed();
|
||||
|
||||
if (v.isEmpty() && f.isEmpty()) { return true; }
|
||||
if (v.isEmpty()) { return false; }
|
||||
|
||||
// no wildcard, just string matching
|
||||
if (!filter.contains('*'))
|
||||
{
|
||||
return (v.indexOf(f, 0, cs) == 0) &&
|
||||
(v.length() == f.length());
|
||||
}
|
||||
|
||||
const QString filterNoWildcard = stripWildcard(f);
|
||||
|
||||
// included?
|
||||
if (f.startsWith('*') && f.endsWith('*'))
|
||||
{
|
||||
return v.contains(filterNoWildcard, cs);
|
||||
}
|
||||
|
||||
// starting with
|
||||
if (f.startsWith('*'))
|
||||
{
|
||||
return v.endsWith(filterNoWildcard, cs);
|
||||
}
|
||||
|
||||
if (f.endsWith('*'))
|
||||
{
|
||||
return v.startsWith(filterNoWildcard, cs);
|
||||
}
|
||||
|
||||
// should never happen
|
||||
Q_ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
template<class ContainerType>
|
||||
QString IModelFilter<ContainerType>::stripWildcard(const QString &value) const
|
||||
{
|
||||
QString sw(value);
|
||||
return sw.remove('*');
|
||||
}
|
||||
|
||||
// Forward instantiations
|
||||
template class IModelFilter<BlackMisc::CStatusMessageList>;
|
||||
template class IModelFilter<BlackMisc::CNameVariantPairList>;
|
||||
template class IModelFilter<BlackMisc::CIdentifierList>;
|
||||
|
||||
template class IModelFilter<BlackMisc::Aviation::CAtcStationList>;
|
||||
template class IModelFilter<BlackMisc::Aviation::CAirportList>;
|
||||
template class IModelFilter<BlackMisc::Aviation::CLiveryList>;
|
||||
template class IModelFilter<BlackMisc::Aviation::CAircraftIcaoCodeList>;
|
||||
template class IModelFilter<BlackMisc::Aviation::CAirlineIcaoCodeList>;
|
||||
template class IModelFilter<BlackMisc::CCountryList>;
|
||||
|
||||
template class IModelFilter<BlackMisc::Network::CServerList>;
|
||||
template class IModelFilter<BlackMisc::Network::CUserList>;
|
||||
template class IModelFilter<BlackMisc::Network::CClientList>;
|
||||
template class IModelFilter<BlackMisc::Network::CTextMessageList>;
|
||||
|
||||
template class IModelFilter<BlackMisc::Simulation::CSimulatedAircraftList>;
|
||||
template class IModelFilter<BlackMisc::Simulation::CAircraftModelList>;
|
||||
template class IModelFilter<BlackMisc::Simulation::CDistributorList>;
|
||||
|
||||
template class IModelFilter<BlackMisc::Settings::CSettingKeyboardHotkeyList>;
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
66
src/blackgui/models/modelfilter.h
Normal file
66
src/blackgui/models/modelfilter.h
Normal file
@@ -0,0 +1,66 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_LISTMODELFILTER_H
|
||||
#define BLACKGUI_LISTMODELFILTER_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include <QString>
|
||||
#include <memory>
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
//! Model filter interface
|
||||
template<class ContainerType> class IModelFilter
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
IModelFilter(bool enabled = true) : m_enabled(enabled) {}
|
||||
|
||||
//! Destructor
|
||||
virtual ~IModelFilter() {}
|
||||
|
||||
//! Used container data
|
||||
virtual ContainerType filter(const ContainerType &container) const = 0;
|
||||
|
||||
//! Anything to do?
|
||||
virtual bool isValid() const = 0;
|
||||
|
||||
//! Enabled?
|
||||
virtual bool isEnabled() const { return m_enabled && isValid(); }
|
||||
|
||||
//! Enabled?
|
||||
void setEnabled(bool enable);
|
||||
|
||||
protected:
|
||||
//! Standard string search supporting wildcard at begin and end: "*xyz", "abc*"
|
||||
bool stringMatchesFilterExpression(const QString &value, const QString &filter, Qt::CaseSensitivity cs = Qt::CaseInsensitive) const;
|
||||
|
||||
//! Remove the * wildcards
|
||||
QString stripWildcard(const QString &value) const;
|
||||
|
||||
private:
|
||||
bool m_enabled = true;
|
||||
};
|
||||
|
||||
//! Model filter interface for those who can generate such a filter (e.g. a widget dialog)
|
||||
template<class ContainerType> class IModelFilterProvider
|
||||
{
|
||||
public:
|
||||
//! Get the filter
|
||||
virtual std::unique_ptr<IModelFilter<ContainerType>> createModelFilter() const = 0;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
#endif // guard
|
||||
@@ -53,7 +53,7 @@ namespace BlackGui
|
||||
this->m_columns.addColumn(CColumn("dist.", "distance", CSimulatedAircraft::IndexDistanceToOwnAircraft, new CAirspaceDistanceFormatter()));
|
||||
this->m_columns.addColumn(CColumn("altitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexAltitude }, new CAltitudeFormatter()));
|
||||
this->m_columns.addColumn(CColumn("gs.", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexGroundspeed }, new CAircraftSpeedFormatter()));
|
||||
this->m_columns.addColumn(CColumn::standardString("icao", { CSimulatedAircraft::IndexIcao, CAircraftIcaoData::IndexAsString}));
|
||||
this->m_columns.addColumn(CColumn::standardString("icao", { CSimulatedAircraft::IndexAircraftIcaoCode, CAircraftIcaoCode::IndexAircraftDesignator}));
|
||||
this->m_columns.addColumn(CColumn("frequency", { CSimulatedAircraft::IndexCom1System, CComSystem::IndexActiveFrequency }, new CComFrequencyFormatter()));
|
||||
this->m_columns.addColumn(CColumn::standardString("transponder", { CSimulatedAircraft::IndexTransponder, CTransponder::IndexTransponderCodeAndModeFormatted }));
|
||||
this->m_columns.addColumn(CColumn("latitude", { CSimulatedAircraft::IndexSituation, CAircraftSituation::IndexLatitude }, new CLatLonFormatter()));
|
||||
@@ -74,7 +74,7 @@ namespace BlackGui
|
||||
this->m_columns.addColumn(CColumn("p.", "parts", CSimulatedAircraft::IndexPartsSynchronized, new CBoolIconFormatter("parts", "no parts"), true));
|
||||
this->m_columns.addColumn(CColumn("fp.", "fast position updates", CSimulatedAircraft::IndexFastPositionUpdates, new CBoolIconFormatter("enabled", "disabled"), true));
|
||||
this->m_columns.addColumn(CColumn::standardString("realname", "pilot's real name", { CSimulatedAircraft::IndexPilot, CUser::IndexRealName }));
|
||||
this->m_columns.addColumn(CColumn::standardString("icao", { CSimulatedAircraft::IndexIcao, CAircraftIcaoData::IndexAsString}));
|
||||
this->m_columns.addColumn(CColumn::standardString("icao", CSimulatedAircraft::IndexCombinedIcaoLiveryString));
|
||||
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}));
|
||||
|
||||
@@ -20,22 +20,10 @@ namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
CStatusMessageListModel::CStatusMessageListModel(QObject *parent) :
|
||||
CListModelBase<BlackMisc::CStatusMessage, BlackMisc::CStatusMessageList>("ViewStatusMessageList", parent)
|
||||
{
|
||||
this->m_columns.addColumn(CColumn("time", CStatusMessage::IndexUtcTimestamp, new CDateTimeFormatter(CDateTimeFormatter::formatHms())));
|
||||
this->m_columns.addColumn(CColumn::standardString("category", CStatusMessage::IndexCategoryHumanReadable));
|
||||
CColumn col = CColumn("severity", CStatusMessage::IndexIcon);
|
||||
col.setSortPropertyIndex(CStatusMessage::IndexSeverityAsString);
|
||||
this->m_columns.addColumn(col);
|
||||
this->m_columns.addColumn(CColumn::standardString("message", CStatusMessage::IndexMessage));
|
||||
this->m_columns.addColumn(CColumn::standardString("all categories", CStatusMessage::IndexCategories));
|
||||
|
||||
this->m_sortedColumn = CStatusMessage::IndexUtcTimestamp;
|
||||
this->m_sortOrder = Qt::DescendingOrder;
|
||||
setMode(Detailed);
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ViewStatusMessageList", "time");
|
||||
@@ -45,5 +33,39 @@ namespace BlackGui
|
||||
(void)QT_TRANSLATE_NOOP("ViewStatusMessageList", "all categories");
|
||||
}
|
||||
|
||||
void CStatusMessageListModel::setMode(CStatusMessageListModel::Mode mode)
|
||||
{
|
||||
this->m_columns.clear();
|
||||
switch (mode)
|
||||
{
|
||||
case Detailed:
|
||||
{
|
||||
this->m_columns.addColumn(CColumn("time", CStatusMessage::IndexUtcTimestamp, new CDateTimeFormatter(CDateTimeFormatter::formatHms())));
|
||||
this->m_columns.addColumn(CColumn::standardString("category", CStatusMessage::IndexCategoryHumanReadable));
|
||||
CColumn col = CColumn("severity", CStatusMessage::IndexIcon);
|
||||
col.setSortPropertyIndex(CStatusMessage::IndexSeverityAsString);
|
||||
this->m_columns.addColumn(col);
|
||||
this->m_columns.addColumn(CColumn::standardString("message", CStatusMessage::IndexMessage));
|
||||
this->m_columns.addColumn(CColumn::standardString("all categories", CStatusMessage::IndexCategories));
|
||||
|
||||
this->m_sortedColumn = CStatusMessage::IndexUtcTimestamp;
|
||||
this->m_sortOrder = Qt::DescendingOrder;
|
||||
}
|
||||
break;
|
||||
case Simplified:
|
||||
{
|
||||
this->m_columns.addColumn(CColumn("time", CStatusMessage::IndexUtcTimestamp, new CDateTimeFormatter(CDateTimeFormatter::formatHms())));
|
||||
CColumn col = CColumn("severity", CStatusMessage::IndexIcon);
|
||||
col.setSortPropertyIndex(CStatusMessage::IndexSeverityAsString);
|
||||
this->m_columns.addColumn(col);
|
||||
this->m_columns.addColumn(CColumn::standardString("message", CStatusMessage::IndexMessage));
|
||||
|
||||
this->m_sortedColumn = CStatusMessage::IndexUtcTimestamp;
|
||||
this->m_sortOrder = Qt::DescendingOrder;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -29,13 +29,22 @@ namespace BlackGui
|
||||
{
|
||||
|
||||
public:
|
||||
//! Mode
|
||||
enum Mode
|
||||
{
|
||||
Detailed,
|
||||
Simplified
|
||||
};
|
||||
|
||||
//! Constructor
|
||||
explicit CStatusMessageListModel(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CStatusMessageListModel() {}
|
||||
|
||||
//! Set mode
|
||||
void setMode(Mode mode);
|
||||
};
|
||||
}
|
||||
}
|
||||
} // ns
|
||||
} // ns
|
||||
#endif // guard
|
||||
|
||||
26
src/blackgui/views/aircrafticaoview.cpp
Normal file
26
src/blackgui/views/aircrafticaoview.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "aircrafticaoview.h"
|
||||
#include <QHeaderView>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
CAircraftIcaoCodeView::CAircraftIcaoCodeView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
this->m_withMenuItemBackend = true;
|
||||
this->standardInit(new CAircraftIcaoCodeListModel(this));
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
33
src/blackgui/views/aircrafticaoview.h
Normal file
33
src/blackgui/views/aircrafticaoview.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_AIRCRAFTICAOVIEW_H
|
||||
#define BLACKGUI_AIRCRAFTICAOVIEW_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "viewbase.h"
|
||||
#include "../models/aircrafticaolistmodel.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
//! Aircraft ICAO codes view
|
||||
class BLACKGUI_EXPORT CAircraftIcaoCodeView : public CViewBase<Models::CAircraftIcaoCodeListModel, BlackMisc::Aviation::CAircraftIcaoCodeList, BlackMisc::Aviation::CAircraftIcaoCode>
|
||||
{
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAircraftIcaoCodeView(QWidget *parent = nullptr);
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // guard
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
#include "aircraftmodelview.h"
|
||||
#include "aircraftmodelfilterform.h"
|
||||
#include "blackgui/filters/aircraftmodelfilterdialog.h"
|
||||
#include <QHeaderView>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
@@ -16,6 +16,7 @@
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackMisc::Simulation;
|
||||
using namespace BlackGui::Models;
|
||||
using namespace BlackGui::Filters;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
@@ -23,18 +24,40 @@ namespace BlackGui
|
||||
{
|
||||
CAircraftModelView::CAircraftModelView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
this->m_withMenuItemClear = true;
|
||||
this->m_withMenuItemRefresh = true;
|
||||
this->standardInit(new CAircraftModelListModel(CAircraftModelListModel::ModelOnly, this));
|
||||
this->standardInit(new CAircraftModelListModel(CAircraftModelListModel::OwnSimulatorModel, this));
|
||||
|
||||
// filter
|
||||
QWidget *mainWindow = this->mainApplicationWindowWidget();
|
||||
Q_ASSERT_X(mainWindow, Q_FUNC_INFO, "no main window found");
|
||||
this->setFilterDialog(new CAircraftModelFilterForm(mainWindow));
|
||||
this->setFilterDialog(new CAircraftModelFilterDialog(mainWindow));
|
||||
}
|
||||
|
||||
void CAircraftModelView::setAircraftModelMode(CAircraftModelListModel::AircraftModelMode mode)
|
||||
{
|
||||
if (mode == CAircraftModelListModel::Database)
|
||||
{
|
||||
this->m_withMenuItemClear = false;
|
||||
this->m_withMenuItemRefresh = false;
|
||||
this->m_withMenuItemBackend = true;
|
||||
}
|
||||
else if (mode == CAircraftModelListModel::OwnSimulatorModel)
|
||||
{
|
||||
this->m_withMenuItemClear = false;
|
||||
this->m_withMenuItemRefresh = false;
|
||||
this->m_withMenuItemBackend = true;
|
||||
}
|
||||
else if (mode == CAircraftModelListModel::VPilotRuleModel)
|
||||
{
|
||||
this->m_withMenuItemClear = true;
|
||||
this->m_withMenuItemRefresh = false;
|
||||
this->m_withMenuItemBackend = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
this->m_withMenuItemClear = true;
|
||||
this->m_withMenuItemRefresh = true;
|
||||
this->m_withMenuItemBackend = true;
|
||||
}
|
||||
this->m_model->setAircraftModelMode(mode);
|
||||
}
|
||||
|
||||
@@ -43,22 +66,19 @@ namespace BlackGui
|
||||
return m_displayAutomatically;
|
||||
}
|
||||
|
||||
bool CAircraftModelView::ps_filterDialogFinished(int status)
|
||||
{
|
||||
if (CViewBase::ps_filterDialogFinished(status)) { return true; }
|
||||
if (!this->m_filterDialog) { this->derivedModel()->removeFilter(); return true; }
|
||||
std::unique_ptr<IModelFilter<CAircraftModelList>> filter(this->getFilterForm()->getFilter());
|
||||
this->derivedModel()->setFilter(filter);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CAircraftModelView::customMenu(QMenu &menu) const
|
||||
{
|
||||
QAction *a = menu.addAction(CIcons::appMappings16(), "Automatically display", this, SLOT(ps_toggleAutoDisplay()));
|
||||
a->setCheckable(true);
|
||||
a->setChecked(m_displayAutomatically);
|
||||
menu.addAction(CIcons::refresh16(), "Reload model data", this, SIGNAL(requestModelReload()));
|
||||
menu.addSeparator();
|
||||
CAircraftModelListModel::AircraftModelMode mode = this->m_model->getModelMode();
|
||||
if (mode == CAircraftModelListModel::VPilotRuleModel || mode == CAircraftModelListModel::OwnSimulatorModel)
|
||||
{
|
||||
QAction *a = menu.addAction(CIcons::appMappings16(), "Automatically display", this, SLOT(ps_toggleAutoDisplay()));
|
||||
a->setCheckable(true);
|
||||
a->setChecked(m_displayAutomatically);
|
||||
menu.addSeparator();
|
||||
a = menu.addAction(CIcons::database16(), "Highlight DB items", this, SLOT(ps_toggleHighlightDbModels()));
|
||||
a->setCheckable(true);
|
||||
a->setChecked(derivedModel()->highlightDbData());
|
||||
}
|
||||
CViewBase::customMenu(menu);
|
||||
}
|
||||
|
||||
@@ -66,13 +86,14 @@ namespace BlackGui
|
||||
{
|
||||
QAction *a = qobject_cast<QAction *>(QObject::sender());
|
||||
if (!a) { return; }
|
||||
Q_ASSERT(a->isCheckable());
|
||||
Q_ASSERT_X(a->isCheckable(), Q_FUNC_INFO, "object not checkable");
|
||||
this->m_displayAutomatically = a->isChecked();
|
||||
}
|
||||
|
||||
CAircraftModelFilterForm *CAircraftModelView::getFilterForm() const
|
||||
void CAircraftModelView::ps_toggleHighlightDbModels()
|
||||
{
|
||||
return static_cast<CAircraftModelFilterForm *>(this->m_filterDialog.data());
|
||||
bool h = derivedModel()->highlightDbData();
|
||||
derivedModel()->setHighlightDbData(!h);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -13,16 +13,17 @@
|
||||
#define BLACKGUI_AIRCRAFTMODELVIEW_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "aircraftmodelfilterform.h"
|
||||
#include "blackgui/filters/aircraftmodelfilterdialog.h"
|
||||
#include "blackgui/models/aircraftmodellistmodel.h"
|
||||
#include "viewbase.h"
|
||||
#include "../models/aircraftmodellistmodel.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
//! Aircraft view
|
||||
class BLACKGUI_EXPORT CAircraftModelView : public CViewBase<Models::CAircraftModelListModel, BlackMisc::Simulation::CAircraftModelList, BlackMisc::Simulation::CAircraftModel>
|
||||
class BLACKGUI_EXPORT CAircraftModelView :
|
||||
public CViewBase<Models::CAircraftModelListModel, BlackMisc::Simulation::CAircraftModelList, BlackMisc::Simulation::CAircraftModel>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -36,13 +37,12 @@ namespace BlackGui
|
||||
//! Display automatically (when models are loaded)
|
||||
bool displayAutomatically() const;
|
||||
|
||||
signals:
|
||||
//! Request reloading of backend models
|
||||
void requestModelReload();
|
||||
//! Display automatically (when models are loaded)
|
||||
void setDisplayAutomatically(bool automatically) { m_displayAutomatically = automatically; }
|
||||
|
||||
protected slots:
|
||||
//! \copydoc CViewBaseNonTemplate::ps_filterDialogFinished
|
||||
virtual bool ps_filterDialogFinished(int status) override;
|
||||
signals:
|
||||
//! Request to load VPilot data
|
||||
void requestVPilotRules();
|
||||
|
||||
protected:
|
||||
//! \copydoc CViewBase::customMenu
|
||||
@@ -52,10 +52,11 @@ namespace BlackGui
|
||||
//! Toggle auto display
|
||||
void ps_toggleAutoDisplay();
|
||||
|
||||
//! Highlight DB models
|
||||
void ps_toggleHighlightDbModels();
|
||||
|
||||
private:
|
||||
//! Filter form
|
||||
CAircraftModelFilterForm *getFilterForm() const;
|
||||
bool m_displayAutomatically = false;
|
||||
bool m_displayAutomatically = false; //!< display automatically (when models are loaded)
|
||||
};
|
||||
} // ns
|
||||
} // ns
|
||||
|
||||
26
src/blackgui/views/airlineicaoview.cpp
Normal file
26
src/blackgui/views/airlineicaoview.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "airlineicaoview.h"
|
||||
#include <QHeaderView>
|
||||
|
||||
using namespace BlackMisc;
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
CAirlineIcaoCodeView::CAirlineIcaoCodeView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
this->m_withMenuItemBackend = true;
|
||||
this->standardInit(new CAirlineIcaoCodeListModel(this));
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
33
src/blackgui/views/airlineicaoview.h
Normal file
33
src/blackgui/views/airlineicaoview.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_AIRLINEICAOVIEW_H
|
||||
#define BLACKGUI_AIRLINEICAOVIEW_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "viewbase.h"
|
||||
#include "../models/airlineicaolistmodel.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
//! Aircraft ICAO codes view
|
||||
class BLACKGUI_EXPORT CAirlineIcaoCodeView : public CViewBase<Models::CAirlineIcaoCodeListModel, BlackMisc::Aviation::CAirlineIcaoCodeList, BlackMisc::Aviation::CAirlineIcaoCode>
|
||||
{
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CAirlineIcaoCodeView(QWidget *parent = nullptr);
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // guard
|
||||
25
src/blackgui/views/countryview.cpp
Normal file
25
src/blackgui/views/countryview.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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 "countryview.h"
|
||||
#include <QHeaderView>
|
||||
|
||||
using namespace BlackGui::Models;
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
CCountryView::CCountryView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
this->m_withMenuItemBackend = true;
|
||||
this->standardInit(new CCountryListModel(this));
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
32
src/blackgui/views/countryview.h
Normal file
32
src/blackgui/views/countryview.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/* Copyright (C) 2015
|
||||
* 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_COUNTRYVIEW_H
|
||||
#define BLACKGUI_COUNTRYVIEW_H
|
||||
|
||||
#include "viewbase.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/models/countrylistmodel.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
namespace Views
|
||||
{
|
||||
//! Distributors
|
||||
class BLACKGUI_EXPORT CCountryView : public CViewBase<Models::CCountryListModel, BlackMisc::CCountryList, BlackMisc::CCountry>
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CCountryView(QWidget *parent = nullptr);
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif // guard
|
||||
@@ -18,6 +18,7 @@ namespace BlackGui
|
||||
{
|
||||
CDistributorView::CDistributorView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
this->m_withMenuItemBackend = true;
|
||||
this->standardInit(new CDistributorListModel(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace BlackGui
|
||||
{
|
||||
CLiveryView::CLiveryView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
this->m_withMenuItemBackend = true;
|
||||
this->standardInit(new CLiveryListModel(this));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,9 +12,9 @@
|
||||
#ifndef BLACKGUI_LIVERYVIEW_H
|
||||
#define BLACKGUI_LIVERYVIEW_H
|
||||
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "viewbase.h"
|
||||
#include "../models/liverylistmodel.h"
|
||||
#include "blackgui/blackguiexport.h"
|
||||
#include "blackgui/models/liverylistmodel.h"
|
||||
|
||||
namespace BlackGui
|
||||
{
|
||||
|
||||
@@ -32,10 +32,10 @@ namespace BlackGui
|
||||
void setIconMode(bool withIcon);
|
||||
|
||||
//! Update or add value, QVariant version
|
||||
bool addOrUpdateByName(const QString &name, const BlackMisc::CVariant &value, const BlackMisc::CIcon &icon = BlackMisc::CIcon(), bool performResizing = true, bool skipEqualValues = true);
|
||||
bool addOrUpdateByName(const QString &name, const BlackMisc::CVariant &value, const BlackMisc::CIcon &icon = BlackMisc::CIcon(), bool isResizeConditionMet = true, bool skipEqualValues = true);
|
||||
|
||||
//! Remove by name
|
||||
void removeByName(const QString &name, bool performResizing = true);
|
||||
void removeByName(const QString &name, bool isResizeConditionMet = true);
|
||||
|
||||
//! Contains name
|
||||
bool containsName(const QString &name);
|
||||
|
||||
Reference in New Issue
Block a user