mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-08-06 01:06:31 +08:00
refactor: Remove unused weather models/views
This commit is contained in:
@@ -34,11 +34,9 @@ add_library(gui SHARED
|
||||
models/distributorfilter.cpp
|
||||
models/columns.h
|
||||
models/aircraftsituationchangelistmodel.h
|
||||
models/windlayerlistmodel.h
|
||||
models/actionhotkeylistmodel.cpp
|
||||
models/listmodelbaseaviation.cpp
|
||||
models/interpolationsetupmodel.cpp
|
||||
models/windlayerlistmodel.cpp
|
||||
models/matchingstatisticsmodel.h
|
||||
models/modelfilter.cpp
|
||||
models/aircrafticaolistmodel.cpp
|
||||
@@ -82,7 +80,6 @@ add_library(gui SHARED
|
||||
models/clientlistmodel.cpp
|
||||
models/aircrafticaofilter.h
|
||||
models/atcstationlistmodel.cpp
|
||||
models/cloudlayerlistmodel.cpp
|
||||
models/simulatedaircraftlistmodel.h
|
||||
models/statusmessagelistmodel.h
|
||||
models/aircraftcategorytreemodel.cpp
|
||||
@@ -105,7 +102,6 @@ add_library(gui SHARED
|
||||
models/applicationinfolistmodel.h
|
||||
models/identifierlistmodel.h
|
||||
models/modelfilter.h
|
||||
models/cloudlayerlistmodel.h
|
||||
models/userlistmodel.cpp
|
||||
models/airportlistmodel.cpp
|
||||
models/actionhotkeylistmodel.h
|
||||
@@ -116,16 +112,13 @@ add_library(gui SHARED
|
||||
models/atcstationlistmodel.h
|
||||
enableforviewbasedindicator.h
|
||||
pluginconfigwindow.h
|
||||
views/cloudlayerview.cpp
|
||||
views/interpolationsetupview.cpp
|
||||
views/userview.h
|
||||
views/aircraftcategorytreeview.h
|
||||
views/windlayerview.h
|
||||
views/viewtimestampobjects.cpp
|
||||
views/aircrafticaoview.h
|
||||
views/viewbase.h
|
||||
views/viewbasemisc.cpp
|
||||
views/windlayerview.cpp
|
||||
views/distributorview.h
|
||||
views/checkboxdelegate.cpp
|
||||
views/viewbaseproxystyle.cpp
|
||||
@@ -171,7 +164,6 @@ add_library(gui SHARED
|
||||
views/aircraftmodelstatisticsdialog.ui
|
||||
views/aircraftmodelstatisticsdialog.h
|
||||
views/audiodeviceinfoview.cpp
|
||||
views/viewbaseweather.cpp
|
||||
views/clientview.cpp
|
||||
views/viewbaseitemdelegate.cpp
|
||||
views/aircraftsituationchangeview.cpp
|
||||
@@ -199,7 +191,6 @@ add_library(gui SHARED
|
||||
views/radarview.cpp
|
||||
views/liveryview.cpp
|
||||
views/viewbasesimulation.cpp
|
||||
views/cloudlayerview.h
|
||||
views/countryview.cpp
|
||||
views/liveryview.h
|
||||
views/flightplandialog.cpp
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "gui/models/cloudlayerlistmodel.h"
|
||||
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "gui/models/columnformatters.h"
|
||||
|
||||
using namespace swift::misc;
|
||||
using namespace swift::misc::physical_quantities;
|
||||
using namespace swift::misc::weather;
|
||||
|
||||
namespace swift::gui::models
|
||||
{
|
||||
|
||||
//! Relative Humidity
|
||||
class CPrecipitationRateFormatter : public CDefaultFormatter
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CPrecipitationRateFormatter(int alignment = alignDefault()) : CDefaultFormatter(alignment, false, roleDisplay())
|
||||
{}
|
||||
|
||||
//! \copydoc CDefaultFormatter::displayRole
|
||||
virtual CVariant displayRole(const CVariant &dataCVariant) const override
|
||||
{
|
||||
if (dataCVariant.canConvert<double>())
|
||||
{
|
||||
double rate = dataCVariant.value<double>();
|
||||
QString formattedString = QString::number(rate) + " mm/h";
|
||||
return formattedString;
|
||||
}
|
||||
Q_ASSERT_X(false, "CPrecipitationRateFormatter", "no double value");
|
||||
return CVariant();
|
||||
}
|
||||
};
|
||||
|
||||
//! Precipitation
|
||||
class CPrecipitationFormatter : public CDefaultFormatter
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CPrecipitationFormatter(int alignment = alignDefault()) : CDefaultFormatter(alignment, false, roleDisplay()) {}
|
||||
|
||||
//! \copydoc CDefaultFormatter::displayRole
|
||||
virtual CVariant displayRole(const CVariant &dataCVariant) const override
|
||||
{
|
||||
if (dataCVariant.canConvert<CCloudLayer::Precipitation>())
|
||||
{
|
||||
CCloudLayer::Precipitation precipitation = dataCVariant.value<CCloudLayer::Precipitation>();
|
||||
switch (precipitation)
|
||||
{
|
||||
case CCloudLayer::PrecipitationUnknown: return QString("Unknown");
|
||||
case CCloudLayer::NoPrecipitation: return QString("None");
|
||||
case CCloudLayer::Rain: return QString("Rain");
|
||||
case CCloudLayer::Snow: return QString("Snow");
|
||||
}
|
||||
}
|
||||
Q_ASSERT_X(false, "CPrecipitationFormatter", "no CCloudLayer::Precipitation value");
|
||||
return CVariant();
|
||||
}
|
||||
};
|
||||
|
||||
//! Clouds
|
||||
class CCloudsFormatter : public CDefaultFormatter
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CCloudsFormatter(int alignment = alignDefault()) : CDefaultFormatter(alignment, false, roleDisplay()) {}
|
||||
|
||||
//! \copydoc CDefaultFormatter::displayRole
|
||||
virtual CVariant displayRole(const CVariant &dataCVariant) const override
|
||||
{
|
||||
if (dataCVariant.canConvert<CCloudLayer::Clouds>())
|
||||
{
|
||||
CCloudLayer::Clouds clouds = dataCVariant.value<CCloudLayer::Clouds>();
|
||||
switch (clouds)
|
||||
{
|
||||
case CCloudLayer::NoClouds: return QString("None");
|
||||
case CCloudLayer::Cirrus: return QString("Cirrus");
|
||||
case CCloudLayer::Stratus: return QString("Stratus");
|
||||
case CCloudLayer::Cumulus: return QString("Cumulus");
|
||||
case CCloudLayer::Thunderstorm: return QString("Thunderstorm");
|
||||
case CCloudLayer::CloudsUnknown: return QString("N/A");
|
||||
}
|
||||
}
|
||||
Q_ASSERT_X(false, "CCloudsFormatter", "no CCloudLayer::Clouds value");
|
||||
return CVariant();
|
||||
}
|
||||
};
|
||||
|
||||
//! Relative Humidity
|
||||
class CCoverageFormatter : public CDefaultFormatter
|
||||
{
|
||||
public:
|
||||
//! Constructor
|
||||
CCoverageFormatter(int alignment = alignDefault()) : CDefaultFormatter(alignment, false, roleDisplay()) {}
|
||||
|
||||
//! \copydoc CDefaultFormatter::displayRole
|
||||
virtual CVariant displayRole(const CVariant &dataCVariant) const override
|
||||
{
|
||||
if (dataCVariant.canConvert<int>())
|
||||
{
|
||||
int coverage = dataCVariant.value<int>();
|
||||
QString formattedString = QString::number(coverage) + " %";
|
||||
return formattedString;
|
||||
}
|
||||
Q_ASSERT_X(false, "CCoverageFormatter", "no int value");
|
||||
return CVariant();
|
||||
}
|
||||
};
|
||||
|
||||
CCloudLayerListModel::CCloudLayerListModel(QObject *parent) : CListModelBase("CloudLayerListModel", parent)
|
||||
{
|
||||
this->m_columns.addColumn(CColumn("base", CCloudLayer::IndexBase, new CAltitudeFormatter()));
|
||||
this->m_columns.addColumn(CColumn("top", CCloudLayer::IndexTop, new CAltitudeFormatter()));
|
||||
this->m_columns.addColumn(
|
||||
CColumn("precipitation rate", CCloudLayer::IndexPrecipitationRate, new CPrecipitationRateFormatter()));
|
||||
this->m_columns.addColumn(
|
||||
CColumn("precipitation", CCloudLayer::IndexPrecipitation, new CPrecipitationFormatter()));
|
||||
this->m_columns.addColumn(CColumn("clouds", CCloudLayer::IndexClouds, new CCloudsFormatter()));
|
||||
this->m_columns.addColumn(CColumn("coverage", CCloudLayer::IndexCoveragePercent, new CCoverageFormatter()));
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CCloudLayer::IndexBase);
|
||||
this->m_sortOrder = Qt::AscendingOrder;
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ModelCloudLayerList", "base");
|
||||
(void)QT_TRANSLATE_NOOP("ModelCloudLayerList", "top");
|
||||
(void)QT_TRANSLATE_NOOP("ModelCloudLayerList", "precipitation rate");
|
||||
(void)QT_TRANSLATE_NOOP("ModelCloudLayerList", "precipitation");
|
||||
(void)QT_TRANSLATE_NOOP("ModelCloudLayerList", "clouds");
|
||||
(void)QT_TRANSLATE_NOOP("ModelCloudLayerList", "coverage");
|
||||
}
|
||||
} // namespace swift::gui::models
|
||||
@@ -1,31 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef SWIFT_GUI_MODELS_CLOUDLAYERLISTMODEL_H
|
||||
#define SWIFT_GUI_MODELS_CLOUDLAYERLISTMODEL_H
|
||||
|
||||
#include "gui/models/listmodelbase.h"
|
||||
#include "gui/swiftguiexport.h"
|
||||
#include "misc/weather/cloudlayer.h"
|
||||
#include "misc/weather/cloudlayerlist.h"
|
||||
|
||||
class QObject;
|
||||
|
||||
namespace swift::gui::models
|
||||
{
|
||||
//! Cloud layer list model
|
||||
class SWIFT_GUI_EXPORT CCloudLayerListModel : public CListModelBase<swift::misc::weather::CCloudLayerList, false>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CCloudLayerListModel(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CCloudLayerListModel() {}
|
||||
};
|
||||
} // namespace swift::gui::models
|
||||
#endif // SWIFT_GUI_MODELS_CLOUDLAYERLISTMODEL_H
|
||||
@@ -1,34 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "windlayerlistmodel.h"
|
||||
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "gui/models/columnformatters.h"
|
||||
|
||||
using namespace swift::misc;
|
||||
using namespace swift::misc::physical_quantities;
|
||||
using namespace swift::misc::weather;
|
||||
|
||||
namespace swift::gui::models
|
||||
{
|
||||
CWindLayerListModel::CWindLayerListModel(QObject *parent) : CListModelBase("WindLayerListModel", parent)
|
||||
{
|
||||
m_columns.addColumn(CColumn("level", CWindLayer::IndexLevel, new CAltitudeFormatter()));
|
||||
m_columns.addColumn(CColumn("direction", CWindLayer::IndexDirection, new CAngleDegreeFormatter()));
|
||||
m_columns.addColumn(CColumn("speed", CWindLayer::IndexSpeed, new CSpeedKtsFormatter()));
|
||||
m_columns.addColumn(CColumn("gust speed", CWindLayer::IndexGustSpeed, new CSpeedKtsFormatter()));
|
||||
|
||||
// default sort order
|
||||
this->setSortColumnByPropertyIndex(CWindLayer::IndexLevel);
|
||||
m_sortOrder = Qt::AscendingOrder;
|
||||
|
||||
// force strings for translation in resource files
|
||||
(void)QT_TRANSLATE_NOOP("ModelWindLayerList", "level");
|
||||
(void)QT_TRANSLATE_NOOP("ModelWindLayerList", "direction");
|
||||
(void)QT_TRANSLATE_NOOP("ModelWindLayerList", "speed");
|
||||
(void)QT_TRANSLATE_NOOP("ModelWindLayerList", "gust speed");
|
||||
}
|
||||
} // namespace swift::gui::models
|
||||
@@ -1,31 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef SWIFT_GUI_MODELS_WINDLAYERLISTMODEL_H
|
||||
#define SWIFT_GUI_MODELS_WINDLAYERLISTMODEL_H
|
||||
|
||||
#include "gui/models/listmodelbase.h"
|
||||
#include "gui/swiftguiexport.h"
|
||||
#include "misc/weather/windlayer.h"
|
||||
#include "misc/weather/windlayerlist.h"
|
||||
|
||||
class QObject;
|
||||
|
||||
namespace swift::gui::models
|
||||
{
|
||||
//! Wind layer list model
|
||||
class SWIFT_GUI_EXPORT CWindLayerListModel : public CListModelBase<swift::misc::weather::CWindLayerList, false>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CWindLayerListModel(QObject *parent = nullptr);
|
||||
|
||||
//! Destructor
|
||||
virtual ~CWindLayerListModel() {}
|
||||
};
|
||||
} // namespace swift::gui::models
|
||||
#endif // SWIFT_GUI_MODELS_WINDLAYERLISTMODEL_H
|
||||
@@ -1,17 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "gui/views/cloudlayerview.h"
|
||||
|
||||
#include "gui/models/cloudlayerlistmodel.h"
|
||||
|
||||
using namespace swift::misc;
|
||||
using namespace swift::gui::models;
|
||||
|
||||
namespace swift::gui::views
|
||||
{
|
||||
CCloudLayerView::CCloudLayerView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
this->standardInit(new CCloudLayerListModel(this));
|
||||
}
|
||||
} // namespace swift::gui::views
|
||||
@@ -1,32 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef SWIFT_GUI_CLOUDLAYERVIEW_H
|
||||
#define SWIFT_GUI_CLOUDLAYERVIEW_H
|
||||
|
||||
#include "gui/models/cloudlayerlistmodel.h"
|
||||
#include "gui/swiftguiexport.h"
|
||||
#include "gui/views/viewbase.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace swift::misc::weather
|
||||
{
|
||||
class CCloudLayer;
|
||||
}
|
||||
|
||||
namespace swift::gui::views
|
||||
{
|
||||
//! Airports view
|
||||
class SWIFT_GUI_EXPORT CCloudLayerView : public CViewBase<models::CCloudLayerListModel>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CCloudLayerView(QWidget *parent = nullptr);
|
||||
};
|
||||
} // namespace swift::gui::views
|
||||
#endif // SWIFT_GUI_CLOUDLAYERVIEW_H
|
||||
@@ -1,10 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2018 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "viewbase.cpp"
|
||||
|
||||
namespace swift::gui::views
|
||||
{
|
||||
template class CViewBase<swift::gui::models::CCloudLayerListModel>;
|
||||
template class CViewBase<swift::gui::models::CWindLayerListModel>;
|
||||
} // namespace swift::gui::views
|
||||
@@ -1,17 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2013 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
#include "gui/views/windlayerview.h"
|
||||
|
||||
#include "gui/models/windlayerlistmodel.h"
|
||||
|
||||
using namespace swift::misc;
|
||||
using namespace swift::gui::models;
|
||||
|
||||
namespace swift::gui::views
|
||||
{
|
||||
CWindLayerView::CWindLayerView(QWidget *parent) : CViewBase(parent)
|
||||
{
|
||||
this->standardInit(new CWindLayerListModel(this));
|
||||
}
|
||||
} // namespace swift::gui::views
|
||||
@@ -1,31 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef SWIFT_GUI_WINDLAYERVIEW_H
|
||||
#define SWIFT_GUI_WINDLAYERVIEW_H
|
||||
|
||||
#include "gui/models/windlayerlistmodel.h"
|
||||
#include "gui/swiftguiexport.h"
|
||||
#include "gui/views/viewbase.h"
|
||||
|
||||
class QWidget;
|
||||
|
||||
namespace swift::misc::weather
|
||||
{
|
||||
class CWindLayer;
|
||||
}
|
||||
namespace swift::gui::views
|
||||
{
|
||||
//! Wind layer view
|
||||
class SWIFT_GUI_EXPORT CWindLayerView : public CViewBase<models::CWindLayerListModel>
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//! Constructor
|
||||
explicit CWindLayerView(QWidget *parent = nullptr);
|
||||
};
|
||||
} // namespace swift::gui::views
|
||||
#endif // SWIFT_GUI_WINDLAYERVIEW_H
|
||||
Reference in New Issue
Block a user