From 1b4ed84e1b4fa088aa2fa93f5d37afb13115feea Mon Sep 17 00:00:00 2001 From: Mat Sutcliffe Date: Thu, 20 Dec 2018 01:03:22 +0000 Subject: [PATCH] CListModelBase and CViewBase: reduce the number of template parameters by relying on what can easily be deduced from the first parameter(s). --- src/blackgui/models/aircrafticaolistmodel.h | 2 +- src/blackgui/models/aircraftmodellistmodel.h | 2 +- .../models/aircraftpartslistmodel.cpp | 2 +- src/blackgui/models/aircraftpartslistmodel.h | 2 +- .../aircraftsituationchangelistmodel.cpp | 2 +- .../models/aircraftsituationchangelistmodel.h | 2 +- .../models/aircraftsituationlistmodel.cpp | 2 +- .../models/aircraftsituationlistmodel.h | 2 +- src/blackgui/models/airlineicaolistmodel.h | 2 +- src/blackgui/models/airportlistmodel.h | 2 +- .../models/applicationinfolistmodel.h | 2 +- src/blackgui/models/atcstationlistmodel.h | 2 +- src/blackgui/models/clientlistmodel.cpp | 2 +- src/blackgui/models/clientlistmodel.h | 2 +- src/blackgui/models/cloudlayerlistmodel.h | 2 +- src/blackgui/models/countrylistmodel.h | 2 +- src/blackgui/models/distributorlistmodel.h | 2 +- src/blackgui/models/identifierlistmodel.h | 2 +- src/blackgui/models/interpolationsetupmodel.h | 2 +- src/blackgui/models/listmodelbase.cpp | 160 +++++------ src/blackgui/models/listmodelbase.h | 9 +- src/blackgui/models/listmodelbaseaviation.cpp | 16 +- src/blackgui/models/listmodelbasemisc.cpp | 10 +- src/blackgui/models/listmodelbasenetwork.cpp | 8 +- .../models/listmodelbasesimulation.cpp | 10 +- src/blackgui/models/listmodelbaseweather.cpp | 6 +- .../models/listmodelcallsignobjects.cpp | 28 +- .../models/listmodelcallsignobjects.h | 12 +- src/blackgui/models/listmodeldbobjects.cpp | 60 ++-- src/blackgui/models/listmodeldbobjects.h | 28 +- .../models/listmodeltimestampobjects.cpp | 42 +-- .../models/listmodeltimestampobjects.h | 21 +- src/blackgui/models/liverylistmodel.h | 2 +- src/blackgui/models/matchingstatisticsmodel.h | 2 +- .../models/namevariantpairlistmodel.h | 2 +- src/blackgui/models/serverlistmodel.h | 2 +- .../models/simulatedaircraftlistmodel.h | 2 +- .../models/statusmessagelistmodel.cpp | 2 +- src/blackgui/models/statusmessagelistmodel.h | 2 +- .../models/temperaturelayerlistmodel.h | 2 +- src/blackgui/models/textmessagelistmodel.h | 2 +- src/blackgui/models/userlistmodel.h | 2 +- src/blackgui/models/windlayerlistmodel.h | 2 +- src/blackgui/views/aircrafticaoview.h | 2 +- src/blackgui/views/aircraftmodelview.h | 2 +- src/blackgui/views/aircraftpartsview.h | 2 +- .../views/aircraftsituationchangeview.h | 2 +- src/blackgui/views/aircraftsituationview.h | 2 +- src/blackgui/views/airlineicaoview.h | 2 +- src/blackgui/views/airportview.h | 2 +- src/blackgui/views/applicationinfoview.h | 2 +- src/blackgui/views/atcstationview.h | 2 +- src/blackgui/views/clientview.h | 2 +- src/blackgui/views/cloudlayerview.h | 2 +- src/blackgui/views/countryview.h | 2 +- src/blackgui/views/distributorview.h | 2 +- src/blackgui/views/identifierview.h | 2 +- src/blackgui/views/interpolationsetupview.h | 2 +- src/blackgui/views/liveryview.h | 2 +- src/blackgui/views/matchingstatisticsview.h | 2 +- src/blackgui/views/namevariantpairview.h | 2 +- src/blackgui/views/serverview.h | 2 +- src/blackgui/views/simulatedaircraftview.h | 2 +- src/blackgui/views/statusmessageview.h | 2 +- src/blackgui/views/temperaturelayerview.h | 2 +- src/blackgui/views/textmessageview.h | 2 +- src/blackgui/views/userview.h | 2 +- src/blackgui/views/viewbase.cpp | 268 +++++++++--------- src/blackgui/views/viewbase.h | 13 +- src/blackgui/views/viewbaseaviation.cpp | 18 +- src/blackgui/views/viewbasemisc.cpp | 10 +- src/blackgui/views/viewbasenetwork.cpp | 8 +- src/blackgui/views/viewbasesimulation.cpp | 8 +- src/blackgui/views/viewbaseweather.cpp | 6 +- src/blackgui/views/viewcallsignobjects.cpp | 46 +-- src/blackgui/views/viewcallsignobjects.h | 13 +- src/blackgui/views/viewdbobjects.cpp | 102 +++---- src/blackgui/views/viewdbobjects.h | 33 ++- src/blackgui/views/viewtimestampobjects.cpp | 16 +- src/blackgui/views/viewtimestampobjects.h | 13 +- src/blackgui/views/windlayerview.h | 2 +- 81 files changed, 585 insertions(+), 489 deletions(-) diff --git a/src/blackgui/models/aircrafticaolistmodel.h b/src/blackgui/models/aircrafticaolistmodel.h index 2e4454311..d48db0739 100644 --- a/src/blackgui/models/aircrafticaolistmodel.h +++ b/src/blackgui/models/aircrafticaolistmodel.h @@ -23,7 +23,7 @@ namespace BlackGui { //! Airport list model class BLACKGUI_EXPORT CAircraftIcaoCodeListModel : - public CListModelDbObjects + public CListModelDbObjects { Q_OBJECT diff --git a/src/blackgui/models/aircraftmodellistmodel.h b/src/blackgui/models/aircraftmodellistmodel.h index 7cf231575..4b1653ae5 100644 --- a/src/blackgui/models/aircraftmodellistmodel.h +++ b/src/blackgui/models/aircraftmodellistmodel.h @@ -30,7 +30,7 @@ namespace BlackGui { //! Aircraft model list model class BLACKGUI_EXPORT CAircraftModelListModel : - public COrderableListModelDbObjects + public COrderableListModelDbObjects { Q_OBJECT diff --git a/src/blackgui/models/aircraftpartslistmodel.cpp b/src/blackgui/models/aircraftpartslistmodel.cpp index faafd09af..e95370c88 100644 --- a/src/blackgui/models/aircraftpartslistmodel.cpp +++ b/src/blackgui/models/aircraftpartslistmodel.cpp @@ -24,7 +24,7 @@ namespace BlackGui namespace Models { CAircraftPartsListModel::CAircraftPartsListModel(QObject *parent) : - CListModelTimestampWithOffsetObjects("ViewAircraftPartsList", parent) + CListModelTimestampWithOffsetObjects("ViewAircraftPartsList", parent) { this->addTimestampOffsetColumns(); diff --git a/src/blackgui/models/aircraftpartslistmodel.h b/src/blackgui/models/aircraftpartslistmodel.h index 6792ed850..395fe70da 100644 --- a/src/blackgui/models/aircraftpartslistmodel.h +++ b/src/blackgui/models/aircraftpartslistmodel.h @@ -26,7 +26,7 @@ namespace BlackGui namespace Models { //! Aircraft parts list model - class BLACKGUI_EXPORT CAircraftPartsListModel : public CListModelTimestampWithOffsetObjects + class BLACKGUI_EXPORT CAircraftPartsListModel : public CListModelTimestampWithOffsetObjects { Q_OBJECT diff --git a/src/blackgui/models/aircraftsituationchangelistmodel.cpp b/src/blackgui/models/aircraftsituationchangelistmodel.cpp index a82066a99..2ea5b29a7 100644 --- a/src/blackgui/models/aircraftsituationchangelistmodel.cpp +++ b/src/blackgui/models/aircraftsituationchangelistmodel.cpp @@ -24,7 +24,7 @@ namespace BlackGui namespace Models { CAircraftSituationChangeListModel::CAircraftSituationChangeListModel(QObject *parent) : - CListModelTimestampWithOffsetObjects("ViewAircraftPartsList", parent) + CListModelTimestampWithOffsetObjects("ViewAircraftPartsList", parent) { this->addTimestampOffsetColumns(); diff --git a/src/blackgui/models/aircraftsituationchangelistmodel.h b/src/blackgui/models/aircraftsituationchangelistmodel.h index f22b42de3..c6cf8f416 100644 --- a/src/blackgui/models/aircraftsituationchangelistmodel.h +++ b/src/blackgui/models/aircraftsituationchangelistmodel.h @@ -25,7 +25,7 @@ namespace BlackGui namespace Models { //! Aircraft situation changes list model - class BLACKGUI_EXPORT CAircraftSituationChangeListModel : public CListModelTimestampWithOffsetObjects + class BLACKGUI_EXPORT CAircraftSituationChangeListModel : public CListModelTimestampWithOffsetObjects { Q_OBJECT diff --git a/src/blackgui/models/aircraftsituationlistmodel.cpp b/src/blackgui/models/aircraftsituationlistmodel.cpp index 55ed38c37..686167fa0 100644 --- a/src/blackgui/models/aircraftsituationlistmodel.cpp +++ b/src/blackgui/models/aircraftsituationlistmodel.cpp @@ -26,7 +26,7 @@ namespace BlackGui namespace Models { CAircraftSituationListModel::CAircraftSituationListModel(QObject *parent) : - CListModelTimestampWithOffsetObjects("ViewAircraftPartsList", parent) + CListModelTimestampWithOffsetObjects("ViewAircraftPartsList", parent) { this->addTimestampOffsetColumns(); diff --git a/src/blackgui/models/aircraftsituationlistmodel.h b/src/blackgui/models/aircraftsituationlistmodel.h index 92a8cfc58..9b5b02026 100644 --- a/src/blackgui/models/aircraftsituationlistmodel.h +++ b/src/blackgui/models/aircraftsituationlistmodel.h @@ -23,7 +23,7 @@ namespace BlackGui namespace Models { //! Client list model - class BLACKGUI_EXPORT CAircraftSituationListModel : public CListModelTimestampWithOffsetObjects + class BLACKGUI_EXPORT CAircraftSituationListModel : public CListModelTimestampWithOffsetObjects { Q_OBJECT diff --git a/src/blackgui/models/airlineicaolistmodel.h b/src/blackgui/models/airlineicaolistmodel.h index 5667a5e4d..33f2ce573 100644 --- a/src/blackgui/models/airlineicaolistmodel.h +++ b/src/blackgui/models/airlineicaolistmodel.h @@ -32,7 +32,7 @@ namespace BlackGui { //! Airport list model class BLACKGUI_EXPORT CAirlineIcaoCodeListModel : - public CListModelDbObjects + public CListModelDbObjects { Q_OBJECT diff --git a/src/blackgui/models/airportlistmodel.h b/src/blackgui/models/airportlistmodel.h index 0873659aa..5d5c9d6ab 100644 --- a/src/blackgui/models/airportlistmodel.h +++ b/src/blackgui/models/airportlistmodel.h @@ -25,7 +25,7 @@ namespace BlackGui { //! Airport list model class BLACKGUI_EXPORT CAirportListModel : - public CListModelBase + public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/applicationinfolistmodel.h b/src/blackgui/models/applicationinfolistmodel.h index 3584f2de9..cdec63483 100644 --- a/src/blackgui/models/applicationinfolistmodel.h +++ b/src/blackgui/models/applicationinfolistmodel.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Models { //! Application info list model - class BLACKGUI_EXPORT CApplicationInfoListModel : public CListModelBase + class BLACKGUI_EXPORT CApplicationInfoListModel : public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/atcstationlistmodel.h b/src/blackgui/models/atcstationlistmodel.h index 3d4cb105f..995ad5c9b 100644 --- a/src/blackgui/models/atcstationlistmodel.h +++ b/src/blackgui/models/atcstationlistmodel.h @@ -26,7 +26,7 @@ namespace BlackGui class CAtcStationTreeModel; //! ATC list model - class BLACKGUI_EXPORT CAtcStationListModel : public CListModelCallsignObjects + class BLACKGUI_EXPORT CAtcStationListModel : public CListModelCallsignObjects { Q_OBJECT diff --git a/src/blackgui/models/clientlistmodel.cpp b/src/blackgui/models/clientlistmodel.cpp index c1c7e7f02..8fec74d31 100644 --- a/src/blackgui/models/clientlistmodel.cpp +++ b/src/blackgui/models/clientlistmodel.cpp @@ -28,7 +28,7 @@ namespace BlackGui namespace Models { CClientListModel::CClientListModel(QObject *parent) : - CListModelBase("ViewClientList", parent) + CListModelBase("ViewClientList", parent) { m_columns.addColumn(CColumn("client", CClient::IndexIcon)); m_columns.addColumn(CColumn::standardValueObject("callsign", CClient::IndexCallsign)); diff --git a/src/blackgui/models/clientlistmodel.h b/src/blackgui/models/clientlistmodel.h index 81b215c9b..ab512e393 100644 --- a/src/blackgui/models/clientlistmodel.h +++ b/src/blackgui/models/clientlistmodel.h @@ -26,7 +26,7 @@ namespace BlackGui namespace Models { //! Client list model - class BLACKGUI_EXPORT CClientListModel : public CListModelBase + class BLACKGUI_EXPORT CClientListModel : public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/cloudlayerlistmodel.h b/src/blackgui/models/cloudlayerlistmodel.h index b8129c4da..0bfd46f3b 100644 --- a/src/blackgui/models/cloudlayerlistmodel.h +++ b/src/blackgui/models/cloudlayerlistmodel.h @@ -25,7 +25,7 @@ namespace BlackGui { //! Cloud layer list model class BLACKGUI_EXPORT CCloudLayerListModel : - public CListModelBase + public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/countrylistmodel.h b/src/blackgui/models/countrylistmodel.h index e5eb181f0..4e6355eee 100644 --- a/src/blackgui/models/countrylistmodel.h +++ b/src/blackgui/models/countrylistmodel.h @@ -30,7 +30,7 @@ namespace BlackGui { //! Country list model class BLACKGUI_EXPORT CCountryListModel : - public CListModelDbObjects + public CListModelDbObjects { Q_OBJECT diff --git a/src/blackgui/models/distributorlistmodel.h b/src/blackgui/models/distributorlistmodel.h index 3135fc66e..65b49b544 100644 --- a/src/blackgui/models/distributorlistmodel.h +++ b/src/blackgui/models/distributorlistmodel.h @@ -28,7 +28,7 @@ namespace BlackGui { //! Distributor list model class BLACKGUI_EXPORT CDistributorListModel : - public COrderableListModelDbObjects + public COrderableListModelDbObjects { Q_OBJECT diff --git a/src/blackgui/models/identifierlistmodel.h b/src/blackgui/models/identifierlistmodel.h index 2ff5578ab..93ae9af23 100644 --- a/src/blackgui/models/identifierlistmodel.h +++ b/src/blackgui/models/identifierlistmodel.h @@ -22,7 +22,7 @@ namespace BlackGui namespace Models { //! Originator list model - class BLACKGUI_EXPORT CIdentifierListModel : public CListModelBase + class BLACKGUI_EXPORT CIdentifierListModel : public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/interpolationsetupmodel.h b/src/blackgui/models/interpolationsetupmodel.h index 526fcfd0a..045eb0352 100644 --- a/src/blackgui/models/interpolationsetupmodel.h +++ b/src/blackgui/models/interpolationsetupmodel.h @@ -23,7 +23,7 @@ namespace BlackGui { //! Country list model class BLACKGUI_EXPORT CInterpolationSetupListModel : - public CListModelCallsignObjects + public CListModelCallsignObjects { Q_OBJECT diff --git a/src/blackgui/models/listmodelbase.cpp b/src/blackgui/models/listmodelbase.cpp index 54040c070..d5be7c510 100644 --- a/src/blackgui/models/listmodelbase.cpp +++ b/src/blackgui/models/listmodelbase.cpp @@ -28,20 +28,20 @@ namespace BlackGui { namespace Models { - template - CListModelBase::CListModelBase(const QString &translationContext, QObject *parent) + template + CListModelBase::CListModelBase(const QString &translationContext, QObject *parent) : CListModelBaseNonTemplate(translationContext, parent) { } - template - int CListModelBase::rowCount(const QModelIndex &parentIndex) const + template + int CListModelBase::rowCount(const QModelIndex &parentIndex) const { Q_UNUSED(parentIndex); return this->containerOrFilteredContainer().size(); } - template - bool CListModelBase::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const + template + bool CListModelBase::canDropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent) const { Q_UNUSED(action); Q_UNUSED(row); @@ -52,8 +52,8 @@ namespace BlackGui return true; } - template - bool CListModelBase::dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent) + template + bool CListModelBase::dropMimeData(const QMimeData *mimeData, Qt::DropAction action, int row, int column, const QModelIndex &parent) { Q_UNUSED(row); Q_UNUSED(column); @@ -73,16 +73,16 @@ namespace BlackGui return true; } - template - bool CListModelBase::isValidIndex(const QModelIndex &index) const + template + bool CListModelBase::isValidIndex(const QModelIndex &index) const { if (!index.isValid()) { return false; } return (index.row() >= 0 && index.row() < this->rowCount(index) && index.column() >= 0 && index.column() < this->columnCount(index)); } - template - QVariant CListModelBase::data(const QModelIndex &index, int role) const + template + QVariant CListModelBase::data(const QModelIndex &index, int role) const { // check / init if (!this->isValidIndex(index)) { return QVariant(); } @@ -113,8 +113,8 @@ namespace BlackGui return formatter->data(role, obj.propertyByIndex(propertyIndex)).getQVariant(); } - template - bool CListModelBase::setData(const QModelIndex &index, const QVariant &value, int role) + template + bool CListModelBase::setData(const QModelIndex &index, const QVariant &value, int role) { Qt::ItemDataRole dataRole = static_cast(role); if (!(dataRole == Qt::UserRole || dataRole == Qt::EditRole)) { return false; } @@ -145,8 +145,8 @@ namespace BlackGui return false; } - template - bool CListModelBase::setInContainer(const QModelIndex &index, const ObjectType &obj) + template + bool CListModelBase::setInContainer(const QModelIndex &index, const ObjectType &obj) { if (!index.isValid()) { return false; } int row = index.row(); @@ -155,8 +155,8 @@ namespace BlackGui return true; } - template - int CListModelBase::update(const ContainerType &container, bool sort) + template + int CListModelBase::update(const ContainerType &container, bool sort) { if (m_modelDestroyed) { return 0; } @@ -192,8 +192,8 @@ namespace BlackGui return newSize; } - template - void CListModelBase::update(const QModelIndex &index, const ObjectType &object) + template + void CListModelBase::update(const QModelIndex &index, const ObjectType &object) { if (m_modelDestroyed) { return; } if (index.row() >= m_container.size()) { return; } @@ -204,14 +204,14 @@ namespace BlackGui emit this->dataChanged(i1, i2); // which range has been changed } - template - void CListModelBase::update(int rowIndex, const ObjectType &object) + template + void CListModelBase::update(int rowIndex, const ObjectType &object) { this->update(this->index(rowIndex, 0), object); } - template - CWorker *CListModelBase::updateAsync(const ContainerType &container, bool sort) + template + CWorker *CListModelBase::updateAsync(const ContainerType &container, bool sort) { Q_UNUSED(sort); if (m_modelDestroyed) { return nullptr; } @@ -230,8 +230,8 @@ namespace BlackGui return worker; } - template - void CListModelBase::updateContainerMaybeAsync(const ContainerType &container, bool sort) + template + void CListModelBase::updateContainerMaybeAsync(const ContainerType &container, bool sort) { if (m_modelDestroyed) { return; } if (container.size() > asyncThreshold && sort) @@ -245,15 +245,15 @@ namespace BlackGui } } - template - bool CListModelBase::hasFilter() const + template + bool CListModelBase::hasFilter() const { const bool f = m_filter && m_filter->isValid(); return f; } - template - void CListModelBase::removeFilter() + template + void CListModelBase::removeFilter() { if (!this->hasFilter()) { return; } m_filter.reset(nullptr); @@ -263,8 +263,8 @@ namespace BlackGui this->emitModelDataChanged(); } - template - void CListModelBase::takeFilterOwnership(std::unique_ptr > &filter) + template + void CListModelBase::takeFilterOwnership(std::unique_ptr > &filter) { if (!filter) { @@ -286,8 +286,8 @@ namespace BlackGui } } - template - const ObjectType &CListModelBase::at(const QModelIndex &index) const + template + const typename CListModelBase::ObjectType &CListModelBase::at(const QModelIndex &index) const { if (index.row() < 0 || index.row() >= this->rowCount()) { @@ -300,20 +300,20 @@ namespace BlackGui } } - template - const ContainerType &CListModelBase::container() const + template + const typename CListModelBase::ContainerType &CListModelBase::container() const { return m_container; } - template - const ContainerType &CListModelBase::containerFiltered() const + template + const typename CListModelBase::ContainerType &CListModelBase::containerFiltered() const { return m_containerFiltered; } - template - const ContainerType &CListModelBase::containerOrFilteredContainer(bool *filtered) const + template + const typename CListModelBase::ContainerType &CListModelBase::containerOrFilteredContainer(bool *filtered) const { if (this->hasFilter()) { @@ -327,8 +327,8 @@ namespace BlackGui } } - template - void CListModelBase::push_back(const ObjectType &object) + template + void CListModelBase::push_back(const ObjectType &object) { beginInsertRows(QModelIndex(), m_container.size(), m_container.size()); m_container.push_back(object); @@ -344,8 +344,8 @@ namespace BlackGui this->emitModelDataChanged(); } - template - void CListModelBase::push_back(const ContainerType &container) + template + void CListModelBase::push_back(const ContainerType &container) { beginInsertRows(QModelIndex(), m_container.size(), m_container.size()); m_container.push_back(container); @@ -361,8 +361,8 @@ namespace BlackGui this->emitModelDataChanged(); } - template - void CListModelBase::insert(const ObjectType &object) + template + void CListModelBase::insert(const ObjectType &object) { beginInsertRows(QModelIndex(), 0, 0); m_container.insert(m_container.begin(), object); @@ -378,8 +378,8 @@ namespace BlackGui this->emitModelDataChanged(); } - template - void CListModelBase::insert(const ContainerType &container) + template + void CListModelBase::insert(const ContainerType &container) { if (container.isEmpty()) { return; } beginInsertRows(QModelIndex(), 0, 0); @@ -396,8 +396,8 @@ namespace BlackGui this->emitModelDataChanged(); } - template - void CListModelBase::remove(const ObjectType &object) + template + void CListModelBase::remove(const ObjectType &object) { int oldSize = m_container.size(); beginRemoveRows(QModelIndex(), 0, 0); @@ -416,8 +416,8 @@ namespace BlackGui } } - template - void CListModelBase::clear() + template + void CListModelBase::clear() { beginResetModel(); m_container.clear(); @@ -426,14 +426,14 @@ namespace BlackGui this->emitModelDataChanged(); } - template - bool CListModelBase::isEmpty() const + template + bool CListModelBase::isEmpty() const { return m_container.isEmpty(); } - template - void CListModelBase::updateFilteredContainer() + template + void CListModelBase::updateFilteredContainer() { if (this->hasFilter()) { @@ -445,16 +445,16 @@ namespace BlackGui } } - template - void CListModelBase::emitModelDataChanged() + template + void CListModelBase::emitModelDataChanged() { const int n = this->containerOrFilteredContainer().size(); emit this->modelDataChanged(n, this->hasFilter()); emit this->changed(); } - template - void CListModelBase::onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles) + template + void CListModelBase::onDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector &roles) { // underlying base class changed Q_UNUSED(topLeft); @@ -463,30 +463,30 @@ namespace BlackGui this->emitModelDataChanged(); } - template - void CListModelBase::onChangedDigest() + template + void CListModelBase::onChangedDigest() { const int n = this->containerOrFilteredContainer().size(); emit this->changedDigest(); emit this->modelDataChangedDigest(n, this->hasFilter()); } - template - void CListModelBase::moveItems(const ContainerType &items, int position) + template + void CListModelBase::moveItems(const ContainerType &items, int position) { // overridden in specialized class Q_UNUSED(items); Q_UNUSED(position); } - template - void CListModelBase::sort() + template + void CListModelBase::sort() { this->sort(this->getSortColumn(), this->getSortOrder()); } - template - void CListModelBase::sort(int column, Qt::SortOrder order) + template + void CListModelBase::sort(int column, Qt::SortOrder order) { if (column == m_sortColumn && order == m_sortOrder) { return; } @@ -502,8 +502,8 @@ namespace BlackGui this->updateContainerMaybeAsync(m_container, true); } - template - void CListModelBase::truncate(int maxNumber, bool forceSort) + template + void CListModelBase::truncate(int maxNumber, bool forceSort) { if (this->rowCount() <= maxNumber) { return; } if (forceSort) @@ -515,8 +515,8 @@ namespace BlackGui this->updateContainerMaybeAsync(container, false); } - template - ContainerType CListModelBase::sortContainerByColumn(const ContainerType &container, int column, Qt::SortOrder order) const + template + typename CListModelBase::ContainerType CListModelBase::sortContainerByColumn(const ContainerType &container, int column, Qt::SortOrder order) const { if (m_modelDestroyed) { return container; } if (container.size() < 2 || !m_columns.isSortable(column)) @@ -542,8 +542,8 @@ namespace BlackGui return container.sorted(p); } - template - QMimeData *CListModelBase::mimeData(const QModelIndexList &indexes) const + template + QMimeData *CListModelBase::mimeData(const QModelIndexList &indexes) const { QMimeData *mimeData = new QMimeData(); if (indexes.isEmpty()) { return mimeData; } @@ -569,8 +569,8 @@ namespace BlackGui return mimeData; } - template - QJsonObject CListModelBase::toJson(bool selectedOnly) const + template + QJsonObject CListModelBase::toJson(bool selectedOnly) const { const CVariant variant = CVariant::fromValue( selectedOnly && m_selectionModel ? @@ -579,8 +579,8 @@ namespace BlackGui return variant.toJson(); } - template - QString CListModelBase::toJsonString(QJsonDocument::JsonFormat format, bool selectedOnly) const + template + QString CListModelBase::toJsonString(QJsonDocument::JsonFormat format, bool selectedOnly) const { const CVariant variant = CVariant::fromValue( selectedOnly && m_selectionModel ? @@ -589,8 +589,8 @@ namespace BlackGui return variant.toJsonString(format); } - template - bool CListModelBase::isOrderable() const + template + bool CListModelBase::isOrderable() const { return false; } diff --git a/src/blackgui/models/listmodelbase.h b/src/blackgui/models/listmodelbase.h index 233d3a982..09873f009 100644 --- a/src/blackgui/models/listmodelbase.h +++ b/src/blackgui/models/listmodelbase.h @@ -39,9 +39,16 @@ namespace BlackGui namespace Models { //! List model - template class CListModelBase : public CListModelBaseNonTemplate + template + class CListModelBase : public CListModelBaseNonTemplate { public: + //! Container type + using ContainerType = T; + + //! Container element type + using ObjectType = typename T::value_type; + //! Destructor virtual ~CListModelBase() {} diff --git a/src/blackgui/models/listmodelbaseaviation.cpp b/src/blackgui/models/listmodelbaseaviation.cpp index 4a0016fa6..00e4a4870 100644 --- a/src/blackgui/models/listmodelbaseaviation.cpp +++ b/src/blackgui/models/listmodelbaseaviation.cpp @@ -15,13 +15,13 @@ namespace BlackGui { // see here for the reason of thess forward instantiations // https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; } // namespace } // namespace diff --git a/src/blackgui/models/listmodelbasemisc.cpp b/src/blackgui/models/listmodelbasemisc.cpp index 50089ffed..018128225 100644 --- a/src/blackgui/models/listmodelbasemisc.cpp +++ b/src/blackgui/models/listmodelbasemisc.cpp @@ -15,11 +15,11 @@ namespace BlackGui { // see here for the reason of thess forward instantiations // https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; } // namespace } // namespace diff --git a/src/blackgui/models/listmodelbasenetwork.cpp b/src/blackgui/models/listmodelbasenetwork.cpp index 34ec3ceb8..483d1dc7f 100644 --- a/src/blackgui/models/listmodelbasenetwork.cpp +++ b/src/blackgui/models/listmodelbasenetwork.cpp @@ -15,10 +15,10 @@ namespace BlackGui { // see here for the reason of thess forward instantiations // https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; } // namespace } // namespace diff --git a/src/blackgui/models/listmodelbasesimulation.cpp b/src/blackgui/models/listmodelbasesimulation.cpp index c25c8ec1f..f7bedd01d 100644 --- a/src/blackgui/models/listmodelbasesimulation.cpp +++ b/src/blackgui/models/listmodelbasesimulation.cpp @@ -15,11 +15,11 @@ namespace BlackGui { // see here for the reason of thess forward instantiations // https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; } // namespace } // namespace diff --git a/src/blackgui/models/listmodelbaseweather.cpp b/src/blackgui/models/listmodelbaseweather.cpp index c2e7ec49f..9d5084f42 100644 --- a/src/blackgui/models/listmodelbaseweather.cpp +++ b/src/blackgui/models/listmodelbaseweather.cpp @@ -16,9 +16,9 @@ namespace BlackGui { // see here for the reason of thess forward instantiations // https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl - template class CListModelBase; - template class CListModelBase; - template class CListModelBase; + template class CListModelBase; + template class CListModelBase; + template class CListModelBase; } // namespace } // namespace diff --git a/src/blackgui/models/listmodelcallsignobjects.cpp b/src/blackgui/models/listmodelcallsignobjects.cpp index c445e2d90..011ffaa35 100644 --- a/src/blackgui/models/listmodelcallsignobjects.cpp +++ b/src/blackgui/models/listmodelcallsignobjects.cpp @@ -22,28 +22,28 @@ namespace BlackGui { namespace Models { - template - CListModelCallsignObjects::CListModelCallsignObjects(const QString &translationContext, QObject *parent) : - CListModelBase(translationContext, parent) + template + CListModelCallsignObjects::CListModelCallsignObjects(const QString &translationContext, QObject *parent) : + CListModelBase(translationContext, parent) { } - template - QVariant CListModelCallsignObjects::data(const QModelIndex &index, int role) const + template + QVariant CListModelCallsignObjects::data(const QModelIndex &index, int role) const { - if (role != Qt::BackgroundRole) { return CListModelBase::data(index, role); } + if (role != Qt::BackgroundRole) { return CListModelBase::data(index, role); } if (isHighlightedIndex(index)) { return QBrush(m_highlightColor); } - return CListModelBase::data(index, role); + return CListModelBase::data(index, role); } - template - BlackMisc::Aviation::CCallsign CListModelCallsignObjects::callsignForIndex(const QModelIndex &index) const + template + BlackMisc::Aviation::CCallsign CListModelCallsignObjects::callsignForIndex(const QModelIndex &index) const { if (!index.isValid()) { return CCallsign(); } return this->at(index).getCallsign(); } - template - bool CListModelCallsignObjects::isHighlightedIndex(const QModelIndex &index) const + template + bool CListModelCallsignObjects::isHighlightedIndex(const QModelIndex &index) const { if (!index.isValid()) { return false; } if (m_highlightCallsigns.isEmpty()) { return false; } @@ -52,8 +52,8 @@ namespace BlackGui // see here for the reason of thess forward instantiations // https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl - template class CListModelCallsignObjects; - template class CListModelCallsignObjects; - template class CListModelCallsignObjects; + template class CListModelCallsignObjects; + template class CListModelCallsignObjects; + template class CListModelCallsignObjects; } // namespace } // namespace diff --git a/src/blackgui/models/listmodelcallsignobjects.h b/src/blackgui/models/listmodelcallsignobjects.h index b5286b6b3..f56cf3a44 100644 --- a/src/blackgui/models/listmodelcallsignobjects.h +++ b/src/blackgui/models/listmodelcallsignobjects.h @@ -29,10 +29,16 @@ namespace BlackGui namespace Models { //! List model for callsign based objects (callsign is unique key) - template class CListModelCallsignObjects : - public CListModelBase + template class CListModelCallsignObjects : + public CListModelBase { public: + //! Container type + using ContainerType = T; + + //! Container element type + using ObjectType = typename T::value_type; + //! Destructor virtual ~CListModelCallsignObjects() {} @@ -46,7 +52,7 @@ namespace BlackGui virtual void clearHighlighting() override { this->clearHighlightedCallsigns(); - CListModelBase::clearHighlighting(); + CListModelBase::clearHighlighting(); } //! Set color for highlighting diff --git a/src/blackgui/models/listmodeldbobjects.cpp b/src/blackgui/models/listmodeldbobjects.cpp index 3a0abf3fc..6cc5618dd 100644 --- a/src/blackgui/models/listmodeldbobjects.cpp +++ b/src/blackgui/models/listmodeldbobjects.cpp @@ -36,45 +36,45 @@ namespace BlackGui { namespace Models { - template - CListModelDbObjects::CListModelDbObjects(const QString &translationContext, QObject *parent) : - CListModelBase(translationContext, parent) + template + CListModelDbObjects::CListModelDbObjects(const QString &translationContext, QObject *parent) : + CListModelBase(translationContext, parent) { constexpr bool hasIntegerKey = std::is_base_of::value && std::is_same::value; constexpr bool hasStringKey = std::is_base_of::value && std::is_base_of::value; static_assert(hasIntegerKey || hasStringKey, "ObjectType needs to implement IDatastoreObjectWithXXXXKey and have appropriate KeyType"); } - template - QVariant CListModelDbObjects::data(const QModelIndex &index, int role) const + template + QVariant CListModelDbObjects::data(const QModelIndex &index, int role) const { - if (role != Qt::BackgroundRole) { return CListModelBase::data(index, role); } + if (role != Qt::BackgroundRole) { return CListModelBase::data(index, role); } if (isHighlightedIndex(index) ) { return QBrush(m_highlightColor); } - return CListModelBase::data(index, role); + return CListModelBase::data(index, role); } - template - KeyType CListModelDbObjects::dbKeyForIndex(const QModelIndex &index) const + template + K CListModelDbObjects::dbKeyForIndex(const QModelIndex &index) const { if (!index.isValid()) { return ObjectType::invalidDbKey(); } return this->at(index).getDbKey(); } - template - bool CListModelDbObjects::isHighlightedIndex(const QModelIndex &index) const + template + bool CListModelDbObjects::isHighlightedIndex(const QModelIndex &index) const { if (!index.isValid()) { return false; } if (m_highlightKeys.isEmpty()) { return false; } return m_highlightKeys.contains(dbKeyForIndex(index)); } - template - COrderableListModelDbObjects::COrderableListModelDbObjects(const QString &translationContext, QObject *parent) - : CListModelDbObjects(translationContext, parent) + template + COrderableListModelDbObjects::COrderableListModelDbObjects(const QString &translationContext, QObject *parent) + : CListModelDbObjects(translationContext, parent) { } - template - void COrderableListModelDbObjects::moveItems(const ContainerType &items, int position) + template + void COrderableListModelDbObjects::moveItems(const ContainerType &items, int position) { if (items.isEmpty()) { return; } ContainerType container(this->container()); @@ -90,33 +90,33 @@ namespace BlackGui this->updateContainerMaybeAsync(container); } - template - bool COrderableListModelDbObjects::setSortColumnToOrder() + template + bool COrderableListModelDbObjects::setSortColumnToOrder() { // force sorted by order, otherwise display looks confusing return this->setSorting(IOrderable::IndexOrder); } - template - int COrderableListModelDbObjects::update(const ContainerType &container, bool sort) + template + int COrderableListModelDbObjects::update(const ContainerType &container, bool sort) { if (container.needsOrder()) { ContainerType orderable(container); orderable.resetOrder(); - return CListModelDbObjects::update(orderable, sort); + return CListModelDbObjects::update(orderable, sort); } - return CListModelDbObjects::update(container, sort); + return CListModelDbObjects::update(container, sort); } - template class CListModelDbObjects; - template class CListModelDbObjects; - template class CListModelDbObjects; - template class CListModelDbObjects; - template class CListModelDbObjects; - template class CListModelDbObjects; - template class COrderableListModelDbObjects; - template class COrderableListModelDbObjects; + template class CListModelDbObjects; + template class CListModelDbObjects; + template class CListModelDbObjects; + template class CListModelDbObjects; + template class CListModelDbObjects; + template class CListModelDbObjects; + template class COrderableListModelDbObjects; + template class COrderableListModelDbObjects; } // namespace } // namespace diff --git a/src/blackgui/models/listmodeldbobjects.h b/src/blackgui/models/listmodeldbobjects.h index 8357a16d2..1cc8797f7 100644 --- a/src/blackgui/models/listmodeldbobjects.h +++ b/src/blackgui/models/listmodeldbobjects.h @@ -28,10 +28,19 @@ namespace BlackGui namespace Models { //! List model for DB objects - template class CListModelDbObjects : - public CListModelBase + template class CListModelDbObjects : + public CListModelBase { public: + //! Container type + using ContainerType = T; + + //! Container element type + using ObjectType = typename T::value_type; + + //! DB key type + using KeyType = K; + //! Destructor virtual ~CListModelDbObjects() {} @@ -45,7 +54,7 @@ namespace BlackGui virtual void clearHighlighting() override { this->clearHighlightedDbKeys(); - CListModelBase::clearHighlighting(); + CListModelBase::clearHighlighting(); } //! \copydoc BlackGui::Models::CListModelBaseNonTemplate::hasHighlightedRows @@ -76,10 +85,19 @@ namespace BlackGui }; //! List model for DB objects - template class COrderableListModelDbObjects : - public CListModelDbObjects + template class COrderableListModelDbObjects : + public CListModelDbObjects { public: + //! Container type + using ContainerType = T; + + //! Container element type + using ObjectType = typename T::value_type; + + //! DB key type + using KeyType = K; + //! Destructor virtual ~COrderableListModelDbObjects() {} diff --git a/src/blackgui/models/listmodeltimestampobjects.cpp b/src/blackgui/models/listmodeltimestampobjects.cpp index e2e935921..a199e795f 100644 --- a/src/blackgui/models/listmodeltimestampobjects.cpp +++ b/src/blackgui/models/listmodeltimestampobjects.cpp @@ -20,46 +20,46 @@ namespace BlackGui { namespace Models { - template - CListModelTimestampObjects::CListModelTimestampObjects(const QString &translationContext, QObject *parent) : - CListModelBase(translationContext, parent) + template + CListModelTimestampObjects::CListModelTimestampObjects(const QString &translationContext, QObject *parent) : + CListModelBase(translationContext, parent) { } - template - void CListModelTimestampObjects::addTimestampColumns() + template + void CListModelTimestampObjects::addTimestampColumns() { CListModelBaseNonTemplate::m_columns.addColumn(CColumn::standardString("timestamp", ObjectType::IndexUtcTimestampFormattedMdhmsz)); CListModelBaseNonTemplate::m_columns.addColumn(CColumn("timestamp ms", "milliseconds since epoch", ObjectType::IndexMSecsSinceEpoch, new CIntegerFormatter())); } - template class CListModelTimestampObjects; - template class CListModelTimestampObjects; - template class CListModelTimestampObjects; - template class CListModelTimestampObjects; + template class CListModelTimestampObjects; + template class CListModelTimestampObjects; + template class CListModelTimestampObjects; + template class CListModelTimestampObjects; - template - CListModelTimestampWithOffsetObjects::CListModelTimestampWithOffsetObjects(const QString &translationContext, QObject *parent) : - CListModelTimestampObjects(translationContext, parent) + template + CListModelTimestampWithOffsetObjects::CListModelTimestampWithOffsetObjects(const QString &translationContext, QObject *parent) : + CListModelTimestampObjects(translationContext, parent) { } - template - void CListModelTimestampWithOffsetObjects::push_frontKeepLatestAdjustedFirst(const ObjectType &object, int max) + template + void CListModelTimestampWithOffsetObjects::push_frontKeepLatestAdjustedFirst(const ObjectType &object, int max) { this->beginInsertRows(QModelIndex(), 0, 0); - CListModelBase::m_container.push_frontKeepLatestAdjustedFirst(object, max); + CListModelBase::m_container.push_frontKeepLatestAdjustedFirst(object, max); this->endInsertRows(); } - template - void CListModelTimestampWithOffsetObjects::addTimestampOffsetColumns() + template + void CListModelTimestampWithOffsetObjects::addTimestampOffsetColumns() { - CListModelTimestampObjects::addTimestampColumns(); + CListModelTimestampObjects::addTimestampColumns(); CListModelBaseNonTemplate::m_columns.addColumn(CColumn("ms adj.", "milliseconds adjusted", ObjectType::IndexAdjustedMsWithOffset, new CIntegerFormatter())); CListModelBaseNonTemplate::m_columns.addColumn(CColumn("t.os.", "time offset", ObjectType::IndexOffsetMs, new CIntegerFormatter())); } - template class CListModelTimestampWithOffsetObjects; - template class CListModelTimestampWithOffsetObjects; - template class CListModelTimestampWithOffsetObjects; + template class CListModelTimestampWithOffsetObjects; + template class CListModelTimestampWithOffsetObjects; + template class CListModelTimestampWithOffsetObjects; } // namespace } // namespace diff --git a/src/blackgui/models/listmodeltimestampobjects.h b/src/blackgui/models/listmodeltimestampobjects.h index b7d93a71d..baaa14954 100644 --- a/src/blackgui/models/listmodeltimestampobjects.h +++ b/src/blackgui/models/listmodeltimestampobjects.h @@ -26,9 +26,16 @@ namespace BlackGui namespace Models { //! List model for timestamp based objects with offset - template class CListModelTimestampObjects : - public CListModelBase + template class CListModelTimestampObjects : + public CListModelBase { + public: + //! Container type + using ContainerType = T; + + //! Container element type + using ObjectType = typename T::value_type; + protected: //! Constructor CListModelTimestampObjects(const QString &translationContext, QObject *parent = nullptr); @@ -38,10 +45,16 @@ namespace BlackGui }; //! List model for timestamp based objects with offset - template class CListModelTimestampWithOffsetObjects : - public CListModelTimestampObjects + template class CListModelTimestampWithOffsetObjects : + public CListModelTimestampObjects { public: + //! Container type + using ContainerType = T; + + //! Container element type + using ObjectType = typename T::value_type; + //! Destructor virtual ~CListModelTimestampWithOffsetObjects() {} diff --git a/src/blackgui/models/liverylistmodel.h b/src/blackgui/models/liverylistmodel.h index 9b6a70e79..c4868de27 100644 --- a/src/blackgui/models/liverylistmodel.h +++ b/src/blackgui/models/liverylistmodel.h @@ -32,7 +32,7 @@ namespace BlackGui { //! Distributor list model class BLACKGUI_EXPORT CLiveryListModel : - public CListModelDbObjects + public CListModelDbObjects { Q_OBJECT diff --git a/src/blackgui/models/matchingstatisticsmodel.h b/src/blackgui/models/matchingstatisticsmodel.h index ad60cae60..c4c5ed74b 100644 --- a/src/blackgui/models/matchingstatisticsmodel.h +++ b/src/blackgui/models/matchingstatisticsmodel.h @@ -23,7 +23,7 @@ namespace BlackGui namespace Models { //! Matching statistics entry - class BLACKGUI_EXPORT CMatchingStatisticsModel : public CListModelBase + class BLACKGUI_EXPORT CMatchingStatisticsModel : public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/namevariantpairlistmodel.h b/src/blackgui/models/namevariantpairlistmodel.h index c30fd7443..de1e0b7b7 100644 --- a/src/blackgui/models/namevariantpairlistmodel.h +++ b/src/blackgui/models/namevariantpairlistmodel.h @@ -33,7 +33,7 @@ namespace BlackGui { //! Simple model displaying name / variant values - class BLACKGUI_EXPORT CNameVariantPairModel : public CListModelBase + class BLACKGUI_EXPORT CNameVariantPairModel : public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/serverlistmodel.h b/src/blackgui/models/serverlistmodel.h index 5e47013ac..cf5b6c823 100644 --- a/src/blackgui/models/serverlistmodel.h +++ b/src/blackgui/models/serverlistmodel.h @@ -23,7 +23,7 @@ namespace BlackGui namespace Models { //! Server list model - class BLACKGUI_EXPORT CServerListModel : public CListModelBase + class BLACKGUI_EXPORT CServerListModel : public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/simulatedaircraftlistmodel.h b/src/blackgui/models/simulatedaircraftlistmodel.h index d70190c30..3eed43861 100644 --- a/src/blackgui/models/simulatedaircraftlistmodel.h +++ b/src/blackgui/models/simulatedaircraftlistmodel.h @@ -25,7 +25,7 @@ namespace BlackGui { //! Aircraft list model class BLACKGUI_EXPORT CSimulatedAircraftListModel : - public CListModelCallsignObjects + public CListModelCallsignObjects { Q_OBJECT diff --git a/src/blackgui/models/statusmessagelistmodel.cpp b/src/blackgui/models/statusmessagelistmodel.cpp index 1b9343ce3..9f0785f27 100644 --- a/src/blackgui/models/statusmessagelistmodel.cpp +++ b/src/blackgui/models/statusmessagelistmodel.cpp @@ -23,7 +23,7 @@ namespace BlackGui namespace Models { CStatusMessageListModel::CStatusMessageListModel(QObject *parent) : - CListModelTimestampObjects("ViewStatusMessageList", parent) + CListModelTimestampObjects("ViewStatusMessageList", parent) { this->setMode(Detailed); diff --git a/src/blackgui/models/statusmessagelistmodel.h b/src/blackgui/models/statusmessagelistmodel.h index 0a26efca6..09a6f95f3 100644 --- a/src/blackgui/models/statusmessagelistmodel.h +++ b/src/blackgui/models/statusmessagelistmodel.h @@ -26,7 +26,7 @@ namespace BlackGui * Status message list model */ class BLACKGUI_EXPORT CStatusMessageListModel : - public CListModelTimestampObjects + public CListModelTimestampObjects { Q_OBJECT diff --git a/src/blackgui/models/temperaturelayerlistmodel.h b/src/blackgui/models/temperaturelayerlistmodel.h index ea30ae4ff..abd5c427a 100644 --- a/src/blackgui/models/temperaturelayerlistmodel.h +++ b/src/blackgui/models/temperaturelayerlistmodel.h @@ -25,7 +25,7 @@ namespace BlackGui { //! Temperature layer list model class BLACKGUI_EXPORT CTemperatureLayerListModel : - public CListModelBase + public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/textmessagelistmodel.h b/src/blackgui/models/textmessagelistmodel.h index 4382f9dbf..36548ef10 100644 --- a/src/blackgui/models/textmessagelistmodel.h +++ b/src/blackgui/models/textmessagelistmodel.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Models { //! Text message list model - class BLACKGUI_EXPORT CTextMessageListModel : public CListModelBase + class BLACKGUI_EXPORT CTextMessageListModel : public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/userlistmodel.h b/src/blackgui/models/userlistmodel.h index 9b94b80d5..d210d58ba 100644 --- a/src/blackgui/models/userlistmodel.h +++ b/src/blackgui/models/userlistmodel.h @@ -24,7 +24,7 @@ namespace BlackGui * User list model */ class BLACKGUI_EXPORT CUserListModel : - public CListModelBase + public CListModelBase { Q_OBJECT diff --git a/src/blackgui/models/windlayerlistmodel.h b/src/blackgui/models/windlayerlistmodel.h index c18ba0245..be2f52614 100644 --- a/src/blackgui/models/windlayerlistmodel.h +++ b/src/blackgui/models/windlayerlistmodel.h @@ -25,7 +25,7 @@ namespace BlackGui { //! Wind layer list model class BLACKGUI_EXPORT CWindLayerListModel : - public CListModelBase + public CListModelBase { Q_OBJECT diff --git a/src/blackgui/views/aircrafticaoview.h b/src/blackgui/views/aircrafticaoview.h index 10ca9b2be..5cf4bc6a8 100644 --- a/src/blackgui/views/aircrafticaoview.h +++ b/src/blackgui/views/aircrafticaoview.h @@ -33,7 +33,7 @@ namespace BlackGui { //! Aircraft ICAO codes view class BLACKGUI_EXPORT CAircraftIcaoCodeView : - public CViewWithDbObjects + public CViewWithDbObjects { Q_OBJECT diff --git a/src/blackgui/views/aircraftmodelview.h b/src/blackgui/views/aircraftmodelview.h index 09a5c2d51..6fe7d0056 100644 --- a/src/blackgui/views/aircraftmodelview.h +++ b/src/blackgui/views/aircraftmodelview.h @@ -50,7 +50,7 @@ namespace BlackGui //! Aircraft view class BLACKGUI_EXPORT CAircraftModelView : - public COrderableViewWithDbObjects + public COrderableViewWithDbObjects { Q_OBJECT diff --git a/src/blackgui/views/aircraftpartsview.h b/src/blackgui/views/aircraftpartsview.h index 6f5783ad2..fd80d13bf 100644 --- a/src/blackgui/views/aircraftpartsview.h +++ b/src/blackgui/views/aircraftpartsview.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Views { //! Aircraft parts - class BLACKGUI_EXPORT CAircraftPartsView : public CViewWithTimestampWithOffsetObjects + class BLACKGUI_EXPORT CAircraftPartsView : public CViewWithTimestampWithOffsetObjects { Q_OBJECT diff --git a/src/blackgui/views/aircraftsituationchangeview.h b/src/blackgui/views/aircraftsituationchangeview.h index 46515ad28..4991512ac 100644 --- a/src/blackgui/views/aircraftsituationchangeview.h +++ b/src/blackgui/views/aircraftsituationchangeview.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Views { //! Aircraft situation change view - class BLACKGUI_EXPORT CAircraftSituationChangeView : public CViewWithTimestampWithOffsetObjects + class BLACKGUI_EXPORT CAircraftSituationChangeView : public CViewWithTimestampWithOffsetObjects { Q_OBJECT diff --git a/src/blackgui/views/aircraftsituationview.h b/src/blackgui/views/aircraftsituationview.h index 85d8a2bdd..b8fcb0efe 100644 --- a/src/blackgui/views/aircraftsituationview.h +++ b/src/blackgui/views/aircraftsituationview.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Views { //! Aircraft situations view - class BLACKGUI_EXPORT CAircraftSituationView : public CViewWithTimestampWithOffsetObjects + class BLACKGUI_EXPORT CAircraftSituationView : public CViewWithTimestampWithOffsetObjects { Q_OBJECT diff --git a/src/blackgui/views/airlineicaoview.h b/src/blackgui/views/airlineicaoview.h index f1a1979e1..e6e522cca 100644 --- a/src/blackgui/views/airlineicaoview.h +++ b/src/blackgui/views/airlineicaoview.h @@ -33,7 +33,7 @@ namespace BlackGui { //! Aircraft ICAO codes view class BLACKGUI_EXPORT CAirlineIcaoCodeView : - public CViewWithDbObjects + public CViewWithDbObjects { Q_OBJECT diff --git a/src/blackgui/views/airportview.h b/src/blackgui/views/airportview.h index 990f24f94..bb3d73b1a 100644 --- a/src/blackgui/views/airportview.h +++ b/src/blackgui/views/airportview.h @@ -26,7 +26,7 @@ namespace BlackGui namespace Views { //! Airports view - class BLACKGUI_EXPORT CAirportView : public CViewBase + class BLACKGUI_EXPORT CAirportView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/applicationinfoview.h b/src/blackgui/views/applicationinfoview.h index 26b91e050..9e05ed6e6 100644 --- a/src/blackgui/views/applicationinfoview.h +++ b/src/blackgui/views/applicationinfoview.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Views { //! Network servers - class BLACKGUI_EXPORT CApplicationInfoView : public CViewBase + class BLACKGUI_EXPORT CApplicationInfoView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/atcstationview.h b/src/blackgui/views/atcstationview.h index 638e3aba1..37046b79e 100644 --- a/src/blackgui/views/atcstationview.h +++ b/src/blackgui/views/atcstationview.h @@ -32,7 +32,7 @@ namespace BlackGui namespace Views { //! ATC stations view - class BLACKGUI_EXPORT CAtcStationView : public CViewWithCallsignObjects + class BLACKGUI_EXPORT CAtcStationView : public CViewWithCallsignObjects { Q_OBJECT diff --git a/src/blackgui/views/clientview.h b/src/blackgui/views/clientview.h index 254a2c7a4..8027424ac 100644 --- a/src/blackgui/views/clientview.h +++ b/src/blackgui/views/clientview.h @@ -26,7 +26,7 @@ namespace BlackGui namespace Views { //! Client view - class BLACKGUI_EXPORT CClientView : public CViewBase + class BLACKGUI_EXPORT CClientView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/cloudlayerview.h b/src/blackgui/views/cloudlayerview.h index fdb236824..880206c24 100644 --- a/src/blackgui/views/cloudlayerview.h +++ b/src/blackgui/views/cloudlayerview.h @@ -25,7 +25,7 @@ namespace BlackGui namespace Views { //! Airports view - class BLACKGUI_EXPORT CCloudLayerView : public CViewBase + class BLACKGUI_EXPORT CCloudLayerView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/countryview.h b/src/blackgui/views/countryview.h index ce4a44ff2..d2c3a7059 100644 --- a/src/blackgui/views/countryview.h +++ b/src/blackgui/views/countryview.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Views { //! Countries - class BLACKGUI_EXPORT CCountryView : public CViewBase + class BLACKGUI_EXPORT CCountryView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/distributorview.h b/src/blackgui/views/distributorview.h index cb621c397..14f9bcc44 100644 --- a/src/blackgui/views/distributorview.h +++ b/src/blackgui/views/distributorview.h @@ -34,7 +34,7 @@ namespace BlackGui { //! Distributors class BLACKGUI_EXPORT CDistributorView : - public COrderableViewWithDbObjects + public COrderableViewWithDbObjects { Q_OBJECT diff --git a/src/blackgui/views/identifierview.h b/src/blackgui/views/identifierview.h index 71130f9e1..c3b35f0de 100644 --- a/src/blackgui/views/identifierview.h +++ b/src/blackgui/views/identifierview.h @@ -23,7 +23,7 @@ namespace BlackGui namespace Views { //! Originator servers - class BLACKGUI_EXPORT CIdentifierView : public CViewBase + class BLACKGUI_EXPORT CIdentifierView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/interpolationsetupview.h b/src/blackgui/views/interpolationsetupview.h index 3cd3bafb9..dc4e006cd 100644 --- a/src/blackgui/views/interpolationsetupview.h +++ b/src/blackgui/views/interpolationsetupview.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Views { //! Distributors - class BLACKGUI_EXPORT CInterpolationSetupView : public CViewWithCallsignObjects + class BLACKGUI_EXPORT CInterpolationSetupView : public CViewWithCallsignObjects { Q_OBJECT diff --git a/src/blackgui/views/liveryview.h b/src/blackgui/views/liveryview.h index cc9ea5e1a..19fe40bd3 100644 --- a/src/blackgui/views/liveryview.h +++ b/src/blackgui/views/liveryview.h @@ -33,7 +33,7 @@ namespace BlackGui { //! Distributors class BLACKGUI_EXPORT CLiveryView : - public CViewWithDbObjects + public CViewWithDbObjects { Q_OBJECT diff --git a/src/blackgui/views/matchingstatisticsview.h b/src/blackgui/views/matchingstatisticsview.h index b4a94a6a8..8ea0549c3 100644 --- a/src/blackgui/views/matchingstatisticsview.h +++ b/src/blackgui/views/matchingstatisticsview.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Views { //! Matching statistics - class BLACKGUI_EXPORT CMatchingStatisticsView : public CViewBase + class BLACKGUI_EXPORT CMatchingStatisticsView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/namevariantpairview.h b/src/blackgui/views/namevariantpairview.h index a011d683b..89b41f67e 100644 --- a/src/blackgui/views/namevariantpairview.h +++ b/src/blackgui/views/namevariantpairview.h @@ -27,7 +27,7 @@ namespace BlackGui namespace Views { //! User view - class BLACKGUI_EXPORT CNameVariantPairView : public CViewBase + class BLACKGUI_EXPORT CNameVariantPairView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/serverview.h b/src/blackgui/views/serverview.h index c894c161c..1e463b89d 100644 --- a/src/blackgui/views/serverview.h +++ b/src/blackgui/views/serverview.h @@ -23,7 +23,7 @@ namespace BlackGui namespace Views { //! Network servers - class BLACKGUI_EXPORT CServerView : public CViewBase + class BLACKGUI_EXPORT CServerView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/simulatedaircraftview.h b/src/blackgui/views/simulatedaircraftview.h index 2eb5ce44b..cb24b5274 100644 --- a/src/blackgui/views/simulatedaircraftview.h +++ b/src/blackgui/views/simulatedaircraftview.h @@ -39,7 +39,7 @@ namespace BlackGui { //! Aircraft view class BLACKGUI_EXPORT CSimulatedAircraftView : - public CViewWithCallsignObjects + public CViewWithCallsignObjects { Q_OBJECT diff --git a/src/blackgui/views/statusmessageview.h b/src/blackgui/views/statusmessageview.h index 91660b09b..442ae3904 100644 --- a/src/blackgui/views/statusmessageview.h +++ b/src/blackgui/views/statusmessageview.h @@ -26,7 +26,7 @@ namespace BlackGui namespace Views { //! Status message view - class BLACKGUI_EXPORT CStatusMessageView : public CViewBase + class BLACKGUI_EXPORT CStatusMessageView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/temperaturelayerview.h b/src/blackgui/views/temperaturelayerview.h index ea4575ecc..0afbddd52 100644 --- a/src/blackgui/views/temperaturelayerview.h +++ b/src/blackgui/views/temperaturelayerview.h @@ -25,7 +25,7 @@ namespace BlackGui namespace Views { //! Airports view - class BLACKGUI_EXPORT CTemperatureLayerView : public CViewBase + class BLACKGUI_EXPORT CTemperatureLayerView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/textmessageview.h b/src/blackgui/views/textmessageview.h index c61006819..c22929937 100644 --- a/src/blackgui/views/textmessageview.h +++ b/src/blackgui/views/textmessageview.h @@ -25,7 +25,7 @@ namespace BlackGui namespace Views { //! Airports view - class BLACKGUI_EXPORT CTextMessageView : public CViewBase + class BLACKGUI_EXPORT CTextMessageView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/userview.h b/src/blackgui/views/userview.h index 3eef63ff2..b63166e2a 100644 --- a/src/blackgui/views/userview.h +++ b/src/blackgui/views/userview.h @@ -23,7 +23,7 @@ namespace BlackGui namespace Views { //! User view - class BLACKGUI_EXPORT CUserView : public CViewBase + class BLACKGUI_EXPORT CUserView : public CViewBase { Q_OBJECT diff --git a/src/blackgui/views/viewbase.cpp b/src/blackgui/views/viewbase.cpp index 07cad5cd3..d9c9a40ab 100644 --- a/src/blackgui/views/viewbase.cpp +++ b/src/blackgui/views/viewbase.cpp @@ -33,8 +33,8 @@ namespace BlackGui { namespace Views { - template - CViewBase::CViewBase(QWidget *parent, ModelClass *model) : CViewBaseNonTemplate(parent), m_model(model) + template + CViewBase::CViewBase(QWidget *parent, ModelClass *model) : CViewBaseNonTemplate(parent), m_model(model) { this->setSortingEnabled(true); if (model) @@ -43,8 +43,8 @@ namespace BlackGui } } - template - int CViewBase::updateContainer(const ContainerType &container, bool sort, bool resize) + template + int CViewBase::updateContainer(const ContainerType &container, bool sort, bool resize) { Q_ASSERT_X(m_model, Q_FUNC_INFO, "Missing model"); if (container.isEmpty()) @@ -95,8 +95,8 @@ namespace BlackGui return c; } - template - CWorker *CViewBase::updateContainerAsync(const ContainerType &container, bool sort, bool resize) + template + CWorker *CViewBase::updateContainerAsync(const ContainerType &container, bool sort, bool resize) { // avoid unnecessary effort when empty if (container.isEmpty()) @@ -122,8 +122,8 @@ namespace BlackGui return worker; } - template - void CViewBase::updateContainerMaybeAsync(const ContainerType &container, bool sort, bool resize) + template + void CViewBase::updateContainerMaybeAsync(const ContainerType &container, bool sort, bool resize) { if (container.isEmpty()) { @@ -140,8 +140,8 @@ namespace BlackGui } } - template - void CViewBase::insert(const ObjectType &value, bool resize) + template + void CViewBase::insert(const ObjectType &value, bool resize) { Q_ASSERT(m_model); if (this->rowCount() < 1) @@ -156,8 +156,8 @@ namespace BlackGui } } - template - void CViewBase::insert(const ContainerType &container, bool resize) + template + void CViewBase::insert(const ContainerType &container, bool resize) { Q_ASSERT(m_model); if (this->rowCount() < 1) @@ -172,8 +172,8 @@ namespace BlackGui } } - template - void CViewBase::push_back(const ObjectType &value, bool resize) + template + void CViewBase::push_back(const ObjectType &value, bool resize) { Q_ASSERT(m_model); if (this->rowCount() < 1) @@ -188,8 +188,8 @@ namespace BlackGui } } - template - void CViewBase::push_back(const ContainerType &container, bool resize) + template + void CViewBase::push_back(const ContainerType &container, bool resize) { Q_ASSERT(m_model); if (this->rowCount() < 1) @@ -204,29 +204,29 @@ namespace BlackGui } } - template - const ObjectType &CViewBase::at(const QModelIndex &index) const + template + const typename CViewBase::ObjectType &CViewBase::at(const QModelIndex &index) const { Q_ASSERT(m_model); return m_model->at(index); } - template - const ContainerType &CViewBase::container() const + template + const typename CViewBase::ContainerType &CViewBase::container() const { Q_ASSERT(m_model); return m_model->container(); } - template - const ContainerType &CViewBase::containerOrFilteredContainer(bool *filtered) const + template + const typename CViewBase::ContainerType &CViewBase::containerOrFilteredContainer(bool *filtered) const { Q_ASSERT(m_model); return m_model->containerOrFilteredContainer(filtered); } - template - ContainerType CViewBase::selectedObjects() const + template + typename CViewBase::ContainerType CViewBase::selectedObjects() const { if (!this->hasSelection()) { return ContainerType(); } ContainerType c; @@ -238,8 +238,8 @@ namespace BlackGui return c; } - template - ContainerType CViewBase::unselectedObjects() const + template + typename CViewBase::ContainerType CViewBase::unselectedObjects() const { if (!this->hasSelection()) { return this->containerOrFilteredContainer(); } ContainerType c; @@ -251,8 +251,8 @@ namespace BlackGui return c; } - template - ObjectType CViewBase::firstSelectedOrDefaultObject() const + template + typename CViewBase::ObjectType CViewBase::firstSelectedOrDefaultObject() const { if (this->hasSelection()) { @@ -267,8 +267,8 @@ namespace BlackGui return ObjectType(); } - template - int CViewBase::updateSelected(const CPropertyIndexVariantMap &vm) + template + int CViewBase::updateSelected(const CPropertyIndexVariantMap &vm) { if (vm.isEmpty()) { return 0; } if (!hasSelection()) { return 0; } @@ -306,22 +306,22 @@ namespace BlackGui return c; } - template - int CViewBase::updateSelected(const CVariant &variant, const CPropertyIndex &index) + template + int CViewBase::updateSelected(const CVariant &variant, const CPropertyIndex &index) { const CPropertyIndexVariantMap vm(index, variant); return this->updateSelected(vm); } - template - ObjectType CViewBase::selectedObject() const + template + typename CViewBase::ObjectType CViewBase::selectedObject() const { const ContainerType c = this->selectedObjects(); return c.frontOrDefault(); } - template - int CViewBase::removeSelectedRows() + template + int CViewBase::removeSelectedRows() { if (!this->hasSelection()) { return 0; } if (this->isEmpty()) { return 0; } @@ -348,8 +348,8 @@ namespace BlackGui return delta; } - template - void CViewBase::presizeOrFullResizeToContents() + template + void CViewBase::presizeOrFullResizeToContents() { const int rc = this->rowCount(); if (rc > ResizeSubsetThreshold) @@ -369,15 +369,15 @@ namespace BlackGui } } - template - void CViewBase::clearHighlighting() + template + void CViewBase::clearHighlighting() { Q_ASSERT(m_model); return m_model->clearHighlighting(); } - template - void CViewBase::materializeFilter() + template + void CViewBase::materializeFilter() { Q_ASSERT(m_model); if (!m_model->hasFilter()) { return; } @@ -387,44 +387,44 @@ namespace BlackGui this->updateContainerMaybeAsync(filtered); } - template - void CViewBase::clear() + template + void CViewBase::clear() { Q_ASSERT(m_model); m_model->clear(); this->hideLoadIndicator(); } - template - int CViewBase::rowCount() const + template + int CViewBase::rowCount() const { Q_ASSERT(m_model); return m_model->rowCount(); } - template - int CViewBase::columnCount() const + template + int CViewBase::columnCount() const { Q_ASSERT(m_model); return m_model->columnCount(QModelIndex()); } - template - bool CViewBase::isEmpty() const + template + bool CViewBase::isEmpty() const { Q_ASSERT(m_model); return m_model->rowCount() < 1; } - template - bool CViewBase::isOrderable() const + template + bool CViewBase::isOrderable() const { Q_ASSERT(m_model); return m_model->isOrderable(); } - template - void CViewBase::allowDragDrop(bool allowDrag, bool allowDrop, bool allowDropJsonFile) + template + void CViewBase::allowDragDrop(bool allowDrag, bool allowDrop, bool allowDropJsonFile) { Q_ASSERT(m_model); @@ -436,15 +436,15 @@ namespace BlackGui m_model->allowFileDrop(allowDropJsonFile); } - template - bool CViewBase::isDropAllowed() const + template + bool CViewBase::isDropAllowed() const { Q_ASSERT(m_model); return m_model->isDropAllowed(); } - template - void CViewBase::dropEvent(QDropEvent *event) + template + void CViewBase::dropEvent(QDropEvent *event) { if (m_model && m_model->isJsonFileDropAllowed() && CGuiUtility::isMimeRepresentingReadableJsonFile(event->mimeData())) { @@ -456,43 +456,43 @@ namespace BlackGui CViewBaseNonTemplate::dropEvent(event); } - template - bool CViewBase::acceptDrop(const QMimeData *mimeData) const + template + bool CViewBase::acceptDrop(const QMimeData *mimeData) const { Q_ASSERT(m_model); const bool a = m_model->acceptDrop(mimeData); return a; } - template - bool CViewBase::setSorting(const CPropertyIndex &propertyIndex, Qt::SortOrder order) + template + bool CViewBase::setSorting(const CPropertyIndex &propertyIndex, Qt::SortOrder order) { Q_ASSERT(m_model); return m_model->setSorting(propertyIndex, order); } - template - void CViewBase::sortByPropertyIndex(const CPropertyIndex &propertyIndex, Qt::SortOrder order) + template + void CViewBase::sortByPropertyIndex(const CPropertyIndex &propertyIndex, Qt::SortOrder order) { m_model->sortByPropertyIndex(propertyIndex, order); } - template - QJsonObject CViewBase::toJson(bool selectedOnly) const + template + QJsonObject CViewBase::toJson(bool selectedOnly) const { Q_ASSERT(m_model); return m_model->toJson(selectedOnly); } - template - QString CViewBase::toJsonString(QJsonDocument::JsonFormat format, bool selectedOnly) const + template + QString CViewBase::toJsonString(QJsonDocument::JsonFormat format, bool selectedOnly) const { Q_ASSERT(m_model); return m_model->toJsonString(format, selectedOnly); } - template - void CViewBase::setObjectName(const QString &name) + template + void CViewBase::setObjectName(const QString &name) { // then name here is mainly set for debugging purposes so each model can be identified Q_ASSERT(m_model); @@ -501,33 +501,33 @@ namespace BlackGui m_model->setObjectName(modelName); } - template - void CViewBase::takeFilterOwnership(std::unique_ptr > &filter) + template + void CViewBase::takeFilterOwnership(std::unique_ptr > &filter) { this->derivedModel()->takeFilterOwnership(filter); } - template - void CViewBase::removeFilter() + template + void CViewBase::removeFilter() { this->derivedModel()->removeFilter(); } - template - bool CViewBase::hasFilter() const + template + bool CViewBase::hasFilter() const { return derivedModel()->hasFilter(); } - template - void CViewBase::addContainerTypesAsDropTypes(bool objectType, bool containerType) + template + void CViewBase::addContainerTypesAsDropTypes(bool objectType, bool containerType) { if (objectType) { m_model->addAcceptedMetaTypeId(qMetaTypeId()); } if (containerType) { m_model->addAcceptedMetaTypeId(qMetaTypeId()); } } - template - void CViewBase::initAsOrderable() + template + void CViewBase::initAsOrderable() { Q_ASSERT_X(isOrderable(), Q_FUNC_INFO, "Model not orderable"); this->allowDragDrop(true, true); @@ -536,8 +536,8 @@ namespace BlackGui this->addContainerTypesAsDropTypes(true, true); } - template - void CViewBase::setTabWidgetViewText(QTabWidget *tw, int index) + template + void CViewBase::setTabWidgetViewText(QTabWidget *tw, int index) { if (!tw) { return; } QString o = tw->tabText(index); @@ -546,8 +546,8 @@ namespace BlackGui tw->setTabText(index, o); } - template - void CViewBase::setSortIndicator() + template + void CViewBase::setSortIndicator() { if (m_model->hasValidSortColumn()) { @@ -558,8 +558,8 @@ namespace BlackGui } } - template - void CViewBase::standardInit(ModelClass *model) + template + void CViewBase::standardInit(ModelClass *model) { Q_ASSERT_X(model || m_model, Q_FUNC_INFO, "Missing model"); if (model) @@ -590,15 +590,15 @@ namespace BlackGui this->setSortIndicator(); } - template - bool CViewBase::reachedResizeThreshold(int containerSize) const + template + bool CViewBase::reachedResizeThreshold(int containerSize) const { if (containerSize < 0) { return this->rowCount() > m_skipResizeThreshold; } return containerSize > m_skipResizeThreshold; } - template - void CViewBase::performModeBasedResizeToContent() + template + void CViewBase::performModeBasedResizeToContent() { // small set or large set? This only performs real resizing, no presizing // remark, see also presizeOrFullResizeToContents @@ -612,15 +612,15 @@ namespace BlackGui } } - template - int CViewBase::performUpdateContainer(const BlackMisc::CVariant &variant, bool sort, bool resize) + template + int CViewBase::performUpdateContainer(const BlackMisc::CVariant &variant, bool sort, bool resize) { ContainerType c(variant.to()); return this->updateContainer(c, sort, resize); } - template - void CViewBase::updateSortIndicator() + template + void CViewBase::updateSortIndicator() { if (this->derivedModel()->hasValidSortColumn()) { @@ -630,50 +630,50 @@ namespace BlackGui } } - template - void CViewBase::mouseOverCallback(const QModelIndex &index, bool mouseOver) + template + void CViewBase::mouseOverCallback(const QModelIndex &index, bool mouseOver) { // void Q_UNUSED(index); Q_UNUSED(mouseOver); } - template - void CViewBase::drawDropIndicator(bool indicator) + template + void CViewBase::drawDropIndicator(bool indicator) { m_dropIndicator = indicator; } - template - void CViewBase::selectObjects(const ContainerType &selectedObjects) + template + void CViewBase::selectObjects(const ContainerType &selectedObjects) { Q_UNUSED(selectedObjects); } - template - CStatusMessage CViewBase::modifyLoadedJsonData(ContainerType &data) const + template + CStatusMessage CViewBase::modifyLoadedJsonData(ContainerType &data) const { Q_UNUSED(data); static const CStatusMessage e(this, CStatusMessage::SeverityInfo, "no modification", true); return e; } - template - CStatusMessage CViewBase::validateLoadedJsonData(const ContainerType &data) const + template + CStatusMessage CViewBase::validateLoadedJsonData(const ContainerType &data) const { Q_UNUSED(data); static const CStatusMessage e(this, CStatusMessage::SeverityInfo, "validation passed", true); return e; } - template - void CViewBase::jsonLoadedAndModelUpdated(const ContainerType &data) + template + void CViewBase::jsonLoadedAndModelUpdated(const ContainerType &data) { Q_UNUSED(data); } - template - void CViewBase::customMenu(CMenuActions &menuActions) + template + void CViewBase::customMenu(CMenuActions &menuActions) { CViewBaseNonTemplate::customMenu(menuActions); @@ -684,8 +684,8 @@ namespace BlackGui } } - template - CStatusMessage CViewBase::loadJsonFile(const QString &fileName) + template + CStatusMessage CViewBase::loadJsonFile(const QString &fileName) { CStatusMessage m; do @@ -761,8 +761,8 @@ namespace BlackGui return m; } - template - void CViewBase::displayContainerAsJsonPopup(bool selectedOnly) + template + void CViewBase::displayContainerAsJsonPopup(bool selectedOnly) { const ContainerType container = selectedOnly ? this->selectedObjects() : this->container(); const QString json = container.toJsonString(); @@ -772,8 +772,8 @@ namespace BlackGui this->textEditDialog()->show(); } - template - CStatusMessage CViewBase::ps_loadJson(const QString &directory) + template + CStatusMessage CViewBase::ps_loadJson(const QString &directory) { const QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Load data file"), @@ -782,8 +782,8 @@ namespace BlackGui return this->loadJsonFile(fileName); } - template - CStatusMessage CViewBase::ps_saveJson(bool selectedOnly, const QString &directory) + template + CStatusMessage CViewBase::ps_saveJson(bool selectedOnly, const QString &directory) { const QString fileName = QFileDialog::getSaveFileName(nullptr, tr("Save data file"), @@ -800,8 +800,8 @@ namespace BlackGui CStatusMessage(this, CStatusMessage::SeverityError, "Writing " + fileName + " failed", true); } - template - void CViewBase::copy() + template + void CViewBase::copy() { QClipboard *clipboard = QApplication::clipboard(); if (!clipboard) { return; } @@ -813,16 +813,16 @@ namespace BlackGui clipboard->setText(json); } - template - void CViewBase::cut() + template + void CViewBase::cut() { if (!QApplication::clipboard()) { return; } this->copy(); this->removeSelectedRows(); } - template - void CViewBase::paste() + template + void CViewBase::paste() { const QClipboard *clipboard = QApplication::clipboard(); if (!clipboard) { return; } @@ -844,15 +844,15 @@ namespace BlackGui } } - template - bool CViewBase::ps_filterDialogFinished(int status) + template + bool CViewBase::ps_filterDialogFinished(int status) { QDialog::DialogCode statusCode = static_cast(status); return ps_filterWidgetChangedFilter(statusCode == QDialog::Accepted); } - template - bool CViewBase::ps_filterWidgetChangedFilter(bool enabled) + template + bool CViewBase::ps_filterWidgetChangedFilter(bool enabled) { if (enabled) { @@ -885,30 +885,30 @@ namespace BlackGui return true; // handled } - template - void CViewBase::ps_removeFilter() + template + void CViewBase::ps_removeFilter() { this->derivedModel()->removeFilter(); } - template - void CViewBase::ps_clicked(const QModelIndex &index) + template + void CViewBase::ps_clicked(const QModelIndex &index) { if (!m_acceptClickSelection) { return; } if (!index.isValid()) { return; } emit objectClicked(CVariant::fromValue(at(index))); } - template - void CViewBase::ps_doubleClicked(const QModelIndex &index) + template + void CViewBase::ps_doubleClicked(const QModelIndex &index) { if (!m_acceptDoubleClickSelection) { return; } if (!index.isValid()) { return; } emit objectDoubleClicked(CVariant::fromValue(at(index))); } - template - void CViewBase::ps_rowSelected(const QModelIndex &index) + template + void CViewBase::ps_rowSelected(const QModelIndex &index) { if (!m_acceptRowSelection) { return; } if (!index.isValid()) { return; } diff --git a/src/blackgui/views/viewbase.h b/src/blackgui/views/viewbase.h index e985f408d..3dc52446f 100644 --- a/src/blackgui/views/viewbase.h +++ b/src/blackgui/views/viewbase.h @@ -591,14 +591,23 @@ namespace BlackGui Q_DECLARE_OPERATORS_FOR_FLAGS(BlackGui::Views::CViewBaseNonTemplate::Menu) //! Base class for views - template class CViewBase : + template class CViewBase : public CViewBaseNonTemplate, - public Models::ISelectionModel + public Models::ISelectionModel { // I cannot use Q_OBJECT here, because: Template classes are not supported by Q_OBJECT // and I cannot declare slots as SLOT because I have no Q_OBJECT macro public: + //! Model type + using ModelClass = T; + + //! Model container type + using ContainerType = typename T::ContainerType; + + //! Model container element type + using ObjectType = typename T::ObjectType; + //! Destructor virtual ~CViewBase() { if (m_model) { m_model->markDestroyed(); }} diff --git a/src/blackgui/views/viewbaseaviation.cpp b/src/blackgui/views/viewbaseaviation.cpp index 3d04e67e7..cb1f5501a 100644 --- a/src/blackgui/views/viewbaseaviation.cpp +++ b/src/blackgui/views/viewbaseaviation.cpp @@ -13,14 +13,14 @@ namespace BlackGui { namespace Views { - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; } // namespace } // namespace diff --git a/src/blackgui/views/viewbasemisc.cpp b/src/blackgui/views/viewbasemisc.cpp index 4723f2d23..28888b939 100644 --- a/src/blackgui/views/viewbasemisc.cpp +++ b/src/blackgui/views/viewbasemisc.cpp @@ -13,10 +13,10 @@ namespace BlackGui { namespace Views { - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; } // namespace } // namespace diff --git a/src/blackgui/views/viewbasenetwork.cpp b/src/blackgui/views/viewbasenetwork.cpp index 25f44643a..f1abf7fe1 100644 --- a/src/blackgui/views/viewbasenetwork.cpp +++ b/src/blackgui/views/viewbasenetwork.cpp @@ -13,9 +13,9 @@ namespace BlackGui { namespace Views { - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; } // namespace } // namespace diff --git a/src/blackgui/views/viewbasesimulation.cpp b/src/blackgui/views/viewbasesimulation.cpp index 85a3f5de4..e89a72198 100644 --- a/src/blackgui/views/viewbasesimulation.cpp +++ b/src/blackgui/views/viewbasesimulation.cpp @@ -13,9 +13,9 @@ namespace BlackGui { namespace Views { - template class CViewBase; - template class CViewBase; - template class CViewBase; - template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; } // namespace } // namespace diff --git a/src/blackgui/views/viewbaseweather.cpp b/src/blackgui/views/viewbaseweather.cpp index 46d075903..d670cd883 100644 --- a/src/blackgui/views/viewbaseweather.cpp +++ b/src/blackgui/views/viewbaseweather.cpp @@ -13,8 +13,8 @@ namespace BlackGui { namespace Views { - template class CViewBase; - template class CViewBase; - template class CViewBase; + template class CViewBase; + template class CViewBase; + template class CViewBase; } // namespace } // namespace diff --git a/src/blackgui/views/viewcallsignobjects.cpp b/src/blackgui/views/viewcallsignobjects.cpp index 1c220b3ce..74399c950 100644 --- a/src/blackgui/views/viewcallsignobjects.cpp +++ b/src/blackgui/views/viewcallsignobjects.cpp @@ -29,28 +29,28 @@ namespace BlackGui { namespace Views { - template - CViewWithCallsignObjects::CViewWithCallsignObjects(QWidget *parent) : - CViewBase(parent) + template + CViewWithCallsignObjects::CViewWithCallsignObjects(QWidget *parent) : + CViewBase(parent) { // void } - template - void CViewWithCallsignObjects::selectCallsign(const CCallsign &callsign) + template + void CViewWithCallsignObjects::selectCallsign(const CCallsign &callsign) { const CCallsignSet cs({callsign}); this->selectCallsigns(cs); } - template - void CViewWithCallsignObjects::selectCallsigns(const CCallsignSet &callsigns) + template + void CViewWithCallsignObjects::selectCallsigns(const CCallsignSet &callsigns) { if (callsigns.isEmpty()) { return; } this->clearSelection(); int r = -1; QSet rows; - for (const ObjectType &obj : CViewBase::containerOrFilteredContainer()) + for (const ObjectType &obj : CViewBase::containerOrFilteredContainer()) { r++; if (callsigns.contains(obj.getCallsign())) @@ -61,24 +61,24 @@ namespace BlackGui this->selectRows(rows); } - template - CCallsignSet CViewWithCallsignObjects::selectedCallsigns() const + template + CCallsignSet CViewWithCallsignObjects::selectedCallsigns() const { if (!this->hasSelection()) { return CCallsignSet(); } const ContainerType selected(this->selectedObjects()); return selected.getCallsigns(); } - template - int CViewWithCallsignObjects::removeCallsign(const CCallsign &callsign) + template + int CViewWithCallsignObjects::removeCallsign(const CCallsign &callsign) { if (callsign.isEmpty()) { return 0; } const CCallsignSet set({ callsign }); return this->removeCallsigns(set); } - template - int CViewWithCallsignObjects::removeCallsigns(const CCallsignSet &callsigns) + template + int CViewWithCallsignObjects::removeCallsigns(const CCallsignSet &callsigns) { if (callsigns.isEmpty()) { return 0; } if (this->isEmpty()) { return 0; } @@ -92,8 +92,8 @@ namespace BlackGui return delta; } - template - int CViewWithCallsignObjects::replaceOrAddObjectsByCallsign(const ContainerType &container) + template + int CViewWithCallsignObjects::replaceOrAddObjectsByCallsign(const ContainerType &container) { if (container.isEmpty()) { return 0; } ContainerType copy(this->container()); @@ -103,8 +103,8 @@ namespace BlackGui return c; } - template - int CViewWithCallsignObjects::replaceOrAddObjectByCallsign(const ObjectType &object) + template + int CViewWithCallsignObjects::replaceOrAddObjectByCallsign(const ObjectType &object) { ContainerType copy(this->container()); const int c = copy.replaceOrAddObjectByCallsign(object); @@ -113,8 +113,8 @@ namespace BlackGui return c; } - template - void CViewWithCallsignObjects::selectObjects(const ContainerType &selectedObjects) + template + void CViewWithCallsignObjects::selectObjects(const ContainerType &selectedObjects) { if (!selectedObjects.isEmpty()) { @@ -122,9 +122,9 @@ namespace BlackGui } } - template class CViewWithCallsignObjects; - template class CViewWithCallsignObjects; - template class CViewWithCallsignObjects; + template class CViewWithCallsignObjects; + template class CViewWithCallsignObjects; + template class CViewWithCallsignObjects; } // namespace } // namespace diff --git a/src/blackgui/views/viewcallsignobjects.h b/src/blackgui/views/viewcallsignobjects.h index f77272d3b..c4bbc4aa1 100644 --- a/src/blackgui/views/viewcallsignobjects.h +++ b/src/blackgui/views/viewcallsignobjects.h @@ -29,10 +29,19 @@ namespace BlackGui namespace Views { //! Base class for views with DB objects - template class CViewWithCallsignObjects : - public CViewBase + template class CViewWithCallsignObjects : + public CViewBase { public: + //! Model type + using ModelClass = T; + + //! Model container type + using ContainerType = typename T::ContainerType; + + //! Model container element type + using ObjectType = typename T::ObjectType; + //! Select callsign void selectCallsign(const BlackMisc::Aviation::CCallsign &callsign); diff --git a/src/blackgui/views/viewdbobjects.cpp b/src/blackgui/views/viewdbobjects.cpp index 055519003..e27c5c724 100644 --- a/src/blackgui/views/viewdbobjects.cpp +++ b/src/blackgui/views/viewdbobjects.cpp @@ -40,40 +40,40 @@ namespace BlackGui { namespace Views { - template - CViewWithDbObjects::CViewWithDbObjects(QWidget *parent) : - CViewBase(parent) + template + CViewWithDbObjects::CViewWithDbObjects(QWidget *parent) : + CViewBase(parent) { // void } - template - ObjectType CViewWithDbObjects::latestObject() const + template + typename CViewWithDbObjects::ObjectType CViewWithDbObjects::latestObject() const { return this->container().latestObject(); } - template - ObjectType CViewWithDbObjects::oldestObject() const + template + typename CViewWithDbObjects::ObjectType CViewWithDbObjects::oldestObject() const { return this->container().oldestObject(); } - template - void CViewWithDbObjects::selectDbKey(const KeyType &key) + template + void CViewWithDbObjects::selectDbKey(const KeyType &key) { const QSet set({key}); this->selectDbKeys(set); } - template - void CViewWithDbObjects::selectDbKeys(const QSet &keys) + template + void CViewWithDbObjects::selectDbKeys(const QSet &keys) { if (keys.isEmpty()) { return; } this->clearSelection(); int r = -1; QSet rows; - for (const ObjectType &obj : CViewBase::containerOrFilteredContainer()) + for (const ObjectType &obj : CViewBase::containerOrFilteredContainer()) { r++; if (!obj.hasValidDbKey()) { continue; } @@ -85,16 +85,16 @@ namespace BlackGui this->selectRows(rows); } - template - QSet CViewWithDbObjects::selectedDbKeys() const + template + QSet::KeyType> CViewWithDbObjects::selectedDbKeys() const { if (!this->hasSelection()) { return QSet(); } const ContainerType selected(this->selectedObjects()); return selected.toDbKeySet(); } - template - int CViewWithDbObjects::removeDbKeys(const QSet &keys) + template + int CViewWithDbObjects::removeDbKeys(const QSet &keys) { if (keys.isEmpty()) { return 0; } if (this->isEmpty()) { return 0; } @@ -108,8 +108,8 @@ namespace BlackGui return delta; } - template - int CViewWithDbObjects::replaceOrAddObjectsByKey(const ContainerType &container) + template + int CViewWithDbObjects::replaceOrAddObjectsByKey(const ContainerType &container) { if (container.isEmpty()) { return 0; } ContainerType copy(this->container()); @@ -119,21 +119,21 @@ namespace BlackGui return c; } - template - void CViewWithDbObjects::customMenu(Menus::CMenuActions &menuActions) + template + void CViewWithDbObjects::customMenu(Menus::CMenuActions &menuActions) { - CViewBase::customMenu(menuActions); + CViewBase::customMenu(menuActions); } - template - COrderableViewWithDbObjects::COrderableViewWithDbObjects(QWidget *parent) : - CViewWithDbObjects::CViewWithDbObjects(parent) + template + COrderableViewWithDbObjects::COrderableViewWithDbObjects(QWidget *parent) : + CViewWithDbObjects::CViewWithDbObjects(parent) { // void } - template - void COrderableViewWithDbObjects::customMenu(CMenuActions &menuActions) + template + void COrderableViewWithDbObjects::customMenu(CMenuActions &menuActions) { if (this->m_menus.testFlag(CViewBaseNonTemplate::MenuOrderable) && this->hasSelection()) { @@ -162,7 +162,7 @@ namespace BlackGui m_leOrder->setValidator(m_validator); QWidgetAction *orderAction = new QWidgetAction(this); orderAction->setDefaultWidget(m_frame); - QObject::connect(m_leOrder, &QLineEdit::returnPressed, this, &COrderableViewWithDbObjects::orderToLineEdit); + QObject::connect(m_leOrder, &QLineEdit::returnPressed, this, &COrderableViewWithDbObjects::orderToLineEdit); m_menuActions[0] = orderAction; } } @@ -171,15 +171,15 @@ namespace BlackGui m_leOrder->setPlaceholderText("New order 0-" + QString::number(maxOrder)); menuActions.addAction(m_menuActions[0], CMenuAction::pathViewOrder()); - m_menuActions[1] = menuActions.addAction(CIcons::arrowMediumNorth16(), "To top", CMenuAction::pathViewOrder(), { this, &COrderableViewWithDbObjects::orderToTop }); - m_menuActions[2] = menuActions.addAction(CIcons::arrowMediumSouth16(), "To bottom", CMenuAction::pathViewOrder(), { this, &COrderableViewWithDbObjects::orderToBottom }); - m_menuActions[3] = menuActions.addAction(CIcons::arrowMediumWest16(), "Freeze current order", CMenuAction::pathViewOrder(), { this, &COrderableViewWithDbObjects::freezeCurrentOrder }); + m_menuActions[1] = menuActions.addAction(CIcons::arrowMediumNorth16(), "To top", CMenuAction::pathViewOrder(), { this, &COrderableViewWithDbObjects::orderToTop }); + m_menuActions[2] = menuActions.addAction(CIcons::arrowMediumSouth16(), "To bottom", CMenuAction::pathViewOrder(), { this, &COrderableViewWithDbObjects::orderToBottom }); + m_menuActions[3] = menuActions.addAction(CIcons::arrowMediumWest16(), "Freeze current order", CMenuAction::pathViewOrder(), { this, &COrderableViewWithDbObjects::freezeCurrentOrder }); } - CViewWithDbObjects::customMenu(menuActions); + CViewWithDbObjects::customMenu(menuActions); } - template - void COrderableViewWithDbObjects::selectObjects(const ContainerType &selectedObjects) + template + void COrderableViewWithDbObjects::selectObjects(const ContainerType &selectedObjects) { if (!selectedObjects.isEmpty()) { @@ -187,8 +187,8 @@ namespace BlackGui } } - template - void COrderableViewWithDbObjects::moveSelectedItems(int order) + template + void COrderableViewWithDbObjects::moveSelectedItems(int order) { if (this->isEmpty()) { return; } const ContainerType objs(this->selectedObjects()); @@ -196,14 +196,14 @@ namespace BlackGui this->m_model->moveItems(objs, order); } - template - void COrderableViewWithDbObjects::orderToTop() + template + void COrderableViewWithDbObjects::orderToTop() { this->moveSelectedItems(0); } - template - void COrderableViewWithDbObjects::orderToBottom() + template + void COrderableViewWithDbObjects::orderToBottom() { int c = this->model()->rowCount() - 1; if (c >= 0) @@ -212,8 +212,8 @@ namespace BlackGui } } - template - void COrderableViewWithDbObjects::orderToLineEdit() + template + void COrderableViewWithDbObjects::orderToLineEdit() { if (this->isEmpty()) { return; } QLineEdit *le = qobject_cast(QObject::sender()); @@ -222,8 +222,8 @@ namespace BlackGui this->moveSelectedItems(order); } - template - void COrderableViewWithDbObjects::freezeCurrentOrder() + template + void COrderableViewWithDbObjects::freezeCurrentOrder() { ContainerType objects = this->container(); objects.freezeOrder(); @@ -232,14 +232,14 @@ namespace BlackGui // see here for the reason of thess forward instantiations // https://isocpp.org/wiki/faq/templates#separate-template-fn-defn-from-decl - template class CViewWithDbObjects; - template class CViewWithDbObjects; - template class CViewWithDbObjects; - template class CViewWithDbObjects; - template class CViewWithDbObjects; - template class CViewWithDbObjects; - template class COrderableViewWithDbObjects; - template class COrderableViewWithDbObjects; + template class CViewWithDbObjects; + template class CViewWithDbObjects; + template class CViewWithDbObjects; + template class CViewWithDbObjects; + template class CViewWithDbObjects; + template class CViewWithDbObjects; + template class COrderableViewWithDbObjects; + template class COrderableViewWithDbObjects; } // namespace } // namespace diff --git a/src/blackgui/views/viewdbobjects.h b/src/blackgui/views/viewdbobjects.h index 9d628616b..31adf799b 100644 --- a/src/blackgui/views/viewdbobjects.h +++ b/src/blackgui/views/viewdbobjects.h @@ -30,10 +30,22 @@ namespace BlackGui namespace Views { //! Base class for views with DB objects - template class CViewWithDbObjects : - public CViewBase + template class CViewWithDbObjects : + public CViewBase { public: + //! Model type + using ModelClass = T; + + //! Model container type + using ContainerType = typename T::ContainerType; + + //! Model container element type + using ObjectType = typename T::ObjectType; + + //! Model DB key type + using KeyType = typename T::KeyType; + //! Get latest object ObjectType latestObject() const; @@ -64,9 +76,22 @@ namespace BlackGui }; //! Base class for views with DB objects also orderable (based on BlackMisc::IOrderableList ) - template class COrderableViewWithDbObjects : - public CViewWithDbObjects + template class COrderableViewWithDbObjects : + public CViewWithDbObjects { + public: + //! Model type + using ModelClass = T; + + //! Model container type + using ContainerType = typename T::ContainerType; + + //! Model container element type + using ObjectType = typename T::ObjectType; + + //! Model DB key type + using KeyType = typename T::KeyType; + protected: //! Constructor explicit COrderableViewWithDbObjects(QWidget *parent = nullptr); diff --git a/src/blackgui/views/viewtimestampobjects.cpp b/src/blackgui/views/viewtimestampobjects.cpp index 8a3609d08..426681e1e 100644 --- a/src/blackgui/views/viewtimestampobjects.cpp +++ b/src/blackgui/views/viewtimestampobjects.cpp @@ -22,22 +22,22 @@ namespace BlackGui { namespace Views { - template - void CViewWithTimestampWithOffsetObjects::push_frontKeepLatestAdjustedFirst(const ObjectType &object, int max) + template + void CViewWithTimestampWithOffsetObjects::push_frontKeepLatestAdjustedFirst(const ObjectType &object, int max) { this->derivedModel()->push_frontKeepLatestAdjustedFirst(object, max); } - template - CViewWithTimestampWithOffsetObjects::CViewWithTimestampWithOffsetObjects(QWidget *parent) : - CViewBase(parent) + template + CViewWithTimestampWithOffsetObjects::CViewWithTimestampWithOffsetObjects(QWidget *parent) : + CViewBase(parent) { // void } - template class CViewWithTimestampWithOffsetObjects; - template class CViewWithTimestampWithOffsetObjects; - template class CViewWithTimestampWithOffsetObjects; + template class CViewWithTimestampWithOffsetObjects; + template class CViewWithTimestampWithOffsetObjects; + template class CViewWithTimestampWithOffsetObjects; } // namespace } // namespace diff --git a/src/blackgui/views/viewtimestampobjects.h b/src/blackgui/views/viewtimestampobjects.h index 6d6164fb1..5bee07167 100644 --- a/src/blackgui/views/viewtimestampobjects.h +++ b/src/blackgui/views/viewtimestampobjects.h @@ -23,10 +23,19 @@ namespace BlackGui namespace Views { //! Base class for views timestamp offset objects - template class CViewWithTimestampWithOffsetObjects : - public CViewBase + template class CViewWithTimestampWithOffsetObjects : + public CViewBase { public: + //! Model type + using ModelClass = T; + + //! Model container type + using ContainerType = typename T::ContainerType; + + //! Model container element type + using ObjectType = typename T::ObjectType; + //! Insert as first element by keeping maxElements and the latest first void push_frontKeepLatestAdjustedFirst(const ObjectType &object, int max); diff --git a/src/blackgui/views/windlayerview.h b/src/blackgui/views/windlayerview.h index ccf997643..9a45cf26c 100644 --- a/src/blackgui/views/windlayerview.h +++ b/src/blackgui/views/windlayerview.h @@ -24,7 +24,7 @@ namespace BlackGui namespace Views { //! Wind layer view - class BLACKGUI_EXPORT CWindLayerView : public CViewBase + class BLACKGUI_EXPORT CWindLayerView : public CViewBase { Q_OBJECT