refs #899, formatting, renaming, include guard names

This commit is contained in:
Klaus Basan
2017-03-06 02:30:22 +01:00
committed by Mathew Sutcliffe
parent 8cc683386f
commit f71e717ec1
12 changed files with 49 additions and 56 deletions

View File

@@ -9,8 +9,8 @@
//! \file
#ifndef BLACKGUI_ATCLISTMODEL_H
#define BLACKGUI_ATCLISTMODEL_H
#ifndef BLACKGUI_MODELS_ATCLISTMODEL_H
#define BLACKGUI_MODELS_ATCLISTMODEL_H
#include "blackgui/blackguiexport.h"
#include "blackgui/models/listmodelbase.h"

View File

@@ -10,6 +10,18 @@
#include "listmodeldbobjects.h"
#include "allmodelcontainers.h"
#include "blackmisc/db/datastoreobjectlist.h"
#include "blackmisc/simulation/aircraftmodel.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackmisc/simulation/distributor.h"
#include "blackmisc/simulation/distributorlist.h"
#include "blackmisc/aviation/aircrafticaocode.h"
#include "blackmisc/aviation/aircrafticaocodelist.h"
#include "blackmisc/aviation/airlineicaocode.h"
#include "blackmisc/aviation/airlineicaocodelist.h"
#include "blackmisc/aviation/livery.h"
#include "blackmisc/aviation/liverylist.h"
#include "blackmisc/country.h"
#include "blackmisc/countrylist.h"
#include "blackmisc/orderable.h"
#include <QBrush>
@@ -37,7 +49,7 @@ namespace BlackGui
QVariant CListModelDbObjects<ObjectType, ContainerType, KeyType, UseCompare>::data(const QModelIndex &index, int role) const
{
if (role != Qt::BackgroundRole) { return CListModelBase<ObjectType, ContainerType, UseCompare>::data(index, role); }
if (isHighlightIndex(index)) { return QBrush(m_highlightColor); }
if (isHighlightedIndex(index)) { return QBrush(m_highlightColor); }
return CListModelBase<ObjectType, ContainerType, UseCompare>::data(index, role);
}
@@ -49,7 +61,7 @@ namespace BlackGui
}
template <typename ObjectType, typename ContainerType, typename KeyType, bool UseCompare>
bool CListModelDbObjects<ObjectType, ContainerType, KeyType, UseCompare>::isHighlightIndex(const QModelIndex &index) const
bool CListModelDbObjects<ObjectType, ContainerType, KeyType, UseCompare>::isHighlightedIndex(const QModelIndex &index) const
{
if (!index.isValid()) { return false; }
if (m_highlightKeys.isEmpty()) { return false; }
@@ -97,8 +109,6 @@ namespace BlackGui
return CListModelDbObjects<ObjectType, ContainerType, KeyType, UseCompare>::update(container, sort);
}
// see here for the reason of thess forward instantiations
// https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl
template class CListModelDbObjects<BlackMisc::Aviation::CLivery, BlackMisc::Aviation::CLiveryList, int, true>;
template class CListModelDbObjects<BlackMisc::CCountry, BlackMisc::CCountryList, QString, true>;
template class CListModelDbObjects<BlackMisc::Aviation::CAircraftIcaoCode, BlackMisc::Aviation::CAircraftIcaoCodeList, int, true>;

View File

@@ -9,22 +9,10 @@
//! \file
#ifndef BLACKGUI_LISTMODELDBOBJECTS_H
#define BLACKGUI_LISTMODELDBOBJECTS_H
#ifndef BLACKGUI_MODELS_LISTMODELDBOBJECTS_H
#define BLACKGUI_MODELS_LISTMODELDBOBJECTS_H
#include "blackgui/models/listmodelbase.h"
#include "blackmisc/aviation/aircrafticaocode.h"
#include "blackmisc/aviation/aircrafticaocodelist.h"
#include "blackmisc/aviation/airlineicaocode.h"
#include "blackmisc/aviation/airlineicaocodelist.h"
#include "blackmisc/aviation/livery.h"
#include "blackmisc/aviation/liverylist.h"
#include "blackmisc/country.h"
#include "blackmisc/countrylist.h"
#include "blackmisc/simulation/aircraftmodel.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackmisc/simulation/distributor.h"
#include "blackmisc/simulation/distributorlist.h"
#include <QColor>
#include <QList>
@@ -48,15 +36,15 @@ namespace BlackGui
virtual ~CListModelDbObjects() {}
//! Keys to be highlighted
void setHighlightDbKeys(const QList<KeyType> &keys) { m_highlightKeys = keys; }
void setHighlightedDbKeys(const QList<KeyType> &keys) { m_highlightKeys = keys; }
//! Clear the highlighted keys
void clearHighlightingDbKeys() { m_highlightKeys.clear(); }
void clearHighlightedDbKeys() { m_highlightKeys.clear(); }
//! \copydoc BlackGui::Models::CListModelBaseNonTemplate::clearHighlighting
virtual void clearHighlighting() override
{
this->clearHighlightingDbKeys();
this->clearHighlightedDbKeys();
CListModelBase<ObjectType, ContainerType, UseCompare>::clearHighlighting();
}
@@ -70,7 +58,7 @@ namespace BlackGui
KeyType dbKeyForIndex(const QModelIndex &index) const;
//! Highlight index
bool isHighlightIndex(const QModelIndex &index) const;
bool isHighlightedIndex(const QModelIndex &index) const;
protected:
//! Constructor

View File

@@ -9,8 +9,8 @@
//! \file
#ifndef BLACKGUI_SIMULATEDAIRCRAFTLISTMODEL_H
#define BLACKGUI_SIMULATEDAIRCRAFTLISTMODEL_H
#ifndef BLACKGUI_MODELS_SIMULATEDAIRCRAFTLISTMODEL_H
#define BLACKGUI_MODELS_SIMULATEDAIRCRAFTLISTMODEL_H
#include "blackgui/blackguiexport.h"
#include "blackgui/models/listmodelbase.h"
@@ -19,12 +19,10 @@
class QObject;
namespace BlackMisc { namespace Simulation { class CSimulatedAircraft; } }
namespace BlackGui
{
namespace Models
{
//! Aircraft list model
class BLACKGUI_EXPORT CSimulatedAircraftListModel :
public CListModelBase<BlackMisc::Simulation::CSimulatedAircraft, BlackMisc::Simulation::CSimulatedAircraftList, true>

View File

@@ -73,21 +73,21 @@ namespace BlackGui
void CAtcStationView::ps_tuneInAtcCom1()
{
CAtcStation s(this->selectedObject());
const CAtcStation s(this->selectedObject());
if (s.getCallsign().isEmpty()) { return; }
emit this->requestComFrequency(s.getFrequency(), CComSystem::Com1);
}
void CAtcStationView::ps_tuneInAtcCom2()
{
CAtcStation s(this->selectedObject());
const CAtcStation s(this->selectedObject());
if (s.getCallsign().isEmpty()) { return; }
emit this->requestComFrequency(s.getFrequency(), CComSystem::Com2);
}
void CAtcStationView::ps_requestTextMessage()
{
CAtcStation s(this->selectedObject());
const CAtcStation s(this->selectedObject());
if (s.getCallsign().isEmpty()) { return; }
emit this->requestTextMessageWidget(s.getCallsign());
}

View File

@@ -27,11 +27,9 @@ class QAction;
class QWidget;
namespace BlackMisc { namespace Aviation { class CCallsign; } }
namespace BlackGui
{
namespace Menus { class CMenuActions; }
namespace Views
{
//! ATC stations view

View File

@@ -94,6 +94,5 @@ namespace BlackGui
if (aircraft.getCallsign().isEmpty()) { return; }
emit requestHighlightInSimulator(aircraft);
}
} // ns
} // ns

View File

@@ -9,8 +9,8 @@
//! \file
#ifndef BLACKGUI_SIMULATEDAIRCRAFTVIEW_H
#define BLACKGUI_SIMULATEDAIRCRAFTVIEW_H
#ifndef BLACKGUI_VIEWS_SIMULATEDAIRCRAFTVIEW_H
#define BLACKGUI_VIEWS_SIMULATEDAIRCRAFTVIEW_H
#include "blackgui/blackguiexport.h"
#include "blackgui/models/simulatedaircraftlistmodel.h"

View File

@@ -9,7 +9,20 @@
#include "blackgui/menus/menuaction.h"
#include "blackgui/views/viewdbobjects.h"
#include "blackgui/models/aircrafticaolistmodel.h"
#include "blackgui/models/aircraftmodellistmodel.h"
#include "blackgui/models/airlineicaolistmodel.h"
#include "blackgui/models/countrylistmodel.h"
#include "blackgui/models/distributorlistmodel.h"
#include "blackgui/models/liverylistmodel.h"
#include "blackmisc/aviation/aircrafticaocodelist.h"
#include "blackmisc/aviation/airlineicaocodelist.h"
#include "blackmisc/aviation/liverylist.h"
#include "blackmisc/icons.h"
#include "blackmisc/countrylist.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackmisc/simulation/distributor.h"
#include "blackmisc/simulation/distributorlist.h"
#include <QAction>
#include <QIntValidator>

View File

@@ -9,24 +9,10 @@
//! \file
#ifndef BLACKGUI_VIEWDBOBJECTS_H
#define BLACKGUI_VIEWDBOBJECTS_H
#ifndef BLACKGUI_VIEWS_VIEWDBOBJECTS_H
#define BLACKGUI_VIEWS_VIEWDBOBJECTS_H
#include "blackgui/models/aircrafticaolistmodel.h"
#include "blackgui/models/aircraftmodellistmodel.h"
#include "blackgui/models/airlineicaolistmodel.h"
#include "blackgui/models/countrylistmodel.h"
#include "blackgui/models/distributorlistmodel.h"
#include "blackgui/models/liverylistmodel.h"
#include "blackgui/views/viewbase.h"
#include "blackmisc/aviation/aircrafticaocodelist.h"
#include "blackmisc/aviation/airlineicaocodelist.h"
#include "blackmisc/aviation/liverylist.h"
#include "blackmisc/countrylist.h"
#include "blackmisc/simulation/aircraftmodellist.h"
#include "blackmisc/simulation/distributor.h"
#include "blackmisc/simulation/distributorlist.h"
#include <QSet>
#include <QObject>
#include <QString>
@@ -34,6 +20,7 @@
class QAction;
class QIntValidator;
class QFrame;
class QLineEdit;
class QWidget;

View File

@@ -122,7 +122,7 @@ namespace BlackMisc
template <class OBJ, class CONTAINER>
int ICallsignObjectList<OBJ, CONTAINER>::removeByCallsigns(const CCallsignSet &callsigns)
{
return this->container().removeIf([ & ](const OBJ &obj) { return callsigns.contains(obj.getCallsign()); });
return this->container().removeIf([ & ](const OBJ & obj) { return callsigns.contains(obj.getCallsign()); });
}
template <class OBJ, class CONTAINER>

View File

@@ -48,7 +48,6 @@ namespace BlackMisc
class ICallsignObjectList
{
public:
//! Contains callsign?
bool containsCallsign(const BlackMisc::Aviation::CCallsign &callsign) const;
@@ -88,12 +87,13 @@ namespace BlackMisc
//! Split into 0..n containers as per callsign
QHash<BlackMisc::Aviation::CCallsign, CONTAINER> splitPerCallsign() const;
//! Sort by callsign
void sortByCallsign();
//! Incremental update or add object
int incrementalUpdateOrAdd(const OBJ &objectBeforeChanged, const BlackMisc::CPropertyIndexVariantMap &changedValues);
//! Sort by callsign
void sortByCallsign();
protected:
//! Constructor
ICallsignObjectList();